From b25db8264c8d8ac71ec1d66a536f7296e2212ecf Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Sun, 28 Mar 2021 00:14:22 +0800 Subject: [PATCH] =?UTF-8?q?'=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hai-cweb/src/main/java/com/cweb/config/SysConfig.java | 9 +++++++++ .../java/com/cweb/controller/pay/OrderController.java | 3 ++- hai-cweb/src/main/resources/dev/config.properties | 1 + .../java/com/hai/common/pay/entity/WeChatPayReqInfo.java | 9 +++++++++ .../java/com/hai/service/impl/HighOrderServiceImpl.java | 3 ++- 5 files changed, 23 insertions(+), 2 deletions(-) diff --git a/hai-cweb/src/main/java/com/cweb/config/SysConfig.java b/hai-cweb/src/main/java/com/cweb/config/SysConfig.java index 17ac6441..3ce4a0b3 100644 --- a/hai-cweb/src/main/java/com/cweb/config/SysConfig.java +++ b/hai-cweb/src/main/java/com/cweb/config/SysConfig.java @@ -16,6 +16,7 @@ public class SysConfig { private String wxApiKey; private String wxMchId; private String wxMchAppId; + private String wxSubAppId; private String wxSubMchId; private String wxUnifiedOrderUrl; private String couponCodePath; @@ -100,4 +101,12 @@ public class SysConfig { public void setWxMchAppId(String wxMchAppId) { this.wxMchAppId = wxMchAppId; } + + public String getWxSubAppId() { + return wxSubAppId; + } + + public void setWxSubAppId(String wxSubAppId) { + this.wxSubAppId = wxSubAppId; + } } diff --git a/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java b/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java index 4b80a252..ca949161 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java @@ -130,6 +130,7 @@ public class OrderController { WeChatPayReqInfo weChatPayReqInfo = new WeChatPayReqInfo(); weChatPayReqInfo.setAppid(SysConst.getSysConfig().getWxMchAppId()); //公众号id weChatPayReqInfo.setMch_id(SysConst.getSysConfig().getWxMchId()); //商户号 + weChatPayReqInfo.setSub_appid(SysConst.getSysConfig().getWxSubAppId()); //商户号 weChatPayReqInfo.setSub_mch_id(SysConst.getSysConfig().getWxSubMchId()); //子商户号 weChatPayReqInfo.setOpenid(openId); @@ -143,7 +144,7 @@ public class OrderController { // weChatPayReqInfo.setAttach(map.get("orderScene").toString()); //附加数据,区分订单类型 Map payMap = new HashMap<>(); - payMap.put("app_id",SysConst.getSysConfig().getWxAppId()); + payMap.put("app_id",SysConst.getSysConfig().getWxSubAppId()); payMap.put("api_key",SysConst.getSysConfig().getWxApiKey()); payMap.put("unified_order_url",SysConst.getSysConfig().getWxUnifiedOrderUrl()); SortedMap sortedMap = wechatPayUtil.goWechatPay(weChatPayReqInfo,payMap); diff --git a/hai-cweb/src/main/resources/dev/config.properties b/hai-cweb/src/main/resources/dev/config.properties index 278aa048..1f5c584b 100644 --- a/hai-cweb/src/main/resources/dev/config.properties +++ b/hai-cweb/src/main/resources/dev/config.properties @@ -6,6 +6,7 @@ wxAppSecret=d8d6dcaef77d3b659258a01b5ddba5df wxApiKey=HfkjWxPayHaiShengGuang0123456789 wxMchAppId=wx637bd6f7314daa46 wxMchId=1289663601 +wxSubAppId=wx8d49e2f83025229d wxSubMchId=1603942866 wxUnifiedOrderUrl=https://api.mch.weixin.qq.com/pay/unifiedorder diff --git a/hai-service/src/main/java/com/hai/common/pay/entity/WeChatPayReqInfo.java b/hai-service/src/main/java/com/hai/common/pay/entity/WeChatPayReqInfo.java index c36a4c13..22cd300d 100644 --- a/hai-service/src/main/java/com/hai/common/pay/entity/WeChatPayReqInfo.java +++ b/hai-service/src/main/java/com/hai/common/pay/entity/WeChatPayReqInfo.java @@ -9,6 +9,7 @@ public class WeChatPayReqInfo implements Serializable { private static final long serialVersionUID = -7642108447915413137L; private String appid; // 公众号id 必填 private String mch_id; // 商户号 必填 + private String sub_appid; // 微信支付分配的子商户号 必填 private String sub_mch_id; // 微信支付分配的子商户号 必填 private String nonce_str; // 随机字符串 必填 private String sign; // 签名 必填 @@ -210,4 +211,12 @@ public class WeChatPayReqInfo implements Serializable { public void setSub_mch_id(String sub_mch_id) { this.sub_mch_id = sub_mch_id; } + + public String getSub_appid() { + return sub_appid; + } + + public void setSub_appid(String sub_appid) { + this.sub_appid = sub_appid; + } } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java index 125dc511..5ff8c608 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java @@ -78,7 +78,8 @@ public class HighOrderServiceImpl implements HighOrderService { highCouponCodeService.updateCouponCode(list.get(0)); // 生成二维码 - String qrCodeUrl = "/home/project/hsg/filesystem/couponCode/"+DateUtil.date2String(new Date(),"yyyyMMddHHmmss")+".png"; + //String qrCodeUrl = "/home/project/hsg/filesystem/couponCode/"+DateUtil.date2String(new Date(),"yyyyMMddHHmmss")+".png"; + String qrCodeUrl = "F:\\"+DateUtil.date2String(new Date(),"yyyyMMddHHmmss")+".png"; QRCodeGenerator.generateQRCodeImage(list.get(0).getSalesCode(), 350, 350, qrCodeUrl); childOrder.setExt1(qrCodeUrl); highChildOrderMapper.updateByPrimaryKey(childOrder);