comtikaweb 4 years ago
parent
commit
fc604fe510
100 changed files with 1555 additions and 1013 deletions
  1. 2 2
      ctkcloud-advertising-service/pom.xml
  2. 4 0
      ctkcloud-advertising-service/src/main/resources/application.yml
  3. 3 5
      ctkcloud-advertising-service/src/main/resources/bootstrap.yml
  4. 2 2
      ctkcloud-ali-service/pom.xml
  5. 0 1
      ctkcloud-ali-service/src/main/java/com/comtika/ctkcloud/server/AlipayApplication.java
  6. 4 0
      ctkcloud-ali-service/src/main/resources/application.yml
  7. 0 77
      ctkcloud-ali-service/src/main/resources/application.yml.bak
  8. 3 5
      ctkcloud-ali-service/src/main/resources/bootstrap.yml
  9. 7 5
      ctkcloud-common/pom.xml
  10. 59 3
      ctkcloud-common/src/main/java/com/comtika/ctkcloud/common/util/TimeUtil.java
  11. 82 0
      ctkcloud-common/src/main/java/com/comtika/ctkcloud/server/auth/UserAuthHandle.java
  12. 4 0
      ctkcloud-common/src/main/java/com/comtika/ctkcloud/server/auth/entity/CommonEntity.java
  13. 9 0
      ctkcloud-common/src/main/java/com/comtika/ctkcloud/server/auth/entity/FindAuthHelpVo.java
  14. 4 2
      ctkcloud-upload-service/src/main/java/com/comtika/ctkcloud/server/entity/UserSiteMerchant.java
  15. 28 0
      ctkcloud-common/src/main/java/com/comtika/ctkcloud/server/dao/CommonDao.java
  16. 0 20
      ctkcloud-common/src/main/java/com/comtika/ctkcloud/server/db/DataSourceConfig.java
  17. 1 1
      ctkcloud-common/src/main/java/com/comtika/ctkcloud/server/entity/mybank/CtkRefund.java
  18. 2 2
      ctkcloud-common/src/main/java/com/comtika/ctkcloud/server/entity/order/CtkRechargeOrder.java
  19. 27 0
      ctkcloud-common/src/main/resources/sql/commonKtjAuth.md
  20. 9 9
      ctkcloud-config-service/pom.xml
  21. 0 1
      ctkcloud-config-service/src/main/java/com/comtika/ctkcloud/server/ConfigApplication.java
  22. 8 16
      ctkcloud-config-service/src/main/resources/application.yml
  23. 2 2
      ctkcloud-customer-service/pom.xml
  24. 7 9
      ctkcloud-customer-service/src/main/java/com/comtika/ctkcloud/server/controller/customer/CustomerOpinionController.java
  25. 9 8
      ctkcloud-customer-service/src/main/resources/application.yml
  26. 3 5
      ctkcloud-customer-service/src/main/resources/bootstrap.yml
  27. 6 6
      ctkcloud-equip-service/pom.xml
  28. 0 9
      ctkcloud-equip-service/src/main/java/com/comtika/ctkcloud/server/EquipServerApplication.java
  29. 11 10
      ctkcloud-equip-service/src/main/java/com/comtika/ctkcloud/server/controller/EquipTerminalController.java
  30. 11 10
      ctkcloud-equip-service/src/main/java/com/comtika/ctkcloud/server/service/equip/EquipTerminalService.java
  31. 29 39
      ctkcloud-equip-service/src/main/java/com/comtika/ctkcloud/server/service/equip/impl/EquipTerminalServiceImpl.java
  32. 0 39
      ctkcloud-equip-service/src/main/resources/application.properties.bak
  33. 5 1
      ctkcloud-equip-service/src/main/resources/application.yml
  34. 4 6
      ctkcloud-equip-service/src/main/resources/bootstrap.yml
  35. 7 5
      ctkcloud-eureka-server/pom.xml
  36. 22 5
      ctkcloud-eureka-server/src/main/resources/application.yml
  37. 15 0
      ctkcloud-eureka-server/src/main/resources/application.yml.bak
  38. 0 33
      ctkcloud-eureka-server/src/main/resources/application.yml.bankk
  39. 0 3
      ctkcloud-eureka-server/src/main/resources/bootstrap.properties
  40. 0 70
      ctkcloud-eureka-server/src/main/resources/logback-spring.xml.bak
  41. 2 2
      ctkcloud-instructions-service/pom.xml
  42. 5 1
      ctkcloud-instructions-service/src/main/resources/application.yml
  43. 4 2
      ctkcloud-instructions-service/src/main/resources/bootstrap.yml
  44. 2 2
      ctkcloud-logs-service/pom.xml
  45. 1 2
      ctkcloud-logs-service/src/main/java/com/comtika/ctkcloud/server/config/es/SearchESUtil.java
  46. 3 4
      ctkcloud-logs-service/src/main/java/com/comtika/ctkcloud/server/service/LogsServiceImpl.java
  47. 5 1
      ctkcloud-logs-service/src/main/resources/application.yml
  48. 3 5
      ctkcloud-logs-service/src/main/resources/bootstrap.yml
  49. 4 4
      ctkcloud-merchant-service/pom.xml
  50. 3 5
      ctkcloud-merchant-service/src/main/resources/bootstrap.yml
  51. 2 8
      ctkcloud-messagepush-service/pom.xml
  52. 3 2
      ctkcloud-messagepush-service/src/main/java/com/comtika/ctkcloud/server/base/config/MessageConfig.java
  53. 9 2
      ctkcloud-messagepush-service/src/main/java/com/comtika/ctkcloud/server/controller/message/MessagePushController.java
  54. 17 3
      ctkcloud-messagepush-service/src/main/java/com/comtika/ctkcloud/server/controller/wx/WxchatHandleController.java
  55. 15 32
      ctkcloud-messagepush-service/src/main/java/com/comtika/ctkcloud/server/core/MessageHandleUtil.java
  56. 33 0
      ctkcloud-messagepush-service/src/main/java/com/comtika/ctkcloud/server/core/cache/MessageCache.java
  57. 10 4
      ctkcloud-messagepush-service/src/main/java/com/comtika/ctkcloud/server/core/mq/WarnChannelAwareMessageListener.java
  58. 9 4
      ctkcloud-messagepush-service/src/main/java/com/comtika/ctkcloud/server/dao/MessagePushDao.java
  59. 1 1
      ctkcloud-messagepush-service/src/main/java/com/comtika/ctkcloud/server/dao/WarnRecordDao.java
  60. 7 0
      ctkcloud-messagepush-service/src/main/java/com/comtika/ctkcloud/server/dao/WxOpenTypeDao.java
  61. 2 0
      ctkcloud-messagepush-service/src/main/java/com/comtika/ctkcloud/server/entity/third/SysUserThirdId.java
  62. 33 0
      ctkcloud-messagepush-service/src/main/java/com/comtika/ctkcloud/server/entity/third/WxOpenType.java
  63. 3 0
      ctkcloud-messagepush-service/src/main/java/com/comtika/ctkcloud/server/service/MessageService.java
  64. 2 6
      ctkcloud-messagepush-service/src/main/java/com/comtika/ctkcloud/server/service/WarnRecordService.java
  65. 3 1
      ctkcloud-messagepush-service/src/main/java/com/comtika/ctkcloud/server/service/WxChatHandleService.java
  66. 354 331
      ctkcloud-messagepush-service/src/main/java/com/comtika/ctkcloud/server/service/impl/MessageServiceImpl.java
  67. 9 16
      ctkcloud-messagepush-service/src/main/java/com/comtika/ctkcloud/server/service/impl/WarnRecordServiceImpl.java
  68. 54 5
      ctkcloud-messagepush-service/src/main/java/com/comtika/ctkcloud/server/service/impl/WxChatHandleServiceImpl.java
  69. 4 2
      ctkcloud-messagepush-service/src/main/java/com/comtika/ctkcloud/server/util/MessageDataHandle.java
  70. 3 1
      ctkcloud-messagepush-service/src/main/resources/bootstrap.yml
  71. 10 2
      ctkcloud-messagepush-service/src/main/resources/sql/warn/record.md
  72. 2 2
      ctkcloud-mybank-service/pom.xml
  73. 121 54
      ctkcloud-mybank-service/src/main/java/com/comtika/ctkcloud/server/core/ComtikaHttpsUtil.java
  74. 8 1
      ctkcloud-mybank-service/src/main/java/com/comtika/ctkcloud/server/core/timer/RefundTimeScheduled.java
  75. 4 0
      ctkcloud-mybank-service/src/main/java/com/comtika/ctkcloud/server/dao/pay/PrePayDao.java
  76. 7 0
      ctkcloud-mybank-service/src/main/java/com/comtika/ctkcloud/server/dao/sep/KtjSepUserDao.java
  77. 15 0
      ctkcloud-mybank-service/src/main/java/com/comtika/ctkcloud/server/entity/sep/KtjSepUser.java
  78. 18 0
      ctkcloud-mybank-service/src/main/java/com/comtika/ctkcloud/server/entity/sep/UserSepReceiver.java
  79. 9 0
      ctkcloud-mybank-service/src/main/java/com/comtika/ctkcloud/server/entity/sep/help/SepQueryHelp.java
  80. 15 0
      ctkcloud-mybank-service/src/main/java/com/comtika/ctkcloud/server/entity/sep/help/SepReceiverHelp.java
  81. 6 6
      ctkcloud-mybank-service/src/main/java/com/comtika/ctkcloud/server/entity/sepAccount/CtkReceiveUser.java
  82. 2 2
      ctkcloud-mybank-service/src/main/java/com/comtika/ctkcloud/server/entity/sepAccount/SepReceiverHelp.java
  83. 71 43
      ctkcloud-mybank-service/src/main/java/com/comtika/ctkcloud/server/service/dafeng/impl/DaFengServiceImpl.java
  84. 10 1
      ctkcloud-mybank-service/src/main/java/com/comtika/ctkcloud/server/service/refund/MybankRefundServiceImpl.java
  85. 18 5
      ctkcloud-mybank-service/src/main/java/com/comtika/ctkcloud/server/service/sepAccount/impl/SepAccountServiceImpl.java
  86. 18 0
      ctkcloud-mybank-service/src/main/java/com/comtika/ctkcloud/server/service/wxSep/IWxSepService.java
  87. 156 0
      ctkcloud-mybank-service/src/main/java/com/comtika/ctkcloud/server/service/wxSep/impl/WxSepServiceImpl.java
  88. 4 4
      ctkcloud-mybank-service/src/main/java/com/comtika/ctkcloud/server/web/SepAccountController.java
  89. 13 2
      ctkcloud-mybank-service/src/main/java/com/comtika/ctkcloud/server/web/UploadController.java
  90. 3 5
      ctkcloud-mybank-service/src/main/resources/bootstrap.yml
  91. 27 1
      ctkcloud-mybank-service/src/main/resources/sql/recharge/order.md
  92. 2 2
      ctkcloud-oauth-server/pom.xml
  93. 3 4
      ctkcloud-oauth-server/src/main/resources/bootstrap.yml
  94. 2 2
      ctkcloud-order-service/pom.xml
  95. 4 6
      ctkcloud-order-service/src/main/resources/bootstrap.yml
  96. 2 2
      ctkcloud-platform-service/pom.xml
  97. 4 6
      ctkcloud-platform-service/src/main/resources/bootstrap.yml
  98. 2 2
      ctkcloud-protocol-service/pom.xml
  99. 5 4
      ctkcloud-protocol-service/src/main/java/com/comtika/ctkcloud/server/core/eunms/OperationCode.java
  100. 0 0
      ctkcloud-protocol-service/src/main/java/com/comtika/ctkcloud/server/core/netty/NettyServerHandle.java

+ 2 - 2
ctkcloud-advertising-service/pom.xml

@@ -59,12 +59,12 @@
 				<artifactId>docker-maven-plugin</artifactId>
 				<version>0.4.13</version>
 				<configuration>
-					<imageName>${docker.aliyun.registry}/${docker.aliyun.name}/${project.artifactId}:5.0.3</imageName>
+					<imageName>${docker.aliyun.registry}/${docker.aliyun.name}/${project.artifactId}:6.0.0</imageName>
 					<!-- <dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory> -->
 					<!-- 如果有相同的覆盖 -->
 					<forceTags>true</forceTags>
 					<baseImage>java</baseImage>
-					<entryPoint>["java","-jar","-XX:+UseG1GC","-XX:+PrintGCDetails","-XX:+PrintGCTimeStamps","-XX:+PrintGCDateStamps","-Xloggc:/protocol.log","-Xms256m","-Xmx256m","-XX:MetaspaceSize=256m","-XX:MaxMetaspaceSize=256m","/${project.build.finalName}.jar"]</entryPoint>
+					<entryPoint>["java","-jar","-XX:+PrintGCDetails","-XX:+PrintGCTimeStamps","-XX:+PrintGCDateStamps","-Xloggc:/protocol.log","-Xms256m","-Xmx256m","-XX:MetaspaceSize=256m","-XX:MaxMetaspaceSize=256m","/${project.build.finalName}.jar"]</entryPoint>
 					<dockerHost>${docker.url}</dockerHost>
 					<registryUrl>${docker.aliyun.registry}</registryUrl>
 					<serverId>docker_actor</serverId>

+ 4 - 0
ctkcloud-advertising-service/src/main/resources/application.yml

@@ -22,3 +22,7 @@ server:
   port: 9034
 spring:
   profiles: s5
+---
+spring:
+  profiles:
+    active: s1

+ 3 - 5
ctkcloud-advertising-service/src/main/resources/bootstrap.yml

@@ -1,11 +1,8 @@
 spring:
   application:
     name: advertising-service
-  tcpUrl: db.comtti.net:9250
-#默认是 是0.1 zikpin采样百分比 前期使用1
-  sleuth:
-    sampler:
-      percentage = 0.5
+  tcpUrl: 172.16.0.11:9250
+  #tcpUrl: 193.112.16.187:9250
 # cloud 配置中心地址
   cloud:
     config:
@@ -22,3 +19,4 @@ eureka:
   client:
     serviceUrl:
       defaultZone: http://admin:comtika2018@peer1:8761/eureka/,http://admin:comtika2018@peer2:8762/eureka/
+#      defaultZone: http://admin:comtika2018@peer1:8761/eureka/

+ 2 - 2
ctkcloud-ali-service/pom.xml

@@ -83,12 +83,12 @@
 				<artifactId>docker-maven-plugin</artifactId>
 				<version>0.4.13</version>
 				<configuration>
-					<imageName>${docker.aliyun.registry}/${docker.aliyun.name}/${project.artifactId}:5.0.3</imageName>
+					<imageName>${docker.aliyun.registry}/${docker.aliyun.name}/${project.artifactId}:6.0.0</imageName>
 					<!-- <dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory> -->
 					<!-- 如果有相同的覆盖 -->
 					<forceTags>true</forceTags>
 					<baseImage>java</baseImage>
-					<entryPoint>["java","-jar","-XX:+PrintGCDetails","-XX:+PrintGCTimeStamps","-XX:+PrintGCDateStamps","-Xloggc:./upload.log","-XX:+UseG1GC","-Xms128m","-Xmx128m","-XX:MetaspaceSize=128m","-XX:MaxMetaspaceSize=128m","/${project.build.finalName}.jar"]</entryPoint>
+					<entryPoint>["java","-jar","-XX:+PrintGCDetails","-XX:+PrintGCTimeStamps","-XX:+PrintGCDateStamps","-Xloggc:./upload.log","-Xms128m","-Xmx128m","-XX:MetaspaceSize=128m","-XX:MaxMetaspaceSize=128m","/${project.build.finalName}.jar"]</entryPoint>
 					<dockerHost>${docker.url}</dockerHost>
 					<registryUrl>${docker.aliyun.registry}</registryUrl>
 					<serverId>docker_actor</serverId>

+ 0 - 1
ctkcloud-ali-service/src/main/java/com/comtika/ctkcloud/server/AlipayApplication.java

@@ -20,7 +20,6 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
 @SpringBootApplication
 @EnableEurekaClient
 @EnableFeignClients
-
 @EnableDiscoveryClient//熔断器
 @EnableHystrix
 @EnableSwagger2

+ 4 - 0
ctkcloud-ali-service/src/main/resources/application.yml

@@ -21,3 +21,7 @@ spring:
 server:
   port: 8999
   profiles: s5
+---
+spring:
+  profiles:
+    active: s1

File diff suppressed because it is too large
+ 0 - 77
ctkcloud-ali-service/src/main/resources/application.yml.bak


+ 3 - 5
ctkcloud-ali-service/src/main/resources/bootstrap.yml

@@ -1,11 +1,8 @@
 spring:
   application:
     name: ali-service
-  tcpUrl: db.comtti.net:9250
-#默认是 是0.1 zikpin采样百分比 前期使用1
-  sleuth:
-    sampler:
-      percentage = 0.5
+  tcpUrl: 172.16.0.11:9250
+  #tcpUrl: 193.112.16.187:9250
 #配置中心地址
   cloud:
     config:
@@ -22,3 +19,4 @@ eureka:
   client:
     serviceUrl:
       defaultZone: http://admin:comtika2018@peer1:8761/eureka/,http://admin:comtika2018@peer2:8762/eureka/
+#      defaultZone: http://admin:comtika2018@peer1:8761/eureka/

+ 7 - 5
ctkcloud-common/pom.xml

@@ -98,14 +98,15 @@
 			<artifactId>spring-cloud-starter-ribbon</artifactId>
 		</dependency>
 		<!-- zipkin 使用rabbitmq -->
-		<dependency>
+		<!--腾讯云去掉 zipkin 2020 02 27-->
+		<!--<dependency>
 			<groupId>org.springframework.cloud</groupId>
 			<artifactId>spring-cloud-sleuth-stream</artifactId>
 		</dependency>
 		<dependency>
 			<groupId>org.springframework.cloud</groupId>
 			<artifactId>spring-cloud-starter-sleuth</artifactId>
-		</dependency>
+		</dependency>-->
 		<!--这个使用rabbit 打调用链到zipkin上 -->
 		<!--<dependency>
 			<groupId>org.springframework.cloud</groupId>
@@ -167,16 +168,17 @@
 			<groupId>org.springframework.cloud</groupId>
 			<artifactId>spring-cloud-starter-config</artifactId>
 		</dependency>
+		<!--腾讯云不启动自动更新配置,修改配置重新启动项目 2020 02 27-->
 		<!-- 配置自动更新 -->
-		<dependency>
+		<!--<dependency>
 			<groupId>org.springframework.boot</groupId>
 			<artifactId>spring-boot-starter-actuator</artifactId>
 		</dependency>
-		<!-- 使用消息总线通知 修改 -->
+		&lt;!&ndash; 使用消息总线通知 修改 &ndash;&gt;
 		<dependency>
 			<groupId>org.springframework.cloud</groupId>
 			<artifactId>spring-cloud-starter-bus-amqp</artifactId>
-		</dependency>
+		</dependency>-->
 
 		<!-- 分布式事务 测试有点卡 大于增加1秒 需寻找其他方法 -->
 		<!-- <dependency>

+ 59 - 3
ctkcloud-common/src/main/java/com/comtika/ctkcloud/common/util/TimeUtil.java

@@ -4,6 +4,7 @@ import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.Date;
+import java.util.Map;
 
 /**
  * 时间工具类
@@ -15,7 +16,7 @@ public class TimeUtil {
 	/**
 	 * 获取某个月份第一天的时间戳
 	 * @return
-	 * @throws ParseException 
+	 * @throws ParseException
 	 */
 	public static Long dateMonthToStamp(String date) throws ParseException{
 		String start = date +"-01 00:00:00";
@@ -23,13 +24,37 @@ public class TimeUtil {
 		return startDate.getTime();
 	}
 	/**
+	 * 获取某个月份第一天的时间戳
+	 * @return
+	 * @throws ParseException
+	 */
+	public static Long dateMonthToStamp(Integer month,Integer year) throws ParseException{
+		Calendar cal = Calendar.getInstance();
+		//设置年份
+		cal.set(Calendar.YEAR,year);
+		//设置月份
+		cal.set(Calendar.MONTH, month-1);
+		//设置为1号,当前日期既为本月第一天
+		cal.set(Calendar.DAY_OF_MONTH, 1);
+		//将小时至0
+		cal.set(Calendar.HOUR_OF_DAY, 0);
+		//将分钟至0
+		cal.set(Calendar.MINUTE, 0);
+		//将秒至0
+		cal.set(Calendar.SECOND,0);
+		//将毫秒至0
+		cal.set(Calendar.MILLISECOND, 0);
+
+		return cal.getTimeInMillis();
+	}
+	/**
 	 * 获取某月最后一天的的时间戳
 	 * @param month
 	 * @return
-	 * @throws ParseException 
+	 * @throws ParseException
 	 */
 	public static Long dateMonthLastDayToStamp(Integer year,Integer month) throws ParseException{
-		
+
 		Calendar cal = Calendar.getInstance();
 		//设置年份
 		cal.set(Calendar.YEAR,year);
@@ -45,4 +70,35 @@ public class TimeUtil {
 		lastDayOfMonth = lastDayOfMonth + " 23:59:59";
 		return simpleDateFormat.parse(lastDayOfMonth).getTime();
 	}
+	/**
+	 * 获取昨日日期零点和23点59分的时间戳
+	 * @throws ParseException
+	 */
+	public static void yesterdayTime(Map<String, Object> map) throws ParseException{
+		// dateToStamp(map);
+		try {
+			if (map.containsKey("startTime")) {
+				Long time = Long.parseLong(map.get("startTime").toString());
+				map.put("yesterdayStartTime", time-86400000L);
+				map.put("yesterdayEndTime",time);
+			}
+		}catch (Exception e){
+
+		}
+	}
+	/**
+	 * 获取当前日期凌晨和当前时间的时间戳
+	 * @throws ParseException
+	 */
+	public static void dateToStamp(Map<String, Object> map) throws ParseException{
+		/*SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+		SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyy-MM-dd");
+		Date date = new Date();
+		String start = simpleDateFormat1.format(date)+" 00:00:00";
+		Date startDate = simpleDateFormat.parse(start);*/
+		long startTimeOfToday = DateTimeUtils.getStartTimeOfToday();
+		map.put("startTime", startTimeOfToday);
+		map.put("endTime", System.currentTimeMillis());
+	}
+
 }

+ 82 - 0
ctkcloud-common/src/main/java/com/comtika/ctkcloud/server/auth/UserAuthHandle.java

@@ -0,0 +1,82 @@
+package com.comtika.ctkcloud.server.auth;
+
+import com.comtika.ctkcloud.common.base.constant.ProjectConstant;
+import com.comtika.ctkcloud.common.enums.platform.OrgTypeEnum;
+import com.comtika.ctkcloud.server.auth.entity.FindAuthHelpVo;
+import com.comtika.ctkcloud.server.auth.entity.UserSiteMerchant;
+import com.comtika.ctkcloud.server.dao.CommonDao;
+import com.comtika.ctkcloud.server.redis.RedisApi;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.*;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * 根据用户登录名查询用户的权限方法
+ */
+@Component
+public class UserAuthHandle {
+    @Autowired
+    private RedisApi redisApi;
+    @Autowired
+    private CommonDao commonDao;
+
+    private final static String AUTH_NAME_PREFIX = "loginName_auth_prific_%s";
+
+    public UserSiteMerchant findUserAuthByLoginName(String loginName)throws Exception{
+        // 超级管理员 不需要查询权限
+        return findUserAuthByLoginName(loginName,10L,TimeUnit.MINUTES);
+    }
+    public UserSiteMerchant findUserAuthByLoginName(String loginName,long timeOut,TimeUnit unit)throws Exception{
+        // 超级管理员 不需要查询权限
+        if(ProjectConstant.ADMIN.equals(loginName))
+            return new UserSiteMerchant();
+        String key = String.format(AUTH_NAME_PREFIX,loginName);
+        Object o = redisApi.get(key);
+        if(o != null) return (UserSiteMerchant) o;
+        UserSiteMerchant userAuth = findUserAuth(loginName);
+        if(userAuth == null) return new UserSiteMerchant();
+        redisApi.set(key,userAuth,timeOut, unit);
+        return userAuth;
+    }
+    private UserSiteMerchant findUserAuth(String loginName){
+        Long userId = commonDao.findUserIdByLoginName(loginName);
+        if(userId == null) return null;
+        Map<String,Object> tmpMap = new HashMap<>(4);
+        tmpMap.put("userId",userId);
+        List<FindAuthHelpVo> data = commonDao.findDataAccessByAdminUserId(tmpMap);
+        Set<Integer> siteIds = new HashSet<>();
+        Set<Integer> merchantIds = new HashSet<>();
+        data.forEach(s->{
+            Integer type = s.getOrgType();
+            if(type != null){
+                if(OrgTypeEnum.ORG.getId() == type){
+                    merchantIds.add(s.getId());
+                }else if(type == OrgTypeEnum.DEPART.getId()){
+                    siteIds.add(s.getId());
+                }
+            }
+        });
+        data.clear();
+        if(!siteIds.isEmpty()){
+            tmpMap.clear();
+            tmpMap.put("siteIds",siteIds);
+            List<Integer> siteIds2 = commonDao.findSiteIdBySiteOrgId(tmpMap);
+            siteIds.clear();
+            if(!siteIds2.isEmpty())
+                siteIds.addAll(siteIds2);
+            siteIds2.clear();
+        }
+        if(!merchantIds.isEmpty()){
+            tmpMap.clear();
+            tmpMap.put("merchantIds",merchantIds);
+            List<Integer> siteList = commonDao.findSiteListByMerchantId(tmpMap);
+            siteIds.addAll(siteList);
+        }
+        //站点包括所有的权限 商户只有配置的商户
+        return new UserSiteMerchant(siteIds,merchantIds);
+    }
+
+
+}

+ 4 - 0
ctkcloud-common/src/main/java/com/comtika/ctkcloud/server/auth/entity/CommonEntity.java

@@ -0,0 +1,4 @@
+package com.comtika.ctkcloud.server.auth.entity;
+
+public class CommonEntity {
+}

+ 9 - 0
ctkcloud-common/src/main/java/com/comtika/ctkcloud/server/auth/entity/FindAuthHelpVo.java

@@ -0,0 +1,9 @@
+package com.comtika.ctkcloud.server.auth.entity;
+
+import lombok.Data;
+
+@Data
+public class FindAuthHelpVo {
+    private Integer id;//id
+    private Integer orgType;//类型
+}

+ 4 - 2
ctkcloud-upload-service/src/main/java/com/comtika/ctkcloud/server/entity/UserSiteMerchant.java

@@ -1,8 +1,10 @@
-package com.comtika.ctkcloud.server.entity;
+package com.comtika.ctkcloud.server.auth.entity;
 
 import java.util.Set;
 
-/**查询权限的内部类*/
+/**
+ * 用户的站点,商户权限
+ */
 public  class UserSiteMerchant{
     public Set<Integer> sites;
     public Set<Integer> merchantIds;

+ 28 - 0
ctkcloud-common/src/main/java/com/comtika/ctkcloud/server/dao/CommonDao.java

@@ -0,0 +1,28 @@
+package com.comtika.ctkcloud.server.dao;
+
+import com.comtika.ctkcloud.server.auth.entity.CommonEntity;
+import com.comtika.ctkcloud.server.auth.entity.FindAuthHelpVo;
+import org.beetl.sql.core.annotatoin.Sql;
+import org.beetl.sql.core.annotatoin.SqlResource;
+import org.beetl.sql.core.mapper.BaseMapper;
+
+import java.util.List;
+import java.util.Map;
+
+@SqlResource("commonKtjAuth")
+public interface CommonDao extends BaseMapper<CommonEntity> {
+
+    /**
+     * 通过用户的登录名获取用户的唯一id
+     * @param loginName
+     * @return
+     */
+    @Sql(value = "select su.id from sys_user su where su.login_name = ? limit 1")
+    Long findUserIdByLoginName(String loginName);
+
+    List<FindAuthHelpVo> findDataAccessByAdminUserId(Map<String, Object> tmpMap);
+
+    List<Integer> findSiteIdBySiteOrgId(Map<String, Object> tmpMap);
+
+    List<Integer> findSiteListByMerchantId(Map<String, Object> tmpMap);
+}

+ 0 - 20
ctkcloud-common/src/main/java/com/comtika/ctkcloud/server/db/DataSourceConfig.java

@@ -29,26 +29,6 @@ public class DataSourceConfig {
     @Value("${datasource.comtika.password}")
     private String password;
 
-    //销售数据源
-   /* @Value("${datasource.sale.url}")
-    private String saleUrl;
-
-    @Value("${datasource.sale.username}")
-    private String saleUserName;
-
-    @Value("${datasource.sale.password}")
-    private String salePassword;*/
-
-    //消息数据源 start
-   /* @Value("${datasource.message.url}")
-    private String messageUrl;
-
-    @Value("${datasource.message.username}")
-    private String messageUserName;
-
-    @Value("${datasource.message.password}")
-    private String messagePassword;*/
-    //消息数据源 end
 
     @Value("${datasource.maxActive}")
     private int maxActive;

+ 1 - 1
ctkcloud-common/src/main/java/com/comtika/ctkcloud/server/entity/mybank/CtkRefund.java

@@ -53,7 +53,7 @@ public class CtkRefund {
     /**用户id**/
     private Long customerId;
 
-    /**退款渠道 1-网商 2-大风**/
+    /**退款渠道 1-网商 2-大风 3-康体佳服务商平台**/
     private Integer channelType;
 
     public Long getId() {

+ 2 - 2
ctkcloud-common/src/main/java/com/comtika/ctkcloud/server/entity/order/CtkRechargeOrder.java

@@ -59,9 +59,9 @@ public class CtkRechargeOrder extends BaseModel
 
     private Long merchantId;//商户id
 
-    private Integer  channelType;//渠道类型,1-网商,2大风
+    private Integer  channelType;//渠道类型,1-网商,2大风,3康体佳服务商平台
 
-    private Integer daFengStatus;//大风订单确认状态
+    private Integer daFengStatus;//大风订单确认状态,0未确认。1已确认
 
     public Long getId() {
         return id;

+ 27 - 0
ctkcloud-common/src/main/resources/sql/commonKtjAuth.md

@@ -0,0 +1,27 @@
+
+findDataAccessByAdminUserId
+===
+SELECT
+	m.id,m.org_type
+FROM
+	sys_org_merchant m
+WHERE m.id=(select u.org_id from sys_user u where u.id = #userId#)
+OR m.id IN (
+	SELECT org_id FROM sys_role_org orole
+		WHERE ( orole.type = 2 AND orole.user_id = #userId# )
+		OR ( orole.type = 1 AND orole.role_id IN 
+			(
+				SELECT urole.role_id
+				FROM sys_role_user urole
+				WHERE urole.user_id = #userId# 
+			)
+	)
+)
+
+findSiteIdBySiteOrgId
+===
+select id FROM ctk_site where org_id in (#join(siteIds)#)
+
+findSiteListByMerchantId
+===
+select cs.id from ctk_site cs where cs.merchant_id in (#join(merchantIds)#)

+ 9 - 9
ctkcloud-config-service/pom.xml

@@ -6,7 +6,7 @@
     	<artifactId>ctkcloud</artifactId>
     	<version>0.0.1-SNAPSHOT</version>
 	</parent>
-	<distributionManagement>
+	<!--<distributionManagement>
 		<repository>
 			<id>maven-release</id>
 			<name>User Project Release</name>
@@ -17,13 +17,13 @@
 			<name>User Project SNAPSHOTS</name>
 			<url>http://192.168.1.182:8081/nexus/content/repositories/snapshots/</url>
 		</snapshotRepository>
-	</distributionManagement>
+	</distributionManagement>-->
 	<dependencies>
 		<!-- springboot web -->
 		<dependency>
 			<groupId>org.springframework.boot</groupId>
 			<artifactId>spring-boot-starter-web</artifactId>
-		</dependency> 
+		</dependency>
 			<!-- eureka 客户端 -->
 		<dependency>
 			<groupId>org.springframework.cloud</groupId>
@@ -35,16 +35,16 @@
 			<artifactId>spring-cloud-config-server</artifactId>
 		</dependency>
 		<!--springcloud bus  -->
-		<dependency>
+		<!--<dependency>
 			<groupId>org.springframework.cloud</groupId>
 			<artifactId>spring-cloud-starter-bus-amqp</artifactId>
-		</dependency>
+		</dependency>-->
 		<!--security  安全验证  -->
 		<dependency>
 			<groupId>org.springframework.boot</groupId>
 			<artifactId>spring-boot-starter-security</artifactId>
 		</dependency>
-		
+
 	</dependencies>
 	<build>
 		<plugins>
@@ -61,7 +61,7 @@
 				<version>0.4.13</version>
 				<configuration>
 					<!-- 镜像名称 -->
-					<imageName>${docker.aliyun.registry}/${docker.aliyun.name}/${project.artifactId}:3.0.0</imageName>
+					<imageName>${docker.aliyun.registry}/${docker.aliyun.name}/${project.artifactId}:6.0.0</imageName>
 					<!-- 下面注释行 使用的指定Dockerfile 文件 构建,如果有该便签  参数配置打包不起作用 -->
 					<!-- <dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory> -->
 					<!-- 是否覆盖相同镜像的 tags -->
@@ -69,7 +69,7 @@
 					<!-- 镜像类型 -->
 					<baseImage>java</baseImage>
 					<!-- docker 运行的时执行指令 -->
-					<entryPoint>["java","-jar","-Xms32m","-Xmx256m","-XX:MetaspaceSize=32m","-XX:MaxMetaspaceSize=128m","/${project.build.finalName}.jar"]</entryPoint>
+					<entryPoint>["java","-jar","-Xms64m","-Xmx64m","-XX:MetaspaceSize=64m","-XX:MaxMetaspaceSize=64m","/${project.build.finalName}.jar"]</entryPoint>
 					<!-- 远程推送镜像至服务器 -->
 					<dockerHost>${docker.url}</dockerHost>
 					<!-- 远程推送镜像至阿里云私服 -->
@@ -91,4 +91,4 @@
 			<!-- end::plugin[] -->
 		</plugins>
 	</build>
-</project>
+</project>

+ 0 - 1
ctkcloud-config-service/src/main/java/com/comtika/ctkcloud/server/ConfigApplication.java

@@ -6,7 +6,6 @@ import org.springframework.cloud.config.server.EnableConfigServer;
 import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
 
 /**
- * 
  * @ClassName: ConfigApplication
  * @Description: 配置中心服务
  * @author actor_miss

+ 8 - 16
ctkcloud-config-service/src/main/resources/application.yml

@@ -24,38 +24,30 @@ spring:
   profiles: s5
 ---
 spring:
-  #rabbitmq:
-    #host: 192.168.0.182
-    #port: 5672
-    #username: admin
-    #password: comtika2018
-  rabbitmq:
-    host: 192.168.0.182
-    port: 15672
-    username: admin
-    password: comtika2018
   cloud:
     bus:
       trace:
         enabled: true
     config:
       server:
-        encrypt: 
+        encrypt:
           enabled: false
         git:
-          uri: http://db.comtti.net:80/configadmin/ctkcloud-config.git
-          username: configadmin
-          password: config@20190510
+          uri: http://193.112.16.187:3000/comtika/comtika-config.git
+          username: comtika
+          password: comtika2020
 eureka:
   instance:
     prefer-ip-address: true
   client:
     serviceUrl:
-      defaultZone: http://localhost:8761/eureka/
-#      defaultZone: http://admin:comtika2018@peer1:8761/eureka/,http://admin:comtika2018@peer2:8762/eureka/
+      defaultZone: http://admin:comtika2018@localhost:8761/eureka/
+      #defaultZone: http://admin:comtika2018@peer1:8761/eureka/,http://admin:comtika2018@peer2:8762/eureka/
 security:
    basic:
      enabled: true
    user:
      name: ctk_miss
      password: actor#config_server
+server:
+  port: 9050

+ 2 - 2
ctkcloud-customer-service/pom.xml

@@ -65,12 +65,12 @@
 				<artifactId>docker-maven-plugin</artifactId>
 				<version>0.4.13</version>
 				<configuration>
-					<imageName>${docker.aliyun.registry}/${docker.aliyun.name}/${project.artifactId}:5.0.3</imageName>
+					<imageName>${docker.aliyun.registry}/${docker.aliyun.name}/${project.artifactId}:6.0.0</imageName>
 					<!-- <dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory> -->
 					<!-- 如果有相同的覆盖 -->
 					<forceTags>true</forceTags>
 					<baseImage>java</baseImage>
-					<entryPoint>["java","-jar","-XX:+PrintGCDetails","-XX:+PrintGCTimeStamps","-XX:+PrintGCDateStamps","-Xloggc:./upload.log","-XX:+UseG1GC","-Xms256m","-Xmx256m","-XX:MetaspaceSize=256m","-XX:MaxMetaspaceSize=256m","/${project.build.finalName}.jar"]</entryPoint>
+					<entryPoint>["java","-jar","-XX:+PrintGCDetails","-XX:+PrintGCTimeStamps","-XX:+PrintGCDateStamps","-Xloggc:./upload.log","-Xms256m","-Xmx256m","-XX:MetaspaceSize=256m","-XX:MaxMetaspaceSize=256m","/${project.build.finalName}.jar"]</entryPoint>
 					<dockerHost>${docker.url}</dockerHost>
 					<registryUrl>${docker.aliyun.registry}</registryUrl>
 					<serverId>docker_actor</serverId>

+ 7 - 9
ctkcloud-customer-service/src/main/java/com/comtika/ctkcloud/server/controller/customer/CustomerOpinionController.java

@@ -20,7 +20,6 @@ import com.comtika.ctkcloud.common.bean.user.LoginUser;
 import com.comtika.ctkcloud.common.result.RespWrapper;
 import com.comtika.ctkcloud.server.entity.customer.opinion.CtkCustomerOpinion;
 import com.comtika.ctkcloud.server.service.customer.CustomerOpinionService;
-import com.esotericsoftware.minlog.Log;
 
 /**
  * 用户意见反馈
@@ -31,17 +30,17 @@ import com.esotericsoftware.minlog.Log;
 @RestController
 @RequestMapping("/customerOpinion")
 public class CustomerOpinionController extends BaseController{
-	
+
 	@Autowired
 	CustomerOpinionService customerOpinionService;
-	
+
 	@SuppressWarnings("rawtypes")
 	@ApiOperation(value = "新增反馈问题", notes = "新增反馈问题")
 	@ApiImplicitParam(name = "customerOpinionDto", value = "反馈问题实体入参", required = false, dataType = "CustomerOpinionDto", paramType = "query")
 	@RequestMapping(value= "/add",method=RequestMethod.GET)
 	public RespWrapper addCustomerOpinion(CtkCustomerOpinion customerOpinion){
-		if(customerOpinion.getType() == null || 
-				customerOpinion.getDescription() == null || 
+		if(customerOpinion.getType() == null ||
+				customerOpinion.getDescription() == null ||
 						customerOpinion.getDescription().length() >200){
 			return RespWrapper.makeFailResp("参数有误");
 		}
@@ -53,7 +52,7 @@ public class CustomerOpinionController extends BaseController{
 			return RespWrapper.makeErrorResp("系统错误");
 		}
 	}
-	
+
 	@SuppressWarnings("rawtypes")
 	@ApiOperation(value = "查询反馈问题", notes = "查询反馈问题")
 	@ApiImplicitParam(name = "type", value = "反馈问题状态", required = false, dataType = "Integer", paramType = "query")
@@ -67,7 +66,7 @@ public class CustomerOpinionController extends BaseController{
 			return RespWrapper.makeErrorResp("查询异常");
 		}
 	}
-	
+
 	@SuppressWarnings("rawtypes")
 	@ApiOperation(value = "删除反馈问题", notes = "删除反馈问题")
 	@ApiImplicitParam(name = "id", value = "删除反馈问题,逻辑上删除", required = true, allowMultiple=true , dataType = "Long", paramType = "query")
@@ -90,9 +89,8 @@ public class CustomerOpinionController extends BaseController{
 			customerOpinionService.deleteCustomerOpinion(map);
 			return RespWrapper.makeSuccessResp("删除成功");
 		} catch (Exception e) {
-			Log.error("删除删除反馈问题失败");
 			return RespWrapper.makeErrorResp("系统异常");
 		}
-		
+
 	}
 }

+ 9 - 8
ctkcloud-customer-service/src/main/resources/application.yml

@@ -22,6 +22,7 @@ server:
   port: 9019
 spring:
   profiles: s5
+---
 #spring:
 #  datasource:
 #    username: root
@@ -57,11 +58,11 @@ spring:
 #        enabled: false
 encrypt:
   key: '*&3loa#@9no_0*(!'
-mybatis:
-  type-handlers-package: 'com.github.prontera.domain.type.handler'
-  mapper-locations: 'classpath*:mapper/**/*Mapper.xml'
-  type-aliases-package: 'com.github.prontera.domain'
-flyway:
-  enabled: true
-  baseline-on-migrate: true
-  validate-on-migrate: false
+#mybatis:
+#  type-handlers-package: 'com.github.prontera.domain.type.handler'
+#  mapper-locations: 'classpath*:mapper/**/*Mapper.xml'
+#  type-aliases-package: 'com.github.prontera.domain'
+#flyway:
+#  enabled: true
+#  baseline-on-migrate: true
+#  validate-on-migrate: false

+ 3 - 5
ctkcloud-customer-service/src/main/resources/bootstrap.yml

@@ -1,11 +1,8 @@
 spring:
   application:
     name: customer-service
-  tcpUrl: db.comtti.net:9250
-#默认是 是0.1 zikpin采样百分比 前期使用1
-  sleuth:
-    sampler:
-      percentage = 0.5
+  tcpUrl: 172.16.0.11:9250
+  #tcpUrl: 193.112.16.187:9250
 # cloud 配置中心地址
   cloud:
     config:
@@ -22,3 +19,4 @@ eureka:
   client:
     serviceUrl:
       defaultZone: http://admin:comtika2018@peer1:8761/eureka/,http://admin:comtika2018@peer2:8762/eureka/
+#      defaultZone: http://admin:comtika2018@peer1:8761/eureka/

+ 6 - 6
ctkcloud-equip-service/pom.xml

@@ -22,12 +22,12 @@
 		</dependency>
 
 		<!-- jpa -->
-		<dependency>
+		<!--<dependency>
 			<groupId>org.springframework.boot</groupId>
 			<artifactId>spring-boot-starter-data-jpa</artifactId>
-		</dependency>
+		</dependency>-->
 
-		<dependency>
+	<!--	<dependency>
 			<groupId>com.alibaba</groupId>
 			<artifactId>fastjson</artifactId>
 			<version>1.2.7</version>
@@ -35,7 +35,7 @@
 		<dependency>
 			<groupId>org.springframework.cloud</groupId>
 			<artifactId>spring-cloud-starter-feign</artifactId>
-		</dependency>
+		</dependency>-->
 
 		<dependency>
 			<groupId>com.comtika</groupId>
@@ -57,12 +57,12 @@
 				<version>0.4.13</version>
 
 				<configuration>
-					<imageName>${docker.aliyun.registry}/${docker.aliyun.name}/${project.artifactId}:5.2.1</imageName>
+					<imageName>${docker.aliyun.registry}/${docker.aliyun.name}/${project.artifactId}:6.0.0</imageName>
 					<!-- <dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory> -->
 					<!-- 如果有相同的覆盖 -->
 					<forceTags>true</forceTags>
 					<baseImage>java</baseImage>
-					<entryPoint>["java","-jar","-XX:+UseG1GC","-XX:+PrintGCDetails","-XX:+PrintGCTimeStamps","-XX:+PrintGCDateStamps","-Xloggc:/protocol.log","-Xms128m","-Xmx128m","-XX:MetaspaceSize=256m","-XX:MaxMetaspaceSize=256m","/${project.build.finalName}.jar"]</entryPoint>
+					<entryPoint>["java","-jar","-XX:+PrintGCDetails","-XX:+PrintGCTimeStamps","-XX:+PrintGCDateStamps","-Xloggc:/protocol.log","-Xms128m","-Xmx128m","-XX:MetaspaceSize=256m","-XX:MaxMetaspaceSize=256m","/${project.build.finalName}.jar"]</entryPoint>
 					<dockerHost>${docker.url}</dockerHost>
 					<registryUrl>${docker.aliyun.registry}</registryUrl>
 					<serverId>docker_actor</serverId>

+ 0 - 9
ctkcloud-equip-service/src/main/java/com/comtika/ctkcloud/server/EquipServerApplication.java

@@ -1,8 +1,5 @@
 package com.comtika.ctkcloud.server;
 
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
 
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -18,13 +15,7 @@ import org.springframework.context.annotation.ComponentScan;
 @EnableFeignClients
 @EnableHystrix
 public class EquipServerApplication{
-	//private static ScheduledExecutorService executorService = Executors.newScheduledThreadPool(10);
 	public static void main(String[] args) {
-		/*executorService.scheduleAtFixedRate(()->{
-			System.out.println("3");
-		}, 0, 3, TimeUnit.SECONDS);*/
-		long hours = TimeUnit.DAYS.toHours(1);
-		System.out.println(hours);
 		SpringApplication.run(EquipServerApplication.class, args);
 	}
 }

+ 11 - 10
ctkcloud-equip-service/src/main/java/com/comtika/ctkcloud/server/controller/EquipTerminalController.java

@@ -8,6 +8,7 @@ import java.util.Map;
 import javax.servlet.http.HttpServletRequest;
 
 import com.alibaba.fastjson.JSONObject;
+import com.comtika.ctkcloud.server.entity.CtkEquipModel;
 import org.beetl.sql.core.engine.PageQuery;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -202,7 +203,7 @@ public class EquipTerminalController extends BaseController {
 			@ApiImplicitParam(paramType = "query", name = "id", value = "集中器的id", dataType = "Long", required = false),
 			@ApiImplicitParam(paramType = "query", name = "serialNo", value = "集中器的序列号", dataType = "String", required = false)})
 	@RequestMapping(value = "queryEquipTerminalByParam", method = RequestMethod.GET)
-	public RespWrapper<Object> queryEquipTerminalByParam(Long id,String serialNo) {
+	public RespWrapper<List<CtkEquipTerminal>> queryEquipTerminalByParam(Long id,String serialNo) {
 		try {
 			CtkEquipTerminal query = new CtkEquipTerminal();
 			if(id != null) {
@@ -225,12 +226,12 @@ public class EquipTerminalController extends BaseController {
     @ApiImplicitParams({
             @ApiImplicitParam(paramType = "query", name = "id", value = "集中器的id", dataType = "Long", required = true)})
     @RequestMapping(value = "queryEquipTerminalById", method = RequestMethod.GET)
-    public RespWrapper<Object> queryEquipTerminalById(Long id) {
+    public RespWrapper<Map<String,Object>> queryEquipTerminalById(Long id) {
         try {
 			if(null == id){
 				return RespWrapper.makeFailResp("参数有误,请检查!");
 			}
-			Map<String,Object> map = new HashMap<>();
+			Map<String,Object> map = new HashMap<String, Object>();
 			map.put("id",id);
         	map = terminalService.queryEquipTerminalById(map);
             CtkEquipTerminal terminal = terminalService.getByIdUniqueHiber(id);
@@ -317,7 +318,7 @@ public class EquipTerminalController extends BaseController {
         @ApiImplicitParam(name="status",value="启用-1;停用-2",required=true,dataType="String",paramType="query")
     })
     @PutMapping(value = "/disableTerminal")
-    public RespWrapper<Object> disableTerminal(Long id,Integer status) {
+    public RespWrapper<Long> disableTerminal(Long id,Integer status) {
         try {
             terminalService.disableTerminalById(id, status);
             return RespWrapper.makeSuccessResp(id);
@@ -330,7 +331,7 @@ public class EquipTerminalController extends BaseController {
 
     @ApiOperation(value = "获取产品列表", notes = "获取所有产品类别")
     @GetMapping(value = "/queryEquipProductList")
-    public RespWrapper<Object> queryEquipProductList() {
+    public RespWrapper<List<Map<String,Object>>> queryEquipProductList() {
         try {
             List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
             for (EquipmentCode each : EquipmentCode.values()) {
@@ -411,13 +412,13 @@ public class EquipTerminalController extends BaseController {
 			@ApiImplicitParam(name="eruipSocketNum",value="设备插座数",required=true,dataType="Integer",paramType="query")
 	})
 	@PostMapping("/addEquipModel")
-	public RespWrapper<Object> addEquipModel(String equipName,String equipModel,String equipType,Integer eruipSocketNum){
+	public RespWrapper<String> addEquipModel(String equipName,String equipModel,String equipType,Integer eruipSocketNum){
     	return terminalService.addEquipModel(equipName,equipModel,equipType,eruipSocketNum);
 	}
 
 	@ApiOperation(value="查询所有设备类型",notes="查询所有设备类型")
 	@PostMapping("/queryEquipModel")
-	public RespWrapper<Object> queryEquipModel(){
+	public RespWrapper<List<CtkEquipModel>> queryEquipModel(){
 		return terminalService.queryEquipModel();
 	}
 
@@ -428,19 +429,19 @@ public class EquipTerminalController extends BaseController {
 			@ApiImplicitParam(name="equipType",value="设备类型",required=true,dataType="String",paramType="query")
 	})
 	@PostMapping("/updateEquipModel")
-	public RespWrapper<Object> updateEquipModel( Long id, String equipName,String equipType){
+	public RespWrapper<String> updateEquipModel( Long id, String equipName,String equipType){
 		return terminalService.updateEquipModel(id,equipName,equipType);
 	}
 
 	@ApiOperation(value="删除设备",notes="删除设备")
 	@PostMapping("/deleteTerminal")
-	public RespWrapper<Object> deleteTerminal( Long id ){
+	public RespWrapper<String> deleteTerminal( Long id ){
 		return terminalService.deleteTerminal(id);
 	}
 
 	@ApiOperation(value="查询ICCID和IMEI",notes="查询ICCID和IMEI")
 	@PostMapping("/queryTerminalIccidAndImei")
-	public RespWrapper<Object> queryTerminalIccidAndImei( Long id ){
+	public RespWrapper<CtkEquipTerminal> queryTerminalIccidAndImei( Long id ){
 		return terminalService.queryTerminalIccidAndImei(id);
 	}
 

+ 11 - 10
ctkcloud-equip-service/src/main/java/com/comtika/ctkcloud/server/service/equip/EquipTerminalService.java

@@ -3,6 +3,7 @@ package com.comtika.ctkcloud.server.service.equip;
 import java.util.List;
 import java.util.Map;
 
+import com.comtika.ctkcloud.server.entity.CtkEquipModel;
 import org.beetl.sql.core.engine.PageQuery;
 
 import com.comtika.ctkcloud.common.base.service.BaseService;
@@ -12,16 +13,16 @@ import com.comtika.ctkcloud.server.entity.equip.CtkEquipTerminal;
 
 /**
  * 设备服务
- * 
+ *
  * @author xjm
  */
 public interface EquipTerminalService extends BaseService<CtkEquipTerminal>
 {
     RespWrapper<Boolean> saveEquip(EquipAddEntity equip);
-    
+
     /**
      * 根据集中器的属性,查集中器列表
-     * 
+     *
      * @param query
      * @return
      */
@@ -63,21 +64,21 @@ public interface EquipTerminalService extends BaseService<CtkEquipTerminal>
 	RespWrapper<PageQuery<Map<String, Object>>> findTerminalList(PageQuery<Map<String, Object>> pageQuery);
 
 	Object blackListHandle(boolean bl);
-	
+
 	RespWrapper<PageQuery<Map<String,Object>>> queryTerminalList(PageQuery<Map<String,Object>> map,Long siteId);
-	
+
 	Map<String,Object> queryTerminalById(Map<String, Long> map);
 	int updateTerminalById(CtkEquipTerminal ctkEquipTerminal);
 
-    RespWrapper<Object> addEquipModel(String equipName, String equipModel, String equipType, Integer eruipSocketNum);
+    RespWrapper<String> addEquipModel(String equipName, String equipModel, String equipType, Integer eruipSocketNum);
 
-    RespWrapper<Object> queryEquipModel();
+    RespWrapper<List<CtkEquipModel>> queryEquipModel();
 
-    RespWrapper<Object> updateEquipModel(Long id, String equipName, String equipType);
+    RespWrapper<String> updateEquipModel(Long id, String equipName, String equipType);
 
-    RespWrapper<Object> deleteTerminal(Long id);
+    RespWrapper<String> deleteTerminal(Long id);
 
     Map<String, Object> queryEquipTerminalById(Map<String, Object> map);
 
-    RespWrapper<Object> queryTerminalIccidAndImei(Long id);
+    RespWrapper<CtkEquipTerminal> queryTerminalIccidAndImei(Long id);
 }

+ 29 - 39
ctkcloud-equip-service/src/main/java/com/comtika/ctkcloud/server/service/equip/impl/EquipTerminalServiceImpl.java

@@ -41,7 +41,7 @@ import com.comtika.ctkcloud.server.service.equip.EquipTerminalService;
 
 /**
  * 设备服务
- * 
+ *
  * @author xjm
  */
 @Service
@@ -70,25 +70,25 @@ public class EquipTerminalServiceImpl extends BaseServiceImpl<CtkEquipTerminal>
     private CtkEquipNodeDao ctkEquipNodeDao;
     /**
      * 根据集中器的属性,查集中器列表
-     * 
+     *
      * @param query
      * @return
      */
     public List<CtkEquipTerminal> queryEquipTerminalByParam(CtkEquipTerminal query) {
         return terminalDao.queryEquipTerminalByParam(query);
     }
-   
+
 
     /**
      * 查集中器及其关联的站点、商家、城市信息
-     * 
+     *
      * @return
      */
     @SuppressWarnings("rawtypes")
     public List<Map> queryOtherTerminalInfo(Map paraMap) {
         return terminalDao.queryOtherTerminalInfo(paraMap);
     }
-    
+
     public static void main(String[] args){
     	/*RespWrapper<Boolean> checkString = new EquipTerminalServiceImpl().checkString("10005301","001000530180","001000530181","001000530182");
     	System.out.println(checkString.isSuccess());*/
@@ -143,7 +143,7 @@ public class EquipTerminalServiceImpl extends BaseServiceImpl<CtkEquipTerminal>
 			return RespWrapper.makeFailResp("流水号不合规则!");
 		}
     }
-    
+
     public RespWrapper<Boolean> saveEquip(EquipAddEntity equip) {
         try {
             String terminalNo = equip.getTerminalNo();
@@ -181,7 +181,7 @@ public class EquipTerminalServiceImpl extends BaseServiceImpl<CtkEquipTerminal>
                 //todo 将站点商户Id 添加到设备表
                 CtkSite ctkSite = terminalDao.getSQLManager().unique(CtkSite.class, siteId);
                 terminal.setMerchantId(ctkSite.getMerchantId());
-                
+
                 terminal.setTerminalNo(terminalNo);
                 //存储设备型号
                 terminal.setEquipModel(equip.getEquipModel());
@@ -245,7 +245,7 @@ public class EquipTerminalServiceImpl extends BaseServiceImpl<CtkEquipTerminal>
                 //String redisKey = ProjectRedisKeyUtil.createTerminalRedisKey(terminalNo);
                 deleteBlackListCache(terminalNo);
                 //super.deleteCacheObject(redisKey);
-                
+
                 return RespWrapper.makeSuccessResp(true);
             }
         } catch (Exception e) {
@@ -255,9 +255,9 @@ public class EquipTerminalServiceImpl extends BaseServiceImpl<CtkEquipTerminal>
         }
         return RespWrapper.makeFailResp("系统异常!");
     }
-    
+
     /**
-     * 
+     *
      * @Title: disableTerminalById
      * @Description: TODO(根据集中器id启用/停用集中器)
      * @param id
@@ -282,7 +282,7 @@ public class EquipTerminalServiceImpl extends BaseServiceImpl<CtkEquipTerminal>
             throw new RuntimeException(e.getMessage());
         }
     }
-    
+
     /***插座补零*/
     private String dealCount(int i) {
         if(i < 10) {
@@ -292,13 +292,13 @@ public class EquipTerminalServiceImpl extends BaseServiceImpl<CtkEquipTerminal>
     }
 
     /**
-     * 
+     *
      * @Title: updateEquipTerminal
      * @Description: TODO(修改设备)
      * @param id
      * @param equip
      * void
-     * @throws InterruptedException 
+     * @throws InterruptedException
      * @throws
      * @变更记录  2018年6月5日 下午12:06:15 向金梅  创建
      */
@@ -346,7 +346,7 @@ public class EquipTerminalServiceImpl extends BaseServiceImpl<CtkEquipTerminal>
             oldSerialNo = terminal.getSerialNo();
             String oldTerminalNo = terminal.getTerminalNo();
             String oldGroupNo = terminal.getGroupNo();
-            
+
             long oldSite = terminal.getSiteId();
             terminal.setSerialNo(serialNo);// 流水号
             terminal.setTerminalNo(terminalNo);
@@ -527,9 +527,9 @@ public class EquipTerminalServiceImpl extends BaseServiceImpl<CtkEquipTerminal>
     public PageQuery<CtkEquipTerminal> queryList(PageQuery<CtkEquipTerminal> pageQuery) {
         return this.pageQueryList("equip.terminal.queryList", pageQuery, CtkEquipTerminal.class);
     }
-    
+
     /**
-     * 
+     *
      * @Title: recheckEquip
      * @Description: TODO(检查录入的设备id是否唯一)
      * @param terminalNo
@@ -560,13 +560,13 @@ public class EquipTerminalServiceImpl extends BaseServiceImpl<CtkEquipTerminal>
                 isExist = terminalDao.recheckNodeNo(map);
                 if(isExist >0) {
                     throw new RuntimeException("子板1设备id已存在!");
-                } 
+                }
                 map.clear();
                 map.put("nodeNo", nodeTwoNo);
                 isExist = terminalDao.recheckNodeNo(map);
                 if(isExist >0) {
                     throw new RuntimeException("子板2设备id已存在!");
-                } 
+                }
                 return true;
             }
         }
@@ -577,7 +577,7 @@ public class EquipTerminalServiceImpl extends BaseServiceImpl<CtkEquipTerminal>
 		try {
 		    pageQuery = terminalDao.findTerminalList(pageQuery);
 			List<Map<String, Object>> list = pageQuery.getList();
-			
+
 			Map<String,Object> tmpMap = new HashMap<String, Object>();
 			tmpMap.put("max", 1);
 			CtkHsVersion maxData = terminalDao.findOTAVersionEntity(tmpMap);
@@ -629,7 +629,7 @@ public class EquipTerminalServiceImpl extends BaseServiceImpl<CtkEquipTerminal>
 								tmp.put("otaNowVersion", "00");
 							}
 						}else{//这里是一致时  这说明不需更新版本
-							bf = false; 
+							bf = false;
 							tmp.put("otaNowVersionId", lv1);
 							tmp.put("otaNowVersion", minData.getHsVersion());
 						}
@@ -717,7 +717,7 @@ public class EquipTerminalServiceImpl extends BaseServiceImpl<CtkEquipTerminal>
 		} catch (Exception e) {
 			return RespWrapper.makeErrorResp("异常:"+e.getMessage());
 		}
-    	
+
 	}
 
 
@@ -738,7 +738,7 @@ public class EquipTerminalServiceImpl extends BaseServiceImpl<CtkEquipTerminal>
 	}
 
     @Override
-    public RespWrapper<Object> addEquipModel(String equipName, String equipModel, String equipType, Integer eruipSocketNum) {
+    public RespWrapper<String> addEquipModel(String equipName, String equipModel, String equipType, Integer eruipSocketNum) {
         try {
             if(StringUtil.isEmpty(equipName)){
                 return RespWrapper.makeFailResp("产品名称不能为空!");
@@ -775,17 +775,13 @@ public class EquipTerminalServiceImpl extends BaseServiceImpl<CtkEquipTerminal>
     }
 
     @Override
-    public RespWrapper<Object> queryEquipModel() {
-	    try {
-            return RespWrapper.makeSuccessResp(ctkEquipModelDao.template(new CtkEquipModel()));
-        }catch (Exception e){
-	        e.printStackTrace();
-            return RespWrapper.makeErrorResp("服务器错误!");
-        }
+    public RespWrapper<List<CtkEquipModel>> queryEquipModel() {
+	    return RespWrapper.makeSuccessResp(ctkEquipModelDao.template(new CtkEquipModel()));
+
     }
 
     @Override
-    public RespWrapper<Object> updateEquipModel(Long id, String equipName, String equipType) {
+    public RespWrapper<String> updateEquipModel(Long id, String equipName, String equipType) {
 	    try {
             if( null == id){
                 return RespWrapper.makeFailResp("参数有误,请检查");
@@ -806,7 +802,7 @@ public class EquipTerminalServiceImpl extends BaseServiceImpl<CtkEquipTerminal>
     }
 
     @Override
-    public RespWrapper<Object> deleteTerminal(Long id) {
+    public RespWrapper<String> deleteTerminal(Long id) {
 	    try {
 	        if( null == id){
 	            return RespWrapper.makeFailResp("参数有误,请检查!");
@@ -834,17 +830,11 @@ public class EquipTerminalServiceImpl extends BaseServiceImpl<CtkEquipTerminal>
 
     @Override
     public Map<String, Object> queryEquipTerminalById(Map<String, Object> map) {
-	    try {
-            return terminalDao.queryEquipTerminalById(map);
-        }catch (Exception e){
-	        e.printStackTrace();
-	        return new HashMap<>();
-        }
-
+	    return terminalDao.queryEquipTerminalById(map);
     }
 
     @Override
-    public RespWrapper<Object> queryTerminalIccidAndImei(Long id) {
+    public RespWrapper<CtkEquipTerminal> queryTerminalIccidAndImei(Long id) {
 	    try {
             if( null == id){
                 return RespWrapper.makeFailResp("参数有误,请检查!");

+ 0 - 39
ctkcloud-equip-service/src/main/resources/application.properties.bak

@@ -1,39 +0,0 @@
-eureka.client.serviceUrl.defaultZone=http://admin:comtika2018@peer1:8761/eureka/,http://admin:comtika2018@peer2:8762/eureka/
-#eureka.client.serviceUrl.defaultZone=http://localhost:8761/eureka/
-eureka.instance.prefer-ip-address=true
-server.port=8970
-
-#服务提供方刷新配置
-#服务过期时间配置,超过这个时间没有接收到心跳EurekaServer就会将这个实例剔除
-#注意,EurekaServer一定要设置eureka.server.eviction-interval-timer-in-ms否则这个配置无效,这个配置一般为服务刷新时间配置的三倍
-#默认90s
-#eureka.instance.lease-expiration-duration-in-seconds=15
-#服务刷新时间配置,每隔这个时间会主动心跳一次
-#默认30s
-#eureka.instance.lease-renewal-interval-in-seconds=5
-#eureka client刷新本地缓存时间--服务调用方
-#默认30s
-#eureka.client.registryFetchIntervalSeconds=5
-#eureka客户端ribbon刷新时间
-#默认30s
-ribbon.ServerListRefreshInterval=36500
-
-#rabbitmq
-spring.rabbitmq.host = localhost
-spring.rabbitmq.port = 5672
-spring.rabbitmq.username = admin
-spring.rabbitmq.password = comtika2018
- 
-#spring.session.store-type=none 
-
-#spring.profiles.active = 
-
-spring.jpa.hibernate.ddl-auto=update
-spring.jpa.show-sql=true
-
-ribbon.ReadTimeout=36500
-ribbon.ConnectTimeout=36500
-hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=36500
-
-#开启熔断器
-feign.hystrix.enabled=true

+ 5 - 1
ctkcloud-equip-service/src/main/resources/application.yml

@@ -21,4 +21,8 @@ spring:
 server:
   port: 8974
 spring:
-  profiles: s5
+  profiles: s5
+---
+spring:
+  profiles:
+    active: s1

+ 4 - 6
ctkcloud-equip-service/src/main/resources/bootstrap.yml

@@ -1,18 +1,15 @@
 spring:
   application:
     name: equip-service
-  tcpUrl: db.comtti.net:9250
-#默认是 是0.1 zikpin采样百分比 前期使用1
-  sleuth:
-    sampler:
-      percentage = 0.1
+  tcpUrl: 172.16.0.11:9250
+  #tcpUrl: 193.112.16.187:9250
 # cloud 配置中心地址
   cloud:
     config:
       discovery:
         enabled: true
         service-id: config-service
-      profile: test
+      profile: prod
       label: master
       username: ctk_miss
       password: actor#config_server
@@ -22,3 +19,4 @@ eureka:
   client:
     serviceUrl:
       defaultZone: http://admin:comtika2018@peer1:8761/eureka/,http://admin:comtika2018@peer2:8762/eureka/
+#      defaultZone: http://admin:comtika2018@peer1:8761/eureka/

+ 7 - 5
ctkcloud-eureka-server/pom.xml

@@ -22,6 +22,7 @@
 		</dependency>
 	</dependencies>
 	<build>
+		<finalName>eureka</finalName>
 		<plugins>
 			<plugin>
 				<groupId>org.springframework.boot</groupId>
@@ -33,16 +34,17 @@
 				<artifactId>docker-maven-plugin</artifactId>
 				<version>0.4.13</version>
 				<configuration>
-					<imageName>${docker.aliyun.registry}/${docker.aliyun.name}/${project.artifactId}:3.0.0</imageName>
+					<!--<imageName>${docker.aliyun.registry}/${docker.aliyun.name}/${project.artifactId}:3.0.0</imageName>-->
+					<imageName>${project.artifactId}:6.0.0</imageName>
 					<!-- <dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory> -->
 					<!-- 如果有相同的覆盖 -->
 					<forceTags>true</forceTags>
 					<baseImage>java</baseImage>
-					<entryPoint>["java","-jar","-Xms32m","-Xmx128m","/${project.build.finalName}.jar"]</entryPoint>
+					<entryPoint>["java","-jar","-Xms64m","-Xmx64m","/${project.build.finalName}.jar"]</entryPoint>
 					<dockerHost>${docker.url}</dockerHost>
-					<registryUrl>${docker.aliyun.registry}</registryUrl>
+					<!--<registryUrl>${docker.aliyun.registry}</registryUrl>
 					<serverId>docker_actor</serverId>
-					<pushImage>false</pushImage>
+					<pushImage>false</pushImage>-->
 					<resources>
 						<resource>
 							<targetPath>/</targetPath>
@@ -56,4 +58,4 @@
 		</plugins>
 	</build>
 
-</project>
+</project>

+ 22 - 5
ctkcloud-eureka-server/src/main/resources/application.yml

@@ -4,15 +4,32 @@ security:
   user:
     name: admin
     password: comtika2018
-
 eureka:
   client:
-    
+    register-with-eureka: false # 表示不向注册中心注册
+    fetch-registry: false # 由于注册中心的职责就是维护服务实例,所以它不需要去检索服务
+spring:
+  profiles:
+    active: peer1
+---
+spring:
+  profiles: peer2
+server:
+  port: 8762
+eureka:
+  instance:
+    hostname: peer2
+  client:
+    serviceUrl:
+      defaultZone: http://admin:comtika2018@peer1:8761/eureka/
+---
+spring:
+  profiles: peer1
 server:
   port: 8761
 eureka:
+  instance:
+    hostname: peer1
   client:
     serviceUrl:
-      defaultZone: http://localhost:8761/eureka/
-    register-with-eureka: false # 表示不向注册中心注册
-    fetch-registry: false # 由于注册中心的职责就是维护服务实例,所以它不需要去检索服务
+      defaultZone: http://admin:comtika2018@peer2:8762/eureka/

+ 15 - 0
ctkcloud-eureka-server/src/main/resources/application.yml.bak

@@ -0,0 +1,15 @@
+security:
+  basic:
+    enabled: true
+  user:
+    name: admin
+    password: comtika2018
+
+server:
+  port: 8761
+eureka:
+  client:
+    serviceUrl:
+      defaultZone: http://localhost:8761/eureka/
+    register-with-eureka: false # 表示不向注册中心注册
+    fetch-registry: false # 由于注册中心的职责就是维护服务实例,所以它不需要去检索服务

+ 0 - 33
ctkcloud-eureka-server/src/main/resources/application.yml.bankk

@@ -1,33 +0,0 @@
-security:
-  basic:
-    enabled: true
-  user:
-    name: admin
-    password: comtika2018
-    
-eureka:
-  client:
-    register-with-eureka: false # 表示不向注册中心注册
-    fetch-registry: false # 由于注册中心的职责就是维护服务实例,所以它不需要去检索服务
----
-spring:
-  profiles: peer2
-server:
-  port: 8762
-eureka:
-  instance:
-    hostname: peer2
-  client:
-    serviceUrl:
-      defaultZone: http://admin:comtika2018@peer1:8761/eureka/
----
-spring:
-  profiles: peer1
-server:
-  port: 8761
-eureka:
-  instance:
-    hostname: peer1
-  client:
-    serviceUrl:
-      defaultZone: http://admin:comtika2018@peer2:8762/eureka/

+ 0 - 3
ctkcloud-eureka-server/src/main/resources/bootstrap.properties

@@ -1,4 +1 @@
 spring.application.name=eureka-server
-#spring.tcpUrl = db.comtti.net:9250
-#默认是 是0.1 zikpin采样百分比 前期使用1
-#spring.sleuth.sampler.percentage = 1

+ 0 - 70
ctkcloud-eureka-server/src/main/resources/logback-spring.xml.bak

@@ -1,70 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--该日志将日志级别不同的log信息保存到不同的文件中 -->
-<configuration>
-	<include resource="org/springframework/boot/logging/logback/defaults.xml" />
- 
-	<springProperty scope="context" name="springAppName"
-		source="spring.application.name" />
- 	<springProperty scope="context" name="tcpUrl"
-		source="spring.tcpUrl" />
-	<!-- 日志在工程中的输出位置 -->
-	<property name="LOG_FILE" value="${BUILD_FOLDER:-build}/${springAppName}" />
- 
-	<!-- 控制台的日志输出样式 -->
-	<property name="CONSOLE_LOG_PATTERN"
-		value="%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}" />
- 
-	<!-- 控制台输出 -->
-	 <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
-		<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
-			<level>INFO</level>
-		</filter>
-		<!-- 日志输出编码 -->
-		<encoder>
-			<pattern>${CONSOLE_LOG_PATTERN}</pattern>
-			<charset>utf8</charset>
-		</encoder>
-	</appender> 
- 
-	<!-- 为logstash输出的JSON格式的Appender -->
-	<appender name="logstash"
-		class="net.logstash.logback.appender.LogstashTcpSocketAppender">
-		<!--这是查询通过tcp 发送至logtash  -->
-		<destination>${tcpUrl}</destination>
-		<encoder>
-			<pattern>${CONSOLE_LOG_PATTERN}</pattern>
-			<charset>utf8</charset>
-		</encoder>
-		<!-- 日志输出编码 -->
-		<encoder
-			class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
-			<providers>
-				<timestamp>
-					<timeZone>UTC</timeZone>
-				</timestamp>
-				<pattern>
-					<pattern>
-						{
-						"severity": "%level",
-						"service": "${springAppName:-}",
-						"trace": "%X{X-B3-TraceId:-}",
-						"span": "%X{X-B3-SpanId:-}",
-						"exportable": "%X{X-Span-Export:-}",
-						"pid": "${PID:-}",
-						"thread": "%thread",
-						"classname": "%logger{40}",
-						"rest": "%message",
-						"time":"%d{yyyyMMddHHmmssSSS}"
-						}
-					</pattern>
-				</pattern>
-			</providers>
-		</encoder>
-	</appender>
- 
-	<!-- 日志输出级别 -->
-	<root level="INFO">
-		<appender-ref ref="console" />
-		<appender-ref ref="logstash" />
-	</root>
-</configuration>

+ 2 - 2
ctkcloud-instructions-service/pom.xml

@@ -46,7 +46,7 @@
 				<version>0.4.13</version>
 				<configuration>
 					<!-- 镜像名称 -->
-					<imageName>${docker.aliyun.registry}/${docker.aliyun.name}/${project.artifactId}:5.0.0</imageName>
+					<imageName>${docker.aliyun.registry}/${docker.aliyun.name}/${project.artifactId}:6.0.0</imageName>
 					<!-- 下面注释行 使用的指定Dockerfile 文件 构建,如果有该便签  参数配置打包不起作用 -->
 					<!-- <dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory> -->
 					<!-- 是否覆盖相同镜像的 tags -->
@@ -54,7 +54,7 @@
 					<!-- 镜像类型 -->
 					<baseImage>java</baseImage>
 					<!-- docker 运行的时执行指令 -->
-					<entryPoint>["java","-jar","-XX:+UseG1GC","-XX:+PrintGCDetails","-XX:+PrintGCTimeStamps","-XX:+PrintGCDateStamps","-Xloggc:./instructions.log","-Xms128m","-Xmx128m","-XX:MetaspaceSize=96m","-XX:MaxMetaspaceSize=96m","/${project.build.finalName}.jar"]</entryPoint>
+					<entryPoint>["java","-jar","-XX:+PrintGCDetails","-XX:+PrintGCTimeStamps","-XX:+PrintGCDateStamps","-Xloggc:./instructions.log","-Xms128m","-Xmx128m","-XX:MetaspaceSize=96m","-XX:MaxMetaspaceSize=96m","/${project.build.finalName}.jar"]</entryPoint>
 					<!-- 远程推送镜像至服务器 -->
 					<dockerHost>${docker.url}</dockerHost>
 					<!-- 远程推送镜像至阿里云私服 -->

+ 5 - 1
ctkcloud-instructions-service/src/main/resources/application.yml

@@ -21,4 +21,8 @@ spring:
 server:
   port: 8884
 spring:
-  profiles: s5
+  profiles: s5
+---
+spring:
+  profiles:
+    active: s1

+ 4 - 2
ctkcloud-instructions-service/src/main/resources/bootstrap.yml

@@ -1,14 +1,15 @@
 spring:
   application:
     name: instructions-service
-  tcpUrl: db.comtti.net:9250
+  tcpUrl: 172.16.0.11:9250
+  #tcpUrl: 193.112.16.187:9250
 # cloud 配置中心地址
   cloud:
     config:
       discovery:
         enabled: true
         service-id: config-service
-      profile: test
+      profile: prod
       label: master
       username: ctk_miss
       password: actor#config_server
@@ -18,3 +19,4 @@ eureka:
   client:
     serviceUrl:
       defaultZone: http://admin:comtika2018@peer1:8761/eureka/,http://admin:comtika2018@peer2:8762/eureka/
+      #defaultZone: http://admin:comtika2018@localhost:8761/eureka/

+ 2 - 2
ctkcloud-logs-service/pom.xml

@@ -40,12 +40,12 @@
             <artifactId>docker-maven-plugin</artifactId>
             <version>0.4.13</version>
             <configuration>
-                <imageName>${docker.aliyun.registry}/${docker.aliyun.name}/${project.artifactId}:5.0.3</imageName>
+                <imageName>${docker.aliyun.registry}/${docker.aliyun.name}/${project.artifactId}:6.0.0</imageName>
                 <!-- <dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory> -->
                 <!-- 如果有相同的覆盖 -->
                 <forceTags>true</forceTags>
                 <baseImage>java</baseImage>
-                <entryPoint>["java","-jar","-XX:+UseG1GC","-XX:+PrintGCDetails","-XX:+PrintGCTimeStamps","-XX:+PrintGCDateStamps","-Xloggc:./log.log","-Xms128m","-Xmx128m","-XX:MetaspaceSize=128m","-XX:MaxMetaspaceSize=128m","/${project.build.finalName}.jar"]</entryPoint>
+                <entryPoint>["java","-jar","-XX:+PrintGCDetails","-XX:+PrintGCTimeStamps","-XX:+PrintGCDateStamps","-Xloggc:./log.log","-Xms128m","-Xmx128m","-XX:MetaspaceSize=128m","-XX:MaxMetaspaceSize=128m","/${project.build.finalName}.jar"]</entryPoint>
                 <dockerHost>${docker.url}</dockerHost>
                 <registryUrl>${docker.aliyun.registry}</registryUrl>
                 <serverId>docker_actor</serverId>

+ 1 - 2
ctkcloud-logs-service/src/main/java/com/comtika/ctkcloud/server/config/es/SearchESUtil.java

@@ -15,8 +15,7 @@ import com.comtika.ctkcloud.condition.es.JestClientApi;
 import io.searchbox.core.SearchResult;
 
 @Component
-public class SearchESUtil
-{
+public class SearchESUtil {
     @Autowired
     private JestClientApi jestClientApi;
 

+ 3 - 4
ctkcloud-logs-service/src/main/java/com/comtika/ctkcloud/server/service/LogsServiceImpl.java

@@ -8,8 +8,7 @@ import com.comtika.ctkcloud.common.result.RespWrapper;
 import com.comtika.ctkcloud.server.config.es.SearchESUtil;
 
 @Service
-public class LogsServiceImpl implements LogsService
-{
+public class LogsServiceImpl implements LogsService {
 
     @Autowired
     private SearchESUtil searchESUtil;
@@ -28,9 +27,9 @@ public class LogsServiceImpl implements LogsService
 			} catch (Exception e1) {
 				e1.printStackTrace();
 				return RespWrapper.makeFailResp("查询日志出错!" + e.getMessage());
-				
+
 			}
-            
+
         }
     }
 

+ 5 - 1
ctkcloud-logs-service/src/main/resources/application.yml

@@ -16,4 +16,8 @@ spring:
 server:
   port: 9024
 spring:
-  profiles: s4
+  profiles: s4
+---
+spring:
+  profiles:
+    active: s1

+ 3 - 5
ctkcloud-logs-service/src/main/resources/bootstrap.yml

@@ -1,11 +1,8 @@
 spring:
   application:
     name: logs-service
-  tcpUrl: db.comtti.net:9250
-#默认是 是0.1 zikpin采样百分比 前期使用1
-  sleuth:
-    sampler:
-      percentage = 0.5
+  tcpUrl: 172.16.0.11:9250
+  #tcpUrl: 193.112.16.187:9250
 # cloud 配置中心地址
   cloud:
     config:
@@ -22,3 +19,4 @@ eureka:
   client:
     serviceUrl:
       defaultZone: http://admin:comtika2018@peer1:8761/eureka/,http://admin:comtika2018@peer2:8762/eureka/
+#      defaultZone: http://admin:comtika2018@peer1:8761/eureka/

+ 4 - 4
ctkcloud-merchant-service/pom.xml

@@ -20,10 +20,10 @@
 		</dependency>
 
 		<!-- jpa -->
-		<dependency>
+		<!--<dependency>
 			<groupId>org.springframework.boot</groupId>
 			<artifactId>spring-boot-starter-data-jpa</artifactId>
-		</dependency>
+		</dependency>-->
 		<!-- MQ消息队列 -->
 		<dependency>
 			<groupId>org.springframework.boot</groupId>
@@ -62,12 +62,12 @@
 				<artifactId>docker-maven-plugin</artifactId>
 				<version>0.4.13</version>
 				<configuration>
-					<imageName>${docker.aliyun.registry}/${docker.aliyun.name}/${project.artifactId}:5.0.4</imageName>
+					<imageName>${docker.aliyun.registry}/${docker.aliyun.name}/${project.artifactId}:6.0.0</imageName>
 					<!-- <dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory> -->
 					<!-- 如果有相同的覆盖 -->
 					<forceTags>true</forceTags>
 					<baseImage>java</baseImage>
-					<entryPoint>["java","-jar","-XX:+UseG1GC","-XX:+PrintGCDetails","-XX:+PrintGCTimeStamps","-XX:+PrintGCDateStamps","-Xloggc:/protocol.log","-Xms256m","-Xmx256m","-XX:MetaspaceSize=256m","-XX:MaxMetaspaceSize=256m","/${project.build.finalName}.jar"]</entryPoint>
+					<entryPoint>["java","-jar","-XX:+PrintGCDetails","-XX:+PrintGCTimeStamps","-XX:+PrintGCDateStamps","-Xloggc:/protocol.log","-Xms256m","-Xmx256m","-XX:MetaspaceSize=256m","-XX:MaxMetaspaceSize=256m","/${project.build.finalName}.jar"]</entryPoint>
 					<dockerHost>${docker.url}</dockerHost>
 					<registryUrl>${docker.aliyun.registry}</registryUrl>
 					<serverId>docker_actor</serverId>

+ 3 - 5
ctkcloud-merchant-service/src/main/resources/bootstrap.yml

@@ -1,11 +1,8 @@
 spring:
   application:
     name: merchant-service
-  tcpUrl: db.comtti.net:9250
-#默认是 是0.1 zikpin采样百分比 前期使用1prod,test
-  sleuth:
-    sampler:
-      percentage = 0.1
+  tcpUrl: 172.16.0.11:9250
+  #tcpUrl: 193.112.16.187:9250
 # cloud 配置中心地址
   cloud:
     config:
@@ -22,3 +19,4 @@ eureka:
   client:
     serviceUrl:
       defaultZone: http://admin:comtika2018@peer1:8761/eureka/,http://admin:comtika2018@peer2:8762/eureka/
+#      defaultZone: http://admin:comtika2018@peer1:8761/eureka/

+ 2 - 8
ctkcloud-messagepush-service/pom.xml

@@ -85,12 +85,6 @@
             <groupId>org.projectlombok</groupId>
             <artifactId>lombok</artifactId>
         </dependency>
-        <dependency>
-            <groupId>com.comtika</groupId>
-            <artifactId>ctkcloud-protocol-service</artifactId>
-            <version>0.0.1-SNAPSHOT</version>
-            <scope>compile</scope>
-        </dependency>
     </dependencies>
 	<build>
 		<plugins>
@@ -108,12 +102,12 @@
 				<artifactId>docker-maven-plugin</artifactId>
 				<version>0.4.13</version>
 				<configuration>
-					<imageName>${docker.aliyun.registry}/${docker.aliyun.name}/${project.artifactId}:5.3.0</imageName>
+					<imageName>${docker.aliyun.registry}/${docker.aliyun.name}/${project.artifactId}:6.0.0</imageName>
 					<!-- <dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory> -->
 					<!-- 如果有相同的覆盖 -->
 					<forceTags>true</forceTags>
 					<baseImage>java</baseImage>
-					<entryPoint>["java","-jar","-XX:+PrintGCDetails","-XX:+PrintGCTimeStamps","-XX:+PrintGCDateStamps","-Xloggc:/message.log","-Xms256m","-Xmx256m","-XX:MetaspaceSize=256m","-XX:MaxMetaspaceSize=256m","/${project.build.finalName}.jar"]</entryPoint>
+					<entryPoint>["java","-jar","-XX:+PrintGCDetails","-XX:+PrintGCTimeStamps","-XX:+PrintGCDateStamps","-Xloggc:/message.log","-Xms128m","-Xmx128m","-XX:MetaspaceSize=128m","-XX:MaxMetaspaceSize=128m","/${project.build.finalName}.jar"]</entryPoint>
 					<dockerHost>${docker.url}</dockerHost>
 					<registryUrl>${docker.aliyun.registry}</registryUrl>
 					<serverId>docker_actor</serverId>

+ 3 - 2
ctkcloud-messagepush-service/src/main/java/com/comtika/ctkcloud/server/base/config/MessageConfig.java

@@ -8,7 +8,8 @@ import org.springframework.context.annotation.Configuration;
 @Data
 @RefreshScope
 public class MessageConfig {
-	
+	public static final String DEFAULT_OPEN_TYPE = "COMTIKA-ZN";
+
 	@Value("${wx.appid}")
 	private String wxAppId;
 	@Value("${wx.appSecret}")
@@ -54,6 +55,6 @@ public class MessageConfig {
 
 
 
-	
+
 
 }

+ 9 - 2
ctkcloud-messagepush-service/src/main/java/com/comtika/ctkcloud/server/controller/message/MessagePushController.java

@@ -1,8 +1,10 @@
 package com.comtika.ctkcloud.server.controller.message;
+import com.comtika.ctkcloud.server.entity.third.WxOpenType;
 import io.swagger.annotations.ApiOperation;
 
 import java.util.Date;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 import org.springframework.beans.factory.annotation.Autowired;
@@ -82,8 +84,13 @@ public class MessagePushController extends BaseController {
         System.out.println("测试发送消息");
     }
 
-
-
+    // 测试使用发送测试消息
+    @Deprecated
+    @GetMapping("sendMissTest")
+    public List<WxOpenType> sendMissTest(Integer id){
+        if(id == null)id = 20024;
+        return messageService.sendMissTest(id);
+    }
 
 
     /**

+ 17 - 3
ctkcloud-messagepush-service/src/main/java/com/comtika/ctkcloud/server/controller/wx/WxchatHandleController.java

@@ -1,6 +1,7 @@
 package com.comtika.ctkcloud.server.controller.wx;
 
 import com.comtika.ctkcloud.common.base.action.BaseController;
+import com.comtika.ctkcloud.common.bean.user.LoginUser;
 import com.comtika.ctkcloud.common.result.RespWrapper;
 import com.comtika.ctkcloud.common.util.StringUtil;
 import com.comtika.ctkcloud.server.service.WxChatHandleService;
@@ -26,14 +27,27 @@ public class WxchatHandleController extends BaseController {
     @Autowired
     private WxChatHandleService wxChatHandleService;
 
-    @ApiOperation(value="微信工作号授权",notes="微信工作号授权")
+    @ApiOperation(value="微信工作号授权;增加参数 openType为类型:代表是什么公众号 传参方式  ?openType=COMTIKA-ZH (COMTIKA-ZH 代表康体佳智慧)")
     @ApiImplicitParam(name="code",value = "微信授权唯一标识",required = true, dataType = "String",paramType = "path")
     @PostMapping("/wxPnAuther")
-    public RespWrapper<Boolean> wxPnAuther(String code){
+    public RespWrapper<Boolean> wxPnAuther(String code,String openType){
         if(StringUtil.isEmpty(code)) return RespWrapper.makeFailResp("授权code不能为空");
         Long userId = super.getCurrentIdByHead();
         if(userId == null) return RespWrapper.makeFailResp("根据请求头获取用户信息失败");
-        return  wxChatHandleService.wxPnAuther(code,userId);
+        return  wxChatHandleService.wxPnAuther(code,userId,openType);
+    }
+    @ApiOperation("公众号解绑操作;openType 公众号类型,不传为康体佳智能公众号;loginName=解绑人手机号,解绑时,提示用户输入登录账户,输入错误解绑失败")
+    @GetMapping("unBindAuth")
+    public RespWrapper<Boolean> unBindAuth(String openType,String loginName){
+        if(StringUtil.isEmpty(loginName))
+            return RespWrapper.makeFailResp("验证登录名不能为空");
+        LoginUser currentLoginUser = super.getCurrentLoginUser();
+        if(currentLoginUser == null)
+            return RespWrapper.makeUnLoginResp("请先登录");
+        if (!loginName.equals(currentLoginUser.getLoginName())) {
+            return RespWrapper.makeFailResp("登录名验证错误");
+        }
+        return wxChatHandleService.unBindAuth(openType,currentLoginUser.getUserId());
     }
 
 

+ 15 - 32
ctkcloud-messagepush-service/src/main/java/com/comtika/ctkcloud/server/core/MessageHandleUtil.java

@@ -5,6 +5,7 @@ import com.comtika.ctkcloud.common.result.RespWrapper;
 import com.comtika.ctkcloud.server.base.config.MessageConfig;
 import com.comtika.ctkcloud.server.entity.SmallMessageHelp;
 import com.comtika.ctkcloud.server.entity.TemplateHelp;
+import com.comtika.ctkcloud.server.entity.third.WxOpenType;
 import com.comtika.ctkcloud.server.entity.warn.WarnMessageEntity;
 import com.comtika.ctkcloud.server.util.EnumMethod;
 import com.comtika.ctkcloud.server.util.HttpRequest;
@@ -29,6 +30,10 @@ public class MessageHandleUtil {
         }
         return  null;
     }
+    public String getWeChatOpenToken(WxOpenType wxOpenType){
+        wxOpenType.checkWeChatParams(messageConfig);
+        return HttpRequest.getAccessToken(messageConfig.getAccessToken(), wxOpenType.getAppId(), wxOpenType.getSecret());
+    }
     /**根据获取token类型不同 从而获取对应的token*/
     public String getTocken(TemplateHelp help){
         return HttpRequest.getAccessToken(messageConfig.getAccessToken(), help.getWxAppId(), help.getSecret());
@@ -42,48 +47,26 @@ public class MessageHandleUtil {
     public JSONObject sendMessagePublicNumber(String token, String json){//https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=ACCESS_TOKEN
         return HttpRequest.sendTemplateMsg(token, "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=ACCESS_TOKEN", json);
     }
-
+    // 获取工作号的参数
     /**获取用户OppenId*/
-    public RespWrapper<String> autherUserOppenId(String code)throws Exception {
+    public RespWrapper<String> autherUserOppenId(String code) {
         //https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code
         String url = messageConfig.getWxPnAuthUrl().replace("APPID",messageConfig.getWxPnAppid()).replace("SECRET",messageConfig.getWxPnSecret()).replace("CODE",code);
+        return doWxChatOpenAuth(url);
+    }
+    private RespWrapper<String> doWxChatOpenAuth(String url){
         JSONObject jsonObject = HttpRequest.httpRequest(url, EnumMethod.GET.name(), null);
         System.out.println("商户授权结果:"+jsonObject);
         Object openid = jsonObject.get("openid");
         if(openid != null) return RespWrapper.makeSuccessResp(openid.toString());
         return RespWrapper.makeFailResp(jsonObject.get("errmsg").toString());
     }
-    public static void main(String[] args)throws Exception{
-        //061NMGko15rlUq0bo3ko18NLko1NMGky
-       /* String st = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code";
-        String url =  st.replace("APPID","wxec504e0378010e16").replace("SECRET","3c3da2c3cb43c7d97b5f94472ef14047").replace("CODE","061NMGko15rlUq0bo3ko18NLko1NMGky");
-        System.out.println("请求路径为:"+url);
-        JSONObject jsonObject = HttpRequest.httpRequest(url, EnumMethod.GET.name(), null);
-        System.out.println("商户授权结果:"+jsonObject);*/
-       //下面模拟发送公众号消息
-        WarnMessageEntity warnEntiy  = new WarnMessageEntity();
-        warnEntiy.setStartTime(1539167462000L);
-        warnEntiy.setWarnType("过压");
-        warnEntiy.setTerminalNo("100050380");
-        warnEntiy.setSerialNo("100050301");
-        warnEntiy.setEquipName("16路电单车交流");
-        warnEntiy.setSiteName("梧桐岛");
-        warnEntiy.setWarnLevl(1);
-        RespWrapper<String> data = MessageDataHandle.createWarnMessage(warnEntiy,false);
-        System.out.println("组装封装数据:"+data.isSuccess());
-        System.out.println("组装封装数据:"+data.getMsg());
-        MessageHandleUtil u = new MessageHandleUtil();
+    public RespWrapper<String> wxChatOpenAuth(String code, WxOpenType wxOpenType){
+        wxOpenType.checkWeChatParams(messageConfig);
+        String url = messageConfig.getWxPnAuthUrl().replace("APPID",wxOpenType.getAppId()).replace("SECRET",wxOpenType.getSecret()).replace("CODE",code);
+        return doWxChatOpenAuth(url);
+    }
 
-        String token = HttpRequest.getAccessToken("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET", "wxec504e0378010e16", "3c3da2c3cb43c7d97b5f94472ef14047");
-        System.out.println(token);
 
-        String json = MessageDataHandle.toJsonPN("oJ-kq1F0GtuQKdrYSc2mYwSm0Rmc", MessageTemplateType.WX_WARN_PUBLIC_NUMBER.getTemplateId(), data.getData());
-        System.out.println("组装发送数据:"+json);
-        //https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=ACCESS_TOKEN
-        //https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=ACCESS_TOKEN
-        //JSONObject jsonObject = u.sendMessage(token, json);
-        JSONObject jsonObject = HttpRequest.sendTemplateMsg(token,"https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=ACCESS_TOKEN", json);
-        System.out.println("结果:"+jsonObject);
-    }
 
 }

+ 33 - 0
ctkcloud-messagepush-service/src/main/java/com/comtika/ctkcloud/server/core/cache/MessageCache.java

@@ -10,8 +10,10 @@ import com.comtika.ctkcloud.common.base.constant.ProjectConstant;
 import com.comtika.ctkcloud.common.enums.msg.MessageTemplateType;
 import com.comtika.ctkcloud.common.util.StringUtil;
 import com.comtika.ctkcloud.server.dao.SmallMessageDao;
+import com.comtika.ctkcloud.server.dao.WxOpenTypeDao;
 import com.comtika.ctkcloud.server.entity.CtkSmallMessage;
 import com.comtika.ctkcloud.server.entity.TemplateHelp;
+import com.comtika.ctkcloud.server.entity.third.WxOpenType;
 import com.comtika.ctkcloud.server.entity.warn.AutoHandleWarnEntity;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -32,6 +34,37 @@ public class MessageCache {
 
 	@Autowired
 	private RedisApi redisApi;
+
+	private static final String We_CHAT_PREFIX = "wx_%s_open_key";
+	public WxOpenType findWxChetOpen(WxOpenTypeDao wxOpenTypeDao, String openType){
+		return doFindWxChetOpen(wxOpenTypeDao,openType,true);
+	}
+	// 有重试机制
+	private WxOpenType doFindWxChetOpen(WxOpenTypeDao wxOpenTypeDao, String openType,boolean isRetry){
+		String key = String.format(We_CHAT_PREFIX,openType);
+		try {
+			Object o = redisApi.get(key);//这里转换失败
+			if(o != null) return (WxOpenType) o;
+			WxOpenType wxOpenType = new WxOpenType();
+			wxOpenType.setWxName(openType);
+			wxOpenType = wxOpenTypeDao.templateOne(wxOpenType);
+			if(wxOpenType == null){
+				wxOpenType = new WxOpenType();
+				redisApi.set(key,wxOpenType,5L,TimeUnit.MINUTES);
+			}else {
+				redisApi.set(key,wxOpenType,2L,TimeUnit.HOURS);
+			}
+			return wxOpenType;
+		}catch (Exception e){
+			e.printStackTrace();
+			redisApi.remove(key);// 清除缓存
+			if(isRetry) return doFindWxChetOpen(wxOpenTypeDao,openType,false);
+			return new WxOpenType();
+		}
+	}
+
+
+
 	/**查询指定的告警上报数据*/
 	public NodeWarnData findWarnDataList(String addrNo,String nodeNo,int plugNo){
 		//return findWarnDataList(String.format(WARN_DATA, addrNo,nodeNo,plugNo));

+ 10 - 4
ctkcloud-messagepush-service/src/main/java/com/comtika/ctkcloud/server/core/mq/WarnChannelAwareMessageListener.java

@@ -7,17 +7,23 @@ import org.springframework.amqp.rabbit.core.ChannelAwareMessageListener;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.util.regex.Pattern;
+
 @Component
 public class WarnChannelAwareMessageListener implements ChannelAwareMessageListener {
-
+    // 判断都是数据
+    private final static Pattern pattern = Pattern.compile("^-?[0-9]+");
     @Autowired
     private MessageService messageService;
+
     // 这里消息处理
     @Override
     public void onMessage(Message message, Channel channel) throws Exception {
         String terminalNo = new String(message.getBody());
-        System.out.println("接受消息为:"+terminalNo);
-        if(terminalNo.length() == 12)
-            messageService.fadSendWarnMessageToManage(terminalNo);
+        if(terminalNo.length() == 12){
+            if(pattern.matcher(terminalNo).matches())
+                messageService.fadSendWarnMessageToManage(terminalNo);
+            else System.out.println("告警消息通知集中器编号不是全数字,集中器编号为:"+terminalNo);
+        }else System.out.println("告警消息通知集中器编号不是12位,集中器编号:"+terminalNo);
     }
 }

+ 9 - 4
ctkcloud-messagepush-service/src/main/java/com/comtika/ctkcloud/server/dao/MessagePushDao.java

@@ -1,9 +1,12 @@
 package com.comtika.ctkcloud.server.dao;
 
-import com.comtika.ctkcloud.server.entity.*;
-import com.comtika.ctkcloud.server.entity.message.CtkMchMessage;
+import com.comtika.ctkcloud.server.entity.FadTerminalWarn;
+import com.comtika.ctkcloud.server.entity.TerminalBase;
+import com.comtika.ctkcloud.server.entity.SmallMessageHelp;
+import com.comtika.ctkcloud.server.entity.UserThirdBaseHelp;
 import com.comtika.ctkcloud.server.entity.message.help.MessageHandleHelp;
 import com.comtika.ctkcloud.server.entity.message.help.SimpleUserInfoHelp;
+import com.comtika.ctkcloud.server.entity.third.WxOpenType;
 import org.beetl.sql.core.annotatoin.Param;
 import org.beetl.sql.core.annotatoin.Sql;
 import org.beetl.sql.core.annotatoin.SqlResource;
@@ -18,6 +21,8 @@ public interface MessagePushDao {
 
     @Sql(value = "select su.phone_no,st.wechat_pn_oppen_id from sys_user su left join sys_user_third_id st on su.id = st.user_id where su.id = ? limit 1")
     UserThirdBaseHelp findUserBaseInfo(Integer userId);
+    @Sql(value = "SELECT su.phone_no FROM sys_user su WHERE su.id = ? LIMIT 1")
+    String findUserPhoneNo(Integer userId);
 
 
    // List<Map<String,Object>> findSerialNo();
@@ -37,6 +42,6 @@ public interface MessagePushDao {
     @Sql(value = "select t.equip_type,cs.site_name,cs.merchant_id,cs.site_manager admin_id from ctk_site cs LEFT JOIN ctk_equip_terminal t on cs.id = t.site_id where t.terminal_no = ? limit 1")
     FadTerminalWarn findFadTerminalWarn(String terminalNo);
 
-    @Sql(value = "select *from ctk_mch_message m where m.mch_id = ? limit 1 ")
-    CtkMchMessage findMchMessageConfig(Integer merchantId);
+    @Sql(value = "select op.*,t.wechat_pn_oppen_id open_id from sys_user_third_id t LEFT JOIN wx_open_type op on t.open_type = op.id where t.`status` = 1 and t.user_id = ?")
+    List<WxOpenType> findWxOpenTypeList(Integer userId);
 }

+ 1 - 1
ctkcloud-messagepush-service/src/main/java/com/comtika/ctkcloud/server/dao/WarnRecordDao.java

@@ -16,7 +16,7 @@ public interface WarnRecordDao extends BaseMapper<SysWarnRecord> {
     /**商户端查询告警列表*/
     PageQuery<Map<String, Object>> getWarnRecordListInMerchant(PageQuery<Map<String, Object>> pageQuery);
 
-    Map<String,Object> checkUserBindPNOppenId(Map<String, Object> map);
+    String checkUserBindPNOppenId(Map<String, Object> map);
 
     /**修改插座状态*/
     @Sql(value = "update ctk_equip_socket s set s.socket_status = ? where s.serial_no = ?")

+ 7 - 0
ctkcloud-messagepush-service/src/main/java/com/comtika/ctkcloud/server/dao/WxOpenTypeDao.java

@@ -0,0 +1,7 @@
+package com.comtika.ctkcloud.server.dao;
+
+import com.comtika.ctkcloud.server.entity.third.WxOpenType;
+import org.beetl.sql.core.mapper.BaseMapper;
+
+public interface WxOpenTypeDao extends BaseMapper<WxOpenType> {
+}

+ 2 - 0
ctkcloud-messagepush-service/src/main/java/com/comtika/ctkcloud/server/entity/third/SysUserThirdId.java

@@ -10,4 +10,6 @@ public class SysUserThirdId {
     private Integer id;//唯一自增的
     private Integer userId;//商户用户id
     private String wechatPnOppenId;//微信工作号oppenId
+    private Integer openType;//公众号类型
+    private Integer status;// 状态 0 为停用 1启用
 }

+ 33 - 0
ctkcloud-messagepush-service/src/main/java/com/comtika/ctkcloud/server/entity/third/WxOpenType.java

@@ -0,0 +1,33 @@
+package com.comtika.ctkcloud.server.entity.third;
+
+import com.comtika.ctkcloud.common.enums.msg.MessageTemplateType;
+import com.comtika.ctkcloud.server.base.config.MessageConfig;
+import lombok.Data;
+import org.beetl.sql.core.annotatoin.AutoID;
+
+import javax.persistence.Transient;
+
+
+@Data
+public class WxOpenType {
+    @AutoID
+    private Integer id;
+    private String wxName;//公众号名称
+    private String nickName;//中文名称
+    private String appId;//公众号id
+    private String secret;//app secret
+    private String templateId;//模版id
+    private String notifyUrl;//增加公众号消息点击回调
+    // 数据库忽略方法
+    @Transient
+    private String openId;
+
+    public void checkWeChatParams(MessageConfig messageConfig){
+        if(id == 1){
+            appId = messageConfig.getWxPnAppid();
+            secret = messageConfig.getWxPnSecret();
+            // 下面这里是告警通知
+            templateId = MessageTemplateType.WX_WARN_PUBLIC_NUMBER.getTemplateId();
+        }
+    }
+}

+ 3 - 0
ctkcloud-messagepush-service/src/main/java/com/comtika/ctkcloud/server/service/MessageService.java

@@ -3,6 +3,7 @@ package com.comtika.ctkcloud.server.service;
 import com.comtika.ctkcloud.common.enums.msg.MessageTemplateType;
 import com.comtika.ctkcloud.common.result.RespWrapper;
 import com.comtika.ctkcloud.server.entity.chargeserver.CtkServiceOrder;
+import com.comtika.ctkcloud.server.entity.third.WxOpenType;
 import com.comtika.ctkcloud.server.entity.warn.WarnMessageEntity;
 
 import java.util.List;
@@ -40,4 +41,6 @@ public interface MessageService {
 	RespWrapper<Boolean> sendSubscribeMessageToWeChat(CtkServiceOrder order, Integer type);
 
     RespWrapper<Map<String, Object>> findMessageAcceptList(Integer siteId);
+
+    List<WxOpenType> sendMissTest(Integer id);
 }

+ 2 - 6
ctkcloud-messagepush-service/src/main/java/com/comtika/ctkcloud/server/service/WarnRecordService.java

@@ -2,7 +2,7 @@ package com.comtika.ctkcloud.server.service;
 
 import java.util.Map;
 
-import com.comtika.ctkcloud.server.entity.message.CtkMchMessage;
+import com.comtika.ctkcloud.common.bean.user.LoginUser;
 import org.beetl.sql.core.engine.PageQuery;
 
 import com.comtika.ctkcloud.common.bean.device.NodeWarnData;
@@ -25,11 +25,7 @@ public interface WarnRecordService {
 	/**商户端查询*/
 	RespWrapper<PageQuery<Map<String, Object>>> getWarnRecordListInMerchant(PageQuery<Map<String, Object>> pageQuery,Boolean warnStatus,Long handleUserId);
 	/**判断用户是否绑定oppid*/
-	RespWrapper<Object> checkUserBindPNOppenId(Long userId);
+	RespWrapper<String> checkUserBindPNOppenId(LoginUser currentLoginUser, String openType);
 
 	RespWrapper<Boolean> autoHandleWarnRecord(int warnId, int handleUserId,String siteName);
-
-    RespWrapper<CtkMchMessage> findMerchantConfigMessage(Integer mch);
-
-	RespWrapper<Boolean> configMerchantMessage(CtkMchMessage ctkMchMessage);
 }

+ 3 - 1
ctkcloud-messagepush-service/src/main/java/com/comtika/ctkcloud/server/service/WxChatHandleService.java

@@ -4,5 +4,7 @@ import com.comtika.ctkcloud.common.result.RespWrapper;
 
 public interface WxChatHandleService {
     /**微信授权*/
-    RespWrapper<Boolean> wxPnAuther(String code, Long userId);
+    RespWrapper<Boolean> wxPnAuther(String code, Long userId,String wxChetType);
+
+    RespWrapper<Boolean> unBindAuth(String openType, Long userId);
 }

+ 354 - 331
ctkcloud-messagepush-service/src/main/java/com/comtika/ctkcloud/server/service/impl/MessageServiceImpl.java

@@ -1,6 +1,7 @@
 package com.comtika.ctkcloud.server.service.impl;
 
 import java.util.*;
+import java.util.regex.Pattern;
 
 import com.comtika.ctkcloud.common.base.constant.ProjectConstant;
 import com.comtika.ctkcloud.server.core.MessageConstant;
@@ -11,9 +12,9 @@ import com.comtika.ctkcloud.server.core.enums.PhoneSendType;
 import com.comtika.ctkcloud.server.dao.EquipTerminalDao;
 import com.comtika.ctkcloud.server.dao.SmallMessageDao;
 import com.comtika.ctkcloud.server.entity.*;
-import com.comtika.ctkcloud.server.entity.message.CtkMchMessage;
 import com.comtika.ctkcloud.server.entity.message.help.MessageHandleHelp;
 import com.comtika.ctkcloud.server.entity.message.help.SimpleUserInfoHelp;
+import com.comtika.ctkcloud.server.entity.third.WxOpenType;
 import com.comtika.ctkcloud.server.entity.warn.WarnMessageEntity;
 import com.comtika.ctkcloud.server.service.SendMessageService;
 import net.sf.json.JSONObject;
@@ -38,16 +39,18 @@ import com.comtika.ctkcloud.server.service.MessageService;
 import com.comtika.ctkcloud.server.util.HttpRequest;
 import com.comtika.ctkcloud.server.util.MessageDataHandle;
 
+import javax.persistence.Transient;
+
 
 @Service
 @Transactional
 public class MessageServiceImpl implements MessageService {
 
-	@Autowired
-	private MessageHandleUtil messageHandleUtil;
+    @Autowired
+    private MessageHandleUtil messageHandleUtil;
 
-	@Autowired
-	private MessageConfig messageConfig;
+    @Autowired
+    private MessageConfig messageConfig;
 
     @Autowired
     private MessagePushDao messagePushDao;
@@ -55,360 +58,380 @@ public class MessageServiceImpl implements MessageService {
 	/*@Autowired
 	private ThirdUserDao thirdUserDao;*/
 
-	@Autowired
-	private SmallMessageDao smallMessageDao;
-	@Autowired
-	private MessageCache messageCache;
+    @Autowired
+    private SmallMessageDao smallMessageDao;
+    @Autowired
+    private MessageCache messageCache;
+
+    @Autowired
+    private SendMessageService sendMessageService;
+    @Autowired
+    private EquipTerminalDao equipTerminalDao;
 
-	@Autowired
-	private SendMessageService sendMessageService;
-	@Autowired
-	private EquipTerminalDao equipTerminalDao;
     /**
-     *
-     * @Title: pushWxMessage
-     * @Description: TODO(微信消息推送 需根据不同模版推送)
      * @param order
      * @param formId
      * @param template
-     * @return
-     * RespWrapper<String>
+     * @return RespWrapper<String>
      * @throws
-     * @变更记录  2018年9月12日 下午11:27:31 actor_miss create
+     * @Title: pushWxMessage
+     * @Description: TODO(微信消息推送 需根据不同模版推送)
+     * @变更记录 2018年9月12日 下午11:27:31 actor_miss create
      */
     private RespWrapper<String> pushWxMessage(CtkServiceOrder order,
-			String formId, String template,String openId,boolean isEnd) {
-    	try{
-			// 这里需要修改下
-			String token = messageHandleUtil.getTocken(WXTokenType.XCX);
-			if(token == null) {
-				System.out.println("获取token 失败");
-				return RespWrapper.makeFailResp("获取token");
-			}
-			return pushWxMessage(order,formId,template,openId,isEnd,token);
-        }catch (Exception e){
-        	e.printStackTrace();
-        	return RespWrapper.makeErrorResp("异常:"+e.getMessage());
+                                              String formId, String template, String openId, boolean isEnd) {
+        try {
+            // 这里需要修改下
+            String token = messageHandleUtil.getTocken(WXTokenType.XCX);
+            if (token == null) {
+                System.out.println("获取token 失败");
+                return RespWrapper.makeFailResp("获取token");
+            }
+            return pushWxMessage(order, formId, template, openId, isEnd, token);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return RespWrapper.makeErrorResp("异常:" + e.getMessage());
         }
 
     }
+
     private RespWrapper<String> pushWxMessage(CtkServiceOrder order,
-			String formId, String template,String openId,boolean isEnd,String token) {
-    	try {
-    		if(StringUtil.isEmpty(openId)){
-				openId = messagePushDao.findCustomerById(order.getCustomerId());
-				if(StringUtil.isEmpty(openId))return RespWrapper.makeFailResp("根据用户id查询openId失败");
-			}
-            RespWrapper<String> returnMap = MessageDataHandle.createTempalteReturnMap(order,isEnd,true);
-            if(!returnMap.isSuccess()){
-            	return RespWrapper.makeFailResp(returnMap.getMsg());
+                                              String formId, String template, String openId, boolean isEnd, String token) {
+        try {
+            if (StringUtil.isEmpty(openId)) {
+                openId = messagePushDao.findCustomerById(order.getCustomerId());
+                if (StringUtil.isEmpty(openId)) return RespWrapper.makeFailResp("根据用户id查询openId失败");
+            }
+            RespWrapper<String> returnMap = MessageDataHandle.createTempalteReturnMap(order, isEnd, true);
+            if (!returnMap.isSuccess()) {
+                return RespWrapper.makeFailResp(returnMap.getMsg());
             }
 
-            String json = MessageDataHandle.toJson(true,openId,template,messageConfig.getWxPage(),formId,returnMap.getData());
-            JSONObject jsonObject = messageHandleUtil.sendMessage(token,json);
-			System.out.println("发送公众号消息结果:"+jsonObject.toString());
+            String json = MessageDataHandle.toJson(true, openId, template, messageConfig.getWxPage(), formId, returnMap.getData());
+            JSONObject jsonObject = messageHandleUtil.sendMessage(token, json);
+            System.out.println("发送公众号消息结果:" + jsonObject.toString());
             return RespWrapper.makeSuccessResp(jsonObject.toString());
-        }catch (Exception e){
-        	e.printStackTrace();
-        	return RespWrapper.makeErrorResp("异常:"+e.getMessage());
+        } catch (Exception e) {
+            e.printStackTrace();
+            return RespWrapper.makeErrorResp("异常:" + e.getMessage());
+        }
+    }
+
+    @Override
+    public RespWrapper<Boolean> sendSubscribeMessageToWeChat(CtkServiceOrder order, Integer type) {
+        SmallMessageHelp help = messagePushDao.findCustomerMessageInfo(order.getCustomerId());
+        if (help == null) return RespWrapper.makeFailResp("根据用户查询基本信息错误");
+        if (help.getLoginType() == 2)
+            return RespWrapper.makeFailResp("暂时不支持支付宝订阅消息");
+        TemplateHelp template = null;
+        switch (type) {
+            case 1:
+                template = messageCache.findTemplateId(help.getAppId(), 3, smallMessageDao);
+                break;
+        }
+        if (template == null) return RespWrapper.makeFailResp("暂时不支持该类型的订阅消息");
+        template.checkSmall(messageConfig);
+        String token = HttpRequest.findSubAccessToken(template.getWxAppId(), template.getSecret());
+        RespWrapper<String> res = sendSubscribeMessageToWeChat(order, template.getTemplate(), help.getOpenId(), type, token);
+        if (res.isSuccess()) return RespWrapper.makeSuccessResp(true);
+        return RespWrapper.makeFailResp(res.getMsg());
+    }
+
+    // 查询消息接收人 与处理人
+    // select cs.site_manager site_admin,m.manager_id merchant_admin,m.marketer_id from ctk_site cs LEFT JOIN ctk_merchant_detail m on cs.merchant_id = m.id limit 1
+    @Override
+    public RespWrapper<Map<String, Object>> findMessageAcceptList(Integer siteId) {
+        MessageHandleHelp handleHelp = messagePushDao.findMessageAcceptList(siteId);
+        Integer handleId = handleHelp.getSiteAdmin();
+        if (handleId == null) handleHelp.getMerchantAdmin();
+        List<SimpleUserInfoHelp> list = messagePushDao.findSimpleUserInfo(handleHelp);
+        Map<String, Object> map = new HashMap<>();
+        map.put("acceptUserList", list);
+        list.forEach(s -> {
+            if (s.getId().intValue() == handleId)
+                map.put("handleUser", s);
+        });
+        return RespWrapper.makeSuccessResp(map);
+    }
+
+    @Override
+    public List<WxOpenType> sendMissTest(Integer id) {
+        return messagePushDao.findWxOpenTypeList(id);
+    }
+
+    // 发送订阅消息在微信小陈那个小
+    private RespWrapper<String> sendSubscribeMessageToWeChat(CtkServiceOrder order, String template, String openId, int type, String token) {
+        try {
+            if (StringUtil.isEmpty(openId)) {
+                openId = messagePushDao.findCustomerById(order.getCustomerId());
+                if (StringUtil.isEmpty(openId)) return RespWrapper.makeFailResp("根据用户id查询openId失败");
+            }
+            // 这里需要修改下 使用订单消息模版
+            String dataStr = MessageDataHandle.createSubscribeTemplate(order, type);
+            String json = MessageDataHandle.toJsonInSubscribeWx(openId, template, "pages/subpages/pages/order", dataStr);
+            JSONObject jsonObject = HttpRequest.sendSubMsgNew(token, json);
+            //JSONObject jsonObject = messageHandleUtil.sendMessage(token,json);
+            System.out.println("发送订阅消息结果:" + jsonObject.toString());
+            return RespWrapper.makeSuccessResp(jsonObject.toString());
+        } catch (Exception e) {
+            e.printStackTrace();
+            return RespWrapper.makeErrorResp("异常:" + e.getMessage());
         }
     }
-	@Override
-	public RespWrapper<Boolean> sendSubscribeMessageToWeChat(CtkServiceOrder order, Integer type) {
-		SmallMessageHelp help = messagePushDao.findCustomerMessageInfo(order.getCustomerId());
-		if(help == null) return RespWrapper.makeFailResp("根据用户查询基本信息错误");
-		if(help.getLoginType() == 2)
-			return RespWrapper.makeFailResp("暂时不支持支付宝订阅消息");
-		TemplateHelp template = null;
-		switch (type){
-			case 1:
-				template = messageCache.findTemplateId(help.getAppId(),3,smallMessageDao);
-				break;
-		}
-		if(template == null) return RespWrapper.makeFailResp("暂时不支持该类型的订阅消息");
-		template.checkSmall(messageConfig);
-		String token = HttpRequest.findSubAccessToken(template.getWxAppId(),template.getSecret());
-		RespWrapper<String> res = sendSubscribeMessageToWeChat(order,template.getTemplate(),help.getOpenId(),type,token);
-		if(res.isSuccess())return RespWrapper.makeSuccessResp(true);
-		return RespWrapper.makeFailResp(res.getMsg());
-	}
-	// 查询消息接收人 与处理人
-	// select cs.site_manager site_admin,m.manager_id merchant_admin,m.marketer_id from ctk_site cs LEFT JOIN ctk_merchant_detail m on cs.merchant_id = m.id limit 1
-	@Override
-	public RespWrapper<Map<String, Object>> findMessageAcceptList(Integer siteId) {
-		MessageHandleHelp handleHelp = messagePushDao.findMessageAcceptList(siteId);
-		Integer handleId = handleHelp.getSiteAdmin();
-		if(handleId == null) handleHelp.getMerchantAdmin();
-		List<SimpleUserInfoHelp> list = messagePushDao.findSimpleUserInfo(handleHelp);
-		Map<String,Object> map = new HashMap<>();
-		map.put("acceptUserList",list);
-		list.forEach(s->{
-			if(s.getId().intValue() == handleId)
-				map.put("handleUser",s);
-		});
-		return RespWrapper.makeSuccessResp(map);
-	}
-
-	// 发送订阅消息在微信小陈那个小
-    private RespWrapper<String> sendSubscribeMessageToWeChat(CtkServiceOrder order,String template,String openId,int type,String token){
-		try {
-			if(StringUtil.isEmpty(openId)){
-				openId = messagePushDao.findCustomerById(order.getCustomerId());
-				if(StringUtil.isEmpty(openId))return RespWrapper.makeFailResp("根据用户id查询openId失败");
-			}
-			// 这里需要修改下 使用订单消息模版
-			String dataStr = MessageDataHandle.createSubscribeTemplate(order,type);
-			String json = MessageDataHandle.toJsonInSubscribeWx(openId,template,"pages/subpages/pages/order",dataStr);
-			JSONObject jsonObject = HttpRequest.sendSubMsgNew(token,json);
-			//JSONObject jsonObject = messageHandleUtil.sendMessage(token,json);
-			System.out.println("发送订阅消息结果:"+jsonObject.toString());
-			return RespWrapper.makeSuccessResp(jsonObject.toString());
-		}catch (Exception e){
-			e.printStackTrace();
-			return RespWrapper.makeErrorResp("异常:"+e.getMessage());
-		}
-	}
-
-
-
-
-	/**
-	 *
-	 * @Title: pushAliMessage
-	 * @Description: TODO(支付宝推送消息)
-	 * @param order
-	 * @param formId
-	 * @param template
-	 * @return
-	 * RespWrapper<String>
-	 * @throws
-	 * @变更记录  2018年9月12日 下午11:25:56 actor_miss create
-	 */
+
+
+    /**
+     * @param order
+     * @param formId
+     * @param template
+     * @return RespWrapper<String>
+     * @throws
+     * @Title: pushAliMessage
+     * @Description: TODO(支付宝推送消息)
+     * @变更记录 2018年9月12日 下午11:25:56 actor_miss create
+     */
     private RespWrapper<String> pushAliMessage(CtkServiceOrder order,
-			String formId, String template,String openId) {
-    	 try {
-	    	 /**
-	         * 先检验测试数据
-	         */
-	        List<String> list = new ArrayList<String>();
-	        if(order.getEquipSocketId() == null){
-	        	return RespWrapper.makeFailResp("插座编号不能为空");
-	        }
-	        if(order.getStartTime() == null){
-	        	return RespWrapper.makeFailResp("充电开始时间不能为空");
-	        }
-	        if(order.getSocketSeq() == null){
-	        	return RespWrapper.makeFailResp("设备流水号不能为空");
-	        }
-	        if(StringUtil.isEmpty(openId)){
-				openId = messagePushDao.findCustomerById(order.getCustomerId());
-				if(StringUtil.isEmpty(openId)){
-					return RespWrapper.makeFailResp("根据用户id查询openId失败");
-				}
-			}
-	        String socketSeq = order.getSocketSeq();
-
-	        list.add(socketSeq.substring(socketSeq.length()-2));//插座
-	        list.add(DateTimeUtils.formatDate(new Date(order.getStartTime()), DateTimeUtils.FORMAT));
-	        list.add(MessageDataHandle.orderNoDateAdjust(StringUtil.convertInt(order.getActChargerTime()+"", 0)));
-	        list.add(StringUtil.convertInt(order.getTotalFee()+"", 0)*1.0/100+"元");
-	        list.add(StringUtil.convertInt(order.getTotalCharge()+"", 0)*1.0/100+"度");
-	        list.add(StringUtil.convertString(order.getOrderRes(), "异常结束"));
-	        list.add(socketSeq);
-
-	        AlipayClient alipayClient =new DefaultAlipayClient(messageConfig.getOppenUrl(),messageConfig.getAliAppid(),messageConfig.getPrivateKey(),"json","UTF-8",messageConfig.getPublicKey(),"RSA2");
-	        AlipayOpenAppMiniTemplatemessageSendRequest request =new AlipayOpenAppMiniTemplatemessageSendRequest();
-	        //下面ok
+                                               String formId, String template, String openId) {
+        try {
+            /**
+             * 先检验测试数据
+             */
+            List<String> list = new ArrayList<String>();
+            if (order.getEquipSocketId() == null) {
+                return RespWrapper.makeFailResp("插座编号不能为空");
+            }
+            if (order.getStartTime() == null) {
+                return RespWrapper.makeFailResp("充电开始时间不能为空");
+            }
+            if (order.getSocketSeq() == null) {
+                return RespWrapper.makeFailResp("设备流水号不能为空");
+            }
+            if (StringUtil.isEmpty(openId)) {
+                openId = messagePushDao.findCustomerById(order.getCustomerId());
+                if (StringUtil.isEmpty(openId)) {
+                    return RespWrapper.makeFailResp("根据用户id查询openId失败");
+                }
+            }
+            String socketSeq = order.getSocketSeq();
+
+            list.add(socketSeq.substring(socketSeq.length() - 2));//插座
+            list.add(DateTimeUtils.formatDate(new Date(order.getStartTime()), DateTimeUtils.FORMAT));
+            list.add(MessageDataHandle.orderNoDateAdjust(StringUtil.convertInt(order.getActChargerTime() + "", 0)));
+            list.add(StringUtil.convertInt(order.getTotalFee() + "", 0) * 1.0 / 100 + "元");
+            list.add(StringUtil.convertInt(order.getTotalCharge() + "", 0) * 1.0 / 100 + "度");
+            list.add(StringUtil.convertString(order.getOrderRes(), "异常结束"));
+            list.add(socketSeq);
+
+            AlipayClient alipayClient = new DefaultAlipayClient(messageConfig.getOppenUrl(), messageConfig.getAliAppid(), messageConfig.getPrivateKey(), "json", "UTF-8", messageConfig.getPublicKey(), "RSA2");
+            AlipayOpenAppMiniTemplatemessageSendRequest request = new AlipayOpenAppMiniTemplatemessageSendRequest();
+            //下面ok
 	        /*request.setBizContent("{"+
 	                "\"to_user_id\":\""+OPEN_ID+"\","+
 	                "\"form_id\":\""+formId+"\","+
 	                "\"user_template_id\":\""+template.getTemplateId()+"\","+
 	                "\"page\":\""+messageConfig.getAliPage()+"\","+
 	                "\"data\":\""+MessageDataHandle.createTemplateMessage(list,false)+"\"}");*/
-	        String data = MessageDataHandle.createTemplateMessage(list,false,false);
-	        request.setBizContent(MessageDataHandle.toJson(false, openId,formId,template,messageConfig.getAliPage(),data));
-        	AlipayOpenAppMiniTemplatemessageSendResponse response = alipayClient.execute(request);
-        	if(response.isSuccess()){
-        		return RespWrapper.makeSuccessResp("发生成功");
-        	}else{
-        		System.out.println("如果发送失败:"+response.getMsg());
-        	}
-        	return RespWrapper.makeFailResp(response.getMsg());
+            String data = MessageDataHandle.createTemplateMessage(list, false, false);
+            request.setBizContent(MessageDataHandle.toJson(false, openId, formId, template, messageConfig.getAliPage(), data));
+            AlipayOpenAppMiniTemplatemessageSendResponse response = alipayClient.execute(request);
+            if (response.isSuccess()) {
+                return RespWrapper.makeSuccessResp("发生成功");
+            } else {
+                System.out.println("如果发送失败:" + response.getMsg());
+            }
+            return RespWrapper.makeFailResp(response.getMsg());
         } catch (AlipayApiException e) {
             e.printStackTrace();
-            return RespWrapper.makeErrorResp("异常:"+e.getMessage());
+            return RespWrapper.makeErrorResp("异常:" + e.getMessage());
         }
     }
-	@Override
-	public RespWrapper<String> fadPushChargerMessage(CtkServiceOrder order, String formId) {
-    	// 这里根据用户唯一小程序用户唯一id 查询是哪个模块的
-		SmallMessageHelp help = messagePushDao.findCustomerMessageInfo(order.getCustomerId());
-		if(help == null) return RespWrapper.makeFailResp("根据用户查询基本信息错误");
-		TemplateHelp template = messageCache.findTemplateId(help.getAppId(),help.getLoginType(),smallMessageDao);
-		template.checkSmall(messageConfig);
-		if(help.getLoginType() == 2){
-			return pushAliMessage(order,formId,template.getTemplate(),help.getOpenId());
-			// 支付宝
-		}
-		String token = messageHandleUtil.getTocken(template);
-		if(token == null){
-			System.out.println("获取微信token 失败");
-			return RespWrapper.makeFailResp("获取微信token");
-		}
-		// 微信
-		return pushWxMessage(order,formId,template.getTemplate(),help.getOpenId(),true,token);
-	}
-
-
-
-	@Override
-	public RespWrapper<String> pushChargerMessage(CtkServiceOrder order,
-			String formId, MessageTemplateType template,String openId) {
-		try {
-			if(template.getTemplateType() == 1){
-				return pushAliMessage(order,formId,template.getTemplateId(),openId);
-			}else if(template.getTemplateType() == 2){
-				return pushWxMessage(order,formId,template.getTemplateId(),openId,template == MessageTemplateType.WX_CHAGER_END);
-			}
-			return RespWrapper.makeFailResp("没有对应的模版");
-		} catch (Exception e) {
-			e.printStackTrace();
-			return RespWrapper.makeErrorResp("异常:"+e.getMessage());
-		}
-	}
-	private static final String TMP_TOUSER = "WARN_TOUSER";
-	/**公众号消息推送*/
-	@Override
-	public RespWrapper<Boolean> publicNumberMessagePush(List<Integer> users, MessageTemplateType template, WarnMessageEntity warnEntiy) {
-		try{
-			return publicMessageGZH(users,template,warnEntiy,false);
-		}catch (Exception e){
-			e.printStackTrace();
-			return RespWrapper.makeFailResp("异常:"+e.getMessage());
-		}
-	}
-	private static final String ONE_TO_FOUR = "0014";
-	@Override
-	public RespWrapper<Boolean> sendWarnMessageToManage(CtkServiceOrder order) {
-		String socketNo = order.getSocketSeq();
-		if(StringUtil.isEmpty(socketNo)) return RespWrapper.makeFailResp("设备唯一id 不能为空");
-		//TODO
-		TerminalBase help = messagePushDao.findMerchantConfigBase(socketNo);
-		if(help == null) return RespWrapper.makeFailResp("查询充电数据错误");
-		CtkManageHelp siteHelp = equipTerminalDao.findSiteAdminAction(order.getSiteId());
-
-		WarnMessageEntity entity = new WarnMessageEntity();
-		entity.setSerialNo(socketNo);
-		entity.setSiteName(siteHelp.getName());
-		entity.setStartTime(System.currentTimeMillis());
-		entity.setTerminalNo(help.getTerminalNo());
-		entity.setWarnLevl(2);
-		entity.setWarnType("断网或断电结束充电");
-		if(help.getTerminalNo().startsWith(ONE_TO_FOUR)){
-			entity.setEquipName("1拖四电单车交流");
-		}else entity.setEquipName("16路电单车交流");
-		List<Integer> users = new ArrayList<>(4);
-		CtkManageHelp mchHelp = equipTerminalDao.findMerchantAdmin(order.getMerchantId().intValue());
-		if(siteHelp.getAdminId() != null)
-			users.add(siteHelp.getAdminId());
-		if(mchHelp.getAdminId() != null)
-			users.add(mchHelp.getAdminId());
-		if(mchHelp.getMarketerId() != null)
-			users.add(mchHelp.getMarketerId());
-		try {
-			return publicMessageGZH(users,MessageTemplateType.WX_WARN_PUBLIC_NUMBER,entity,true,"设备断网或断电结束充电,请检查设备!");
-		}catch (Exception e){
-			e.printStackTrace();
-			return RespWrapper.makeFailResp("异常:"+e.getMessage());
-		}
-	}
-	@Override
-	public void fadSendWarnMessageToManage(String terminalNo){
-		// 这里需要处理下是否发生断电、断网消息
-		FadTerminalWarn warn = messagePushDao.findFadTerminalWarn(terminalNo);
-		// 商户没有配置时不提供断电、断网消息
-		CtkMchMessage mchMessage = messagePushDao.findMchMessageConfig(warn.getMerchantId());
-		if(mchMessage == null || !mchMessage.getWarn())
-			return;
-		WarnMessageEntity entity = new WarnMessageEntity();
-		entity.setSerialNo("设备编号["+terminalNo+"]");
-		entity.setSiteName(warn.getSiteName());
-		entity.setStartTime(System.currentTimeMillis());
-		entity.setTerminalNo(terminalNo);
-		entity.setWarnLevl(2);
-		entity.setWarnType("断网或断电");
-		warn.check();
-		// TODO
-		// entity.setEquipName(warn.getEquipType() == null || warn.getEquipType() == 16?"16路电单车交流":"1拖四电单车交流");
-		if(terminalNo.startsWith(ONE_TO_FOUR)){
-			entity.setEquipName("1拖四电单车交流");
-		}else entity.setEquipName("16路电单车交流");
-		List<Integer> users = new ArrayList<>(4);
-		CtkManageHelp mchHelp = equipTerminalDao.findMerchantAdmin(warn.getMerchantId());
-		if(warn.getAdminId() != null)
-			users.add(warn.getAdminId());
-		if(mchHelp.getAdminId() != null)
-			users.add(mchHelp.getAdminId());
-		if(mchHelp.getMarketerId() != null)
-			users.add(mchHelp.getMarketerId());
-		try {
-			publicMessageGZH(users,MessageTemplateType.WX_WARN_PUBLIC_NUMBER,entity,true,"设备发送断网或断电,请检查设备!");
-		}catch (Exception e){
-			e.printStackTrace();
-		}
-	}
-
-
-	@Override
-	public RespWrapper<Boolean> autoHandleWarnPublicMessage(List<Integer> users, MessageTemplateType template, WarnMessageEntity warnEntiy) {
-		try {
-			return publicMessageGZH(users,template,warnEntiy,true);
-		}catch (Exception e){
-			e.printStackTrace();
-			return RespWrapper.makeFailResp(e.getMessage());
-		}
-	}
-
-	/**公众号消息推送*/
-	private RespWrapper<Boolean> publicMessageGZH(List<Integer> users, MessageTemplateType template, WarnMessageEntity warnEntiy,boolean isAuto,String msg)throws Exception{
-		int size = users.size();
-		if(size < 0 ) return  RespWrapper.makeFailResp("发送消息到用户唯一标识不能为空");
-		//组装数据
-		RespWrapper<String> data = MessageDataHandle.createWarnMessage(warnEntiy,isAuto,msg);
-		if(!data.isSuccess()) return RespWrapper.makeFailResp(data.getMsg());
-		//回调地址
-		String json = MessageDataHandle.toJsonPN(TMP_TOUSER, template.getTemplateId(), data.getData());
-		//下面通过用户id 查询 用户微信公众号oppenId 与 用户登入名
-		UserThirdBaseHelp help;
-		for(int i=0;i<size;i++){
-			help = messagePushDao.findUserBaseInfo(users.get(i));
-			if (StringUtil.isNotEmpty(help.getWechatPnOppenId())){
-				String replace = json.replace(TMP_TOUSER, help.getWechatPnOppenId());
-				Optional.ofNullable(messageHandleUtil.getTocken(WXTokenType.GZH)).ifPresent(p->{
-					messageHandleUtil.sendMessagePublicNumber(p, replace);
-				});
-			}
-			//自动处理告警(不发送手机短信)
-			if(!isAuto || StringUtil.isNotEmpty(msg)){
-				if(MessageConstant.PATTERN_MOBILE.matcher(help.getPhoneNo()).matches() && StringUtil.isNotEmpty(help.getPhoneNo()) && !ProjectConstant.ADMIN.equals(help.getPhoneNo())){
-					sendMessageService.send(help.getPhoneNo(), PhoneSendType.WARN,warnEntiy);
-				}
-			}
-		}
-		return RespWrapper.makeSuccessResp(true);
-	}
-
-	private RespWrapper<Boolean> publicMessageGZH(List<Integer> users, MessageTemplateType template, WarnMessageEntity warnEntiy,boolean isAuto)throws Exception{
-		return publicMessageGZH(users,template,warnEntiy,isAuto,null);
-	}
-	public static void main(String[] args){
-		System.out.println(MessageConstant.PATTERN_MOBILE.matcher("12588458430").matches());
-		String key = null;
-		Optional.ofNullable(key).ifPresent(s->{
-			System.out.println(1);
-			System.out.println(s);
-		});
-	}
+
+    @Override
+    public RespWrapper<String> fadPushChargerMessage(CtkServiceOrder order, String formId) {
+        // 这里根据用户唯一小程序用户唯一id 查询是哪个模块的
+        SmallMessageHelp help = messagePushDao.findCustomerMessageInfo(order.getCustomerId());
+        if (help == null) return RespWrapper.makeFailResp("根据用户查询基本信息错误");
+        TemplateHelp template = messageCache.findTemplateId(help.getAppId(), help.getLoginType(), smallMessageDao);
+        template.checkSmall(messageConfig);
+        if (help.getLoginType() == 2) {
+            return pushAliMessage(order, formId, template.getTemplate(), help.getOpenId());
+            // 支付宝
+        }
+        String token = messageHandleUtil.getTocken(template);
+        if (token == null) {
+            System.out.println("获取微信token 失败");
+            return RespWrapper.makeFailResp("获取微信token");
+        }
+        // 微信
+        return pushWxMessage(order, formId, template.getTemplate(), help.getOpenId(), true, token);
+    }
+
+
+    @Override
+    public RespWrapper<String> pushChargerMessage(CtkServiceOrder order,
+                                                  String formId, MessageTemplateType template, String openId) {
+        try {
+            if (template.getTemplateType() == 1) {
+                return pushAliMessage(order, formId, template.getTemplateId(), openId);
+            } else if (template.getTemplateType() == 2) {
+                return pushWxMessage(order, formId, template.getTemplateId(), openId, template == MessageTemplateType.WX_CHAGER_END);
+            }
+            return RespWrapper.makeFailResp("没有对应的模版");
+        } catch (Exception e) {
+            e.printStackTrace();
+            return RespWrapper.makeErrorResp("异常:" + e.getMessage());
+        }
+    }
+
+    private static final String TMP_TOUSER = "WARN_TOUSER";
+
+    /**
+     * 公众号消息推送
+     */
+    @Override
+    public RespWrapper<Boolean> publicNumberMessagePush(List<Integer> users, MessageTemplateType template, WarnMessageEntity warnEntiy) {
+        try {
+            return publicMessageGZH(users, template, warnEntiy, false);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return RespWrapper.makeFailResp("异常:" + e.getMessage());
+        }
+    }
+
+    private static final String ONE_TO_FOUR = "0014";
+
+    @Override
+    public RespWrapper<Boolean> sendWarnMessageToManage(CtkServiceOrder order) {
+        String socketNo = order.getSocketSeq();
+        if (StringUtil.isEmpty(socketNo)) return RespWrapper.makeFailResp("设备唯一id 不能为空");
+        //TODO
+        TerminalBase help = messagePushDao.findMerchantConfigBase(socketNo);
+        if (help == null) return RespWrapper.makeFailResp("查询充电数据错误");
+        CtkManageHelp siteHelp = equipTerminalDao.findSiteAdminAction(order.getSiteId());
+
+        WarnMessageEntity entity = new WarnMessageEntity();
+        entity.setSerialNo(socketNo);
+        entity.setSiteName(siteHelp.getName());
+        entity.setStartTime(System.currentTimeMillis());
+        entity.setTerminalNo(help.getTerminalNo());
+        entity.setWarnLevl(2);
+        entity.setWarnType("断网或断电结束充电");
+        if (help.getTerminalNo().startsWith(ONE_TO_FOUR)) {
+            entity.setEquipName("1拖四电单车交流");
+        } else entity.setEquipName("16路电单车交流");
+        List<Integer> users = new ArrayList<>(4);
+        CtkManageHelp mchHelp = equipTerminalDao.findMerchantAdmin(order.getMerchantId().intValue());
+        if (siteHelp.getAdminId() != null)
+            users.add(siteHelp.getAdminId());
+        if (mchHelp.getAdminId() != null)
+            users.add(mchHelp.getAdminId());
+        if (mchHelp.getMarketerId() != null)
+            users.add(mchHelp.getMarketerId());
+        try {
+            return publicMessageGZH(users, MessageTemplateType.WX_WARN_PUBLIC_NUMBER, entity, true, "设备断网或断电结束充电,请检查设备!");
+        } catch (Exception e) {
+            e.printStackTrace();
+            return RespWrapper.makeFailResp("异常:" + e.getMessage());
+        }
+    }
+
+    @Override
+    public void fadSendWarnMessageToManage(String terminalNo) {
+        FadTerminalWarn warn = messagePushDao.findFadTerminalWarn(terminalNo);
+        if(warn == null || warn.getMerchantId() == null){
+            System.out.println("告警消息有误,设备编号:"+terminalNo);
+            return;
+        }
+        WarnMessageEntity entity = new WarnMessageEntity();
+        entity.setSerialNo("设备编号[" + terminalNo + "]");
+        entity.setSiteName(warn.getSiteName());
+        entity.setStartTime(System.currentTimeMillis());
+        entity.setTerminalNo(terminalNo);
+        entity.setWarnLevl(2);
+        entity.setWarnType("断网或断电");
+        warn.check();
+        // TODO
+        // entity.setEquipName(warn.getEquipType() == null || warn.getEquipType() == 16?"16路电单车交流":"1拖四电单车交流");
+        if (terminalNo.startsWith(ONE_TO_FOUR)) {
+            entity.setEquipName("1拖四电单车交流");
+        } else entity.setEquipName("16路电单车交流");
+        List<Integer> users = new ArrayList<>(4);
+        CtkManageHelp mchHelp = equipTerminalDao.findMerchantAdmin(warn.getMerchantId());
+        if (warn.getAdminId() != null)
+            users.add(warn.getAdminId());
+        if (mchHelp.getAdminId() != null)
+            users.add(mchHelp.getAdminId());
+        if (mchHelp.getMarketerId() != null)
+            users.add(mchHelp.getMarketerId());
+        try {
+            publicMessageGZH(users, MessageTemplateType.WX_WARN_PUBLIC_NUMBER, entity, true, "设备发送断网或断电,请检查设备!");
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+
+    @Override
+    public RespWrapper<Boolean> autoHandleWarnPublicMessage(List<Integer> users, MessageTemplateType template, WarnMessageEntity warnEntiy) {
+        try {
+            return publicMessageGZH(users, template, warnEntiy, true);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return RespWrapper.makeFailResp(e.getMessage());
+        }
+    }
+
+    /**
+     * 公众号消息推送
+     */
+    private RespWrapper<Boolean> publicMessageGZH(List<Integer> users, MessageTemplateType template, WarnMessageEntity warnEntiy, boolean isAuto, String msg) throws Exception {
+        int size = users.size();
+        if (size < 0) return RespWrapper.makeFailResp("发送消息到用户唯一标识不能为空");
+        //组装数据
+        RespWrapper<String> data = MessageDataHandle.createWarnMessage(warnEntiy, isAuto, msg);
+        if (!data.isSuccess()) return RespWrapper.makeFailResp(data.getMsg());
+        //下面通过用户id 查询 用户微信公众号oppenId 与 用户登入名
+        String phoneNo;
+        for (int i = 0; i < size; i++) {
+            phoneNo = messagePushDao.findUserPhoneNo(users.get(i));
+            doSendWeChatOpenMessage(users.get(i),data.getData());
+            //自动处理告警(不发送手机短信)
+            if (!isAuto || StringUtil.isNotEmpty(msg)) {
+                if (StringUtil.isNotEmpty(phoneNo) && MessageConstant.PATTERN_MOBILE.matcher(phoneNo).matches()) {
+                    sendMessageService.send(phoneNo, PhoneSendType.WARN, warnEntiy);
+                }
+            }
+        }
+        return RespWrapper.makeSuccessResp(true);
+    }
+
+    // 发送公众号模版消息
+    private void doSendWeChatOpenMessage(Integer userId, String data) {
+        try {
+            // 增加消息回调地址
+            List<WxOpenType> list = messagePushDao.findWxOpenTypeList(userId);
+            list.forEach(s->{
+                String openId = s.getOpenId();
+                if(openId != null){
+                    String token = messageHandleUtil.getWeChatOpenToken(s);
+                    Optional.ofNullable(token).ifPresent(p -> {
+                        //回调地址
+                        String replace = MessageDataHandle.toJsonPN(s.getNotifyUrl(),openId, s.getTemplateId(), data);
+                        messageHandleUtil.sendMessagePublicNumber(p, replace);
+                    });
+                }
+            });
+            list.clear();
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+
+    }
+
+
+    private RespWrapper<Boolean> publicMessageGZH(List<Integer> users, MessageTemplateType template, WarnMessageEntity warnEntiy, boolean isAuto) throws Exception {
+        return publicMessageGZH(users, template, warnEntiy, isAuto, null);
+    }
 
 
 }

+ 9 - 16
ctkcloud-messagepush-service/src/main/java/com/comtika/ctkcloud/server/service/impl/WarnRecordServiceImpl.java

@@ -4,6 +4,7 @@ import java.util.*;
 import java.util.stream.Collectors;
 
 import com.alibaba.fastjson.JSONObject;
+import com.comtika.ctkcloud.common.bean.user.LoginUser;
 import com.comtika.ctkcloud.common.enums.device.EquipmentCode;
 import com.comtika.ctkcloud.common.enums.device.NodeStatus;
 import com.comtika.ctkcloud.common.enums.es.ESLogIndex;
@@ -52,7 +53,6 @@ public class WarnRecordServiceImpl implements WarnRecordService {
 	@Autowired
     private JestClientApi jestClientApi;
 
-
 	@Autowired
 	private WarnRecordDao warnRecordDao;
 	@Autowired
@@ -351,21 +351,14 @@ public class WarnRecordServiceImpl implements WarnRecordService {
     }
     /**判断用户是否绑定公众号*/
     @Override
-    public RespWrapper<Object> checkUserBindPNOppenId(Long userId) {
-        try {
-            Map<String,Object> map = new HashMap<>();
-            map.put("userId",userId);
-            map = warnRecordDao.checkUserBindPNOppenId(map);
-            Object oppenid = map.get("wechatPnOppenId");
-            if(oppenid == null || StringUtil.isEmpty(oppenid.toString())) {
-                Object res = map.get("loginName");
-                return RespWrapper.makeResp(5,null,res);
-            }
-            return RespWrapper.makeSuccessResp(true);
-        }catch (Exception e){
-            e.printStackTrace();
-            return RespWrapper.makeFailResp("异常:"+e.getMessage());
-        }
+    public RespWrapper<String> checkUserBindPNOppenId(LoginUser user, String openType) {
+        Map<String,Object> map = new HashMap<>();
+        map.put("userId",user.getUserId());
+        map.put("wxName",openType);
+        String openId = warnRecordDao.checkUserBindPNOppenId(map);
+        if(StringUtil.isEmpty(openId))
+            return RespWrapper.makeResp(5,null,user.getLoginName());
+        return RespWrapper.makeSuccessResp("ok");
     }
     /**处理告警内部类  清除上报缓存的值,并且保存至es中*/
     private void handleRecord(int id,SysWarnRecord single)throws Exception{

+ 54 - 5
ctkcloud-messagepush-service/src/main/java/com/comtika/ctkcloud/server/service/impl/WxChatHandleServiceImpl.java

@@ -2,45 +2,72 @@ package com.comtika.ctkcloud.server.service.impl;
 
 import com.comtika.ctkcloud.common.result.RespWrapper;
 import com.comtika.ctkcloud.common.util.StringUtil;
+import com.comtika.ctkcloud.server.base.config.MessageConfig;
 import com.comtika.ctkcloud.server.core.MessageHandleUtil;
+import com.comtika.ctkcloud.server.core.cache.MessageCache;
 import com.comtika.ctkcloud.server.dao.ThirdUserDao;
+import com.comtika.ctkcloud.server.dao.WxOpenTypeDao;
 import com.comtika.ctkcloud.server.entity.third.SysUserThirdId;
+import com.comtika.ctkcloud.server.entity.third.WxOpenType;
 import com.comtika.ctkcloud.server.service.WxChatHandleService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.regex.Pattern;
+
 /**
  * 微信公众号静默授权  使用在商户端H5
  */
 @Service
 public class WxChatHandleServiceImpl implements WxChatHandleService {
 
+
     @Autowired
     private MessageHandleUtil messageHandleUtil;
     @Autowired
     private ThirdUserDao thirdUserDao;
+    @Autowired
+    private WxOpenTypeDao wxOpenTypeDao;
+    @Autowired
+    private MessageCache messageCache;
     /**微信公众号授权*/
     @Override
-    public RespWrapper<Boolean> wxPnAuther(String code, Long userId) {
+    public RespWrapper<Boolean> wxPnAuther(String code, Long userId,String wxChetType) {
+        if(StringUtil.isEmpty(wxChetType)) wxChetType = MessageConfig.DEFAULT_OPEN_TYPE;
+        WxOpenType wxChetOpen = messageCache.findWxChetOpen(wxOpenTypeDao, wxChetType);
+        if(wxChetOpen.getId() == null)
+            return RespWrapper.makeFailResp("该公众号暂时还没有配置,请联系管理人员");
+        // 这里需要根据
         try{
             //下面更新数据 或 新增数据
             SysUserThirdId third = new SysUserThirdId();
             third.setUserId(userId.intValue());
+            third.setOpenType(wxChetOpen.getId());
             third = thirdUserDao.templateOne(third);
-            boolean bt = false;
-            if( (bt = third == null) || StringUtil.isEmpty(third.getWechatPnOppenId())){
-                RespWrapper<String> tmpRes = messageHandleUtil.autherUserOppenId(code);
+            // 下面需要重新授权
+            if(third == null || StringUtil.isEmpty(third.getWechatPnOppenId())){
+                // 公众号授权方法
+                RespWrapper<String> tmpRes = messageHandleUtil.wxChatOpenAuth(code,wxChetOpen);
                 if(!tmpRes.isSuccess()) return RespWrapper.makeFailResp(tmpRes.getMsg());
                 String oppenId = tmpRes.getData();
-                if(bt){
+                if(third == null){
                     third = new SysUserThirdId();
                     third.setUserId(userId.intValue());
                     third.setWechatPnOppenId(oppenId);
+                    third.setOpenType(wxChetOpen.getId());
+                    third.setStatus(1);
                     thirdUserDao.insert(third);
                 }else {
+                    third.setOpenType(wxChetOpen.getId());
+                    third.setStatus(1);
                     third.setWechatPnOppenId(oppenId);
                     thirdUserDao.updateTemplateById(third);
                 }
+            }else {
+                if (third.getStatus() == 0) {
+                    third.setStatus(1);
+                    thirdUserDao.updateTemplateById(third);
+                }
             }
             return RespWrapper.makeSuccessResp(true);
         }catch (Exception e){
@@ -49,4 +76,26 @@ public class WxChatHandleServiceImpl implements WxChatHandleService {
         }
     }
 
+    @Override
+    public RespWrapper<Boolean> unBindAuth(String openType, Long userId) {
+        if(StringUtil.isEmpty(openType)) openType = MessageConfig.DEFAULT_OPEN_TYPE;
+        WxOpenType wxChetOpen = messageCache.findWxChetOpen(wxOpenTypeDao, openType);
+        if(wxChetOpen.getId() == null)
+            return RespWrapper.makeFailResp("该公众号暂时还没有配置,请联系管理人员");
+        SysUserThirdId third = new SysUserThirdId();
+        third.setUserId(userId.intValue());
+        third.setOpenType(wxChetOpen.getId());
+        third = thirdUserDao.templateOne(third);
+        if(third == null) return RespWrapper.makeFailResp("该用户暂时没有绑定,无需解绑");
+        if(third.getStatus() == 0) return RespWrapper.makeFailResp("该用户已经解绑,无需再解");
+        third.setStatus(0);
+        thirdUserDao.updateTemplateById(third);
+        return RespWrapper.makeSuccessResp(true);
+    }
+
+    public static void main(String[] args){
+        Pattern pattern = Pattern.compile("^-?[0-9]+");
+        String str = "0123456789";
+        System.out.println(pattern.matcher(str).matches());
+    }
 }

+ 4 - 2
ctkcloud-messagepush-service/src/main/java/com/comtika/ctkcloud/server/util/MessageDataHandle.java

@@ -384,8 +384,9 @@ public class MessageDataHandle {
 		String k = sb.toString();
 		return k.substring(0, k.lastIndexOf(",")) + "}";
 	}
+	private static final String NOTIFY_URL = "\"url\":\"%s\",";
     /**创建公众好消息组装方法*/
-    public static String toJsonPN(String...strs)throws Exception {
+    public static String toJsonPN(String notifyUrl,String...strs){
         if(strs.length != 3) throw new ArrayIndexOutOfBoundsException("入参长度必须为3");
         StringBuffer sb = new StringBuffer("{");
         for(int i=0;i<3;i++ ) {
@@ -396,7 +397,8 @@ public class MessageDataHandle {
                 sb.append("\"" + tmps + "\":\"" + strs[i] + "\",");
             }
         }
-        sb.append("\"url\":\"https://b.comtti.net/\",");
+        if(StringUtil.isEmpty(notifyUrl)) notifyUrl = "https://b.comtti.net/";
+        sb.append(String.format(NOTIFY_URL,notifyUrl));
         sb.append("\"topcolor\":\"#FF0000\"}");
         /*String k = sb.toString();
         return k.substring(0, k.lastIndexOf(",")) + "}";*/

+ 3 - 1
ctkcloud-messagepush-service/src/main/resources/bootstrap.yml

@@ -1,7 +1,8 @@
 spring:
   application:
     name: messagepush-service
-  tcpUrl: db.comtti.net:9250
+  tcpUrl: 172.16.0.11:9250
+  #tcpUrl: 193.112.16.187:9250
 # cloud 配置中心地址
   cloud:
     config:
@@ -18,3 +19,4 @@ eureka:
   client:
     serviceUrl:
       defaultZone: http://admin:comtika2018@peer1:8761/eureka/,http://admin:comtika2018@peer2:8762/eureka/
+#      defaultZone: http://admin:comtika2018@peer1:8761/eureka/

+ 10 - 2
ctkcloud-messagepush-service/src/main/resources/sql/warn/record.md

@@ -55,5 +55,13 @@ from
 checkUserBindPNOppenId
 ===
 * 判断用户是否绑定的微信公众号 方便推送消息
-SELECT us.login_name,sti.wechat_pn_oppen_id from sys_user us left join sys_user_third_id sti on us.id = sti.user_id
- where us.id = #userId#
+SELECT
+	t.wechat_pn_oppen_id open_id
+FROM
+	sys_user su 
+LEFT JOIN sys_user_third_id t ON t.user_id = su.id
+LEFT JOIN wx_open_type ot on t.open_type = ot.id
+where su.id = #userId#
+and t.`status` = 1
+and ot.wx_name = #wxName#
+limit 1

+ 2 - 2
ctkcloud-mybank-service/pom.xml

@@ -122,12 +122,12 @@
                 <artifactId>docker-maven-plugin</artifactId>
                 <version>0.4.13</version>
                 <configuration>
-                    <imageName>${docker.aliyun.registry}/${docker.aliyun.name}/${project.artifactId}:5.0.3</imageName>
+                    <imageName>${docker.aliyun.registry}/${docker.aliyun.name}/${project.artifactId}:6.0.1</imageName>
                     <!-- <dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory> -->
                     <!-- 如果有相同的覆盖 -->
                     <forceTags>true</forceTags>
                     <baseImage>java</baseImage>
-                    <entryPoint>["java","-jar","-XX:+UseG1GC","-XX:+PrintGCDetails","-XX:+PrintGCTimeStamps","-XX:+PrintGCDateStamps","-Xloggc:/mybank.log","-Xms256m","-Xmx256m","-XX:MetaspaceSize=256m","-XX:MaxMetaspaceSize=256m","/${project.build.finalName}.jar"]</entryPoint>
+                    <entryPoint>["java","-jar","-XX:+PrintGCDetails","-XX:+PrintGCTimeStamps","-XX:+PrintGCDateStamps","-Xloggc:/mybank.log","-Xms256m","-Xmx256m","-XX:MetaspaceSize=256m","-XX:MaxMetaspaceSize=256m","/${project.build.finalName}.jar"]</entryPoint>
                     <dockerHost>${docker.url}</dockerHost>
                     <registryUrl>${docker.aliyun.registry}</registryUrl>
                     <serverId>docker_actor</serverId>

+ 121 - 54
ctkcloud-mybank-service/src/main/java/com/comtika/ctkcloud/server/core/ComtikaHttpsUtil.java

@@ -1,72 +1,139 @@
 package com.comtika.ctkcloud.server.core;
 
-import com.alibaba.fastjson.JSONObject;
-import com.comtika.ctkcloud.common.util.StringUtil;
 import org.apache.http.HttpEntity;
 import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpUriRequest;
 import org.apache.http.entity.StringEntity;
 import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.impl.client.HttpClients;
 import org.apache.http.util.EntityUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.springframework.web.multipart.MultipartFile;
 
-import java.util.HashMap;
+import java.io.BufferedReader;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
 import java.util.Map;
 
-/**
- * 调用微信分账http
- */
 public class ComtikaHttpsUtil {
-    private static  final CloseableHttpClient httpclient = HttpClients.createDefault();
-    private static Logger logger = LoggerFactory.getLogger(ComtikaHttpsUtil.class);
 
-    public static String doPostWxPage(String url, String json) throws Exception {
-        return doPostWxPage(url,json,null);
-    }
-    public static String doPostWxPage(String url, String json, Map<String,String> head) throws Exception {
-        HttpPost httpost = new HttpPost(url); // 设置响应头信息
-        if(head == null){
-            httpost.addHeader("Content-Type","application/json;charset=UTF-8");
-        }else {
-            head.forEach((k,v)->{
-                httpost.addHeader(k,v);
-            });
-        }
-        if(StringUtil.isNotEmpty(json))
-            httpost.setEntity(new StringEntity(json, "UTF-8"));
-        CloseableHttpResponse response = httpclient.execute(httpost);
-        try {
-            HttpEntity entity = response.getEntity();
-            String jsonStr = EntityUtils.toString(response.getEntity(), "UTF-8");
-            EntityUtils.consume(entity);
-            return jsonStr;
-        } finally {
-            response.close();
-        }
-    }
-    public static void main(String[] args)throws Exception{
-        //Map<String,Object> condition = new HashMap<>(4);
-        //condition.put("subMchId","1584278251");
-        //System.out.println(doPostWxPage("http://localhost:8888/sepAccount/findSepUserList", JSONObject.toJSONString(condition)));
-        //Thread.sleep(1000);
-        //System.out.println(doPostWxPage("http://localhost:8888/sepAccount/findSepUserList", JSONObject.toJSONString(condition)));
-        System.out.println(doGetWxPage("http://localhost:8888/sepAccount/findSepAccountResult/ktjSep20200418001"));
-    }
+	// 这里是其他方式post 请求
+	public static String doPost(String url, String data,
+			Map<String, String> head) throws Exception {
+		HttpPost httpost = new HttpPost(url); // 设置响应头信息
+		if (head == null) {
+			httpost.addHeader("Content-Type", "application/json; charset=UTF-8");
+		} else {
+			head.forEach((k, v) -> {
+				httpost.addHeader(k, v);
+			});
+		}
+		if (data != null)
+			httpost.setEntity(new StringEntity(data, "UTF-8"));
+		return doHttp(httpost);
+	}
 
-    public static String doGetWxPage(String url) throws Exception{
-        HttpGet httpGet = new HttpGet(url);
-        CloseableHttpResponse response = httpclient.execute(httpGet);
-        try {
-            HttpEntity entity = response.getEntity();
-            String jsonStr = EntityUtils.toString(response.getEntity(), "UTF-8");
-            EntityUtils.consume(entity);
-            return jsonStr;
-        }finally {
-            response.close();
-        }
-    }
+	public static String doPost(String url, String data) throws Exception {
+		return doPost(url, data, null);
+	}
 
+	public static String doGet(String url) throws Exception {
+		return doGet(url, null);
+	}
+
+	public static String doGet(String url, Map<String, String> heads)
+			throws Exception {
+		HttpGet get = new HttpGet(url);
+		if (heads == null) {
+			get.addHeader("Content-Type", "application/json; charset=UTF-8");
+		} else {
+			heads.forEach((k, v) -> {
+				get.addHeader(k, v);
+			});
+		}
+		return doHttp(get);
+	}
+
+	private static class HttpIns {
+		private static final CloseableHttpClient INS = HttpClients
+				.createDefault();
+	}
+
+	private static String doHttp(HttpUriRequest request) throws Exception {
+		CloseableHttpClient httpclient = HttpIns.INS;
+		CloseableHttpResponse response = httpclient.execute(request);
+		try {
+			HttpEntity entity = response.getEntity();
+			String jsonStr = EntityUtils
+					.toString(response.getEntity(), "UTF-8");
+			EntityUtils.consume(entity);
+			return jsonStr;
+		} finally {
+			response.close();
+		}
+	}
+
+	public static String upload(String url, MultipartFile file)throws IOException {
+		String boundary = Long.toHexString(System.currentTimeMillis());
+		String newLine = "\r\n";
+		final String boundaryPrefix = "--";
+		String result = "";
+		URL url1 = new URL(url);
+		HttpURLConnection conn = (HttpURLConnection) url1.openConnection();
+		// 设置为POST情
+		conn.setRequestMethod("POST");
+		// 发送POST请求必须设置如下两行
+		conn.setDoOutput(true);
+		conn.setDoInput(true);
+		conn.setUseCaches(false);
+		// 设置请求头参数
+		conn.setRequestProperty("connection", "Keep-Alive");
+		conn.setRequestProperty("Charsert", "UTF-8");
+		conn.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary);
+		OutputStream out = new DataOutputStream(conn.getOutputStream());
+		// 上传文件
+		StringBuilder sb = new StringBuilder();
+		sb.append(boundaryPrefix);
+        sb.append(boundary);
+        sb.append(newLine);
+        // 文件参数,photo参数名可以随意修改
+        sb.append("Content-Disposition: form-data;name=\"file\";filename=\"" + file.getOriginalFilename() + "\"" + newLine);
+        sb.append("Content-Type:application/octet-stream");
+        // 参数头设置完以后需要两个换行,然后才是参数内容
+        sb.append(newLine);
+        sb.append(newLine);
+		// 将参数头的数据写入到输出流中
+		out.write(sb.toString().getBytes());
+		// 数据输入流,用于读取文件数据
+		DataInputStream in = new DataInputStream(file.getInputStream());
+		byte[] bufferOut = new byte[1024 * 8];
+		int bytes = 0;
+		// 每次读8KB数据,并且将文件数据写入到输出流中
+		while ((bytes = in.read(bufferOut)) != -1) {
+			out.write(bufferOut, 0, bytes);
+		}
+		// 最后添加换行
+        out.write(newLine.getBytes());
+		in.close();
+		 // 定义最后数据分隔线,即--加上BOUNDARY再加上--。
+        byte[] end_data = (newLine + boundaryPrefix + boundary + boundaryPrefix + newLine).getBytes();
+        // 写上结尾标识
+        out.write(end_data);
+        out.flush();
+        out.close();
+		// 定义BufferedReader输入流来读取URL的响应
+		BufferedReader reader = new BufferedReader(new InputStreamReader(
+				conn.getInputStream()));
+		String line = null;
+		while ((line = reader.readLine()) != null) {
+			result += line; // 这里读取的是上边url对应的上传文件接口的返回值,读取出来后,然后接着返回到前端,实现接口中调用接口的方式
+		}
+		return result;
+	}
 }

+ 8 - 1
ctkcloud-mybank-service/src/main/java/com/comtika/ctkcloud/server/core/timer/RefundTimeScheduled.java

@@ -15,6 +15,7 @@ import com.comtika.ctkcloud.common.util.IDUtil;
 import com.comtika.ctkcloud.server.base.UnifyPayModel;
 import com.comtika.ctkcloud.server.dao.refund.RefundDao;
 import com.comtika.ctkcloud.server.entity.mybank.CtkRefund;
+import com.comtika.ctkcloud.server.service.comtika.ComtikaMerchantService;
 import com.comtika.ctkcloud.server.service.dafeng.DaFengService;
 import com.comtika.ctkcloud.server.service.refund.MybankRefundServiceImpl;
 
@@ -31,7 +32,9 @@ public class RefundTimeScheduled extends BaseController{
 
 	@Autowired
 	private DaFengService daFengService;
-
+	
+	@Autowired
+	private ComtikaMerchantService comtikaMerchantService;
 	/**
 	 * 定时任务查询网商退款情况,只查询网商受理成功状态的每五分钟查询一次
 	 */
@@ -72,6 +75,10 @@ public class RefundTimeScheduled extends BaseController{
 			if(null != channelType && channelType == 2){
 				//这里是大风的退款
 				daFengService.dafengRefund(map);
+				
+			}else if(null != channelType && channelType == 3){
+				//这里是康体佳服务商平台退款
+				comtikaMerchantService.queryComtikaRefund(map);
 				//如果是网商受理成功,退款中那就重新发起查询
 			}else if(status == MyBankRefundType.ACCEPTANCE.getId() || status == MyBankRefundType.REFUNDING.getId()){
 				mybankRefundService.queryRefund(map.get("outRefundNo").toString());

+ 4 - 0
ctkcloud-mybank-service/src/main/java/com/comtika/ctkcloud/server/dao/pay/PrePayDao.java

@@ -19,4 +19,8 @@ public interface PrePayDao extends BaseMapper<CtkRechargeOrder> {
     Map<String,Object> queryDafengOrderAndMerchantId(Map<String,Object> map);
 
     List<Map<String, Object>> queryDaFengOrder();
+    
+    Map<String, Object> queryRechargeOrderSiteIdAndMerchantId(Map<String, Object> map);
+
+	List<Map<String, Object>> queryComtikaOrder();
 }

+ 7 - 0
ctkcloud-mybank-service/src/main/java/com/comtika/ctkcloud/server/dao/sep/KtjSepUserDao.java

@@ -0,0 +1,7 @@
+package com.comtika.ctkcloud.server.dao.sep;
+
+import com.comtika.ctkcloud.server.entity.sep.KtjSepUser;
+import org.beetl.sql.core.mapper.BaseMapper;
+
+public interface KtjSepUserDao extends BaseMapper<KtjSepUser> {
+}

+ 15 - 0
ctkcloud-mybank-service/src/main/java/com/comtika/ctkcloud/server/entity/sep/KtjSepUser.java

@@ -0,0 +1,15 @@
+package com.comtika.ctkcloud.server.entity.sep;
+
+import lombok.Data;
+import org.beetl.sql.core.annotatoin.AutoID;
+
+@Data
+public class KtjSepUser {
+    @AutoID
+    private Integer id;
+    private String wxAccount;//微信个人账户
+    private String nickName;//微信账号名字
+    private String sepRate;//分账比例 0.01-1 保留2位小数
+    private Integer siteId;//站点id
+    private Integer merchantId;//商户id
+}

+ 18 - 0
ctkcloud-mybank-service/src/main/java/com/comtika/ctkcloud/server/entity/sep/UserSepReceiver.java

@@ -0,0 +1,18 @@
+package com.comtika.ctkcloud.server.entity.sep;
+
+
+import com.comtika.ctkcloud.server.entity.sep.help.SepReceiverHelp;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 分账设置 帮助类
+ */
+@Data
+public class UserSepReceiver {
+    private List<SepReceiverHelp> sepUserList;//分账用户
+    private Integer siteId;// 为了更好的分账灵活
+    private Integer merchantId;
+
+}

+ 9 - 0
ctkcloud-mybank-service/src/main/java/com/comtika/ctkcloud/server/entity/sep/help/SepQueryHelp.java

@@ -0,0 +1,9 @@
+package com.comtika.ctkcloud.server.entity.sep.help;
+
+import lombok.Data;
+
+@Data
+public class SepQueryHelp {
+    private Integer siteId;
+    private Integer merchantId;
+}

+ 15 - 0
ctkcloud-mybank-service/src/main/java/com/comtika/ctkcloud/server/entity/sep/help/SepReceiverHelp.java

@@ -0,0 +1,15 @@
+package com.comtika.ctkcloud.server.entity.sep.help;
+
+import lombok.Data;
+
+
+/**
+ * 分账用户帮助类
+ */
+@Data
+public class SepReceiverHelp {
+    private String wxAccount;//微信个人账户
+    private String nickName;//微信账号名字
+    private String sepRate;//分账比例 0.01-1 保留2位小数
+
+}

+ 6 - 6
ctkcloud-mybank-service/src/main/java/com/comtika/ctkcloud/server/entity/sepAccount/CtkReceiveUser.java

@@ -7,11 +7,11 @@ import org.beetl.sql.core.annotatoin.AutoID;
 @Data
 public class CtkReceiveUser {
     @AutoID
-    private Integer id;
-    private String nickName;
-    private String account;
-    private String rate;
-    private Integer merchantId;
-    private Integer siteId;
+    private Integer id;		//数据库表id
+    private String nickName;//分账人名称
+    private String account;	//
+    private String rate;	//
+    private Integer merchantId;//商户id
+    private Integer siteId;	//站点id
     private String groupName;
 }

+ 2 - 2
ctkcloud-mybank-service/src/main/java/com/comtika/ctkcloud/server/entity/sepAccount/SepReceiverHelp.java

@@ -7,7 +7,7 @@ import lombok.Data;
  */
 @Data
 public class SepReceiverHelp {
-    private String wxAccount;//微信个人账户
+    private String account;//微信个人账户
     private String nickName;//微信账号名字
-    private String sepRate;//分账比例 0.01-1 保留2位小数
+    private String rate;//分账比例 0.01-1 保留2位小数
 }

+ 71 - 43
ctkcloud-mybank-service/src/main/java/com/comtika/ctkcloud/server/service/dafeng/impl/DaFengServiceImpl.java

@@ -10,20 +10,27 @@ import com.comtika.ctkcloud.common.util.DateTimeUtils;
 import com.comtika.ctkcloud.common.util.IDUtil;
 import com.comtika.ctkcloud.common.util.StringUtil;
 import com.comtika.ctkcloud.server.base.UnifyPayModel;
+import com.comtika.ctkcloud.server.core.ComtikaHttpsUtil;
+import com.comtika.ctkcloud.server.dao.comtika.SysComtikaMerchantDao;
 import com.comtika.ctkcloud.server.dao.dafeng.*;
 import com.comtika.ctkcloud.server.dao.pay.PrePayDao;
 import com.comtika.ctkcloud.server.dao.refund.RefundDao;
 import com.comtika.ctkcloud.server.entity.*;
+import com.comtika.ctkcloud.server.entity.comtikawechat.SysComtikaMerchant;
 import com.comtika.ctkcloud.server.entity.mybank.CtkRefund;
 import com.comtika.ctkcloud.server.entity.order.CtkRechargeOrder;
+import com.comtika.ctkcloud.server.entity.sepAccount.CtkReceiveUser;
 import com.comtika.ctkcloud.server.fegin.CustomerService;
 import com.comtika.ctkcloud.server.fegin.OrderNoFeignService;
 import com.comtika.ctkcloud.server.fegin.ServerFeignService;
+import com.comtika.ctkcloud.server.service.comtika.ComtikaMerchantService;
 import com.comtika.ctkcloud.server.service.dafeng.DaFengService;
 import com.comtika.ctkcloud.server.util.dafeng.Base64Utils;
 import com.comtika.ctkcloud.server.util.dafeng.HTTPUtils;
 import com.comtika.ctkcloud.server.util.dafeng.RSAUtils;
+
 import net.sf.json.JSONObject;
+
 import org.apache.log4j.Logger;
 import org.beetl.sql.core.engine.PageQuery;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -31,6 +38,7 @@ import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Service;
 
 import javax.servlet.http.HttpServletResponse;
+
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -68,7 +76,7 @@ public class DaFengServiceImpl implements DaFengService {
 
 	@Autowired
 	private DaFengSeparateListDao daFengSeparateListDao;
-
+	
 	@Autowired
 	private DaFengSeparateBillDao daFengSeparateBillDao;
 
@@ -92,7 +100,14 @@ public class DaFengServiceImpl implements DaFengService {
 
 	@Autowired
 	private OrderNoFeignService orderNoFeignService;
-
+	
+	@Autowired
+	private SysComtikaMerchantDao sysComtikaMerchantDao;
+	
+	@Autowired
+	private ComtikaMerchantService comtikaMerchantService;
+	
+	
 	@Override
 	public RespWrapper<Object> registerMerchant(DaFeng daFeng) {
 		DaFeng daFeng2 = null;
@@ -1151,47 +1166,13 @@ public class DaFengServiceImpl implements DaFengService {
 	@Override
 	public RespWrapper<Object> orderNotice(Long rechargeOrderId) {
 		try {
-
-			Map<String,Object> map = new HashMap<String,Object>();
-			map.put("id", rechargeOrderId);
-			map = prePayDao.queryDafengOrderAndMerchantId(map);
-			if(null == map.get("payTransactionId") || null == map.get("merchantNo")){
-				return RespWrapper.makeFailResp("数据有误,请检查!");
-			}
-			JSONObject dataJson = new JSONObject();
-			dataJson.put("merchantId", map.get("merchantNo"));//大风商户号,调报备接口时返回
-			dataJson.put("orderId", map.get("payTransactionId"));//大风支付单号
-
-			log.info("加密前业务数据:"+dataJson);
-			String data = Base64Utils.encode(RSAUtils.encryptByPublicKey(dataJson.toString().getBytes(), dfPublicKey));
-			log.info("加密后业务数据:"+data);
-
-			JSONObject reqMap = new JSONObject();
-			reqMap.put("service", "DF_ORDER_NOTICE");
-			reqMap.put("secId", "RSA");
-			reqMap.put("version", "1.0.0");
-			reqMap.put("platformId", platformId);
-			reqMap.put("data", data);
-
-			log.info("加密前签名数据:"+reqMap);
-			String sign = RSAUtils.sign(reqMap.toString().getBytes(), merPrivateKey);
-			log.info("加密后签名数据:"+sign);
-			reqMap.put("sign", sign);
-
-			log.info("请求数据:"+reqMap);
-			String result = HTTPUtils.post( url + "payManage/orderOverNotice.do", reqMap, null);
-			log.info("返回数据:"+result);
-
-			JSONObject respJson = JSONObject.fromObject(result);
-			if ("0000".equals(respJson.getString("respCode"))){
-				//String decryptData = new String(RSAUtils.decryptByPrivateKey(Base64Utils.decode(respJson.getString("respData")), merPrivateKey));
-				//log.info("解密后返回参数:"+decryptData);
-				//订单通知成功后,需要修改数据库
-				CtkRechargeOrder ctkRechargeOrder = new CtkRechargeOrder();
-				ctkRechargeOrder.setId(rechargeOrderId);
-				ctkRechargeOrder.setDaFengStatus(1);
-				prePayDao.updateTemplateById(ctkRechargeOrder);
-				return RespWrapper.makeSuccessResp("订单通知成功!");
+			CtkRechargeOrder ctk = new CtkRechargeOrder();
+			ctk.setId(rechargeOrderId);
+			ctk = prePayDao.templateOne(ctk);
+			if(  ctk.getChannelType() == 2 ){//如果是大风渠道
+				return dafengOrderNotice(rechargeOrderId);
+			}else if (ctk.getChannelType() == 3){//康体佳服务商平台
+				return comtikaMerchantService.comtikaOrderNotice(ctk);
 			}
 		} catch (Exception e) {
 			e.printStackTrace();
@@ -1199,6 +1180,53 @@ public class DaFengServiceImpl implements DaFengService {
 		}
 		return RespWrapper.makeFailResp("订单通知失败!");
 	}
+	
+	
+
+	private RespWrapper<Object> dafengOrderNotice(Long rechargeOrderId) throws Exception {
+		Map<String,Object> map = new HashMap<String,Object>();
+		map.put("id", rechargeOrderId);
+		map = prePayDao.queryDafengOrderAndMerchantId(map);
+		if(null == map.get("payTransactionId") || null == map.get("merchantNo")){
+			return RespWrapper.makeFailResp("数据有误,请检查!");
+		}
+		JSONObject dataJson = new JSONObject();
+		dataJson.put("merchantId", map.get("merchantNo"));//大风商户号,调报备接口时返回
+		dataJson.put("orderId", map.get("payTransactionId"));//大风支付单号
+
+		log.info("加密前业务数据:"+dataJson);
+		String data = Base64Utils.encode(RSAUtils.encryptByPublicKey(dataJson.toString().getBytes(), dfPublicKey));
+		log.info("加密后业务数据:"+data);
+
+		JSONObject reqMap = new JSONObject();
+		reqMap.put("service", "DF_ORDER_NOTICE");
+		reqMap.put("secId", "RSA");
+		reqMap.put("version", "1.0.0");
+		reqMap.put("platformId", platformId);
+		reqMap.put("data", data);
+
+		log.info("加密前签名数据:"+reqMap);
+		String sign = RSAUtils.sign(reqMap.toString().getBytes(), merPrivateKey);
+		log.info("加密后签名数据:"+sign);
+		reqMap.put("sign", sign);
+
+		log.info("请求数据:"+reqMap);
+		String result = HTTPUtils.post( url + "payManage/orderOverNotice.do", reqMap, null);
+		log.info("返回数据:"+result);
+
+		JSONObject respJson = JSONObject.fromObject(result);
+		if ("0000".equals(respJson.getString("respCode"))){
+			//String decryptData = new String(RSAUtils.decryptByPrivateKey(Base64Utils.decode(respJson.getString("respData")), merPrivateKey));
+			//log.info("解密后返回参数:"+decryptData);
+			//订单通知成功后,需要修改数据库
+			CtkRechargeOrder ctkRechargeOrder = new CtkRechargeOrder();
+			ctkRechargeOrder.setId(rechargeOrderId);
+			ctkRechargeOrder.setDaFengStatus(1);
+			prePayDao.updateTemplateById(ctkRechargeOrder);
+			return RespWrapper.makeSuccessResp("订单通知成功!");
+		}
+		return RespWrapper.makeFailResp("订单通知失败!");
+	}
 
 	@Override
 	public void queryDafengSeparate() {

+ 10 - 1
ctkcloud-mybank-service/src/main/java/com/comtika/ctkcloud/server/service/refund/MybankRefundServiceImpl.java

@@ -23,6 +23,7 @@ import com.comtika.ctkcloud.server.dao.merchant.DetailDao;
 import com.comtika.ctkcloud.server.dao.recharge.RechargeDao;
 import com.comtika.ctkcloud.server.dao.refund.RefundDao;
 import com.comtika.ctkcloud.server.entity.mybank.CtkRefund;
+import com.comtika.ctkcloud.server.service.comtika.ComtikaMerchantService;
 import com.comtika.ctkcloud.server.service.dafeng.DaFengService;
 import com.comtika.ctkcloud.server.util.XmlSignUtil;
 import com.comtika.ctkcloud.server.util.XmlUtil;
@@ -44,7 +45,10 @@ public class MybankRefundServiceImpl implements MybankRefundService {
 
 	@Autowired
 	private MybankConfig mybankConfig;
-
+	
+	@Autowired
+	private ComtikaMerchantService comtikaMerchantService;
+	
 	@Override
 	public RespWrapper<Object> mybankRefund(Long refundFee, Long merchantId,
 											Long rechargeOrderId, String ip,String msg) {
@@ -77,6 +81,11 @@ public class MybankRefundServiceImpl implements MybankRefundService {
 			String payOrderId = String.valueOf(rechargeMap.get("payTransactionId"));
 			return daFengService.refundDaFeng(rechargeOrderId,payOrderId, refundFee,merchantId,Long.parseLong(rechargeMap.get("customerId").toString()));
 		}
+		/**这里判断是否是康体佳服务商的,网商的逻辑不动**/
+		if(null != rechargeMap.get("channelType") && Integer.parseInt(String.valueOf(rechargeMap.get("channelType"))) == 3){
+			String payOrderId = String.valueOf(rechargeMap.get("payTransactionId"));
+			return comtikaMerchantService.refundComtika(rechargeOrderId,payOrderId, refundFee,merchantId,Long.parseLong(rechargeMap.get("customerId").toString()));
+		}
 		//3.查询商户入驻网商银行的商户号
 		map.put("merchantId", merchantId);
 		String merchantNo = detailDao.queryMerchantDetail(map);

+ 18 - 5
ctkcloud-mybank-service/src/main/java/com/comtika/ctkcloud/server/service/sepAccount/impl/SepAccountServiceImpl.java

@@ -4,11 +4,14 @@ import com.alibaba.fastjson.JSONObject;
 import com.comtika.ctkcloud.common.result.RespWrapper;
 import com.comtika.ctkcloud.common.util.StringUtil;
 import com.comtika.ctkcloud.server.core.ComtikaHttpsUtil;
+import com.comtika.ctkcloud.server.dao.comtika.SysComtikaMerchantDao;
 import com.comtika.ctkcloud.server.dao.sepAccount.ReceiveDao;
+import com.comtika.ctkcloud.server.entity.comtikawechat.SysComtikaMerchant;
 import com.comtika.ctkcloud.server.entity.sepAccount.CtkReceiveUser;
 import com.comtika.ctkcloud.server.entity.sepAccount.SepReceiveConfigHelp;
 import com.comtika.ctkcloud.server.entity.sepAccount.SepReceiverHelp;
 import com.comtika.ctkcloud.server.service.sepAccount.ISepAccountService;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -31,10 +34,20 @@ public class SepAccountServiceImpl implements ISepAccountService {
 
     @Autowired
     private ReceiveDao receiveDao;
+    
+    @Autowired
+	private SysComtikaMerchantDao sysComtikaMerchantDao;
+    
     @Override
     @Transient
     public RespWrapper<Boolean> sepReceiveUserConfig(SepReceiveConfigHelp help) {
         // todo 需要查询该商户是否已经入住吗
+    	SysComtikaMerchant sys = new SysComtikaMerchant();
+    	sys.setMerchantId(Long.parseLong(help.getMerchantId()+""));
+    	sys = sysComtikaMerchantDao.templateOne(sys);
+    	if( null ==sys || sys.getRegisterStatus() != 2){
+    		return RespWrapper.makeFailResp("商户未入住,不能设置分账人!");
+    	}
         String  groupName = String.format(SITE_GROUP_NAME,help.getSiteId());
         CtkReceiveUser user = new CtkReceiveUser();
         boolean isMerchant = help.getMerchantId() != null;
@@ -56,10 +69,10 @@ public class SepAccountServiceImpl implements ISepAccountService {
             CtkReceiveUser ck = new CtkReceiveUser();
             if(!isMerchant)
                 ck.setSiteId(help.getSiteId());
-            ck.setAccount(s.getWxAccount());
+            ck.setAccount(s.getAccount());
             ck.setGroupName(groupName);
             ck.setNickName(s.getNickName());
-            ck.setRate(s.getSepRate());
+            ck.setRate(s.getRate());
             list.add(ck);
         });
         Map<String,Object> condition = new HashMap<>(4);
@@ -68,7 +81,7 @@ public class SepAccountServiceImpl implements ISepAccountService {
         // todo 填写对应特约商户号
         condition.put("subMchId","");
         try {
-            String s = ComtikaHttpsUtil.doPostWxPage(CTK_BASE_URL_PREFIX + CTK_SEP_HANDLE_URL, JSONObject.toJSONString(condition));
+            String s = ComtikaHttpsUtil.doPost(CTK_BASE_URL_PREFIX + CTK_SEP_HANDLE_URL, JSONObject.toJSONString(condition));
             RespWrapper respWrapper = JSONObject.parseObject(s, RespWrapper.class);
             if(!respWrapper.isSuccess())
                 throw new RuntimeException(respWrapper.getMsg());
@@ -104,7 +117,7 @@ public class SepAccountServiceImpl implements ISepAccountService {
         condition.put("amount",totalFee);
         condition.put("transactionId",transactionId);
         try {
-            String s = ComtikaHttpsUtil.doPostWxPage(CTK_BASE_URL_PREFIX + CTK_ADD_RECEIVE_URL, JSONObject.toJSONString(condition));
+            String s = ComtikaHttpsUtil.doPost(CTK_BASE_URL_PREFIX + CTK_ADD_RECEIVE_URL, JSONObject.toJSONString(condition));
             RespWrapper<String> respWrapper = JSONObject.parseObject(s, RespWrapper.class);
             if(!respWrapper.isSuccess())
                 throw new RuntimeException(respWrapper.getMsg());
@@ -140,7 +153,7 @@ public class SepAccountServiceImpl implements ISepAccountService {
         if(StringUtil.isNotEmpty(outOrderNo)) return RespWrapper.makeFailResp("查询outOrderNo的不能为空");
         String format = String.format(FIND_SEP_RESULT, outOrderNo);
         try {
-            String s = ComtikaHttpsUtil.doGetWxPage(CTK_BASE_URL_PREFIX + format);
+            String s = ComtikaHttpsUtil.doGet(CTK_BASE_URL_PREFIX + format);
             return JSONObject.parseObject(s, RespWrapper.class);
         }catch (Exception e){
             log.error("查询分账账单异常:{}",e.getMessage());

+ 18 - 0
ctkcloud-mybank-service/src/main/java/com/comtika/ctkcloud/server/service/wxSep/IWxSepService.java

@@ -0,0 +1,18 @@
+package com.comtika.ctkcloud.server.service.wxSep;
+
+import com.comtika.ctkcloud.common.result.RespWrapper;
+import com.comtika.ctkcloud.server.entity.sep.help.SepQueryHelp;
+import com.comtika.ctkcloud.server.entity.sep.help.SepReceiverHelp;
+import com.comtika.ctkcloud.server.entity.sep.UserSepReceiver;
+
+import java.util.List;
+
+public interface IWxSepService {
+    RespWrapper<Boolean> addSepReceive(UserSepReceiver userSepReceiver);
+
+    RespWrapper<List<SepReceiverHelp>> findSepUserList(SepQueryHelp help);
+    // 商户分账时调用接口
+    RespWrapper<String> sepAccountHandle(Integer merchantId,Integer amount,String transactionId);
+    RespWrapper<String> sepAccountHandleFormSiteId(Integer siteId,Integer amount,String transactionId);
+
+}

+ 156 - 0
ctkcloud-mybank-service/src/main/java/com/comtika/ctkcloud/server/service/wxSep/impl/WxSepServiceImpl.java

@@ -0,0 +1,156 @@
+package com.comtika.ctkcloud.server.service.wxSep.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.comtika.ctkcloud.common.result.RespWrapper;
+import com.comtika.ctkcloud.server.core.ComtikaHttpsUtil;
+import com.comtika.ctkcloud.server.dao.sep.KtjSepUserDao;
+import com.comtika.ctkcloud.server.entity.sep.KtjSepUser;
+import com.comtika.ctkcloud.server.entity.sep.help.SepQueryHelp;
+import com.comtika.ctkcloud.server.entity.sep.help.SepReceiverHelp;
+import com.comtika.ctkcloud.server.entity.sep.UserSepReceiver;
+import com.comtika.ctkcloud.server.service.wxSep.IWxSepService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class WxSepServiceImpl implements IWxSepService {
+    private static final String GROUP_NAME = "COMTIKA_SITE_%";
+    private static final String BASE_URL = "http://localhost:8888";
+    @Autowired
+    private KtjSepUserDao ktjSepUserDao;
+    @Override
+    public RespWrapper<Boolean> addSepReceive(UserSepReceiver userSepReceiver) {
+        // todo 需要判断是否已经入驻
+        String subMchId = "";
+        KtjSepUser user = new KtjSepUser();
+        handleField(user,userSepReceiver);
+        // 下面准备新增数据
+        List<SepReceiverHelp> sepUserList = userSepReceiver.getSepUserList();
+        List<KtjSepUser> list = new ArrayList<>(sepUserList.size());
+        sepUserList.forEach(s->{
+            KtjSepUser user1 = new KtjSepUser();
+            handleField(user1,userSepReceiver);
+            user1.setNickName(s.getNickName());
+            user1.setWxAccount(s.getWxAccount());
+            user1.setSepRate(s.getSepRate());
+            list.add(user1);
+        });
+
+        /**
+         *  private List<SepReceiverHelp> sepUserList;//分账用户
+         *     private String groupName;//分账分组,为了以后兼容站点分账
+         *     private String subMchId;//服务商户提供的子商户
+         */
+        Map<String,Object> condition = new HashMap<>(8);
+        condition.put("sepUserList",userSepReceiver.getSepUserList());
+        condition.put("subMchId",subMchId);
+        if(userSepReceiver.getMerchantId() == null)
+            condition.put("groupName",String.format(GROUP_NAME,userSepReceiver.getSiteId()));
+        String json = JSONObject.toJSONString(condition);
+        try {
+            ComtikaHttpsUtil.doPost(BASE_URL+"/sepAccount/addSepReceive",json);
+        }catch (Exception e){
+            e.printStackTrace();
+            return RespWrapper.makeFailResp("异常:"+e.getMessage());
+        }
+        // 删除原来的
+        ktjSepUserDao.template(user).forEach(s->{
+            // 这里的数据需要删除
+            ktjSepUserDao.deleteById(s.getId());
+        });
+        //调用接口
+        ktjSepUserDao.insertBatch(list);
+        return RespWrapper.makeSuccessResp(true);
+    }
+    private void handleField(KtjSepUser user,UserSepReceiver userSepReceiver){
+        if(userSepReceiver.getMerchantId() != null){
+            user.setMerchantId(user.getMerchantId());
+        }else {
+            user.setSiteId(user.getSiteId());
+        }
+    }
+    // 这里直接查本地数据库
+    @Override
+    public RespWrapper<List<SepReceiverHelp>> findSepUserList(SepQueryHelp help) {
+        KtjSepUser user = new KtjSepUser();
+        if(help.getMerchantId() != null)
+            user.setMerchantId(help.getMerchantId());
+        else user.setSiteId(help.getSiteId());
+        List<SepReceiverHelp> list = new ArrayList<>();
+        ktjSepUserDao.template(user).forEach(s->{
+            SepReceiverHelp receiver = new SepReceiverHelp();
+            receiver.setNickName(s.getNickName());
+            receiver.setSepRate(s.getSepRate());
+            receiver.setWxAccount(s.getWxAccount());
+            list.add(receiver);
+        });
+        return RespWrapper.makeSuccessResp(list);
+    }
+
+    /**
+     *  private String subMchId;
+     *     private String groupName;// 没有传使用默认的
+     *     private Integer amount;//分账金额 分账时使用,如果不传使用支付金额
+     *     private String transactionId;//微信支付编号
+     * @param merchantId
+     * @param amount
+     * @param transactionId
+     * @return
+     */
+    @Override
+    public RespWrapper<String> sepAccountHandle(Integer merchantId, Integer amount, String transactionId) {
+        if(amount == null || amount< 1)
+            return RespWrapper.makeFailResp("分账金额不能小于1分钱");
+        String subMchId = findSubMchIdByMerchant(merchantId);
+        Map<String,Object> condition = new HashMap<>(8);
+        condition.put("subMchId",subMchId);
+        condition.put("amount",amount);
+        condition.put("transactionId",transactionId);
+        return doSepAccountHandle(condition);
+    }
+    private RespWrapper<String> doSepAccountHandle(Map<String,Object> condition){
+        try {
+            String post = ComtikaHttpsUtil.doPost(BASE_URL + "/sepAccount/sepAccountHandle", JSONObject.toJSONString(condition));
+            RespWrapper<String> respWrapper = JSONObject.parseObject(post, RespWrapper.class);
+            return respWrapper;
+        }catch (Exception e){
+            return RespWrapper.makeFailResp("异常:"+e.getMessage());
+        }
+    }
+    // todo 根据商户id 查询入驻特约商户号
+    private String findSubMchIdByMerchant(Integer merchantId) {
+        return null;
+    }
+
+    @Override
+    public RespWrapper<String> sepAccountHandleFormSiteId(Integer siteId, Integer amount, String transactionId) {
+        String subMchId = findSubMchIdBySite(siteId);
+        Map<String,Object> condition = new HashMap<>(8);
+        condition.put("subMchId",subMchId);
+        condition.put("amount",amount);
+        condition.put("transactionId",transactionId);
+        condition.put("groupName",String.format(GROUP_NAME,siteId));
+        return doSepAccountHandle(condition);
+    }
+    // todo 根据站点id 查询入驻特约商户号
+    private String findSubMchIdBySite(Integer siteId) {
+        // todo 根据站点查询商户
+        Integer merchantId = 0;
+        return findSubMchIdByMerchant(merchantId);
+    }
+    // todo 测试查询自己配置的分账人 查询
+    public static void main(String[] args)throws Exception{
+        Map<String,String> condition = new HashMap<>(4);
+        condition.put("subMchId","1584278251");
+        String post = ComtikaHttpsUtil.doPost(BASE_URL + "/sepAccount/findSepUserList", JSONObject.toJSONString(condition));
+        System.out.println(post);
+        RespWrapper respWrapper = JSONObject.parseObject(post, RespWrapper.class);
+        System.out.println(respWrapper);
+
+    }
+}

+ 4 - 4
ctkcloud-mybank-service/src/main/java/com/comtika/ctkcloud/server/web/SepAccountController.java

@@ -43,11 +43,11 @@ public class SepAccountController extends BaseController {
         for(SepReceiverHelp receiverHelp:receiverUserList){
             if(StringUtil.isEmpty(receiverHelp.getNickName()))
                 return RespWrapper.makeFailResp("分账人名字不能为空");
-            if(StringUtil.isEmpty(receiverHelp.getWxAccount()))
+            if(StringUtil.isEmpty(receiverHelp.getAccount()))
                 return RespWrapper.makeFailResp("分账人"+receiverHelp.getNickName()+",微信账号不能为空");
-            if(StringUtil.isEmpty(receiverHelp.getSepRate()))
+            if(StringUtil.isEmpty(receiverHelp.getRate()))
                 return RespWrapper.makeFailResp("分账人:"+receiverHelp.getNickName()+";分账比例不能为空");
-            Float fl = Float.valueOf(receiverHelp.getSepRate());
+            Float fl = Float.valueOf(receiverHelp.getRate());
             num += (int) (fl.floatValue()*100);
         }
         if(num > 30) return RespWrapper.makeFailResp("分账订单金额不能超过30%");
@@ -57,7 +57,7 @@ public class SepAccountController extends BaseController {
     @ApiOperation(value = "查询设置分账人接口 merchantId > siteId")
     @GetMapping("findSepReceiveUserList")
     public RespWrapper<List<CtkReceiveUser>> findSepReceiveUserList(Integer siteId,Integer merchantId){
-        if(siteId == null || merchantId == null)
+        if(siteId == null && merchantId == null)
             return RespWrapper.makeFailResp("请选择查询入参");
         return iSepAccountService.findSepReceiveUserList(siteId,merchantId);
     }

+ 13 - 2
ctkcloud-mybank-service/src/main/java/com/comtika/ctkcloud/server/web/UploadController.java

@@ -4,10 +4,13 @@ package com.comtika.ctkcloud.server.web;
 import com.comtika.ctkcloud.common.result.RespWrapper;
 import com.comtika.ctkcloud.server.config.MybankConfig;
 import com.comtika.ctkcloud.server.constant.PhotoType;
+import com.comtika.ctkcloud.server.service.comtika.ComtikaMerchantService;
 import com.comtika.ctkcloud.server.service.merchant.upload.UploadPhotoService;
+
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiOperation;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -29,7 +32,9 @@ public class UploadController {
 
     @Autowired
     MybankConfig config;
-
+    
+    @Autowired
+	private ComtikaMerchantService comtikaMerchantService;
     /**
      * 上传文件
      * 测试方法:
@@ -64,7 +69,13 @@ public class UploadController {
             return RespWrapper.makeErrorResp("上传异常"+e.getMessage());
         }
     }
-
+    
+    @ApiOperation(value = "这个是微信图片上传", notes = "这个是微信图片上传")
+	@PostMapping("/weChatUploadPhoto")
+    public RespWrapper<Object> uploadPhoto(MultipartFile file) {
+		return comtikaMerchantService.uploadPhoto(file);
+	}
+    
     /*@ApiOperation(value = "上传图片--新 test", notes = "photoType:1 身份证正面,02 身份证反面,03 营业执照,04组织机构代码证," +
             "05 开户许可证,06 门头照,07 其它,08 收银台照片,09 门店内景照片,10 各大餐饮平台入驻")
     @PostMapping("/uploadPhotoNew")

+ 3 - 5
ctkcloud-mybank-service/src/main/resources/bootstrap.yml

@@ -1,11 +1,8 @@
 spring:
   application:
     name: mybank-service
-  tcpUrl: db.comtti.net:9250
-#默认是 是0.1 zikpin采样百分比 前期使用1
-  sleuth:
-    sampler:
-      percentage = 0.1
+  tcpUrl: 172.16.0.11:9250
+  #tcpUrl: 193.112.16.187:9250
 #配置中心地址
   cloud:
     config:
@@ -22,3 +19,4 @@ eureka:
   client:
     serviceUrl:
       defaultZone: http://admin:comtika2018@peer1:8761/eureka/,http://admin:comtika2018@peer2:8762/eureka/
+#      defaultZone: http://admin:comtika2018@peer1:8761/eureka/

+ 27 - 1
ctkcloud-mybank-service/src/main/resources/sql/recharge/order.md

@@ -32,4 +32,30 @@ WHERE recharge_no IN
   WHERE cro.status = 30 
     AND cro.channel_type = 2 
     AND cro.da_feng_status = 0) 
-  AND order_status != 0 
+  AND order_status != 0 
+  
+queryComtikaOrder
+=== 
+SELECT 
+  recharge_no,
+  charge_money,
+  total_fee 
+FROM
+  ctk_service_order 
+WHERE recharge_no IN 
+  (SELECT 
+    cro.id 
+  FROM
+    ctk_recharge_order cro 
+  WHERE cro.status = 30 
+    AND cro.channel_type = 3 
+    AND cro.da_feng_status = 0) 
+  AND order_status != 0  
+ 
+ 
+  
+queryRechargeOrderSiteIdAndMerchantId
+===
+SELECT site_id,merchant_id FROM ctk_service_order WHERE recharge_no = #rechargeOrderId#  
+  
+  

+ 2 - 2
ctkcloud-oauth-server/pom.xml

@@ -54,12 +54,12 @@
 				<artifactId>docker-maven-plugin</artifactId>
 				<version>0.4.13</version>
 				<configuration>
-					<imageName>${docker.aliyun.registry}/${docker.aliyun.name}/${project.artifactId}:5.0.2</imageName>
+					<imageName>${docker.aliyun.registry}/${docker.aliyun.name}/${project.artifactId}:6.0.0</imageName>
 					<!-- <dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory> -->
 					<!-- 如果有相同的覆盖 -->
 					<forceTags>true</forceTags>
 					<baseImage>java</baseImage>
-					<entryPoint>["java","-jar","-XX:+UseG1GC","-XX:+PrintGCDetails","-XX:+PrintGCTimeStamps","-XX:+PrintGCDateStamps","-Xloggc:/protocol.log","-Xms256m","-Xmx256m","-XX:MetaspaceSize=128m","-XX:MaxMetaspaceSize=128m","/${project.build.finalName}.jar"]</entryPoint>
+					<entryPoint>["java","-jar","-XX:+PrintGCDetails","-XX:+PrintGCTimeStamps","-XX:+PrintGCDateStamps","-Xloggc:/protocol.log","-Xms256m","-Xmx256m","-XX:MetaspaceSize=128m","-XX:MaxMetaspaceSize=128m","/${project.build.finalName}.jar"]</entryPoint>
 					<dockerHost>${docker.url}</dockerHost>
 					<registryUrl>${docker.aliyun.registry}</registryUrl>
 					<serverId>docker_actor</serverId>

+ 3 - 4
ctkcloud-oauth-server/src/main/resources/bootstrap.yml

@@ -3,10 +3,8 @@ server:
 spring:
   application:
     name: oauth-server
-  tcpUrl: db.comtti.net:9250
-  sleuth:
-    sampler:
-      percentage: 0.5
+  tcpUrl: 172.16.0.11:9250
+  #tcpUrl: 193.112.16.187:9250
   cloud:
     config:
       discovery:
@@ -22,3 +20,4 @@ eureka:
   client:
     serviceUrl:
       defaultZone: http://admin:comtika2018@peer1:8761/eureka/,http://admin:comtika2018@peer2:8762/eureka/
+#      defaultZone: http://admin:comtika2018@peer1:8761/eureka/

+ 2 - 2
ctkcloud-order-service/pom.xml

@@ -37,12 +37,12 @@
 				<artifactId>docker-maven-plugin</artifactId>
 				<version>0.4.13</version>
 				<configuration>
-					<imageName>${docker.aliyun.registry}/${docker.aliyun.name}/${project.artifactId}:5.0.4</imageName>
+					<imageName>${docker.aliyun.registry}/${docker.aliyun.name}/${project.artifactId}:6.0.0</imageName>
 					<!-- <dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory> -->
 					<!-- 如果有相同的覆盖 -->
 					<forceTags>true</forceTags>
 					<baseImage>java</baseImage>
-					<entryPoint>["java","-jar","-XX:+PrintGCDetails","-XX:+PrintGCTimeStamps","-XX:+PrintGCDateStamps","-Xloggc:./upload.log","-XX:+UseG1GC","-Xms256m","-Xmx256m","-XX:MetaspaceSize=256m","-XX:MaxMetaspaceSize=256m","/${project.build.finalName}.jar"]</entryPoint>
+					<entryPoint>["java","-jar","-XX:+PrintGCDetails","-XX:+PrintGCTimeStamps","-XX:+PrintGCDateStamps","-Xloggc:./upload.log","-Xms256m","-Xmx256m","-XX:MetaspaceSize=256m","-XX:MaxMetaspaceSize=256m","/${project.build.finalName}.jar"]</entryPoint>
 					<dockerHost>${docker.url}</dockerHost>
 					<registryUrl>${docker.aliyun.registry}</registryUrl>
 					<serverId>docker_actor</serverId>

+ 4 - 6
ctkcloud-order-service/src/main/resources/bootstrap.yml

@@ -1,18 +1,15 @@
 spring:
   application:
     name: order-service
-  tcpUrl: db.comtti.net:9250
-#默认是 是0.1 zikpin采样百分比 前期使用1
-  sleuth:
-    sampler:
-      percentage = 0.5
+  tcpUrl: 172.16.0.11:9250
+  #tcpUrl: 193.112.16.187:9250
 # cloud 配置中心地址
   cloud:
     config:
       discovery:
         enabled: true
         service-id: config-service
-      profile: test
+      profile: prod
       label: master
       username: ctk_miss
       password: actor#config_server
@@ -22,3 +19,4 @@ eureka:
   client:
     serviceUrl:
       defaultZone: http://admin:comtika2018@peer1:8761/eureka/,http://admin:comtika2018@peer2:8762/eureka/
+#      defaultZone: http://admin:comtika2018@peer1:8761/eureka/

+ 2 - 2
ctkcloud-platform-service/pom.xml

@@ -50,12 +50,12 @@
 				<artifactId>docker-maven-plugin</artifactId>
 				<version>0.4.13</version>
 				<configuration>
-					<imageName>${docker.aliyun.registry}/${docker.aliyun.name}/${project.artifactId}:5.0.3</imageName>
+					<imageName>${docker.aliyun.registry}/${docker.aliyun.name}/${project.artifactId}:6.0.0</imageName>
 					<!-- <dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory> -->
 					<!-- 如果有相同的覆盖 -->
 					<forceTags>true</forceTags>
 					<baseImage>java</baseImage>
-					<entryPoint>["java","-jar","-XX:+UseG1GC","-XX:+PrintGCDetails","-XX:+PrintGCTimeStamps","-XX:+PrintGCDateStamps","-Xloggc:/protocol.log","-Xms256m","-Xmx256m","-XX:MetaspaceSize=256m","-XX:MaxMetaspaceSize=256m","/${project.build.finalName}.jar"]</entryPoint>
+					<entryPoint>["java","-jar","-XX:+PrintGCDetails","-XX:+PrintGCTimeStamps","-XX:+PrintGCDateStamps","-Xloggc:/protocol.log","-Xms256m","-Xmx256m","-XX:MetaspaceSize=256m","-XX:MaxMetaspaceSize=256m","/${project.build.finalName}.jar"]</entryPoint>
 					<dockerHost>${docker.url}</dockerHost>
 					<registryUrl>${docker.aliyun.registry}</registryUrl>
 					<serverId>docker_actor</serverId>

+ 4 - 6
ctkcloud-platform-service/src/main/resources/bootstrap.yml

@@ -1,18 +1,15 @@
 spring:
   application:
     name: platform-service
-  tcpUrl: db.comtti.net:9250
-#默认是 是0.1 zikpin采样百分比 前期使用1
-  sleuth:
-    sampler:
-      percentage = 0.1
+  tcpUrl: 172.16.0.11:9250
+  #tcpUrl: 193.112.16.187:9250
 # cloud 配置中心地址
   cloud:
     config:
       discovery:
         enabled: true
         service-id: config-service
-      profile: test
+      profile: prod
       label: master
       username: ctk_miss
       password: actor#config_server
@@ -23,3 +20,4 @@ eureka:
   client:
     serviceUrl:
       defaultZone: http://admin:comtika2018@peer1:8761/eureka/,http://admin:comtika2018@peer2:8762/eureka/
+#      defaultZone: http://admin:comtika2018@peer1:8761/eureka/

+ 2 - 2
ctkcloud-protocol-service/pom.xml

@@ -53,12 +53,12 @@
 				<artifactId>docker-maven-plugin</artifactId>
 				<version>0.4.13</version>
 				<configuration>
-					<imageName>${docker.aliyun.registry}/${docker.aliyun.name}/${project.artifactId}:5.2.1</imageName>
+					<imageName>${docker.aliyun.registry}/${docker.aliyun.name}/${project.artifactId}:6.0.0</imageName>
 					<!-- <dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory> -->
 					<!-- 如果有相同的覆盖 -->
 					<forceTags>true</forceTags>
 					<baseImage>java</baseImage>
-					<entryPoint>["java","-jar","-XX:+UseG1GC","-XX:+PrintGCDetails","-XX:+PrintGCTimeStamps","-XX:+PrintGCDateStamps","-Xloggc:/protocol.log","-Xms384m","-Xmx384m","-XX:MetaspaceSize=256m","-XX:MaxMetaspaceSize=256m","/${project.build.finalName}.jar"]</entryPoint>
+					<entryPoint>["java","-jar","-XX:+PrintGCDetails","-XX:+PrintGCTimeStamps","-XX:+PrintGCDateStamps","-Xloggc:/protocol.log","-Xms384m","-Xmx384m","-XX:MetaspaceSize=256m","-XX:MaxMetaspaceSize=256m","/${project.build.finalName}.jar"]</entryPoint>
 					<dockerHost>${docker.url}</dockerHost>
 					<registryUrl>${docker.aliyun.registry}</registryUrl>
 					<serverId>docker_actor</serverId>

+ 5 - 4
ctkcloud-protocol-service/src/main/java/com/comtika/ctkcloud/server/core/eunms/OperationCode.java

@@ -14,13 +14,14 @@ public enum OperationCode {
 	FIND_TERMINAL_MAC(0xE2,"查询集中器MAC E2H"),
 	UPDATE_TERMINAL_TIME(0x8C,"设置集中器时间 8CH"),
 	FIND_TERMINAL_TIME(0x8D,"查询集中器时间 8DH"),
-	UPDATE_IP_PORT(0xFC,"设置集中器远程更新IP和端口 FCH"),
-	GET_IP_PORT(0xFD,"查询集中器远程更新IP和端口 FDH"),
+	// 忽略该版本指令
+	//UPDATE_IP_PORT(0xFC,"设置集中器远程更新IP和端口 FCH"),
+	//GET_IP_PORT(0xFD,"查询集中器远程更新IP和端口 FDH"),
 	GET_DETAIL_HD(0x4A,"查询集中器软硬件信息 4AH"),
 	SET_HOST_IPPORT(0xF8,"设置集中器主服务器IP和端口 F8H"),
 	GET_HOST_IPPORT(0xF9,"查询集中器主服务器IP和端口 F9H"),
-	SET_BACKUP_IP_PORT(0xFA,"集中器备用服务器IP和端口 FAH"),
-	GET_BACKUP_IP_PORT(0xFB,"查询集中器备用服务器IP和端口 FBH"),
+	//SET_BACKUP_IP_PORT(0xFA,"集中器备用服务器IP和端口 FAH"),
+	//GET_BACKUP_IP_PORT(0xFB,"查询集中器备用服务器IP和端口 FBH"),
 	SET_NODE_PARAM(0x01,"配置节点参数 01H"),
 	SET_NODE_PATTERN(0x02,"设置节点工作模式 02H"),
 	SET_NODE_RTC(0x03,"设置节点RTC 03H"),

+ 0 - 0
ctkcloud-protocol-service/src/main/java/com/comtika/ctkcloud/server/core/netty/NettyServerHandle.java


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