comtikaweb 4 роки тому
батько
коміт
baea9438ad

+ 1 - 1
ctkcloud-mybank-service/src/main/java/com/comtika/ctkcloud/server/entity/comtikawechat/SysComtikaMerchant.java

@@ -21,7 +21,7 @@ public class SysComtikaMerchant {
 	private Long merchantId;
 	
 	//服务商平台商户号
-	private String subMchId;
+	private String subMchid;
 	
 	// 申请业务单号
 	private String businessCode;

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

@@ -9,8 +9,8 @@ public class CtkReceiveUser {
     @AutoID
     private Integer id;		//数据库表id
     private String nickName;//分账人名称
-    private String account;	//
-    private String rate;	//
+    private String wxAccount;	//
+    private String sepRate;	//
     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 account;//微信个人账户
+    private String wxAccount;//微信个人账户
     private String nickName;//微信账号名字
-    private String rate;//分账比例 0.01-1 保留2位小数
+    private String sepRate;//分账比例 0.01-1 保留2位小数
 }

+ 31 - 19
ctkcloud-mybank-service/src/main/java/com/comtika/ctkcloud/server/service/comtika/impl/ComtikaMerchantServiceImpl.java

@@ -89,7 +89,9 @@ public class ComtikaMerchantServiceImpl implements ComtikaMerchantService {
 	
 	public static String notifyUrl = "https://www.comtikaiot.cn/api/zuul/mybank/comtika/notify";
 	
-
+	public static  String CTK_SEP_HANDLE_URL = "/sepAccount/sepAccountHandle";//发起分账接口
+	
+	
 	@SuppressWarnings("unchecked")
 	@Override
 	public RespWrapper<Object> weChatRegisterMerchant(
@@ -152,13 +154,8 @@ public class ComtikaMerchantServiceImpl implements ComtikaMerchantService {
 			}
 			// 获取请求头
 			Map<String, String> map = requestHeader();
-			// 将businessCode生成json数据
-			Map<String, String> json = new HashMap<String, String>();
-			json.put("businessCode", businessCode);
-			String body = JSONObject.toJSONString(json);
-			System.out.println(body);
 			// 请求服务商平台
-			String httpData = HTTPUtils.post(host + queryWeChatRegisterMerchant, map, body);
+			String httpData = ComtikaHttpsUtil.doGet(host + queryWeChatRegisterMerchant + "?businessCode=" + businessCode);
 			RespWrapper<Object> respWrapper = JSONObject.parseObject(httpData,RespWrapper.class);
 			if (RespCode.SUCCESS != respWrapper.getCode()) {
 				return respWrapper;
@@ -167,7 +164,7 @@ public class ComtikaMerchantServiceImpl implements ComtikaMerchantService {
 			String subMchid = jsonObject.getString("subMchid");
 			Integer registerStatus = jsonObject.getInteger("registerStatus");
 			String registerMessage = jsonObject.getString("registerMessage");
-			sysComtikaMerchant.setSubMchId(subMchid);
+			sysComtikaMerchant.setSubMchid(subMchid);
 			sysComtikaMerchant.setRegisterStatus(registerStatus);
 			sysComtikaMerchant.setRegisterMessage(registerMessage);
 			sysComtikaMerchantDao.updateTemplateById(sysComtikaMerchant);
@@ -321,7 +318,7 @@ public class ComtikaMerchantServiceImpl implements ComtikaMerchantService {
 		return map;
 	}
 
-	public static void main(String[] args) {
+	public static void main(String[] args) throws Exception {
 		/*
 		 * ComtikaRegisterMerchant comtikaRegisterMerchant = new
 		 * ComtikaRegisterMerchant(); comtikaRegisterMerchant.setMerchantId(1L);
@@ -367,9 +364,24 @@ public class ComtikaMerchantServiceImpl implements ComtikaMerchantService {
 		 * .out.println(a.weChatRegisterMerchant(comtikaRegisterMerchant));
 		 * System.out.println(new Date());
 		 */
-
-		ComtikaMerchantServiceImpl a = new ComtikaMerchantServiceImpl();
-		a.queryWeChatRegisterMerchant("111");
+		
+		/*ComtikaMerchantServiceImpl a = new ComtikaMerchantServiceImpl();
+		a.queryWeChatRegisterMerchant("111");*/
+		String httpData = ComtikaHttpsUtil.doGet(host + queryWeChatRegisterMerchant + "?businessCode=" + "Comtika_305A1A0A58194B2EB54F7D9B1AB91FE81590551744");
+		//String httpData = HTTPUtils.post(host + queryWeChatRegisterMerchant, map, body);
+		RespWrapper<Object> respWrapper = JSONObject.parseObject(httpData,RespWrapper.class);
+		JSONObject jsonObject = JSONObject.parseObject(respWrapper.getData().toString());
+		String subMchid = jsonObject.getString("subMchid");
+		Integer registerStatus = jsonObject.getInteger("registerStatus");
+		String registerMessage = jsonObject.getString("registerMessage");
+		System.out.println(subMchid);
+		System.out.println(registerStatus);
+		System.out.println(registerMessage);
+		SysComtikaMerchant sysComtikaMerchant = new SysComtikaMerchant();
+		sysComtikaMerchant.setSubMchid(subMchid);
+		sysComtikaMerchant.setRegisterStatus(registerStatus);
+		sysComtikaMerchant.setRegisterMessage(registerMessage);
+		System.out.println(sysComtikaMerchant.toString());
 	}
 
 	@Override
@@ -471,7 +483,7 @@ public class ComtikaMerchantServiceImpl implements ComtikaMerchantService {
 			// 站点id默认1L
 			return toPaymentApply(openId, ip, mybankPay.getTotalFee(), "N",
 					order.getOrderId(), order.getGoodsName(),
-					comtika.getSubMchId());
+					comtika.getSubMchid());
 		} catch (Exception e) {
 			e.printStackTrace();
 			return RespWrapper.makeErrorResp("服务器错误!");
@@ -502,7 +514,7 @@ public class ComtikaMerchantServiceImpl implements ComtikaMerchantService {
 			comtika = sysComtikaMerchantDao.templateOne(comtika);
 			String refundDesc =  "结束充电";
 			// 发起退款
-			RespWrapper<Object> result = refund(refundAmount,refundDesc,payOrderId,refundFlowId,comtika.getSubMchId());
+			RespWrapper<Object> result = refund(refundAmount,refundDesc,payOrderId,refundFlowId,comtika.getSubMchid());
 			JSONObject json = JSONObject.parseObject(result.getData().toString());
 			if (result.isSuccess()) {
 				ctkRefund.setStatus(MyBankRefundType.ACCEPTANCE.getId());
@@ -561,10 +573,10 @@ public class ComtikaMerchantServiceImpl implements ComtikaMerchantService {
 			ck.setMerchantId(Integer.parseInt(merchantId+""));
 			ck = receiveDao.templateOne(ck);
 			map.clear();
-			map.put("subMchId", sys.getSubMchId());
+			map.put("subMchId", sys.getSubMchid());
 			map.put("transactionId", ctk.getPayTransactionId());
 			map.put("groupName", ck.getGroupName());
-			String str = ComtikaHttpsUtil.doPost(ctk.getPayTransactionId(), JSONObject.toJSONString(map));
+			String str = ComtikaHttpsUtil.doPost(host + CTK_SEP_HANDLE_URL, JSONObject.toJSONString(map));
 			RespWrapper<Object> data = JSONObject.parseObject(str, RespWrapper.class);
 			if(data.isSuccess()){
 				CtkRechargeOrder cro = new CtkRechargeOrder();
@@ -673,11 +685,11 @@ public class ComtikaMerchantServiceImpl implements ComtikaMerchantService {
 						ck.setMerchantId(Integer.parseInt(merchantId+""));
 						ck = receiveDao.templateOne(ck);
 						map1.clear();
-						map1.put("subMchId", sys.getSubMchId());
+						map1.put("subMchId", sys.getSubMchid());
 						map1.put("transactionId", ctk.getPayTransactionId());
 						map1.put("groupName", ck.getGroupName());
 						map1.put("amount", ctk.getTotalFee() - refundFee);//分账金额等于总金额减去退款金额
-						String str1 = ComtikaHttpsUtil.doPost(ctk.getPayTransactionId(), JSONObject.toJSONString(map));
+						String str1 = ComtikaHttpsUtil.doPost(host + CTK_SEP_HANDLE_URL, JSONObject.toJSONString(map));
 						RespWrapper<Object> data1 = JSONObject.parseObject(str1, RespWrapper.class);
 						if(data1.isSuccess()){
 							CtkRechargeOrder cro = new CtkRechargeOrder();
@@ -700,7 +712,7 @@ public class ComtikaMerchantServiceImpl implements ComtikaMerchantService {
 				comtika = sysComtikaMerchantDao.templateOne(comtika);
 				String refundDesc =  "结束充电";
 				// 发起退款
-				RespWrapper<Object> result = refund(ctkRefund.getRefundFee(),refundDesc,cro.getPayTransactionId(),refundFlowId,comtika.getSubMchId());
+				RespWrapper<Object> result = refund(ctkRefund.getRefundFee(),refundDesc,cro.getPayTransactionId(),refundFlowId,comtika.getSubMchid());
 				JSONObject json = JSONObject.parseObject(result.getData().toString());
 				if (result.isSuccess()) {
 					ctkRefund.setStatus(MyBankRefundType.ACCEPTANCE.getId());

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

@@ -27,9 +27,9 @@ import java.util.Map;
 public class SepAccountServiceImpl implements ISepAccountService {
     private final static Logger log = LoggerFactory.getLogger(SepAccountServiceImpl.class);
     private static final String SITE_GROUP_NAME = "COMTIKA_SEP_SITE_%s";// 这样设置站点时只有设计
-    private static final String CTK_BASE_URL_PREFIX = "http://localhost:8888";
+    private static final String CTK_BASE_URL_PREFIX = "https://www.comtikaiot.cn/wechatpay";
     private static final String CTK_ADD_RECEIVE_URL = "/sepAccount/addSepReceive";//增加分账人接口
-    private static final String CTK_SEP_HANDLE_URL = "/sepAccount/sepAccountHandle";//增加分账人接口
+    private static final String CTK_SEP_HANDLE_URL = "/sepAccount/sepAccountHandle";//发起分账接口
     private static final String FIND_SEP_RESULT = "/sepAccount/findSepAccountResult/%s";//增加分账人接口
 
     @Autowired
@@ -69,19 +69,19 @@ public class SepAccountServiceImpl implements ISepAccountService {
             CtkReceiveUser ck = new CtkReceiveUser();
             if(!isMerchant)
                 ck.setSiteId(help.getSiteId());
-            ck.setAccount(s.getAccount());
+            ck.setWxAccount(s.getWxAccount());
             ck.setGroupName(groupName);
             ck.setNickName(s.getNickName());
-            ck.setRate(s.getRate());
+            ck.setSepRate(s.getSepRate());
             list.add(ck);
         });
         Map<String,Object> condition = new HashMap<>(4);
         condition.put("sepUserList",help.getReceiverUserList());
         condition.put("groupName",groupName);
         // todo 填写对应特约商户号
-        condition.put("subMchId","");
+        condition.put("subMchId",sys.getSubMchid());
         try {
-            String s = ComtikaHttpsUtil.doPost(CTK_BASE_URL_PREFIX + CTK_SEP_HANDLE_URL, JSONObject.toJSONString(condition));
+            String s = ComtikaHttpsUtil.doPost(CTK_BASE_URL_PREFIX + CTK_ADD_RECEIVE_URL, JSONObject.toJSONString(condition));
             RespWrapper respWrapper = JSONObject.parseObject(s, RespWrapper.class);
             if(!respWrapper.isSuccess())
                 throw new RuntimeException(respWrapper.getMsg());

+ 3 - 3
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.getAccount()))
+            if(StringUtil.isEmpty(receiverHelp.getWxAccount()))
                 return RespWrapper.makeFailResp("分账人"+receiverHelp.getNickName()+",微信账号不能为空");
-            if(StringUtil.isEmpty(receiverHelp.getRate()))
+            if(StringUtil.isEmpty(receiverHelp.getSepRate()))
                 return RespWrapper.makeFailResp("分账人:"+receiverHelp.getNickName()+";分账比例不能为空");
-            Float fl = Float.valueOf(receiverHelp.getRate());
+            Float fl = Float.valueOf(receiverHelp.getSepRate());
             num += (int) (fl.floatValue()*100);
         }
         if(num > 30) return RespWrapper.makeFailResp("分账订单金额不能超过30%");

+ 1 - 1
ctkcloud-mybank-service/src/main/resources/sql/comtika/merchant.md

@@ -4,7 +4,7 @@ SELECT
 	cs.site_id,
 	cs.merchant_id ,
 	scm.register_status,
-	scm.sub_mchId 
+	scm.sub_mchid 
 FROM 
 (SELECT 
     merchant_id,id AS site_id 

+ 1 - 1
ctkcloud-sites-service/pom.xml

@@ -42,7 +42,7 @@
 				<artifactId>docker-maven-plugin</artifactId>
 				<version>0.4.13</version>
 				<configuration>
-					<imageName>${docker.aliyun.registry}/${docker.aliyun.name}/${project.artifactId}:6.0.0</imageName>
+					<imageName>${docker.aliyun.registry}/${docker.aliyun.name}/${project.artifactId}:6.0.1</imageName>
 					<!-- <dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory> -->
 					<!-- 如果有相同的覆盖 -->
 					<forceTags>true</forceTags>

+ 1 - 1
ctkcloud-sites-service/src/main/resources/sql/site.md

@@ -55,7 +55,7 @@ AND nd.id = sk.equip_node_id
 
 findSitesByParams
 ===
-SELECT #page("s.id,s.`region`,s.`run_time`,s.`site_name`,s.`site_status`,s.`business_type`,m.`org_name` merchant_name,equipment.total_num,free.free_num,cmd.merchant_abbr")#
+SELECT #page("s.id,s.`region`,s.`run_time`,s.`site_name`,s.`site_status`,s.`business_type`,m.`org_name` merchant_name,equipment.total_num,free.free_num,cmd.merchant_abbr,s.`merchant_id`")#
 FROM `ctk_site` s
 LEFT JOIN `sys_org_merchant` org ON s.`org_id` = org.`id`
 LEFT JOIN `sys_org_merchant` m ON s.`merchant_id` = m.`id`