linxk 1 mese fa
commit
1c74b12b1c
100 ha cambiato i file con 7750 aggiunte e 0 eliminazioni
  1. 27 0
      .gitignore
  2. 1 0
      README.md
  3. 1 0
      deploy.bat
  4. 1 0
      eclipse.bat
  5. 1 0
      install.bat
  6. 62 0
      operating-api/pom.xml
  7. 121 0
      operating-api/src/main/java/com/txz/operating/dto/AppModuleDTO.java
  8. 163 0
      operating-api/src/main/java/com/txz/operating/dto/ConfigDTO.java
  9. 121 0
      operating-api/src/main/java/com/txz/operating/dto/DubboServiceDTO.java
  10. 266 0
      operating-api/src/main/java/com/txz/operating/dto/ErrorCodeDTO.java
  11. 205 0
      operating-api/src/main/java/com/txz/operating/dto/InterfacePmtDTO.java
  12. 518 0
      operating-api/src/main/java/com/txz/operating/dto/InterfacesDTO.java
  13. 58 0
      operating-api/src/main/java/com/txz/operating/dto/ModuleDTO.java
  14. 311 0
      operating-api/src/main/java/com/txz/operating/dto/NoticeDTO.java
  15. 46 0
      operating-api/src/main/java/com/txz/operating/dto/PageDto.java
  16. 30 0
      operating-api/src/main/java/com/txz/operating/dto/award/AwardBizTypeEnum.java
  17. 36 0
      operating-api/src/main/java/com/txz/operating/dto/award/AwardCoinDTO.java
  18. 41 0
      operating-api/src/main/java/com/txz/operating/dto/award/AwardMenuDTO.java
  19. 25 0
      operating-api/src/main/java/com/txz/operating/dto/award/AwardRequestDTO.java
  20. 58 0
      operating-api/src/main/java/com/txz/operating/dto/award/AwardResultDTO.java
  21. 24 0
      operating-api/src/main/java/com/txz/operating/dto/award/AwardResultMenuDTO.java
  22. 23 0
      operating-api/src/main/java/com/txz/operating/dto/award/VoiceDTO.java
  23. 39 0
      operating-api/src/main/java/com/txz/operating/dto/rank/RequestMedianScoreByRankDto.java
  24. 51 0
      operating-api/src/main/java/com/txz/operating/dto/rank/RequestRankDto.java
  25. 27 0
      operating-api/src/main/java/com/txz/operating/dto/rank/ResponseRankIntro.java
  26. 39 0
      operating-api/src/main/java/com/txz/operating/dto/rank/ResponseUserRankDetailDTO.java
  27. 26 0
      operating-api/src/main/java/com/txz/operating/dto/rank/ResponseUserScore.java
  28. 22 0
      operating-api/src/main/java/com/txz/operating/mq/OperatingMqBizCodeEnum.java
  29. 31 0
      operating-api/src/main/java/com/txz/operating/mq/OperatingMqMessage.java
  30. 102 0
      operating-api/src/main/java/com/txz/operating/result/Result.java
  31. 26 0
      operating-api/src/main/java/com/txz/operating/service/IOperatingMedianScoreDubboService.java
  32. 70 0
      operating-api/src/main/java/com/txz/operating/service/IOperatingRankDubboService.java
  33. 19 0
      operating-api/src/main/java/com/txz/operating/service/OperatingConfigDubboService.java
  34. 23 0
      operating-api/src/main/java/com/txz/operating/service/OperatingInterfacesDubboService.java
  35. 16 0
      operating-api/src/main/resources/i18n/error.properties
  36. 16 0
      operating-api/src/main/resources/i18n/error_in_ID.properties
  37. 142 0
      operating-service/pom.xml
  38. 19 0
      operating-service/src/main/java/com/txz/operating/FeignConfiguration.java
  39. 54 0
      operating-service/src/main/java/com/txz/operating/OperatingApplication.java
  40. 43 0
      operating-service/src/main/java/com/txz/operating/configurer/HeaderAttribute.java
  41. 46 0
      operating-service/src/main/java/com/txz/operating/configurer/IpConfiguration.java
  42. 252 0
      operating-service/src/main/java/com/txz/operating/configurer/MyWebMvcConfigurer.java
  43. 49 0
      operating-service/src/main/java/com/txz/operating/configurer/MybatisConfigurer.java
  44. 96 0
      operating-service/src/main/java/com/txz/operating/configurer/Parameters.java
  45. 21 0
      operating-service/src/main/java/com/txz/operating/configurer/RibbonWeightedResponseTimeRuleConfig.java
  46. 56 0
      operating-service/src/main/java/com/txz/operating/configurer/StartLoadConfig.java
  47. 65 0
      operating-service/src/main/java/com/txz/operating/configurer/SwaggerConfig.java
  48. 101 0
      operating-service/src/main/java/com/txz/operating/configurer/log/WebLogAspect.java
  49. 49 0
      operating-service/src/main/java/com/txz/operating/configurer/shutdown/GracefulShutdownUndertow.java
  50. 29 0
      operating-service/src/main/java/com/txz/operating/configurer/shutdown/GracefulShutdownUndertowWrapper.java
  51. 27 0
      operating-service/src/main/java/com/txz/operating/configurer/shutdown/UndertowExtraConfiguration.java
  52. 16 0
      operating-service/src/main/java/com/txz/operating/constants/MyConstants.java
  53. 38 0
      operating-service/src/main/java/com/txz/operating/constants/RedisConstants.java
  54. 84 0
      operating-service/src/main/java/com/txz/operating/core/AbstractService.java
  55. 17 0
      operating-service/src/main/java/com/txz/operating/core/Mapper.java
  56. 47 0
      operating-service/src/main/java/com/txz/operating/core/MessageTemplteType.java
  57. 41 0
      operating-service/src/main/java/com/txz/operating/core/MyPageInfo.java
  58. 29 0
      operating-service/src/main/java/com/txz/operating/core/ProjectConstant.java
  59. 542 0
      operating-service/src/main/java/com/txz/operating/core/RedisUtil.java
  60. 138 0
      operating-service/src/main/java/com/txz/operating/core/ResultCode.java
  61. 37 0
      operating-service/src/main/java/com/txz/operating/core/ResultGenerator.java
  62. 22 0
      operating-service/src/main/java/com/txz/operating/core/Service.java
  63. 29 0
      operating-service/src/main/java/com/txz/operating/core/ServiceException.java
  64. 57 0
      operating-service/src/main/java/com/txz/operating/core/SmsTempletType.java
  65. 34 0
      operating-service/src/main/java/com/txz/operating/core/cache/CacheKey.java
  66. 38 0
      operating-service/src/main/java/com/txz/operating/core/cache/CacheType.java
  67. 35 0
      operating-service/src/main/java/com/txz/operating/core/cache/lock/AbstractDistributedLock.java
  68. 93 0
      operating-service/src/main/java/com/txz/operating/core/cache/lock/DistributedLock.java
  69. 101 0
      operating-service/src/main/java/com/txz/operating/core/cache/lock/RedisDistributedLock.java
  70. 7 0
      operating-service/src/main/java/com/txz/operating/dao/AppModuleMapper.java
  71. 7 0
      operating-service/src/main/java/com/txz/operating/dao/ConfigMapper.java
  72. 7 0
      operating-service/src/main/java/com/txz/operating/dao/ErrorCodeMapper.java
  73. 7 0
      operating-service/src/main/java/com/txz/operating/dao/InterfacePmtMapper.java
  74. 7 0
      operating-service/src/main/java/com/txz/operating/dao/InterfacesMapper.java
  75. 7 0
      operating-service/src/main/java/com/txz/operating/dao/NoticeMapper.java
  76. 82 0
      operating-service/src/main/java/com/txz/operating/dubbo/client/UserDubboServiceClient.java
  77. 33 0
      operating-service/src/main/java/com/txz/operating/dubbo/impl/OperatingConfigDubboServiceImpl.java
  78. 143 0
      operating-service/src/main/java/com/txz/operating/dubbo/impl/OperatingInterfacesDubboServiceImpl.java
  79. 267 0
      operating-service/src/main/java/com/txz/operating/dubbo/impl/RankDubboServiceImpl.java
  80. 56 0
      operating-service/src/main/java/com/txz/operating/dubbo/impl/RankMedianScoreDubboServiceImpl.java
  81. 39 0
      operating-service/src/main/java/com/txz/operating/enums/ActivityInTypeEnum.java
  82. 44 0
      operating-service/src/main/java/com/txz/operating/enums/ActivityModuleEnum.java
  83. 52 0
      operating-service/src/main/java/com/txz/operating/enums/ActivityTypeEnum.java
  84. 64 0
      operating-service/src/main/java/com/txz/operating/model/AppModule.java
  85. 141 0
      operating-service/src/main/java/com/txz/operating/model/Config.java
  86. 265 0
      operating-service/src/main/java/com/txz/operating/model/ErrorCode.java
  87. 212 0
      operating-service/src/main/java/com/txz/operating/model/InterfacePmt.java
  88. 552 0
      operating-service/src/main/java/com/txz/operating/model/Interfaces.java
  89. 48 0
      operating-service/src/main/java/com/txz/operating/model/Module.java
  90. 141 0
      operating-service/src/main/java/com/txz/operating/model/Notice.java
  91. 158 0
      operating-service/src/main/java/com/txz/operating/mq/rocket/consumer/Consumers.java
  92. 33 0
      operating-service/src/main/java/com/txz/operating/mq/rocket/consumer/TestConsumerListener.java
  93. 23 0
      operating-service/src/main/java/com/txz/operating/mq/rocket/consumer/message/MyMessage.java
  94. 26 0
      operating-service/src/main/java/com/txz/operating/mq/rocket/producer/Producers.java
  95. 19 0
      operating-service/src/main/java/com/txz/operating/open/BaiduOpenApi.java
  96. 6 0
      operating-service/src/main/java/com/txz/operating/open/CosOpenApi.java
  97. 9 0
      operating-service/src/main/java/com/txz/operating/open/JbsOpenApi.java
  98. 9 0
      operating-service/src/main/java/com/txz/operating/open/TxOpenApi.java
  99. 161 0
      operating-service/src/main/java/com/txz/operating/open/been/BdAdrressResult.java
  100. 32 0
      operating-service/src/main/java/com/txz/operating/open/been/JbsStation.java

+ 27 - 0
.gitignore

@@ -0,0 +1,27 @@
+/target/
+!.mvn/wrapper/maven-wrapper.jar
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+/build/
+target/
+/spy.log

+ 1 - 0
README.md

@@ -0,0 +1 @@
+111

+ 1 - 0
deploy.bat

@@ -0,0 +1 @@
+cmd /k mvn deploy -DskipTests

+ 1 - 0
eclipse.bat

@@ -0,0 +1 @@
+cmd /k mvn clean eclipse:clean eclipse:eclipse -DdownloadSources=true -DdownloadJavadocs=true

+ 1 - 0
install.bat

@@ -0,0 +1 @@
+cmd /k mvn install -Dmaven.test.skip=true

+ 62 - 0
operating-api/pom.xml

@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>operating</artifactId>
+        <groupId>com.txz</groupId>
+        <version>1.0.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>operating-api</artifactId>
+    <version>1.0.1-SNAPSHOT</version>
+    <dependencies>
+
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <version>1.18.10</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <version>1.2.69</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+            <version>RELEASE</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.data</groupId>
+            <artifactId>spring-data-redis</artifactId>
+            <scope>compile</scope>
+        </dependency>
+
+
+    </dependencies>
+
+
+    <build>
+        <plugins>
+            <!-- 要将源码放上去,需要加入这个插件 -->
+            <plugin>
+                <artifactId>maven-source-plugin</artifactId>
+                <version>3.2.0</version>
+                <configuration>
+                    <attach>true</attach>
+                </configuration>
+                <executions>
+                    <execution>
+                        <phase>compile</phase>
+                        <goals>
+                            <goal>jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>

+ 121 - 0
operating-api/src/main/java/com/txz/operating/dto/AppModuleDTO.java

@@ -0,0 +1,121 @@
+/*
+*
+* AppModuleDTO.java
+* Copyright(C) 2017-2020 fendo公司
+* @date 2020-05-22
+*/
+package com.txz.operating.dto;
+
+import java.io.Serializable;
+
+public class AppModuleDTO implements Serializable {
+    /**
+     * 
+     */
+    private Long id;
+
+    /**
+     * 应用编码
+     */
+    private String appCode;
+
+    /**
+     * 模块名称
+     */
+    private String name;
+
+    /**
+     * 模块编码
+     */
+    private String code;
+
+    /**
+     * 状态 1开放 2关闭
+     */
+    private Byte status;
+
+    /**
+     * o_app_module
+     */
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 
+     * @return id 
+     */
+    public Long getId() {
+        return id;
+    }
+
+    /**
+     * 
+     * @param id 
+     */
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    /**
+     * 应用编码
+     * @return app_code 应用编码
+     */
+    public String getAppCode() {
+        return appCode;
+    }
+
+    /**
+     * 应用编码
+     * @param appCode 应用编码
+     */
+    public void setAppCode(String appCode) {
+        this.appCode = appCode;
+    }
+
+    /**
+     * 模块名称
+     * @return name 模块名称
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * 模块名称
+     * @param name 模块名称
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * 模块编码
+     * @return code 模块编码
+     */
+    public String getCode() {
+        return code;
+    }
+
+    /**
+     * 模块编码
+     * @param code 模块编码
+     */
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    /**
+     * 状态 1开放 2关闭
+     * @return status 状态 1开放 2关闭
+     */
+    public Byte getStatus() {
+        return status;
+    }
+
+    /**
+     * 状态 1开放 2关闭
+     * @param status 状态 1开放 2关闭
+     */
+    public void setStatus(Byte status) {
+        this.status = status;
+    }
+}

+ 163 - 0
operating-api/src/main/java/com/txz/operating/dto/ConfigDTO.java

@@ -0,0 +1,163 @@
+/*
+*
+* ConfigDTO.java
+* Copyright(C) 2017-2020 fendo公司
+* @date 2020-11-24
+*/
+package com.txz.operating.dto;
+
+import java.io.Serializable;
+
+public class ConfigDTO implements Serializable {
+    /**
+     * 
+     */
+    private Integer id;
+
+    /**
+     * 
+     */
+    private String name;
+
+    /**
+     * 
+     */
+    private String code;
+
+    /**
+     * 
+     */
+    private Integer parentId;
+
+    /**
+     * 视图类型 1运营配置 2系统配置
+     */
+    private Integer viweType;
+
+    /**
+     * 
+     */
+    private String valueInfo;
+
+    /**
+     * 
+     */
+    private Integer seq;
+
+    /**
+     * o_config
+     */
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 
+     * @return id 
+     */
+    public Integer getId() {
+        return id;
+    }
+
+    /**
+     * 
+     * @param id 
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * 
+     * @return name 
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * 
+     * @param name 
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * 
+     * @return code 
+     */
+    public String getCode() {
+        return code;
+    }
+
+    /**
+     * 
+     * @param code 
+     */
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    /**
+     * 
+     * @return parent_id 
+     */
+    public Integer getParentId() {
+        return parentId;
+    }
+
+    /**
+     * 
+     * @param parentId 
+     */
+    public void setParentId(Integer parentId) {
+        this.parentId = parentId;
+    }
+
+    /**
+     * 视图类型 1运营配置 2系统配置
+     * @return viwe_type 视图类型 1运营配置 2系统配置
+     */
+    public Integer getViweType() {
+        return viweType;
+    }
+
+    /**
+     * 视图类型 1运营配置 2系统配置
+     * @param viweType 视图类型 1运营配置 2系统配置
+     */
+    public void setViweType(Integer viweType) {
+        this.viweType = viweType;
+    }
+
+    /**
+     * 
+     * @return value_info 
+     */
+    public String getValueInfo() {
+        return valueInfo;
+    }
+
+    /**
+     * 
+     * @param valueInfo 
+     */
+    public void setValueInfo(String valueInfo) {
+        this.valueInfo = valueInfo;
+    }
+
+    /**
+     * 
+     * @return seq 
+     */
+    public Integer getSeq() {
+        return seq;
+    }
+
+    /**
+     * 
+     * @param seq 
+     */
+    public void setSeq(Integer seq) {
+        this.seq = seq;
+    }
+}

+ 121 - 0
operating-api/src/main/java/com/txz/operating/dto/DubboServiceDTO.java

@@ -0,0 +1,121 @@
+/*
+*
+* DubboServiceDTO.java
+* Copyright(C) 2017-2020 fendo公司
+* @date 2021-08-31
+*/
+package com.txz.operating.dto;
+
+import java.io.Serializable;
+
+public class DubboServiceDTO implements Serializable {
+    /**
+     * 
+     */
+    private Integer id;
+
+    /**
+     * 名称
+     */
+    private String name;
+
+    /**
+     * 服务名称
+     */
+    private String appCode;
+
+    /**
+     * 接口名
+     */
+    private String interfaceClass;
+
+    /**
+     * 版本号
+     */
+    private String version;
+
+    /**
+     * o_dubbo_service
+     */
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 
+     * @return id 
+     */
+    public Integer getId() {
+        return id;
+    }
+
+    /**
+     * 
+     * @param id 
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * 名称
+     * @return name 名称
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * 名称
+     * @param name 名称
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * 服务名称
+     * @return app_code 服务名称
+     */
+    public String getAppCode() {
+        return appCode;
+    }
+
+    /**
+     * 服务名称
+     * @param appCode 服务名称
+     */
+    public void setAppCode(String appCode) {
+        this.appCode = appCode;
+    }
+
+    /**
+     * 接口名
+     * @return interface_class 接口名
+     */
+    public String getInterfaceClass() {
+        return interfaceClass;
+    }
+
+    /**
+     * 接口名
+     * @param interfaceClass 接口名
+     */
+    public void setInterfaceClass(String interfaceClass) {
+        this.interfaceClass = interfaceClass;
+    }
+
+    /**
+     * 版本号
+     * @return version 版本号
+     */
+    public String getVersion() {
+        return version;
+    }
+
+    /**
+     * 版本号
+     * @param version 版本号
+     */
+    public void setVersion(String version) {
+        this.version = version;
+    }
+}

+ 266 - 0
operating-api/src/main/java/com/txz/operating/dto/ErrorCodeDTO.java

@@ -0,0 +1,266 @@
+/*
+*
+* ErrorCodeDTO.java
+* Copyright(C) 2017-2020 fendo公司
+* @date 2019-11-22
+*/
+package com.txz.operating.dto;
+
+import cn.hutool.core.bean.BeanUtil;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class ErrorCodeDTO implements Serializable {
+    /**
+     * 
+     */
+    private Integer id;
+
+    /**
+     * 返回结果码
+     */
+    private String returnCode;
+
+    /**
+     * 返回结果消息
+     */
+    private String returnMsg;
+
+    /**
+     * 内部系统结果码
+     */
+    private String retCode;
+
+    /**
+     * 内部系统结果消息
+     */
+    private String retMsg;
+
+    /**
+     * 接口id
+     */
+    private Integer interfaceId;
+
+    /**
+     * 接口名
+     */
+    private String interfacePath;
+
+    /**
+     * 创建人
+     */
+    private String createName;
+
+    /**
+     * 更新人
+     */
+    private String updateName;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 更新时间
+     */
+    private Date updateTime;
+
+    /**
+     * o_error_code
+     */
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 
+     * @return id 
+     */
+    public Integer getId() {
+        return id;
+    }
+
+    /**
+     * 
+     * @param id 
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * 返回结果码
+     * @return return_code 返回结果码
+     */
+    public String getReturnCode() {
+        return returnCode;
+    }
+
+    /**
+     * 返回结果码
+     * @param returnCode 返回结果码
+     */
+    public void setReturnCode(String returnCode) {
+        this.returnCode = returnCode;
+    }
+
+    /**
+     * 返回结果消息
+     * @return return_msg 返回结果消息
+     */
+    public String getReturnMsg() {
+        return returnMsg;
+    }
+
+    /**
+     * 返回结果消息
+     * @param returnMsg 返回结果消息
+     */
+    public void setReturnMsg(String returnMsg) {
+        this.returnMsg = returnMsg;
+    }
+
+    /**
+     * 内部系统结果码
+     * @return ret_code 内部系统结果码
+     */
+    public String getRetCode() {
+        return retCode;
+    }
+
+    /**
+     * 内部系统结果码
+     * @param retCode 内部系统结果码
+     */
+    public void setRetCode(String retCode) {
+        this.retCode = retCode;
+    }
+
+    /**
+     * 内部系统结果消息
+     * @return ret_msg 内部系统结果消息
+     */
+    public String getRetMsg() {
+        return retMsg;
+    }
+
+    /**
+     * 内部系统结果消息
+     * @param retMsg 内部系统结果消息
+     */
+    public void setRetMsg(String retMsg) {
+        this.retMsg = retMsg;
+    }
+
+    /**
+     * 接口id
+     * @return interface_id 接口id
+     */
+    public Integer getInterfaceId() {
+        return interfaceId;
+    }
+
+    /**
+     * 接口id
+     * @param interfaceId 接口id
+     */
+    public void setInterfaceId(Integer interfaceId) {
+        this.interfaceId = interfaceId;
+    }
+
+    /**
+     * 接口名
+     * @return interface_path 接口名
+     */
+    public String getInterfacePath() {
+        return interfacePath;
+    }
+
+    /**
+     * 接口名
+     * @param interfacePath 接口名
+     */
+    public void setInterfacePath(String interfacePath) {
+        this.interfacePath = interfacePath;
+    }
+
+    /**
+     * 创建人
+     * @return create_name 创建人
+     */
+    public String getCreateName() {
+        return createName;
+    }
+
+    /**
+     * 创建人
+     * @param createName 创建人
+     */
+    public void setCreateName(String createName) {
+        this.createName = createName;
+    }
+
+    /**
+     * 更新人
+     * @return update_name 更新人
+     */
+    public String getUpdateName() {
+        return updateName;
+    }
+
+    /**
+     * 更新人
+     * @param updateName 更新人
+     */
+    public void setUpdateName(String updateName) {
+        this.updateName = updateName;
+    }
+
+    /**
+     * 创建时间
+     * @return create_time 创建时间
+     */
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    /**
+     * 创建时间
+     * @param createTime 创建时间
+     */
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    /**
+     * 更新时间
+     * @return update_time 更新时间
+     */
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    /**
+     * 更新时间
+     * @param updateTime 更新时间
+     */
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public static ErrorCodeDTO generator(Object o){
+        if (o == null){
+            return null;
+        }
+        ErrorCodeDTO temp = new ErrorCodeDTO();
+        BeanUtil.copyProperties(o,temp);
+        return temp;
+    }
+
+}

+ 205 - 0
operating-api/src/main/java/com/txz/operating/dto/InterfacePmtDTO.java

@@ -0,0 +1,205 @@
+/*
+*
+* InterfacePmtDTO.java
+* Copyright(C) 2017-2020 fendo公司
+* @date 2019-11-01
+*/
+package com.txz.operating.dto;
+
+import java.io.Serializable;
+
+public class InterfacePmtDTO implements Serializable {
+    /**
+     * 
+     */
+    private Integer id;
+
+    /**
+     * 接口id
+     */
+    private String itfcId;
+
+    /**
+     * 参数
+     */
+    private String param;
+
+    /**
+     * 参数名称
+     */
+    private String paramName;
+
+    /**
+     * 数据类型 0varchar 1int 2date 3object
+     */
+    private String dataType;
+
+    /**
+     * 是否必须有值 0可为空 1不为空
+     */
+    private String ismust;
+
+    /**
+     * 长度
+     */
+    private String length;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    /**
+     * 请求参数类型(0.请求参数,1.返回参数)
+     */
+    private Integer paramtype;
+
+    /**
+     * o_interface_pmt
+     */
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 
+     * @return id 
+     */
+    public Integer getId() {
+        return id;
+    }
+
+    /**
+     * 
+     * @param id 
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * 接口id
+     * @return itfc_id 接口id
+     */
+    public String getItfcId() {
+        return itfcId;
+    }
+
+    /**
+     * 接口id
+     * @param itfcId 接口id
+     */
+    public void setItfcId(String itfcId) {
+        this.itfcId = itfcId;
+    }
+
+    /**
+     * 参数
+     * @return param 参数
+     */
+    public String getParam() {
+        return param;
+    }
+
+    /**
+     * 参数
+     * @param param 参数
+     */
+    public void setParam(String param) {
+        this.param = param;
+    }
+
+    /**
+     * 参数名称
+     * @return param_name 参数名称
+     */
+    public String getParamName() {
+        return paramName;
+    }
+
+    /**
+     * 参数名称
+     * @param paramName 参数名称
+     */
+    public void setParamName(String paramName) {
+        this.paramName = paramName;
+    }
+
+    /**
+     * 数据类型 0varchar 1int 2date 3object
+     * @return data_type 数据类型 0varchar 1int 2date 3object
+     */
+    public String getDataType() {
+        return dataType;
+    }
+
+    /**
+     * 数据类型 0varchar 1int 2date 3object
+     * @param dataType 数据类型 0varchar 1int 2date 3object
+     */
+    public void setDataType(String dataType) {
+        this.dataType = dataType;
+    }
+
+    /**
+     * 是否必须有值 0可为空 1不为空
+     * @return ismust 是否必须有值 0可为空 1不为空
+     */
+    public String getIsmust() {
+        return ismust;
+    }
+
+    /**
+     * 是否必须有值 0可为空 1不为空
+     * @param ismust 是否必须有值 0可为空 1不为空
+     */
+    public void setIsmust(String ismust) {
+        this.ismust = ismust;
+    }
+
+    /**
+     * 长度
+     * @return length 长度
+     */
+    public String getLength() {
+        return length;
+    }
+
+    /**
+     * 长度
+     * @param length 长度
+     */
+    public void setLength(String length) {
+        this.length = length;
+    }
+
+    /**
+     * 备注
+     * @return remark 备注
+     */
+    public String getRemark() {
+        return remark;
+    }
+
+    /**
+     * 备注
+     * @param remark 备注
+     */
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    /**
+     * 请求参数类型(0.请求参数,1.返回参数)
+     * @return paramType 请求参数类型(0.请求参数,1.返回参数)
+     */
+    public Integer getParamtype() {
+        return paramtype;
+    }
+
+    /**
+     * 请求参数类型(0.请求参数,1.返回参数)
+     * @param paramtype 请求参数类型(0.请求参数,1.返回参数)
+     */
+    public void setParamtype(Integer paramtype) {
+        this.paramtype = paramtype;
+    }
+}

+ 518 - 0
operating-api/src/main/java/com/txz/operating/dto/InterfacesDTO.java

@@ -0,0 +1,518 @@
+/*
+*
+* InterfacesDTO.java
+* Copyright(C) 2017-2020 fendo公司
+* @date 2019-11-01
+*/
+package com.txz.operating.dto;
+
+import cn.hutool.core.bean.BeanUtil;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class InterfacesDTO implements Serializable {
+    /**
+     * 
+     */
+    private Integer id;
+
+    /**
+     * 接口名称
+     */
+    private String apiName;
+
+    /**
+     * 返回结果转译 0 不转义 1转义
+     */
+    private Integer returnCodeTranslate;
+
+    /**
+     * API中文名称
+     */
+    private String apiRemark;
+
+    /**
+     * API描述
+     */
+    private String apiMemo;
+
+    /**
+     * 服务名
+     */
+    private String serviceName;
+
+    /**
+     * 服务路径
+     */
+    private String servicePath;
+
+    /**
+     * 服务类型
+     */
+    private String serviceType;
+
+    /**
+     * 连接超时时间
+     */
+    private String connectionTimeout;
+
+    /**
+     * 读取数据超时时间
+     */
+    private String soTimeout;
+
+    /**
+     * 模块ID
+     */
+    private String moduleId;
+
+    /**
+     * 模块名称
+     */
+    private String moduleName;
+
+    /**
+     * 登录授权类型(0.无需,1.需要)
+     */
+    private Integer authorizeType;
+
+    /**
+     * 商户所有权认证(0.无需,1.需要)
+     */
+    private Integer merchantAuthorizeType;
+
+    /**
+     * 状态 0未启用 1正常 2禁用
+     */
+    private Integer status;
+
+    /**
+     * 请求json
+     */
+    private String requestJson;
+
+    /**
+     * 请求json例子
+     */
+    private String requestJsonDemo;
+
+    /**
+     * 响应json
+     */
+    private String responseJson;
+
+    /**
+     * 响应json例子
+     */
+    private String responseJsonDemo;
+
+    /**
+     * 创建人
+     */
+    private String createName;
+
+    /**
+     * 更新人
+     */
+    private String updateName;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 更新时间
+     */
+    private Date updateTime;
+
+    /**
+     * o_interfaces
+     */
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 
+     * @return id 
+     */
+    public Integer getId() {
+        return id;
+    }
+
+    /**
+     * 
+     * @param id 
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * 接口名称
+     * @return api_name 接口名称
+     */
+    public String getApiName() {
+        return apiName;
+    }
+
+    /**
+     * 接口名称
+     * @param apiName 接口名称
+     */
+    public void setApiName(String apiName) {
+        this.apiName = apiName;
+    }
+
+    /**
+     * 返回结果转译 0 不转义 1转义
+     * @return return_code_translate 返回结果转译 0 不转义 1转义
+     */
+    public Integer getReturnCodeTranslate() {
+        return returnCodeTranslate;
+    }
+
+    /**
+     * 返回结果转译 0 不转义 1转义
+     * @param returnCodeTranslate 返回结果转译 0 不转义 1转义
+     */
+    public void setReturnCodeTranslate(Integer returnCodeTranslate) {
+        this.returnCodeTranslate = returnCodeTranslate;
+    }
+
+    /**
+     * API中文名称
+     * @return api_remark API中文名称
+     */
+    public String getApiRemark() {
+        return apiRemark;
+    }
+
+    /**
+     * API中文名称
+     * @param apiRemark API中文名称
+     */
+    public void setApiRemark(String apiRemark) {
+        this.apiRemark = apiRemark;
+    }
+
+    /**
+     * API描述
+     * @return api_memo API描述
+     */
+    public String getApiMemo() {
+        return apiMemo;
+    }
+
+    /**
+     * API描述
+     * @param apiMemo API描述
+     */
+    public void setApiMemo(String apiMemo) {
+        this.apiMemo = apiMemo;
+    }
+
+    /**
+     * 服务名
+     * @return service_name 服务名
+     */
+    public String getServiceName() {
+        return serviceName;
+    }
+
+    /**
+     * 服务名
+     * @param serviceName 服务名
+     */
+    public void setServiceName(String serviceName) {
+        this.serviceName = serviceName;
+    }
+
+    /**
+     * 服务路径
+     * @return service_path 服务路径
+     */
+    public String getServicePath() {
+        return servicePath;
+    }
+
+    /**
+     * 服务路径
+     * @param servicePath 服务路径
+     */
+    public void setServicePath(String servicePath) {
+        this.servicePath = servicePath;
+    }
+
+    /**
+     * 服务类型
+     * @return service_type 服务类型
+     */
+    public String getServiceType() {
+        return serviceType;
+    }
+
+    /**
+     * 服务类型
+     * @param serviceType 服务类型
+     */
+    public void setServiceType(String serviceType) {
+        this.serviceType = serviceType;
+    }
+
+    /**
+     * 连接超时时间
+     * @return connection_timeout 连接超时时间
+     */
+    public String getConnectionTimeout() {
+        return connectionTimeout;
+    }
+
+    /**
+     * 连接超时时间
+     * @param connectionTimeout 连接超时时间
+     */
+    public void setConnectionTimeout(String connectionTimeout) {
+        this.connectionTimeout = connectionTimeout;
+    }
+
+    /**
+     * 读取数据超时时间
+     * @return so_timeout 读取数据超时时间
+     */
+    public String getSoTimeout() {
+        return soTimeout;
+    }
+
+    /**
+     * 读取数据超时时间
+     * @param soTimeout 读取数据超时时间
+     */
+    public void setSoTimeout(String soTimeout) {
+        this.soTimeout = soTimeout;
+    }
+
+    /**
+     * 模块ID
+     * @return module_id 模块ID
+     */
+    public String getModuleId() {
+        return moduleId;
+    }
+
+    /**
+     * 模块ID
+     * @param moduleId 模块ID
+     */
+    public void setModuleId(String moduleId) {
+        this.moduleId = moduleId;
+    }
+
+    /**
+     * 模块名称
+     * @return module_name 模块名称
+     */
+    public String getModuleName() {
+        return moduleName;
+    }
+
+    /**
+     * 模块名称
+     * @param moduleName 模块名称
+     */
+    public void setModuleName(String moduleName) {
+        this.moduleName = moduleName;
+    }
+
+    /**
+     * 登录授权类型(0.无需,1.需要)
+     * @return authorize_type 登录授权类型(0.无需,1.需要)
+     */
+    public Integer getAuthorizeType() {
+        return authorizeType;
+    }
+
+    /**
+     * 登录授权类型(0.无需,1.需要)
+     * @param authorizeType 登录授权类型(0.无需,1.需要)
+     */
+    public void setAuthorizeType(Integer authorizeType) {
+        this.authorizeType = authorizeType;
+    }
+
+    /**
+     * 商户所有权认证(0.无需,1.需要)
+     * @return merchant_authorize_type 商户所有权认证(0.无需,1.需要)
+     */
+    public Integer getMerchantAuthorizeType() {
+        return merchantAuthorizeType;
+    }
+
+    /**
+     * 商户所有权认证(0.无需,1.需要)
+     * @param merchantAuthorizeType 商户所有权认证(0.无需,1.需要)
+     */
+    public void setMerchantAuthorizeType(Integer merchantAuthorizeType) {
+        this.merchantAuthorizeType = merchantAuthorizeType;
+    }
+
+    /**
+     * 状态 0未启用 1正常 2禁用
+     * @return status 状态 0未启用 1正常 2禁用
+     */
+    public Integer getStatus() {
+        return status;
+    }
+
+    /**
+     * 状态 0未启用 1正常 2禁用
+     * @param status 状态 0未启用 1正常 2禁用
+     */
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    /**
+     * 请求json
+     * @return request_json 请求json
+     */
+    public String getRequestJson() {
+        return requestJson;
+    }
+
+    /**
+     * 请求json
+     * @param requestJson 请求json
+     */
+    public void setRequestJson(String requestJson) {
+        this.requestJson = requestJson;
+    }
+
+    /**
+     * 请求json例子
+     * @return request_json_demo 请求json例子
+     */
+    public String getRequestJsonDemo() {
+        return requestJsonDemo;
+    }
+
+    /**
+     * 请求json例子
+     * @param requestJsonDemo 请求json例子
+     */
+    public void setRequestJsonDemo(String requestJsonDemo) {
+        this.requestJsonDemo = requestJsonDemo;
+    }
+
+    /**
+     * 响应json
+     * @return response_json 响应json
+     */
+    public String getResponseJson() {
+        return responseJson;
+    }
+
+    /**
+     * 响应json
+     * @param responseJson 响应json
+     */
+    public void setResponseJson(String responseJson) {
+        this.responseJson = responseJson;
+    }
+
+    /**
+     * 响应json例子
+     * @return response_json_demo 响应json例子
+     */
+    public String getResponseJsonDemo() {
+        return responseJsonDemo;
+    }
+
+    /**
+     * 响应json例子
+     * @param responseJsonDemo 响应json例子
+     */
+    public void setResponseJsonDemo(String responseJsonDemo) {
+        this.responseJsonDemo = responseJsonDemo;
+    }
+
+    /**
+     * 创建人
+     * @return create_name 创建人
+     */
+    public String getCreateName() {
+        return createName;
+    }
+
+    /**
+     * 创建人
+     * @param createName 创建人
+     */
+    public void setCreateName(String createName) {
+        this.createName = createName;
+    }
+
+    /**
+     * 更新人
+     * @return update_name 更新人
+     */
+    public String getUpdateName() {
+        return updateName;
+    }
+
+    /**
+     * 更新人
+     * @param updateName 更新人
+     */
+    public void setUpdateName(String updateName) {
+        this.updateName = updateName;
+    }
+
+    /**
+     * 创建时间
+     * @return create_time 创建时间
+     */
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    /**
+     * 创建时间
+     * @param createTime 创建时间
+     */
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    /**
+     * 更新时间
+     * @return update_time 更新时间
+     */
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    /**
+     * 更新时间
+     * @param updateTime 更新时间
+     */
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public static InterfacesDTO generator(Object o){
+        if (o == null){
+            return null;
+        }
+        InterfacesDTO temp = new InterfacesDTO();
+        BeanUtil.copyProperties(o,temp);
+        return temp;
+    }
+
+}

+ 58 - 0
operating-api/src/main/java/com/txz/operating/dto/ModuleDTO.java

@@ -0,0 +1,58 @@
+/*
+*
+* ModuleDTO.java
+* Copyright(C) 2017-2020 fendo公司
+* @date 2019-11-26
+*/
+package com.txz.operating.dto;
+
+import java.io.Serializable;
+
+public class ModuleDTO implements Serializable {
+    /**
+     * 
+     */
+    private Integer id;
+
+    /**
+     * 模块名称
+     */
+    private String moduleName;
+
+    /**
+     * o_module
+     */
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 
+     * @return id 
+     */
+    public Integer getId() {
+        return id;
+    }
+
+    /**
+     * 
+     * @param id 
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * 模块名称
+     * @return module_name 模块名称
+     */
+    public String getModuleName() {
+        return moduleName;
+    }
+
+    /**
+     * 模块名称
+     * @param moduleName 模块名称
+     */
+    public void setModuleName(String moduleName) {
+        this.moduleName = moduleName;
+    }
+}

+ 311 - 0
operating-api/src/main/java/com/txz/operating/dto/NoticeDTO.java

@@ -0,0 +1,311 @@
+/*
+*
+* NoticeDTO.java
+* Copyright(C) 2017-2020 fendo公司
+* @date 2020-03-26
+*/
+package com.txz.operating.dto;
+
+import java.io.Serializable;
+import java.util.Date;
+
+public class NoticeDTO implements Serializable {
+    /**
+     * 
+     */
+    private Integer id;
+
+    /**
+     * 应用编码
+     */
+    private String appCode;
+
+    /**
+     * 文字内容
+     */
+    private String content;
+
+    /**
+     * 图片内容
+     */
+    private String pic;
+
+    /**
+     * 音频内容
+     */
+    private String voice;
+
+    /**
+     * 类型 1滚屏公告 2登录公告
+     */
+    private Byte type;
+
+    /**
+     * 排序
+     */
+    private Integer seq;
+
+    /**
+     * 间隔时间 单位 秒
+     */
+    private Integer intervalTime;
+
+    /**
+     * 状态 1正常 2禁用
+     */
+    private Byte status;
+
+    /**
+     * 开始时间
+     */
+    private Date startTime;
+
+    /**
+     * 结束时间
+     */
+    private Date endTime;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 创建人
+     */
+    private String createUser;
+
+    /**
+     * 更新时间
+     */
+    private Date updateTime;
+
+    /**
+     * o_notice
+     */
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 
+     * @return id 
+     */
+    public Integer getId() {
+        return id;
+    }
+
+    /**
+     * 
+     * @param id 
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * 应用编码
+     * @return app_code 应用编码
+     */
+    public String getAppCode() {
+        return appCode;
+    }
+
+    /**
+     * 应用编码
+     * @param appCode 应用编码
+     */
+    public void setAppCode(String appCode) {
+        this.appCode = appCode;
+    }
+
+    /**
+     * 文字内容
+     * @return content 文字内容
+     */
+    public String getContent() {
+        return content;
+    }
+
+    /**
+     * 文字内容
+     * @param content 文字内容
+     */
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+    /**
+     * 图片内容
+     * @return pic 图片内容
+     */
+    public String getPic() {
+        return pic;
+    }
+
+    /**
+     * 图片内容
+     * @param pic 图片内容
+     */
+    public void setPic(String pic) {
+        this.pic = pic;
+    }
+
+    /**
+     * 音频内容
+     * @return voice 音频内容
+     */
+    public String getVoice() {
+        return voice;
+    }
+
+    /**
+     * 音频内容
+     * @param voice 音频内容
+     */
+    public void setVoice(String voice) {
+        this.voice = voice;
+    }
+
+    /**
+     * 类型 1滚屏公告 2登录公告
+     * @return type 类型 1滚屏公告 2登录公告
+     */
+    public Byte getType() {
+        return type;
+    }
+
+    /**
+     * 类型 1滚屏公告 2登录公告
+     * @param type 类型 1滚屏公告 2登录公告
+     */
+    public void setType(Byte type) {
+        this.type = type;
+    }
+
+    /**
+     * 排序
+     * @return seq 排序
+     */
+    public Integer getSeq() {
+        return seq;
+    }
+
+    /**
+     * 排序
+     * @param seq 排序
+     */
+    public void setSeq(Integer seq) {
+        this.seq = seq;
+    }
+
+    /**
+     * 间隔时间 单位 秒
+     * @return interval_time 间隔时间 单位 秒
+     */
+    public Integer getIntervalTime() {
+        return intervalTime;
+    }
+
+    /**
+     * 间隔时间 单位 秒
+     * @param intervalTime 间隔时间 单位 秒
+     */
+    public void setIntervalTime(Integer intervalTime) {
+        this.intervalTime = intervalTime;
+    }
+
+    /**
+     * 状态 1正常 2禁用
+     * @return status 状态 1正常 2禁用
+     */
+    public Byte getStatus() {
+        return status;
+    }
+
+    /**
+     * 状态 1正常 2禁用
+     * @param status 状态 1正常 2禁用
+     */
+    public void setStatus(Byte status) {
+        this.status = status;
+    }
+
+    /**
+     * 开始时间
+     * @return start_time 开始时间
+     */
+    public Date getStartTime() {
+        return startTime;
+    }
+
+    /**
+     * 开始时间
+     * @param startTime 开始时间
+     */
+    public void setStartTime(Date startTime) {
+        this.startTime = startTime;
+    }
+
+    /**
+     * 结束时间
+     * @return end_time 结束时间
+     */
+    public Date getEndTime() {
+        return endTime;
+    }
+
+    /**
+     * 结束时间
+     * @param endTime 结束时间
+     */
+    public void setEndTime(Date endTime) {
+        this.endTime = endTime;
+    }
+
+    /**
+     * 创建时间
+     * @return create_time 创建时间
+     */
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    /**
+     * 创建时间
+     * @param createTime 创建时间
+     */
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    /**
+     * 创建人
+     * @return create_user 创建人
+     */
+    public String getCreateUser() {
+        return createUser;
+    }
+
+    /**
+     * 创建人
+     * @param createUser 创建人
+     */
+    public void setCreateUser(String createUser) {
+        this.createUser = createUser;
+    }
+
+    /**
+     * 更新时间
+     * @return update_time 更新时间
+     */
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    /**
+     * 更新时间
+     * @param updateTime 更新时间
+     */
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+}

+ 46 - 0
operating-api/src/main/java/com/txz/operating/dto/PageDto.java

@@ -0,0 +1,46 @@
+package com.txz.operating.dto;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+import java.io.Serializable;
+
+/**
+ * @Author: Fcx
+ * @Date: 2019/11/26 14:02
+ * @Version 1.0
+ */
+@Data
+@ToString
+@AllArgsConstructor
+@NoArgsConstructor
+abstract public class PageDto implements Serializable {
+
+    private static final long serialVersionUID = 2183579114875265007L;
+    private Integer page;
+
+    private Integer size;
+
+    public Integer getPage() {
+        if (this.page != null) {
+            return Math.max(this.page, 1);
+        }
+        return null;
+    }
+
+    public Integer getSize() {
+        if (this.size != null) {
+            return Math.max(this.size, 1);
+        }
+        return null;
+    }
+
+    public Integer getIndex(){
+        if (this.page != null && this.size != null) {
+            return this.page * this.size - this.size;
+        }
+        return null;
+    }
+}

+ 30 - 0
operating-api/src/main/java/com/txz/operating/dto/award/AwardBizTypeEnum.java

@@ -0,0 +1,30 @@
+package com.txz.operating.dto.award;
+
+public enum AwardBizTypeEnum {
+
+    SIGN_IN(1, "签到领奖"),
+    ACTIVITY(2, "活动领奖"),
+    FEEDBACK(3,"意见反馈"),
+    MGR(4,"后台管理"),
+    LOTTERY(5, "大转盘抽奖"),
+    REDEEM_CODE(6, "兑换码"),
+    COUPON(7, "优惠券"),
+    PERMIT(8, "签到通行证"),
+    OTHER(99, "其他"),
+    ;
+    private Integer key;
+    private String value;
+
+    AwardBizTypeEnum(Integer key, String value) {
+        this.key = key;
+        this.value = value;
+    }
+
+    public Integer getKey() {
+        return key;
+    }
+
+    public String getDesc() {
+        return value;
+    }
+}

+ 36 - 0
operating-api/src/main/java/com/txz/operating/dto/award/AwardCoinDTO.java

@@ -0,0 +1,36 @@
+package com.txz.operating.dto.award;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+/**
+ * @author :linxk
+ * @date :Created in 2020/7/9 13:40
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class AwardCoinDTO  implements Serializable {
+
+    /**
+     * 币种类型
+     * @see
+     */
+    private Integer type;
+
+    /**
+     * 币种名称
+     */
+    private String name;
+
+    /**
+     * 变化值
+     */
+    private Integer num;
+
+
+}

+ 41 - 0
operating-api/src/main/java/com/txz/operating/dto/award/AwardMenuDTO.java

@@ -0,0 +1,41 @@
+package com.txz.operating.dto.award;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+/**
+ * @author :yuzhengqun
+ * @date :Created in 2020/7/9 13:40
+ */
+@Data
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+public class AwardMenuDTO  implements Serializable {
+
+    /**
+     * 奖品菜单ID
+     */
+    private Long menuId;
+    /**
+     * 奖品类型
+     * @see
+     */
+    private Integer type;
+
+    /**
+     * 奖品名称
+     */
+    private String name;
+
+    /**
+     * 用于前端选择资源
+     */
+    private String code;
+
+
+}

+ 25 - 0
operating-api/src/main/java/com/txz/operating/dto/award/AwardRequestDTO.java

@@ -0,0 +1,25 @@
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+package com.txz.operating.dto.award;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+@Data
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+public class AwardRequestDTO implements Serializable {
+    private Integer prizeId;
+    private Long menuId;
+    private Integer value;
+    private AwardRequestDTO replace;
+
+}

+ 58 - 0
operating-api/src/main/java/com/txz/operating/dto/award/AwardResultDTO.java

@@ -0,0 +1,58 @@
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+package com.txz.operating.dto.award;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.util.List;
+
+@Data
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+public class AwardResultDTO implements Serializable {
+    /**
+     * 状态 1成功
+     */
+    private Integer status;
+    /**
+     * 返回语句
+     */
+    private String remind;
+    /**
+     *返回语音
+     */
+    private VoiceDTO voice;
+    /**
+     *返回币种1变化
+     */
+    private Integer coin;
+
+    /**
+     *返回币种1变化
+     */
+    private Integer ore;
+    /**
+     * 自定义货币类型 和值的编号
+     */
+    private List<AwardCoinDTO> coins;
+
+    private Byte isVip;
+    /**
+     *奖励结果
+     */
+    private List<AwardResultMenuDTO> awardMenuList;
+    /**
+     *原奖励结果
+     */
+    private List<AwardRequestDTO> sourceAwardList;
+
+
+}

+ 24 - 0
operating-api/src/main/java/com/txz/operating/dto/award/AwardResultMenuDTO.java

@@ -0,0 +1,24 @@
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+package com.txz.operating.dto.award;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+@Data
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+public class AwardResultMenuDTO implements Serializable {
+    private Integer type;
+    private Integer value;
+    private String code;
+
+}

+ 23 - 0
operating-api/src/main/java/com/txz/operating/dto/award/VoiceDTO.java

@@ -0,0 +1,23 @@
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+package com.txz.operating.dto.award;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+@Data
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+public class VoiceDTO implements Serializable {
+    private String content;
+    private String voiceUrl;
+
+}

+ 39 - 0
operating-api/src/main/java/com/txz/operating/dto/rank/RequestMedianScoreByRankDto.java

@@ -0,0 +1,39 @@
+package com.txz.operating.dto.rank;
+
+import lombok.*;
+
+import java.io.Serializable;
+
+/**
+ * @Author: Fcx
+ * @Date: 2019/11/26 14:01
+ * @Version 1.0
+ */
+@Data
+@ToString
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class RequestMedianScoreByRankDto implements Serializable {
+    private static final long serialVersionUID = -1L;
+
+    /**
+     * 排行榜是否逆序
+     * true 逆序, 数字越大的排名越前  比如: 正确率
+     * false  顺序, 数字越小排名越前  比如: 答题速度
+     *
+     * 怎么存怎么取: 如 存的时候传true,那么取的时候也传true
+     */
+    private Boolean reverse;
+
+    /**
+     * 排行榜存取的唯一key值(年级/学校等)
+     */
+    private String rankKey;
+
+    /**
+     * 排行榜的中位数索引  非必传
+     */
+    private Long medianIndex;
+
+}

+ 51 - 0
operating-api/src/main/java/com/txz/operating/dto/rank/RequestRankDto.java

@@ -0,0 +1,51 @@
+package com.txz.operating.dto.rank;
+
+import com.txz.operating.dto.PageDto;
+import lombok.*;
+
+/**
+ * @Author: Fcx
+ * @Date: 2019/11/26 14:01
+ * @Version 1.0
+ */
+@Data
+@ToString
+@EqualsAndHashCode(callSuper=true)
+@NoArgsConstructor
+@AllArgsConstructor
+public class RequestRankDto extends PageDto {
+
+    /**
+     * 排行榜是否逆序
+     * true 逆序, 数字越大的排名越前  比如: 正确率
+     * false  顺序, 数字越小排名越前  比如: 答题速度
+     *
+     * 怎么存怎么取: 如 存的时候传true,那么取的时候也传true
+     */
+    private Boolean reverse;
+
+    /**
+     * 排行榜存取的唯一key值(年级/学校等)
+     */
+    private String rankKey;
+
+    /**
+     * 用户id
+     */
+    private String userId;
+
+    /**
+     * 用户待更新的分数
+     */
+    private Integer score;
+
+    @Builder
+    private RequestRankDto(Boolean reverse, String rankKey, String userId, Integer score, Integer page, Integer size) {
+        super(page, size);
+        this.reverse = reverse;
+        this.rankKey = rankKey;
+        this.userId = userId;
+        this.score = score;
+    }
+
+}

+ 27 - 0
operating-api/src/main/java/com/txz/operating/dto/rank/ResponseRankIntro.java

@@ -0,0 +1,27 @@
+package com.txz.operating.dto.rank;
+
+import lombok.*;
+
+import java.io.Serializable;
+
+/**
+ * @Author: Fcx
+ * @Date: 2019/11/26 18:02
+ * @Version 1.0
+ */
+@Getter
+@Setter
+@ToString
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class ResponseRankIntro implements Serializable {
+
+    private static final long serialVersionUID = 7553737909196727258L;
+
+    private Long rankSize;
+
+    private Long totalScore;
+
+}

+ 39 - 0
operating-api/src/main/java/com/txz/operating/dto/rank/ResponseUserRankDetailDTO.java

@@ -0,0 +1,39 @@
+package com.txz.operating.dto.rank;
+
+import lombok.*;
+
+import java.io.Serializable;
+
+/**
+ * 用户排行榜每一条的详情DTO
+ *
+ * @Author: Fcx
+ * @Date: 2019/11/25 19:47
+ * @Version 1.0
+ */
+@Getter
+@Setter
+@ToString
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class ResponseUserRankDetailDTO implements Serializable {
+
+    private static final long serialVersionUID = 8592131577850489756L;
+
+    /**
+     * 分数
+     */
+    private Double score;
+
+    /**
+     * 排名
+     */
+    private Long rank;
+
+    /**
+     * 排行榜总人数
+     */
+    private Long rankSize;
+
+}

+ 26 - 0
operating-api/src/main/java/com/txz/operating/dto/rank/ResponseUserScore.java

@@ -0,0 +1,26 @@
+package com.txz.operating.dto.rank;
+
+import lombok.*;
+
+import java.io.Serializable;
+
+/**
+ * @Author: Fcx
+ * @Date: 2019/11/26 18:02
+ * @Version 1.0
+ */
+@Getter
+@Setter
+@ToString
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class ResponseUserScore implements Serializable {
+
+    private static final long serialVersionUID = -271210795658635545L;
+    private String userId;
+
+    private Integer score;
+
+}

+ 22 - 0
operating-api/src/main/java/com/txz/operating/mq/OperatingMqBizCodeEnum.java

@@ -0,0 +1,22 @@
+package com.txz.operating.mq;
+
+import lombok.Getter;
+
+/**
+ * mq调用业务编码
+ */
+@Getter
+public enum OperatingMqBizCodeEnum {
+
+    INTERACTIVE(1, ""),
+
+    ;
+
+    private Integer key;
+    private String value;
+
+    OperatingMqBizCodeEnum(Integer key, String value) {
+        this.key = key;
+        this.value = value;
+    }
+}

+ 31 - 0
operating-api/src/main/java/com/txz/operating/mq/OperatingMqMessage.java

@@ -0,0 +1,31 @@
+package com.txz.operating.mq;
+
+
+import lombok.Builder;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+import java.io.Serializable;
+
+/**
+ * 统一MQ响应
+ * @author Fcx
+ */
+@Setter
+@Getter
+@ToString
+@Builder
+public class OperatingMqMessage<T> implements Serializable {
+
+    private static final long serialVersionUID = 6484555602318841035L;
+    /**
+     * 业务编号
+     */
+    private OperatingMqBizCodeEnum bizCode;
+    /**
+     * 业务数据
+     */
+    private T data;
+
+}

+ 102 - 0
operating-api/src/main/java/com/txz/operating/result/Result.java

@@ -0,0 +1,102 @@
+package com.txz.operating.result;
+
+import com.alibaba.fastjson.JSON;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+/**
+ * 统一API响应结果封装
+ */
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class Result<T> implements Serializable {
+    private String code;
+    private String message;
+    private T data;
+
+
+    public static Result success() {
+        return Result.builder()
+                .code("200")
+                .message("操作成功")
+                .build();
+    }
+
+    public static Result success(Object data) {
+        return Result.builder()
+                .code("200")
+                .message("操作成功")
+                .data(data)
+                .build();
+    }
+
+    public static Result build(String code, String message) {
+        return Result.builder()
+                .code(code)
+                .message(message)
+                .build();
+    }
+
+    public static Result fail(String code, String message, Object data) {
+        return Result.builder()
+                .code(code)
+                .message(message)
+                .data(data)
+                .build();
+    }
+
+    public static Result fail(Object data) {
+        return Result.builder()
+                .code("400")
+                .message("操作失败")
+                .data(data)
+                .build();
+    }
+
+    public static Result fail(String code, String message) {
+        return Result.builder()
+                .code(code)
+                .message(message)
+                .build();
+    }
+
+
+
+    @Override
+    public String toString() {
+        return JSON.toJSONString(this);
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public Result setCode(String code) {
+        this.code = code;
+        return this;
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    public Result setMessage(String message) {
+        this.message = message;
+        return this;
+    }
+
+    public T getData() {
+        return data;
+    }
+
+    public Result setData(T data) {
+        this.data = data;
+        return this;
+    }
+}

+ 26 - 0
operating-api/src/main/java/com/txz/operating/service/IOperatingMedianScoreDubboService.java

@@ -0,0 +1,26 @@
+package com.txz.operating.service;
+
+import com.txz.operating.dto.rank.RequestMedianScoreByRankDto;
+import com.txz.operating.result.Result;
+
+/**
+ * 排行榜接口
+ * <p>
+ * 若干个排行榜
+ *
+ * @Author: Fcx
+ * @Date: 2019/11/25 15:07
+ * @Version 1.0
+ */
+public interface IOperatingMedianScoreDubboService {
+
+
+    /**
+     *获取中位数
+     * @param dto 所需参数: rankKey reverse
+     * @return
+     */
+    Result<Long> getMedianScore(RequestMedianScoreByRankDto dto);
+
+
+}

+ 70 - 0
operating-api/src/main/java/com/txz/operating/service/IOperatingRankDubboService.java

@@ -0,0 +1,70 @@
+package com.txz.operating.service;
+
+import com.txz.operating.dto.rank.RequestRankDto;
+import com.txz.operating.dto.rank.ResponseRankIntro;
+import com.txz.operating.dto.rank.ResponseUserRankDetailDTO;
+import com.txz.operating.dto.rank.ResponseUserScore;
+import com.txz.operating.result.Result;
+
+import java.util.List;
+
+/**
+ * 排行榜接口
+ * <p>
+ * 若干个排行榜
+ *
+ * @Author: Fcx
+ * @Date: 2019/11/25 15:07
+ * @Version 1.0
+ */
+public interface IOperatingRankDubboService {
+
+    /**
+     * 获取一个指定数量的排行榜列表
+     *
+     * @param dto 所需参数: rankKey reverse page size
+     * @return
+     */
+    Result<List<ResponseUserScore>> getRankList(RequestRankDto dto);
+
+    /**
+     * 获取排行榜的总人数
+     *
+     * @param dto 所需参数: rankKey reverse
+     * @return
+     */
+    Result<ResponseRankIntro> getRankSizeAndTotalScore(RequestRankDto dto);
+
+    /**
+     * 获取用户rankKey对应的所有排行榜,目前包括正确率和答题速度
+     *
+     * @param dto 所需参数: rankKey reverse userId
+     * @return
+     */
+    Result<ResponseUserRankDetailDTO> getRankByUserId(RequestRankDto dto);
+
+    /**
+     * 更新一个用户在某个排行榜中的分数
+     *
+     * @param dto 所需参数: rankKey reverse userId score
+     * @return
+     */
+    Result saveRankList(RequestRankDto dto);
+
+    /**
+     * 删掉一个用户在某个排行榜中的排名
+     * 传入 reverse rankKey userId
+     *
+     * @param dto
+     * @return
+     */
+    Result delUserRank(RequestRankDto dto);
+
+    /**
+     * 删掉一个排行榜
+     * 传入 reverse rankKey
+     *
+     * @return
+     */
+    Result delRank(RequestRankDto dto);
+}

+ 19 - 0
operating-api/src/main/java/com/txz/operating/service/OperatingConfigDubboService.java

@@ -0,0 +1,19 @@
+package com.txz.operating.service;
+
+
+import com.txz.operating.dto.ConfigDTO;
+import com.txz.operating.result.Result;
+
+/**
+ * 配置管理
+ */
+public interface OperatingConfigDubboService {
+
+	/**
+	 * 通过code获取config
+	 * @param code
+	 * @return
+	 */
+	Result<ConfigDTO> getConfigByCode(String code);
+
+}

+ 23 - 0
operating-api/src/main/java/com/txz/operating/service/OperatingInterfacesDubboService.java

@@ -0,0 +1,23 @@
+package com.txz.operating.service;
+
+
+import com.txz.operating.dto.ErrorCodeDTO;
+import com.txz.operating.dto.InterfacesDTO;
+import com.txz.operating.result.Result;
+
+public interface OperatingInterfacesDubboService {
+
+	/**
+	 * 通过接口名获取接口信息
+	 * @param servicePath
+	 * @return
+	 */
+	Result<InterfacesDTO> detailForGateway(String servicePath);
+
+	/**
+	 * 通过接口名获取接口信息
+	 * @param servicePath
+	 * @return
+	 */
+	Result<ErrorCodeDTO> getErrorCode(String servicePath, String retCode);
+}

+ 16 - 0
operating-api/src/main/resources/i18n/error.properties

@@ -0,0 +1,16 @@
+BUSINESS_ERROR_001=\u8BF7\u68C0\u67E5\u624B\u673A\u53F7\u662F\u5426\u6B63\u786E
+BUSINESS_ERROR_002=\u624B\u673A\u53F7\u548C\u5BC6\u7801\u4E0D\u5339\u914D
+BUSINESS_ERROR_003=APP\u767B\u5F55\u6388\u6743\u5931\u8D25
+BUSINESS_ERROR_004=AccountKit \u767B\u5F55\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u9A8C\u8BC1
+BUSINESS_ERROR_005=\u624B\u673A\u53F7\u5DF2\u6CE8\u518C
+BUSINESS_ERROR_006=\u9A8C\u8BC1\u5DF2\u8FC7\u671F
+BUSINESS_ERROR_007=\u9A8C\u8BC1\u7801\u9519\u8BEF
+BUSINESS_ERROR_008=\u8BBE\u7F6E\u5BC6\u7801\u5931\u8D25
+BUSINESS_ERROR_009=\u8BF7\u91CD\u65B0\u9A8C\u8BC1code
+BUSINESS_ERROR_010=Facebook \u767B\u5F55\u5931\u8D25
+BUSINESS_ERROR_011=\u6B64 Facebook \u5DF2\u88AB\u5176\u4ED6\u8D26\u53F7\u4F7F\u7528
+BUSINESS_ERROR_012=\u8BF7\u60A8\u5148\u767B\u9646
+BUSINESS_ERROR_013=\u7CFB\u7EDF\u5185\u90E8\u5F02\u5E38\uFF0Csource \u8BF7\u6C42\u53C2\u6570\u4E0D\u5408\u6CD5
+BUSINESS_ERROR_014=\u624B\u673A\u53F7\u5DF2\u5173\u8054\u8FC7\u5176\u4ED6 Facebook \u8D26\u53F7\uFF0C\u8BF7\u6362\u4E00\u4E2A\u53F7\u7801\u8BD5\u8BD5
+
+PARAMETER_ERROR_001=\u65E0\u6548\u7684\u53C2\u6570

+ 16 - 0
operating-api/src/main/resources/i18n/error_in_ID.properties

@@ -0,0 +1,16 @@
+BUSINESS_ERROR_001=Silakan periksa apakah nomor telepon sudah benar
+BUSINESS_ERROR_002=Nomor telepon dan kata sandi tidak cocok
+BUSINESS_ERROR_003=Otorisasi login APP gagal
+BUSINESS_ERROR_004=Login Akun gagal, harap verifikasi ulang
+BUSINESS_ERROR_005=Nomor anda telah diregistrasi
+BUSINESS_ERROR_006=Verifikasi telah kedaluwarsa
+BUSINESS_ERROR_007=Kode verifikasi salah
+BUSINESS_ERROR_008=Gagal mengatur kata sandi
+BUSINESS_ERROR_009=Harap verifikasi ulang kodenya
+BUSINESS_ERROR_010=Verifikasi Facebook gagal
+BUSINESS_ERROR_011=Akun Facebook ini telah digunakan oleh akun lain
+BUSINESS_ERROR_012=Silahkan login
+BUSINESS_ERROR_013=Kesalahan internal sistem
+BUSINESS_ERROR_014=Nomor telepon ini telah terhubung dengan akun Facebook, silahkan ganti nomor untuk mencoba
+
+PARAMETER_ERROR_001=Parameter tidak valid

+ 142 - 0
operating-service/pom.xml

@@ -0,0 +1,142 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <parent>
+        <artifactId>operating</artifactId>
+        <groupId>com.txz</groupId>
+        <version>1.0.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>operating-service</artifactId>
+    <packaging>jar</packaging>
+    <version>1.0.0-SNAPSHOT</version>
+    <properties>
+        <java.version>1.8</java.version>
+    </properties>
+
+    <!-- Inherit defaults from Spring Boot -->
+    <dependencies>
+        <!--        <dependency>-->
+        <!--            <groupId>org.springframework.boot</groupId>-->
+        <!--            <artifactId>spring-boot-starter-data-redis</artifactId>-->
+        <!--        </dependency>-->
+        <dependency>
+            <groupId>org.redisson</groupId>
+            <artifactId>redisson</artifactId>
+            <version>3.13.1</version>
+        </dependency>
+        <dependency>
+            <groupId>com.qcloud</groupId>
+            <artifactId>cos_api</artifactId>
+            <version>5.6.15</version>
+        </dependency>
+        <!-- rocketMQ start-->
+        <dependency>
+            <groupId>org.apache.rocketmq</groupId>
+            <artifactId>rocketmq-spring-boot-starter</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-zipkin</artifactId>
+        </dependency>
+
+        <!--格式化sql日志-->
+        <dependency>
+            <groupId>p6spy</groupId>
+            <artifactId>p6spy</artifactId>
+            <version>3.8.6</version>
+        </dependency>
+        <!--Spring Boot依赖-->
+<!--        <dependency>-->
+<!--            <groupId>com.txz</groupId>-->
+<!--            <artifactId>cif-api</artifactId>-->
+<!--            <version>1.0.0-SNAPSHOT</version>-->
+<!--            <exclusions>-->
+<!--                <exclusion>-->
+<!--                    <groupId>com.github.binarywang</groupId>-->
+<!--                    <artifactId>wx-java-mp-spring-boot-starter</artifactId>-->
+<!--                </exclusion>-->
+<!--            </exclusions>-->
+<!--        </dependency>-->
+        <!--Spring Boot依赖-->
+
+        <!--异维科技dubbo接口包依赖-->
+        <dependency>
+            <groupId>com.txz</groupId>
+            <artifactId>operating-api</artifactId>
+            <version>1.0.1-SNAPSHOT</version>
+        </dependency>
+
+        <!--test依赖-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <!--异维科技公共包依赖-->
+        <dependency>
+            <groupId>com.txz</groupId>
+            <artifactId>common</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+            <version>5.2.4</version>
+            <scope>compile</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>com.tencentcloudapi</groupId>
+            <artifactId>tencentcloud-sdk-java</artifactId>
+            <!-- 请到 https://search.maven.org/search?q=tencentcloud-sdk-java 查询最新版本 -->
+            <version>3.1.158</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.baidu.aip</groupId>
+            <artifactId>java-sdk</artifactId>
+            <version>4.15.1</version>
+            <exclusions>
+                <exclusion>
+                    <artifactId>guava</artifactId>
+                    <groupId>com.google.guava</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <configuration>
+                    <finalName>operating</finalName>
+                </configuration>
+            </plugin>
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>${java.version}</source>
+                    <target>${java.version}</target>
+                    <encoding>UTF-8</encoding>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>${maven-surefire-plugin.version}</version>
+                <configuration>
+                    <skipTests>true</skipTests>  <!--默认关掉单元测试 -->
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+
+</project>

+ 19 - 0
operating-service/src/main/java/com/txz/operating/FeignConfiguration.java

@@ -0,0 +1,19 @@
+//package com.txz.operating;
+//import feign.Request;
+//import org.springframework.beans.factory.annotation.Value;
+//import org.springframework.context.annotation.Bean;
+//import org.springframework.context.annotation.Configuration;
+//
+//@Configuration
+//public class FeignConfiguration {
+//    @Value("${feign.connectTimeout:60000}")
+//    private int connectTimeout;
+//
+//    @Value("${feign.readTimeOut:60000}")
+//    private int readTimeout;
+//
+//    @Bean
+//    public Request.Options options() {
+//        return new Request.Options(connectTimeout, readTimeout);
+//    }
+//}

+ 54 - 0
operating-service/src/main/java/com/txz/operating/OperatingApplication.java

@@ -0,0 +1,54 @@
+package com.txz.operating;
+
+import com.spring4all.swagger.EnableSwagger2Doc;
+import com.txz.operating.configurer.RibbonWeightedResponseTimeRuleConfig;
+import com.txz.operating.configurer.shutdown.GracefulShutdownUndertowWrapper;
+import io.undertow.UndertowOptions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.web.client.RestTemplateBuilder;
+import org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory;
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
+import org.springframework.cloud.client.loadbalancer.LoadBalanced;
+import org.springframework.cloud.netflix.ribbon.RibbonClient;
+import org.springframework.cloud.netflix.ribbon.RibbonClients;
+import org.springframework.context.annotation.Bean;
+import org.springframework.web.client.RestTemplate;
+
+@EnableDiscoveryClient
+@SpringBootApplication
+@EnableSwagger2Doc
+@RibbonClients(value = {
+        @RibbonClient(name = "operating",configuration = RibbonWeightedResponseTimeRuleConfig.class)
+})
+//@EnableFeignClients(basePackages = {"com.txz.operating.service"})
+public class OperatingApplication {
+
+    public static void main(String[] args) throws Exception {
+        SpringApplication.run(OperatingApplication.class, args);
+    }
+
+    @Autowired
+    private GracefulShutdownUndertowWrapper gracefulShutdownUndertowWrapper;
+
+    @Bean
+    public UndertowServletWebServerFactory servletWebServerFactory() {
+        UndertowServletWebServerFactory factory = new UndertowServletWebServerFactory();
+        factory.addDeploymentInfoCustomizers(deploymentInfo -> deploymentInfo.addOuterHandlerChainWrapper(gracefulShutdownUndertowWrapper));
+        factory.addBuilderCustomizers(builder -> builder.setServerOption(UndertowOptions.ENABLE_STATISTICS, true));
+        return factory;
+    }
+
+    /**
+     * 负载均衡
+     * 默认的负载均衡机制采用的类似轮询的这种均衡机制
+     */
+    @Bean
+    @LoadBalanced
+    public RestTemplate restTemplate(RestTemplateBuilder builder){
+        //spring官网建议RestTemplateBuilder构造器来进行构造,这里体现了构造者设计模式
+        return builder.build();
+    }
+}
+

+ 43 - 0
operating-service/src/main/java/com/txz/operating/configurer/HeaderAttribute.java

@@ -0,0 +1,43 @@
+package com.txz.operating.configurer;
+
+import org.springframework.web.bind.annotation.ControllerAdvice;
+import org.springframework.web.bind.annotation.ModelAttribute;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * @author :yuzhengqun
+ * @date :Created in 2019/11/15 17:19
+ */
+@ControllerAdvice
+public class HeaderAttribute {
+
+    @ModelAttribute(value = "userId")
+    public Long getUserId(HttpServletRequest request) {
+        String userId = request.getHeader("userId");
+        if (userId == null) {
+            return null;
+        }
+        return Long.valueOf(userId);
+    }
+
+    @ModelAttribute(value = "token")
+    public String getToken(HttpServletRequest request) {
+        String token = request.getHeader("token");
+        if (token == null) {
+            return null;
+        }
+        return token;
+    }
+
+
+    @ModelAttribute(value = "appCode")
+    public String getAppCode(HttpServletRequest request) {
+        String appCode = request.getHeader("appCode");
+        if (appCode == null) {
+            return null;
+        }
+        return appCode;
+    }
+
+}

+ 46 - 0
operating-service/src/main/java/com/txz/operating/configurer/IpConfiguration.java

@@ -0,0 +1,46 @@
+package com.txz.operating.configurer;
+
+
+import cn.hutool.core.lang.Assert;
+import org.springframework.boot.web.context.WebServerInitializedEvent;
+import org.springframework.context.ApplicationListener;
+import org.springframework.stereotype.Component;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
+@Component
+public class IpConfiguration implements ApplicationListener<WebServerInitializedEvent> {
+
+    private int serverPort;
+
+
+    @Override
+    public void onApplicationEvent(WebServerInitializedEvent event) {
+        this.serverPort = event.getWebServer().getPort();
+    }
+
+    public int getPort() {
+        return this.serverPort;
+    }
+
+    public String getIpAndPort() {
+        InetAddress address = null;
+        try {
+            address = InetAddress.getLocalHost();
+        } catch (UnknownHostException e) {
+            e.printStackTrace();
+        }
+        return address.getHostAddress() +":"+getPort();
+    }
+
+    public String getIp() {
+        InetAddress address = null;
+        try {
+            address = InetAddress.getLocalHost();
+        } catch (UnknownHostException e) {
+            e.printStackTrace();
+        }
+        return address.getHostAddress();
+    }
+}

+ 252 - 0
operating-service/src/main/java/com/txz/operating/configurer/MyWebMvcConfigurer.java

@@ -0,0 +1,252 @@
+package com.txz.operating.configurer;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.serializer.SerializeConfig;
+import com.alibaba.fastjson.serializer.SerializerFeature;
+import com.alibaba.fastjson.serializer.ToStringSerializer;
+import com.alibaba.fastjson.support.config.FastJsonConfig;
+import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
+import com.txz.operating.core.ProjectConstant;
+import com.txz.operating.core.ResultCode;
+import com.txz.operating.core.ServiceException;
+import com.txz.operating.core.cache.CacheKey;
+import com.txz.operating.core.cache.CacheType;
+import com.txz.operating.result.Result;
+import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.http.MediaType;
+import org.springframework.http.converter.HttpMessageConverter;
+import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
+import org.springframework.web.method.HandlerMethod;
+import org.springframework.web.servlet.HandlerExceptionResolver;
+import org.springframework.web.servlet.ModelAndView;
+import org.springframework.web.servlet.NoHandlerFoundException;
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
+
+import javax.annotation.Resource;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Spring MVC 配置
+ */
+@Configuration
+public class MyWebMvcConfigurer implements WebMvcConfigurer {
+
+    private final Logger  logger = LoggerFactory.getLogger(MyWebMvcConfigurer.class);
+    @Resource
+    private Parameters parameters;
+
+    @Resource
+    private RedisTemplate redisTemplate;
+
+    @Override
+    public void addResourceHandlers(ResourceHandlerRegistry registry) {
+
+        registry.addResourceHandler("swagger-ui.html")
+                .addResourceLocations("classpath:/META-INF/resources/");
+        registry.addResourceHandler("docs.html")
+                .addResourceLocations("classpath:/META-INF/resources/");
+        registry.addResourceHandler("doc.html")
+                .addResourceLocations("classpath:/META-INF/resources/");
+
+        registry.addResourceHandler("/webjars/**")
+                .addResourceLocations("classpath:/META-INF/resources/webjars/");
+    }
+
+    // 使用阿里 FastJson 作为JSON MessageConverter
+    @Override
+    public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
+        for (int i = converters.size() - 1; i >= 0; i--) {
+            if (converters.get(i) instanceof MappingJackson2HttpMessageConverter) {
+                converters.remove(i);
+            }
+        }
+        FastJsonHttpMessageConverter fastJsonHttpMessageConverter = new FastJsonHttpMessageConverter();
+        //自定义fastjson配置
+        FastJsonConfig config = new FastJsonConfig();
+        config.setDateFormat("yyyy-MM-dd HH:mm:ss");
+        config.setSerializerFeatures(
+                SerializerFeature.WriteMapNullValue,        // 是否输出值为null的字段,默认为false,我们将它打开
+                SerializerFeature.WriteNullListAsEmpty,     // 将Collection类型字段的字段空值输出为[]
+                SerializerFeature.WriteNullStringAsEmpty,   // 将字符串类型字段的空值输出为空字符串
+                SerializerFeature.WriteNullNumberAsZero,    // 将数值类型字段的空值输出为0
+                SerializerFeature.WriteDateUseDateFormat,
+                SerializerFeature.DisableCircularReferenceDetect    // 禁用循环引用
+        );
+        SerializeConfig serializeConfig = SerializeConfig.globalInstance;
+        serializeConfig.put(BigInteger.class, ToStringSerializer.instance);
+        serializeConfig.put(Long.class, ToStringSerializer.instance);
+        serializeConfig.put(Long.TYPE, ToStringSerializer.instance);
+        config.setSerializeConfig(serializeConfig);
+        fastJsonHttpMessageConverter.setFastJsonConfig(config);
+        // 添加支持的MediaTypes;不添加时默认为*/*,也就是默认支持全部
+        // 但是MappingJackson2HttpMessageConverter里面支持的MediaTypes为application/json
+        // 参考它的做法, fastjson也只添加application/json的MediaType
+        List<MediaType> fastMediaTypes = new ArrayList<>();
+        fastMediaTypes.add(MediaType.APPLICATION_JSON_UTF8);
+        fastJsonHttpMessageConverter.setSupportedMediaTypes(fastMediaTypes);
+        converters.add(fastJsonHttpMessageConverter);
+        // 设置项目名称
+        ProjectConstant.application = parameters.getApplication();
+    }
+
+    // 统一异常处理
+    @Override
+    public void configureHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers) {
+        exceptionResolvers.add((request, response, handler, e) -> {
+            Result result = new Result();
+            if (e instanceof ServiceException) {// 业务失败的异常,如“账号或密码错误”
+                result.setCode(ResultCode.FAIL.getCode()).setMessage(e.getMessage());
+                logger.info(e.getMessage());
+            } else if (e instanceof NoHandlerFoundException) {
+                result.setCode(ResultCode.NOT_FOUND.getCode()).setMessage(
+                    "接口 [" + request.getRequestURI() + "] 不存在");
+            } else if (e instanceof ServletException) {
+                result.setCode(ResultCode.FAIL.getCode()).setMessage(e.getMessage());
+            } else {
+                result.setCode(ResultCode.INTERNAL_SERVER_ERROR.getCode()).setMessage(
+                    "接口 [" + request.getRequestURI() + "] 内部错误,请联系管理员");
+                String message;
+                if (handler instanceof HandlerMethod) {
+                    HandlerMethod handlerMethod = (HandlerMethod) handler;
+                    message = String.format("接口 [%s] 出现异常,方法:%s.%s,异常摘要:%s",
+                        request.getRequestURI(), handlerMethod.getBean().getClass().getName(),
+                        handlerMethod.getMethod().getName(), e.getMessage());
+                } else {
+                    message = e.getMessage();
+                }
+                logger.error(message, e);
+            }
+            responseResult(response, result);
+            return new ModelAndView();
+        });
+    }
+
+    // 解决跨域问题
+    @Override
+    public void addCorsMappings(CorsRegistry registry) {
+         registry.addMapping("/**");
+    }
+
+    // 添加拦截器
+    @Override
+    public void addInterceptors(InterceptorRegistry registry) {
+        // 接口签名认证拦截器,该签名认证比较简单,实际项目中可以使用Json Web Token或其他更好的方式替代。
+        if ("true".equals(parameters.getSignature())) { // 开发环境忽略签名认证
+            registry.addInterceptor(new HandlerInterceptorAdapter() {
+                @Override
+                public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
+                                         Object handler) throws Exception {
+                    // 验证签名
+                    boolean pass = validateSign(request);
+                    if (pass) {
+                        return true;
+                    } else {
+                        logger.warn("签名认证失败,请求接口:{},请求IP:{},请求参数:{}", request.getRequestURI(),
+                            getIpAddress(request), JSON.toJSONString(request.getParameterMap()));
+
+                        Result result = new Result();
+                        result.setCode(ResultCode.UNAUTHORIZED.getCode()).setMessage("签名认证失败");
+                        responseResult(response, result);
+                        return false;
+                    }
+                }
+            });
+        }
+    }
+
+    private void responseResult(HttpServletResponse response, Result result) {
+        response.setCharacterEncoding("UTF-8");
+        response.setHeader("Content-type", "application/json;charset=UTF-8");
+        response.setStatus(200);
+        try {
+            response.getWriter().write(JSON.toJSONString(result));
+        } catch (IOException ex) {
+            logger.error(ex.getMessage());
+        }
+    }
+
+    /**
+     * 一个简单的登录认证
+     */
+    private boolean validateLogin(HttpServletRequest request) {
+        String userId = request.getParameter("userId");
+        if (StringUtils.isBlank(userId)) {
+            return false;
+        }
+        CacheKey key = CacheKey.generateKey(CacheType.AppSecretKey, userId);
+        boolean exists = redisTemplate.hasKey(key.toString());
+        if (exists) {
+            return true;
+        } else {
+            return false;
+        }
+
+    }
+
+    /**
+     * 一个简单的签名认证,规则: 1. 将请求参数按ascii码排序 2. 拼接为a=value&b=value...这样的字符串(不包含sign)
+     * 3. 混合密钥(secret)进行md5获得签名,与请求的签名进行比较
+     */
+    private boolean validateSign(HttpServletRequest request) {
+        String requestSign = request.getParameter("sign");// 获得请求签名,如sign=19e907700db7ad91318424a97c54ed57
+        if (StringUtils.isEmpty(requestSign)) {
+            return false;
+        }
+        List<String> keys = new ArrayList<String>(request.getParameterMap().keySet());
+        keys.remove("sign");// 排除sign参数
+        Collections.sort(keys);// 排序
+
+        StringBuilder sb = new StringBuilder();
+        for (String key : keys) {
+            sb.append(key).append("=").append(request.getParameter(key)).append("&");// 拼接字符串
+        }
+        String linkString = sb.toString();
+        linkString = StringUtils.substring(linkString, 0, linkString.length() - 1);// 去除最后一个'&'
+
+        String secret = "Potato";// 密钥,自己修改
+        String sign = DigestUtils.md5Hex(linkString + secret);// 混合密钥md5
+
+        return StringUtils.equals(sign, requestSign);// 比较
+    }
+
+    private String getIpAddress(HttpServletRequest request) {
+        String ip = request.getHeader("x-forwarded-for");
+        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+            ip = request.getHeader("Proxy-Client-IP");
+        }
+        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+            ip = request.getHeader("WL-Proxy-Client-IP");
+        }
+        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+            ip = request.getHeader("HTTP_CLIENT_IP");
+        }
+        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+            ip = request.getHeader("HTTP_X_FORWARDED_FOR");
+        }
+        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+            ip = request.getRemoteAddr();
+        }
+        // 如果是多级代理,那么取第一个ip为客户端ip
+        if (ip != null && ip.indexOf(",") != -1) {
+            ip = ip.substring(0, ip.indexOf(",")).trim();
+        }
+
+        return ip;
+    }
+}

+ 49 - 0
operating-service/src/main/java/com/txz/operating/configurer/MybatisConfigurer.java

@@ -0,0 +1,49 @@
+package com.txz.operating.configurer;
+
+import com.txz.operating.core.ProjectConstant;
+import org.apache.ibatis.session.SqlSessionFactory;
+import org.mybatis.spring.SqlSessionFactoryBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
+import org.springframework.core.io.support.ResourcePatternResolver;
+import tk.mybatis.spring.mapper.MapperScannerConfigurer;
+
+import javax.sql.DataSource;
+import java.util.Properties;
+
+/**
+ * Mybatis & Mapper & PageHelper 配置
+ */
+@Configuration
+public class MybatisConfigurer {
+
+    @Bean
+    public SqlSessionFactory sqlSessionFactoryBean(DataSource dataSource) throws Exception {
+        SqlSessionFactoryBean factory = new SqlSessionFactoryBean();
+        factory.setDataSource(dataSource);
+        factory.setTypeAliasesPackage(ProjectConstant.MODEL_PACKAGE);
+
+        //添加XML目录
+        ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
+        factory.setMapperLocations(resolver.getResources("classpath:mapper/*.xml"));
+        return factory.getObject();
+    }
+
+    @Bean
+    public MapperScannerConfigurer mapperScannerConfigurer() {
+        MapperScannerConfigurer mapperScannerConfigurer = new MapperScannerConfigurer();
+        mapperScannerConfigurer.setSqlSessionFactoryBeanName("sqlSessionFactoryBean");
+        mapperScannerConfigurer.setBasePackage(ProjectConstant.MAPPER_PACKAGE);
+
+        //配置通用Mapper,详情请查阅官方文档
+        Properties properties = new Properties();
+        properties.setProperty("mappers", ProjectConstant.MAPPER_INTERFACE_REFERENCE);
+        properties.setProperty("notEmpty", "false");//insert、update是否判断字符串类型!='' 即 test="str != null"表达式内是否追加 and str != ''
+        properties.setProperty("IDENTITY", "MYSQL");
+        mapperScannerConfigurer.setProperties(properties);
+
+        return mapperScannerConfigurer;
+    }
+
+}

+ 96 - 0
operating-service/src/main/java/com/txz/operating/configurer/Parameters.java

@@ -0,0 +1,96 @@
+package com.txz.operating.configurer;
+
+import lombok.Data;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.cloud.context.config.annotation.RefreshScope;
+import org.springframework.stereotype.Component;
+
+@Component
+@Data
+@RefreshScope
+public class Parameters {
+    /**
+     *
+     当前激活的配置文件
+     */
+    @Value("${spring.profiles.active}")
+    private String        env;
+
+    /**
+     *
+     是否启用签名
+     */
+    @Value("${signature}")
+    private String        signature;
+
+    /**
+     * 是否启用登录验证
+     */
+    @Value("${dubbo.registry.address}")
+    private String        dubboRegistryAddress;
+
+    /**
+     * 是否启用登录验证
+     */
+    @Value("${login.check}")
+    private String        loginCheck;
+
+    @Value("${spring.application.name}")
+    private String        application;
+
+    @Value("${jbs.url}")
+    private String        jbsUrl;
+
+    @Value("${cos.bucketName}")
+    private String cosBucketName; //桶的名称
+
+    @Value("${cos.region}")
+    private String cosRegion;//区域上海
+
+    @Value("${cos.appId}")
+    private String cosAppId; //APPID
+
+    @Value("${cos.secretId}")
+    private String cosSecretId; //SecretId 是用于标识 API 调用者的身份
+
+    @Value("${cos.secretKey}")
+    private String cosSecretKey; //SecretKey是用于加密签名字符串和服务器端验证签名字符串的密钥
+
+    @Value("${baidu.map.url}")
+    private String baiduMapUrl = "http://api.map.baidu.com/place/v2/search";
+
+    @Value("${baidu.map.ak}")
+    private String baiduMapAk = "0lzCFQAArNsjnm56HTGXSGNIFmUGCpwc";
+
+    @Value("${lottery.record.save.ids}")
+    private String lotterySaveIds = ",13,14,15,";
+
+    @Value("${tx.secret.id}")
+    private String secretId ;
+
+    @Value("${tx.secret.key}")
+    private String secretKey ;
+
+    @Value("${baidu.app.id}")
+    private String baiduAppId ;
+
+    @Value("${baidu.apk.key}")
+    private String baiduApkKey ;
+
+    @Value("${baidu.secret.key}")
+    private String baiduSecretKey ;
+
+    /**
+     * 通行证开关 off关闭 其他开启
+     */
+    @Value("${permit.service}")
+    private String permitService ;
+
+    @Value("${open.appCode}")
+    private String  openAppCode ;
+
+
+
+
+
+}

+ 21 - 0
operating-service/src/main/java/com/txz/operating/configurer/RibbonWeightedResponseTimeRuleConfig.java

@@ -0,0 +1,21 @@
+package com.txz.operating.configurer;
+
+import com.netflix.loadbalancer.IRule;
+import com.netflix.loadbalancer.WeightedResponseTimeRule;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * @Author: Fcx
+ * @Date: 2022/3/14 12:32
+ * @Version 1.0
+ */
+@Configuration
+public class RibbonWeightedResponseTimeRuleConfig {
+
+    //方法名一定要叫iRule
+    @Bean
+    public IRule iRule(){
+        return new WeightedResponseTimeRule();
+    }
+}

+ 56 - 0
operating-service/src/main/java/com/txz/operating/configurer/StartLoadConfig.java

@@ -0,0 +1,56 @@
+package com.txz.operating.configurer;
+
+import cn.hutool.core.util.ArrayUtil;
+import com.txz.operating.constants.RedisConstants;
+import com.txz.operating.dto.InterfacesDTO;
+import com.txz.operating.model.Interfaces;
+import com.txz.operating.service.InterfacesService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @author Fcx
+ */
+@Component
+@Slf4j
+public class StartLoadConfig implements CommandLineRunner {
+
+    @Autowired
+    private RedisTemplate redisTemplate;
+    @Autowired
+    private InterfacesService interfacesService;
+
+    @Override
+    public void run(String... strings) {
+        if (redisTemplate.opsForHash().size(RedisConstants.INTERFACES_MAP) > 0 && ArrayUtil.isEmpty(strings)) {
+            // 有数据, 没参数, 不执行
+            return;
+        }
+        if (ArrayUtil.isEmpty(strings)) {
+            // 没有数据, 没有参数, 全部刷新
+            reloadInterfaces();
+            return;
+        }
+        for (String string : strings) {
+            // 有参数, 按参数刷新
+            if ("interfaces".equals(string)) {
+                reloadInterfaces();
+            }
+        }
+        System.out.println("初始加载######################################################");
+    }
+
+    private void reloadInterfaces() {
+        redisTemplate.delete(RedisConstants.INTERFACES_MAP);
+        List<Interfaces> all = interfacesService.findAll();
+        for (Interfaces interfaces : all) {
+            redisTemplate.opsForHash().put(RedisConstants.INTERFACES_MAP, interfaces.getServicePath(), InterfacesDTO.generator(interfaces));
+        }
+    }
+
+}

+ 65 - 0
operating-service/src/main/java/com/txz/operating/configurer/SwaggerConfig.java

@@ -0,0 +1,65 @@
+package com.txz.operating.configurer;
+
+import io.swagger.annotations.ApiOperation;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Profile;
+import springfox.documentation.builders.ApiInfoBuilder;
+import springfox.documentation.builders.ParameterBuilder;
+import springfox.documentation.builders.PathSelectors;
+import springfox.documentation.builders.RequestHandlerSelectors;
+import springfox.documentation.schema.ModelRef;
+import springfox.documentation.service.ApiInfo;
+import springfox.documentation.service.Contact;
+import springfox.documentation.service.Parameter;
+import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.spring.web.plugins.Docket;
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Fcx
+ */
+@Configuration
+@EnableSwagger2
+@Profile({"dev","test"})
+public class SwaggerConfig {
+
+    @Bean
+    public Docket docket(){
+        //添加header参数
+        List<Parameter> pars = new ArrayList<>();
+        ParameterBuilder ticketPar = new ParameterBuilder();
+        ticketPar.name("token").description("user token")
+                .modelRef(new ModelRef("string")).parameterType("header")
+                .required(false).build(); //header中的ticket参数非必填,传空也可以
+        ticketPar = new ParameterBuilder();
+        ticketPar.name("appCode").description("appCode")
+                .modelRef(new ModelRef("string")).parameterType("header")
+                .required(false).build(); //header中的ticket参数非必填,传空也可以
+
+        pars.add(ticketPar.build());
+        return new Docket(DocumentationType.SWAGGER_2)
+                .globalOperationParameters(pars)
+                .groupName("demo")
+                .apiInfo(getApiInfo())
+                .select()
+                //设置basePackage会将包下的所有被@Api标记类的所有方法作为api
+                .apis(RequestHandlerSelectors.basePackage("com.txz.project.web"))
+                //只有标记了@ApiOperation的方法才会暴露出给swagger
+                .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
+                .paths(PathSelectors.regex("/api/.*")).build();
+    }
+
+    private ApiInfo getApiInfo(){
+        return new ApiInfoBuilder()
+                .title("API接口文档")
+                .description("swagger2 demo api")
+                .termsOfServiceUrl("http://localhost/swagger-ui.html")
+                .version("1.0").contact(new Contact("admin", "http://localhost/swagger-ui.html", "xxx@qq.com"))
+                .build();
+    }
+
+}

+ 101 - 0
operating-service/src/main/java/com/txz/operating/configurer/log/WebLogAspect.java

@@ -0,0 +1,101 @@
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+package com.txz.operating.configurer.log;
+
+import com.alibaba.fastjson.JSONObject;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.Signature;
+import org.aspectj.lang.annotation.AfterReturning;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Before;
+import org.aspectj.lang.annotation.Pointcut;
+import org.aspectj.lang.reflect.CodeSignature;
+import org.aspectj.lang.reflect.MethodSignature;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+
+@Aspect
+@Component
+public class WebLogAspect {
+    private static Logger logger = LoggerFactory.getLogger(WebLogAspect.class);
+
+    public WebLogAspect() {
+    }
+
+    @Pointcut("execution(public * com.txz.operating.web..*Controller.*(..))")
+    public void webLog() {
+    }
+
+    private static String[] types = {"java.lang.Integer", "java.lang.Double",
+            "java.lang.Float", "java.lang.Long", "java.lang.Short",
+            "java.lang.Byte", "java.lang.Boolean", "java.lang.Char",
+            "java.lang.String", "int", "double", "long", "short", "byte",
+            "boolean", "char", "float"};
+
+    @Before("webLog()")
+    public void doBefore(JoinPoint joinPoint) throws Throwable {
+        try {
+            // 接收到请求,记录请求内容
+            ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+            HttpServletRequest request = attributes.getRequest();
+            HttpServletResponse response = attributes.getResponse();
+            String logStr = "";
+            // 记录下请求内容
+            logStr += "URL:" + request.getRequestURI() + " | ";
+            logStr += "token:" + request.getHeader("token") + " | ";
+            logStr += "appCode:" + request.getHeader("appCode") + " | ";
+            logStr += "CLASS_METHOD:" + joinPoint.getSignature().getDeclaringType().getSimpleName() + "." + joinPoint.getSignature().getName() + " | ";
+            logStr += "ARGS:";
+            // joinPoint获取参数名
+            String[] params = ((CodeSignature) joinPoint.getStaticPart().getSignature()).getParameterNames();
+            // joinPoint获取参数值
+            Object[] args = joinPoint.getArgs();
+            Signature signature = joinPoint.getSignature();
+            MethodSignature methodSignature = (MethodSignature) signature;
+            Method method = methodSignature.getMethod();
+            // 打印请求参数
+            int i = 0;
+            for (Object arg : args) {
+                if (arg == request || arg == response) {
+                    i += 1;
+                    continue;
+                }
+                String typeName = "";
+                try {
+                    typeName = arg.getClass().getTypeName();
+                } catch (Exception e) {
+                }
+                if (!Arrays.asList(types).contains(typeName)) {
+                    // 把参数转成json格式
+                    logStr += "&" + params[i] + "=" + JSONObject.toJSONString(arg);
+                } else {
+                    logStr += "&" + params[i] + "=" + arg;
+                }
+                i += 1;
+            }
+            logStr += " | ";
+            logger.info(logStr);
+        } catch (Throwable e) {
+            logger.error("HaLogParamAspect error.", e);
+        }
+    }
+
+    @AfterReturning(
+        returning = "ret",
+        pointcut = "webLog()"
+    )
+    public void doAfterReturning(Object ret) throws Throwable {
+        logger.info("RESPONSE : {}", ret);
+    }
+}

+ 49 - 0
operating-service/src/main/java/com/txz/operating/configurer/shutdown/GracefulShutdownUndertow.java

@@ -0,0 +1,49 @@
+package com.txz.operating.configurer.shutdown;
+
+/**
+ * @Author: Fcx
+ * @Date: 2019/11/29 15:08
+ * @Version 1.0
+ */
+import io.undertow.Undertow;
+import io.undertow.server.ConnectorStatistics;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.web.embedded.undertow.UndertowServletWebServer;
+import org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext;
+import org.springframework.context.ApplicationListener;
+import org.springframework.context.event.ContextClosedEvent;
+import org.springframework.stereotype.Component;
+
+import java.lang.reflect.Field;
+import java.util.List;
+
+/**
+ *
+ * 优雅关闭 Spring Boot undertow
+ */
+@Component
+public class GracefulShutdownUndertow implements ApplicationListener<ContextClosedEvent> {
+
+    @Autowired
+    private GracefulShutdownUndertowWrapper gracefulShutdownUndertowWrapper;
+
+    @Autowired
+    private ServletWebServerApplicationContext context;
+
+    @Override
+    public void onApplicationEvent(ContextClosedEvent contextClosedEvent){
+        gracefulShutdownUndertowWrapper.getGracefulShutdownHandler().shutdown();
+        try {
+            UndertowServletWebServer webServer = (UndertowServletWebServer)context.getWebServer();
+            Field field = webServer.getClass().getDeclaredField("undertow");
+            field.setAccessible(true);
+            Undertow undertow = (Undertow) field.get(webServer);
+            List<Undertow.ListenerInfo> listenerInfo = undertow.getListenerInfo();
+            Undertow.ListenerInfo listener = listenerInfo.get(0);
+            ConnectorStatistics connectorStatistics = listener.getConnectorStatistics();
+            while (connectorStatistics.getActiveConnections() > 0){}
+        }catch (Exception e){
+            // Application Shutdown
+        }
+    }
+}

+ 29 - 0
operating-service/src/main/java/com/txz/operating/configurer/shutdown/GracefulShutdownUndertowWrapper.java

@@ -0,0 +1,29 @@
+package com.txz.operating.configurer.shutdown;
+
+import io.undertow.server.HandlerWrapper;
+import io.undertow.server.HttpHandler;
+import io.undertow.server.handlers.GracefulShutdownHandler;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Author: Fcx
+ * @Date: 2019/11/29 15:08
+ * @Version 1.0
+ */
+@Component
+public class GracefulShutdownUndertowWrapper implements HandlerWrapper {
+
+    private GracefulShutdownHandler gracefulShutdownHandler;
+
+    @Override
+    public HttpHandler wrap(HttpHandler handler) {
+        if (gracefulShutdownHandler == null) {
+            this.gracefulShutdownHandler = new GracefulShutdownHandler(handler);
+        }
+        return gracefulShutdownHandler;
+    }
+
+    public GracefulShutdownHandler getGracefulShutdownHandler() {
+        return gracefulShutdownHandler;
+    }
+}

+ 27 - 0
operating-service/src/main/java/com/txz/operating/configurer/shutdown/UndertowExtraConfiguration.java

@@ -0,0 +1,27 @@
+package com.txz.operating.configurer.shutdown;
+
+import io.undertow.UndertowOptions;
+import lombok.AllArgsConstructor;
+import org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory;
+import org.springframework.context.annotation.Bean;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Author: Fcx
+ * @Date: 2019/11/29 15:13
+ * @Version 1.0
+ */
+@Component
+@AllArgsConstructor
+public class UndertowExtraConfiguration {
+
+    private final GracefulShutdownUndertowWrapper gracefulShutdownWrapper;
+
+    @Bean
+    public UndertowServletWebServerFactory servletWebServerFactory() {
+        UndertowServletWebServerFactory factory = new UndertowServletWebServerFactory();
+        factory.addDeploymentInfoCustomizers(deploymentInfo -> deploymentInfo.addOuterHandlerChainWrapper(gracefulShutdownWrapper));
+        factory.addBuilderCustomizers(builder -> builder.setServerOption(UndertowOptions.ENABLE_STATISTICS, true));
+        return factory;
+    }
+}

+ 16 - 0
operating-service/src/main/java/com/txz/operating/constants/MyConstants.java

@@ -0,0 +1,16 @@
+package com.txz.operating.constants;
+
+/**
+ * 自定义常量
+ *
+ * @Author: Fcx
+ * @Date: 2019/11/25 20:15
+ * @Version 1.0
+ */
+abstract public class MyConstants {
+
+    /**
+     * 排行榜里小数位的总分,用来排序
+     */
+    public static final long RANK_TOTAL_SCORE = 100000000000000L;
+}

+ 38 - 0
operating-service/src/main/java/com/txz/operating/constants/RedisConstants.java

@@ -0,0 +1,38 @@
+package com.txz.operating.constants;
+
+/**
+ * @author Fcx
+ */
+public class RedisConstants {
+
+    /**
+     * 排行榜列表
+     */
+    public static final String RANK_LIST = "rank:list:reverse:rankKey";
+
+    /**
+     * 并列分数排行榜map
+     */
+    public static final String RANK_PARATAXIS_MAP = "rank:parataxis:map:reverse:rankKey";
+
+    /**
+     * 排行榜总分
+     */
+    public static final String RANK_TOTAL_SCORE = "rank:totalScore:reverse:rankType:rankKey";
+
+    /**
+     * 排行榜的用户信息
+     */
+    public static final String RANK_USER = "rank:user:userId";
+
+    /**
+     * 排行榜MAP的分数信息
+     */
+    public static final String RANK_MAP_SCORE = "rank:map:score:num";
+
+    /**
+     * 接口列表
+     */
+    public static final String INTERFACES_MAP = "operating:interfaces:map";
+
+}

+ 84 - 0
operating-service/src/main/java/com/txz/operating/core/AbstractService.java

@@ -0,0 +1,84 @@
+package com.txz.operating.core;
+
+import com.txz.operating.core.ServiceException;
+import org.apache.ibatis.exceptions.TooManyResultsException;
+import org.springframework.beans.factory.annotation.Autowired;
+import tk.mybatis.mapper.entity.Condition;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.ParameterizedType;
+import java.util.List;
+
+/**
+ * 基于通用MyBatis Mapper插件的Service接口的实现
+ */
+public abstract class AbstractService<T> implements Service<T> {
+
+    @Autowired
+    protected Mapper<T> mapper;
+
+    private Class<T> modelClass;    // 当前泛型真实类型的Class
+
+    public AbstractService() {
+        ParameterizedType pt = (ParameterizedType) this.getClass().getGenericSuperclass();
+        modelClass = (Class<T>) pt.getActualTypeArguments()[0];
+    }
+
+    @Override
+    public int  save(T model) {
+       return mapper.insertSelective(model);
+    }
+
+    @Override
+    public int  save(List<T> models) {
+    	return mapper.insertList(models);
+    }
+
+    @Override
+    public void deleteById(Number id) {
+        mapper.deleteByPrimaryKey(id);
+    }
+
+    @Override
+    public void deleteByIds(String ids) {
+        mapper.deleteByIds(ids);
+    }
+
+    @Override
+    public void update(T model) {
+        mapper.updateByPrimaryKeySelective(model);
+    }
+
+    @Override
+    public T findById(Number id) {
+        return mapper.selectByPrimaryKey(id);
+    }
+
+    @Override
+    public T findBy(String fieldName, Object value) throws TooManyResultsException {
+        try {
+            T model = modelClass.newInstance();
+            Field field = modelClass.getDeclaredField(fieldName);
+            field.setAccessible(true);
+            field.set(model, value);
+            return mapper.selectOne(model);
+        } catch (ReflectiveOperationException e) {
+            throw new ServiceException(e.getMessage(), e);
+        }
+    }
+
+    @Override
+    public List<T> findByIds(String ids) {
+        return mapper.selectByIds(ids);
+    }
+
+    @Override
+    public List<T> findByCondition(Condition condition) {
+        return mapper.selectByCondition(condition);
+    }
+
+    @Override
+    public List<T> findAll() {
+        return mapper.selectAll();
+    }
+}

+ 17 - 0
operating-service/src/main/java/com/txz/operating/core/Mapper.java

@@ -0,0 +1,17 @@
+package com.txz.operating.core;
+
+import tk.mybatis.mapper.common.BaseMapper;
+import tk.mybatis.mapper.common.ConditionMapper;
+import tk.mybatis.mapper.common.IdsMapper;
+import tk.mybatis.mapper.common.special.InsertListMapper;
+
+/**
+ * 定制版MyBatis Mapper插件接口,如需其他接口参考官方文档自行添加。
+ */
+public interface Mapper<T>
+        extends
+        BaseMapper<T>,
+        ConditionMapper<T>,
+        IdsMapper<T>,
+        InsertListMapper<T> {
+}

+ 47 - 0
operating-service/src/main/java/com/txz/operating/core/MessageTemplteType.java

@@ -0,0 +1,47 @@
+package com.txz.operating.core;
+
+/**
+ * 消息模板枚举
+ */
+public enum MessageTemplteType {
+
+	/** 保修报事-派单通知 */
+	DISPATCH_NOTICE("dispatchNotice", "保修报事-派单通知"),
+	/** 物业缴费-缴费提醒通知 */
+	PAYMENT_REMINDER_NOTICE("paymentReminderNotice", "物业缴费-缴费提醒通知"),
+
+
+	;
+
+	private final String code; // 状态码
+	private final String desc;
+
+	MessageTemplteType(String code, String desc) {
+		this.code = code;
+		this.desc = desc;
+	}
+
+	public String getCode() {
+		return code;
+	}
+
+	public String getDesc() {
+		return desc;
+	}
+
+	/**
+	 * 通过状态码获取ENUM的名字
+	 * 
+	 * @param statusCode
+	 * @return
+	 */
+	public static ResultCode getEnumByStatusCode(String code) {
+		for (ResultCode p : ResultCode.values()) {
+			if (p.code().equalsIgnoreCase(code)) {
+				return p;
+			}
+		}
+
+		return null;
+	}
+}

+ 41 - 0
operating-service/src/main/java/com/txz/operating/core/MyPageInfo.java

@@ -0,0 +1,41 @@
+
+
+package com.txz.operating.core;
+
+import com.github.pagehelper.PageInfo;
+import lombok.*;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * 对Page<E>结果进行包装
+ * <p/>
+ * 新增分页的多项属性,主要参考:http://bbs.csdn.net/topics/360010907
+ *
+ * @author linxk
+ */
+@Builder
+@AllArgsConstructor
+@Getter
+@Setter
+public class MyPageInfo<T> extends PageInfo {
+
+    //结果集
+    private String data;
+
+    public MyPageInfo() {
+    }
+
+    /**
+     * 包装Page对象
+     *
+     * @param list
+     */
+    public MyPageInfo(List<T> list) {
+        super(list, 8);
+    }
+
+
+}

+ 29 - 0
operating-service/src/main/java/com/txz/operating/core/ProjectConstant.java

@@ -0,0 +1,29 @@
+package com.txz.operating.core;
+
+/**
+ * 项目常量
+ */
+public final class ProjectConstant {
+    public static final String BASE_PACKAGE = "com.txz.operating";//项目基础包名称,根据自己公司的项目修改
+
+    public static final String MODEL_PACKAGE = BASE_PACKAGE + ".model";//Model所在包
+    public static final String MAPPER_PACKAGE = BASE_PACKAGE + ".dao";//Mapper所在包
+    public static final String SERVICE_PACKAGE = BASE_PACKAGE + ".service";//Service所在包
+    public static final String SERVICE_IMPL_PACKAGE = SERVICE_PACKAGE + ".impl";//ServiceImpl所在包
+    public static final String SERVICE_DTO_PACKAGE = BASE_PACKAGE + ".dto";//dto所在包
+    public static final String CONTROLLER_PACKAGE = BASE_PACKAGE + ".web.mng";//Controller所在包
+
+    public static final String MAPPER_INTERFACE_REFERENCE = BASE_PACKAGE + ".core.Mapper";//Mapper插件基础接口的完全限定名
+    //项目名称
+    public static  String application;
+
+    public static final String AREA_CODE = application + ".area.code.redis";
+
+    public static final String AREA_PROVINCE_CITY = application + ".area.province.city.redis";
+
+    public static final String INTERFACES_DETAIL = application + ".interfaces.detail.redis";
+
+    public static final String ERROR_CODE = application + ".error.code.redis";
+
+
+}

+ 542 - 0
operating-service/src/main/java/com/txz/operating/core/RedisUtil.java

@@ -0,0 +1,542 @@
+package com.txz.operating.core;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+import javax.annotation.Resource;
+
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.stereotype.Component;
+import org.springframework.util.CollectionUtils;
+ 
+ 
+/**
+ * 
+ * @author
+ * 基于spring和redis的redisTemplate工具类
+ * 针对所有的hash 都是以h开头的方法
+ * 针对所有的Set 都是以s开头的方法                    不含通用方法
+ * 针对所有的List 都是以l开头的方法
+ */
+@Component
+public class RedisUtil {
+ 
+	@Resource
+	private RedisTemplate<String, Object> redisTemplate;
+	
+	//=============================common============================
+	/**
+	 * 指定缓存失效时间
+	 * @param key 键
+	 * @param time 时间(秒)
+	 * @return
+	 */
+	public boolean expire(String key,long time){
+		try {
+			if(time>0){
+				redisTemplate.expire(key, time, TimeUnit.SECONDS);
+			}
+			return true;
+		} catch (Exception e) {
+			e.printStackTrace();
+			return false;
+		}
+	}
+	
+	/**
+	 * 根据key 获取过期时间
+	 * @param key 键 不能为null
+	 * @return 时间(秒) 返回0代表为永久有效
+	 */
+	public long getExpire(String key){
+		return redisTemplate.getExpire(key,TimeUnit.SECONDS);
+	}
+	
+	/**
+	 * 判断key是否存在
+	 * @param key 键
+	 * @return true 存在 false不存在
+	 */
+	public boolean hasKey(String key){
+		try {
+			return redisTemplate.hasKey(key);
+		} catch (Exception e) {
+			e.printStackTrace();
+			return false;
+		}
+	}
+	
+	/**
+	 * 删除缓存
+	 * @param key 可以传一个值 或多个
+	 */
+	@SuppressWarnings("unchecked")
+	public void del(String ... key){
+		if(key!=null&&key.length>0){
+			if(key.length==1){
+				redisTemplate.delete(key[0]);
+			}else{
+				redisTemplate.delete(CollectionUtils.arrayToList(key));
+			}
+		}
+	}
+	
+	//============================String=============================
+	/**
+	 * 普通缓存获取
+	 * @param key 键
+	 * @return 值
+	 */
+	public Object get(String key){
+		return key==null?null:redisTemplate.opsForValue().get(key);
+	}
+	
+	/**
+	 * 普通缓存放入
+	 * @param key 键
+	 * @param value 值
+	 * @return true成功 false失败
+	 */
+	public boolean set(String key,Object value) {
+		 try {
+			redisTemplate.opsForValue().set(key, value);
+			return true;
+		} catch (Exception e) {
+			e.printStackTrace();
+			return false;
+		}
+		
+	}
+	
+	/**
+	 * 普通缓存放入并设置时间
+	 * @param key 键
+	 * @param value 值
+	 * @param time 时间(秒) time要大于0 如果time小于等于0 将设置无限期
+	 * @return true成功 false 失败
+	 */
+	public boolean set(String key,Object value,long time){
+		try {
+			if(time>0){
+				redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS);
+			}else{
+				set(key, value);
+			}
+			return true;
+		} catch (Exception e) {
+			e.printStackTrace();
+			return false;
+		}
+	}
+	
+	/**
+	 * 递增
+	 * @param key 键
+	 * @param delta 要增加几(大于0)
+	 * @return
+	 */
+	public long incr(String key, long delta){  
+		if(delta<0){
+			throw new RuntimeException("递增因子必须大于0");
+		}
+		return redisTemplate.opsForValue().increment(key, delta);
+    }
+	
+	/**
+	 * 递减
+	 * @param key 键
+	 * @param delta 要减少几(小于0)
+	 * @return
+	 */
+	public long decr(String key, long delta){  
+		if(delta<0){
+			throw new RuntimeException("递减因子必须大于0");
+		}
+        return redisTemplate.opsForValue().increment(key, -delta);  
+    }  
+	
+	//================================Map=================================
+	/**
+	 * HashGet
+	 * @param key 键 不能为null
+	 * @param item 项 不能为null
+	 * @return 值
+	 */
+	public Object hget(String key,String item){
+		return redisTemplate.opsForHash().get(key, item);
+	}
+	
+	/**
+	 * 获取hashKey对应的所有键值
+	 * @param key 键
+	 * @return 对应的多个键值
+	 */
+	public Map<Object,Object> hmget(String key){
+		return redisTemplate.opsForHash().entries(key);
+	}
+	
+	/**
+	 * HashSet
+	 * @param key 键
+	 * @param map 对应多个键值
+	 * @return true 成功 false 失败
+	 */
+	public boolean hmset(String key, Map<String,Object> map){  
+        try {
+			redisTemplate.opsForHash().putAll(key, map);
+			return true;
+		} catch (Exception e) {
+			e.printStackTrace();
+			return false;
+		}
+    }
+	
+	/**
+	 * HashSet 并设置时间
+	 * @param key 键
+	 * @param map 对应多个键值
+	 * @param time 时间(秒)
+	 * @return true成功 false失败
+	 */
+    public boolean hmset(String key, Map<String,Object> map, long time){  
+        try {
+			redisTemplate.opsForHash().putAll(key, map);
+			if(time>0){
+				expire(key, time);
+			}
+			return true;
+		} catch (Exception e) {
+			e.printStackTrace();
+			return false;
+		}
+    }
+	
+	/**
+	 * 向一张hash表中放入数据,如果不存在将创建
+	 * @param key 键
+	 * @param item 项
+	 * @param value 值
+	 * @return true 成功 false失败
+	 */
+	public boolean hset(String key,String item,Object value) {
+		 try {
+			redisTemplate.opsForHash().put(key, item, value);
+			return true;
+		} catch (Exception e) {
+			e.printStackTrace();
+			return false;
+		}
+	}
+	
+	/**
+	 * 向一张hash表中放入数据,如果不存在将创建
+	 * @param key 键
+	 * @param item 项
+	 * @param value 值
+	 * @param time 时间(秒)  注意:如果已存在的hash表有时间,这里将会替换原有的时间
+	 * @return true 成功 false失败
+	 */
+	public boolean hset(String key,String item,Object value,long time) {
+		 try {
+			redisTemplate.opsForHash().put(key, item, value);
+			if(time>0){
+				expire(key, time);
+			}
+			return true;
+		} catch (Exception e) {
+			e.printStackTrace();
+			return false;
+		}
+	}
+	
+	/**
+	 * 删除hash表中的值
+	 * @param key 键 不能为null
+	 * @param item 项 可以使多个 不能为null
+	 */
+    public void hdel(String key, Object... item){  
+		redisTemplate.opsForHash().delete(key,item);
+    } 
+    
+    /**
+     * 判断hash表中是否有该项的值
+     * @param key 键 不能为null
+     * @param item 项 不能为null
+     * @return true 存在 false不存在
+     */
+    public boolean hHasKey(String key, String item){
+		return redisTemplate.opsForHash().hasKey(key, item);
+    } 
+	
+	/**
+	 * hash递增 如果不存在,就会创建一个 并把新增后的值返回
+	 * @param key 键
+	 * @param item 项
+	 * @param by 要增加几(大于0)
+	 * @return
+	 */
+	public double hincr(String key, String item,double by){  
+        return redisTemplate.opsForHash().increment(key, item, by);
+    }
+	
+	/**
+	 * hash递减
+	 * @param key 键
+	 * @param item 项
+	 * @param by 要减少记(小于0)
+	 * @return
+	 */
+	public double hdecr(String key, String item,double by){  
+        return redisTemplate.opsForHash().increment(key, item,-by);  
+    }  
+	
+	//============================set=============================
+	/**
+	 * 根据key获取Set中的所有值
+	 * @param key 键
+	 * @return
+	 */
+	public Set<Object> sGet(String key){
+		try {
+			return redisTemplate.opsForSet().members(key);
+		} catch (Exception e) {
+			e.printStackTrace();
+			return null;
+		}
+	}
+	
+	/**
+	 * 根据value从一个set中查询,是否存在
+	 * @param key 键
+	 * @param value 值
+	 * @return true 存在 false不存在
+	 */
+	public boolean sHasKey(String key,Object value){
+		try {
+			return redisTemplate.opsForSet().isMember(key, value);
+		} catch (Exception e) {
+			e.printStackTrace();
+			return false;
+		}
+	}
+	
+	/**
+	 * 将数据放入set缓存
+	 * @param key 键
+	 * @param values 值 可以是多个
+	 * @return 成功个数
+	 */
+	public long sSet(String key, Object...values) {
+        try {
+            return redisTemplate.opsForSet().add(key, values);
+        } catch (Exception e) {
+        	e.printStackTrace();
+        	return 0;
+        }
+    }
+	
+	/**
+	 * 将set数据放入缓存
+	 * @param key 键
+	 * @param time 时间(秒)
+	 * @param values 值 可以是多个
+	 * @return 成功个数
+	 */
+	public long sSetAndTime(String key,long time,Object...values) {
+        try {
+        	Long count = redisTemplate.opsForSet().add(key, values);
+        	if(time>0){
+        		expire(key, time);
+			}
+            return count;
+        } catch (Exception e) {
+        	e.printStackTrace();
+        	return 0;
+        }
+    }
+	
+	/**
+	 * 获取set缓存的长度
+	 * @param key 键
+	 * @return
+	 */
+	public long sGetSetSize(String key){
+		try {
+			return redisTemplate.opsForSet().size(key);
+		} catch (Exception e) {
+			e.printStackTrace();
+			return 0;
+		}
+	}
+	
+	/**
+	 * 移除值为value的
+	 * @param key 键
+	 * @param values 值 可以是多个
+	 * @return 移除的个数
+	 */
+	public long setRemove(String key, Object ...values) {
+        try {
+            Long count = redisTemplate.opsForSet().remove(key, values);
+            return count;
+        } catch (Exception e) {
+        	e.printStackTrace();
+        	return 0;
+        }
+    }
+    //===============================list=================================
+    
+	/**
+	 * 获取list缓存的内容
+	 * @param key 键
+	 * @param start 开始
+	 * @param end 结束  0 到 -1代表所有值
+	 * @return
+	 */
+	public List<Object> lGet(String key,long start, long end){
+		try {
+			return redisTemplate.opsForList().range(key, start, end);
+		} catch (Exception e) {
+			e.printStackTrace();
+			return null;
+		}
+	}
+	
+	/**
+	 * 获取list缓存的长度
+	 * @param key 键
+	 * @return
+	 */
+	public long lGetListSize(String key){
+		try {
+			return redisTemplate.opsForList().size(key);
+		} catch (Exception e) {
+			e.printStackTrace();
+			return 0;
+		}
+	}
+	
+	/**
+	 * 通过索引 获取list中的值
+	 * @param key 键
+	 * @param index 索引  index>=0时, 0 表头,1 第二个元素,依次类推;index<0时,-1,表尾,-2倒数第二个元素,依次类推
+	 * @return
+	 */
+	public Object lGetIndex(String key,long index){
+		try {
+			return redisTemplate.opsForList().index(key, index);
+		} catch (Exception e) {
+			e.printStackTrace();
+			return null;
+		}
+	}
+	
+	/**
+	 * 将list放入缓存
+	 * @param key 键
+	 * @param value 值
+	 * @return
+	 */
+	public boolean lSet(String key, Object value) {
+        try {
+            redisTemplate.opsForList().rightPush(key, value);
+            return true;
+        } catch (Exception e) {
+        	e.printStackTrace();
+        	return false;
+        }
+    }
+	
+	/**
+	 * 将list放入缓存
+	 * @param key 键
+	 * @param value 值
+	 * @param time 时间(秒)
+	 * @return
+	 */
+	public boolean lSet(String key, Object value, long time) {
+        try {
+            redisTemplate.opsForList().rightPush(key, value);
+            if (time > 0) {
+            	expire(key, time);
+			}
+            return true;
+        } catch (Exception e) {
+        	e.printStackTrace();
+        	return false;
+        }
+    }
+	
+	/**
+	 * 将list放入缓存
+	 * @param key 键
+	 * @param value 值
+	 * @return
+	 */
+	public boolean lSet(String key, List<Object> value) {
+	    try {
+			redisTemplate.opsForList().rightPushAll(key, value);
+			return true;
+		} catch (Exception e) {
+			e.printStackTrace();
+			return false;
+		}
+    }
+	
+	/**
+	 * 将list放入缓存
+	 * @param key 键
+	 * @param value 值
+	 * @param time 时间(秒)
+	 * @return
+	 */
+	public boolean lSet(String key, List<Object> value, long time) {
+	    try {
+			redisTemplate.opsForList().rightPushAll(key, value);
+			if (time > 0){
+				expire(key, time);
+			}
+			return true;
+		} catch (Exception e) {
+			e.printStackTrace();
+			return false;
+		}
+    }
+	
+	/**
+	 * 根据索引修改list中的某条数据
+	 * @param key 键
+	 * @param index 索引
+	 * @param value 值
+	 * @return
+	 */
+	public boolean lUpdateIndex(String key, long index,Object value) {
+	    try {
+			redisTemplate.opsForList().set(key, index, value);
+			return true;
+		} catch (Exception e) {
+			e.printStackTrace();
+			return false;
+		}
+    } 
+	
+	/**
+	 * 移除N个值为value 
+	 * @param key 键
+	 * @param count 移除多少个
+	 * @param value 值
+	 * @return 移除的个数
+	 */
+	public long lRemove(String key,long count,Object value) {
+		try {
+			Long remove = redisTemplate.opsForList().remove(key, count, value);
+			return remove;
+		} catch (Exception e) {
+			e.printStackTrace();
+			return 0;
+		}
+	}
+	
+}

+ 138 - 0
operating-service/src/main/java/com/txz/operating/core/ResultCode.java

@@ -0,0 +1,138 @@
+package com.txz.operating.core;
+
+/**
+ * 响应码枚举,参考HTTP状态码的语义
+ */
+public enum ResultCode {
+    /**
+     * 系统错误
+     */
+    SUCCESS("200","成功"),//成功
+    FAIL("400","失败"),//失败
+    UNAUTHORIZED("401","未认证(签名错误)"),//未认证(签名错误)
+    NOT_FOUND("404","接口不存在"),//接口不存在
+    INTERNAL_SERVER_ERROR("500","服务器内部错误"),
+    PERMISSION_NOT_HAS("409","没有操作权限"),
+    BACKSTAGE_IS_ERROR("501","网关异常"),
+
+
+    APPCODE_IS_NULL("1005", "应用编号不能为空"),
+
+    /**
+     * 业务错误
+     */
+    OBJECT_IS_NULL("6000","对象不能为空"),
+    ID_IS_NULL("6001","对象ID不能为空"),
+    CODE_IS_NULL("6002","编号不能为空"),
+    NAME_IS_NULL("6003","名称不能为空"),
+    SEQ_IS_NULL("6004","排序不能为空"),
+    LEVEL_IS_NULL("6005","级别不能为空"),
+    USERID_IS_NULL("6006","用户id不能为空"),
+    RESULT_IS_NULL("6007","查询结果为空"),
+    TYPE_IS_NULL("6008","类型为空"),
+    SQL_ERROR("6009","数据库异常"),
+    IDENTITY_IS_NULL("6010","身份证不能为空"),
+    CUSTOMERID_IS_NULL("6011","客户号不能为空"),
+    CUSTOMERID_IS_ERROR("6012","未查询到用户信息"),
+    SELECT_IS_ERROR("6013","数据异常查询失败,请联系检查用户信息"),
+    IDENTITYUPKEY_IS_ERROR("6014","身份证正面照片key不能为空"),
+    CODE_IS_INVALID("6015","验证码无效"),
+    TOKEN_IS_NULL("6016","TOKEN不能为空"),
+
+
+
+    /**
+     * 缺少请求参数
+     */
+    REQUEST_ARGS_IS_NULL("6000","缺少请求参数"),
+
+    PROVINCE_IS_NULL("6001", "未找到省信息" )
+    , CITY_IS_NULL("6002","未找到城市信息" ),
+
+    CITY_TYPE_IS_ERROR("6003", "城市类型错误" ),
+    CONTENT_IS_NULL("6004", "通知内容不能为空"),
+    STARTTIME_IS_NULL("6005","开始时间不能为空" ),
+    ENDTIME_IS_NULL("6006","结束时间不能为空" ),
+    TYPE_SEQ_IS_EXIST("6007","改类型排序已存在"),
+    LIFT_OBJECT_IS_NULL("6008","通知排序已经在顶部或者底部"),
+    AREACODE_IS_NULL("6009","地区码不能为空"),
+    GROUPID_IS_NULL("6010","分组id不能为空"),
+    LOTTERYID_IS_NULL("6011","抽奖id不能为空" ),
+    USER_IS_NULL("6012","用户未找到" ),
+    SCHOOL_IS_NULL("6013","学校未找到" ),
+    STATUS_IS_ERROR("6014","状态异常:未上架" ),
+    STATUS_HAS_ERROR("6026","状态异常:已上架" ),
+    CONVERSIONCODE_IS_UESD("6015","兑换码已使用完" ),
+    TIME_IS_ERROR("6016","无效的领奖时间" ),
+    NUM_IS_NULL("6017","数量不能为空或0" ),
+    NUM_IS_BIG("6018","数量太大"), BATCH_IS_ERROR("6019","批次已用完" ),
+    USER_NUM_ERROR("6020","用户兑换次数已满" ), CONVERSION_IS_NULL("6021","兑换码不存在,更多兑换码公众号活动获取" ),
+    AWARD_ERROR("6022","领奖失败" ),
+    CREATENAME_IS_NULL("6023","创建人为空" ), STATUS_IS_NULL("6024", "状态不能为空"),
+    VERSION_IS_NULL("6025", "版本号不能为空" ),
+    DISPOSE_STATUS_IS_ERROR("6027", "处理状态异常:未处理" ),
+    DISPOSE_STATUS_HAS_ERROR("6028", "处理状态异常:已处理" ),
+    STATION_IS_NULL("6029", "基站信息未找到" ),
+    AREA_IS_NULL("6030", "地区码未找到" ),
+    BAIDU_API_ERROR("6031", "获取百度接口异常"),
+    STARTTIME_IS_ERROR("6032", "活动未开始" ),
+    ENDTIME_IS_ERROR("6033", "活动已结束" ),
+    WEEK_CONVERSION_CODE_IS_NULL("6034", "周末兑换码未配置,请联系客服" ),
+
+    APPCODE_IS_ERROR("6035", "应用编码异常"),
+    PRIZE_IS_NULL("6036", "奖品为空,请联系管理员"),
+    PRIZE_IS_DRAW("6037", "奖品已领取" ),
+    USER_IS_NOT_VIP("6038", "您还不是会员,不能领取哦") ,
+    USER_IS_NOT_SVIP("6038", "您还不是永久会员,不能领取哦") ,
+    USER_IS_LOGIN_NUM_LESS("6039", "您登录次数不足,不能领取哦" ),
+    PERMIT_IS_UPDATED("6040", "通行证天数已更新") ,
+    PERMIT_SERVICE_IS_OFF("6041", "通行证服务未开启" ),
+    SIGNED_ERROR("6043", "已签到" ),
+    ACTIVITY_IS_NOT_FINISH("6044", "未达到领取条件,请按活动规则领取。"),
+    ACTIVITY_IS_NOT_INTYPE("6045", "活动达标类型是空" ),
+    PRIZE_IS_ERROR("6046", "奖品配置异常" ),
+    ACTIVITY_IS_END("6058", "活动已结束"),
+
+    ;
+    /**
+     * 状态码
+     */
+    private final String code;
+    private final String message;
+
+    ResultCode(String code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    public String code() {
+        return code;
+    }
+
+    public String message() {
+        return message;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    /**
+     * 通过状态码获取ENUM的名字
+     * @param code
+     * @return
+     */
+    public static ResultCode getEnumByStatusCode(String code) {
+        for (ResultCode p : ResultCode.values()) {
+            if (p.code().equalsIgnoreCase(code)) {
+                return p;
+            }
+        }
+
+        return null;
+    }
+}

+ 37 - 0
operating-service/src/main/java/com/txz/operating/core/ResultGenerator.java

@@ -0,0 +1,37 @@
+package com.txz.operating.core;
+
+
+import com.txz.operating.result.Result;
+
+/**
+ * 响应结果生成工具
+ */
+public class ResultGenerator {
+    private static final String DEFAULT_SUCCESS_MESSAGE = "SUCCESS";
+
+    public static Result genSuccessResult() {
+        return new Result()
+                .setCode(ResultCode.SUCCESS.getCode())
+                .setMessage(DEFAULT_SUCCESS_MESSAGE);
+    }
+
+    public static Result genSuccessResult(Object data) {
+        return new Result()
+                .setCode(ResultCode.SUCCESS.getCode())
+                .setMessage(DEFAULT_SUCCESS_MESSAGE)
+                .setData(data);
+    }
+
+    public static Result genFailResult(ResultCode code) {
+        return new Result()
+                .setCode(code.getCode())
+                .setMessage(code.getMessage());
+    }
+
+    public static Result genFailResult(ResultCode code,Object data) {
+        return new Result()
+                .setCode(code.getCode())
+                .setMessage(code.getMessage())
+                .setData(data);
+    }
+}

+ 22 - 0
operating-service/src/main/java/com/txz/operating/core/Service.java

@@ -0,0 +1,22 @@
+package com.txz.operating.core;
+
+import org.apache.ibatis.exceptions.TooManyResultsException;
+import tk.mybatis.mapper.entity.Condition;
+
+import java.util.List;
+
+/**
+ * Service 层 基础接口,其他Service 接口 请继承该接口
+ */
+public interface Service<T> {
+	int  save(T model);//持久化
+	int  save(List<T> models);//批量持久化
+    void deleteById(Number id);//通过主鍵刪除
+    void deleteByIds(String ids);//批量刪除 eg:ids -> “1,2,3,4”
+    void update(T model);//更新
+    T findById(Number id);//通过ID查找
+    T findBy(String fieldName, Object value) throws TooManyResultsException; //通过Model中某个成员变量名称(非数据表中column的名称)查找,value需符合unique约束
+    List<T> findByIds(String ids);//通过多个ID查找//eg:ids -> “1,2,3,4”
+    List<T> findByCondition(Condition condition);//根据条件查找
+    List<T> findAll();//获取所有
+}

+ 29 - 0
operating-service/src/main/java/com/txz/operating/core/ServiceException.java

@@ -0,0 +1,29 @@
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+package com.txz.operating.core;
+
+import lombok.Data;
+
+@Data
+public class ServiceException extends RuntimeException {
+
+    private ResultCode code;
+
+    public ServiceException() {
+    }
+
+    public ServiceException(ResultCode code) {
+        this.code = code;
+    }
+
+    public ServiceException(String message) {
+        super(message);
+    }
+
+    public ServiceException(String message, Throwable cause) {
+        super(message, cause);
+    }
+}

+ 57 - 0
operating-service/src/main/java/com/txz/operating/core/SmsTempletType.java

@@ -0,0 +1,57 @@
+package com.txz.operating.core;
+
+/**
+ * 短信模板枚举
+ */
+public enum SmsTempletType {
+	
+	RAPID_REGISTRATION("rapidRegistration","快速注册短信验证码"),
+	THIRD_PARTY_LOGIN("thirdPartyLogin","第三方登陆短信验证码"),
+	VERIFICATION_CODE_LANDING("verificationCodeLanding","验证码登陆"),
+	UPDATE_VERIFICATION_CODE("updateVerificationCode","更绑手机验证码"),
+	SET_PASSWORD_VERIFICATION_CODE("setPasswordVerificationCode","设置密码验证码"),
+	
+	;
+	
+	private String code;
+	private String desc;
+	
+	SmsTempletType(String code, String desc) {
+		this.code = code;
+		this.desc = desc;
+	}
+	
+	
+	/**
+	 * 通过状态码获取ENUM的名字
+	 * 
+	 * @param code
+	 * @return
+	 */
+	public static ResultCode getEnumByStatusCode(String code) {
+		for (ResultCode p : ResultCode.values()) {
+			if (p.code().equalsIgnoreCase(code)) {
+				return p;
+			}
+		}
+
+		return null;
+	}
+	
+	public String getCode() {
+		return code;
+	}
+	public void setCode(String code) {
+		this.code = code;
+	}
+	public String getDesc() {
+		return desc;
+	}
+	public void setDesc(String desc) {
+		this.desc = desc;
+	}
+	
+	
+	
+
+}

+ 34 - 0
operating-service/src/main/java/com/txz/operating/core/cache/CacheKey.java

@@ -0,0 +1,34 @@
+package com.txz.operating.core.cache;
+
+import java.io.Serializable;
+
+
+public class CacheKey implements Serializable {
+
+	private CacheType cacheType;
+
+	private String subKey;
+
+	private CacheKey() {
+	}
+
+	public static CacheKey generateKey(CacheType cacheType, String subKey) {
+		if (cacheType == null) {
+			throw new NullPointerException("CacheKey不允许存在空参数");
+		}
+		CacheKey key = new CacheKey();
+		key.cacheType = cacheType;
+		key.subKey = subKey;
+		return key;
+	}
+
+	@Override
+	public String toString() {
+		return new StringBuilder().append(cacheType).append("_").append(subKey != null ? subKey : "").toString();
+	}
+
+	public CacheType getType() {
+		return cacheType;
+	}
+
+}

+ 38 - 0
operating-service/src/main/java/com/txz/operating/core/cache/CacheType.java

@@ -0,0 +1,38 @@
+package com.txz.operating.core.cache;
+
+import com.txz.operating.core.ProjectConstant;
+
+public enum CacheType {
+
+	// ----------------------- token 密钥相关 ------------------------
+
+	/**
+	 * app端密钥
+	 */
+	AppSecretKey,
+
+	/**
+	 * 抽奖key
+	 */
+	LotteryKey,
+
+	/**
+	 * 获奖 列表key
+	 */
+	LotteryKeyList,
+
+	Sign,
+
+	// ------------------------- 订单相关 -------------------------
+	/**
+	 * 用户相关的一些配置:黑名单等
+	 */
+	UserConfig;
+
+	private static String keyHead = ProjectConstant.application;
+
+	@Override
+	public String toString() {
+		return keyHead + "_" + name();
+	};
+}

+ 35 - 0
operating-service/src/main/java/com/txz/operating/core/cache/lock/AbstractDistributedLock.java

@@ -0,0 +1,35 @@
+package com.txz.operating.core.cache.lock;
+
+/**
+ * 分布式锁抽象类
+ *
+ * @author zlt
+ * @date 2018/5/29 14:14
+ */
+public abstract class AbstractDistributedLock implements DistributedLock{
+
+    @Override
+    public boolean lock(String key) {
+        return lock(key, TIMEOUT_MILLIS, RETRY_TIMES, SLEEP_MILLIS);
+    }
+
+    @Override
+    public boolean lock(String key, int retryTimes) {
+        return lock(key, TIMEOUT_MILLIS, retryTimes, SLEEP_MILLIS);
+    }
+
+    @Override
+    public boolean lock(String key, int retryTimes, long sleepMillis) {
+        return lock(key, TIMEOUT_MILLIS, retryTimes, sleepMillis);
+    }
+
+    @Override
+    public boolean lock(String key, long expire) {
+        return lock(key, expire, RETRY_TIMES, SLEEP_MILLIS);
+    }
+
+    @Override
+    public boolean lock(String key, long expire, int retryTimes) {
+        return lock(key, expire, retryTimes, SLEEP_MILLIS);
+    }
+}

+ 93 - 0
operating-service/src/main/java/com/txz/operating/core/cache/lock/DistributedLock.java

@@ -0,0 +1,93 @@
+package com.txz.operating.core.cache.lock;
+
+/**
+ * 分布式锁顶级接口
+ * 例如:
+ * RETRY_TIMES=100,SLEEP_MILLIS=100
+ * RETRY_TIMES * SLEEP_MILLIS = 10000 意味着如果一直获取不了锁,最长会等待10秒后抛超时异常
+ *
+ * @author zlt
+ * @date 2018/5/29 14:12
+ */
+public interface DistributedLock {
+
+    /**
+     * 默认超时时间
+     */
+    long TIMEOUT_MILLIS = 5000;
+
+    /**
+     * 重试次数
+     */
+    int RETRY_TIMES = 100;
+
+    /**
+     * 每次重试后等待的时间
+     */
+    long SLEEP_MILLIS = 100;
+
+    /**
+     * 获取锁
+     *
+     * @param key key
+     * @return 成功/失败
+     */
+    boolean lock(String key);
+
+    /**
+     * 获取锁
+     *
+     * @param key        key
+     * @param retryTimes 重试次数
+     * @return 成功/失败
+     */
+    boolean lock(String key, int retryTimes);
+
+    /**
+     * 获取锁
+     *
+     * @param key         key
+     * @param retryTimes  重试次数
+     * @param sleepMillis 获取锁失败的重试间隔
+     * @return 成功/失败
+     */
+    boolean lock(String key, int retryTimes, long sleepMillis);
+
+    /**
+     * 获取锁
+     *
+     * @param key    key
+     * @param expire 获取锁超时时间
+     * @return 成功/失败
+     */
+    boolean lock(String key, long expire);
+
+    /**
+     * 获取锁
+     *
+     * @param key        key
+     * @param expire     获取锁超时时间
+     * @param retryTimes 重试次数
+     * @return 成功/失败
+     */
+    boolean lock(String key, long expire, int retryTimes);
+
+    /**
+     * 获取锁
+     *
+     * @param key         key
+     * @param expire      获取锁超时时间
+     * @param retryTimes  重试次数
+     * @param sleepMillis 获取锁失败的重试间隔
+     * @return 成功/失败
+     */
+    boolean lock(String key, long expire, int retryTimes, long sleepMillis);
+
+    /**
+     * 释放锁
+     *
+     * @param key key值
+     * @return 释放结果
+     */
+    boolean releaseLock(String key);
+}

+ 101 - 0
operating-service/src/main/java/com/txz/operating/core/cache/lock/RedisDistributedLock.java

@@ -0,0 +1,101 @@
+package com.txz.operating.core.cache.lock;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.data.redis.connection.RedisStringCommands;
+import org.springframework.data.redis.connection.ReturnType;
+import org.springframework.data.redis.core.RedisCallback;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.core.types.Expiration;
+import org.springframework.stereotype.Component;
+
+import java.util.UUID;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * redis分布式锁实现
+ *
+ * @author zlt
+ * @date 2018/5/29 14:16
+ */
+@Slf4j
+@Component
+public class RedisDistributedLock extends AbstractDistributedLock{
+    public RedisDistributedLock(RedisTemplate redisTemplate) {
+        this.redisTemplate = redisTemplate;
+    }
+
+    private RedisTemplate<String, Object> redisTemplate;
+
+    private ThreadLocal<String> lockFlag = new ThreadLocal<>();
+
+    private static final String UNLOCK_LUA;
+
+    /*
+     * 通过lua脚本释放锁,来达到释放锁的原子操作
+     */
+    static {
+        UNLOCK_LUA = "if redis.call(\"get\",KEYS[1]) == ARGV[1] " +
+                "then " +
+                "    return redis.call(\"del\",KEYS[1]) " +
+                "else " +
+                "    return 0 " +
+                "end ";
+    }
+
+    @Override
+    public boolean lock(String key, long expire, int retryTimes, long sleepMillis) {
+        boolean result = setRedis(key, expire);
+        // 如果获取锁失败,按照传入的重试次数进行重试
+        while ((!result) && retryTimes-- > 0) {
+            try {
+                log.debug("get redisDistributeLock failed, retrying..." + retryTimes);
+                Thread.sleep(sleepMillis);
+            } catch (InterruptedException e) {
+                log.warn("Interrupted!", e);
+                Thread.currentThread().interrupt();
+            }
+            result = setRedis(key, expire);
+        }
+        return result;
+    }
+
+    @Override
+    public boolean releaseLock(String key) {
+        // 释放锁的时候,有可能因为持锁之后方法执行时间大于锁的有效期,此时有可能已经被另外一个线程持有锁,所以不能直接删除
+        try {
+            // 使用lua脚本删除redis中匹配value的key,可以避免由于方法执行时间过长而redis锁自动过期失效的时候误删其他线程的锁
+            // spring自带的执行脚本方法中,集群模式直接抛出不支持执行脚本的异常,所以只能拿到原redis的connection来执行脚本
+            Boolean result = redisTemplate.execute((RedisCallback<Boolean>) connection -> {
+                byte[] scriptByte = redisTemplate.getStringSerializer().serialize(UNLOCK_LUA);
+                return connection.eval(scriptByte, ReturnType.BOOLEAN, 1
+                        , redisTemplate.getStringSerializer().serialize(key)
+                        , redisTemplate.getStringSerializer().serialize(lockFlag.get()));
+            });
+            return result;
+        } catch (Exception e) {
+            log.error("release redisDistributeLock occured an exception", e);
+        } finally {
+            lockFlag.remove();
+        }
+        return false;
+    }
+
+
+    private boolean setRedis(final String key, final long expire) {
+        try {
+            boolean status = redisTemplate.execute((RedisCallback<Boolean>) connection -> {
+                String uuid = UUID.randomUUID().toString();
+                lockFlag.set(uuid);
+                byte[] keyByte = redisTemplate.getStringSerializer().serialize(key);
+                byte[] uuidByte = redisTemplate.getStringSerializer().serialize(uuid);
+
+                boolean result = connection.set(keyByte, uuidByte, Expiration.from(expire, TimeUnit.MILLISECONDS), RedisStringCommands.SetOption.ifAbsent());
+                return result;
+            });
+            return status;
+        } catch (Exception e) {
+            log.error("set redisDistributeLock occured an exception", e);
+        }
+        return false;
+    }
+}

+ 7 - 0
operating-service/src/main/java/com/txz/operating/dao/AppModuleMapper.java

@@ -0,0 +1,7 @@
+package com.txz.operating.dao;
+
+import com.txz.operating.core.Mapper;
+import com.txz.operating.model.AppModule;
+
+public interface AppModuleMapper extends Mapper<AppModule> {
+}

+ 7 - 0
operating-service/src/main/java/com/txz/operating/dao/ConfigMapper.java

@@ -0,0 +1,7 @@
+package com.txz.operating.dao;
+
+import com.txz.operating.core.Mapper;
+import com.txz.operating.model.Config;
+
+public interface ConfigMapper extends Mapper<Config> {
+}

+ 7 - 0
operating-service/src/main/java/com/txz/operating/dao/ErrorCodeMapper.java

@@ -0,0 +1,7 @@
+package com.txz.operating.dao;
+
+import com.txz.operating.model.ErrorCode;
+import com.txz.operating.core.Mapper;
+
+public interface ErrorCodeMapper extends Mapper<ErrorCode> {
+}

+ 7 - 0
operating-service/src/main/java/com/txz/operating/dao/InterfacePmtMapper.java

@@ -0,0 +1,7 @@
+package com.txz.operating.dao;
+
+import com.txz.operating.model.InterfacePmt;
+import com.txz.operating.core.Mapper;
+
+public interface InterfacePmtMapper extends Mapper<InterfacePmt> {
+}

+ 7 - 0
operating-service/src/main/java/com/txz/operating/dao/InterfacesMapper.java

@@ -0,0 +1,7 @@
+package com.txz.operating.dao;
+
+import com.txz.operating.model.Interfaces;
+import com.txz.operating.core.Mapper;
+
+public interface InterfacesMapper extends Mapper<Interfaces> {
+}

+ 7 - 0
operating-service/src/main/java/com/txz/operating/dao/NoticeMapper.java

@@ -0,0 +1,7 @@
+package com.txz.operating.dao;
+
+import com.txz.operating.core.Mapper;
+import com.txz.operating.model.Notice;
+
+public interface NoticeMapper extends Mapper<Notice> {
+}

+ 82 - 0
operating-service/src/main/java/com/txz/operating/dubbo/client/UserDubboServiceClient.java

@@ -0,0 +1,82 @@
+//package com.txz.operating.dubbo.client;
+//
+//import com.yiweikeji.cif.dto.MemberDTO;
+//import com.yiweikeji.cif.dto.Result;
+//import com.yiweikeji.cif.dto.UserDTO;
+//import com.yiweikeji.cif.dto.UserWithSchoolDTO;
+//import com.yiweikeji.cif.para.UserPara;
+//import com.yiweikeji.cif.service.MemberDubboService;
+//import com.yiweikeji.cif.service.UserDubboService;
+//import com.yiweikeji.cif.service.UserWithSchoolDubboService;
+//import org.apache.dubbo.config.annotation.Reference;
+//import org.springframework.stereotype.Component;
+//
+//import java.util.Date;
+//
+//@Component
+//public class UserDubboServiceClient {
+//
+//    @Reference
+//    UserDubboService userDubboService;
+//
+//    @Reference
+//    private MemberDubboService memberDubboService;
+//
+//    public Result<UserDTO> getUser(String userId, String appCode) {
+//        return userDubboService.getUser(userId,appCode);
+//    }
+//
+//    public Result<UserDTO> getUser(UserPara userPara) {
+//        return userDubboService.getUser(userPara);
+//    }
+//    /**
+//     * 更新用户学校id
+//     * @return
+//     */
+//    public Result<Boolean> updateSchool(String userId , Integer schoolId) {
+//        return userDubboService.updateSchool(userId,schoolId);
+//    }
+//
+//    public Result<UserDTO> getUserByToken(String token, String appCode) {
+//        return userDubboService.getUserByToken(token,appCode);
+//    }
+//
+//    public Result<Boolean> getSubscribePopup(String userId){
+//        return userDubboService.getSubscribePopup(userId);
+//    }
+//
+//
+//    /**
+//     * 获取 用户关注状态
+//     * @param userId
+//     * @param type 1微信公众号状态
+//     * @return
+//     *
+//     */
+//    public Result<Integer> getUserSubscribeStatus(String userId ,Integer type){
+//        return userDubboService.getUserSubscribeStatus(userId,type);
+//    }
+//
+//    /**
+//     * 获取 用户关注时间
+//     * @param userId
+//     * @return
+//     *
+//     */
+//    public Result<Date> getUserSubscribeTime(String userId){
+//        return userDubboService.getUserSubscribeTime(userId);
+//    }
+//
+//    /**
+//     * 获取会员状态  0-非会员 1-普通会员 2-年度会员
+//     * @param userId
+//     * @return
+//     */
+//    public Integer getVipStatus(String userId){
+//        MemberDTO memberDTO = memberDubboService.getMember(userId);
+//        if(memberDTO == null){
+//            return 0;
+//        }
+//        return memberDTO.getLevel();
+//    }
+//}

+ 33 - 0
operating-service/src/main/java/com/txz/operating/dubbo/impl/OperatingConfigDubboServiceImpl.java

@@ -0,0 +1,33 @@
+package com.txz.operating.dubbo.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.StrUtil;
+import com.txz.operating.dto.ConfigDTO;
+import com.txz.operating.model.Config;
+import com.txz.operating.result.Result;
+import com.txz.operating.service.ConfigService;
+import com.txz.operating.core.ResultCode;
+import com.txz.operating.service.OperatingConfigDubboService;
+import org.apache.dubbo.config.annotation.Service;
+
+import javax.annotation.Resource;
+
+@Service
+public class OperatingConfigDubboServiceImpl implements OperatingConfigDubboService {
+
+
+    @Resource
+    private ConfigService configService;
+
+    @Override
+    public Result<ConfigDTO> getConfigByCode(String code) {
+        if (StrUtil.isBlank(code)){
+            return Result.fail(ResultCode.OBJECT_IS_NULL.code(),ResultCode.OBJECT_IS_NULL.message());
+        }
+        Config config = configService.findBy("code", code);
+        if (config != null){
+            return Result.success(BeanUtil.toBean(config,ConfigDTO.class));
+        }
+        return Result.fail(ResultCode.OBJECT_IS_NULL.code(),ResultCode.OBJECT_IS_NULL.message());
+    }
+}

+ 143 - 0
operating-service/src/main/java/com/txz/operating/dubbo/impl/OperatingInterfacesDubboServiceImpl.java

@@ -0,0 +1,143 @@
+package com.txz.operating.dubbo.impl;
+
+import com.txz.operating.dto.ErrorCodeDTO;
+import com.txz.operating.dto.InterfacesDTO;
+import com.txz.operating.model.ErrorCode;
+import com.txz.operating.model.Interfaces;
+import com.txz.operating.result.Result;
+import com.txz.operating.service.ErrorCodeService;
+import com.txz.operating.service.InterfacesService;
+import com.txz.operating.constants.RedisConstants;
+import com.txz.operating.core.ProjectConstant;
+import com.txz.operating.core.RedisUtil;
+import com.txz.operating.service.OperatingInterfacesDubboService;
+import org.apache.dubbo.config.annotation.Service;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.data.redis.core.RedisTemplate;
+import tk.mybatis.mapper.entity.Condition;
+
+import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class OperatingInterfacesDubboServiceImpl implements OperatingInterfacesDubboService {
+
+    private static Logger log = LoggerFactory.getLogger(OperatingInterfacesDubboServiceImpl.class);
+
+    @Resource
+    private InterfacesService interfacesService;
+
+    @Resource
+    private ErrorCodeService errorCodeService;
+
+    @Resource
+    private RedisUtil redisUtil;
+
+    @Resource
+    private RedisTemplate redisTemplate;
+
+    private Map<String, InterfacesDTO> map = new HashMap<>();
+
+    @Override
+    public Result<InterfacesDTO> detailForGateway(String servicePath) {
+        InterfacesDTO interfaces = map.get(servicePath);
+        if (null != interfaces) {
+            return Result.success(interfaces);
+        } else {
+            //处理 通配符 * 部分
+            for (String key:map.keySet()) {
+                InterfacesDTO temp = map.get(key);
+                if (key.contains("*") && servicePath.startsWith(key.substring(0,key.indexOf("*")))){
+                    return Result.success(temp);
+                }
+            }
+            //查询数据库
+            InterfacesDTO dto = null;
+            List<Interfaces> all = interfacesService.findAll();
+            for (Interfaces interfacez : all) {
+                String key = interfacez.getServicePath();
+                if (key.equals(servicePath)) {
+                    dto = InterfacesDTO.generator(interfacez);
+                    map.put(key,dto);
+                    return Result.success(dto);
+                } else if (key.contains("*") && servicePath.startsWith(key.substring(0,key.indexOf("*")))){
+                    dto = InterfacesDTO.generator(interfacez);
+                    map.put(key,dto);
+                    return Result.success(dto);
+                }
+            }
+            return Result.fail("未找到接口");
+        }
+    }
+
+
+//    @Override
+//    public Result<InterfacesDTO> detailForGateway(String servicePath) {
+////        log.info(String.format("servicePath = %s", servicePath));
+//        InterfacesDTO interfaces = (InterfacesDTO) redisTemplate.opsForHash().get(RedisConstants.INTERFACES_MAP, servicePath);
+//        if (null != interfaces) {
+////            log.info("接口名:" + interfaces.getApiName());
+//            return Result.success(interfaces);
+//        } else {
+//            // 刷新接口
+//            InterfacesDTO dto = reloadInterfaces(servicePath);
+//            if (null != dto) {
+//                return Result.success(dto);
+//            } else {
+//                Map<String,Object> entries = redisTemplate.opsForHash().entries(RedisConstants.INTERFACES_MAP);
+//                Set<String> keys = entries.keySet();
+//                for (String key:keys ) {
+//                    if (key.contains("*")){
+//                        if (servicePath.startsWith(key.substring(0,key.indexOf("*")))){
+////                            log.info("接口名:" + interfaces.getApiName()+",接口url:"+servicePath);
+//                            return Result.success((InterfacesDTO)entries.get(key));
+//                        }
+//                    }
+//                }
+//            }
+//            return Result.fail("未找到接口");
+//        }
+//    }
+
+    /**
+     * 刷新redis中的接口信息并返回当前这个接口的信息
+     *
+     * @param servicePath
+     */
+    private InterfacesDTO reloadInterfaces(String servicePath) {
+        redisTemplate.delete(RedisConstants.INTERFACES_MAP);
+        List<Interfaces> all = interfacesService.findAll();
+        InterfacesDTO dto = null;
+        for (Interfaces interfaces : all) {
+            redisTemplate.opsForHash().put(RedisConstants.INTERFACES_MAP, interfaces.getServicePath(), InterfacesDTO.generator(interfaces));
+            String key = interfaces.getServicePath();
+            if (key.equals(servicePath)) {
+                dto = InterfacesDTO.generator(interfaces);
+            } else if (key.contains("*") && servicePath.startsWith(key.substring(0,key.indexOf("*")))){
+                dto = InterfacesDTO.generator(interfaces);
+            }
+        }
+        return dto;
+    }
+
+    @Override
+    public Result<ErrorCodeDTO> getErrorCode(String servicePath, String retCode) {
+        String key = ProjectConstant.ERROR_CODE + servicePath + retCode;
+        Object areaObject = redisUtil.get(key);
+        if (areaObject != null) {
+            return Result.success((ErrorCodeDTO) areaObject);
+        }
+        Condition condition = new Condition(ErrorCode.class);
+        condition.createCriteria().andEqualTo("interfacePath", servicePath).andEqualTo("retCode", retCode);
+        List<ErrorCode> codes = errorCodeService.findByCondition(condition);
+        if (codes != null && !codes.isEmpty()) {
+            ErrorCodeDTO ret = ErrorCodeDTO.generator(codes.get(0));
+            redisUtil.set(key, ret, 900);
+            return Result.success(ret);
+        }
+        return Result.fail("未找到错误码");
+    }
+}

+ 267 - 0
operating-service/src/main/java/com/txz/operating/dubbo/impl/RankDubboServiceImpl.java

@@ -0,0 +1,267 @@
+package com.txz.operating.dubbo.impl;
+
+import cn.hutool.core.util.StrUtil;
+import com.txz.operating.dto.rank.RequestRankDto;
+import com.txz.operating.dto.rank.ResponseRankIntro;
+import com.txz.operating.dto.rank.ResponseUserRankDetailDTO;
+import com.txz.operating.dto.rank.ResponseUserScore;
+import com.txz.operating.result.Result;
+import com.txz.operating.constants.MyConstants;
+import com.txz.operating.constants.RedisConstants;
+import com.txz.operating.core.ResultCode;
+import com.txz.operating.service.IOperatingRankDubboService;
+import com.txz.operating.util.lock.LockNameConst;
+import com.txz.operating.util.lock.RedissonLockUtil;
+import org.apache.dubbo.config.annotation.Service;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.core.ZSetOperations;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @Author: Fcx
+ * @Date: 2019/11/25 15:07
+ * @Version 1.0
+ */
+@Service
+public class RankDubboServiceImpl implements IOperatingRankDubboService {
+
+    @Autowired
+    private RedisTemplate redisTemplate;
+
+    @Override
+    public Result<List<ResponseUserScore>> getRankList(RequestRankDto dto) {
+        if (dto.getRankKey() == null || dto.getReverse() == null
+                || dto.getPage() == null || dto.getSize() == null) {
+            return Result.fail(ResultCode.REQUEST_ARGS_IS_NULL.getCode(), ResultCode.REQUEST_ARGS_IS_NULL.getMessage());
+        }
+        // rank列表
+        Set<ZSetOperations.TypedTuple<String>> rankList;
+        if (dto.getReverse()) {
+            rankList = redisTemplate.opsForZSet().reverseRangeWithScores(RedisConstants.RANK_LIST
+                    .replaceFirst("reverse", dto.getReverse().toString())
+                    .replaceFirst("rankKey", dto.getRankKey()), dto.getIndex(), dto.getSize());
+        } else {
+            rankList = redisTemplate.opsForZSet().rangeWithScores(RedisConstants.RANK_LIST
+                    .replaceFirst("reverse", dto.getReverse().toString())
+                    .replaceFirst("rankKey", dto.getRankKey()), dto.getIndex(), dto.getSize());
+        }
+        List<ResponseUserScore> list = new ArrayList<>(rankList.size());
+        for (ZSetOperations.TypedTuple<String> tuple : rankList) {
+            // key 转换
+            String userId = StrUtil.subAfter(tuple.getValue(), RedisConstants.RANK_USER.replace("userId", ""), false);
+            int score = tuple.getScore().intValue();
+            ResponseUserScore build = ResponseUserScore.builder()
+                    .userId(userId)
+                    .score(score)
+                    .build();
+            list.add(build);
+        }
+        return Result.success(list);
+    }
+
+    @Override
+    public Result<ResponseRankIntro> getRankSizeAndTotalScore(RequestRankDto dto) {
+        if (dto.getRankKey() == null || dto.getReverse() == null) {
+            return Result.fail(ResultCode.REQUEST_ARGS_IS_NULL.getCode(), ResultCode.REQUEST_ARGS_IS_NULL.getMessage());
+        }
+        Long rankSize = redisTemplate.opsForZSet().zCard(RedisConstants.RANK_LIST
+                .replaceFirst("reverse", dto.getReverse().toString())
+                .replaceFirst("rankKey", dto.getRankKey())
+        );
+        Object o = redisTemplate.opsForValue().get(RedisConstants.RANK_TOTAL_SCORE
+                .replaceFirst("reverse", dto.getReverse().toString())
+                .replaceFirst("rankKey", dto.getRankKey()));
+        Long totalScore = 0L;
+        if (o != null) {
+            totalScore = (Long) o;
+        }
+        ResponseRankIntro rankIntro = ResponseRankIntro.builder()
+                .rankSize(rankSize)
+                .totalScore(totalScore)
+                .build();
+        return Result.success(rankIntro);
+    }
+
+    @Override
+    public Result<ResponseUserRankDetailDTO> getRankByUserId(RequestRankDto dto) {
+        if (dto.getRankKey() == null || dto.getUserId() == null || dto.getReverse() == null) {
+            return Result.fail(ResultCode.REQUEST_ARGS_IS_NULL.getCode(), ResultCode.REQUEST_ARGS_IS_NULL.getMessage());
+        }
+        // 用户的分数
+        Double score = redisTemplate.opsForZSet().score(
+                RedisConstants.RANK_LIST
+                        .replaceFirst("reverse", dto.getReverse().toString())
+                        .replaceFirst("rankKey", dto.getRankKey()),
+                RedisConstants.RANK_USER
+                        .replaceFirst("reverse", dto.getReverse().toString())
+                        .replaceFirst("userId", dto.getUserId()));
+        // 用户的排名
+        // 取并列map,此得分的用户
+
+        String parataxisRankUserId = dto.getUserId();
+        Long rank = null;
+        if (null != score) {
+            Object o = redisTemplate.opsForHash().get(
+                    RedisConstants.RANK_PARATAXIS_MAP
+                            .replaceFirst("reverse", dto.getReverse().toString())
+                            .replaceFirst("rankKey", dto.getRankKey()),
+                    // key分数
+                    RedisConstants.RANK_MAP_SCORE.replace("num", String.valueOf(score.intValue()))
+            );
+            if (null != o) {
+                parataxisRankUserId = (String) o;
+            }
+            if (dto.getReverse()) {
+                rank = redisTemplate.opsForZSet().reverseRank(RedisConstants.RANK_LIST
+                                .replaceFirst("reverse", dto.getReverse().toString())
+                                .replaceFirst("rankKey", dto.getRankKey()),
+                        RedisConstants.RANK_USER
+                                .replaceFirst("userId", parataxisRankUserId));
+            } else {
+                rank = redisTemplate.opsForZSet().rank(RedisConstants.RANK_LIST
+                                .replaceFirst("reverse", dto.getReverse().toString())
+                                .replaceFirst("rankKey", dto.getRankKey()),
+                        RedisConstants.RANK_USER
+                                .replaceFirst("userId", parataxisRankUserId));
+            }
+        }
+
+        // 本排行榜的人数
+        Long rankSize = redisTemplate.opsForZSet().zCard(RedisConstants.RANK_LIST
+                .replaceFirst("reverse", dto.getReverse().toString())
+                .replaceFirst("rankKey", dto.getRankKey())
+        );
+
+        if (null != rank) {
+            rank += 1;
+        }
+
+        ResponseUserRankDetailDTO detailDTO = ResponseUserRankDetailDTO.builder()
+                .score(score)
+                .rank(rank)
+                .rankSize(rankSize)
+                .build();
+        return Result.success(detailDTO);
+    }
+
+    @Override
+    public Result saveRankList(RequestRankDto dto) {
+        if (dto.getRankKey() == null || dto.getUserId() == null || dto.getReverse() == null || dto.getScore() == null) {
+            return Result.fail(ResultCode.REQUEST_ARGS_IS_NULL.getCode(), ResultCode.REQUEST_ARGS_IS_NULL.getMessage());
+        }
+
+        /// 不收集排行榜的总分  2020年11月20日 14:48:33
+        // updateRankTotalScore(dto, true);
+
+        // 更新一个用户在某个排行榜中的分数
+        long floatNum;
+        if (dto.getReverse()) {
+            floatNum = System.currentTimeMillis();
+        } else {
+            floatNum = MyConstants.RANK_TOTAL_SCORE - System.currentTimeMillis();
+        }
+        redisTemplate.opsForZSet().add(
+                RedisConstants.RANK_LIST
+                        .replaceFirst("reverse", dto.getReverse().toString())
+                        .replaceFirst("rankKey", dto.getRankKey()),
+                RedisConstants.RANK_USER
+                        .replaceFirst("userId", dto.getUserId()),
+
+                // 小数点后加一个随时间更新的值, 后面的小于前面的, 所以同分数排名是后来居上
+                Double.valueOf(dto.getScore() + "." + floatNum)
+        );
+
+        // 更新并列map,此得分的用户
+        redisTemplate.opsForHash().put(
+                RedisConstants.RANK_PARATAXIS_MAP
+                        .replaceFirst("reverse", dto.getReverse().toString())
+                        .replaceFirst("rankKey", dto.getRankKey()),
+                // key存分数
+                RedisConstants.RANK_MAP_SCORE.replace("num", dto.getScore().toString())
+                ,
+                // value存userId
+                dto.getUserId()
+        );
+
+        return Result.success();
+    }
+
+    private void updateRankTotalScore(RequestRankDto dto, Boolean update) {
+        // 加分布式锁
+        String lockKey = LockNameConst.LOCK_RANK_TOTAL_SCORE
+                .replace("reverse", dto.getReverse().toString())
+                .replace("rankKey", dto.getRankKey());
+        // 等待5s, 10min释放
+        if (!RedissonLockUtil.tryLock(lockKey, TimeUnit.SECONDS, 5, 60 * 10)) {
+            throw new RuntimeException("分布式锁冲突");
+        }
+
+        // #######维护此排行榜的总分 start ######
+        Object o = redisTemplate.opsForValue().get(RedisConstants.RANK_TOTAL_SCORE
+                .replaceFirst("reverse", dto.getReverse().toString())
+                .replaceFirst("rankKey", dto.getRankKey()));
+        Long totalScore;
+        if (o != null) {
+            totalScore = (Long) o;
+        } else {
+            totalScore = 0L;
+        }
+
+        // 查出用户在排行榜里的分数,减去再加上新值
+        Double score = redisTemplate.opsForZSet().score(
+                RedisConstants.RANK_LIST
+                        .replaceFirst("reverse", dto.getReverse().toString())
+                        .replaceFirst("rankKey", dto.getRankKey()),
+                RedisConstants.RANK_USER
+                        .replaceFirst("userId", dto.getUserId()));
+        if (score != null) {
+            totalScore = totalScore - score.longValue();
+        }
+
+        if (update) {
+            totalScore = totalScore + dto.getScore();
+        }
+
+        redisTemplate.opsForValue().set(
+                RedisConstants.RANK_TOTAL_SCORE
+                        .replaceFirst("reverse", dto.getReverse().toString())
+                        .replaceFirst("rankKey", dto.getRankKey()),
+                totalScore
+        );
+        // #######维护此排行榜的总分 end ######
+        RedissonLockUtil.unlock(lockKey);
+    }
+
+    @Override
+    public Result delUserRank(RequestRankDto dto) {
+        // 减去用户在此排行榜的总分
+        updateRankTotalScore(dto, false);
+
+        Long remove = redisTemplate.opsForZSet().remove(
+                RedisConstants.RANK_LIST
+                        .replaceFirst("reverse", dto.getReverse().toString())
+                        .replaceFirst("rankKey", dto.getRankKey()),
+                RedisConstants.RANK_USER
+                        .replaceFirst("userId", dto.getUserId()));
+
+        return Result.success(remove);
+    }
+
+    @Override
+    public Result delRank(RequestRankDto dto) {
+        // 删除此排行榜的总分
+        Boolean deleteTotalScore = redisTemplate.delete(RedisConstants.RANK_TOTAL_SCORE
+                .replaceFirst("reverse", dto.getReverse().toString())
+                .replaceFirst("rankKey", dto.getRankKey()));
+        // 删除排行榜
+        Boolean delete = redisTemplate.delete(RedisConstants.RANK_LIST
+                .replaceFirst("reverse", dto.getReverse().toString())
+                .replaceFirst("rankKey", dto.getRankKey()));
+        return Result.success(deleteTotalScore && delete);
+    }
+}

+ 56 - 0
operating-service/src/main/java/com/txz/operating/dubbo/impl/RankMedianScoreDubboServiceImpl.java

@@ -0,0 +1,56 @@
+package com.txz.operating.dubbo.impl;
+
+import cn.hutool.core.collection.CollUtil;
+import com.txz.operating.dto.rank.RequestMedianScoreByRankDto;
+import com.txz.operating.result.Result;
+import com.txz.operating.constants.RedisConstants;
+import com.txz.operating.service.IOperatingMedianScoreDubboService;
+import org.apache.dubbo.config.annotation.Service;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
+
+import java.util.Set;
+
+/**
+ * @Author: Fcx
+ * @Date: 2019/11/25 15:07
+ * @Version 1.0
+ */
+@Service
+public class RankMedianScoreDubboServiceImpl implements IOperatingMedianScoreDubboService {
+
+    @Autowired
+    private RedisTemplate redisTemplate;
+
+    @Override
+    public Result<Long> getMedianScore(RequestMedianScoreByRankDto dto) {
+        Long medianIndex = dto.getMedianIndex();
+        if (null == medianIndex) {
+            Long rankSize = redisTemplate.opsForZSet().zCard(RedisConstants.RANK_LIST
+                    .replaceFirst("reverse", dto.getReverse().toString())
+                    .replaceFirst("rankKey", dto.getRankKey())
+            );
+            if (rankSize == null || rankSize == 0) {
+                return Result.fail("排行榜不存在" + dto.getRankKey() + dto.getReverse());
+            }
+            medianIndex = rankSize / 2;
+        }
+
+        Set range = redisTemplate.opsForZSet().range(
+                RedisConstants.RANK_LIST
+                        .replaceFirst("reverse", dto.getReverse().toString())
+                        .replaceFirst("rankKey", dto.getRankKey()),
+                medianIndex, medianIndex + 1);
+        if (CollUtil.isNotEmpty(range)) {
+            String key = (String) range.toArray()[0];
+
+            Double score = redisTemplate.opsForZSet().score(
+                    RedisConstants.RANK_LIST
+                            .replaceFirst("reverse", dto.getReverse().toString())
+                            .replaceFirst("rankKey", dto.getRankKey()),
+                    key);
+            return Result.success(score.longValue());
+        }
+        return Result.fail("请检查中位数" + medianIndex);
+    }
+}

+ 39 - 0
operating-service/src/main/java/com/txz/operating/enums/ActivityInTypeEnum.java

@@ -0,0 +1,39 @@
+package com.txz.operating.enums;
+
+/**
+ * 之前是准入类型  20210524改为
+ * 达标类型 1年会员
+ */
+public enum ActivityInTypeEnum {
+
+    YEAR_VIP((byte)1, "年会员"),
+    ;
+
+    private byte key;
+    private String value;
+
+    ActivityInTypeEnum(byte key, String value) {
+        this.key = key;
+        this.value = value;
+    }
+
+    public static ActivityInTypeEnum getEnum(Byte inType) {
+        if (inType == null){
+            return null;
+        }
+        for (ActivityInTypeEnum temp:values()) {
+            if (temp.key == inType){
+                return temp;
+            }
+        }
+        return null;
+    }
+
+    public byte getKey() {
+        return key;
+    }
+
+    public String getValue() {
+        return value;
+    }
+}

+ 44 - 0
operating-service/src/main/java/com/txz/operating/enums/ActivityModuleEnum.java

@@ -0,0 +1,44 @@
+package com.txz.operating.enums;
+
+/**
+ */
+public enum ActivityModuleEnum {
+
+    COMMON((byte)1, "通用活动","common"),
+    HOT((byte)2, "特殊活动","hot"),
+    ;
+
+    private byte key;
+    private String value;
+    private String code;
+
+    ActivityModuleEnum(byte key, String value, String code) {
+        this.key = key;
+        this.value = value;
+        this.code = code;
+    }
+
+    public byte getKey() {
+        return key;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public static ActivityModuleEnum getEnum(Byte inType) {
+        if (inType == null){
+            return null;
+        }
+        for (ActivityModuleEnum temp:values()) {
+            if (temp.key == inType){
+                return temp;
+            }
+        }
+        return null;
+    }
+}

+ 52 - 0
operating-service/src/main/java/com/txz/operating/enums/ActivityTypeEnum.java

@@ -0,0 +1,52 @@
+package com.txz.operating.enums;
+
+/**
+ * 活动类型枚举 完成类型 1VIP 2关注公众号 3 无条件
+ */
+public enum ActivityTypeEnum {
+
+    VIP((byte)1, "VIP","vip"),
+    ACCOUNTS((byte)2, "关注公众号","focus"),
+    NO_CONDITION((byte)3, "展示图片","activity"),
+    MANUAL_AWARD((byte)4, "手动领奖","award"),
+    SIGN((byte)5, "签到","sign"),
+    PERMIT((byte)6, "通行证","permit"),
+    conversion((byte)7, "兑换码","conversion"),
+    ACTIVITY_MESSAGE((byte)8, "活动消息","activity_message"),
+
+    ;
+
+    private byte key;
+    private String value;
+    private String code;
+
+    ActivityTypeEnum(byte key, String value,String code) {
+        this.key = key;
+        this.value = value;
+        this.code = code;
+    }
+
+    public byte getKey() {
+        return key;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public static ActivityTypeEnum getEnum(Byte inType) {
+        if (inType == null){
+            return null;
+        }
+        for (ActivityTypeEnum temp:values()) {
+            if (temp.key == inType){
+                return temp;
+            }
+        }
+        return null;
+    }
+}

+ 64 - 0
operating-service/src/main/java/com/txz/operating/model/AppModule.java

@@ -0,0 +1,64 @@
+package com.txz.operating.model;
+
+import lombok.*;
+
+import javax.persistence.*;
+
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+@Getter
+@Setter
+@Table(name = "o_app_module")
+public class AppModule {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Long id;
+
+    /**
+     * 应用编码
+     */
+    @Column(name = "app_code")
+    private String appCode;
+
+    /**
+     * 模块名称
+     */
+    private String name;
+
+    /**
+     * 携带内容
+     */
+    private String content;
+
+
+    /**
+     * 是否检查版本 1检查 2不检查
+     */
+    @Column(name = "check_version")
+    private Byte checkVersion;
+
+    /**
+     * 模块名称
+     */
+    private String version;
+
+    /**
+     * 模块编码
+     */
+    private String code;
+
+    /**
+     * 用户分群id  为空则不参与判断
+     */
+    @Column(name = "cluster_ids")
+    private String clusterIds;
+
+
+    /**
+     * 状态 1开放 2关闭
+     */
+    private Byte status;
+
+
+}

+ 141 - 0
operating-service/src/main/java/com/txz/operating/model/Config.java

@@ -0,0 +1,141 @@
+package com.txz.operating.model;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import javax.persistence.*;
+@ApiModel("配置")
+@Table(name = "o_config")
+public class Config {
+
+    @ApiModelProperty(name = "id", value = "id")
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer id;
+
+    @ApiModelProperty(name = "name", value = "配置项名称")
+    private String name;
+
+    @ApiModelProperty(name = "code", value = "配置项")
+    private String code;
+
+    @ApiModelProperty(name = "parentId", value = "父节点")
+    @Column(name = "parent_id")
+    private Integer parentId;
+
+    /**
+     * 视图类型 1运营配置 2系统配置
+     */
+    @ApiModelProperty(name = "viweType", value = "视图类型 1运营配置 2系统配置")
+    @Column(name = "viwe_type")
+    private Integer viweType;
+
+    @ApiModelProperty(name = "valueInfo", value = "配置项值")
+    @Column(name = "value_info")
+    private String valueInfo;
+
+    @ApiModelProperty(name = "seq", value = "排序")
+    private Integer seq;
+
+    /**
+     * @return id
+     */
+    public Integer getId() {
+        return id;
+    }
+
+    /**
+     * @param id
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * @return name
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * @param name
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * @return code
+     */
+    public String getCode() {
+        return code;
+    }
+
+    /**
+     * @param code
+     */
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    /**
+     * @return parent_id
+     */
+    public Integer getParentId() {
+        return parentId;
+    }
+
+    /**
+     * @param parentId
+     */
+    public void setParentId(Integer parentId) {
+        this.parentId = parentId;
+    }
+
+    /**
+     * 获取视图类型 1运营配置 2系统配置
+     *
+     * @return viwe_type - 视图类型 1运营配置 2系统配置
+     */
+    public Integer getViweType() {
+        return viweType;
+    }
+
+    /**
+     * 设置视图类型 1运营配置 2系统配置
+     *
+     * @param viweType 视图类型 1运营配置 2系统配置
+     */
+    public void setViweType(Integer viweType) {
+        this.viweType = viweType;
+    }
+
+    /**
+     * @return value_info
+     */
+    public String getValueInfo() {
+        return valueInfo;
+    }
+
+    /**
+     * @param valueInfo
+     */
+    public void setValueInfo(String valueInfo) {
+        this.valueInfo = valueInfo;
+    }
+
+    /**
+     * @return seq
+     */
+    public Integer getSeq() {
+        return seq;
+    }
+
+    /**
+     * @param seq
+     */
+    public void setSeq(Integer seq) {
+        this.seq = seq;
+    }
+}

+ 265 - 0
operating-service/src/main/java/com/txz/operating/model/ErrorCode.java

@@ -0,0 +1,265 @@
+package com.txz.operating.model;
+
+import java.util.Date;
+import javax.persistence.*;
+
+@Table(name = "o_error_code")
+public class ErrorCode {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer id;
+
+    /**
+     * 返回结果码
+     */
+    @Column(name = "return_code")
+    private String returnCode;
+
+    /**
+     * 返回结果消息
+     */
+    @Column(name = "return_msg")
+    private String returnMsg;
+
+    /**
+     * 内部系统结果码
+     */
+    @Column(name = "ret_code")
+    private String retCode;
+
+    /**
+     * 内部系统结果消息
+     */
+    @Column(name = "ret_msg")
+    private String retMsg;
+
+    /**
+     * 接口id
+     */
+    @Column(name = "interface_id")
+    private Integer interfaceId;
+
+    /**
+     * 接口名
+     */
+    @Column(name = "interface_path")
+    private String interfacePath;
+
+    /**
+     * 创建人
+     */
+    @Column(name = "create_name")
+    private String createName;
+
+    /**
+     * 更新人
+     */
+    @Column(name = "update_name")
+    private String updateName;
+
+    /**
+     * 创建时间
+     */
+    @Column(name = "create_time")
+    private Date createTime;
+
+    /**
+     * 更新时间
+     */
+    @Column(name = "update_time")
+    private Date updateTime;
+
+    /**
+     * @return id
+     */
+    public Integer getId() {
+        return id;
+    }
+
+    /**
+     * @param id
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * 获取返回结果码
+     *
+     * @return return_code - 返回结果码
+     */
+    public String getReturnCode() {
+        return returnCode;
+    }
+
+    /**
+     * 设置返回结果码
+     *
+     * @param returnCode 返回结果码
+     */
+    public void setReturnCode(String returnCode) {
+        this.returnCode = returnCode;
+    }
+
+    /**
+     * 获取返回结果消息
+     *
+     * @return return_msg - 返回结果消息
+     */
+    public String getReturnMsg() {
+        return returnMsg;
+    }
+
+    /**
+     * 设置返回结果消息
+     *
+     * @param returnMsg 返回结果消息
+     */
+    public void setReturnMsg(String returnMsg) {
+        this.returnMsg = returnMsg;
+    }
+
+    /**
+     * 获取内部系统结果码
+     *
+     * @return ret_code - 内部系统结果码
+     */
+    public String getRetCode() {
+        return retCode;
+    }
+
+    /**
+     * 设置内部系统结果码
+     *
+     * @param retCode 内部系统结果码
+     */
+    public void setRetCode(String retCode) {
+        this.retCode = retCode;
+    }
+
+    /**
+     * 获取内部系统结果消息
+     *
+     * @return ret_msg - 内部系统结果消息
+     */
+    public String getRetMsg() {
+        return retMsg;
+    }
+
+    /**
+     * 设置内部系统结果消息
+     *
+     * @param retMsg 内部系统结果消息
+     */
+    public void setRetMsg(String retMsg) {
+        this.retMsg = retMsg;
+    }
+
+    /**
+     * 获取接口id
+     *
+     * @return interface_id - 接口id
+     */
+    public Integer getInterfaceId() {
+        return interfaceId;
+    }
+
+    /**
+     * 设置接口id
+     *
+     * @param interfaceId 接口id
+     */
+    public void setInterfaceId(Integer interfaceId) {
+        this.interfaceId = interfaceId;
+    }
+
+    /**
+     * 获取接口名
+     *
+     * @return interface_path - 接口名
+     */
+    public String getInterfacePath() {
+        return interfacePath;
+    }
+
+    /**
+     * 设置接口名
+     *
+     * @param interfacePath 接口名
+     */
+    public void setInterfacePath(String interfacePath) {
+        this.interfacePath = interfacePath;
+    }
+
+    /**
+     * 获取创建人
+     *
+     * @return create_name - 创建人
+     */
+    public String getCreateName() {
+        return createName;
+    }
+
+    /**
+     * 设置创建人
+     *
+     * @param createName 创建人
+     */
+    public void setCreateName(String createName) {
+        this.createName = createName;
+    }
+
+    /**
+     * 获取更新人
+     *
+     * @return update_name - 更新人
+     */
+    public String getUpdateName() {
+        return updateName;
+    }
+
+    /**
+     * 设置更新人
+     *
+     * @param updateName 更新人
+     */
+    public void setUpdateName(String updateName) {
+        this.updateName = updateName;
+    }
+
+    /**
+     * 获取创建时间
+     *
+     * @return create_time - 创建时间
+     */
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    /**
+     * 设置创建时间
+     *
+     * @param createTime 创建时间
+     */
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    /**
+     * 获取更新时间
+     *
+     * @return update_time - 更新时间
+     */
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    /**
+     * 设置更新时间
+     *
+     * @param updateTime 更新时间
+     */
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+}

+ 212 - 0
operating-service/src/main/java/com/txz/operating/model/InterfacePmt.java

@@ -0,0 +1,212 @@
+package com.txz.operating.model;
+
+import javax.persistence.*;
+
+@Table(name = "o_interface_pmt")
+public class InterfacePmt {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer id;
+
+    /**
+     * 接口id
+     */
+    @Column(name = "itfc_id")
+    private String itfcId;
+
+    /**
+     * 参数
+     */
+    private String param;
+
+    /**
+     * 参数名称
+     */
+    @Column(name = "param_name")
+    private String paramName;
+
+    /**
+     * 数据类型 0varchar 1int 2date 3object
+     */
+    @Column(name = "data_type")
+    private String dataType;
+
+    /**
+     * 是否必须有值 0可为空 1不为空
+     */
+    private String ismust;
+
+    /**
+     * 长度
+     */
+    private String length;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    /**
+     * 请求参数类型(0.请求参数,1.返回参数)
+     */
+    @Column(name = "paramType")
+    private Integer paramtype;
+
+    /**
+     * @return id
+     */
+    public Integer getId() {
+        return id;
+    }
+
+    /**
+     * @param id
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * 获取接口id
+     *
+     * @return itfc_id - 接口id
+     */
+    public String getItfcId() {
+        return itfcId;
+    }
+
+    /**
+     * 设置接口id
+     *
+     * @param itfcId 接口id
+     */
+    public void setItfcId(String itfcId) {
+        this.itfcId = itfcId;
+    }
+
+    /**
+     * 获取参数
+     *
+     * @return param - 参数
+     */
+    public String getParam() {
+        return param;
+    }
+
+    /**
+     * 设置参数
+     *
+     * @param param 参数
+     */
+    public void setParam(String param) {
+        this.param = param;
+    }
+
+    /**
+     * 获取参数名称
+     *
+     * @return param_name - 参数名称
+     */
+    public String getParamName() {
+        return paramName;
+    }
+
+    /**
+     * 设置参数名称
+     *
+     * @param paramName 参数名称
+     */
+    public void setParamName(String paramName) {
+        this.paramName = paramName;
+    }
+
+    /**
+     * 获取数据类型 0varchar 1int 2date 3object
+     *
+     * @return data_type - 数据类型 0varchar 1int 2date 3object
+     */
+    public String getDataType() {
+        return dataType;
+    }
+
+    /**
+     * 设置数据类型 0varchar 1int 2date 3object
+     *
+     * @param dataType 数据类型 0varchar 1int 2date 3object
+     */
+    public void setDataType(String dataType) {
+        this.dataType = dataType;
+    }
+
+    /**
+     * 获取是否必须有值 0可为空 1不为空
+     *
+     * @return ismust - 是否必须有值 0可为空 1不为空
+     */
+    public String getIsmust() {
+        return ismust;
+    }
+
+    /**
+     * 设置是否必须有值 0可为空 1不为空
+     *
+     * @param ismust 是否必须有值 0可为空 1不为空
+     */
+    public void setIsmust(String ismust) {
+        this.ismust = ismust;
+    }
+
+    /**
+     * 获取长度
+     *
+     * @return length - 长度
+     */
+    public String getLength() {
+        return length;
+    }
+
+    /**
+     * 设置长度
+     *
+     * @param length 长度
+     */
+    public void setLength(String length) {
+        this.length = length;
+    }
+
+    /**
+     * 获取备注
+     *
+     * @return remark - 备注
+     */
+    public String getRemark() {
+        return remark;
+    }
+
+    /**
+     * 设置备注
+     *
+     * @param remark 备注
+     */
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    /**
+     * 获取请求参数类型(0.请求参数,1.返回参数)
+     *
+     * @return paramType - 请求参数类型(0.请求参数,1.返回参数)
+     */
+    public Integer getParamtype() {
+        return paramtype;
+    }
+
+    /**
+     * 设置请求参数类型(0.请求参数,1.返回参数)
+     *
+     * @param paramtype 请求参数类型(0.请求参数,1.返回参数)
+     */
+    public void setParamtype(Integer paramtype) {
+        this.paramtype = paramtype;
+    }
+}

+ 552 - 0
operating-service/src/main/java/com/txz/operating/model/Interfaces.java

@@ -0,0 +1,552 @@
+package com.txz.operating.model;
+
+import javax.persistence.*;
+import java.util.Date;
+
+@Table(name = "o_interfaces")
+public class Interfaces {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer id;
+
+    /**
+     * 接口名称
+     */
+    @Column(name = "api_name")
+    private String apiName;
+
+    /**
+     * 返回结果转译 0 不转义 1转义
+     */
+    @Column(name = "return_code_translate")
+    private Integer returnCodeTranslate;
+
+    /**
+     * API中文名称
+     */
+    @Column(name = "api_remark")
+    private String apiRemark;
+
+    /**
+     * API描述
+     */
+    @Column(name = "api_memo")
+    private String apiMemo;
+
+    /**
+     * 服务名
+     */
+    @Column(name = "service_name")
+    private String serviceName;
+
+    /**
+     * 服务路径
+     */
+    @Column(name = "service_path")
+    private String servicePath;
+
+    /**
+     * 服务类型
+     */
+    @Column(name = "service_type")
+    private String serviceType;
+
+    /**
+     * 连接超时时间
+     */
+    @Column(name = "connection_timeout")
+    private String connectionTimeout;
+
+    /**
+     * 读取数据超时时间
+     */
+    @Column(name = "so_timeout")
+    private String soTimeout;
+
+    /**
+     * 模块ID
+     */
+    @Column(name = "module_id")
+    private String moduleId;
+
+    /**
+     * 模块名称
+     */
+    @Column(name = "module_name")
+    private String moduleName;
+
+    /**
+     * 登录授权类型(0.无需,1.需要)
+     */
+    @Column(name = "authorize_type")
+    private Integer authorizeType;
+
+    /**
+     * 商户所有权认证(0.无需,1.需要)
+     */
+    @Column(name = "merchant_authorize_type")
+    private Integer merchantAuthorizeType;
+
+    /**
+     * 状态 0未启用 1正常 2禁用
+     */
+    private Integer status;
+
+    /**
+     * 请求json
+     */
+    @Column(name = "request_json")
+    private String requestJson;
+
+    /**
+     * 请求json例子
+     */
+    @Column(name = "request_json_demo")
+    private String requestJsonDemo;
+
+    /**
+     * 响应json
+     */
+    @Column(name = "response_json")
+    private String responseJson;
+
+    /**
+     * 响应json例子
+     */
+    @Column(name = "response_json_demo")
+    private String responseJsonDemo;
+
+    /**
+     * 创建人
+     */
+    @Column(name = "create_name")
+    private String createName;
+
+    /**
+     * 更新人
+     */
+    @Column(name = "update_name")
+    private String updateName;
+
+    /**
+     * 创建时间
+     */
+    @Column(name = "create_time")
+    private Date createTime;
+
+    /**
+     * 更新时间
+     */
+    @Column(name = "update_time")
+    private Date updateTime;
+
+    /**
+     * @return id
+     */
+    public Integer getId() {
+        return id;
+    }
+
+    /**
+     * @param id
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * 获取接口名称
+     *
+     * @return api_name - 接口名称
+     */
+    public String getApiName() {
+        return apiName;
+    }
+
+    /**
+     * 设置接口名称
+     *
+     * @param apiName 接口名称
+     */
+    public void setApiName(String apiName) {
+        this.apiName = apiName;
+    }
+
+    /**
+     * 获取返回结果转译 0 不转义 1转义
+     *
+     * @return return_code_translate - 返回结果转译 0 不转义 1转义
+     */
+    public Integer getReturnCodeTranslate() {
+        return returnCodeTranslate;
+    }
+
+    /**
+     * 设置返回结果转译 0 不转义 1转义
+     *
+     * @param returnCodeTranslate 返回结果转译 0 不转义 1转义
+     */
+    public void setReturnCodeTranslate(Integer returnCodeTranslate) {
+        this.returnCodeTranslate = returnCodeTranslate;
+    }
+
+    /**
+     * 获取API中文名称
+     *
+     * @return api_remark - API中文名称
+     */
+    public String getApiRemark() {
+        return apiRemark;
+    }
+
+    /**
+     * 设置API中文名称
+     *
+     * @param apiRemark API中文名称
+     */
+    public void setApiRemark(String apiRemark) {
+        this.apiRemark = apiRemark;
+    }
+
+    /**
+     * 获取API描述
+     *
+     * @return api_memo - API描述
+     */
+    public String getApiMemo() {
+        return apiMemo;
+    }
+
+    /**
+     * 设置API描述
+     *
+     * @param apiMemo API描述
+     */
+    public void setApiMemo(String apiMemo) {
+        this.apiMemo = apiMemo;
+    }
+
+    /**
+     * 获取服务名
+     *
+     * @return service_name - 服务名
+     */
+    public String getServiceName() {
+        return serviceName;
+    }
+
+    /**
+     * 设置服务名
+     *
+     * @param serviceName 服务名
+     */
+    public void setServiceName(String serviceName) {
+        this.serviceName = serviceName;
+    }
+
+    /**
+     * 获取服务路径
+     *
+     * @return service_path - 服务路径
+     */
+    public String getServicePath() {
+        return servicePath;
+    }
+
+    /**
+     * 设置服务路径
+     *
+     * @param servicePath 服务路径
+     */
+    public void setServicePath(String servicePath) {
+        this.servicePath = servicePath;
+    }
+
+    /**
+     * 获取服务类型
+     *
+     * @return service_type - 服务类型
+     */
+    public String getServiceType() {
+        return serviceType;
+    }
+
+    /**
+     * 设置服务类型
+     *
+     * @param serviceType 服务类型
+     */
+    public void setServiceType(String serviceType) {
+        this.serviceType = serviceType;
+    }
+
+    /**
+     * 获取连接超时时间
+     *
+     * @return connection_timeout - 连接超时时间
+     */
+    public String getConnectionTimeout() {
+        return connectionTimeout;
+    }
+
+    /**
+     * 设置连接超时时间
+     *
+     * @param connectionTimeout 连接超时时间
+     */
+    public void setConnectionTimeout(String connectionTimeout) {
+        this.connectionTimeout = connectionTimeout;
+    }
+
+    /**
+     * 获取读取数据超时时间
+     *
+     * @return so_timeout - 读取数据超时时间
+     */
+    public String getSoTimeout() {
+        return soTimeout;
+    }
+
+    /**
+     * 设置读取数据超时时间
+     *
+     * @param soTimeout 读取数据超时时间
+     */
+    public void setSoTimeout(String soTimeout) {
+        this.soTimeout = soTimeout;
+    }
+
+    /**
+     * 获取模块ID
+     *
+     * @return module_id - 模块ID
+     */
+    public String getModuleId() {
+        return moduleId;
+    }
+
+    /**
+     * 设置模块ID
+     *
+     * @param moduleId 模块ID
+     */
+    public void setModuleId(String moduleId) {
+        this.moduleId = moduleId;
+    }
+
+    /**
+     * 获取模块名称
+     *
+     * @return module_name - 模块名称
+     */
+    public String getModuleName() {
+        return moduleName;
+    }
+
+    /**
+     * 设置模块名称
+     *
+     * @param moduleName 模块名称
+     */
+    public void setModuleName(String moduleName) {
+        this.moduleName = moduleName;
+    }
+
+    /**
+     * 获取登录授权类型(0.无需,1.需要)
+     *
+     * @return authorize_type - 登录授权类型(0.无需,1.需要)
+     */
+    public Integer getAuthorizeType() {
+        return authorizeType;
+    }
+
+    /**
+     * 设置登录授权类型(0.无需,1.需要)
+     *
+     * @param authorizeType 登录授权类型(0.无需,1.需要)
+     */
+    public void setAuthorizeType(Integer authorizeType) {
+        this.authorizeType = authorizeType;
+    }
+
+    /**
+     * 获取商户所有权认证(0.无需,1.需要)
+     *
+     * @return merchant_authorize_type - 商户所有权认证(0.无需,1.需要)
+     */
+    public Integer getMerchantAuthorizeType() {
+        return merchantAuthorizeType;
+    }
+
+    /**
+     * 设置商户所有权认证(0.无需,1.需要)
+     *
+     * @param merchantAuthorizeType 商户所有权认证(0.无需,1.需要)
+     */
+    public void setMerchantAuthorizeType(Integer merchantAuthorizeType) {
+        this.merchantAuthorizeType = merchantAuthorizeType;
+    }
+
+    /**
+     * 获取状态 0未启用 1正常 2禁用
+     *
+     * @return status - 状态 0未启用 1正常 2禁用
+     */
+    public Integer getStatus() {
+        return status;
+    }
+
+    /**
+     * 设置状态 0未启用 1正常 2禁用
+     *
+     * @param status 状态 0未启用 1正常 2禁用
+     */
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    /**
+     * 获取请求json
+     *
+     * @return request_json - 请求json
+     */
+    public String getRequestJson() {
+        return requestJson;
+    }
+
+    /**
+     * 设置请求json
+     *
+     * @param requestJson 请求json
+     */
+    public void setRequestJson(String requestJson) {
+        this.requestJson = requestJson;
+    }
+
+    /**
+     * 获取请求json例子
+     *
+     * @return request_json_demo - 请求json例子
+     */
+    public String getRequestJsonDemo() {
+        return requestJsonDemo;
+    }
+
+    /**
+     * 设置请求json例子
+     *
+     * @param requestJsonDemo 请求json例子
+     */
+    public void setRequestJsonDemo(String requestJsonDemo) {
+        this.requestJsonDemo = requestJsonDemo;
+    }
+
+    /**
+     * 获取响应json
+     *
+     * @return response_json - 响应json
+     */
+    public String getResponseJson() {
+        return responseJson;
+    }
+
+    /**
+     * 设置响应json
+     *
+     * @param responseJson 响应json
+     */
+    public void setResponseJson(String responseJson) {
+        this.responseJson = responseJson;
+    }
+
+    /**
+     * 获取响应json例子
+     *
+     * @return response_json_demo - 响应json例子
+     */
+    public String getResponseJsonDemo() {
+        return responseJsonDemo;
+    }
+
+    /**
+     * 设置响应json例子
+     *
+     * @param responseJsonDemo 响应json例子
+     */
+    public void setResponseJsonDemo(String responseJsonDemo) {
+        this.responseJsonDemo = responseJsonDemo;
+    }
+
+    /**
+     * 获取创建人
+     *
+     * @return create_name - 创建人
+     */
+    public String getCreateName() {
+        return createName;
+    }
+
+    /**
+     * 设置创建人
+     *
+     * @param createName 创建人
+     */
+    public void setCreateName(String createName) {
+        this.createName = createName;
+    }
+
+    /**
+     * 获取更新人
+     *
+     * @return update_name - 更新人
+     */
+    public String getUpdateName() {
+        return updateName;
+    }
+
+    /**
+     * 设置更新人
+     *
+     * @param updateName 更新人
+     */
+    public void setUpdateName(String updateName) {
+        this.updateName = updateName;
+    }
+
+    /**
+     * 获取创建时间
+     *
+     * @return create_time - 创建时间
+     */
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    /**
+     * 设置创建时间
+     *
+     * @param createTime 创建时间
+     */
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    /**
+     * 获取更新时间
+     *
+     * @return update_time - 更新时间
+     */
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    /**
+     * 设置更新时间
+     *
+     * @param updateTime 更新时间
+     */
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+}

+ 48 - 0
operating-service/src/main/java/com/txz/operating/model/Module.java

@@ -0,0 +1,48 @@
+package com.txz.operating.model;
+
+import javax.persistence.*;
+
+@Table(name = "o_module")
+public class Module {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer id;
+
+    /**
+     * 模块名称
+     */
+    @Column(name = "module_name")
+    private String moduleName;
+
+    /**
+     * @return id
+     */
+    public Integer getId() {
+        return id;
+    }
+
+    /**
+     * @param id
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * 获取模块名称
+     *
+     * @return module_name - 模块名称
+     */
+    public String getModuleName() {
+        return moduleName;
+    }
+
+    /**
+     * 设置模块名称
+     *
+     * @param moduleName 模块名称
+     */
+    public void setModuleName(String moduleName) {
+        this.moduleName = moduleName;
+    }
+}

+ 141 - 0
operating-service/src/main/java/com/txz/operating/model/Notice.java

@@ -0,0 +1,141 @@
+package com.txz.operating.model;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.*;
+
+import java.util.Date;
+import javax.persistence.*;
+
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+@Getter
+@Setter
+@ApiModel("公告")
+@Table(name = "o_notice")
+public class Notice {
+    @Id
+    @ApiModelProperty("id")
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer id;
+
+    /**
+     * 应用编码
+     */
+    @ApiModelProperty("应用编码")
+    @Column(name = "app_code")
+    private String appCode;
+
+    /**
+     * 文字内容
+     */
+    @ApiModelProperty("文字内容")
+    private String content;
+
+    /**
+     * link
+     */
+    @ApiModelProperty("link")
+    private String link;
+
+    @ApiModelProperty("用户分群id:多个使用,分割")
+    @Column(name = "cluster_ids")
+    private String clusterIds;
+
+    /**
+     * 图片内容
+     */
+    @ApiModelProperty("图片内容")
+    private String pic;
+
+    /**
+     * 音频内容
+     */
+    @ApiModelProperty("音频内容")
+    private String voice;
+
+    /**
+     * 类型 1滚屏公告 2登录公告
+     */
+    @ApiModelProperty("类型 1滚屏公告 2登录公告")
+    private Byte type;
+
+
+    /**
+     * 准入类型 1所有玩家 2非关玩家 3非VIP玩家 4非关非VIP玩家
+     */
+    @ApiModelProperty("准入类型 1所有玩家 2非关玩家 3非VIP玩家 4非关非VIP玩家")
+    @Column(name = "in_type")
+    private Byte inType;
+
+    /**
+     * 排序
+     */
+    @ApiModelProperty("排序")
+    private Integer seq;
+
+    /**
+     * 播放次数
+     */
+    @ApiModelProperty("播放次数")
+    private Integer num;
+
+    /**
+     * 间隔时间 (滚屏公告 单位 秒)(按钮公告 单位 天)
+     */
+    @ApiModelProperty("间隔时间 (滚屏公告 单位 秒)(按钮公告 单位 天)")
+    @Column(name = "interval_time")
+    private Integer intervalTime;
+
+    /**
+     * 状态 1正常 2禁用
+     */
+    @ApiModelProperty("状态 1正常 2禁用")
+    private Byte status;
+
+    /**
+     * 开始时间
+     */
+    @ApiModelProperty("开始时间")
+    @Column(name = "start_time")
+    private Date startTime;
+
+    /**
+     * 结束时间
+     */
+    @ApiModelProperty("结束时间")
+    @Column(name = "end_time")
+    private Date endTime;
+
+
+    /**
+     * 创建时间
+     */
+    @ApiModelProperty("创建时间")
+    @Column(name = "create_time")
+    private Date createTime;
+
+    /**
+     * 创建人
+     */
+    @ApiModelProperty("创建人")
+    @Column(name = "create_user")
+    private String createUser;
+
+    /**
+     * 更新人
+     */
+    @ApiModelProperty("更新人")
+    @Column(name = "update_user")
+    private String updateUser;
+
+    /**
+     * 更新时间
+     */
+    @ApiModelProperty("更新时间")
+    @Column(name = "update_time")
+    private Date updateTime;
+
+
+}

+ 158 - 0
operating-service/src/main/java/com/txz/operating/mq/rocket/consumer/Consumers.java

@@ -0,0 +1,158 @@
+//package com.txz.operating.mq.rocket.consumer;
+//
+//import cn.hutool.core.collection.CollUtil;
+//import cn.hutool.core.date.DateUtil;
+//import cn.hutool.json.JSONUtil;
+//import com.github.pagehelper.PageHelper;
+//import com.yiweikeji.cif.dto.UserDTO;
+//import com.txz.operating.configurer.IpConfiguration;
+//import lombok.extern.slf4j.Slf4j;
+//import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
+//import org.apache.rocketmq.common.consumer.ConsumeFromWhere;
+//import org.apache.rocketmq.spring.annotation.ConsumeMode;
+//import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
+//import org.apache.rocketmq.spring.core.RocketMQListener;
+//import org.apache.rocketmq.spring.core.RocketMQPushConsumerLifecycleListener;
+//import org.springframework.context.annotation.Configuration;
+//import org.springframework.stereotype.Service;
+//import tk.mybatis.mapper.entity.Condition;
+//import tk.mybatis.mapper.entity.Example;
+//
+//import javax.annotation.Resource;
+//import java.util.ArrayList;
+//import java.util.List;
+//
+///**
+// * 异步消费采集器上报预警消息
+// *
+// * @author Administrator
+// * @version $Id: Consumers.java, v 0.1 2019年5月30日 下午3:11:28 Administrator Exp $
+// */
+//@Configuration
+//@Slf4j
+//public class Consumers {
+//
+//    @Resource
+//    private IpConfiguration ipConfiguration;
+//
+//    @Resource
+//    private ActivityService activityService;
+//
+//    @Resource
+//    private ActivityRecordService activityRecordService;
+//
+//    @Service
+//    @RocketMQMessageListener(topic = "${cif.user.subscribe.topic}", consumerGroup = "${spring.application.name}" + "_subscribe", consumeMode = ConsumeMode.ORDERLY)
+//    public class WeChatSubscribe implements RocketMQListener<Object>, RocketMQPushConsumerLifecycleListener {
+//        @Override
+//        public void onMessage(Object message) {
+//            log.info("operating: "+ ipConfiguration.getPort() +"received message: {}", message);
+//            try {
+//                List<String> userIdList = (List<String>) message;
+//                log.info("设置玩家关注公众号,玩家ID列表:{}", JSONUtil.toJsonStr(userIdList));
+//                //将玩家设置为关注
+//                PageHelper.startPage(1, 10);
+//                String now = DateUtil.format(DateUtil.date(),"yyyyMMddHHmmss");
+//                Condition condition = new Condition(Activity.class);
+//                Example.Criteria criteria = condition.createCriteria();
+//                criteria.andEqualTo("status", 1);
+//                criteria.andEqualTo("accomplishType", 2);
+//                criteria.andGreaterThanOrEqualTo("startTime", now);
+//                criteria.andLessThanOrEqualTo("endTime", now);
+//                List<Activity> activities = activityService.findByCondition(condition);
+//                if (CollUtil.isNotEmpty(activities)){
+//                    List<ActivityRecord> records = new ArrayList<>(10);
+//                    for (String userId: userIdList) {
+//                        for (Activity activity:activities) {
+//                            records.add(ActivityRecord.builder().activityId(activity.getId()).createTime(DateUtil.date()).userId(userId).build());
+//                        }
+//                    }
+//                    if (CollUtil.isNotEmpty(records)){
+//                        //新增记录
+//                        activityRecordService.save(records);
+//                    }
+//                }
+//            } catch (Exception e) {
+//                log.error("设置玩家关注公众号异常,玩家ID列表:{}", JSONUtil.toJsonStr(message), e);
+//                return;
+//            }
+//        }
+//
+//        @Override
+//        public void prepareStart(DefaultMQPushConsumer consumer) {
+//            consumer.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET);
+//        }
+//    }
+//
+//
+//    @Service
+//    @RocketMQMessageListener(topic = "${cif.user.wxPay.topic}", consumerGroup = "${spring.application.name}" + "_vip", consumeMode = ConsumeMode.ORDERLY)
+//    public class UserBuyVip implements RocketMQListener<UserDTO>, RocketMQPushConsumerLifecycleListener {
+//        @Override
+//        public void onMessage(UserDTO userDTO) {
+//            log.info("operating: "+ ipConfiguration.getPort() +"received message: {}", userDTO);
+//            try {
+//                if (userDTO == null) {
+//                    log.warn("设置玩家会员信息异常,玩家信息为空");
+//                    return;
+//                }
+//                PageHelper.startPage(1, 10);
+//                String now = DateUtil.format(DateUtil.date(),"yyyyMMddHHmmss");
+//                Condition condition = new Condition(Activity.class);
+//                Example.Criteria criteria = condition.createCriteria();
+//                criteria.andEqualTo("status", 1);
+//                criteria.andEqualTo("accomplishType", 1);
+//                criteria.andGreaterThanOrEqualTo("startTime", now);
+//                criteria.andLessThanOrEqualTo("endTime", now);
+//                List<Activity> activities = activityService.findByCondition(condition);
+//                if (CollUtil.isNotEmpty(activities)){
+//                    List<ActivityRecord> records = new ArrayList<>(10);
+//                    for (Activity activity:activities) {
+//                        records.add(ActivityRecord.builder().activityId(activity.getId()).createTime(DateUtil.date()).userId(userDTO.getUserId()).build());
+//                    }
+//                    if (CollUtil.isNotEmpty(records)){
+//                        activityRecordService.save(records);
+//                    }
+//                }
+//                log.info("玩家开通vip会员,用户ID:{},会员过期时间:{}", userDTO.getUserId(), userDTO.getMemberEndTime());
+//            } catch (Exception e) {
+//                log.error("设置玩家会员信息异常,user:{}", userDTO.toString());
+//                throw e;
+//            }
+//        }
+//
+//        @Override
+//        public void prepareStart(DefaultMQPushConsumer consumer) {
+//            consumer.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET);
+//        }
+//    }
+//
+//   // @Service
+//   // @RocketMQMessageListener(topic = "${cif.user.interactive.topic}", consumerGroup = "${spring.application.name}", consumeMode = ConsumeMode.ORDERLY)
+//   // public class MyConsumer3 implements RocketMQListener<UserFriendInteractiveMsg>, RocketMQPushConsumerLifecycleListener {
+//   //     @Override
+//   //     public void onMessage(UserFriendInteractiveMsg mqMessage) {
+//   //         logger.info("cif: "+ ipConfiguration.getPort() +"received message: {}", mqMessage);
+//   //         try {
+//   //             //更新用户单元信息:
+//   //             if(mqMessage.getFriendUserId() != null && StrUtil.isNotBlank(mqMessage.getUserId())){
+//   //                 userFriendService.interactive(mqMessage);
+//   //             }
+//   //             logger.info("TODO : {}", mqMessage);
+//   //         } catch (Exception e) {
+//   //             logger.error("RocketMq解析数据出错", e);
+//   //             return;
+//   //         }
+//   //     }
+//
+//   //     @Override
+//   //     public void prepareStart(DefaultMQPushConsumer consumer) {
+//   //         consumer.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET);
+//   //     }
+//   //
+//   // }
+//
+//
+//
+//
+//}

+ 33 - 0
operating-service/src/main/java/com/txz/operating/mq/rocket/consumer/TestConsumerListener.java

@@ -0,0 +1,33 @@
+//package com.txz.operating.mq.rocket.consumer;
+//
+//import com.alibaba.fastjson.JSON;
+//import com.txz.operating.mq.rocket.consumer.message.MyMessage;
+//import lombok.extern.slf4j.Slf4j;
+//import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
+//import org.apache.rocketmq.spring.core.RocketMQListener;
+//import org.springframework.stereotype.Component;
+//
+///**
+// * @Author: Fcx
+// * @Date: 2019/11/28 21:27
+// * @Version 1.0
+// */
+//@Slf4j
+//@Component
+//// topic需要和生产者的topic一致,consumerGroup属性是必须指定的,内容可以随意
+//@RocketMQMessageListener(topic = "mission-topic", consumerGroup = "consumer-group")
+//public class TestConsumerListener implements RocketMQListener<MyMessage> {
+//
+//
+//
+//    /**
+//     * 监听到消息的时候就会调用该方法
+//     *
+//     * @param message 消息体
+//     */
+//    @Override
+//    public void onMessage(MyMessage message) {
+//        log.info("从mission-topic中监听到消息");
+//        log.info(JSON.toJSONString(message));
+//    }
+//}

+ 23 - 0
operating-service/src/main/java/com/txz/operating/mq/rocket/consumer/message/MyMessage.java

@@ -0,0 +1,23 @@
+package com.txz.operating.mq.rocket.consumer.message;
+
+import lombok.Data;
+import lombok.ToString;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @Author: Fcx
+ * @Date: 2019/11/28 21:03
+ * @Version 1.0
+ */
+@Data
+@ToString
+public class MyMessage implements Serializable {
+    private static final long serialVersionUID = 4183459183310052388L;
+
+    private Integer id = 1;
+    private String name = "fcx";
+    private String status = "default";
+    private Date createTime = new Date();
+}

+ 26 - 0
operating-service/src/main/java/com/txz/operating/mq/rocket/producer/Producers.java

@@ -0,0 +1,26 @@
+//package com.txz.operating.mq.rocket.producer;
+//
+//import org.apache.rocketmq.client.producer.SendResult;
+//import org.apache.rocketmq.spring.core.RocketMQTemplate;
+//import org.springframework.beans.factory.annotation.Value;
+//import org.springframework.stereotype.Component;
+//
+//import javax.annotation.Resource;
+//
+///**
+// * @author Administrator
+// * @version $Id: Producers.java, v 0.1 2019年5月30日 下午3:11:54 Administrator Exp $
+// */
+//@Component
+//public class Producers {
+//    @Resource
+//    private RocketMQTemplate rocketMQTemplate;
+//
+//    @Value("${user.info.topic}")
+//    private String userInfoTopic;
+//
+//    public SendResult pushUserInfo(UserInfo userInfo) {
+//        return rocketMQTemplate.syncSendOrderly(userInfoTopic, userInfo, userInfo.getUserId());
+//    }
+//
+//}

+ 19 - 0
operating-service/src/main/java/com/txz/operating/open/BaiduOpenApi.java

@@ -0,0 +1,19 @@
+package com.txz.operating.open;
+
+import com.txz.operating.open.been.BdAdrressResult;
+import org.json.JSONObject;
+
+import java.util.HashMap;
+
+
+public interface BaiduOpenApi {
+
+    BdAdrressResult search(String location, String query);
+
+    BdAdrressResult suggestion(String region,String query);
+
+    /**
+     * 语音-一句话翻译
+     */
+    JSONObject sentenceRecognition(byte[] data, String format, int rate, HashMap<String, Object> options);
+}

+ 6 - 0
operating-service/src/main/java/com/txz/operating/open/CosOpenApi.java

@@ -0,0 +1,6 @@
+package com.txz.operating.open;
+
+public interface CosOpenApi {
+
+
+}

+ 9 - 0
operating-service/src/main/java/com/txz/operating/open/JbsOpenApi.java

@@ -0,0 +1,9 @@
+package com.txz.operating.open;
+
+
+import com.txz.operating.open.been.JbsStation;
+
+public interface JbsOpenApi {
+
+    JbsStation getStationInfo(Integer mcc, Integer mnc, Integer lac, Integer ci);
+}

+ 9 - 0
operating-service/src/main/java/com/txz/operating/open/TxOpenApi.java

@@ -0,0 +1,9 @@
+package com.txz.operating.open;
+
+public interface TxOpenApi {
+
+    /**
+     * 语音-一句话翻译
+     */
+    String SentenceRecognition(String  sentenceUrl);
+}

+ 161 - 0
operating-service/src/main/java/com/txz/operating/open/been/BdAdrressResult.java

@@ -0,0 +1,161 @@
+package com.txz.operating.open.been;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+@AllArgsConstructor
+@NoArgsConstructor
+@Data
+public class BdAdrressResult {
+    private  Integer          status;
+    private  String           message;
+    private  Integer          total;
+    private  List<BdAdrress>  results;
+
+
+
+    public class BdAdrress {
+        private String name;
+        private String address;
+        private String province;
+        private String city;
+        private String area;
+        private String telephone;
+        private String uid;
+        private String adcode;
+        private Double lat;
+        private Double lng;
+        private Location location;
+
+        public Double getLat() {
+            if (location != null){
+                return location.lat;
+            }
+            return lat;
+        }
+
+        public void setLat(Double lat) {
+            this.lat = lat;
+        }
+
+        public Double getLng() {
+            if (location != null){
+                return location.lng;
+            }
+            return lng;
+        }
+
+        public void setLng(Double lng) {
+            this.lng = lng;
+        }
+
+        public Location getLocation() {
+            return location;
+        }
+
+        public void setLocation(Location location) {
+            this.location = location;
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        public void setName(String name) {
+            this.name = name;
+        }
+
+        public String getAddress() {
+            return address;
+        }
+
+        public void setAddress(String address) {
+            this.address = address;
+        }
+
+        public String getProvince() {
+            return province;
+        }
+
+        public void setProvince(String province) {
+            this.province = province;
+        }
+
+        public String getCity() {
+            return city;
+        }
+
+        public void setCity(String city) {
+            this.city = city;
+        }
+
+        public String getArea() {
+            return area;
+        }
+
+        public void setArea(String area) {
+            this.area = area;
+        }
+
+        public String getTelephone() {
+            return telephone;
+        }
+
+        public void setTelephone(String telephone) {
+            this.telephone = telephone;
+        }
+
+        public String getUid() {
+            return uid;
+        }
+
+        public void setUid(String uid) {
+            this.uid = uid;
+        }
+
+        public String getAdcode() {
+            return adcode;
+        }
+
+        public void setAdcode(String adcode) {
+            this.adcode = adcode;
+        }
+    }
+
+    class Location {
+        private Double lat;
+        private Double lng;
+
+        public Double getLat() {
+            return lat;
+        }
+
+        public void setLat(Double lat) {
+            this.lat = lat;
+        }
+
+        public Double getLng() {
+            return lng;
+        }
+
+        public void setLng(Double lng) {
+            this.lng = lng;
+        }
+    }
+//        "name":"万志培训学校",
+//            "location":{
+//        "lat":30.297645,
+//                "lng":120.186011
+//    },
+//        "address":"江南巷1号兔狗创新大厦附楼二楼",
+//            "province":"浙江省",
+//            "city":"杭州市",
+//            "area":"下城区",
+//            "telephone":"13738018269",
+//            "detail":1,
+//            "uid":"c0007c5ae7a001a09c09f730"
+//    }
+}

+ 32 - 0
operating-service/src/main/java/com/txz/operating/open/been/JbsStation.java

@@ -0,0 +1,32 @@
+package com.txz.operating.open.been;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+public class JbsStation {
+
+    private Integer errcode;
+
+    /**
+     * 范围
+     */
+    private Integer radius;
+
+    /**
+     * 纬度
+     */
+    private Double lat;
+
+    /**
+     * 经度
+     */
+    private Double lon;
+
+    /**
+     * 地址
+     */
+    private String address;
+
+}

Some files were not shown because too many files changed in this diff