瀏覽代碼

Merge branch 'dev/one' into dev/intelligentTriage

gaodm 6 年之前
父節點
當前提交
e0ef7715c5
共有 100 個文件被更改,包括 2779 次插入202 次删除
  1. 7 0
      common/pom.xml
  2. 3 2
      common/src/main/java/com/diagbot/enums/SysTypeEnum.java
  3. 3 1
      common/src/main/java/com/diagbot/exception/CommonErrorCode.java
  4. 70 0
      common/src/main/java/com/diagbot/util/JwtUtil.java
  5. 1 1
      common/src/main/java/com/diagbot/util/RegexValidateUtil.java
  6. 63 0
      config-server/src/main/resources/shared/application-pro.yml
  7. 94 0
      config-server/src/main/resources/shared/bi-service-pro.yml
  8. 94 0
      config-server/src/main/resources/shared/diagbotman-service-pro.yml
  9. 93 0
      config-server/src/main/resources/shared/feedback-service-pro.yml
  10. 6 1
      config-server/src/main/resources/shared/gateway-service-dev.yml
  11. 6 1
      config-server/src/main/resources/shared/gateway-service-local.yml
  12. 92 0
      config-server/src/main/resources/shared/gateway-service-pro.yml
  13. 6 1
      config-server/src/main/resources/shared/gateway-service-test.yml
  14. 94 0
      config-server/src/main/resources/shared/knowledge-service-pro.yml
  15. 97 0
      config-server/src/main/resources/shared/logger-service-pro.yml
  16. 25 0
      config-server/src/main/resources/shared/monitor-service-pro.yml
  17. 3 1
      config-server/src/main/resources/shared/triage-service-dev.yml
  18. 3 1
      config-server/src/main/resources/shared/triage-service-local.yml
  19. 96 0
      config-server/src/main/resources/shared/triage-service-pro.yml
  20. 3 1
      config-server/src/main/resources/shared/triage-service-test.yml
  21. 86 0
      config-server/src/main/resources/shared/uaa-service-pro.yml
  22. 1 0
      config-server/src/main/resources/shared/user-service-dev.yml
  23. 1 0
      config-server/src/main/resources/shared/user-service-local.yml
  24. 114 0
      config-server/src/main/resources/shared/user-service-pro.yml
  25. 1 0
      config-server/src/main/resources/shared/user-service-test.yml
  26. 14 0
      diagbotman-service/src/main/java/com/diagbot/client/UserServiceClient.java
  27. 28 0
      diagbotman-service/src/main/java/com/diagbot/client/hystrix/UserServiceHystrix.java
  28. 2 0
      diagbotman-service/src/main/java/com/diagbot/config/ResourceServerConfigurer.java
  29. 27 1
      diagbotman-service/src/main/java/com/diagbot/config/security/UrlAccessDecisionManager.java
  30. 10 0
      diagbotman-service/src/main/java/com/diagbot/dto/EnShowOptionDTO.java
  31. 35 0
      diagbotman-service/src/main/java/com/diagbot/dto/GetConsoleOpenedDTO.java
  32. 22 0
      diagbotman-service/src/main/java/com/diagbot/dto/HasPermissionDTO.java
  33. 10 0
      diagbotman-service/src/main/java/com/diagbot/dto/LantoneProductDTO.java
  34. 15 0
      diagbotman-service/src/main/java/com/diagbot/dto/LantoneProductOrgDTO.java
  35. 17 1
      diagbotman-service/src/main/java/com/diagbot/dto/OpenUpOnTrialDTO.java
  36. 15 5
      diagbotman-service/src/main/java/com/diagbot/dto/ProductAuthProgressDTO.java
  37. 5 0
      diagbotman-service/src/main/java/com/diagbot/dto/ProductLineDTO.java
  38. 2 2
      diagbotman-service/src/main/java/com/diagbot/dto/ProductOrderExportDTO.java
  39. 4 0
      diagbotman-service/src/main/java/com/diagbot/dto/RenewalsInfosDTO.java
  40. 33 2
      diagbotman-service/src/main/java/com/diagbot/dto/UserAndProdutDTO.java
  41. 95 0
      diagbotman-service/src/main/java/com/diagbot/entity/ServiceTokenWithUser.java
  42. 21 0
      diagbotman-service/src/main/java/com/diagbot/entity/Token.java
  43. 13 0
      diagbotman-service/src/main/java/com/diagbot/entity/User.java
  44. 13 0
      diagbotman-service/src/main/java/com/diagbot/entity/UserRenewals.java
  45. 15 8
      diagbotman-service/src/main/java/com/diagbot/entity/wrapper/OrderDetailsWapper.java
  46. 3 2
      diagbotman-service/src/main/java/com/diagbot/entity/wrapper/ServiceTokenWrapper.java
  47. 6 0
      diagbotman-service/src/main/java/com/diagbot/entity/wrapper/UserRenewalsWrapper.java
  48. 3 4
      diagbotman-service/src/main/java/com/diagbot/enums/NotPassEnum.java
  49. 2 2
      diagbotman-service/src/main/java/com/diagbot/enums/PaymentMethodEnum.java
  50. 1 1
      diagbotman-service/src/main/java/com/diagbot/enums/StatusEnum.java
  51. 122 21
      diagbotman-service/src/main/java/com/diagbot/facade/LantoneProductFacade.java
  52. 97 17
      diagbotman-service/src/main/java/com/diagbot/facade/OpenedProductsFacade.java
  53. 44 14
      diagbotman-service/src/main/java/com/diagbot/facade/OrderDetailsFacade.java
  54. 84 38
      diagbotman-service/src/main/java/com/diagbot/facade/ProductOrderFacade.java
  55. 61 3
      diagbotman-service/src/main/java/com/diagbot/facade/ProductServiceFacade.java
  56. 73 22
      diagbotman-service/src/main/java/com/diagbot/facade/ServiceTokenFacade.java
  57. 60 6
      diagbotman-service/src/main/java/com/diagbot/facade/UserRenewalsFacade.java
  58. 7 0
      diagbotman-service/src/main/java/com/diagbot/mapper/LantoneProductMapper.java
  59. 13 0
      diagbotman-service/src/main/java/com/diagbot/mapper/OpenedProductsMapper.java
  60. 8 0
      diagbotman-service/src/main/java/com/diagbot/mapper/OrderDetailsMapper.java
  61. 8 1
      diagbotman-service/src/main/java/com/diagbot/mapper/ProductOrderMapper.java
  62. 32 0
      diagbotman-service/src/main/java/com/diagbot/mapper/ServiceTokenMapper.java
  63. 6 0
      diagbotman-service/src/main/java/com/diagbot/mapper/UserRenewalsMapper.java
  64. 7 0
      diagbotman-service/src/main/java/com/diagbot/service/LantoneProductService.java
  65. 13 0
      diagbotman-service/src/main/java/com/diagbot/service/OpenedProductsService.java
  66. 3 0
      diagbotman-service/src/main/java/com/diagbot/service/OrderDetailsService.java
  67. 35 0
      diagbotman-service/src/main/java/com/diagbot/service/ServiceTokenService.java
  68. 6 0
      diagbotman-service/src/main/java/com/diagbot/service/UserRenewalsService.java
  69. 10 0
      diagbotman-service/src/main/java/com/diagbot/service/impl/LantoneProductServiceImpl.java
  70. 10 0
      diagbotman-service/src/main/java/com/diagbot/service/impl/OpenedProductsServiceImpl.java
  71. 5 1
      diagbotman-service/src/main/java/com/diagbot/service/impl/OrderDetailsServiceImpl.java
  72. 38 0
      diagbotman-service/src/main/java/com/diagbot/service/impl/ServiceTokenServiceImpl.java
  73. 9 0
      diagbotman-service/src/main/java/com/diagbot/service/impl/UserRenewalsServiceImpl.java
  74. 29 1
      diagbotman-service/src/main/java/com/diagbot/web/ProductOrderController.java
  75. 2 1
      diagbotman-service/src/main/java/com/diagbot/web/ServiceTokenController.java
  76. 9 2
      diagbotman-service/src/main/resources/mapper/LantoneProductMapper.xml
  77. 56 7
      diagbotman-service/src/main/resources/mapper/OpenedProductsMapper.xml
  78. 7 1
      diagbotman-service/src/main/resources/mapper/OrderDetailsMapper.xml
  79. 21 2
      diagbotman-service/src/main/resources/mapper/ProductOrderMapper.xml
  80. 4 2
      diagbotman-service/src/main/resources/mapper/ProductServiceMapper.xml
  81. 46 0
      diagbotman-service/src/main/resources/mapper/ServiceTokenMapper.xml
  82. 16 3
      diagbotman-service/src/main/resources/mapper/UserRenewalsMapper.xml
  83. 7 6
      docs/003.20181024初始化脚本/init_diagbotcloud.sql
  84. 8 0
      eureka-server/src/main/resources/application-pro.yml
  85. 4 0
      gateway-service/pom.xml
  86. 2 1
      gateway-service/src/main/java/com/diagbot/client/DiagbotmanServiceClient.java
  87. 2 1
      gateway-service/src/main/java/com/diagbot/client/hystrix/DiagbotmanServiceHystrix.java
  88. 2 0
      gateway-service/src/main/java/com/diagbot/client/hystrix/UserServiceHystrix.java
  89. 22 0
      gateway-service/src/main/java/com/diagbot/entity/HasPermissionDTO.java
  90. 1 1
      gateway-service/src/main/java/com/diagbot/entity/ServiceFilter.java
  91. 192 0
      gateway-service/src/main/java/com/diagbot/entity/SysLog.java
  92. 21 0
      gateway-service/src/main/java/com/diagbot/entity/Token.java
  93. 30 7
      gateway-service/src/main/java/com/diagbot/filter/GlobalGatewayFilter.java
  94. 23 0
      gateway-service/src/main/java/com/diagbot/rabbit/MyProcessor.java
  95. 27 0
      gateway-service/src/main/java/com/diagbot/rabbit/MySender.java
  96. 1 1
      triage-service/src/main/java/com/diagbot/client/AIServiceClient.java
  97. 1 1
      uaa-service/src/main/resources/mapper/UserMapper.xml
  98. 8 2
      user-service/src/main/java/com/diagbot/client/DiagbotmanClient.java
  99. 14 2
      user-service/src/main/java/com/diagbot/client/hystrix/DiagbotmanServiceHystrix.java
  100. 0 0
      user-service/src/main/java/com/diagbot/config/RedisConfigurer.java

+ 7 - 0
common/pom.xml

@@ -96,6 +96,13 @@
             <version>4.0.0</version>
         </dependency>
 
+        <dependency>
+            <groupId>com.auth0</groupId>
+            <artifactId>java-jwt</artifactId>
+            <version>3.4.1</version>
+            <scope>compile</scope>
+        </dependency>
+
         <!--<dependency>-->
             <!--<groupId>com.fasterxml.jackson.core</groupId>-->
             <!--<artifactId>jackson-core</artifactId>-->

+ 3 - 2
common/src/main/java/com/diagbot/enums/SysTypeEnum.java

@@ -18,8 +18,9 @@ public enum SysTypeEnum implements KeyedNamed {
     BI_SERVICE(5, "bi-service"),
     KNOWLEDGE_SERVICE(6, "knowledge-service"),
     FEEDBACK_SERVICE(7, "feedback-service"),
-    ICSS_WEB(8, "icss-web"),
-    TRIAGE_SERVICE(9, "triage-web");
+    ICSS_WEB(8, "icss-service"),
+    TRIAGE_SERVICE(9, "triage-service"),
+    APPKEY(10, "appkey");
 
     @Setter
     private int key;

+ 3 - 1
common/src/main/java/com/diagbot/exception/CommonErrorCode.java

@@ -21,7 +21,9 @@ public enum CommonErrorCode implements ErrorCode {
     STATUS_IS_ERROR("00020006", "参数状态错误!"),
     SERVER_IS_ERROR("00020007", "各自业务错误!"),
     NO_PERMISSION("00020008", "无权访问!"),
-    IS_EXISTS("00020009", "已存在!");
+    IS_EXISTS("00020009", "已存在!"),
+    ANALYZER_TOKEN_FAIL("10020010", "解析token失败"),
+    TOKEN_PAST("10020011", "token已失效,请重新登录");
 
     private String code;
     private String msg;

文件差異過大導致無法顯示
+ 70 - 0
common/src/main/java/com/diagbot/util/JwtUtil.java


+ 1 - 1
common/src/main/java/com/diagbot/util/RegexValidateUtil.java

@@ -56,7 +56,7 @@ public class RegexValidateUtil {
     public static boolean checkPassWord(String password) {
         boolean flag = false;
         try {
-            Pattern regex = Pattern.compile("^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$");
+            Pattern regex = Pattern.compile("^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z\\W_]{6,16}$");
             Matcher matcher = regex.matcher(password);
             flag = matcher.matches();
         } catch (Exception e) {

+ 63 - 0
config-server/src/main/resources/shared/application-pro.yml

@@ -0,0 +1,63 @@
+#logging:
+#  level:
+#    org.springframework.security: INFO
+
+hystrix:
+  command:
+    default:
+      execution:
+        isolation:
+          thread:
+            timeoutInMilliseconds: 3000
+
+eureka:
+  instance:
+    prefer-ip-address: true #使用IP注册
+    instance-id: ${spring.cloud.client.ip-address}:${server.port}
+    leaseRenewalIntervalInSeconds: 10
+    health-check-url-path: /actuator/health #2.0后actuator的地址发生了变化
+  client:
+    registryFetchIntervalSeconds: 5
+#    serviceUrl:
+#      defaultZone: http://eureka1:8761/eureka/
+
+#endpoints:
+#  health:
+#    sensitive: false
+#    enabled: true
+#  actuator:
+#    enabled: true
+#    sensitive: false
+#  beans:
+#    sensitive: false
+#    enabled: true
+
+
+management:
+  endpoints:
+    web:
+      exposure:
+        include: bus-refresh,health,info,hystrix.stream
+      cors:
+        allowed-origins: "*"
+        allowed-methods: "*"
+  endpoint:
+    health:
+      show-details: always
+feign:
+  hystrix:
+    enabled: true
+
+spring:
+  #消息总线
+  cloud:
+    bus:
+      enabled: true
+      trace:
+        enabled: true
+  jackson:
+    date-format: yyyy-MM-dd HH:mm:ss
+    time-zone: GMT+8
+
+swagger:
+  enable: false

+ 94 - 0
config-server/src/main/resources/shared/bi-service-pro.yml

@@ -0,0 +1,94 @@
+server:
+  port: 8841
+
+# 驱动配置信息
+spring:
+  datasource:
+    druid:
+      driverClassName: com.mysql.jdbc.Driver
+      driver-class-name: com.mysql.jdbc.Driver
+      platform: mysql
+      url: jdbc:mysql://192.168.2.236:3306/sys-log?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false
+      username: root
+      password: lantone
+      # 连接池的配置信息
+      # 初始化大小,最小,最大
+      initialSize: 5
+      minIdle: 5
+      maxActive: 20
+      # 配置获取连接等待超时的时间
+      maxWait: 60000
+      # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+      timeBetweenEvictionRunsMillis: 60000
+      # 配置一个连接在池中最小生存的时间,单位是毫秒
+      minEvictableIdleTimeMillis: 300000
+      validationQuery: SELECT 1 FROM DUAL
+      testWhileIdle: true
+      testOnBorrow: false
+      testOnReturn: false
+      # 打开PSCache,并且指定每个连接上PSCache的大小
+      poolPreparedStatements: true
+      maxPoolPreparedStatementPerConnectionSize: 20
+      # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
+      filters.commons-log.connection-logger-name: stat,wall,log4j
+      filter.stat.log-slow-sql: true
+      filter.stat.slow-sql-millis: 2000
+      #监控配置
+      web-stat-filter:
+        enabled: true
+        url-pattern: /*
+        exclusions: '*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*'
+
+      # StatViewServlet配置,说明请参考Druid Wiki,配置_StatViewServlet配置
+      stat-view-servlet:
+        enabled: true
+        url-pattern: /druid/*
+        reset-enable: false
+        login-username: root
+        login-password: root
+
+  cloud:
+    stream:
+      bindings:
+        outputLog:
+          destination: myLog
+  #          contentType: text/plain      # 实体 json string 在传递的类型装换 查看 http://docs.spring
+
+  #mq
+  rabbitmq:
+    host: 192.168.2.236
+    port: 5672
+    username: lantone
+    password: lantone
+    publisher-confirms: true
+    virtual-host: /
+
+#mybatis
+mybatis-plus:
+  mapper-locations: classpath:/mapper/*Mapper.xml
+  #实体扫描,多个package用逗号或者分号分隔
+  typeAliasesPackage: com.diagbot.entity
+  global-config:
+    #刷新mapper 调试神器
+    db-config:
+      #主键类型  0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
+      id-type: id_worker
+      #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
+      field-strategy: not_empty
+      #驼峰下划线转换
+      column-underline: true
+      #数据库大写下划线转换
+      #capital-mode: true
+      #刷新mapper 调试神器
+      refresh-mapper: true
+      #逻辑删除配置
+      logic-delete-value: 0
+      logic-not-delete-value: 1
+      #自定义填充策略接口实现
+      #meta-object-handler: com.baomidou.springboot.xxx
+      #自定义SQL注入器
+      #sql-injector: com.baomidou.springboot.xxx
+  configuration:
+    map-underscore-to-camel-case: true
+    cache-enabled: false
+

+ 94 - 0
config-server/src/main/resources/shared/diagbotman-service-pro.yml

@@ -0,0 +1,94 @@
+server:
+  port: 8811
+
+# 驱动配置信息
+spring:
+  datasource:
+    druid:
+      driverClassName: com.mysql.jdbc.Driver
+      driver-class-name: com.mysql.jdbc.Driver
+      platform: mysql
+      url: jdbc:mysql://192.168.2.236:3306/sys-diagbotman?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false
+      username: root
+      password: lantone
+      # 连接池的配置信息
+      # 初始化大小,最小,最大
+      initialSize: 5
+      minIdle: 5
+      maxActive: 20
+      # 配置获取连接等待超时的时间
+      maxWait: 60000
+      # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+      timeBetweenEvictionRunsMillis: 60000
+      # 配置一个连接在池中最小生存的时间,单位是毫秒
+      minEvictableIdleTimeMillis: 300000
+      validationQuery: SELECT 1 FROM DUAL
+      testWhileIdle: true
+      testOnBorrow: false
+      testOnReturn: false
+      # 打开PSCache,并且指定每个连接上PSCache的大小
+      poolPreparedStatements: true
+      maxPoolPreparedStatementPerConnectionSize: 20
+      # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
+      filters.commons-log.connection-logger-name: stat,wall,log4j
+      filter.stat.log-slow-sql: true
+      filter.stat.slow-sql-millis: 2000
+      #监控配置
+      web-stat-filter:
+        enabled: true
+        url-pattern: /*
+        exclusions: '*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*'
+
+      # StatViewServlet配置,说明请参考Druid Wiki,配置_StatViewServlet配置
+      stat-view-servlet:
+        enabled: true
+        url-pattern: /druid/*
+        reset-enable: false
+        login-username: root
+        login-password: root
+
+  cloud:
+    stream:
+      bindings:
+        outputLog:
+          destination: myLog
+  #          contentType: text/plain      # 实体 json string 在传递的类型装换 查看 http://docs.spring
+
+  #mq
+  rabbitmq:
+    host: 192.168.2.236
+    port: 5672
+    username: lantone
+    password: lantone
+    publisher-confirms: true
+    virtual-host: /
+
+#mybatis
+mybatis-plus:
+  mapper-locations: classpath:/mapper/*Mapper.xml
+  #实体扫描,多个package用逗号或者分号分隔
+  typeAliasesPackage: com.diagbot.entity
+  global-config:
+    #刷新mapper 调试神器
+    db-config:
+      #主键类型  0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
+      id-type: id_worker
+      #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
+      field-strategy: not_empty
+      #驼峰下划线转换
+      column-underline: true
+      #数据库大写下划线转换
+      #capital-mode: true
+      #刷新mapper 调试神器
+      refresh-mapper: true
+      #逻辑删除配置
+      logic-delete-value: 0
+      logic-not-delete-value: 1
+      #自定义填充策略接口实现
+      #meta-object-handler: com.baomidou.springboot.xxx
+      #自定义SQL注入器
+      #sql-injector: com.baomidou.springboot.xxx
+  configuration:
+    map-underscore-to-camel-case: true
+    cache-enabled: false
+

+ 93 - 0
config-server/src/main/resources/shared/feedback-service-pro.yml

@@ -0,0 +1,93 @@
+server:
+  port: 8831
+
+# 驱动配置信息
+spring:
+  datasource:
+    druid:
+      driverClassName: com.mysql.jdbc.Driver
+      driver-class-name: com.mysql.jdbc.Driver
+      platform: mysql
+      url: jdbc:mysql://192.168.2.236:3306/sys-log?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false
+      username: root
+      password: lantone
+      # 连接池的配置信息
+      # 初始化大小,最小,最大
+      initialSize: 5
+      minIdle: 5
+      maxActive: 20
+      # 配置获取连接等待超时的时间
+      maxWait: 60000
+      # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+      timeBetweenEvictionRunsMillis: 60000
+      # 配置一个连接在池中最小生存的时间,单位是毫秒
+      minEvictableIdleTimeMillis: 300000
+      validationQuery: SELECT 1 FROM DUAL
+      testWhileIdle: true
+      testOnBorrow: false
+      testOnReturn: false
+      # 打开PSCache,并且指定每个连接上PSCache的大小
+      poolPreparedStatements: true
+      maxPoolPreparedStatementPerConnectionSize: 20
+      # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
+      filters.commons-log.connection-logger-name: stat,wall,log4j
+      filter.stat.log-slow-sql: true
+      filter.stat.slow-sql-millis: 2000
+      #监控配置
+      web-stat-filter:
+        enabled: true
+        url-pattern: /*
+        exclusions: '*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*'
+
+      # StatViewServlet配置,说明请参考Druid Wiki,配置_StatViewServlet配置
+      stat-view-servlet:
+        enabled: true
+        url-pattern: /druid/*
+        reset-enable: false
+        login-username: root
+        login-password: root
+
+  cloud:
+    stream:
+      bindings:
+        outputLog:
+          destination: myLog
+  #          contentType: text/plain      # 实体 json string 在传递的类型装换 查看 http://docs.spring
+
+  #mq
+  rabbitmq:
+    host: 192.168.2.236
+    port: 5672
+    username: lantone
+    password: lantone
+    publisher-confirms: true
+    virtual-host: /
+
+#mybatis
+mybatis-plus:
+  mapper-locations: classpath:/mapper/*Mapper.xml
+  #实体扫描,多个package用逗号或者分号分隔
+  typeAliasesPackage: com.diagbot.entity
+  global-config:
+    #刷新mapper 调试神器
+    db-config:
+      #主键类型  0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
+      id-type: id_worker
+      #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
+      field-strategy: not_empty
+      #驼峰下划线转换
+      column-underline: true
+      #数据库大写下划线转换
+      #capital-mode: true
+      #刷新mapper 调试神器
+      refresh-mapper: true
+      #逻辑删除配置
+      logic-delete-value: 0
+      logic-not-delete-value: 1
+      #自定义填充策略接口实现
+      #meta-object-handler: com.baomidou.springboot.xxx
+      #自定义SQL注入器
+      #sql-injector: com.baomidou.springboot.xxx
+  configuration:
+    map-underscore-to-camel-case: true
+    cache-enabled: false

+ 6 - 1
config-server/src/main/resources/shared/gateway-service-dev.yml

@@ -20,6 +20,11 @@ spring:
     publisher-confirms: true
     virtual-host: /
   cloud:
+    stream:
+      bindings:
+        outputLog:
+          destination: myLog
+    #          contentType: text/plain      # 实体 json string 在传递的类型装换 查看 http://docs.spring
     gateway:
       default-filters:
       routes:
@@ -83,5 +88,5 @@ server:
   port: 5050
 
 lantone:
-  product: icss,1;icsstry,2
+  product: triage,1;icss,2
 

+ 6 - 1
config-server/src/main/resources/shared/gateway-service-local.yml

@@ -20,6 +20,11 @@ spring:
     publisher-confirms: true
     virtual-host: /
   cloud:
+    stream:
+      bindings:
+        outputLog:
+          destination: myLog
+      #          contentType: text/plain      # 实体 json string 在传递的类型装换 查看 http://docs.spring
     gateway:
       default-filters:
       routes:
@@ -83,5 +88,5 @@ server:
   port: 5050
 
 lantone:
-  product: icss,1;icsstry,2
+  product: triage,1;icss,2
 

+ 92 - 0
config-server/src/main/resources/shared/gateway-service-pro.yml

@@ -0,0 +1,92 @@
+hystrix:
+  command:
+    default:
+      execution:
+        isolation:
+          thread:
+            timeoutInMilliseconds: 20000
+
+ribbon:
+  ReadTimeout: 20000
+  ConnectTimeout: 20000
+
+spring:
+  #mq
+  rabbitmq:
+    host: 192.168.2.236
+    port: 5672
+    username: lantone
+    password: lantone
+    publisher-confirms: true
+    virtual-host: /
+  cloud:
+    stream:
+      bindings:
+        outputLog:
+          destination: myLog
+    #          contentType: text/plain      # 实体 json string 在传递的类型装换 查看 http://docs.spring
+    gateway:
+      default-filters:
+      routes:
+      - id: user-service
+        uri: lb://user-service
+        predicates:
+        - Path=/api/user/**
+        filters:
+        - SwaggerHeaderFilter
+        - StripPrefix=2
+      - id: logger-service
+        uri: lb://logger-service
+        predicates:
+        - Path=/api/log/**
+        filters:
+        - SwaggerHeaderFilter
+        - StripPrefix=2
+      - id: bi-service
+        uri: lb://bi-service
+        predicates:
+        - Path=/api/bi/**
+        filters:
+        - SwaggerHeaderFilter
+        - StripPrefix=2
+      - id: diagbotman-service
+        uri: lb://diagbotman-service
+        predicates:
+        - Path=/api/diagbotman/**
+        filters:
+        - SwaggerHeaderFilter
+        - StripPrefix=2
+      - id: feedback-service
+        uri: lb://feedback-service
+        predicates:
+        - Path=/api/feedback/**
+        filters:
+        - SwaggerHeaderFilter
+        - StripPrefix=2
+      - id: knowledge-service
+        uri: lb://knowledge-service
+        predicates:
+        - Path=/api/knowledge/**
+        filters:
+        - SwaggerHeaderFilter
+        - StripPrefix=2
+      - id: icss
+        uri: http://192.168.2.165:8080
+        predicates:
+        - Path=/api/icss/**
+        filters:
+        - StripPrefix=2
+      - id: triage-service
+        uri: lb://triage-service
+        predicates:
+        - Path=/api/triage/**
+        filters:
+        - SwaggerHeaderFilter
+        - StripPrefix=2
+
+server:
+  port: 5050
+
+lantone:
+  product: triage,1;icss,2
+

+ 6 - 1
config-server/src/main/resources/shared/gateway-service-test.yml

@@ -20,6 +20,11 @@ spring:
     publisher-confirms: true
     virtual-host: /
   cloud:
+    stream:
+      bindings:
+        outputLog:
+          destination: myLog
+      #          contentType: text/plain      # 实体 json string 在传递的类型装换 查看 http://docs.spring
     gateway:
       default-filters:
       routes:
@@ -83,5 +88,5 @@ server:
   port: 5050
 
 lantone:
-  product: icss,1;icsstry,2
+  product: triage33,1;icss,2
 

+ 94 - 0
config-server/src/main/resources/shared/knowledge-service-pro.yml

@@ -0,0 +1,94 @@
+server:
+  port: 8821
+
+# 驱动配置信息
+spring:
+  datasource:
+    druid:
+      driverClassName: com.mysql.jdbc.Driver
+      driver-class-name: com.mysql.jdbc.Driver
+      platform: mysql
+      url: jdbc:mysql://192.168.2.236:3306/sys-log?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false
+      username: root
+      password: lantone
+      # 连接池的配置信息
+      # 初始化大小,最小,最大
+      initialSize: 5
+      minIdle: 5
+      maxActive: 20
+      # 配置获取连接等待超时的时间
+      maxWait: 60000
+      # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+      timeBetweenEvictionRunsMillis: 60000
+      # 配置一个连接在池中最小生存的时间,单位是毫秒
+      minEvictableIdleTimeMillis: 300000
+      validationQuery: SELECT 1 FROM DUAL
+      testWhileIdle: true
+      testOnBorrow: false
+      testOnReturn: false
+      # 打开PSCache,并且指定每个连接上PSCache的大小
+      poolPreparedStatements: true
+      maxPoolPreparedStatementPerConnectionSize: 20
+      # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
+      filters.commons-log.connection-logger-name: stat,wall,log4j
+      filter.stat.log-slow-sql: true
+      filter.stat.slow-sql-millis: 2000
+      #监控配置
+      web-stat-filter:
+        enabled: true
+        url-pattern: /*
+        exclusions: '*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*'
+
+      # StatViewServlet配置,说明请参考Druid Wiki,配置_StatViewServlet配置
+      stat-view-servlet:
+        enabled: true
+        url-pattern: /druid/*
+        reset-enable: false
+        login-username: root
+        login-password: root
+
+  cloud:
+    stream:
+      bindings:
+        outputLog:
+          destination: myLog
+  #          contentType: text/plain      # 实体 json string 在传递的类型装换 查看 http://docs.spring
+
+  #mq
+  rabbitmq:
+    host: 192.168.2.236
+    port: 5672
+    username: lantone
+    password: lantone
+    publisher-confirms: true
+    virtual-host: /
+
+#mybatis
+mybatis-plus:
+  mapper-locations: classpath:/mapper/*Mapper.xml
+  #实体扫描,多个package用逗号或者分号分隔
+  typeAliasesPackage: com.diagbot.entity
+  global-config:
+    #刷新mapper 调试神器
+    db-config:
+      #主键类型  0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
+      id-type: id_worker
+      #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
+      field-strategy: not_empty
+      #驼峰下划线转换
+      column-underline: true
+      #数据库大写下划线转换
+      #capital-mode: true
+      #刷新mapper 调试神器
+      refresh-mapper: true
+      #逻辑删除配置
+      logic-delete-value: 0
+      logic-not-delete-value: 1
+      #自定义填充策略接口实现
+      #meta-object-handler: com.baomidou.springboot.xxx
+      #自定义SQL注入器
+      #sql-injector: com.baomidou.springboot.xxx
+  configuration:
+    map-underscore-to-camel-case: true
+    cache-enabled: false
+

+ 97 - 0
config-server/src/main/resources/shared/logger-service-pro.yml

@@ -0,0 +1,97 @@
+server:
+  port: 9997
+
+# 驱动配置信息
+spring:
+  datasource:
+    druid:
+      driverClassName: com.mysql.jdbc.Driver
+      driver-class-name: com.mysql.jdbc.Driver
+      platform: mysql
+      url: jdbc:mysql://192.168.2.236:3306/sys-log?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false
+      username: root
+      password: lantone
+      # 连接池的配置信息
+      # 初始化大小,最小,最大
+      initialSize: 5
+      minIdle: 5
+      maxActive: 20
+      # 配置获取连接等待超时的时间
+      maxWait: 60000
+      # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+      timeBetweenEvictionRunsMillis: 60000
+      # 配置一个连接在池中最小生存的时间,单位是毫秒
+      minEvictableIdleTimeMillis: 300000
+      validationQuery: SELECT 1 FROM DUAL
+      testWhileIdle: true
+      testOnBorrow: false
+      testOnReturn: false
+      # 打开PSCache,并且指定每个连接上PSCache的大小
+      poolPreparedStatements: true
+      maxPoolPreparedStatementPerConnectionSize: 20
+      # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
+      filters.commons-log.connection-logger-name: stat,wall,log4j
+      filter.stat.log-slow-sql: true
+      filter.stat.slow-sql-millis: 2000
+      #监控配置
+      web-stat-filter:
+        enabled: true
+        url-pattern: /*
+        exclusions: '*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*'
+
+      # StatViewServlet配置,说明请参考Druid Wiki,配置_StatViewServlet配置
+      stat-view-servlet:
+        enabled: true
+        url-pattern: /druid/*
+        reset-enable: false
+        login-username: root
+        login-password: root
+
+  cloud:
+    stream:
+      bindings:
+        outputLog:
+          destination: myLog
+        #          contentType: text/plain      # 实体 json string 在传递的类型装换 查看 http://docs.spring
+        inputLog:
+          destination: myLog
+          group: logReceiveGroup     # 具体分组 对应 MQ 是 队列名称 并且持久化队列
+
+  #mq
+  rabbitmq:
+    host: 192.168.2.236
+    port: 5672
+    username: lantone
+    password: lantone
+    publisher-confirms: true
+    virtual-host: /
+
+#mybatis
+mybatis-plus:
+  mapper-locations: classpath:/mapper/*Mapper.xml
+  #实体扫描,多个package用逗号或者分号分隔
+  typeAliasesPackage: com.diagbot.entity
+  global-config:
+    #刷新mapper 调试神器
+    db-config:
+      #主键类型  0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
+      id-type: id_worker
+      #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
+      field-strategy: not_empty
+      #驼峰下划线转换
+      column-underline: true
+      #数据库大写下划线转换
+      #capital-mode: true
+      #刷新mapper 调试神器
+      refresh-mapper: true
+      #逻辑删除配置
+      logic-delete-value: 0
+      logic-not-delete-value: 1
+      #自定义填充策略接口实现
+      #meta-object-handler: com.baomidou.springboot.xxx
+      #自定义SQL注入器
+      #sql-injector: com.baomidou.springboot.xxx
+  configuration:
+    map-underscore-to-camel-case: true
+    cache-enabled: false
+

+ 25 - 0
config-server/src/main/resources/shared/monitor-service-pro.yml

@@ -0,0 +1,25 @@
+server:
+  port: 8766
+security.basic.enabled: false
+turbine:
+  aggregator:
+    clusterConfig: default
+  appConfig: user-service , logger-service
+  clusterNameExpression: new String("default")
+  combine-host: true
+  instanceUrlSuffix:
+    default: actuator/hystrix.stream
+
+#mq
+spring:
+  rabbitmq:
+    host: 192.168.2.236
+    port: 5672
+    username: lantone
+    password: lantone
+    publisher-confirms: true
+    virtual-host: /
+
+management:
+  security:
+    enabled: false

+ 3 - 1
config-server/src/main/resources/shared/triage-service-dev.yml

@@ -91,4 +91,6 @@ mybatis-plus:
   configuration:
     map-underscore-to-camel-case: true
     cache-enabled: false
-
+ai:
+  server:
+    address: http://192.168.2.234:8080

+ 3 - 1
config-server/src/main/resources/shared/triage-service-local.yml

@@ -91,4 +91,6 @@ mybatis-plus:
   configuration:
     map-underscore-to-camel-case: true
     cache-enabled: false
-
+ai:
+  server:
+    address: http://192.168.2.234:8080

+ 96 - 0
config-server/src/main/resources/shared/triage-service-pro.yml

@@ -0,0 +1,96 @@
+server:
+  port: 8842
+
+# 驱动配置信息
+spring:
+  datasource:
+    druid:
+      driverClassName: com.mysql.jdbc.Driver
+      driver-class-name: com.mysql.jdbc.Driver
+      platform: mysql
+      url: jdbc:mysql://192.168.2.236:3306/sys-triage?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false
+      username: root
+      password: lantone
+      # 连接池的配置信息
+      # 初始化大小,最小,最大
+      initialSize: 5
+      minIdle: 5
+      maxActive: 20
+      # 配置获取连接等待超时的时间
+      maxWait: 60000
+      # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+      timeBetweenEvictionRunsMillis: 60000
+      # 配置一个连接在池中最小生存的时间,单位是毫秒
+      minEvictableIdleTimeMillis: 300000
+      validationQuery: SELECT 1 FROM DUAL
+      testWhileIdle: true
+      testOnBorrow: false
+      testOnReturn: false
+      # 打开PSCache,并且指定每个连接上PSCache的大小
+      poolPreparedStatements: true
+      maxPoolPreparedStatementPerConnectionSize: 20
+      # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
+      filters.commons-log.connection-logger-name: stat,wall,log4j
+      filter.stat.log-slow-sql: true
+      filter.stat.slow-sql-millis: 2000
+      #监控配置
+      web-stat-filter:
+        enabled: true
+        url-pattern: /*
+        exclusions: '*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*'
+
+      # StatViewServlet配置,说明请参考Druid Wiki,配置_StatViewServlet配置
+      stat-view-servlet:
+        enabled: true
+        url-pattern: /druid/*
+        reset-enable: false
+        login-username: root
+        login-password: root
+
+  cloud:
+    stream:
+      bindings:
+        outputLog:
+          destination: myLog
+  #          contentType: text/plain      # 实体 json string 在传递的类型装换 查看 http://docs.spring
+
+  #mq
+  rabbitmq:
+    host: 192.168.2.236
+    port: 5672
+    username: lantone
+    password: lantone
+    publisher-confirms: true
+    virtual-host: /
+
+#mybatis
+mybatis-plus:
+  mapper-locations: classpath:/mapper/*Mapper.xml
+  #实体扫描,多个package用逗号或者分号分隔
+  typeAliasesPackage: com.diagbot.entity
+  global-config:
+    #刷新mapper 调试神器
+    db-config:
+      #主键类型  0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
+      id-type: id_worker
+      #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
+      field-strategy: not_empty
+      #驼峰下划线转换
+      column-underline: true
+      #数据库大写下划线转换
+      #capital-mode: true
+      #刷新mapper 调试神器
+      refresh-mapper: true
+      #逻辑删除配置
+      logic-delete-value: 0
+      logic-not-delete-value: 1
+      #自定义填充策略接口实现
+      #meta-object-handler: com.baomidou.springboot.xxx
+      #自定义SQL注入器
+      #sql-injector: com.baomidou.springboot.xxx
+  configuration:
+    map-underscore-to-camel-case: true
+    cache-enabled: false
+ai:
+  server:
+    address: http://192.168.2.234:8080

+ 3 - 1
config-server/src/main/resources/shared/triage-service-test.yml

@@ -91,4 +91,6 @@ mybatis-plus:
   configuration:
     map-underscore-to-camel-case: true
     cache-enabled: false
-
+ai:
+  server:
+    address: http://192.168.2.234:8080

+ 86 - 0
config-server/src/main/resources/shared/uaa-service-pro.yml

@@ -0,0 +1,86 @@
+# 驱动配置信息
+spring:
+  datasource:
+    druid:
+      driverClassName: com.mysql.jdbc.Driver
+      driver-class-name: com.mysql.jdbc.Driver
+      platform: mysql
+      url: jdbc:mysql://192.168.2.236:3306/sys-user?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false
+      username: root
+      password: lantone
+      # 连接池的配置信息
+      # 初始化大小,最小,最大
+      initialSize: 5
+      minIdle: 5
+      maxActive: 20
+      # 配置获取连接等待超时的时间
+      maxWait: 60000
+      # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+      timeBetweenEvictionRunsMillis: 60000
+      # 配置一个连接在池中最小生存的时间,单位是毫秒
+      minEvictableIdleTimeMillis: 300000
+      validationQuery: SELECT 1 FROM DUAL
+      testWhileIdle: true
+      testOnBorrow: false
+      testOnReturn: false
+      # 打开PSCache,并且指定每个连接上PSCache的大小
+      poolPreparedStatements: true
+      maxPoolPreparedStatementPerConnectionSize: 20
+      # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
+      filters.commons-log.connection-logger-name: stat,wall,log4j
+      filter.stat.log-slow-sql: true
+      filter.stat.slow-sql-millis: 2000
+      #监控配置
+      web-stat-filter:
+        enabled: true
+        url-pattern: /*
+        exclusions: '*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*'
+
+      # StatViewServlet配置,说明请参考Druid Wiki,配置_StatViewServlet配置
+      stat-view-servlet:
+        enabled: true
+        url-pattern: /druid/*
+        reset-enable: false
+        login-username: root
+        login-password: root
+
+  #mq
+  rabbitmq:
+    host: 192.168.2.236
+    port: 5672
+    username: lantone
+    password: lantone
+    publisher-confirms: true
+    virtual-host: /
+
+#mybatis
+mybatis-plus:
+  mapper-locations: classpath:/mapper/*Mapper.xml
+  #实体扫描,多个package用逗号或者分号分隔
+  typeAliasesPackage: com.diagbot.entity
+  global-config:
+    #刷新mapper 调试神器
+    db-config:
+      #主键类型  0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
+      id-type: id_worker
+      #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
+      field-strategy: not_empty
+      #驼峰下划线转换
+      column-underline: true
+      #数据库大写下划线转换
+      #capital-mode: true
+      #刷新mapper 调试神器
+      refresh-mapper: true
+      #逻辑删除配置
+      logic-delete-value: 0
+      logic-not-delete-value: 1
+      #自定义填充策略接口实现
+      #meta-object-handler: com.baomidou.springboot.xxx
+      #自定义SQL注入器
+      #sql-injector: com.baomidou.springboot.xxx
+  configuration:
+    map-underscore-to-camel-case: true
+    cache-enabled: false
+
+server:
+  port: 9999

+ 1 - 0
config-server/src/main/resources/shared/user-service-dev.yml

@@ -70,6 +70,7 @@ spring:
       idc: 1 # 不可见ID索引
       sms: 2 # Redis短信索引
       img: 3 # Redis图片验证码索引
+      token: 4 # Token索引
     host: 192.168.2.236  #Redis服务器地址
     port: 6379 # Redis服务器连接端口
     password: lantone # Redis服务器连接密码(默认为空)

+ 1 - 0
config-server/src/main/resources/shared/user-service-local.yml

@@ -70,6 +70,7 @@ spring:
       idc: 11 # 不可见ID索引
       sms: 12 # Redis短信索引
       img: 13 # Redis图片验证码索引
+      token: 14 # Token索引
     host: 192.168.2.236  #Redis服务器地址
     port: 6379 # Redis服务器连接端口
     password: lantone # Redis服务器连接密码(默认为空)

+ 114 - 0
config-server/src/main/resources/shared/user-service-pro.yml

@@ -0,0 +1,114 @@
+server:
+  port: 8762
+
+# 驱动配置信息
+spring:
+  datasource:
+    druid:
+      driverClassName: com.mysql.jdbc.Driver
+      driver-class-name: com.mysql.jdbc.Driver
+      platform: mysql
+      url: jdbc:mysql://192.168.2.236:3306/sys-user?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false
+      username: root
+      password: lantone
+      # 连接池的配置信息
+      # 初始化大小,最小,最大
+      initialSize: 5
+      minIdle: 5
+      maxActive: 20
+      # 配置获取连接等待超时的时间
+      maxWait: 60000
+      # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+      timeBetweenEvictionRunsMillis: 60000
+      # 配置一个连接在池中最小生存的时间,单位是毫秒
+      minEvictableIdleTimeMillis: 300000
+      validationQuery: SELECT 1 FROM DUAL
+      testWhileIdle: true
+      testOnBorrow: false
+      testOnReturn: false
+      # 打开PSCache,并且指定每个连接上PSCache的大小
+      poolPreparedStatements: true
+      maxPoolPreparedStatementPerConnectionSize: 20
+      # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
+      filters.commons-log.connection-logger-name: stat,wall,log4j
+      filter.stat.log-slow-sql: true
+      filter.stat.slow-sql-millis: 2000
+      #监控配置
+      web-stat-filter:
+        enabled: true
+        url-pattern: /*
+        exclusions: '*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*'
+
+      # StatViewServlet配置,说明请参考Druid Wiki,配置_StatViewServlet配置
+      stat-view-servlet:
+        enabled: true
+        url-pattern: /druid/*
+        reset-enable: false
+        login-username: root
+        login-password: root
+
+  cloud:
+    stream:
+      bindings:
+        outputLog:
+          destination: myLog
+  #          contentType: text/plain      # 实体 json string 在传递的类型装换 查看 http://docs.spring
+
+  #mq
+  rabbitmq:
+    host: 192.168.2.236
+    port: 5672
+    username: lantone
+    password: lantone
+    publisher-confirms: true
+    virtual-host: /
+
+  #redis
+  redis:
+    database:
+      cache: 0 # Redis缓存索引
+      idc: 1 # 不可见ID索引
+      sms: 2 # Redis短信索引
+      img: 3 # Redis图片验证码索引
+      token: 4 # Token索引
+    host: 192.168.2.236  #Redis服务器地址
+    port: 6379 # Redis服务器连接端口
+    password: lantone # Redis服务器连接密码(默认为空)
+    jedis:
+      pool:
+        max-active: 8 # 连接池最大连接数(使用负值表示没有限制)
+        max-idle: 5 # 连接池中的最大空闲连接
+        max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制)
+        min-idle: 0 # 连接池中的最小空闲连接
+    timeout: 0 # 连接超时时间(毫秒)
+
+#mybatis
+mybatis-plus:
+  mapper-locations: classpath:/mapper/*Mapper.xml
+  #实体扫描,多个package用逗号或者分号分隔
+  typeAliasesPackage: com.diagbot.entity
+  global-config:
+    #刷新mapper 调试神器
+    db-config:
+      #主键类型  0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
+      id-type: id_worker
+      #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
+      field-strategy: not_empty
+      #驼峰下划线转换
+      column-underline: true
+      #数据库大写下划线转换
+      #capital-mode: true
+      #刷新mapper 调试神器
+      refresh-mapper: true
+      #逻辑删除配置
+      logic-delete-value: 0
+      logic-not-delete-value: 1
+      #自定义填充策略接口实现
+      #meta-object-handler: com.baomidou.springboot.xxx
+      #自定义SQL注入器
+      #sql-injector: com.baomidou.springboot.xxx
+  configuration:
+    map-underscore-to-camel-case: true
+    cache-enabled: false
+
+foo: foo version 1

+ 1 - 0
config-server/src/main/resources/shared/user-service-test.yml

@@ -70,6 +70,7 @@ spring:
       idc: 1 # 不可见ID索引
       sms: 2 # Redis短信索引
       img: 3 # Redis图片验证码索引
+      token: 4 # Token索引
     host: 192.168.2.241  #Redis服务器地址
     port: 6379 # Redis服务器连接端口
     password: lantone # Redis服务器连接密码(默认为空)

+ 14 - 0
diagbotman-service/src/main/java/com/diagbot/client/UserServiceClient.java

@@ -3,6 +3,8 @@ package com.diagbot.client;
 import com.diagbot.client.hystrix.UserServiceHystrix;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.UserOrgDTO;
+import com.diagbot.entity.Token;
+import com.diagbot.entity.User;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -19,11 +21,23 @@ import java.util.Map;
 @FeignClient(value = "user-service", fallback = UserServiceHystrix.class)
 public interface UserServiceClient {
 
+    @PostMapping(value = "/user/getUserAuthStatus")
+    RespDTO<User> getUserAuthStatus(@RequestBody Long userId);
+
+    @PostMapping(value = "/user/getUserAllInfo")
+    RespDTO<List<User>> getUserAllInfo();
+
     @PostMapping(value = "/user/getUserAndOrg")
     RespDTO<Map<Long, UserOrgDTO>> getUserAndOrg(@RequestBody List<Long> userIds);
 
     @PostMapping(value = "/user/getUserByOrgName")
     RespDTO<List<Long>> getUserByOrgName(@RequestBody String orgName);
+    
+    @PostMapping(value = "/userAuthentication/getAuthInfoCount")
+    RespDTO<List<Integer>> getAuthInfoCount(@RequestBody Long userId);
+
+    @PostMapping("/user/verifyToken")
+    RespDTO<Boolean> verifyToken(@RequestBody Token token);
 
 }
 

+ 28 - 0
diagbotman-service/src/main/java/com/diagbot/client/hystrix/UserServiceHystrix.java

@@ -3,8 +3,11 @@ package com.diagbot.client.hystrix;
 import com.diagbot.client.UserServiceClient;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.UserOrgDTO;
+import com.diagbot.entity.Token;
+import com.diagbot.entity.User;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.RequestBody;
 
 import java.util.List;
 import java.util.Map;
@@ -19,6 +22,18 @@ import java.util.Map;
 @Slf4j
 public class UserServiceHystrix implements UserServiceClient {
 
+    @Override
+    public RespDTO<User> getUserAuthStatus(@RequestBody Long userId) {
+        log.error("【hystrix】调用{}异常", "getUserAuthStatus");
+        return null;
+    }
+
+    @Override
+    public RespDTO<List<User>> getUserAllInfo() {
+        log.error("【hystrix】调用{}异常", "getUserAuthStatus");
+        return null;
+    }
+
     @Override
     public RespDTO<Map<Long, UserOrgDTO>> getUserAndOrg(List<Long> userIds) {
         log.error("【hystrix】调用{}异常", "getUserAndOrg");
@@ -30,4 +45,17 @@ public class UserServiceHystrix implements UserServiceClient {
         log.error("【hystrix】调用{}异常", "getUserByOrgName");
         return null;
     }
+
+	@Override
+	public RespDTO<List<Integer>> getAuthInfoCount(Long userId) {
+		log.error("【hystrix】调用{}异常", "getAuthInfoCount");
+		return null;
+	}
+
+    @Override
+    public RespDTO<Boolean> verifyToken(Token token) {
+        log.error("【hystrix】调用{}异常", "verifyToken");
+        return null;
+    }
+
 }

+ 2 - 0
diagbotman-service/src/main/java/com/diagbot/config/ResourceServerConfigurer.java

@@ -29,6 +29,8 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                         , "/service_filter/getAll", "/serviceToken/hasPermission").permitAll()
                 .antMatchers("/getDiagbotManEnumsData").permitAll()
                 .antMatchers("/productOrder/getInformationAvailableAll").permitAll()
+                .antMatchers("/productOrder/getUserWaitingRenewal").permitAll()
+                .antMatchers("/productOrder/getOrderByUserToAudit").permitAll()
                 .antMatchers("/**").authenticated();
         //        .antMatchers("/**").permitAll();
     }

+ 27 - 1
diagbotman-service/src/main/java/com/diagbot/config/security/UrlAccessDecisionManager.java

@@ -1,8 +1,15 @@
 package com.diagbot.config.security;
 
+import com.diagbot.client.UserServiceClient;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.entity.Token;
+import com.diagbot.util.HttpUtils;
+import com.diagbot.util.StringUtil;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.AccessDecisionManager;
 import org.springframework.security.access.AccessDeniedException;
 import org.springframework.security.access.ConfigAttribute;
+import org.springframework.security.authentication.AccountExpiredException;
 import org.springframework.security.authentication.InsufficientAuthenticationException;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.GrantedAuthority;
@@ -21,6 +28,9 @@ import java.util.Collection;
  */
 @Service
 public class UrlAccessDecisionManager implements AccessDecisionManager {
+    @Autowired
+    private UserServiceClient userServiceClient;
+
     @Override
     public void decide(Authentication authentication, Object object, Collection<ConfigAttribute> configAttributes) throws AccessDeniedException, InsufficientAuthenticationException {
         HttpServletRequest request = ((FilterInvocation) object).getHttpRequest();
@@ -31,6 +41,20 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
         if ("anonymousUser".equals(authentication.getPrincipal())) {
             throw new AccessDeniedException("no right");
         } else {
+            //验证token有效性
+            String tokenStr = HttpUtils.getHeaders(request).get("Authorization");
+            if (StringUtil.isNotEmpty(tokenStr)) {
+                Token token = new Token();
+                tokenStr = tokenStr.replaceFirst("Bearer ", "");
+                token.setToken(tokenStr);
+                RespDTO<Boolean> res = userServiceClient.verifyToken(token);
+                if (res == null || !"0".equals(res.code)) {
+                    throw new AccountExpiredException("token expire");
+                }
+                if (!res.data) {
+                    throw new AccountExpiredException("token expire");
+                }
+            }
             for (GrantedAuthority ga : authentication.getAuthorities()) {
                 String[] authority = ga.getAuthority().split(";");
                 url = authority[0];
@@ -56,7 +80,7 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
         return true;
     }
 
-    private Boolean matchPermitAllUrl(HttpServletRequest request){
+    private Boolean matchPermitAllUrl(HttpServletRequest request) {
         if (matchers("/swagger/**", request)
                 || matchers("/v2/**", request)
                 || matchers("/swagger-ui.html/**", request)
@@ -69,6 +93,8 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/service_filter/getAll", request)
                 || matchers("/serviceToken/hasPermission", request)
                 || matchers("/productOrder/getInformationAvailableAll", request)
+                || matchers("/productOrder/getUserWaitingRenewal", request)
+                || matchers("/productOrder/getOrderByUserToAudit", request)
                 || matchers("/", request)) {
             return true;
         }

+ 10 - 0
diagbotman-service/src/main/java/com/diagbot/dto/EnShowOptionDTO.java

@@ -14,6 +14,16 @@ public class EnShowOptionDTO implements Serializable {
      */
     private static final long serialVersionUID = 1L;
     
+    /**
+     * 认证中数量
+     */
+    private Integer authIngCount;
+    
+    /**
+     * 认证被拒原因个数
+     */
+    private Integer authRejectCount;
+    
     /**
      * 订单数量
      */

+ 35 - 0
diagbotman-service/src/main/java/com/diagbot/dto/GetConsoleOpenedDTO.java

@@ -65,4 +65,39 @@ public class GetConsoleOpenedDTO implements Serializable {
      */
     private Integer renewalsStutas;
     
+    /**
+     *  0-过期,1-未过期
+     */
+    private Integer isExpire;
+    
+    /**
+     * 产品地址
+     */
+    private String url;
+    
+    /**
+     * 
+     */
+    private String appKeyId;
+    
+    /**
+     * 
+     */
+    private String appKeySecret;
+    
+    /**
+     * 是否可以进入
+     */
+    private Integer isInto;
+    
+    /**
+     * 是否显示生成token
+     */
+    private Integer isCreateToken;
+    
+    /**
+     * 是否可以开始使用
+     */
+    private Integer isBegin;
+    
 }

+ 22 - 0
diagbotman-service/src/main/java/com/diagbot/dto/HasPermissionDTO.java

@@ -0,0 +1,22 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+
+/**
+ * @Description: 是否有权限返回类
+ * @Author: ztg
+ * @Date: 2018/9/20 10:32
+ */
+
+@Getter
+@Setter
+public class HasPermissionDTO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private Boolean hasPermission ;//标志
+    private String userId;         //用户ID
+}

+ 10 - 0
diagbotman-service/src/main/java/com/diagbot/dto/LantoneProductDTO.java

@@ -44,6 +44,11 @@ public class LantoneProductDTO {
      */
     private String chargeType;
 
+    /**
+     * 接入方式名称
+     */
+    private String chargeTypeName;
+
     /**
      * 产品路径
      */
@@ -74,6 +79,11 @@ public class LantoneProductDTO {
      */
     private String accessType;
 
+    /**
+     * 接入方式名称
+     */
+    private String accessTypeName;
+
     /**
      * 已开通数量
      */

+ 15 - 0
diagbotman-service/src/main/java/com/diagbot/dto/LantoneProductOrgDTO.java

@@ -54,4 +54,19 @@ public class LantoneProductOrgDTO extends LantoneProduct {
      * 关联的service
      */
     private List<ServiceInfo> serviceInfos;
+
+    /**
+     * 仅线上模式
+     */
+    private Boolean onlyOnline;
+
+    /**
+     * 已过期
+     */
+    private Boolean isExpired;
+
+    /**
+     * 未到开通时间
+     */
+    private Boolean unStarted;
 }

+ 17 - 1
diagbotman-service/src/main/java/com/diagbot/dto/OpenUpOnTrialDTO.java

@@ -17,6 +17,22 @@ public class OpenUpOnTrialDTO implements Serializable {
     private static final long serialVersionUID = 1L;
 
 
-    private ServiceToken serviceToken;
+//    private ServiceToken serviceToken;
+    
+    
+    /**
+     * 试用地址
+     */
+    private String trialUrl;
+
+    /**
+     * 
+     */
+    private String appKeyId;
+    
+    /**
+     * 
+     */
+    private String appKeySecret;
 
 }

+ 15 - 5
diagbotman-service/src/main/java/com/diagbot/dto/ProductAuthProgressDTO.java

@@ -20,14 +20,24 @@ public class ProductAuthProgressDTO implements Serializable {
      */
     private static final long serialVersionUID = 1L;
 
+//    /**
+//     * 订单编号
+//     */
+//    private String num;
+//
+//    /**
+//     * 订单详情
+//     */
+//    private List<AuthDetailDTO> products;
+    
     /**
-     * 订单编号
+     * 待审核和审核通过的订单明细
      */
-    private String num;
-
+    private List<AuthDetailDTO> passProduct;
+    
     /**
-     * 订单详情
+     * 审核不通过的订单明细
      */
-    private List<AuthDetailDTO> products;
+    private List<AuthDetailDTO> failProduct;
 
 }

+ 5 - 0
diagbotman-service/src/main/java/com/diagbot/dto/ProductLineDTO.java

@@ -43,6 +43,11 @@ public class ProductLineDTO {
      */
     private Integer productAudit;
 
+    /**
+     * 停用状态
+     */
+    private Integer serviceStatus;
+
     /**
      * list格式返回给前台
      * @return

+ 2 - 2
diagbotman-service/src/main/java/com/diagbot/dto/ProductOrderExportDTO.java

@@ -17,7 +17,7 @@ public class ProductOrderExportDTO {
     private String time;
     private String num;
     private String orgName;
-    private String linKman;
+    private String linkman;
     private String userName;
     private String email;
     private String auditStatus;
@@ -33,7 +33,7 @@ public class ProductOrderExportDTO {
         this.time = time;
         this.num = num;
         this.orgName = orgName;
-        this.linKman = linKman;
+        this.linkman = linKman;
         this.userName = userName;
         this.email = email;
         this.auditStatus = auditStatus;

+ 4 - 0
diagbotman-service/src/main/java/com/diagbot/dto/RenewalsInfosDTO.java

@@ -68,4 +68,8 @@ public class RenewalsInfosDTO {
      */
     private String renewalsNo;
 
+    /**
+     * 到期时间
+     */
+    private Date endTime;
 }

+ 33 - 2
diagbotman-service/src/main/java/com/diagbot/dto/UserAndProdutDTO.java

@@ -1,6 +1,11 @@
 package com.diagbot.dto;
 
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.List;
+
+import com.diagbot.enums.AccessTypeEnum;
+import com.diagbot.enums.ChargeTypeEnum;
 
 import lombok.Getter;
 import lombok.Setter;
@@ -21,8 +26,34 @@ public class UserAndProdutDTO {
     private Date startTime;//开通时间
     private Date endTime;//结束时间
     private Integer serviceStatus;//启用状态
-    private Integer accessType;//接入方式
-    private Integer chargeType;//结算方式
+    private String accessType;//接入方式
+    private String chargeType;//结算方式
     private String productName;//产品名称
 
+    /**
+     * list格式返回给前台
+     * @return
+     */
+    public String[] getAccessType() {
+        String[] strs =accessType.split(",");
+        List<String> list =new ArrayList();
+        for (int i =0;i<strs.length;i++){
+            list.add(AccessTypeEnum.getName(Integer.valueOf(strs[i])));
+        }
+        String[] strs1 =new String[list.size()];
+        return list.toArray(strs1);
+    }
+    /**
+     * list格式返回给前台
+     * @return
+     */
+    public String[] getChargeType() {
+        String[] strs =chargeType.split(",");
+        List<String> list =new ArrayList();
+        for (int i =0;i<strs.length;i++){
+            list.add(ChargeTypeEnum.getName(Integer.valueOf(strs[i])));
+        }
+        String[] strs1 =new String[list.size()];
+        return list.toArray(strs1);
+    }
 }

+ 95 - 0
diagbotman-service/src/main/java/com/diagbot/entity/ServiceTokenWithUser.java

@@ -0,0 +1,95 @@
+package com.diagbot.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 服务令牌表 (包含用户id)
+ * </p>
+ *
+ * @author zhaops
+ * @since 2018-09-18
+ */
+@Getter
+@Setter
+public class ServiceTokenWithUser implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private Long id;
+
+    /**
+     * 是否删除 N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 产品服务关联id
+     */
+    private Long productServiceId;
+
+    /**
+     * 服务调用id
+     */
+    private String appKeyId;
+
+    /**
+     * 服务调用密码
+     */
+    private String appKeySecret;
+
+    /**
+     * 令牌类型(1:online,2:手动,3:试用)
+     */
+    private Integer type;
+
+    /**
+     * 状态(0:禁用,1:启用)
+     */
+    private Integer status;
+
+    /**
+     * 开通日期
+     */
+    private Date startingDate;
+
+    /**
+     * 到期时间
+     */
+    private Date expiringDate;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+
+    /**
+     * 用户id
+     */
+    private Long userId;
+}

+ 21 - 0
diagbotman-service/src/main/java/com/diagbot/entity/Token.java

@@ -0,0 +1,21 @@
+package com.diagbot.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+
+/**
+ * @Description: token
+ * @Author: ztg
+ * @Date: 2018/9/19 13:14
+ */
+@Getter
+@Setter
+public class Token implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private String token;
+
+}

+ 13 - 0
diagbotman-service/src/main/java/com/diagbot/entity/User.java

@@ -61,6 +61,18 @@ public class User implements Serializable {
      */
     private String username;
 
+    /**
+     * 认证状态: 0 未认证,1 已认证,2 认证中
+     */
+    private Integer authStatus;
+
+    public Integer getAuthStatus() {
+        return authStatus;
+    }
+
+    public void setAuthStatus(Integer authStatus) {
+        this.authStatus = authStatus;
+    }
 
     public Long getId() {
         return id;
@@ -137,6 +149,7 @@ public class User implements Serializable {
                 ", modifier=" + modifier +
                 ", password=" + password +
                 ", username=" + username +
+                ", authStatus="+ authStatus +
                 "}";
     }
 }

+ 13 - 0
diagbotman-service/src/main/java/com/diagbot/entity/UserRenewals.java

@@ -89,6 +89,19 @@ public class UserRenewals implements Serializable {
      */
     private Integer cancelRenewals;
 
+    /**
+     * 结束时间
+     */
+    private Date endTime;
+
+    public Date getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(Date endTime) {
+        this.endTime = endTime;
+    }
+
     public Integer getCancelRenewals() {
         return cancelRenewals;
     }

+ 15 - 8
diagbotman-service/src/main/java/com/diagbot/entity/wrapper/OrderDetailsWapper.java

@@ -1,6 +1,5 @@
 package com.diagbot.entity.wrapper;
 
-import com.diagbot.util.DateUtil;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -34,11 +33,21 @@ public class OrderDetailsWapper {
      */
     private Integer status;
 
+    /**
+     * 付费状态名称
+     */
+    private String payStatusName;
+
     /**
      * 不通过类型
      */
     private Integer rejectType;
 
+    /**
+     * 不通过类型说明
+     */
+    private String rejectTypeName;
+
     /**
      * 不通过原因
      */
@@ -49,6 +58,11 @@ public class OrderDetailsWapper {
      */
     private String productName;
 
+    /**
+     * 产品id
+     */
+    private Long productId;
+
     /**
      * 订单编号
      */
@@ -66,11 +80,4 @@ public class OrderDetailsWapper {
 
     private String orgName;//机构名称
 
-    public String getStartTime() {
-        return DateUtil.formatDate(startTime);
-    }
-
-    public String getEndTime() {
-        return DateUtil.formatDate(endTime);
-    }
 }

+ 3 - 2
diagbotman-service/src/main/java/com/diagbot/entity/wrapper/ServiceTokenWrapper.java

@@ -13,9 +13,10 @@ import lombok.Setter;
 @Setter
 public class ServiceTokenWrapper extends ServiceToken {
     private String url;
-
+    private Long productId;
     private String productName;
-
     private String serviceName;
+    private Long userId;
+    private Integer serviceStatus;
 
 }

+ 6 - 0
diagbotman-service/src/main/java/com/diagbot/entity/wrapper/UserRenewalsWrapper.java

@@ -51,4 +51,10 @@ public class UserRenewalsWrapper {
      * 是否取消续费
      */
     private Integer cancelRenewals;
+
+    /**
+     * 产品id
+     */
+    private Long productId;
+
 }

+ 3 - 4
diagbotman-service/src/main/java/com/diagbot/enums/NotPassEnum.java

@@ -9,10 +9,9 @@ import lombok.Setter;
  * @time: 11:06 2018/9/27
  */
 public enum NotPassEnum implements KeyedNamed {
-    ImperfectInformation(1, "账号信息不完善"),
-    AgencyError(2, "机构有误"),
-    CancellationOfOrder(3,"取消订单"),
-    NotChoose(0,"未选择");
+    ImperfectInformation(1, "产品即将升级"),
+    AgencyError(2, "付款异常"),
+    CancellationOfOrder(3,"取消购买");
 
     @Setter
     private Integer key;

+ 2 - 2
diagbotman-service/src/main/java/com/diagbot/enums/PaymentMethodEnum.java

@@ -9,8 +9,8 @@ import lombok.Setter;
  * @time: 11:06 2018/9/27
  */
 public enum PaymentMethodEnum implements KeyedNamed {
-    PAY(1,"已付"),
-    NOT_PAY(0, "未付");
+    PAY(1,"已付"),
+    NOT_PAY(0, "未付");
 
     @Setter
     private Integer key;

+ 1 - 1
diagbotman-service/src/main/java/com/diagbot/enums/StatusEnum.java

@@ -9,7 +9,7 @@ import lombok.Setter;
  * @time: 2018/9/19 10:05
  */
 public enum StatusEnum implements KeyedNamed {
-    Disable(0, "用"),
+    Disable(0, "用"),
     Enable(1, "启用");
 
     @Setter

+ 122 - 21
diagbotman-service/src/main/java/com/diagbot/facade/LantoneProductFacade.java

@@ -8,17 +8,26 @@ import com.diagbot.dto.LantoneProductDTO;
 import com.diagbot.dto.LantoneProductOrgDTO;
 import com.diagbot.dto.OpendProductDTO;
 import com.diagbot.dto.ProductLineDTO;
+import com.diagbot.dto.RenewalsInfosDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.UserOrgDTO;
 import com.diagbot.entity.LantoneProduct;
 import com.diagbot.entity.OpenedProducts;
 import com.diagbot.entity.OpenedProductsIndex;
+import com.diagbot.entity.OrderDetailsIndex;
 import com.diagbot.entity.ServiceInfo;
+import com.diagbot.entity.User;
+import com.diagbot.entity.UserRenewals;
 import com.diagbot.entity.wrapper.OpendProductWrapper;
 import com.diagbot.entity.wrapper.ServiceInfoWrapper;
+import com.diagbot.entity.wrapper.UserRenewalsWrapper;
 import com.diagbot.enums.AccessTypeEnum;
+import com.diagbot.enums.AuditStatusEnum;
+import com.diagbot.enums.CancelRenewalsEnum;
+import com.diagbot.enums.ChargeTypeEnum;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.enums.ProductAuditEnum;
+import com.diagbot.enums.RenewalsEnum;
 import com.diagbot.enums.ServiceTypeEnum;
 import com.diagbot.enums.StatusEnum;
 import com.diagbot.enums.TrialStatusEnum;
@@ -38,6 +47,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -57,6 +67,10 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
     private OrderDetailsFacade orderDetailsFacade;
     @Autowired
     private ServiceInfoFacade serviceInfoFacade;
+    @Autowired
+    private UserRenewalsFacade userRenewalsFacade;
+    @Autowired
+    private ProductServiceFacade productServiceFacade;
 
     /**
      * 产品线管理添加产品
@@ -65,7 +79,8 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
      * @return Boolean true
      */
     public Boolean addProducts(AddProductsVO addProductsVO) {
-        if(addProductsVO.getName().equals(this.selectProductByName(addProductsVO.getName()).getName())){
+        LantoneProduct lantoneProductInfos = this.selectProductByName(addProductsVO.getName());
+        if(lantoneProductInfos != null && addProductsVO.getName().equals(lantoneProductInfos.getName())){
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
                     "产品名称重复");
         }
@@ -74,7 +89,7 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
         lantoneProduct.setGmtCreate(DateUtil.now());
         lantoneProduct.setCreator(UserUtils.getCurrentPrincipleID());
         if (!save(lantoneProduct)) {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+            throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL,
                     "产品添加失败");
         }
         return true;
@@ -88,15 +103,20 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
      * @return Boolean true
      */
     public Boolean updateProduct(UpdateProductVO updateProductVO) {
-        if(updateProductVO.getName().equals(this.selectProductByName(updateProductVO.getName()).getName())){
+        LantoneProduct lantoneProductInfo = this.selectProductByName(updateProductVO.getName());
+        if(null != lantoneProductInfo && updateProductVO.getName().equals(lantoneProductInfo.getName()) && updateProductVO.getId() != lantoneProductInfo.getId()){
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
                     "产品名称重复");
         }
         LantoneProduct lantoneProduct = this.getById(updateProductVO.getId());
+        if(lantoneProduct.getIsDeleted().equals(IsDeleteEnum.Y.getKey())){
+            throw new CommonException(CommonErrorCode.NOT_EXISTS,
+                    "该产品已删除");
+        }
         BeanUtil.copyProperties(updateProductVO, lantoneProduct);
         lantoneProduct.setModifier(UserUtils.getCurrentPrincipleID());
         lantoneProduct.setGmtModified(DateUtil.now());
-        if(updateProductVO.getServiceStatus()==StatusEnum.Disable.getKey()){
+        if(null != updateProductVO.getServiceStatus() && updateProductVO.getServiceStatus()==StatusEnum.Disable.getKey()){
             Page page =new Page();
             OpenedProductsIndex openedProductsIndex =new OpenedProductsIndex();
             openedProductsIndex.setProductId(updateProductVO.getId());
@@ -107,7 +127,7 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
             }
         }
         if (!updateById(lantoneProduct)) {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+            throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL,
                     "产品修改失败");
         }
         return true;
@@ -121,21 +141,51 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
      */
     public Boolean stopProduct(UpdateProductVO updateProductVO) {
         LantoneProduct lantoneProduct = this.getById(updateProductVO.getId());
+        if(lantoneProduct.getIsDeleted().equals(IsDeleteEnum.Y.getKey())){
+            throw new CommonException(CommonErrorCode.NOT_EXISTS,
+                    "该产品已删除");
+        }
+        if(updateProductVO.getServiceStatus() == lantoneProduct.getServiceStatus() && updateProductVO.getServiceStatus() == StatusEnum.Enable.getKey()){
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                    "该产品已启用,启用失败");
+        }
+        if(updateProductVO.getServiceStatus() == lantoneProduct.getServiceStatus() && updateProductVO.getServiceStatus() == StatusEnum.Disable.getKey()){
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                    "该产品已停用,停用失败");
+        }
         BeanUtil.copyProperties(updateProductVO, lantoneProduct);
         lantoneProduct.setModifier(UserUtils.getCurrentPrincipleID());
         lantoneProduct.setGmtModified(DateUtil.now());
-        if(updateProductVO.getServiceStatus()==StatusEnum.Disable.getKey()){
+        if(updateProductVO.getServiceStatus().intValue() == StatusEnum.Disable.getKey()){
             Page page =new Page();
             OpenedProductsIndex openedProductsIndex =new OpenedProductsIndex();
             openedProductsIndex.setProductId(updateProductVO.getId());
             openedProductsIndex.setServiceStatus(StatusEnum.Enable.getKey());
-            if(openedProductsFacade.getByProductId(page,openedProductsIndex).getRecords().size()>0){
+            if(openedProductsFacade.getByProductId(page,openedProductsIndex).getRecords().size() > 0){
                 throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
                         "用户正在使用中,停用失败");
             }
+            OrderDetailsIndex orderDetailsIndex =new OrderDetailsIndex();
+            orderDetailsIndex.setProductId(updateProductVO.getId());
+            orderDetailsIndex.setAuditStatus(AuditStatusEnum.NotAudit.getKey());
+            if(orderDetailsFacade.seleAllOrderDetials(orderDetailsIndex).size() > 0){
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                        "该产品无法停用,请先处理申请信息");
+            }
+            UserRenewalsWrapper renewalsInfosDTO =new UserRenewalsWrapper();
+            renewalsInfosDTO.setProductId(updateProductVO.getId());
+            renewalsInfosDTO.setRenewalsStatus(RenewalsEnum.NOT_RENEWALS.getKey());
+            List<RenewalsInfosDTO> list =  userRenewalsFacade.selectUserRenewals(page,renewalsInfosDTO).getRecords();
+            UserRenewals userRenewals = new UserRenewals();
+            userRenewals.setRenewalsStatus(RenewalsEnum.NOT_RENEWALS.getKey());
+            userRenewals.setCancelRenewals(CancelRenewalsEnum.NOT_CANCEL.getKey());
+            if(list.contains(userRenewals)){
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                        "该产品无法停用,请先处理续费申请信息");
+            }
         }
         if (!updateById(lantoneProduct)) {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+            throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL,
                     "产品修改失败");
         }
         return true;
@@ -148,7 +198,11 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
      * @return Boolean true
      */
     public Boolean deleteProduct(UpdateProductVO updateProductVO) {
-        LantoneProduct lantoneProduct = getById(updateProductVO.getId());
+        LantoneProduct lantoneProduct = this.getById(updateProductVO.getId());
+        if(lantoneProduct.getIsDeleted().equals(IsDeleteEnum.Y.getKey())){
+            throw new CommonException(CommonErrorCode.NOT_EXISTS,
+                    "该产品已删除");
+        }
         if(lantoneProduct.getServiceStatus()==StatusEnum.Enable.getKey()){
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
                     "当前产品正在使用中不可删除");
@@ -164,9 +218,13 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
         lantoneProduct.setGmtModified(DateUtil.now());
         lantoneProduct.setIsDeleted(IsDeleteEnum.Y.getKey());
         if (!updateById(lantoneProduct)) {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+            throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL,
                     "产品删除失败");
         }
+        if(!productServiceFacade.deleteByProductId(updateProductVO.getId())){
+                throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL,
+                        "产品令牌删除失败");
+        }
         return true;
     }
 
@@ -182,7 +240,7 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
         userIdList.add(userId);
         RespDTO<Map<Long, UserOrgDTO>> mapRespDTO = userServiceClient.getUserAndOrg(userIdList);
         if (mapRespDTO == null || !"0".equals(mapRespDTO.code)) {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+            throw new CommonException(CommonErrorCode.RPC_ERROR,
                     "获取用户机构信息失败");
         }
 
@@ -202,6 +260,18 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
             String[] accessTypeArray = new String[accessType.length];
             String[] chargeTypeArray = new String[chargeType.length];
 
+            // 仅线上模式
+            if (accessType.length == 1 && Integer.valueOf(accessType[0]).equals(AccessTypeEnum.Online.getKey())) {
+                product.setOnlyOnline(true);
+            }
+
+            // 产品是否在有效期内 该产品未在有效服务期内,无法使用
+            if (product.getEndTime().before(new Date())) {
+                product.setIsExpired(true);
+            } else if (product.getStartTime().after(new Date())) {
+                product.setUnStarted(true);
+            }
+
             for (int i = 0; i < accessType.length; i++) {
                 accessTypeArray[i] = AccessTypeEnum.getName(Integer.parseInt(accessType[i]));
             }
@@ -250,19 +320,13 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
                 productLineDTO.setProductAudit(ProductAuditEnum.NotOpend.getKey());
             }
         }
-        RespDTO<Map<Long, UserOrgDTO>> mapRespDTO = userServiceClient.getUserAndOrg(userIdList);
+        RespDTO<User> mapRespDTO = userServiceClient.getUserAuthStatus(userId);
         if (mapRespDTO == null || !"0".equals(mapRespDTO.code)) {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+            throw new CommonException(CommonErrorCode.RPC_ERROR,
                     "获取用户机构信息失败");
         }
-        Map<Long, UserOrgDTO> dataMap =mapRespDTO.data;
-        UserOrgDTO uo =dataMap.get(userId);
         Map map =new HashMap();
-        if(uo.getAuStatus() == null){
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
-                    "账号信息不完善");
-        }
-        map.put("userAuStatus",uo.getAuStatus());
+        map.put("userAuStatus",mapRespDTO.data.getAuthStatus());
         List list =new ArrayList();
         list.add(productLineDTOList);
         list.add(map);
@@ -276,13 +340,34 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
      * @return 当条产品线下所有订单信息
      */
     public IPage<OpendProductDTO> opendedProduct(OppendedProductVO oppendedProductVO) {
+        LantoneProduct lantoneProduct = new LantoneProduct();
+        lantoneProduct.setId(oppendedProductVO.getProductId());
+        LantoneProduct lantoneProducts = this.getById(lantoneProduct.getId());
+        if(lantoneProducts.getIsDeleted().equals(IsDeleteEnum.Y.getKey())){
+            throw new CommonException(CommonErrorCode.NOT_EXISTS,
+                    "该产品已删除");
+        }
         Page page =new Page();
         BeanUtil.copyProperties(oppendedProductVO,page);
         OpenedProductsIndex openedProductsIndex = new OpenedProductsIndex();
         BeanUtil.copyProperties(oppendedProductVO, openedProductsIndex);
         if(oppendedProductVO.getOrgName()!=null&&oppendedProductVO.getOrgName()!=""){
             RespDTO<List<Long>> rlist = userServiceClient.getUserByOrgName(oppendedProductVO.getOrgName());
+            if(rlist.data.size() == 0){
+                rlist.data.add(-1L);
+            }
             openedProductsIndex.setUserId(rlist.data);
+        }else{
+            RespDTO<List<User>> userInfiList = userServiceClient.getUserAllInfo();
+            if(userInfiList == null || !"0".equals(userInfiList.code) ) {
+                throw new CommonException(CommonErrorCode.RPC_ERROR,
+                        "获取用户和机构信息失败");
+            }
+            List<Long> userIds =new ArrayList<>();
+            for (User user:userInfiList.data) {
+                userIds.add(user.getId());
+            }
+            openedProductsIndex.setUserId(userIds);
         }
         List<OpendProductDTO> list = openedProductsFacade.getByProductId(page,openedProductsIndex).getRecords();
         List<Long> list1 = new ArrayList<>();
@@ -292,7 +377,7 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
         }
         RespDTO<Map<Long, UserOrgDTO>> mapRespDTO = userServiceClient.getUserAndOrg(list1);
         if (mapRespDTO == null || !"0".equals(mapRespDTO.code)) {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+            throw new CommonException(CommonErrorCode.RPC_ERROR,
                     "获取用户和机构信息失败");
         }
         Map<Long, UserOrgDTO> dataMap = mapRespDTO.data;
@@ -315,8 +400,24 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
         Page page =new Page();
         BeanUtil.copyProperties(lantoneProductSelectVO,page);
         IPage<LantoneProductDTO> res = this.selectProduct(page, lantoneProductSelectVO.getName());
+        String charName = null;
+        String acssName = null;
         for (LantoneProductDTO lantoneProductDTO:res.getRecords()) {
+            String charNamebc =new String();
+            String acssNamebc =new String();
+            charName =lantoneProductDTO.getChargeType();
+            acssName =lantoneProductDTO.getAccessType();
             lantoneProductDTO.setTrialStatusName(TrialStatusEnum.getName(lantoneProductDTO.getTrialStatus()));
+            String[] strs =charName.split(",");
+            for (int i = 0; i<strs.length;i++){
+                charNamebc  += ChargeTypeEnum.getName(Integer.parseInt(strs[i]))+",";
+            }
+            String[] strs1 = acssName.split(",");
+            for (int j = 0; j<strs1.length;j++){
+                acssNamebc += AccessTypeEnum.getName(Integer.parseInt(strs1[j]))+",";
+            }
+            lantoneProductDTO.setChargeTypeName(charNamebc);
+            lantoneProductDTO.setAccessTypeName(acssNamebc);
         }
         return RespDTO.onSuc(res);
     }

+ 97 - 17
diagbotman-service/src/main/java/com/diagbot/facade/OpenedProductsFacade.java

@@ -1,5 +1,14 @@
 package com.diagbot.facade;
 
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.diagbot.client.UserServiceClient;
 import com.diagbot.dto.EnShowOptionDTO;
 import com.diagbot.dto.GetConsoleOnTrialDTO;
 import com.diagbot.dto.GetConsoleOpenedDTO;
@@ -10,6 +19,8 @@ import com.diagbot.entity.LantoneProduct;
 import com.diagbot.entity.OpenedProducts;
 import com.diagbot.entity.ProductService;
 import com.diagbot.entity.ServiceInfo;
+import com.diagbot.entity.ServiceToken;
+import com.diagbot.entity.User;
 import com.diagbot.entity.UserRenewals;
 import com.diagbot.enums.AccessTypeEnum;
 import com.diagbot.enums.IsDeleteEnum;
@@ -27,13 +38,6 @@ import com.diagbot.vo.ModifyOpeningTimeVO;
 import com.diagbot.vo.OpenUpOnTrialVO;
 import com.diagbot.vo.ProductServiceSaveVO;
 import com.diagbot.vo.StartAndendByUserIdVO;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
 
 /**
  * @Description:已开通产品业务层
@@ -54,6 +58,10 @@ public class OpenedProductsFacade extends OpenedProductsServiceImpl {
     private OpenedProductsFacade openedProductsFacade;
     @Autowired
     private ProductOrderFacade productOrderFacade;
+    @Autowired
+    private UserServiceClient userServiceClient;
+    @Autowired
+    private ServiceTokenFacade serviceTokenFacade;
 
     public List<OpenedProducts> getByAppkeyAndSecretFac(Map map) {
         return this.getByAppkeyAndSecret(map);
@@ -65,7 +73,7 @@ public class OpenedProductsFacade extends OpenedProductsServiceImpl {
      * @return 所有已经开通的产品
      */
     public List<GetConsoleOpenedDTO> getConsoleOpened() {
-        Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
+    	Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
         
         List<GetConsoleOpenedDTO> retList = baseMapper.getConsoleOpened(userId);
         for(GetConsoleOpenedDTO i : retList){
@@ -75,6 +83,18 @@ public class OpenedProductsFacade extends OpenedProductsServiceImpl {
         	}
         	i.setAccessTypeMsg(accessTypeMsg);
         	i.setServiceStatusMsg(StatusEnum.getName(i.getServiceStatus()));
+        	
+        	if(i.getAccessType().indexOf("1")!=-1){
+        		i.setIsInto(1);
+        	}else{
+        		i.setIsInto(0);
+        		i.setUrl("");
+        	}
+        	if(i.getAccessType().replace("1", "").replace(",", "").length()>0){
+        		i.setIsCreateToken(1);
+        	}else{
+        		i.setIsCreateToken(0);
+        	}
         }
         
         return retList;
@@ -126,13 +146,34 @@ public class OpenedProductsFacade extends OpenedProductsServiceImpl {
      * @return 包含token
      */
     public OpenUpOnTrialDTO openUpOnTrial(OpenUpOnTrialVO openUpOnTrialVO) {
+    	OpenUpOnTrialDTO openUpOnTrialDTO = new OpenUpOnTrialDTO();
+    	
         LantoneProduct lantoneProduct =new LantoneProduct();
         lantoneProduct.setId(openUpOnTrialVO.getProductId());
         LantoneProduct lantoneProducts = lantoneProductFacade.getById(lantoneProduct);
         if (null == lantoneProducts || IsDeleteEnum.Y.getKey().equals(lantoneProducts.getIsDeleted())){
             throw new CommonException(CommonErrorCode.NOT_EXISTS, "该产品已删除");
         }
+        if(StatusEnum.Disable.getKey()==lantoneProducts.getServiceStatus()){
+        	throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "该产品已停用");
+        }
+        openUpOnTrialDTO.setTrialUrl(lantoneProducts.getTrialUrl());
         Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
+        //验证用户是否生成过试用
+        Map<String, Object> paramMap = new HashMap<>();
+        paramMap.put("userId", userId.toString());
+        paramMap.put("productId", openUpOnTrialVO.getProductId());
+        ServiceToken serviceToken = serviceTokenFacade.getTryTokenByUserIdAndProductId(paramMap);
+        if (serviceToken!=null){
+        	Date now = new Date();
+            if(serviceToken.getExpiringDate().getTime()<now.getTime()){
+            	throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "该产品已过期");
+            }
+            openUpOnTrialDTO.setAppKeyId(serviceToken.getAppKeyId());
+            openUpOnTrialDTO.setAppKeySecret(serviceToken.getAppKeySecret());
+            return openUpOnTrialDTO;
+        }
+        
         Date now = new Date();
         ServiceInfo serviceInfo = new ServiceInfo();
         serviceInfo.setType(ServiceTypeEnum.Sys_Create.getKey());
@@ -158,8 +199,8 @@ public class OpenedProductsFacade extends OpenedProductsServiceImpl {
         productServiceSaveVO.setType(TokenTypeEnum.Trial.getKey());
         ProductServiceDTO poroductServiceDTO = productServiceFacade.genProductService(productServiceSaveVO);
 
-        OpenUpOnTrialDTO openUpOnTrialDTO = new OpenUpOnTrialDTO();
-        openUpOnTrialDTO.setServiceToken(poroductServiceDTO.getServiceToken());
+        openUpOnTrialDTO.setAppKeyId(poroductServiceDTO.getServiceToken().getAppKeyId());
+        openUpOnTrialDTO.setAppKeySecret(poroductServiceDTO.getServiceToken().getAppKeySecret());
 
         return openUpOnTrialDTO;
     }
@@ -179,6 +220,10 @@ public class OpenedProductsFacade extends OpenedProductsServiceImpl {
         enShowOptionDTO.setOrderAuthFailCount(productOrderFacade.getOrderAuthFailCount(userId));
         enShowOptionDTO.setOpenedCount(openedCount);
         enShowOptionDTO.setOnTrialCount(onTrialCount);
+        
+        List<Integer> list = userServiceClient.getAuthInfoCount(userId).data;
+        enShowOptionDTO.setAuthIngCount(list.get(0));
+        enShowOptionDTO.setAuthRejectCount(list.get(1));
 
         return enShowOptionDTO;
     }
@@ -194,6 +239,40 @@ public class OpenedProductsFacade extends OpenedProductsServiceImpl {
         openedProducts.setCreator(UserUtils.getCurrentPrincipleID());
         openedProducts.setGmtCreate(DateUtil.now());
         openedProducts.setServiceStatus(startAndendByUserIdVO.getServiceStatus());
+         RespDTO<User> userData = userServiceClient.getUserAuthStatus(startAndendByUserIdVO.getUserId());
+         User user = userData.data;
+         if(user.getIsDeleted().equals("Y")){
+           	 return RespDTO.onError("该用户已不存在"); 
+            }
+         //当用户是操作是启用的时候,先判断该产品是否是启用状态
+		if (startAndendByUserIdVO.getServiceStatus().equals(StatusEnum.Enable.getKey())) {
+			LantoneProduct lantoneProduct = new LantoneProduct();
+			lantoneProduct.setId(startAndendByUserIdVO.getProductId());
+			LantoneProduct lantone = lantoneProductFacade.getById(lantoneProduct);
+			if (lantone.getServiceStatus().equals(StatusEnum.Disable.getKey())) {
+				return RespDTO.onError("该产品线已停用");
+			}
+		}
+		//判断该用户是否有续费申请单
+     	UserRenewals userRenewals = new UserRenewals();
+     	userRenewals.setUserId(startAndendByUserIdVO.getUserId());
+     	userRenewals.setProductId(startAndendByUserIdVO.getProductId());
+     	int userSum = userRenewalsFacade.getUserWaitingRenewal(userRenewals);
+     	if(userSum>0){
+      		 return RespDTO.onError("该产品无法停用,请先处理续费申请信息");
+         	}
+     	//验证是否有别的管理员操作过
+     	Map<String, Object> map = new HashMap<String, Object>();
+        map.put("userId", startAndendByUserIdVO.getUserId());
+        map.put("productId", startAndendByUserIdVO.getProductId());
+        List<OpenedProducts> OpenedProductsData = selectOpenedProducts(map);
+        if(OpenedProductsData != null){
+        	for(OpenedProducts openedProductsNew : OpenedProductsData){
+        		if(openedProductsNew.getServiceStatus().equals(startAndendByUserIdVO.getServiceStatus())){
+        			return RespDTO.onError("该产品已被"+StatusEnum.getName(startAndendByUserIdVO.getServiceStatus())+"无需处理");	
+        		}
+        	}	
+        }
         boolean res = startAndendByuserId(openedProducts);
         if (!res) {
             throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL);
@@ -210,8 +289,8 @@ public class OpenedProductsFacade extends OpenedProductsServiceImpl {
         OpenedProducts openedProducts = new OpenedProducts();
         openedProducts.setUserId(userId);
         openedProducts.setProductId(productId);
-        openedProducts.setCreator(UserUtils.getCurrentPrincipleID());
-        openedProducts.setGmtCreate(DateUtil.now());
+        openedProducts.setModifier(UserUtils.getCurrentPrincipleID());
+        openedProducts.setGmtModified(DateUtil.now());
         boolean res = delInformationAvailable(openedProducts);
         if (!res) {
             throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL);
@@ -233,20 +312,21 @@ public class OpenedProductsFacade extends OpenedProductsServiceImpl {
         List<OpenedProducts> opendList = openedProductsFacade.selectOpenedProducts(map);
         List<Long> renewalsList = userRenewalsFacade.selectProductIdByUserId(map);
         if(!renewalsList.contains(modifyOpeningTimeVO.getProductId())){
-            throw new CommonException(CommonErrorCode.NOT_EXISTS, "续费单单不存在,请刷新重试");
+            throw new CommonException(CommonErrorCode.NOT_EXISTS, "续费单已审核,请刷新重试");
         }
         for (OpenedProducts openedProducts1 :opendList) {
             if(beforeTime(openedProducts1.getEndTime(),modifyOpeningTimeVO.getEndTime())){
-                throw new CommonException(CommonErrorCode.NOT_EXISTS, "输入有误,续费时间需大于到期时间");
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "输入有误,续费时间需大于到期时间");
             }
         }
-        openedProducts.setEndTime(DateUtil.parseDate(modifyOpeningTimeVO.getEndTime()));
-        openedProducts.setCreator(UserUtils.getCurrentPrincipleID());
-        openedProducts.setGmtCreate(DateUtil.now());
+        openedProducts.setEndTime(DateUtil.parseDateTime(DateUtil.formatDateTime(DateUtil.getLastTimeOfDay(DateUtil.parseDate(modifyOpeningTimeVO.getEndTime())))));
+        openedProducts.setModifier(UserUtils.getCurrentPrincipleID());
+        openedProducts.setGmtModified(DateUtil.now());
         UserRenewals userRenewals = new UserRenewals();
         userRenewals.setRenewalsStatus(RenewalsEnum.RENEWALS.getKey());
         userRenewals.setGmtModified(DateUtil.now());
         userRenewals.setModifier(UserUtils.getCurrentPrincipleID());
+        userRenewals.setEndTime(DateUtil.parseDateTime(DateUtil.formatDateTime(DateUtil.getLastTimeOfDay(DateUtil.parseDate(modifyOpeningTimeVO.getEndTime())))));
         userRenewals.setRenewalsNo(modifyOpeningTimeVO.getRenewalsNo());
        //修改续费时间
         boolean res = modifyOpeningTime(openedProducts);

+ 44 - 14
diagbotman-service/src/main/java/com/diagbot/facade/OrderDetailsFacade.java

@@ -3,6 +3,7 @@ package com.diagbot.facade;
 import com.diagbot.client.UserServiceClient;
 import com.diagbot.dto.OrderDetialsDTO;
 import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.UserAndProdutDTO;
 import com.diagbot.dto.UserOrgDTO;
 import com.diagbot.entity.LantoneProduct;
 import com.diagbot.entity.OpenedProducts;
@@ -10,7 +11,9 @@ import com.diagbot.entity.OrderDetails;
 import com.diagbot.entity.OrderDetailsIndex;
 import com.diagbot.entity.ProductOrder;
 import com.diagbot.entity.ServiceInfo;
+import com.diagbot.entity.wrapper.OrderDetailsWapper;
 import com.diagbot.enums.AuditStatusEnum;
+import com.diagbot.enums.NotPassEnum;
 import com.diagbot.enums.PaymentMethodEnum;
 import com.diagbot.enums.ServiceTypeEnum;
 import com.diagbot.enums.TokenTypeEnum;
@@ -30,7 +33,6 @@ import org.springframework.transaction.annotation.Transactional;
 
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 
@@ -67,6 +69,13 @@ public class OrderDetailsFacade extends OrderDetailsServiceImpl {
         ProductOrder productOrder =new ProductOrder();
         productOrder.setNum(orderDetails.getOrderNum());
         productOrder =productOrderFacade.selctOrderTimeByOrderNum(productOrder);
+        if(auditStatusVO.getStartTime() !=null && auditStatusVO.getStartTime().equals("")){
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                    "开始时间不能为空");
+        }else if(auditStatusVO.getEndTime() !=null && auditStatusVO.getEndTime().equals("")){
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                    "结束时间不能为空");
+        }
         if (orderDetails == null) {
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
                     "订单明细不存在");
@@ -79,27 +88,35 @@ public class OrderDetailsFacade extends OrderDetailsServiceImpl {
         orderDetails.setModifier(UserUtils.getCurrentPrincipleID());
         orderDetails.setAuditStatus(auditStatusVO.getAuditStatus());
         if(auditStatusVO.getAuditStatus()== AuditStatusEnum.Veto.getKey()){
-            orderDetails.setRejectType(auditStatusVO.getRejectType());
-            orderDetails.setRejectReason(auditStatusVO.getRejectReason());
+            if(auditStatusVO.getRejectReason() != null && !auditStatusVO.getRejectReason().equals("") ){
+                orderDetails.setRejectType(-1);
+                if(auditStatusVO.getRejectReason().length()>100){
+                    throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                            "输入原因过长,请减少一些");
+                }
+                orderDetails.setRejectReason(auditStatusVO.getRejectReason());
+            }else {
+                orderDetails.setRejectType(auditStatusVO.getRejectType());
+            }
             if(!this.updateById(orderDetails)){
-                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL,
                         "审核状态修改失败");
             }
             return productOrderFacade.updateProductOrderStatus(orderDetails.getOrderNum());
         }
+        orderDetails.setStatus(PaymentMethodEnum.PAY.getKey());
         if(!this.updateById(orderDetails)){
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+            throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL,
                     "审核状态修改失败");
         }
-        orderDetails.setStatus(PaymentMethodEnum.PAY.getKey());
         Long userId =Long.parseLong(UserUtils.getCurrentPrincipleID());
         OpenedProducts openedProducts =new OpenedProducts();
         openedProducts.setGmtCreate(DateUtil.now());
         openedProducts.setCreator(UserUtils.getCurrentPrincipleID());
         openedProducts.setProductId(orderDetails.getProductId());
         openedProducts.setUserId(orderDetails.getUserId());
-        openedProducts.setStartTime(DateUtil.parseDate(auditStatusVO.getStartTime()));
-        openedProducts.setEndTime(DateUtil.parseDate(auditStatusVO.getEndTime()));
+        openedProducts.setStartTime(DateUtil.parseDateTime(DateUtil.formatDateTime(DateUtil.getFirstTimeOfDay(DateUtil.parseDate(auditStatusVO.getStartTime())))));
+        openedProducts.setEndTime(DateUtil.parseDateTime(DateUtil.formatDateTime(DateUtil.getLastTimeOfDay(DateUtil.parseDate(auditStatusVO.getEndTime())))));
         openedProducts.setOrderId(productOrder.getId());
         openedProductsFacade.save(openedProducts);
         LantoneProduct lantoneProduct =new LantoneProduct();
@@ -147,23 +164,36 @@ public class OrderDetailsFacade extends OrderDetailsServiceImpl {
         }
         RespDTO<Map<Long, UserOrgDTO>> mapRespDTO = userServiceClient.getUserAndOrg(list1);
         if(mapRespDTO == null || !"0".equals(mapRespDTO.code) ) {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+            throw new CommonException(CommonErrorCode.RPC_ERROR,
                     "获取用户和机构信息失败");
         }
         Map<Long, UserOrgDTO> dataMap = mapRespDTO.data;
+        List<UserAndProdutDTO> openedProductTime =openedProductsFacade.getInformationAvailableByUserIdsB(list1);
         for(OrderDetialsDTO bean : list) {
             UserOrgDTO uo = dataMap.get(bean.getUserId());
             if(uo != null) {
                 BeanUtil.copyProperties(uo,bean);
             }
-            if(bean.getAuditStatus()==AuditStatusEnum.Adopt.getKey()){
-                Collection<OpenedProducts> openedProductTime =openedProductsFacade.listByIds(list1);
-                for (OpenedProducts openedProducts:openedProductTime) {
-                    bean.setStartTime(openedProducts.getStartTime());
-                    bean.setEndTime(openedProducts.getEndTime());
+            if(bean.getRejectType().intValue() != 0){
+                bean.setRejectTypeName(NotPassEnum.getName(bean.getRejectType()));
+            }
+            if(bean.getAuditStatus() == AuditStatusEnum.Adopt.getKey()){
+                for (UserAndProdutDTO openedProducts:openedProductTime) {
+                    if(bean.getUserId().intValue() == openedProducts.getUserId().intValue() && bean.getProductId().intValue() == openedProducts.getProductId().intValue()){
+                        bean.setStartTime(openedProducts.getStartTime());
+                        bean.setEndTime(openedProducts.getEndTime());
+                    }
                 }
             }
+            bean.setPayStatusName(PaymentMethodEnum.getName(bean.getStatus()));
         }
         return list;
     }
+    /**
+     * 根据用户id查询是否有在审核的数据数量
+     */
+	public int getOrderByUserToAudit(OrderDetailsWapper rderDetails) {
+    	
+		return baseMapper.getOrderByUserToAudit(rderDetails);
+    }
 }

+ 84 - 38
diagbotman-service/src/main/java/com/diagbot/facade/ProductOrderFacade.java

@@ -15,6 +15,7 @@ import com.diagbot.entity.OrderDetailStatus;
 import com.diagbot.entity.OrderDetails;
 import com.diagbot.entity.ProductOrder;
 import com.diagbot.entity.ProductOrderIndex;
+import com.diagbot.entity.User;
 import com.diagbot.entity.wrapper.ProductOrderWrapper;
 import com.diagbot.enums.AuditStatusEnum;
 import com.diagbot.enums.AuthStatusEnum;
@@ -75,37 +76,55 @@ public class ProductOrderFacade extends ProductOrderServiceImpl {
      *
      * @return 包含产品当前的认证状态
      */
-    public List<ProductAuthProgressDTO> productAuthProgress() {
-        List<ProductAuthProgressDTO> retList = new ArrayList<ProductAuthProgressDTO>();
-        Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
-        List<ProductOrder> orderList = baseMapper.getUserProductOrder(userId);
-        List<String> nums = new ArrayList<>();
-        for (ProductOrder i : orderList) {
-            nums.add(i.getNum());
-        }
-        
-        if(nums.size()==0){
-        	return retList;
-        }
+    public ProductAuthProgressDTO productAuthProgress() {
+//        List<ProductAuthProgressDTO> retList = new ArrayList<ProductAuthProgressDTO>();
+//        Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
+//        List<ProductOrder> orderList = baseMapper.getUserProductOrder(userId);
+//        List<String> nums = new ArrayList<>();
+//        for (ProductOrder i : orderList) {
+//            nums.add(i.getNum());
+//        }
+//        
+//        if(nums.size()==0){
+//        	return retList;
+//        }
         
-        List<AuthDetailDTO> detailList = baseMapper.getOrderDetailsByNums(nums);
-        List<AuthDetailDTO> products = null;
-        Map<String, List<AuthDetailDTO>> detailMap = detailList.stream().collect(Collectors.groupingBy(AuthDetailDTO::getNum));
-        for (String num : detailMap.keySet()) {
-            ProductAuthProgressDTO productAuthProgressDTO = new ProductAuthProgressDTO();
-            productAuthProgressDTO.setNum(num);
-            products = detailMap.get(num);
-            for(AuthDetailDTO i : products){
-            	i.setAuditStatusMsg(AuditStatusEnum.getName(i.getAuditStatus()));
-            	if(i.getRejectType()!=null){
-            		i.setRejectReason(NotPassEnum.getName(i.getRejectType()));
-            	}
-            }
-            productAuthProgressDTO.setProducts(products);
-            retList.add(productAuthProgressDTO);
+//        List<AuthDetailDTO> detailList = baseMapper.getOrderDetailsByNums(nums);
+//        List<AuthDetailDTO> products = null;
+//        Map<String, List<AuthDetailDTO>> detailMap = detailList.stream().collect(Collectors.groupingBy(AuthDetailDTO::getNum));
+//        for (String num : detailMap.keySet()) {
+//            ProductAuthProgressDTO productAuthProgressDTO = new ProductAuthProgressDTO();
+//            productAuthProgressDTO.setNum(num);
+//            products = detailMap.get(num);
+//            for(AuthDetailDTO i : products){
+//            	i.setAuditStatusMsg(AuditStatusEnum.getName(i.getAuditStatus()));
+//            	if(i.getRejectType()!=null&&i.getRejectType()!=-1){
+//            		i.setRejectReason(NotPassEnum.getName(i.getRejectType()));
+//            	}
+//            }
+//            productAuthProgressDTO.setProducts(products);
+//            retList.add(productAuthProgressDTO);
+//        }
+        Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
+        List<AuthDetailDTO> detailList = baseMapper.getOrderDetailsByUserId(userId);
+        List<AuthDetailDTO> passProduct = new ArrayList<>();
+        List<AuthDetailDTO> failProduct = new ArrayList<>();
+        for(AuthDetailDTO i : detailList){
+        	i.setAuditStatusMsg(AuditStatusEnum.getName(i.getAuditStatus()));
+        	if(i.getRejectType()!=null&&i.getRejectType()!=-1){
+        		i.setRejectReason(NotPassEnum.getName(i.getRejectType()));
+        	}
+        	if(i.getAuditStatus()==0){
+        		failProduct.add(i);
+        	}else{
+        		passProduct.add(i);
+        	}
         }
 
-        return retList;
+        ProductAuthProgressDTO productAuthProgressDTO = new ProductAuthProgressDTO();
+        productAuthProgressDTO.setPassProduct(passProduct);
+        productAuthProgressDTO.setFailProduct(failProduct);
+        return productAuthProgressDTO;
     }
     
     /**
@@ -142,7 +161,7 @@ public class ProductOrderFacade extends ProductOrderServiceImpl {
         userIdList.add(userId);
         RespDTO<Map<Long, UserOrgDTO>> mapRespDTO = userServiceClient.getUserAndOrg(userIdList);
         if (mapRespDTO == null || !"0".equals(mapRespDTO.code)) {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+            throw new CommonException(CommonErrorCode.RPC_ERROR,
                     "获取用户机构信息失败");
         }
         Map<Long, UserOrgDTO> dataMap =mapRespDTO.data;
@@ -171,7 +190,7 @@ public class ProductOrderFacade extends ProductOrderServiceImpl {
         productOrder.setUserId(userId);
         productOrder.setTime(DateUtil.now());
         if (!save(productOrder)) {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "添加订单失败");
+            throw new CommonException(CommonErrorCode.INSERT_DATA_FAILED, "添加订单失败");
         }
         OrderDetails orderDetails = null;
         List<OrderDetails> list =new ArrayList();
@@ -190,7 +209,7 @@ public class ProductOrderFacade extends ProductOrderServiceImpl {
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "获取产品信息失败");
         }
         if(orderDetailsFacade.saveOrderDetails(list)){
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "添加订单失败");
+            throw new CommonException(CommonErrorCode.INSERT_DATA_FAILED, "添加订单失败");
         }
         return true;
     }
@@ -214,7 +233,16 @@ public class ProductOrderFacade extends ProductOrderServiceImpl {
      */
     public WaitExamOrderCouDTO waitExamOrderCou() {
         WaitExamOrderCouDTO waitExamOrderCouDTO = new WaitExamOrderCouDTO();
-        waitExamOrderCouDTO.setCount(baseMapper.waitExamOrderCou());
+        RespDTO<List<User>> userInfiList = userServiceClient.getUserAllInfo();
+        if(userInfiList == null || !"0".equals(userInfiList.code) ) {
+            throw new CommonException(CommonErrorCode.RPC_ERROR,
+                    "获取用户和机构信息失败");
+        }
+        List<Long> userIds =new ArrayList<>();
+        for (User user:userInfiList.data) {
+            userIds.add(user.getId());
+        }
+        waitExamOrderCouDTO.setCount(baseMapper.waitExamOrderCou(userIds));
         return waitExamOrderCouDTO;
     }
 
@@ -233,7 +261,25 @@ public class ProductOrderFacade extends ProductOrderServiceImpl {
 		//TODO
         if(productOrderVO.getOrgName()!=null&&productOrderVO.getOrgName()!=""){
             RespDTO<List<Long>> rlist = userServiceClient.getUserByOrgName(productOrderVO.getOrgName());
+            if(rlist == null || !"0".equals(rlist.code) ) {
+                throw new CommonException(CommonErrorCode.RPC_ERROR,
+                        "获取用户和机构信息失败");
+            }
+            if(rlist.data.size() == 0){
+                rlist.data.add(-1L);
+            }
             productOrderIndex.setUserId(rlist.data);
+        }else{
+            RespDTO<List<User>> userInfiList = userServiceClient.getUserAllInfo();
+            if(userInfiList == null || !"0".equals(userInfiList.code) ) {
+                throw new CommonException(CommonErrorCode.RPC_ERROR,
+                        "获取用户和机构信息失败");
+            }
+            List<Long> userIds =new ArrayList<>();
+            for (User user:userInfiList.data) {
+                userIds.add(user.getId());
+            }
+            productOrderIndex.setUserId(userIds);
         }
 		List<ProductOrderDTO> list =productOrderFacade.selectAllProductOrder(page,productOrderIndex).getRecords();
 		List<Long> list1 =new ArrayList<>();
@@ -249,7 +295,7 @@ public class ProductOrderFacade extends ProductOrderServiceImpl {
 		List<OrderDetialsDTO> orderDetilList = orderDetailsFacade.getAllOrderDetials(orderDetialsVO);
 		RespDTO<Map<Long, UserOrgDTO>> mapRespDTO = userServiceClient.getUserAndOrg(list1);
 		if(mapRespDTO == null || !"0".equals(mapRespDTO.code) ) {
-			throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+			throw new CommonException(CommonErrorCode.RPC_ERROR,
 					"获取用户和机构信息失败");
 		}
 		Map<Long, UserOrgDTO> dataMap = mapRespDTO.data;
@@ -303,7 +349,7 @@ public class ProductOrderFacade extends ProductOrderServiceImpl {
         productOrder.setGmtModified(DateUtil.now());
         productOrder.setModifier(UserUtils.getCurrentPrincipleID());
         if(!this.updateById(productOrder)){
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+            throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL,
                     "用户订单审核状态修改失败");
         }
         return true;
@@ -330,7 +376,7 @@ public class ProductOrderFacade extends ProductOrderServiceImpl {
         GsonUtil.toJson(datas.data.getRecords());
         List<String> listName = new ArrayList<>();
 
-        listName.add("订单id");
+        listName.add("编号");
         listName.add("申请时间");
         listName.add("订单号");
         listName.add("申请机构");
@@ -344,7 +390,7 @@ public class ProductOrderFacade extends ProductOrderServiceImpl {
         listId.add("time");//申请时间
         listId.add("num");// 订单号
         listId.add("orgName");//申请机构
-        listId.add("linKman");// 申请人
+        listId.add("linkman");// 申请人
         listId.add("userName");//手机号
         listId.add("email");//邮箱
         listId.add("auditStatus");//审核状态
@@ -353,8 +399,8 @@ public class ProductOrderFacade extends ProductOrderServiceImpl {
         List<ProductOrderExportDTO> list = new ArrayList<>();
         for (int i = 0; i < datas.data.getRecords().size(); i++) {
             ProductOrderWrapper userInfo = datas.data.getRecords().get(i);
-            list.add(new ProductOrderExportDTO(String.valueOf(userInfo.getId()),
-                    DateUtil.formatDate(userInfo.getTime()),
+            list.add(new ProductOrderExportDTO(String.valueOf(i+1),
+                    DateUtil.formatDateTime(userInfo.getTime()),
                     userInfo.getNum(),
                     userInfo.getOrgName(),
                     userInfo.getLinkman(),

+ 61 - 3
diagbotman-service/src/main/java/com/diagbot/facade/ProductServiceFacade.java

@@ -1,10 +1,12 @@
 package com.diagbot.facade;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.diagbot.dto.ProductServiceDTO;
 import com.diagbot.entity.LantoneProduct;
+import com.diagbot.entity.OpenedProducts;
 import com.diagbot.entity.ProductService;
 import com.diagbot.entity.ServiceInfo;
 import com.diagbot.entity.ServiceToken;
@@ -16,6 +18,7 @@ import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
 import com.diagbot.service.impl.ProductServiceServiceImpl;
 import com.diagbot.util.DateUtil;
+import com.diagbot.util.EntityUtil;
 import com.diagbot.util.GuidUtil;
 import com.diagbot.util.UserUtils;
 import com.diagbot.vo.ProductServiceSaveVO;
@@ -23,6 +26,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.util.Date;
+import java.util.List;
+import java.util.Map;
 
 /**
  * @Description:产品与用户端关联业务层
@@ -50,7 +55,7 @@ public class ProductServiceFacade extends ProductServiceServiceImpl {
         ProductServiceDTO productServiceDTO = new ProductServiceDTO();
         Long operatorId = Long.parseLong(UserUtils.getCurrentPrincipleID());
         Long userId = null;
-        if (null != productServiceSaveVO.getUserId()){
+        if (null != productServiceSaveVO.getUserId()) {
             userId = productServiceSaveVO.getUserId();
         } else {
             userId = operatorId;
@@ -58,10 +63,36 @@ public class ProductServiceFacade extends ProductServiceServiceImpl {
         LantoneProduct lantoneProduct = lantoneProductFacade.getById(productServiceSaveVO.getProductId());
         if (lantoneProduct == null) {
             throw new CommonException(CommonErrorCode.NOT_EXISTS,
-                    "找不到产品【" + lantoneProduct.getName() + "】");
+                    "产品未找到");
+        } else if (lantoneProduct.getIsDeleted().equals(IsDeleteEnum.Y.getKey())) {
+            throw new CommonException(CommonErrorCode.NOT_EXISTS,
+                    "无法操作,该产品线已删除");
+        } else if (lantoneProduct.getServiceStatus().equals(StatusEnum.Disable.getKey())) {
+            throw new CommonException(CommonErrorCode.NOT_EXISTS,
+                    "无法操作,该产品线已停用");
+        }
+        QueryWrapper<OpenedProducts> openedProductsQueryWrapper = new QueryWrapper<>();
+        openedProductsQueryWrapper.eq("product_id", lantoneProduct.getId()).eq("user_id", userId);
+        List<OpenedProducts> openedProductsList = openedProductsFacade.list(openedProductsQueryWrapper);
+        openedProductsQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
+        OpenedProducts openedProducts = openedProductsFacade.getOne(openedProductsQueryWrapper);
+        if (!productServiceSaveVO.getType().equals(TokenTypeEnum.Trial.getKey())) {
+            if (openedProductsList.size() == 0) {
+                throw new CommonException(CommonErrorCode.NOT_EXISTS,
+                        "无法操作,该产品未开通");
+            } else if (openedProducts == null) {
+                throw new CommonException(CommonErrorCode.NOT_EXISTS,
+                        "无法操作,该产品已删除");
+            } else if (openedProducts.getServiceStatus().equals(StatusEnum.Disable.getKey())) {
+                throw new CommonException(CommonErrorCode.NOT_EXISTS,
+                        "无法操作,该产品已停用");
+            } else if (openedProducts.getEndTime().before(new Date())) {
+                throw new CommonException(CommonErrorCode.NOT_EXISTS,
+                        "无法操作,该产品已到期");
+            }
         }
         ServiceInfo serviceInfo = serviceInfoFacade.getById(productServiceSaveVO.getServiceId());
-        if (serviceInfo == null) {
+        if (serviceInfo == null || serviceInfo.getIsDeleted().equals(IsDeleteEnum.Y.getKey())) {
             throw new CommonException(CommonErrorCode.NOT_EXISTS,
                     "找不到服务端【" + serviceInfo.getName() + "】");
         } else if (serviceInfo.getUserId() != userId) {
@@ -149,6 +180,33 @@ public class ProductServiceFacade extends ProductServiceServiceImpl {
         return true;
     }
 
+    /**
+     * 删除产品后,级联删除产品服务端关联和令牌
+     * @param productId
+     * @return
+     */
+    public Boolean deleteByProductId(Long productId) {
+        QueryWrapper<ProductService> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("product_id", productId).eq("is_deleted", IsDeleteEnum.N.getKey());
+        List<ProductService> productServiceList = this.list(queryWrapper);
+        Map<Long, ProductService> map = EntityUtil.makeEntityMap(productServiceList, "id");
+        //删除令牌
+        UpdateWrapper<ServiceToken> tokenUpdateWrapper = new UpdateWrapper<>();
+        tokenUpdateWrapper.in("product_service_id", map.keySet());
+        tokenUpdateWrapper.set("is_deleted", IsDeleteEnum.Y.getKey());
+        serviceTokenFacade.update(new ServiceToken(), tokenUpdateWrapper);
+
+        //删除产品服务端关联
+        for (ProductService productService : productServiceList) {
+            productService.setIsDeleted(IsDeleteEnum.Y.getKey());
+        }
+        UpdateWrapper<ProductService> productServiceUpdateWrapper = new UpdateWrapper<>();
+        productServiceUpdateWrapper.in("id", map.keySet());
+        productServiceUpdateWrapper.set("is_deleted", IsDeleteEnum.Y.getKey());
+        this.update(new ProductService(), productServiceUpdateWrapper);
+        return true;
+    }
+
 
     /**
      * 获取当前用户产品服务关联列表

+ 73 - 22
diagbotman-service/src/main/java/com/diagbot/facade/ServiceTokenFacade.java

@@ -2,6 +2,7 @@ package com.diagbot.facade;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.diagbot.dto.HasPermissionDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.entity.LantoneProduct;
 import com.diagbot.entity.OpenedProducts;
@@ -52,50 +53,56 @@ public class ServiceTokenFacade extends ServiceTokenServiceImpl {
      * @param serviceTokenVo 参数
      * @return 是否有权限
      */
-    public RespDTO<Boolean> hasPermission(ServiceTokenVo serviceTokenVo) {
+    public RespDTO<HasPermissionDTO> hasPermission(ServiceTokenVo serviceTokenVo) {
+        HasPermissionDTO hasPermissionDTO = new HasPermissionDTO();
         String appkey = serviceTokenVo.getAppkey();
         String secret = serviceTokenVo.getSecret();
         Map<String, Object> paramMap = new HashMap<>();
         paramMap.put("appkey", appkey);
         paramMap.put("secret", secret);
-        //ServiceToken st = this.getServiceToken(paramMap);
-        QueryWrapper<ServiceToken> qw = new QueryWrapper<>();
-        qw.eq("app_key_id", appkey).
-                eq("app_key_secret", secret);
-        ServiceToken st = this.selectOneRecord(qw);
-        if (null == st) {
+        paramMap.put("productId", serviceTokenVo.getProductId());
+
+        //获取用户的id
+        List<ServiceTokenWrapper> serviceTokenWrapperList = this.getByAppkeyAndSecretAndProductId(paramMap);
+
+        if (ListUtil.isEmpty(serviceTokenWrapperList)) {
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "appkey或secret错误,appkey=【" + appkey + "】," + "secret=【" + secret + "】");
         }
+        ServiceTokenWrapper st = serviceTokenWrapperList.get(0);
+        if (StatusEnum.Disable.getKey() == st.getServiceStatus()) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该产品已停用");
+        }
         if (TokenTypeEnum.Trial.getKey() == st.getType()) {
-            ProductService ps = productServiceFacade.getById(st.getProductServiceId());
-            if (ps == null) {
-                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "无权限访问");
-            }
-            if (!ps.getProductId().equals(serviceTokenVo.getProductId())) {
-                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "无权限访问");
-            }
             Date date = new Date();
             if (st.getExpiringDate().getTime() < date.getTime()) {
                 throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "访问权限已过期");
             }
         } else {
-            List<OpenedProducts> opList = openedProductsFacade.getByAppkeyAndSecret(paramMap);
-            if (ListUtil.isEmpty(opList)) {
+            QueryWrapper<OpenedProducts> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
+            queryWrapper.eq("user_id", st.getUserId());
+            queryWrapper.eq("product_id", st.getProductId());
+            OpenedProducts op = openedProductsFacade.getOne(queryWrapper);
+            if (op == null) {
                 throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "无权限访问");
             }
-            if (opList.size() != 1) {
-                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "当前appkey和secret对应多条数据");
-            }
-            OpenedProducts op = opList.get(0);// 正常只有一条数据
             Date date = new Date();
             if (!(StatusEnum.Enable.getKey() == op.getServiceStatus())) {
                 throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "当前服务已停用");
             }
+            if (op.getStartTime().getTime() > date.getTime()) {
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该产品未在有效服务期内,无法使用");
+            }
             if (op.getEndTime().getTime() < date.getTime()) {
-                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "访问权限已过期");
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该产品已超出有效服务期,无法使用");
             }
         }
-        return RespDTO.onSuc(true);
+        hasPermissionDTO.setHasPermission(true);
+        //获取用户的id
+        if (st.getUserId() != null) {
+            hasPermissionDTO.setUserId(st.getUserId().toString());
+        }
+        return RespDTO.onSuc(hasPermissionDTO);
     }
 
     /**
@@ -155,6 +162,36 @@ public class ServiceTokenFacade extends ServiceTokenServiceImpl {
         return this.updateRecord(serviceToken, uw);
     }
 
+    /**
+     * 根据id批量删除令牌
+     *
+     * @param ids
+     * @return
+     */
+    public Boolean deleteByIds(Long[] ids) {
+        QueryWrapper<ServiceToken> queryWrapper = new QueryWrapper<>();
+        queryWrapper.in("id", ids);
+        List<ServiceToken> serviceTokenList = this.list(queryWrapper);
+        for (ServiceToken serviceToken : serviceTokenList) {
+            serviceToken.setIsDeleted(IsDeleteEnum.Y.getKey());
+        }
+        return this.updateBatchById(serviceTokenList);
+    }
+
+    /**
+     * 根据条件批量删除令牌
+     *
+     * @param queryWrapper
+     * @return
+     */
+    public Boolean deleteByWrapper(QueryWrapper<ServiceToken> queryWrapper) {
+        List<ServiceToken> serviceTokenList = this.list(queryWrapper);
+        for (ServiceToken serviceToken : serviceTokenList) {
+            serviceToken.setIsDeleted(IsDeleteEnum.Y.getKey());
+        }
+        return this.updateBatchById(serviceTokenList);
+    }
+
     /**
      * 启用令牌
      *
@@ -207,4 +244,18 @@ public class ServiceTokenFacade extends ServiceTokenServiceImpl {
         }
         return true;
     }
+
+    /**
+     * 根据条件查询令牌
+     *
+     * @param map
+     * @return
+     */
+    public ServiceToken getTokenByMap(Map<String, Object> map) {
+        QueryWrapper<ServiceToken> queryWrapper = new QueryWrapper<>();
+        for (Map.Entry<String, Object> entry : map.entrySet()) {
+            queryWrapper.eq(entry.getKey(), entry.getValue());
+        }
+        return this.getOne(queryWrapper);
+    }
 }

+ 60 - 6
diagbotman-service/src/main/java/com/diagbot/facade/UserRenewalsFacade.java

@@ -7,6 +7,8 @@ import com.diagbot.dto.ProductLineDTO;
 import com.diagbot.dto.RenewalsInfosDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.UserOrgDTO;
+import com.diagbot.entity.OpenedProducts;
+import com.diagbot.entity.User;
 import com.diagbot.entity.UserRenewals;
 import com.diagbot.entity.wrapper.UserRenewalsWrapper;
 import com.diagbot.enums.CancelRenewalsEnum;
@@ -20,6 +22,7 @@ import com.diagbot.service.impl.UserRenewalsServiceImpl;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.DateUtil;
 import com.diagbot.util.EntityUtil;
+import com.diagbot.util.ListUtil;
 import com.diagbot.util.StringUtil;
 import com.diagbot.util.UserUtils;
 import com.diagbot.vo.AddRenewalsInfoVO;
@@ -49,7 +52,14 @@ public class UserRenewalsFacade extends UserRenewalsServiceImpl {
     private LantoneProductFacade lantoneProductFacade;
     @Autowired
     private OpenedProductsFacade openedProductsFacade;
+    @Autowired
+    private UserRenewalsFacade userRenewalsFacade;
 
+    /**
+     * 产品续费
+     * @param addRenewalsInfoVO 参数
+     * @return Boolean
+     */
     public RespDTO<Boolean> addRenewalsInfos(AddRenewalsInfoVO addRenewalsInfoVO){
         UserRenewals userRenewals =new UserRenewals();
         Map map =new HashMap();
@@ -62,7 +72,8 @@ public class UserRenewalsFacade extends UserRenewalsServiceImpl {
         userRenewals.setApplyTime(DateUtil.now());
         userRenewals.setGmtCreate(DateUtil.now());
         userRenewals.setRenewalsNo(visibleIdCreater.getNextId(VisibleIdTypeEnum.IS_RENEWALS.getKey()).toString());
-        if(openedProductsFacade.selectOpenedProducts(map).size() == 0){
+        List<OpenedProducts> openedProductsList = openedProductsFacade.selectOpenedProducts(map);
+        if(ListUtil.isEmpty(openedProductsList)){
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该产品未开通,不能续费");
         }
         if(this.selectProductIdByUserId(map).contains(addRenewalsInfoVO.getProductId())){
@@ -72,7 +83,11 @@ public class UserRenewalsFacade extends UserRenewalsServiceImpl {
         return RespDTO.onSuc(this.save(userRenewals));
     }
 
-
+    /**
+     * 续费列表显示
+     * @param renewalsInfosVO
+     * @return
+     */
     public IPage renewalsInfo(RenewalsInfosVO renewalsInfosVO){
         Page page =new Page();
         BeanUtil.copyProperties(renewalsInfosVO,page);
@@ -81,19 +96,34 @@ public class UserRenewalsFacade extends UserRenewalsServiceImpl {
         userRenewalsWrapper.setCancelRenewals(CancelRenewalsEnum.NOT_CANCEL.getKey());
         if(StringUtil.isNotBlank(renewalsInfosVO.getOrgName())){
             RespDTO<List<Long>> rlist = userServiceClient.getUserByOrgName(renewalsInfosVO.getOrgName());
+            if(rlist.data.size() == 0){
+                rlist.data.add(-1L);
+            }
             userRenewalsWrapper.setUserId(rlist.data);
+        }else{
+            RespDTO<List<User>> userInfiList = userServiceClient.getUserAllInfo();
+            if(userInfiList == null || !"0".equals(userInfiList.code) ) {
+                throw new CommonException(CommonErrorCode.RPC_ERROR,
+                        "获取用户和机构信息失败");
+            }
+            List<Long> userIds =new ArrayList<>();
+            for (User user:userInfiList.data) {
+                userIds.add(user.getId());
+            }
+            userRenewalsWrapper.setUserId(userIds);
         }
         List<RenewalsInfosDTO> list = this.selectUserRenewals(page,userRenewalsWrapper).getRecords();
-        List<ProductLineDTO> productList =lantoneProductFacade.productLines();
+        List<ProductLineDTO> productList =lantoneProductFacade.productLinesB();
         Map<Long, ProductLineDTO> productMap = EntityUtil.makeEntityMap(productList,"id");
         List<Long> userIds =new ArrayList<>();
         for (RenewalsInfosDTO renewalsInfosDTO:list) {
             Long userId = renewalsInfosDTO.getUserId();
             userIds.add(userId);
         }
+        List<OpenedProducts> opendList = openedProductsFacade.getOpendInfos();
         RespDTO<Map<Long, UserOrgDTO>> mapRespDTO = userServiceClient.getUserAndOrg(userIds);
         if(mapRespDTO == null || !"0".equals(mapRespDTO.code) ) {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+            throw new CommonException(CommonErrorCode.RPC_ERROR,
                     "获取用户和机构信息失败");
         }
         Map<Long, UserOrgDTO> dataMap = mapRespDTO.data;
@@ -105,6 +135,13 @@ public class UserRenewalsFacade extends UserRenewalsServiceImpl {
 //                    bean.setProductName(productLineDTO.getName());
 //                }
 //            }
+            if(bean.getRenewalsStatus().intValue() == RenewalsEnum.NOT_RENEWALS.getKey()){
+                for (OpenedProducts openedProducts:opendList) {
+                    if(openedProducts.getUserId().longValue() == bean.getUserId().longValue()&&openedProducts.getProductId().longValue() == bean.getProductId().longValue()){
+                        bean.setEndTime(openedProducts.getEndTime());
+                    }
+                }
+            }
             if (null != productMap && null != productMap.get(bean.getProductId())){
                 bean.setProductName(productMap.get(bean.getProductId()).getName());
             }
@@ -117,25 +154,42 @@ public class UserRenewalsFacade extends UserRenewalsServiceImpl {
         return page;
     }
 
+    /**
+     * 删除续费信息
+     * @param deleteRenewalsInfoVO
+     * @return Boolean
+     */
     public Boolean deleteRenewalsInfo(DeleteRenewalsInfoVO deleteRenewalsInfoVO){
         UserRenewals userRenewals =this.getById(deleteRenewalsInfoVO.getId());
         userRenewals.setIsDeleted(IsDeleteEnum.Y.getKey());
         userRenewals.setModifier(UserUtils.getCurrentPrincipleID());
         userRenewals.setGmtModified(DateUtil.now());
         if(!this.updateById(userRenewals)){
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+            throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL,
                     "删除失败");
         }
         return true;
     }
 
+    /**
+     * 取消续费
+     * @param deleteRenewalsInfoVO
+     * @return Boolean
+     */
     public Boolean cancelRenewalsInfo(DeleteRenewalsInfoVO deleteRenewalsInfoVO){
         UserRenewals userRenewals =this.getById(deleteRenewalsInfoVO.getId());
         userRenewals.setCancelRenewals(CancelRenewalsEnum.CANCEL_RENEWALS_ENUM.getKey());
         userRenewals.setModifier(UserUtils.getCurrentPrincipleID());
         userRenewals.setGmtModified(DateUtil.now());
+        Map map =new HashMap();
+        map.put("userId",userRenewals.getUserId());
+        map.put("productId",userRenewals.getProductId());
+        List<Long> renewalsList = userRenewalsFacade.selectProductIdByUserId(map);
+        if(!renewalsList.contains(userRenewals.getProductId())){
+            throw new CommonException(CommonErrorCode.NOT_EXISTS, "续费单已审核,请刷新重试");
+        }
         if(!this.updateById(userRenewals)){
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+            throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL,
                     "取消失败");
         }
         return true;

+ 7 - 0
diagbotman-service/src/main/java/com/diagbot/mapper/LantoneProductMapper.java

@@ -28,6 +28,13 @@ public interface LantoneProductMapper extends BaseMapper<LantoneProduct> {
      */
     List<ProductLineDTO> productLines();
 
+    /**
+     * @Description: 查询所有产品信息系包括已删除的
+     * @Author: wangyu
+     * @Date: 9:49 2018/9/18
+     */
+    List<ProductLineDTO> productLinesB();
+
     /**
      * @Description: 根据产品名称分页查询
      * @Author: wangyu

+ 13 - 0
diagbotman-service/src/main/java/com/diagbot/mapper/OpenedProductsMapper.java

@@ -115,10 +115,23 @@ public interface OpenedProductsMapper extends BaseMapper<OpenedProducts> {
      */
     public List<UserAndProdutDTO> getInformationAvailableByUserIds(List<Long> userIds);
 
+    /**
+     *
+     * @param  userIds
+     * @return
+     */
+    public List<UserAndProdutDTO> getInformationAvailableByUserIdsB(List<Long> userIds);
+
     /**
      * 根据用户id查询是否有开通产品
      * @param userId
      * @return
      */
     public List<Long> getOpendCountByUserId(Long userId);
+
+    /**
+     * 根据用户id和产品id获取用户已开通信息
+     * @return
+     */
+    public List<OpenedProducts> getOpendInfos();
 }

+ 8 - 0
diagbotman-service/src/main/java/com/diagbot/mapper/OrderDetailsMapper.java

@@ -5,6 +5,8 @@ import com.diagbot.dto.OrderDetialsDTO;
 import com.diagbot.entity.OrderDetailStatus;
 import com.diagbot.entity.OrderDetails;
 import com.diagbot.entity.OrderDetailsIndex;
+import com.diagbot.entity.wrapper.OrderDetailsWapper;
+
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -46,4 +48,10 @@ public interface OrderDetailsMapper extends BaseMapper<OrderDetails> {
      * @return
      */
     public List<Long> getOrderDetailsByUser(Long userId);
+    /**
+     * 根据用户id查询是否有在审核的数据数量
+     * @param userId
+     * @return
+     */
+    public int  getOrderByUserToAudit(OrderDetailsWapper orderDetails);
 }

+ 8 - 1
diagbotman-service/src/main/java/com/diagbot/mapper/ProductOrderMapper.java

@@ -50,6 +50,13 @@ public interface ProductOrderMapper extends BaseMapper<ProductOrder> {
      */
     List<AuthDetailDTO> getOrderDetailsByNums(List<String> nums);
     
+    /**
+     * 根据用户id查询详情集合
+     * @param userId
+     * @return
+     */
+    List<AuthDetailDTO> getOrderDetailsByUserId(Long userId);
+    
     /**
      * 根据用户id查询审核不通过订单信息数量
      * @param userId
@@ -69,7 +76,7 @@ public interface ProductOrderMapper extends BaseMapper<ProductOrder> {
      *
      * @return
      */
-    int waitExamOrderCou();
+    int waitExamOrderCou(List<Long> list);
 
     /**
      * @Description: 产品申请查询所有订单信息接口

+ 32 - 0
diagbotman-service/src/main/java/com/diagbot/mapper/ServiceTokenMapper.java

@@ -2,7 +2,10 @@ package com.diagbot.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.diagbot.entity.ServiceToken;
+import com.diagbot.entity.ServiceTokenWithUser;
+import com.diagbot.entity.wrapper.ServiceTokenWrapper;
 
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -14,4 +17,33 @@ import java.util.Map;
  * @since 2018-09-17
  */
 public interface ServiceTokenMapper extends BaseMapper<ServiceToken> {
+
+
+    /**
+     * 根据appkey和secret获取ServiceToken信息
+     * @param map
+     * @return
+     */
+    public List<ServiceTokenWithUser> getByAppkeyAndSecret(Map map);
+
+    /**
+     * 根据userId和productId获取试用商品的数量
+     * @param map
+     * @return
+     */
+    Integer getTryTokenCount(Map map);
+    
+    /**
+     * 根据userId和productId获取试用商品token
+     * @param map
+     * @return
+     */
+    ServiceToken getTryTokenByUserIdAndProductId(Map map);
+
+    /**
+     * 根据appkey、secret、productId获取ServiceToken信息
+     * @param map
+     * @return
+     */
+    public List<ServiceTokenWrapper> getByAppkeyAndSecretAndProduct(Map map);
 }

+ 6 - 0
diagbotman-service/src/main/java/com/diagbot/mapper/UserRenewalsMapper.java

@@ -42,4 +42,10 @@ public interface UserRenewalsMapper extends BaseMapper<UserRenewals> {
      * @return
      */
     public boolean updateRenewalStatus(UserRenewals userRenewals);
+    /**
+     *查詢用户的待续费数量
+     * @param userRenewals
+     * @return
+     */
+    public int getUserWaitingRenewal(UserRenewals userRenewals);
 }

+ 7 - 0
diagbotman-service/src/main/java/com/diagbot/service/LantoneProductService.java

@@ -27,6 +27,13 @@ public interface LantoneProductService extends IService<LantoneProduct> {
      */
     List<ProductLineDTO> productLines();
 
+    /**
+     * @Description: 查询所有产品信息系包括已删除的
+     * @Author: wangyu
+     * @Date: 9:49 2018/9/18
+     */
+    List<ProductLineDTO> productLinesB();
+
     /**
      * @Description: 朗通查询所有产品线
      * @Author: wangyu

+ 13 - 0
diagbotman-service/src/main/java/com/diagbot/service/OpenedProductsService.java

@@ -79,6 +79,13 @@ public interface OpenedProductsService extends IService<OpenedProducts> {
      */
     public List<UserAndProdutDTO> getInformationAvailableByUserIds(List<Long> userIds);
 
+    /**
+     *
+     * @param userIds
+     * @return
+     */
+    public List<UserAndProdutDTO> getInformationAvailableByUserIdsB(List<Long> userIds);
+
 
     /**
      * 根据用户id查询是否有开通产品
@@ -86,4 +93,10 @@ public interface OpenedProductsService extends IService<OpenedProducts> {
      * @return list
      */
     public List<Long> getOpendCountByUserId(Long userId);
+
+    /**
+     * 根据用户id和产品id获取用户已开通信息
+     * @return
+     */
+    public List<OpenedProducts> getOpendInfos();
 }

+ 3 - 0
diagbotman-service/src/main/java/com/diagbot/service/OrderDetailsService.java

@@ -5,6 +5,7 @@ import com.diagbot.dto.OrderDetialsDTO;
 import com.diagbot.entity.OrderDetailStatus;
 import com.diagbot.entity.OrderDetails;
 import com.diagbot.entity.OrderDetailsIndex;
+import com.diagbot.entity.wrapper.OrderDetailsWapper;
 
 import java.util.List;
 
@@ -45,4 +46,6 @@ public interface OrderDetailsService extends IService<OrderDetails> {
      * @return
      */
     public List<Long> getOrderDetailsByUser(Long userId);
+    
+    public int  getOrderByUserToAudit(OrderDetailsWapper orderDetails);
 }

+ 35 - 0
diagbotman-service/src/main/java/com/diagbot/service/ServiceTokenService.java

@@ -4,6 +4,11 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.diagbot.entity.ServiceToken;
+import com.diagbot.entity.ServiceTokenWithUser;
+import com.diagbot.entity.wrapper.ServiceTokenWrapper;
+
+import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -30,4 +35,34 @@ public interface ServiceTokenService extends IService<ServiceToken> {
      * @return
      */
     ServiceToken selectOneRecord(QueryWrapper<ServiceToken> queryWrapper);
+
+
+    /**
+     * 根据appkey和secret获取ServiceToken信息
+     * @param map
+     * @return
+     */
+    public List<ServiceTokenWithUser> getByAppkeyAndSecret(Map map);
+
+
+    /**
+     * 根据appkey、secret、productId获取ServiceToken信息
+     * @param map
+     * @return
+     */
+    public List<ServiceTokenWrapper> getByAppkeyAndSecretAndProductId(Map map);
+
+    /**
+     * 根据userId和productId获取试用商品的数量
+     * @param map
+     * @return
+     */
+    Integer getTryTokenCount(Map map);
+    
+    /**
+     * 根据userId和productId获取试用商品token
+     * @param map
+     * @return
+     */
+    ServiceToken getTryTokenByUserIdAndProductId(Map map);
 }

+ 6 - 0
diagbotman-service/src/main/java/com/diagbot/service/UserRenewalsService.java

@@ -42,4 +42,10 @@ public interface UserRenewalsService extends IService<UserRenewals> {
      * @return
      */
     public boolean updateRenewalStatus(UserRenewals userRenewals);
+    /**
+     * 
+     * @param userRenewals
+     * @return
+     */
+    public int getUserWaitingRenewal(UserRenewals userRenewals);
 }

+ 10 - 0
diagbotman-service/src/main/java/com/diagbot/service/impl/LantoneProductServiceImpl.java

@@ -39,6 +39,16 @@ public class LantoneProductServiceImpl extends ServiceImpl<LantoneProductMapper,
         return baseMapper.productLines();
     }
 
+    /**
+     * @Description: 显示朗通产品线
+     * @Author: wangyu
+     * @Date: 13:29 2018/9/18
+     */
+    @Override
+    public List<ProductLineDTO> productLinesB() {
+        return baseMapper.productLinesB();
+    }
+
     /**
      * @Description: 查询朗通所有产品线
      * @Author: wangyu

+ 10 - 0
diagbotman-service/src/main/java/com/diagbot/service/impl/OpenedProductsServiceImpl.java

@@ -64,6 +64,11 @@ public class OpenedProductsServiceImpl extends ServiceImpl<OpenedProductsMapper,
         return baseMapper.delInformationAvailable(openedProducts);
     }
 
+    @Override
+    public List<OpenedProducts> getOpendInfos() {
+        return baseMapper.getOpendInfos();
+    }
+
     @Override
     public boolean modifyOpeningTime(OpenedProducts openedProducts) {
         // TODO Auto-generated method stub
@@ -84,6 +89,11 @@ public class OpenedProductsServiceImpl extends ServiceImpl<OpenedProductsMapper,
     	return baseMapper.getInformationAvailableByUserIds(userIds);
     }
 
+    @Override
+    public List<UserAndProdutDTO> getInformationAvailableByUserIdsB(List<Long> userIds){
+        return baseMapper.getInformationAvailableByUserIdsB(userIds);
+    }
+
     @Override
     public List<Long> getOpendCountByUserId(Long userId) {
         return baseMapper.getOpendCountByUserId(userId);

+ 5 - 1
diagbotman-service/src/main/java/com/diagbot/service/impl/OrderDetailsServiceImpl.java

@@ -61,6 +61,10 @@ public class OrderDetailsServiceImpl extends ServiceImpl<OrderDetailsMapper, Ord
     public List<Long> getOrderDetailsByUser(Long userId) {
         return baseMapper.getOrderDetailsByUser(userId);
     }
-
+    @Override
+	public int getOrderByUserToAudit(OrderDetailsWapper orderDetails) {
+		
+		return baseMapper.getOrderByUserToAudit(orderDetails);
+	}
 
 }

+ 38 - 0
diagbotman-service/src/main/java/com/diagbot/service/impl/ServiceTokenServiceImpl.java

@@ -4,11 +4,16 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.diagbot.entity.ServiceToken;
+import com.diagbot.entity.ServiceTokenWithUser;
+import com.diagbot.entity.wrapper.ServiceTokenWrapper;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.mapper.ServiceTokenMapper;
 import com.diagbot.service.ServiceTokenService;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+import java.util.Map;
+
 /**
  * <p>
  * 服务令牌表 服务实现类
@@ -41,4 +46,37 @@ public class ServiceTokenServiceImpl extends ServiceImpl<ServiceTokenMapper, Ser
         queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
         return this.baseMapper.selectOne(queryWrapper);
     }
+
+    @Override
+    public List<ServiceTokenWithUser> getByAppkeyAndSecret(Map map) {
+        return baseMapper.getByAppkeyAndSecret(map);
+    }
+
+    @Override
+    public List<ServiceTokenWrapper> getByAppkeyAndSecretAndProductId(Map map) {
+        return baseMapper.getByAppkeyAndSecretAndProduct(map);
+    }
+
+
+    /**
+     * 根据userId和productId获取试用商品的数量
+     * @param map
+     * @return
+     */
+    @Override
+    public Integer getTryTokenCount(Map map){
+        return baseMapper.getTryTokenCount(map);
+    }
+
+    /**
+     * 根据userId和productId获取试用商品token
+     */
+	@Override
+	public ServiceToken getTryTokenByUserIdAndProductId(Map map) {
+		// TODO Auto-generated method stub
+		return baseMapper.getTryTokenByUserIdAndProductId(map);
+	}
+    
+    
+
 }

+ 9 - 0
diagbotman-service/src/main/java/com/diagbot/service/impl/UserRenewalsServiceImpl.java

@@ -41,4 +41,13 @@ public class UserRenewalsServiceImpl extends ServiceImpl<UserRenewalsMapper, Use
 		// TODO Auto-generated method stub
 		return baseMapper.updateRenewalStatus(userRenewals);
 	}
+	/**
+     *查詢用户的待续费数量
+     * @param userRenewals
+     * @return
+     */
+	@Override
+	public int getUserWaitingRenewal(UserRenewals userRenewals){
+		return baseMapper.getUserWaitingRenewal(userRenewals);
+	}
 }

+ 29 - 1
diagbotman-service/src/main/java/com/diagbot/web/ProductOrderController.java

@@ -12,9 +12,13 @@ import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.UserAndProdutDTO;
 import com.diagbot.dto.WaitExamOrderCouDTO;
 import com.diagbot.entity.OpenedProducts;
+import com.diagbot.entity.UserRenewals;
+import com.diagbot.entity.wrapper.OrderDetailsWapper;
 import com.diagbot.facade.LantoneProductFacade;
 import com.diagbot.facade.OpenedProductsFacade;
+import com.diagbot.facade.OrderDetailsFacade;
 import com.diagbot.facade.ProductOrderFacade;
+import com.diagbot.facade.UserRenewalsFacade;
 import com.diagbot.vo.ModifyOpeningTimeVO;
 import com.diagbot.vo.OpenUpOnTrialVO;
 import com.diagbot.vo.ProductOrderVO;
@@ -49,11 +53,15 @@ public class ProductOrderController {
     private ProductOrderFacade productOrderFacade;
     @Autowired
     private OpenedProductsFacade openedProductsFacade;
+    @Autowired
+    private OrderDetailsFacade orderDetailsFacade;
+    @Autowired
+    private UserRenewalsFacade userRenewalsFacade;
 
     @ApiOperation(value = "控制台-产品认证进度[by:rengb]", notes = "控制台-产品认证进度")
     @PostMapping("/productAuthProgress")
     @SysLogger("productAuthProgress")
-    public RespDTO<List<ProductAuthProgressDTO>> productAuthProgress() {
+    public RespDTO<ProductAuthProgressDTO> productAuthProgress() {
         return RespDTO.onSuc(productOrderFacade.productAuthProgress());
     }
 
@@ -157,4 +165,24 @@ public class ProductOrderController {
     	List<UserAndProdutDTO> UserAndProdutData = openedProductsFacade.getInformationAvailableByUserIds(userIds);
     	return RespDTO.onSuc(UserAndProdutData);
     }
+    @ApiOperation(value = "客户中心-查询用户是否有待审核的产品数量[by:wangfeng]", notes = "用户已开通信息")
+    @PostMapping("/getOrderByUserToAudit")
+    @SysLogger("getOrderByUserToAudit")
+   
+    public RespDTO<Integer> getOrderByUserToAudit(@RequestBody Long userId){
+    	OrderDetailsWapper rderDetails =new OrderDetailsWapper();
+    	rderDetails.setUserId(userId);
+    	int sums = orderDetailsFacade.getOrderByUserToAudit(rderDetails);
+    	return RespDTO.onSuc(sums);	
+    }
+    @ApiOperation(value = "客户中心-查询用户续费数量[by:wangfeng]", notes = "用户已开通信息")
+    @PostMapping("/getUserWaitingRenewal")
+    @SysLogger("getUserWaitingRenewal")
+    
+    public RespDTO<Integer> getUserWaitingRenewal(@RequestBody Long userId){
+    	UserRenewals userRenewals = new UserRenewals();
+    	userRenewals.setUserId(userId);
+    	int userIdSum = userRenewalsFacade.getUserWaitingRenewal(userRenewals);
+    	return RespDTO.onSuc(userIdSum);	
+    }
 }

+ 2 - 1
diagbotman-service/src/main/java/com/diagbot/web/ServiceTokenController.java

@@ -2,6 +2,7 @@ package com.diagbot.web;
 
 
 import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.HasPermissionDTO;
 import com.diagbot.dto.ProductServiceDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.entity.wrapper.ServiceTokenWrapper;
@@ -48,7 +49,7 @@ public class ServiceTokenController {
     @PostMapping("/hasPermission")
     @ApiOperation(value = "查询当前appkey和secret是否有权限[by:zhoutg]")
     @ApiIgnore
-    public RespDTO<Boolean> hasPermission(@RequestBody ServiceTokenVo serviceTokenVo) {
+    public RespDTO<HasPermissionDTO> hasPermission(@RequestBody ServiceTokenVo serviceTokenVo) {
         return serviceTokenFacade.hasPermission(serviceTokenVo);
     }
 

+ 9 - 2
diagbotman-service/src/main/resources/mapper/LantoneProductMapper.xml

@@ -44,7 +44,12 @@
     </resultMap>
 
     <select id="productLines" resultType="com.diagbot.dto.ProductLineDTO">
-        SELECT * FROM `diag_lantone_product` WHERE is_deleted = 'N' AND  service_status = 1
+        SELECT * FROM `diag_lantone_product` WHERE is_deleted = 'N'
+    </select>
+
+
+    <select id="productLinesB" resultType="com.diagbot.dto.ProductLineDTO">
+        SELECT * FROM `diag_lantone_product`
     </select>
 
     <!--根据产品名称分页查询-->
@@ -76,6 +81,7 @@
         <if test="name != null and name != ''">
             AND p.name LIKE concat ('%',#{name},'%')
         </if>
+        ORDER BY gmt_create DESC
     </select>
 
     <select id="opendedProduct" resultMap="BaseResultMap" parameterType="java.util.Map">
@@ -97,11 +103,12 @@
 			  and c.num=d.order_num
               and d.audit_status=1
               and a.is_deleted='N' and b.is_deleted='N' and c.is_deleted='N' and d.is_deleted='N'
+              -- and (find_in_set('2',a.access_type) or FIND_IN_SET('3',a.access_type))
               and b.user_id=#{userId}  and c.user_id=#{userId}  and d.user_id=#{userId}
     </select>
     
     <select id="selectProductByName" resultMap="BaseResultMap">
-        SELECT * FROM `diag_lantone_product` WHERE `name`=#{name}
+        SELECT * FROM `diag_lantone_product` WHERE is_deleted='N' and `name`=#{name}
     </select>
 
 </mapper>

+ 56 - 7
diagbotman-service/src/main/resources/mapper/OpenedProductsMapper.xml

@@ -62,10 +62,31 @@
 			DATE_FORMAT(a.start_time,'%Y-%m-%d') as startTime,
 			DATE_FORMAT(a.end_time,'%Y-%m-%d') as endTime,
 			a.service_status as serviceStatus,
+			b.url as url,
 			b.access_type as accessType,
-			case when c.id is null then 0 else 1 end as renewalsStutas
+			d.app_key_id as appKeyId,
+			d.app_key_secret as appKeySecret,
+			case when c.id is null then 0 else 1 end as renewalsStutas,
+			case when sysdate()>a.end_time then 0 else 1 end as isExpire,
+			case when a.start_time>sysdate() then 0 else 1 end as isBegin
 		from diag_opened_products a join diag_lantone_product b on a.product_id=b.id
 		left join diag_user_renewals c on a.user_id=c.user_id and a.product_id=c.product_id and c.renewals_status=0 and c.cancel_renewals=0 and c.is_deleted='N'
+		left join 
+		(SELECT
+		b.product_id,
+		c.app_key_id,
+		c.app_key_secret
+		FROM
+		diag_service_info a
+		JOIN diag_product_service b ON a.id = b.service_id
+		JOIN diag_service_token c ON b.id = c.product_service_id
+		WHERE
+		a.is_deleted = 'N'
+		AND b.is_deleted = 'N'
+		AND c.is_deleted = 'N'
+		AND a.user_id = #{userId}
+		AND a.type = 1
+		AND c.type = 1) d on b.id=d.product_id
 		where a.is_deleted='N' and b.is_deleted='N' and a.user_id=#{userId}
     </select>
 
@@ -119,7 +140,7 @@
 		FROM
 		diag_opened_products
 		WHERE
-		user_id = #{userId} and is_deleted = 'N' and service_status = 1)
+		user_id = #{userId} and is_deleted = 'N')
 	</select>
 
     <select id="getConsoleOnTrialCount" parameterType="long" resultType="int">
@@ -154,6 +175,7 @@
         ON a.product_id=b.id
         WHERE
         a.is_deleted = "N"
+        AND b.is_deleted = "N"
         <if test="userId !=null">
             AND a.user_id = #{userId}
         </if>
@@ -187,9 +209,10 @@
         UPDATE diag_opened_products a
         <trim prefix="set" suffixOverrides=",">
             <if test="gmtModified !=null">a.gmt_modified=#{gmtModified},</if>
-            <if test="modifier != null">a.modifier=#{modifier}</if>
+            <if test="modifier != null">a.modifier=#{modifier},</if>
             <if test="startTime != null">a.start_time = #{startTime},</if>
-            <if test="endTime != null">a.end_time = #{endTime}</if>
+            <if test="endTime != null">a.end_time = #{endTime},</if>
+            <if test="serviceStatus != null">a.service_status = #{serviceStatus}</if>
         </trim>
         WHERE
         a.user_id = #{userId}
@@ -211,7 +234,7 @@
         ORDER BY b.time desc
     </select>
 
-    <select id="getOpendById" resultMap="BaseResultMap" parameterType="java.util.List">
+    <select id="getOpendById" resultMap="BaseResultMap">
         SELECT * FROM `diag_opened_products` a where a.service_status ='1'
         <if test="productId != null and productId != ''">
             and a.product_id =#{productId}
@@ -225,8 +248,30 @@
         a.start_time as startTime,
         a.end_time as endTime,
         a.service_status as serviceStatus,
-        a.access_type as accessType,
-        a.charge_type as chargeType,
+        b.access_type as accessType,
+        b.charge_type as chargeType,
+        b.name as productName
+        FROM diag_opened_products a JOIN diag_lantone_product b
+        ON a.product_id=b.id
+        WHERE
+        a.is_deleted = "N"
+        AND b.is_deleted = "N"
+        AND a.user_id in
+        <foreach collection="list" item="ids" open="(" close=")" separator=",">
+            #{ids}
+        </foreach>
+    </select>
+
+    <select id="getInformationAvailableByUserIdsB" parameterType="java.util.List" resultType="com.diagbot.dto.UserAndProdutDTO">
+        SELECT
+        a.id as Id,
+        a.product_id as productId,
+        a.user_id as userId,
+        a.start_time as startTime,
+        a.end_time as endTime,
+        a.service_status as serviceStatus,
+        b.access_type as accessType,
+        b.charge_type as chargeType,
         b.name as productName
         FROM diag_opened_products a JOIN diag_lantone_product b
         ON a.product_id=b.id
@@ -241,4 +286,8 @@
     <select id="getOpendCountByUserId" resultType="java.lang.Long">
         SELECT a.product_id FROM diag_opened_products a WHERE a.is_deleted ='N' and a.user_id = #{userId}
     </select>
+    
+    <select id="getOpendInfos" resultType="com.diagbot.entity.OpenedProducts">
+        SELECT * FROM `diag_opened_products` WHERE is_deleted = "N"
+    </select>
 </mapper>

+ 7 - 1
diagbotman-service/src/main/resources/mapper/OrderDetailsMapper.xml

@@ -40,7 +40,7 @@
     </resultMap>
     <select id="seleAllOrderDetials" resultMap="BaseResultWrapper">
         SELECT
-        a.id,a.user_id,a.audit_status,a.`status`,a.reject_type,a.reject_reason , b.time order_time,c.`name` product_name,a.order_num
+        a.id,a.user_id,a.audit_status,a.`status`,a.reject_type,a.reject_reason , b.time order_time,c.`name` product_name,a.order_num ,c.id product_id
         FROM
         diag_order_details a
         LEFT JOIN diag_product_order b ON a.order_num = b.num
@@ -54,6 +54,9 @@
         <if test="productId != null and productId !=''">
             AND product_id = #{productId}
         </if>
+        <if test="auditStatus != null and auditStatus !=''">
+            AND a.audit_status = #{auditStatus}
+        </if>
     </select>
 
     <select id="selectAllOrderDetialsByOrderNum" resultType="com.diagbot.entity.OrderDetailStatus">
@@ -77,4 +80,7 @@
     <select id="getOrderDetailsByUser" resultType="java.lang.Long">
         SELECT a.product_id FROM diag_order_details a WHERE a.is_deleted ='N' and a.audit_status != 0 and a.user_id = #{userId}
     </select>
+    <select id="getOrderByUserToAudit" resultType="java.lang.Integer">
+        SELECT COUNT(*) FROM diag_order_details a WHERE a.is_deleted ='N' and a.audit_status = 2 and a.user_id = #{userId}
+    </select>
 </mapper>

+ 21 - 2
diagbotman-service/src/main/resources/mapper/ProductOrderMapper.xml

@@ -68,6 +68,22 @@
         <foreach collection="list" separator="," open="(" close=")" item="num">
             #{num}
         </foreach>
+        order by b.audit_status desc,b.gmt_modified desc,b.gmt_create desc
+    </select>
+    
+   	<select id="getOrderDetailsByUserId" parameterType="Long" 
+   			resultType="com.diagbot.dto.AuthDetailDTO">
+    	select
+        b.order_num as num,
+        b.audit_status as auditStatus,
+        c.name as name,
+		b.reject_type as rejectType,
+        b.reject_reason as rejectReason
+		from diag_product_order a
+		join diag_order_details b on a.num=b.order_num
+		join diag_lantone_product c on b.product_id=c.id
+		where a.is_deleted = 'N' and b.is_deleted = 'N' and c.is_deleted = 'N' and a.user_id=#{userId}
+		order by b.audit_status desc,b.gmt_modified desc,b.gmt_create desc
     </select>
     
     <select id="getOrderAuthFailCount" parameterType="Long" resultType="int">
@@ -86,13 +102,16 @@
         </if>
     </select>
 
-    <select id="waitExamOrderCou" resultType="int">
+    <select id="waitExamOrderCou" parameterType="list" resultType="int">
     	SELECT 
 			count(1) 
 		FROM diag_product_order a join
 		(SELECT DISTINCT order_num
 		from diag_order_details where is_deleted='N' and audit_status=2) b on a.num=b.order_num
-		where a.is_deleted='N'
+		where a.is_deleted='N' and a.user_id in
+		<foreach collection="list" open="(" close=")" separator="," item="userid">
+			#{userid}
+		</foreach>
     </select>
 
     <select id="selectAllProductOrder" resultMap="BaseResultWrapper">

+ 4 - 2
diagbotman-service/src/main/resources/mapper/ProductServiceMapper.xml

@@ -37,15 +37,17 @@
     <!-- 查询产品与服务端的关联列表(分页) -->
     <select id="selectProductServicePage" resultMap="BaseResultWrapperMap">
         select a.*,d.name as product_name,d.decription as product_description,c.name as service_name,c.description as service_description
-        from diag_product_service a,diag_opened_products b,diag_service_info c ,diag_lantone_product d
+        from diag_product_service a,diag_opened_products b,diag_service_info c ,diag_lantone_product d,diag_service_token e
         where a.product_id=b.product_id
         and a.product_id=d.id
         and a.service_id=c.id
+        and a.id=e.product_service_id
         and a.is_deleted='N'
         and b.is_deleted='N'
         and c.is_deleted='N'
-        and b.service_status=1
         and d.is_deleted='N'
+        and e.is_deleted='N'
+        and e.type=2
         and (find_in_set('1',d.access_type) or FIND_IN_SET('2',d.access_type))
         <if test="productService.userId != null and productService.userId != '' ">
             and b.user_id=#{productService.userId} and c.user_id=#{productService.userId}

+ 46 - 0
diagbotman-service/src/main/resources/mapper/ServiceTokenMapper.xml

@@ -20,4 +20,50 @@
         <result column="expiring_date" property="expiringDate"/>
         <result column="remark" property="remark"/>
     </resultMap>
+
+
+
+    <select id="getByAppkeyAndSecret" parameterType="java.util.Map" resultType="com.diagbot.entity.ServiceTokenWithUser">
+        SELECT a.*, c.user_id user_id FROM `diag_service_token` a, diag_product_service b, diag_service_info c
+        where a.is_deleted = 'N' and b.is_deleted = 'N' and c.is_deleted = 'N'
+        and a.app_key_id = #{appkey} and a.app_key_secret = #{secret} and a.product_service_id = b.id and b.service_id = c.id
+    </select>
+
+    <select id="getTryTokenCount" parameterType="java.util.Map" resultType="Integer">
+        SELECT COUNT(a.id) FROM `diag_service_token` a, diag_product_service b, diag_service_info c
+        where a.is_deleted = 'N' and b.is_deleted = 'N' and c.is_deleted = 'N'
+		and a.product_service_id = b.id and b.service_id = c.id and a.type = 3
+        and c.user_id = #{userId} and b.product_id = #{productId}
+    </select>
+    
+ 	<select id="getTryTokenByUserIdAndProductId" parameterType="java.util.Map" resultMap="BaseResultMap">
+        SELECT  
+        	a.*
+        FROM `diag_service_token` a, diag_product_service b, diag_service_info c
+        where a.is_deleted = 'N' and b.is_deleted = 'N' and c.is_deleted = 'N'
+		and a.product_service_id = b.id and b.service_id = c.id and a.type = 3
+        and c.user_id = #{userId} and b.product_id = #{productId}
+    </select>
+
+	
+
+    <select id="getByAppkeyAndSecretAndProduct" parameterType="java.util.Map" resultType="com.diagbot.entity.wrapper.ServiceTokenWrapper">
+        SELECT
+            st.*, ps.product_id, lp.service_status
+        FROM
+            diag_service_token st,
+            diag_product_service ps,
+            diag_service_info si,
+            diag_lantone_product lp
+        WHERE
+            st.product_service_id = ps.id
+        AND ps.service_id = si.id
+        AND ps.product_id = lp.id
+        AND st.is_deleted = 'N'
+        AND ps.is_deleted = 'N'
+        AND si.is_deleted = 'N'
+        AND lp.is_deleted = 'N'
+        AND ps.product_id = #{productId}
+        AND st.app_key_id = #{appkey} and st.app_key_secret = #{secret}
+    </select>
 </mapper>

+ 16 - 3
diagbotman-service/src/main/resources/mapper/UserRenewalsMapper.xml

@@ -31,10 +31,10 @@
         <if test="renewalsInfosVO.renewalsStatus != null">
               AND renewals_status = #{renewalsInfosVO.renewalsStatus}
         </if>
-        <if test="renewalsInfosVO.startTime != null and renewalsInfosVO.endTime != null">
+        <if test="renewalsInfosVO.startTime != null and renewalsInfosVO.endTime != ''">
             AND apply_time BETWEEN #{renewalsInfosVO.startTime} and #{renewalsInfosVO.endTime}
         </if>
-        <if test="renewalsInfosVO.cancelRenewals != null and renewalsInfosVO.cancelRenewals != null">
+        <if test="renewalsInfosVO.cancelRenewals != null">
             AND cancel_renewals = #{renewalsInfosVO.cancelRenewals}
         </if>
         <if test="renewalsInfosVO.userId != null and renewalsInfosVO.userId.size > 0">
@@ -42,6 +42,9 @@
                 user_id = #{renewalsInfosVO.userId}
             </foreach>
         </if>
+        <if test="renewalsInfosVO.productId != null and renewalsInfosVO.productId != ''">
+            AND product_id = #{renewalsInfosVO.productId}
+        </if>
         ORDER BY apply_time DESC
     </select>
 
@@ -51,8 +54,18 @@
 	  <trim prefix="set" suffixOverrides=",">
 	  <if test="gmtModified != null">a.gmt_modified = #{gmtModified} ,</if>
 	  <if test="modifier != null">a.modifier = #{modifier},</if> 
-	  <if test="renewalsStatus != null">a.renewals_status = #{renewalsStatus} </if>
+	  <if test="renewalsStatus != null">a.renewals_status = #{renewalsStatus},</if>
+      <if test="endTime != null">a.end_time = #{endTime}</if>
 	  </trim>
 	  WHERE a.renewals_no = #{renewalsNo}
 </update>
+    <select id="getUserWaitingRenewal"   resultType="java.lang.Integer">
+	SELECT COUNT(*) FROM diag_user_renewals 
+	WHERE 
+	is_deleted = 'N' 
+	AND renewals_status = 0 
+	AND cancel_renewals = 0 
+	AND product_id = #{productId}
+	AND user_id = #{userId}
+    </select>
 </mapper>

文件差異過大導致無法顯示
+ 7 - 6
docs/003.20181024初始化脚本/init_diagbotcloud.sql


+ 8 - 0
eureka-server/src/main/resources/application-pro.yml

@@ -0,0 +1,8 @@
+server:
+  port: 8761
+eureka:
+  client:
+    register-with-eureka: false
+    fetch-registry: false
+    serviceUrl:
+      defaultZone: http://eureka1:${server.port}/eureka/

+ 4 - 0
gateway-service/pom.xml

@@ -79,6 +79,10 @@
             <groupId>org.springframework.cloud</groupId>
             <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-stream-rabbit</artifactId>
+        </dependency>
         <dependency>
             <groupId>com.diagbot</groupId>
             <artifactId>common</artifactId>

+ 2 - 1
gateway-service/src/main/java/com/diagbot/client/DiagbotmanServiceClient.java

@@ -2,6 +2,7 @@ package com.diagbot.client;
 
 import com.diagbot.client.hystrix.DiagbotmanServiceHystrix;
 import com.diagbot.dto.RespDTO;
+import com.diagbot.entity.HasPermissionDTO;
 import com.diagbot.entity.ServiceFilter;
 import com.diagbot.entity.ServiceToken;
 import org.springframework.cloud.openfeign.FeignClient;
@@ -23,7 +24,7 @@ public interface DiagbotmanServiceClient {
     RespDTO<List<ServiceFilter>> getAll();
 
     @PostMapping("/serviceToken/hasPermission")
-    RespDTO<Boolean> hasPermission(@RequestBody ServiceToken st);
+    RespDTO<HasPermissionDTO> hasPermission(@RequestBody ServiceToken st);
 
 }
 

+ 2 - 1
gateway-service/src/main/java/com/diagbot/client/hystrix/DiagbotmanServiceHystrix.java

@@ -3,6 +3,7 @@ package com.diagbot.client.hystrix;
 
 import com.diagbot.client.DiagbotmanServiceClient;
 import com.diagbot.dto.RespDTO;
+import com.diagbot.entity.HasPermissionDTO;
 import com.diagbot.entity.ServiceToken;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Component;
@@ -24,7 +25,7 @@ public class DiagbotmanServiceHystrix implements DiagbotmanServiceClient {
     }
 
     @Override
-    public RespDTO<Boolean> hasPermission(@RequestBody ServiceToken st) {
+    public RespDTO<HasPermissionDTO> hasPermission(@RequestBody ServiceToken st) {
         log.error("【hystrix】调用{}异常", "hasPermisson");
         return null;
     }

+ 2 - 0
gateway-service/src/main/java/com/diagbot/client/hystrix/UserServiceHystrix.java

@@ -14,9 +14,11 @@ import org.springframework.stereotype.Component;
 @Component
 @Slf4j
 public class UserServiceHystrix implements UserServiceClient {
+
     @Override
     public RespDTO login(String username, String password) {
         log.error("【hystrix】调用{}异常", "login");
         return null;
     }
+
 }

+ 22 - 0
gateway-service/src/main/java/com/diagbot/entity/HasPermissionDTO.java

@@ -0,0 +1,22 @@
+package com.diagbot.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+
+/**
+ * @Description: 是否有权限返回类
+ * @Author: ztg
+ * @Date: 2018/9/20 10:32
+ */
+
+@Getter
+@Setter
+public class HasPermissionDTO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private Boolean hasPermission ;//标志
+    private String userId;         //用户ID
+}

+ 1 - 1
gateway-service/src/main/java/com/diagbot/entity/ServiceFilter.java

@@ -15,7 +15,7 @@ import java.io.Serializable;
 public class ServiceFilter implements Serializable {
 
     private static final long serialVersionUID = 1L;
-    private String name;
+    private String serviceName;
     private Long productId;
 
 

+ 192 - 0
gateway-service/src/main/java/com/diagbot/entity/SysLog.java

@@ -0,0 +1,192 @@
+package com.diagbot.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 系统操作日志表
+ * </p>
+ *
+ * @author gaodm
+ * @since 2018-09-14
+ */
+public class SysLog implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 日志ID
+     */
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 访问者的IP
+     */
+    private String ip;
+
+    /**
+     * 访问的系统类型 1:user-service,2:diagbotman-service,3:uaa-service,4:log-service,5:bi-service,6:knowledge-service,7:feedback-service,8:icss-web
+     */
+    private Integer sysType;
+
+    /**
+     * 方法
+     */
+    private String method;
+
+    /**
+     * 操作名
+     */
+    private String operation;
+
+    /**
+     * 参数
+     */
+    private String params;
+
+    /**
+     * 用户名
+     */
+    private String username;
+
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getIsDeleted() {
+        return isDeleted;
+    }
+
+    public void setIsDeleted(String isDeleted) {
+        this.isDeleted = isDeleted;
+    }
+
+    public Date getGmtCreate() {
+        return gmtCreate;
+    }
+
+    public void setGmtCreate(Date gmtCreate) {
+        this.gmtCreate = gmtCreate;
+    }
+
+    public Date getGmtModified() {
+        return gmtModified;
+    }
+
+    public void setGmtModified(Date gmtModified) {
+        this.gmtModified = gmtModified;
+    }
+
+    public String getCreator() {
+        return creator;
+    }
+
+    public void setCreator(String creator) {
+        this.creator = creator;
+    }
+
+    public String getModifier() {
+        return modifier;
+    }
+
+    public void setModifier(String modifier) {
+        this.modifier = modifier;
+    }
+
+    public String getIp() {
+        return ip;
+    }
+
+    public void setIp(String ip) {
+        this.ip = ip;
+    }
+
+    public Integer getSysType() {
+        return sysType;
+    }
+
+    public void setSysType(Integer sysType) {
+        this.sysType = sysType;
+    }
+
+    public String getMethod() {
+        return method;
+    }
+
+    public void setMethod(String method) {
+        this.method = method;
+    }
+
+    public String getOperation() {
+        return operation;
+    }
+
+    public void setOperation(String operation) {
+        this.operation = operation;
+    }
+
+    public String getParams() {
+        return params;
+    }
+
+    public void setParams(String params) {
+        this.params = params;
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    @Override
+    public String toString() {
+        return "SysLog{" +
+                "id=" + id +
+                ", isDeleted=" + isDeleted +
+                ", gmtCreate=" + gmtCreate +
+                ", gmtModified=" + gmtModified +
+                ", creator=" + creator +
+                ", modifier=" + modifier +
+                ", ip=" + ip +
+                ", sysType=" + sysType +
+                ", method=" + method +
+                ", operation=" + operation +
+                ", params=" + params +
+                ", username=" + username +
+                "}";
+    }
+}

+ 21 - 0
gateway-service/src/main/java/com/diagbot/entity/Token.java

@@ -0,0 +1,21 @@
+package com.diagbot.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+
+/**
+ * @Description: token
+ * @Author: ztg
+ * @Date: 2018/9/19 13:14
+ */
+@Getter
+@Setter
+public class Token implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private String token;
+
+}

+ 30 - 7
gateway-service/src/main/java/com/diagbot/filter/GlobalGatewayFilter.java

@@ -1,9 +1,13 @@
 package com.diagbot.filter;
 
 import com.diagbot.client.DiagbotmanServiceClient;
-import com.diagbot.client.UserServiceClient;
 import com.diagbot.dto.RespDTO;
+import com.diagbot.entity.HasPermissionDTO;
+import com.diagbot.entity.ServiceFilter;
 import com.diagbot.entity.ServiceToken;
+import com.diagbot.entity.SysLog;
+import com.diagbot.enums.SysTypeEnum;
+import com.diagbot.rabbit.MySender;
 import com.diagbot.util.GsonUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -22,6 +26,7 @@ import reactor.core.publisher.Mono;
 
 import java.net.URI;
 import java.nio.charset.StandardCharsets;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedHashSet;
@@ -44,10 +49,10 @@ public class GlobalGatewayFilter implements GlobalFilter {
     @Value("${lantone.product}")
     private String lantonePrduct;
 
-    @Autowired
-    UserServiceClient userServiceClient;
     @Autowired
     DiagbotmanServiceClient diagbotmanServiceClient;
+    @Autowired
+    private MySender mySender;
 
 
     @Override
@@ -83,20 +88,38 @@ public class GlobalGatewayFilter implements GlobalFilter {
         //            }
         //        }
 
+
+
+
         Map<String, Long> serviceFilters = this.dealServiceFilter();
         if (serviceFilters.get(serviceName) != null) {
-            String appkey = request.getHeaders().getFirst("appkey");
-            String secret = request.getHeaders().getFirst("secret");
-            Long productId = SERVICE_FILTER.get(serviceName);
+            String appkey = request.getHeaders().getFirst("appKeyId");
+            String secret = request.getHeaders().getFirst("appKeySecret");
+            Long productId = serviceFilters.get(serviceName);
             //获取appkey,secret对应的权限信息
             ServiceToken st = new ServiceToken();
             st.setAppkey(appkey);
             st.setSecret(secret);
             st.setProductId(productId);
-            RespDTO<Boolean> res = diagbotmanServiceClient.hasPermission(st);
+            RespDTO<HasPermissionDTO> res = diagbotmanServiceClient.hasPermission(st);
             if (res == null || !RespDTO.TRUE_CODE.equals(res.code)) {
                 return getVoidMono(serverWebExchange, res);
             }
+
+            //记录日志
+            SysLog sysLog = new SysLog();
+            sysLog.setGmtCreate(new Date());
+            sysLog.setIp(request.getRemoteAddress().toString());
+            sysLog.setMethod(requestUri);
+            ServiceFilter serviceFilter = new ServiceFilter();
+            serviceFilter.setServiceName(serviceName);
+            serviceFilter.setProductId(productId);
+            sysLog.setOperation(GsonUtil.toJson(serviceFilter));
+            sysLog.setParams(requestUri);
+            sysLog.setSysType(SysTypeEnum.APPKEY.getKey());
+            sysLog.setUsername(res.data.getUserId());
+            mySender.outputLogSend(sysLog);
+
         }
 
         ServerHttpRequest.Builder builder = serverWebExchange.getRequest().mutate();

+ 23 - 0
gateway-service/src/main/java/com/diagbot/rabbit/MyProcessor.java

@@ -0,0 +1,23 @@
+package com.diagbot.rabbit;
+
+import org.springframework.cloud.stream.annotation.Input;
+import org.springframework.cloud.stream.annotation.Output;
+import org.springframework.messaging.MessageChannel;
+import org.springframework.messaging.SubscribableChannel;
+
+/**
+ * @Description: 自定义Stream发布和消费对象
+ * @author: gaodm
+ * @time: 2018/8/29 13:39
+ */
+public interface MyProcessor {
+
+    String INPUT_LOG = "inputLog";
+    String OUTPUT_LOG = "outputLog";
+
+    @Input(INPUT_LOG)
+    SubscribableChannel inputLog();
+
+    @Output(OUTPUT_LOG)
+    MessageChannel outputLog();
+}

+ 27 - 0
gateway-service/src/main/java/com/diagbot/rabbit/MySender.java

@@ -0,0 +1,27 @@
+package com.diagbot.rabbit;
+
+import com.diagbot.entity.SysLog;
+import com.diagbot.util.GsonUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.cloud.stream.annotation.EnableBinding;
+import org.springframework.integration.support.MessageBuilder;
+import org.springframework.messaging.MessageChannel;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description: 发布者
+ * @author: gaodm
+ * @time: 2018/8/29 13:41
+ */
+@Component
+@EnableBinding({ MyProcessor.class })
+public class MySender {
+    @Autowired
+    @Qualifier("outputLog")
+    MessageChannel outputLog;
+
+    public void outputLogSend(SysLog sysLog) {
+        outputLog.send(MessageBuilder.withPayload(GsonUtil.toJson(sysLog)).build());
+    }
+}

+ 1 - 1
triage-service/src/main/java/com/diagbot/client/AIServiceClient.java

@@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RequestBody;
  * @author: gaodm
  * @time: 2018/10/25 9:56
  */
-@FeignClient(name = "AI", url = "http://192.168.2.234:8080", fallback = AIServiceHystrix.class)
+@FeignClient(name = "AI", url = "${ai.server.address}", fallback = AIServiceHystrix.class)
 public interface AIServiceClient {
 
     @PostMapping(value = "/web/doc/algorithm/neural")

+ 1 - 1
uaa-service/src/main/resources/mapper/UserMapper.xml

@@ -30,6 +30,6 @@
     <select id="getByUserName" parameterType="java.lang.String" resultMap="userMap">
 		select u.*
 		from sys_user u
-        where u.username= #{username}
+        where is_deleted = 'N' and u.username= #{username}
 	</select>
 </mapper>

+ 8 - 2
user-service/src/main/java/com/diagbot/client/DiagbotmanClient.java

@@ -7,7 +7,7 @@ import org.springframework.web.bind.annotation.PostMapping;
 
 import com.diagbot.client.hystrix.DiagbotmanServiceHystrix;
 import com.diagbot.dto.RespDTO;
-import com.diagbot.dto.UserAndProdutUDTO;
+import com.diagbot.dto.UserAndProdutDTO;
 import org.springframework.web.bind.annotation.RequestBody;
 
 /**
@@ -20,6 +20,12 @@ import org.springframework.web.bind.annotation.RequestBody;
 public interface DiagbotmanClient {
 	
 	@PostMapping(value = "/productOrder/getInformationAvailableAll")
-	public RespDTO<List<UserAndProdutUDTO>> getInformationAvailableAll(@RequestBody List<Long> userIds);
+	RespDTO<List<UserAndProdutDTO>> getInformationAvailableAll(@RequestBody List<Long> userIds);
+	
+	@PostMapping(value = "/productOrder/getUserWaitingRenewal")
+	public RespDTO<Integer> getUserWaitingRenewal(@RequestBody Long userId);
+	
+	@PostMapping(value = "/productOrder/getOrderByUserToAudit")
+	public RespDTO<Integer> getOrderByUserToAudit(@RequestBody Long userId);
 
 }

+ 14 - 2
user-service/src/main/java/com/diagbot/client/hystrix/DiagbotmanServiceHystrix.java

@@ -7,7 +7,7 @@ import org.springframework.stereotype.Component;
 
 import com.diagbot.client.DiagbotmanClient;
 import com.diagbot.dto.RespDTO;
-import com.diagbot.dto.UserAndProdutUDTO;
+import com.diagbot.dto.UserAndProdutDTO;
 
 import lombok.extern.slf4j.Slf4j;
 /**
@@ -21,9 +21,21 @@ import lombok.extern.slf4j.Slf4j;
 public class DiagbotmanServiceHystrix implements DiagbotmanClient {
 	
 	@Override
-	public RespDTO<List<UserAndProdutUDTO>> getInformationAvailableAll(List<Long> userIds){
+	public RespDTO<List<UserAndProdutDTO>> getInformationAvailableAll(List<Long> userIds){
 		 log.error("【hystrix】调用{}异常","getInformationAvailableAll");
 	        return null;
 	}
 
+	@Override
+	public RespDTO<Integer> getUserWaitingRenewal(Long userId) {
+		log.error("【hystrix】调用{}异常","getInformationAvailableAll");
+		return null;
+	}
+
+	@Override
+	public RespDTO<Integer> getOrderByUserToAudit(Long userId) {
+		log.error("【hystrix】调用{}异常","getInformationAvailableAll");
+		return null;
+	}
+
 }

+ 0 - 0
user-service/src/main/java/com/diagbot/config/RedisConfigurer.java


部分文件因文件數量過多而無法顯示