|
@@ -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());
|