Forráskód Böngészése

Merge branch 'master' of http://git.ds-bay.com/project/cuspay

csk 6 éve
szülő
commit
a5f50cd25c

+ 2 - 1
src/main/java/com/emato/cuspay/biz/merch/MerchantNoticeBiz.java

@@ -119,9 +119,10 @@ public class MerchantNoticeBiz implements CuspayBiz{
         request.put("msg",noti.getMsg());
         request.put("cusDeclStatus", noti.getCusDeclStatus());
         request.put("thirdPartyMerchCode",noti.getThirdPartyMerchCode());
-        request.put("thirdPartyMerchName()",noti.getThirdPartyMerchName());
+        request.put("thirdPartyMerchName",noti.getThirdPartyMerchName());
         request.put("platNo", noti.getPlatSn());
         request.put("platName", noti.getPlatName());
+        request.put("merchOrderSn",noti.getAllSubOrderId());
 
         ResponseMessage responseMessage = new ResponseMessage.Builder()
                 .setCode(ResponseStatus.SUCCESS.getItem())

+ 1 - 1
src/main/java/com/emato/cuspay/biz/wx/AbstractCusDeclareBiz.java

@@ -33,7 +33,7 @@ public abstract class AbstractCusDeclareBiz implements CuspayBiz {
         List<MerchPayCfg> list = this.paymentService.loadMerchPayCfg();
         if (list != null && !list.isEmpty()) {
             list.forEach(cfg ->{
-                payCaches.put(cfg.getMerchSn(), cfg);
+                payCaches.put(cfg.getAppid(), cfg);
             });
         }
     }

+ 9 - 7
src/main/java/com/emato/cuspay/biz/wx/WxCusDeclareBiz.java

@@ -124,7 +124,7 @@ public class WxCusDeclareBiz extends AbstractCusDeclareBiz implements CuspayBiz
         wxCbPayDocList.forEach(wxCbPayDoc -> {
 
             //获取商户信息 从缓存中去  缓存不存在 从数据库重取
-            MerchPayCfg merchPayCfg = getMerchPayCfgCache(wxCbPayDoc.getMerchSn());
+            MerchPayCfg merchPayCfg = getMerchPayCfgCache(wxCbPayDoc.getAppid());
 
             MerchNotiBuilder builder = new MerchNotiBuilder();
 
@@ -135,17 +135,17 @@ public class WxCusDeclareBiz extends AbstractCusDeclareBiz implements CuspayBiz
 
             if (merchPayCfg == null) {
                 wxCbPayDoc.setReturnCode("FAIL");
-                wxCbPayDoc.setReturnMsg("商户编号为【"+wxCbPayDoc.getMerchSn()+"】的商户支付配置信息不存在");
+                wxCbPayDoc.setReturnMsg("appid为【"+wxCbPayDoc.getAppid()+"】的商户支付配置信息不存在");
                 wxCbPayDocService.updateWxCbPay(wxCbPayDoc);
-                logger.error("商户编号为【"+wxCbPayDoc.getMerchSn()+"】的商户支付配置信息不存在");
+                logger.error("appid为【"+wxCbPayDoc.getAppid()+"】的商户支付配置信息不存在");
                 return;
             }
 
             if (merchPayCfg.getMerchWxApiKey() == null) {
                 wxCbPayDoc.setReturnCode(WxContants.ERROR_NO_INFOMATION);
-                wxCbPayDoc.setReturnMsg("商户编号为【"+wxCbPayDoc.getMerchSn()+"】的商户支付信息api密钥为空");
+                wxCbPayDoc.setReturnMsg("appid为【"+wxCbPayDoc.getAppid()+"】的商户支付信息api密钥为空");
                 wxCbPayDocService.updateWxCbPay(wxCbPayDoc);
-                logger.error("商户编号为【"+wxCbPayDoc.getMerchSn()+"】的商户支付信息api密钥为空");
+                logger.error("appid为【"+wxCbPayDoc.getAppid()+"】的商户支付信息api密钥为空");
                 return;
             }
             //设置商户配置信息
@@ -179,10 +179,12 @@ public class WxCusDeclareBiz extends AbstractCusDeclareBiz implements CuspayBiz
                 wxCbPayDoc.setResultCode(wxResponseMsgDto.getResultCode());
                 wxCbPayDoc.setReturnCode(wxResponseMsgDto.getReturnCode());
                 wxCbPayDoc.setReturnMsg(wxResponseMsgDto.getReturnMsg());
-
                 //返回这状态码为成功 业务结果成功
                 if (WxContants.SUCCESS.equals(wxResponseMsgDto.getReturnCode())) {
                     if (WxContants.SUCCESS.equals(wxResponseMsgDto.getResultCode())) {
+                        wxCbPayDoc.setSubOrderNo(wxResponseMsgDto.getSubOrderNo());
+                        wxCbPayDoc.setSubOrderId(wxResponseMsgDto.getSubOrderId());
+
                         //订购人与支付人校验结果
                         if (!StringUtils.isEmpty(wxResponseMsgDto.getCertCheckResult())) {
                             if ("UNCHECKED".equals(wxResponseMsgDto.getCertCheckResult())) { //未知
@@ -351,7 +353,7 @@ public class WxCusDeclareBiz extends AbstractCusDeclareBiz implements CuspayBiz
             sorted.put("action_type", wxCbPayDoc.getActionType());
         }
         if (wxCbPayDoc.getSubOrderNo() != null && !wxCbPayDoc.getSubOrderNo().isEmpty()) {
-            sorted.put("sub_order_no", wxCbPayDoc.getActionType());
+            sorted.put("sub_order_no", wxCbPayDoc.getSubOrderNo());
         }
         if (wxCbPayDoc.getFeeType() != null && !wxCbPayDoc.getFeeType().isEmpty()) {
             sorted.put("fee_type", wxCbPayDoc.getFeeType());

+ 49 - 34
src/main/java/com/emato/cuspay/biz/wx/WxCusDeclareQueryBiz.java

@@ -98,7 +98,7 @@ public class WxCusDeclareQueryBiz extends AbstractCusDeclareBiz implements Cuspa
         wxCbPayDocs.forEach(wxCbPayDoc -> {
             WxQuerySuccessResponseMsgDto querySuccessResponseDto = new WxQuerySuccessResponseMsgDto();
             //获取商户信息 从缓存中去  缓存不存在 从数据库重取
-            MerchPayCfg merchPayCfg = getMerchPayCfgCache(wxCbPayDoc.getMerchSn());
+            MerchPayCfg merchPayCfg = getMerchPayCfgCache(wxCbPayDoc.getAppid());
 
             MerchNotiBuilder builder = new MerchNotiBuilder();
 
@@ -109,17 +109,17 @@ public class WxCusDeclareQueryBiz extends AbstractCusDeclareBiz implements Cuspa
 
             if (merchPayCfg == null) {
                 wxCbPayDoc.setReturnCode("FAIL");
-                wxCbPayDoc.setReturnMsg("商户编号为【"+wxCbPayDoc.getMerchSn()+"】的商户支付配置信息不存在");
+                wxCbPayDoc.setReturnMsg("appid为【"+wxCbPayDoc.getAppid()+"】的商户支付配置信息不存在");
                 wxCbPayDocService.updateWxCbPay(wxCbPayDoc);
-                logger.error("商户编号为【"+wxCbPayDoc.getMerchSn()+"】的商户支付配置信息不存在 ");
+                logger.error("appid为【"+wxCbPayDoc.getAppid()+"】的商户支付配置信息不存在 ");
                 return;
             }
 
             if (merchPayCfg.getMerchWxApiKey() == null) {
                 wxCbPayDoc.setReturnCode(WxContants.ERROR_NO_INFOMATION);
-                wxCbPayDoc.setReturnMsg("商户编号为【"+wxCbPayDoc.getMerchSn()+"】的商户支付信息api密钥为空");
+                wxCbPayDoc.setReturnMsg("appid为【"+wxCbPayDoc.getAppid()+"】的商户支付信息api密钥为空");
                 wxCbPayDocService.updateWxCbPay(wxCbPayDoc);
-                logger.error("商户编号为【"+wxCbPayDoc.getMerchSn()+"】的商户支付信息api密钥为空 ");
+                logger.error("appid为【"+wxCbPayDoc.getAppid()+"】的商户支付信息api密钥为空 ");
                 return;
             }
             //设置商户配置信息
@@ -149,6 +149,8 @@ public class WxCusDeclareQueryBiz extends AbstractCusDeclareBiz implements Cuspa
                 errorList.add(wxPayError);
             }
             MerchNoti merchNoti = new MerchNoti();
+            String allSubOrderId = "";
+            String allSubOrderNo = "";
             try {
                 //返回状态码为成功
                 if(WxContants.SUCCESS.equals(wxQueryResponseMsg.getReturnCode())){
@@ -184,6 +186,7 @@ public class WxCusDeclareQueryBiz extends AbstractCusDeclareBiz implements Cuspa
                             //解析xml获取WxQuerySuccessResponseMsgDto
                             querySuccessResponseDto = ReaderXmlForDOM4J.parse(result, i);
                             wxCbPayDoc.setSubOrderNo(querySuccessResponseDto.getSubOrderNo());
+                            wxCbPayDoc.setSubOrderId(querySuccessResponseDto.getSubOrderId());
                             wxCbPayDoc.setMchCustomsNo(querySuccessResponseDto.getMchCustomsNo());
                             wxCbPayDoc.setCustoms(querySuccessResponseDto.getCustoms());
                             wxCbPayDoc.setFeeType(querySuccessResponseDto.getFeeType());
@@ -191,6 +194,8 @@ public class WxCusDeclareQueryBiz extends AbstractCusDeclareBiz implements Cuspa
                             wxCbPayDoc.setDuty(querySuccessResponseDto.getDuty());
                             wxCbPayDoc.setTransportFee(querySuccessResponseDto.getTransportFee());
                             wxCbPayDoc.setProductFee(querySuccessResponseDto.getProductFee());
+                            allSubOrderId = querySuccessResponseDto.getSubOrderId();
+                            allSubOrderNo = querySuccessResponseDto.getSubOrderNo();
 
                             String state = querySuccessResponseDto.getState();
 
@@ -232,6 +237,14 @@ public class WxCusDeclareQueryBiz extends AbstractCusDeclareBiz implements Cuspa
                                         .cusDeclStatus(WxDict.MerchNoticeStatus.i_13.getItem())
                                         .build();
                             }
+                            wxCbPayDocService.updateWxCbPay(wxCbPayDoc);
+
+                            MerchNoti noti = new MerchNoti();
+                            noti.setCode(wxQueryResponseMsg.getErrCode());
+                            noti.setAllPayNo(wxQueryResponseMsg.getTransactionId());
+                            noti.setCusDeclStatus(merchNoti.getCusDeclStatus());
+                            noti.setAllSubOrderNo(allSubOrderNo);
+                            updateMerchNoti(noti,allSubOrderId,merchNoti);//更新商户通知
                         }
                     }else{//业务状态码失败
                         wxCbPayDoc.setErrCode(wxQueryResponseMsg.getErrCode());
@@ -242,6 +255,14 @@ public class WxCusDeclareQueryBiz extends AbstractCusDeclareBiz implements Cuspa
                                 .msg(wxQueryResponseMsg.getErrCodeDes())
                                 .cusDeclStatus(WxDict.MerchNoticeStatus.i_13.getItem())
                                 .build();
+                        wxCbPayDocService.updateWxCbPay(wxCbPayDoc);
+
+                        MerchNoti noti = new MerchNoti();
+                        noti.setCode(wxQueryResponseMsg.getErrCode());
+                        noti.setAllPayNo(wxQueryResponseMsg.getTransactionId());
+                        noti.setCusDeclStatus(merchNoti.getCusDeclStatus());
+                        noti.setAllSubOrderNo(allSubOrderNo);
+                        updateMerchNoti(noti,allSubOrderId,merchNoti);//更新商户通知
                     }
                 }
                 ///返回状态码为失败
@@ -253,40 +274,19 @@ public class WxCusDeclareQueryBiz extends AbstractCusDeclareBiz implements Cuspa
                             .msg(wxQueryResponseMsg.getReturnMsg())
                             .cusDeclStatus(WxDict.MerchNoticeStatus.i_13.getItem())
                             .build();
+                    wxCbPayDocService.updateWxCbPay(wxCbPayDoc);
+
+                    MerchNoti noti = new MerchNoti();
+                    noti.setCode(wxQueryResponseMsg.getErrCode());
+                    noti.setAllPayNo(wxQueryResponseMsg.getTransactionId());
+                    noti.setCusDeclStatus(merchNoti.getCusDeclStatus());
+                    noti.setAllSubOrderNo(allSubOrderNo);
+                    updateMerchNoti(noti,allSubOrderId,merchNoti);//更新商户通知
                 }
-
-                wxCbPayDocService.updateWxCbPay(wxCbPayDoc);
             } catch (Exception e) {
                 logger.error("更新支付单证入库信息状态异常", e);
                 return;
             }
-
-            List<MerchNoti> mchNotiList = null;
-            try {
-                MerchNoti noti = new MerchNoti();
-                noti.setCode(wxQueryResponseMsg.getErrCode());
-                noti.setAllPayNo(wxQueryResponseMsg.getTransactionId());
-                noti.setCusDeclStatus(merchNoti.getCusDeclStatus());
-                mchNotiList = merchNotiService.getMerchNotiByCodeAndOrderNo(noti);
-            } catch (Exception e) {
-                logger.error("根据code查询商户通知信息异常", e);
-                return;
-            }
-
-            try {
-                if(mchNotiList != null && mchNotiList.size() > 0){
-                    MerchNoti noti = mchNotiList.get(0);
-                    noti.setTstm(new Date());
-                    merchNotiService.update(noti);
-                }else{
-                    merchNotiService.insert(merchNoti);
-                }
-            } catch (Exception e) {
-                logger.error("操作商户通知数据异常", e);
-                WxPayError wxPayError = createWxPayError(wxCbPayDoc, querySuccessResponseDto);
-                wxPayError.setErrMsg("操作商户通知数据异常");
-                errorList.add(wxPayError);
-            }
         });
         //存储异常记录
         try {
@@ -303,6 +303,18 @@ public class WxCusDeclareQueryBiz extends AbstractCusDeclareBiz implements Cuspa
         }
 
     }
+    private void updateMerchNoti(MerchNoti noti,String allSubOrderId,MerchNoti merchNoti){
+        List<MerchNoti> merchNotiList = merchNotiService.getMerchNotiByCodeAndOrderNo(noti);
+        if(merchNotiList != null && merchNotiList.size()>0){
+            MerchNoti merchNoti1 = merchNotiList.get(0);
+            merchNoti1.setTstm(new Date());
+            merchNoti1.setAllSubOrderId(allSubOrderId);
+            merchNotiService.update(merchNoti1);
+        }else{
+            merchNoti.setNotiSn(TablePrimaryKeyPrefix.merch_pay_noti_type + IdWorkerAide.nextId());
+            merchNotiService.insert(merchNoti);
+        }
+    }
     /**
      * 记录异常的支付单证信息
      * @param wxCbPayDoc
@@ -341,6 +353,9 @@ public class WxCusDeclareQueryBiz extends AbstractCusDeclareBiz implements Cuspa
         sorted.put("mch_id", wxCbPayDoc.getMchId());
         sorted.put("out_trade_no", wxCbPayDoc.getOutTradeNo());
         sorted.put("transaction_id", wxCbPayDoc.getTransactionId());
+        if(org.apache.commons.lang3.StringUtils.isNotEmpty(wxCbPayDoc.getSubOrderNo())) {
+            sorted.put("sub_order_no", wxCbPayDoc.getSubOrderNo());
+        }
         sorted.put("customs", wxCbPayDoc.getCustoms());
 
         //2.生成签名

+ 10 - 0
src/main/java/com/emato/cuspay/entity/merch/MerchNoti.java

@@ -61,12 +61,22 @@ public class MerchNoti implements Serializable {
 
     private String merchErpOrderSn;
 
+    private String allSubOrderId;
+
     private static final long serialVersionUID = 1L;
 
     public MerchNoti() {
         super();
     }
 
+    public String getAllSubOrderId() {
+        return allSubOrderId;
+    }
+
+    public void setAllSubOrderId(String allSubOrderId) {
+        this.allSubOrderId = allSubOrderId;
+    }
+
     public String getNotiSn() {
         return notiSn;
     }

+ 5 - 5
src/main/java/com/emato/cuspay/entity/merch/MerchPayCfg.java

@@ -6,7 +6,7 @@ import java.util.Date;
 public class MerchPayCfg implements Serializable {
     private String payCfgSn;
 
-    private String merchSn;
+    private String appid;
 
     private String merchWxApiKey;
 
@@ -42,12 +42,12 @@ public class MerchPayCfg implements Serializable {
         this.payCfgSn = payCfgSn == null ? null : payCfgSn.trim();
     }
 
-    public String getMerchSn() {
-        return merchSn;
+    public String getAppid() {
+        return appid;
     }
 
-    public void setMerchSn(String merchSn) {
-        this.merchSn = merchSn == null ? null : merchSn.trim();
+    public void setAppid(String appid) {
+        this.appid = appid == null ? null : appid.trim();
     }
 
     public String getMerchWxApiKey() {

+ 2 - 2
src/main/java/com/emato/cuspay/service/impl/MerchPaymentServiceImpl.java

@@ -36,10 +36,10 @@ public class MerchPaymentServiceImpl implements MerchPaymentService {
 
         try {
             MerchPayCfg payCfg = new MerchPayCfg();
-            payCfg.setMerchSn(merchPayCfg.getMerchSn());
+            payCfg.setAppid(merchPayCfg.getAppid());
             payCfg.setPayChnlFlag(merchPayCfg.getPayChnlFlag());
             if(merchPayCfgMapper.getMerchPayCfgByMerchsnAndChnlFlag(payCfg) != null){
-                return  new ResponseMessage.Builder().setCode(ResponseStatus.ERROR.getItem()).setMsg("商户编号为"+merchPayCfg.getMerchSn()+"的支付配置信息已存在")
+                return  new ResponseMessage.Builder().setCode(ResponseStatus.ERROR.getItem()).setMsg("appid为"+merchPayCfg.getAppid()+"的支付配置信息已存在")
                         .build();
             }
         } catch (Exception e) {

+ 1 - 1
src/main/java/com/emato/cuspay/web/controller/merch/MerchPaymentController.java

@@ -39,7 +39,7 @@ public class MerchPaymentController {
         Map<String, Object> validate = MapBeanUtils.fromObject(merchPayCfg);
         Map<String, Object> beVerified = Maps.newHashMap();
 
-        beVerified.put("merchSn", "商户编号");
+        beVerified.put("appid", "appid");
         beVerified.put("merchWxApiKey","api密钥");
         beVerified.put("notifyUrl","商户通知回调接口");
         beVerified.put("payChnlFlag", "支付通道标识(weixin:微信,alipay:蚂蚁金服)");

+ 1 - 0
src/main/java/com/emato/cuspay/wx/common/MerchNotiBuilder.java

@@ -45,6 +45,7 @@ public class MerchNotiBuilder {
         this.merchNoti.setAllOrderNo(wxCbPay.getOutTradeNo());
         this.merchNoti.setAllPayNo(wxCbPay.getTransactionId());
         this.merchNoti.setAllSubOrderNo(wxCbPay.getSubOrderNo());
+        this.merchNoti.setAllSubOrderId(wxCbPay.getSubOrderId());
         this.merchNoti.setCreaterSn("1");
         this.merchNoti.setCreateTime(sdf.format(new Date()));
         return this;

+ 10 - 0
src/main/java/com/emato/cuspay/wx/entity/WxCbPayDoc.java

@@ -88,12 +88,22 @@ public class WxCbPayDoc implements Serializable {
 
     private String buyerPayerCheck;
 
+    private String subOrderId;
+
     private static final long serialVersionUID = 1L;
 
     public WxCbPayDoc() {
         super();
     }
 
+    public String getSubOrderId() {
+        return subOrderId;
+    }
+
+    public void setSubOrderId(String subOrderId) {
+        this.subOrderId = subOrderId;
+    }
+
     public String getBuyerPayerCheck() {
         return buyerPayerCheck;
     }

+ 3 - 3
src/main/java/com/emato/cuspay/wx/service/impl/WxCbPayDocServiceImpl.java

@@ -44,11 +44,11 @@ public class WxCbPayDocServiceImpl implements WxCbPayDocService {
         wxCbPayDoc.setWxPaySn(TablePrimaryKeyPrefix.wx_cb_pay_type + IdWorkerAide.nextId());
         //设置支付单状态 待审核
         wxCbPayDoc.setDocStatus(WxDict.PaymentDocStatus.i_00.getItem());
-        String merchSn = wxCbPayDoc.getMerchSn();
+        String appid = wxCbPayDoc.getAppid();
         try {
-            List<MerchPayCfg> merchPayCfgList = merchPayCfgMapper.getMerchPayCfgByMerchsn(merchSn);
+            List<MerchPayCfg> merchPayCfgList = merchPayCfgMapper.getMerchPayCfgByMerchsn(appid);
             if(merchPayCfgList.size() == 0){
-                return  new ResponseMessage.Builder().setCode(ResponseStatus.ERROR.getItem()).setMsg("商户编号为"+merchSn+"的支付配置信息不存在")
+                return  new ResponseMessage.Builder().setCode(ResponseStatus.ERROR.getItem()).setMsg("appid为" + appid + "的支付配置信息不存在")
                         .build();
             }
         } catch (Exception e) {

+ 2 - 2
src/main/resources/application-dev.yml

@@ -31,8 +31,8 @@ spring:
             type: com.zaxxer.hikari.HikariDataSource
             driver-class-name: org.mariadb.jdbc.Driver
             url: jdbc:mysql://120.76.84.45:3306/cuspay?useSSL=false&useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull
-            username: ceshi
-            password: abc-123
+            username: tuser
+            password: Qq!123
             # hikari连接池配置
             hikari:
                 connection-timeout: 10000

+ 2 - 2
src/main/resources/application-test.yml

@@ -31,8 +31,8 @@ spring:
             type: com.zaxxer.hikari.HikariDataSource
             driver-class-name: org.mariadb.jdbc.Driver
             url: jdbc:mysql://192.168.1.251:3306/cuspay?useSSL=false&useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull
-            username: ceshi
-            password: abc-123
+            username: tuser
+            password: Qq!123
             # hikari连接池配置
             hikari:
                 connection-timeout: 10000

+ 2 - 2
src/main/resources/application.yml

@@ -8,7 +8,7 @@ app:
 
 # 服务配置
 server:
-    address: 120.76.26.84
+    address: 172.18.68.117
     port: 9999
     servlet:
       context-path: /
@@ -35,7 +35,7 @@ spring:
             driver-class-name: org.mariadb.jdbc.Driver
             url: jdbc:mysql://rm-wz9rps8173a1nx63g819.mysql.rds.aliyuncs.com:3306/cuspay?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true
             username: qh_cus
-            password: Ci*&k89Cf
+            password: #nbJVH*W7p
             # hikari连接池配置
             hikari:
                 connection-timeout: 10000

+ 19 - 1
src/main/resources/mybatis/mapper/MerchNotiMapper.xml

@@ -15,6 +15,7 @@
     <result column="all_order_no" property="allOrderNo" jdbcType="VARCHAR" />
     <result column="all_pay_no" property="allPayNo" jdbcType="VARCHAR" />
     <result column="all_sub_order_no" property="allSubOrderNo" jdbcType="VARCHAR" />
+    <result column="all_sub_order_id" property="allSubOrderId" jdbcType="VARCHAR" />
     <result column="pay_chnl_flag" property="payChnlFlag" jdbcType="VARCHAR" />
     <result column="buyer_payer_check" property="buyerPayerCheck" jdbcType="CHAR" />
     <result column="noti_count" property="notiCount" jdbcType="INTEGER" />
@@ -34,7 +35,7 @@
   <sql id="Base_Column_List" >
     noti_sn, all_pay_sn, merch_sn, merch_name, merch_erp_order_sn, plat_sn, plat_name,
     third_party_merch_code, third_party_merch_name, all_merch_id, all_order_no, all_pay_no,
-    all_sub_order_no, pay_chnl_flag, buyer_payer_check, noti_count, is_stoped, cus_decl_status,
+    all_sub_order_no, all_sub_order_id, pay_chnl_flag, buyer_payer_check, noti_count, is_stoped, cus_decl_status,
     noti_statue, code, msg, notify_url, remark, creater_sn, create_time, moder_sn, mod_time,
     tstm
   </sql>
@@ -49,6 +50,9 @@
     <include refid="Base_Column_List" />
     from merch_noti
     where code = #{code,jdbcType=VARCHAR} and all_pay_no = #{allPayNo,jdbcType=VARCHAR} and cus_decl_status = #{cusDeclStatus,jdbcType=VARCHAR}
+    <if test="allSubOrderNo != null" >
+      and all_sub_order_no = #{allSubOrderNo}
+    </if>
   </select>
 
   <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
@@ -98,6 +102,9 @@
       <if test="allSubOrderNo != null" >
         all_sub_order_no,
       </if>
+      <if test="allSubOrderId != null" >
+        all_sub_order_id,
+      </if>
       <if test="payChnlFlag != null" >
         pay_chnl_flag,
       </if>
@@ -184,6 +191,9 @@
       <if test="allSubOrderNo != null" >
         #{allSubOrderNo,jdbcType=VARCHAR},
       </if>
+      <if test="allSubOrderId != null" >
+        #{allSubOrderId,jdbcType=VARCHAR},
+      </if>
       <if test="payChnlFlag != null" >
         #{payChnlFlag,jdbcType=VARCHAR},
       </if>
@@ -270,6 +280,9 @@
       <if test="allSubOrderNo != null" >
         all_sub_order_no = #{allSubOrderNo,jdbcType=VARCHAR},
       </if>
+      <if test="allSubOrderId != null" >
+        all_sub_order_id = #{allSubOrderId,jdbcType=VARCHAR},
+      </if>
       <if test="payChnlFlag != null" >
         pay_chnl_flag = #{payChnlFlag,jdbcType=VARCHAR},
       </if>
@@ -341,6 +354,7 @@
         all_order_no,
         all_pay_no,
         all_sub_order_no,
+        all_sub_order_id,
         pay_chnl_flag,
         buyer_payer_check,
         noti_count,
@@ -372,6 +386,7 @@
           #{item.allOrderNo,jdbcType=VARCHAR},
           #{item.allPayNo,jdbcType=VARCHAR},
           #{item.allSubOrderNo,jdbcType=VARCHAR},
+          #{item.allSubOrderId,jdbcType=VARCHAR},
           #{item.payChnlFlag,jdbcType=VARCHAR},
           #{item.buyerPayerCheck,jdbcType=CHAR},
           #{item.notiCount,jdbcType=INTEGER},
@@ -429,6 +444,9 @@
         <if test="item.allSubOrderNo != null" >
           all_sub_order_no = #{item.allSubOrderNo,jdbcType=VARCHAR},
         </if>
+        <if test="item.allSubOrderId != null" >
+          all_sub_order_id = #{item.allSubOrderId,jdbcType=VARCHAR},
+        </if>
         <if test="item.payChnlFlag != null" >
           pay_chnl_flag = #{item.payChnlFlag,jdbcType=VARCHAR},
         </if>

+ 12 - 12
src/main/resources/mybatis/mapper/MerchPayCfgMapper.xml

@@ -3,7 +3,7 @@
 <mapper namespace="com.emato.cuspay.dao.mapper.merch.MerchPayCfgMapper" >
   <resultMap id="BaseResultMap" type="com.emato.cuspay.entity.merch.MerchPayCfg" >
     <id column="pay_cfg_sn" property="payCfgSn" jdbcType="VARCHAR" />
-    <result column="merch_sn" property="merchSn" jdbcType="VARCHAR" />
+    <result column="appid" property="appid" jdbcType="VARCHAR" />
     <result column="merch_wx_api_key" property="merchWxApiKey" jdbcType="VARCHAR" />
     <result column="notify_url" property="notifyUrl" jdbcType="VARCHAR" />
     <result column="pay_chnl_flag" property="payChnlFlag" jdbcType="VARCHAR" />
@@ -16,7 +16,7 @@
     <result column="tstm" property="tstm" jdbcType="TIMESTAMP" />
   </resultMap>
   <sql id="Base_Column_List" >
-    pay_cfg_sn, merch_sn, merch_wx_api_key, notify_url, pay_chnl_flag, is_valid, remark, creater_sn, create_time, moder_sn,
+    pay_cfg_sn, appid, merch_wx_api_key, notify_url, pay_chnl_flag, is_valid, remark, creater_sn, create_time, moder_sn,
     mod_time, tstm
   </sql>
 
@@ -36,8 +36,8 @@
       <if test="payCfgSn != null" >
         pay_cfg_sn,
       </if>
-      <if test="merchSn != null" >
-        merch_sn,
+      <if test="appid != null" >
+        appid,
       </if>
       <if test="merchWxApiKey != null" >
         merch_wx_api_key,
@@ -74,8 +74,8 @@
       <if test="payCfgSn != null" >
         #{payCfgSn,jdbcType=VARCHAR},
       </if>
-      <if test="merchSn != null" >
-        #{merchSn,jdbcType=VARCHAR},
+      <if test="appid != null" >
+        #{appid,jdbcType=VARCHAR},
       </if>
       <if test="merchWxApiKey != null" >
         #{merchWxApiKey,jdbcType=VARCHAR},
@@ -112,8 +112,8 @@
   <update id="updateByPrimaryKeySelective" parameterType="com.emato.cuspay.entity.merch.MerchPayCfg" >
     update merch_pay_cfg
     <set >
-      <if test="merchSn != null" >
-        merch_sn = #{merchSn,jdbcType=VARCHAR},
+      <if test="appid != null" >
+        appid = #{appid,jdbcType=VARCHAR},
       </if>
       <if test="merchWxApiKey != null" >
         merch_wx_api_key = #{merchWxApiKey,jdbcType=VARCHAR},
@@ -152,24 +152,24 @@
   <select id="selectByWxMercherSn" resultMap="BaseResultMap" parameterType="java.lang.String">
     SELECT
     <include refid="Base_Column_List" />
-    FROM merch_pay_cfg WHERE merch_sn = #{merchSn} AND pay_chnl_flag = "weixin"
+    FROM merch_pay_cfg WHERE appid = #{appid} AND pay_chnl_flag = "weixin"
   </select>
 
   <select id="selectMerchPayCfg" resultMap="BaseResultMap">
     SELECT 
-    <include refid="Base_Column_List"/>
+    *
     FROM merch_pay_cfg
   </select>
 
   <select id="getMerchPayCfgByMerchsnAndChnlFlag" resultMap="BaseResultMap" parameterType="com.emato.cuspay.entity.merch.MerchPayCfg">
     SELECT
     <include refid="Base_Column_List" />
-    FROM merch_pay_cfg WHERE merch_sn = #{merchSn} AND pay_chnl_flag = #{payChnlFlag}
+    FROM merch_pay_cfg WHERE appid = #{appid} AND pay_chnl_flag = #{payChnlFlag}
   </select>
 
   <select id="getMerchPayCfgByMerchsn" resultMap="BaseResultMap" parameterType="java.lang.String">
     SELECT
     <include refid="Base_Column_List" />
-    FROM merch_pay_cfg WHERE merch_sn = #{merchSn}
+    FROM merch_pay_cfg WHERE appid = #{appid}
   </select>
 </mapper>

+ 16 - 1
src/main/resources/mybatis/mapper/wx/WxCbPayDocMapper.xml

@@ -12,6 +12,7 @@
     <result column="appid" property="appid" jdbcType="VARCHAR" />
     <result column="mch_id" property="mchId" jdbcType="VARCHAR" />
     <result column="out_trade_no" property="outTradeNo" jdbcType="VARCHAR" />
+    <result column="sub_order_id" property="subOrderId" jdbcType="VARCHAR" />
     <result column="transaction_id" property="transactionId" jdbcType="VARCHAR" />
     <result column="customs" property="customs" jdbcType="VARCHAR" />
     <result column="mch_customs_no" property="mchCustomsNo" jdbcType="VARCHAR" />
@@ -47,7 +48,7 @@
   </resultMap>
   <sql id="Base_Column_List" >
     wx_pay_sn, merch_sn, merch_name, merch_erp_order_sn, plat_sn, plat_name, third_party_merch_code, third_party_merch_name,
-    appid, mch_id, out_trade_no, transaction_id, customs, mch_customs_no, duty, action_type,
+    appid, mch_id, out_trade_no, sub_order_id, transaction_id, customs, mch_customs_no, duty, action_type,
     sub_order_no, fee_type, order_fee, transport_fee, product_fee, cert_type, cert_id, 
     name, doc_status, remark, return_code, return_msg, result_code, err_code, err_code_des,
     creater_sn, create_time, moder_sn, mod_time, tstm, ex_field, ex_field2, ex_field3, 
@@ -104,6 +105,9 @@
       <if test="outTradeNo != null" >
         out_trade_no,
       </if>
+      <if test="subOrderId != null" >
+        sub_order_id,
+      </if>
       <if test="transactionId != null" >
         transaction_id,
       </if>
@@ -229,6 +233,9 @@
       <if test="outTradeNo != null" >
         #{outTradeNo,jdbcType=VARCHAR},
       </if>
+      <if test="subOrderId != null" >
+        #{subOrderId,jdbcType=VARCHAR},
+      </if>
       <if test="transactionId != null" >
         #{transactionId,jdbcType=VARCHAR},
       </if>
@@ -358,6 +365,9 @@
       <if test="outTradeNo != null" >
         out_trade_no = #{outTradeNo,jdbcType=VARCHAR},
       </if>
+      <if test="subOrderId != null" >
+        sub_order_id = #{subOrderId,jdbcType=VARCHAR},
+      </if>
       <if test="transactionId != null" >
         transaction_id = #{transactionId,jdbcType=VARCHAR},
       </if>
@@ -475,6 +485,7 @@
       appid,
       mch_id,
       out_trade_no,
+      sub_order_id,
       transaction_id,
       customs,
       mch_customs_no,
@@ -519,6 +530,7 @@
           #{appid,jdbcType=VARCHAR},
           #{mchId,jdbcType=VARCHAR},
           #{outTradeNo,jdbcType=VARCHAR},
+          #{subOrderId,jdbcType=VARCHAR},
           #{transactionId,jdbcType=VARCHAR},
           #{customs,jdbcType=VARCHAR},
           #{mchCustomsNo,jdbcType=VARCHAR},
@@ -589,6 +601,9 @@
         <if test="item.outTradeNo != null" >
           out_trade_no = #{item.outTradeNo,jdbcType=VARCHAR},
         </if>
+        <if test="item.subOrderId != null" >
+          sub_order_id = #{item.subOrderId,jdbcType=VARCHAR},
+        </if>
         <if test="item.transactionId != null" >
           transaction_id = #{item.transactionId,jdbcType=VARCHAR},
         </if>