diff --git a/hai-bweb/src/main/java/com/bweb/config/msg/MerStoreAccountChgHandler.java b/hai-bweb/src/main/java/com/bweb/config/msg/MerStoreAccountChgHandler.java index cc91b812..cd156a58 100644 --- a/hai-bweb/src/main/java/com/bweb/config/msg/MerStoreAccountChgHandler.java +++ b/hai-bweb/src/main/java/com/bweb/config/msg/MerStoreAccountChgHandler.java @@ -33,55 +33,55 @@ public class MerStoreAccountChgHandler { @PostConstruct public void init() { -// new Thread(() -> { -// { -// //消息处理 -// while (true){ -// try { -// //构建的队列为左进右出 -// Object o = redisTemplate.opsForList().rightPop(MsgTopic.MerStoreAccount.getName()); -// if (o != null) { -// //处理消息 -// logger.info("消息通道:"+o); -// -// Map param = (Map) o; -// -// if (MapUtils.getInteger(param, "businessType").equals(MerStoreAmountTypeEnum.type1.getType())) { -// Map otherParam = new HashMap<>(); -// otherParam.put("sourceType", MapUtils.getString(param, "sourceType")); -// otherParam.put("sourceId", MapUtils.getString(param, "sourceId")); -// otherParam.put("sourceContent", MapUtils.getString(param, "sourceContent")); -// otherParam.put("opUserId", MapUtils.getLong(param, "opUserId")); -// otherParam.put("opUserName", MapUtils.getString(param, "opUserName")); -// -// merchantStoreAccountService.recharge( -// MapUtils.getLong(param, "storeId"), -// new BigDecimal(MapUtils.getString(param, "price")), -// otherParam); -// } -// -// if (MapUtils.getInteger(param, "businessType").equals(MerStoreAmountTypeEnum.type2.getType())) { -// Map otherParam = new HashMap<>(); -// otherParam.put("sourceType", MapUtils.getString(param, "sourceType")); -// otherParam.put("sourceId", MapUtils.getString(param, "sourceId")); -// otherParam.put("sourceContent", MapUtils.getString(param, "sourceContent")); -// otherParam.put("opUserId", MapUtils.getLong(param, "opUserId")); -// otherParam.put("opUserName", MapUtils.getString(param, "opUserName")); -// -// merchantStoreAccountService.consume( -// MapUtils.getLong(param, "storeId"), -// new BigDecimal(MapUtils.getString(param, "price")), -// otherParam); -// } -// -// } else { -// Thread.sleep(1000); -// } -// }catch (Exception e){ -// logger.error("监听订单状态变更错误",e); -// } -// } -// } -// }).start(); + new Thread(() -> { + { + //消息处理 + while (true){ + try { + //构建的队列为左进右出 + Object o = redisTemplate.opsForList().rightPop(MsgTopic.MerStoreAccount.getName()); + if (o != null) { + //处理消息 + logger.info("消息通道:"+o); + + Map param = (Map) o; + + if (MapUtils.getInteger(param, "businessType").equals(MerStoreAmountTypeEnum.type1.getType())) { + Map otherParam = new HashMap<>(); + otherParam.put("sourceType", MapUtils.getString(param, "sourceType")); + otherParam.put("sourceId", MapUtils.getString(param, "sourceId")); + otherParam.put("sourceContent", MapUtils.getString(param, "sourceContent")); + otherParam.put("opUserId", MapUtils.getLong(param, "opUserId")); + otherParam.put("opUserName", MapUtils.getString(param, "opUserName")); + + merchantStoreAccountService.recharge( + MapUtils.getLong(param, "storeId"), + new BigDecimal(MapUtils.getString(param, "price")), + otherParam); + } + + if (MapUtils.getInteger(param, "businessType").equals(MerStoreAmountTypeEnum.type2.getType())) { + Map otherParam = new HashMap<>(); + otherParam.put("sourceType", MapUtils.getString(param, "sourceType")); + otherParam.put("sourceId", MapUtils.getString(param, "sourceId")); + otherParam.put("sourceContent", MapUtils.getString(param, "sourceContent")); + otherParam.put("opUserId", MapUtils.getLong(param, "opUserId")); + otherParam.put("opUserName", MapUtils.getString(param, "opUserName")); + + merchantStoreAccountService.consume( + MapUtils.getLong(param, "storeId"), + new BigDecimal(MapUtils.getString(param, "price")), + otherParam); + } + + } else { + Thread.sleep(1000); + } + }catch (Exception e){ + logger.error("监听订单状态变更错误",e); + } + } + } + }).start(); } } diff --git a/hai-bweb/src/main/resources/prod/logback.xml b/hai-bweb/src/main/resources/prod/logback.xml index 516350df..5762f5eb 100644 --- a/hai-bweb/src/main/resources/prod/logback.xml +++ b/hai-bweb/src/main/resources/prod/logback.xml @@ -57,6 +57,24 @@ UTF-8 + + + log/wechatPay.log + + log/wechatPayLog/wechatPayLog.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + @@ -69,4 +87,8 @@ + + + + diff --git a/hai-order/src/main/resources/dev/logback.xml b/hai-order/src/main/resources/dev/logback.xml index 430d1fb5..eb4dc1eb 100644 --- a/hai-order/src/main/resources/dev/logback.xml +++ b/hai-order/src/main/resources/dev/logback.xml @@ -125,6 +125,25 @@ UTF-8 + + + log/wechatPay.log + + log/wechatPayLog/wechatPayLog.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + + @@ -152,5 +171,8 @@ + + + diff --git a/hai-order/src/main/resources/prod/logback.xml b/hai-order/src/main/resources/prod/logback.xml index 17bea0c3..f9435509 100644 --- a/hai-order/src/main/resources/prod/logback.xml +++ b/hai-order/src/main/resources/prod/logback.xml @@ -125,6 +125,25 @@ UTF-8 + + + log/wechatPay.log + + log/wechatPayLog/wechatPayLog.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + + @@ -152,5 +171,8 @@ + + + diff --git a/hai-service/src/main/java/com/hai/config/WxOrderConfig.java b/hai-service/src/main/java/com/hai/config/WxOrderConfig.java index bd73797e..5841937c 100644 --- a/hai-service/src/main/java/com/hai/config/WxOrderConfig.java +++ b/hai-service/src/main/java/com/hai/config/WxOrderConfig.java @@ -115,7 +115,14 @@ public class WxOrderConfig { param.put("sign_type", "HMAC-SHA256"); String signStr = WxUtils.generateSignature(param, "Skufk5oi85wDFGl888i6wsRSTkdd5df5" , WXPayConstants.SignType.HMACSHA256); param.put("sign", signStr); - String resultXmL = doSSLRequest(param.get("mch_id"), "https://api.mch.weixin.qq.com/secapi/pay/refund", WxUtils.mapToXml(param)); + + String paramXml = WxUtils.mapToXml(param); + log.info("==========退款START========="); + log.info("订单号:" + paySerialNo); + log.info("请求参数:" + paramXml); + String resultXmL = doSSLRequest(param.get("mch_id"), "https://api.mch.weixin.qq.com/secapi/pay/refund", paramXml); + log.info("响应参数:" + resultXmL); + log.info("==========退款END========="); return XmlUtil.getObjectFromXML(resultXmL, OrderRefundModel.class); }