Browse Source

Merge branch 'master' of hyq/cuspay into master

project 7 years ago
parent
commit
b1401a9d16

+ 46 - 0
src/main/java/com/emato/cuspay/common/msg/RequestMessage.java

@@ -0,0 +1,46 @@
+package com.emato.cuspay.common.msg;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @author huangyq
+ * @version 1.0
+ * 2018-05-18 14:52
+ */
+public class RequestMessage implements Serializable {
+    private static final long serialVersionUID = -3044821399294307105L;
+
+    //状态码
+    private String code;
+
+    private String msg;
+    //业务数据
+    private Object data;
+
+
+    public Object getData() {
+        return data;
+    }
+
+    public void setData(Object data) {
+        this.data = data;
+    }
+
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+}

+ 4 - 0
src/main/java/com/emato/cuspay/dao/mapper/merch/MerchCusCfgMapper.java

@@ -4,6 +4,8 @@ package com.emato.cuspay.dao.mapper.merch;
 import com.emato.cuspay.dto.merch.MerchCusCfg;
 import org.springframework.stereotype.Component;
 
+import java.util.List;
+
 @Component
 public interface MerchCusCfgMapper {
 
@@ -14,4 +16,6 @@ public interface MerchCusCfgMapper {
     MerchCusCfg selectByPrimaryKey(String cusCfgSn);
 
     int updateByPrimaryKeySelective(MerchCusCfg record);
+
+    List<MerchCusCfg> getMerchCusCfgByMerchSn(String merchSn);
 }

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

@@ -84,12 +84,22 @@ public class WxCbPayDoc implements Serializable {
 
     private String exField5;
 
+    private String platNo;
+
     private static final long serialVersionUID = 1L;
 
     public WxCbPayDoc() {
         super();
     }
 
+    public String getPlatNo() {
+        return platNo;
+    }
+
+    public void setPlatNo(String platNo) {
+        this.platNo = platNo == null ? null : platNo.trim();
+    }
+
     public String getWxPaySn() {
         return wxPaySn;
     }

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

@@ -23,7 +23,7 @@ public class MerchPaymentServiceImpl implements MerchPaymentService{
     private MerchPayCfgMapper merchPayCfgMapper;
 
     public ResponseMessage addMerchPayCfg(MerchPayCfg merchPayCfg) {
-        merchPayCfg.setMerchSn(TablePrimaryKeyPrefix.merch_pay_cfg_type + IdWorkerAide.nextId());
+        merchPayCfg.setPayCfgSn(TablePrimaryKeyPrefix.merch_pay_cfg_type + IdWorkerAide.nextId());
         int result = merchPayCfgMapper.insertSelective(merchPayCfg);
         if (result > 0) {
             return ResponseMessage.builder(ResponseStatus.SUCCESS.getItem(), "添加成功").build();

+ 1 - 9
src/main/java/com/emato/cuspay/service/wx/CusPayService.java

@@ -3,14 +3,13 @@ package com.emato.cuspay.service.wx;
 import com.emato.cuspay.dto.wx.WxCbPayDoc;
 import com.emato.cuspay.support.msg.resp.ResponseMessage;
 import org.springframework.stereotype.Component;
-import org.springframework.stereotype.Service;
 
 /**
  * @author zx
  * @version 1.0
  * 2018-05-15 09:36
  */
-@Service
+@Component
 public interface CusPayService {
 
     /**
@@ -24,11 +23,4 @@ public interface CusPayService {
      */
     void notifyMecher();
 
-    /**
-     * 微信支付单入库
-     * @param wxCbPayDoc 微信支付单证
-     * @return
-     */
-    ResponseMessage addWxCbPayDoc(WxCbPayDoc wxCbPayDoc);
-
 }

+ 20 - 0
src/main/java/com/emato/cuspay/service/wx/WxCbPayDocService.java

@@ -0,0 +1,20 @@
+package com.emato.cuspay.service.wx;
+
+import com.emato.cuspay.dto.wx.WxCbPayDoc;
+import com.emato.cuspay.support.msg.resp.ResponseMessage;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author huangyq
+ * @version 1.0
+ * 2018-05-18 16:05
+ */
+@Component
+public interface WxCbPayDocService {
+    /**
+     * 微信支付单入库
+     * @param wxCbPayDoc 微信支付单证
+     * @return
+     */
+    ResponseMessage addWxCbPayDoc(WxCbPayDoc wxCbPayDoc);
+}

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

@@ -15,6 +15,7 @@ import com.emato.cuspay.service.wx.CusPayService;
 import com.emato.cuspay.support.msg.resp.ResponseMessage;
 import com.emato.cuspay.support.msg.resp.ResponseStatus;
 import com.emato.cuspay.util.XmlUtils;
+import com.emato.cuspay.util.jackson.JacksonUtil;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import org.apache.commons.codec.digest.DigestUtils;
@@ -38,17 +39,13 @@ import javax.xml.bind.JAXB;
 import java.io.IOException;
 import java.io.StringReader;
 import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.SortedMap;
+import java.util.*;
 
 /**
  * @author zengjun
  * @version 1.0
  * 2018-05-15 10:18
  */
-
 @Service
 public class CustomServiceImpl implements CusPayService {
     private static final Logger logger = LoggerFactory.getLogger(CusPayService.class);
@@ -79,9 +76,6 @@ public class CustomServiceImpl implements CusPayService {
     private WxPayErrorMapper wxPayErrorMapper;
 
     @Autowired
-    private MerchCusCfgMapper merchCusCfgMapper;
-
-    @Autowired
     private MerchPayCfgMapper merchPayCfgMapper;
 
     /**
@@ -139,9 +133,6 @@ public class CustomServiceImpl implements CusPayService {
                                 FAIL.equals(wxResponseMsg.getReturnCode())) {
                         //设置申报状态为失败
                         wxCbPayDoc.setDocStatus(Dict.PaymentDocStatus.i_03.getItem());
-//                        //设置通知商户
-//                        wxCbPayDoc.setNotifyMerch(Dict.Whether.Yes.getItem());
-                        wxCbPayDocMapper.updateByPrimaryKeySelective(wxCbPayDoc);
                     }
 
                     //返回这状态码为成功 业务结果成功
@@ -151,37 +142,26 @@ public class CustomServiceImpl implements CusPayService {
                         //返回状态未申报
                         if (Dict.ResponseMsgState.UNDECLARED.getItem().equals(wxResponseMsg.getState())) {
                             wxCbPayDoc.setDocStatus(Dict.PaymentDocStatus.i_01.getItem());
-//                            wxCbPayDoc.setNotifyMerch(Dict.Whether.Yes.getItem());
-                            wxCbPayDocMapper.updateByPrimaryKeySelective(wxCbPayDoc);
                         }
                         //申报中
                         if (Dict.ResponseMsgState.PROCESSING.getItem().equals(wxResponseMsg.getState())) {
                             wxCbPayDoc.setDocStatus(Dict.PaymentDocStatus.i_22.getItem());
-                            wxCbPayDocMapper.updateByPrimaryKeySelective(wxCbPayDoc);
                         }
                         //申报已提交
                         if (Dict.ResponseMsgState.SUBMITTED.getItem().equals(wxResponseMsg.getState())) {
                             wxCbPayDoc.setDocStatus(Dict.PaymentDocStatus.i_10.getItem());
-//                            wxCbPayDoc.setNotifyMerch(Dict.Whether.Yes.getItem());
-                            wxCbPayDocMapper.updateByPrimaryKeySelective(wxCbPayDoc);
                         }
                         //申报成功
                         if (Dict.ResponseMsgState.SUCCESS.getItem().equals(wxResponseMsg.getState())) {
                             wxCbPayDoc.setDocStatus(Dict.PaymentDocStatus.i_11.getItem());
-//                            wxCbPayDoc.setNotifyMerch(Dict.Whether.Yes.getItem());
-                            wxCbPayDocMapper.updateByPrimaryKeySelective(wxCbPayDoc);
                         }
                         //申报失败
                         if (Dict.ResponseMsgState.FAIL.getItem().equals(wxResponseMsg.getState())) {
                             wxCbPayDoc.setDocStatus(Dict.PaymentDocStatus.i_03.getItem());
-//                            wxCbPayDoc.setNotifyMerch(Dict.Whether.Yes.getItem());
-                            wxCbPayDocMapper.updateByPrimaryKeySelective(wxCbPayDoc);
                         }
                         //海关接口异常
                         if (Dict.ResponseMsgState.EXCEPT.getItem().equals(wxResponseMsg.getState())) {
                             wxCbPayDoc.setDocStatus(Dict.PaymentDocStatus.i_03.getItem());
-//                            wxCbPayDoc.setNotifyMerch(Dict.Whether.Yes.getItem());
-                            wxCbPayDocMapper.updateByPrimaryKeySelective(wxCbPayDoc);
                         }
                     }
 
@@ -192,9 +172,8 @@ public class CustomServiceImpl implements CusPayService {
                         wxCbPayDoc.setErrCodeDes(wxResponseMsg.getErrCodeDes());
                         wxCbPayDoc.setDocStatus(Dict.PaymentDocStatus.i_12.getItem());
                         //业务失败 通知商户
-//                        wxCbPayDoc.setNotifyMerch(Dict.Whether.Yes.getItem());
-                        wxCbPayDocMapper.updateByPrimaryKeySelective(wxCbPayDoc);
                     }
+                    wxCbPayDocMapper.updateByPrimaryKeySelective(wxCbPayDoc);
                 } else {
                     throw new IOException("request url:["+declareURL+"] response code:"+ status);
                 }
@@ -286,29 +265,6 @@ public class CustomServiceImpl implements CusPayService {
     }
 
     /**
-     * 支付单信息入库
-     * @param wxCbPayDoc 微信支付单证
-     * @return
-     */
-    public ResponseMessage addWxCbPayDoc(WxCbPayDoc wxCbPayDoc) {
-        wxCbPayDoc.setWxPaySn(TablePrimaryKeyPrefix.wx_cb_pay_type + IdWorkerAide.nextId());
-        //设置支付单状态 待审核
-        wxCbPayDoc.setDocStatus(Dict.PaymentDocStatus.i_00.getItem());
-
-        int result = wxCbPayDocMapper.insertSelective(wxCbPayDoc);
-        if (result > 0) {
-            return new ResponseMessage.Builder()
-                    .setCode(ResponseStatus.SUCCESS.getItem())
-                    .setMsg("入库成功")
-                    .build();
-        }
-        return  new ResponseMessage.Builder()
-                .setCode(ResponseStatus.ERROR.getItem())
-                .setMsg("入库失败")
-                .build();
-    }
-
-    /**
      * 支付单状态改变 异步通知商户
      */
     public void notifyMecher() {

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

@@ -0,0 +1,62 @@
+package com.emato.cuspay.service.wx.impl;
+
+import com.emato.cuspay.common.contant.Dict;
+import com.emato.cuspay.common.contant.TablePrimaryKeyPrefix;
+import com.emato.cuspay.common.core.db.IdWorkerAide;
+import com.emato.cuspay.dao.mapper.merch.MerchCusCfgMapper;
+import com.emato.cuspay.dao.mapper.merch.MerchPayCfgMapper;
+import com.emato.cuspay.dao.mapper.wx.WxCbPayDocMapper;
+import com.emato.cuspay.dto.merch.MerchCusCfg;
+import com.emato.cuspay.dto.wx.WxCbPayDoc;
+import com.emato.cuspay.service.wx.WxCbPayDocService;
+import com.emato.cuspay.support.msg.resp.ResponseMessage;
+import com.emato.cuspay.support.msg.resp.ResponseStatus;
+import com.emato.cuspay.util.jackson.JacksonUtil;
+import com.google.common.base.Strings;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * @author huangyq
+ * @version 1.0
+ * 2018-05-18 16:05
+ */
+@Service
+public class WxCbPayDocServiceImpl implements WxCbPayDocService{
+    @Autowired
+    private WxCbPayDocMapper wxCbPayDocMapper;
+
+    @Autowired
+    private MerchPayCfgMapper merchPayCfgMapper;
+
+    /**
+     * 支付单信息入库
+     * @param wxCbPayDoc 微信支付单证
+     * @return
+     */
+    public ResponseMessage addWxCbPayDoc(WxCbPayDoc wxCbPayDoc) {
+        wxCbPayDoc.setWxPaySn(TablePrimaryKeyPrefix.wx_cb_pay_type + IdWorkerAide.nextId());
+        //设置支付单状态 待审核
+        wxCbPayDoc.setDocStatus(Dict.PaymentDocStatus.i_00.getItem());
+        String merchSn = wxCbPayDoc.getMerchSn();
+
+        if(merchPayCfgMapper.selectByWxMercherSn(merchSn) == null){
+            return  new ResponseMessage.Builder().setCode(ResponseStatus.ERROR.getItem()).setMsg("商户编号为"+merchSn+"的支付配置信息不存在")
+                    .build();
+        }
+
+        int result = wxCbPayDocMapper.insertSelective(wxCbPayDoc);
+        if (result > 0) {
+            HashMap<String,String> resultMap = new HashMap<>();
+            resultMap.put("docStatus", Dict.PaymentDocStatus.i_00.getItemName());
+
+            return new ResponseMessage.Builder().setCode(ResponseStatus.SUCCESS.getItem()).setMsg("入库成功")
+                    .setData(JacksonUtil.toJson(resultMap)).build();
+        }
+        return  new ResponseMessage.Builder().setCode(ResponseStatus.ERROR.getItem()).setMsg("入库失败")
+                .build();
+    }
+}

+ 14 - 12
src/main/java/com/emato/cuspay/support/msg/resp/ResponseMessage.java

@@ -1,7 +1,9 @@
 package com.emato.cuspay.support.msg.resp;
 
 import com.google.common.base.Strings;
+import com.google.common.collect.Lists;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
@@ -27,7 +29,7 @@ public class ResponseMessage {
     /**
      * 回执业务数据
      */
-    private ResponseMessageData data;
+    private Object data;
 
     private ResponseMessage() {
     }
@@ -40,7 +42,7 @@ public class ResponseMessage {
         return msg;
     }
 
-    public ResponseMessageData getData() {
+    public Object getData() {
         return data;
     }
 
@@ -167,54 +169,54 @@ public class ResponseMessage {
     public static class Builder {
         private String code;
         private String msg;
-        private ResponseMessageData data;
+        private Object data;
 
         public Builder() {
             this.code = ResponseStatus.SUCCESS.getItem();
             this.msg = ResponseStatus.SUCCESS.getItemName();
-            this.data = ResponseMessageData.builder().build();
+            this.data = Lists.newArrayList();
         }
 
         public Builder(String code, String msg) {
             this.code = Strings.isNullOrEmpty(code) ? ResponseStatus.SUCCESS.getItem() : code;
             this.msg = Strings.isNullOrEmpty(msg) ? ResponseStatus.SUCCESS.getItemName() : msg;
-            this.data = ResponseMessageData.builder().build();
+            this.data = Lists.newArrayList();
         }
 
         public Builder(String code, String msg, ResponseMessageData responseMessageData) {
             this.code = Strings.isNullOrEmpty(code) ? ResponseStatus.SUCCESS.getItem() : code;
             this.msg = Strings.isNullOrEmpty(msg) ? ResponseStatus.SUCCESS.getItemName() : msg;
-            this.data = responseMessageData;
+            this.data = Lists.newArrayList();
         }
 
         public Builder(String code, String msg, Map map) {
             this.code = Strings.isNullOrEmpty(code) ? ResponseStatus.SUCCESS.getItem() : code;
             this.msg = Strings.isNullOrEmpty(msg) ? ResponseStatus.SUCCESS.getItemName() : msg;
-            this.data = ResponseMessageData.builder(map, Map.class).build();
+            this.data = Lists.newArrayList();
         }
 
         public Builder(String code, String msg, List rows) {
             this.code = Strings.isNullOrEmpty(code) ? ResponseStatus.SUCCESS.getItem() : code;
             this.msg = Strings.isNullOrEmpty(msg) ? ResponseStatus.SUCCESS.getItemName() : msg;
-            this.data = ResponseMessageData.builder(rows).build();
+            this.data = Lists.newArrayList();
         }
 
         public <T> Builder(T t, Class<T> type) {
             this.code = ResponseStatus.SUCCESS.getItem();
             this.msg = ResponseStatus.SUCCESS.getItemName();
-            this.data = ResponseMessageData.builder(t, type).build();
+            this.data = Lists.newArrayList();
         }
 
         public <T> Builder(String msg, T t, Class<T> type) {
             this.code = ResponseStatus.SUCCESS.getItem();
             this.msg = Strings.isNullOrEmpty(msg) ? ResponseStatus.SUCCESS.getItemName() : msg;
-            this.data = ResponseMessageData.builder(t, type).build();
+            this.data = Lists.newArrayList();
         }
 
         public <T> Builder(String code, String msg, T t, Class<T> type) {
             this.code = Strings.isNullOrEmpty(code) ? ResponseStatus.SUCCESS.getItem() : code;
             this.msg = Strings.isNullOrEmpty(msg) ? ResponseStatus.SUCCESS.getItemName() : msg;
-            this.data = ResponseMessageData.builder(t, type).build();
+            this.data = Lists.newArrayList();
         }
 
         public Builder setCode(String code) {
@@ -227,7 +229,7 @@ public class ResponseMessage {
             return this;
         }
 
-        public Builder setData(ResponseMessageData data) {
+        public Builder setData(Object data) {
             this.data = data;
             return this;
         }

+ 15 - 0
src/main/java/com/emato/cuspay/util/Validator.java

@@ -5,6 +5,9 @@ import com.emato.cuspay.support.msg.resp.ResponseStatus;
 import org.apache.commons.lang3.StringUtils;
 
 import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
 
 /**
  * @author zx
@@ -54,4 +57,16 @@ public abstract class Validator {
                     .setCode(ResponseStatus.SUCCESS.getItem())
                     .build();
     }
+
+    /**
+     * 验证身份证号
+     * 大陆是18位
+     * 香港是15位
+     */
+    public static boolean isCardNo(String str)throws PatternSyntaxException {
+        String regExp = "^[1-9]\\d{5}(18|19|([23]\\d))\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$|(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{2}$)";
+        Pattern p = Pattern.compile(regExp);
+        Matcher m = p.matcher(str);
+        return m.matches();
+    }
 }

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

@@ -40,9 +40,8 @@ public class MerchPaymentController {
         Map<String, Object> beVerified = Maps.newHashMap();
 
         beVerified.put("merchSn", "商户编号");
-        beVerified.put("appKey","api密钥");
+        beVerified.put("merchWxApiKey","api密钥");
         beVerified.put("notifyUrl","商户通知回调接口");
-        beVerified.put("sign","签名");
         beVerified.put("payChnlFlag", "支付通道标识(weixin:微信,alipay:蚂蚁金服)");
 
         ResponseMessage rst = Validator.isEmpty(beVerified, validate);

+ 29 - 5
src/main/java/com/emato/cuspay/web/controller/wx/WxCusController.java

@@ -1,20 +1,25 @@
 package com.emato.cuspay.web.controller.wx;
 
+import com.emato.cuspay.common.msg.RequestMessage;
 import com.emato.cuspay.dto.wx.WxCbPayDoc;
 import com.emato.cuspay.service.wx.CusPayService;
+import com.emato.cuspay.service.wx.WxCbPayDocService;
 import com.emato.cuspay.support.msg.resp.ResponseMessage;
 import com.emato.cuspay.support.msg.resp.ResponseStatus;
 import com.emato.cuspay.util.MapBeanUtils;
 import com.emato.cuspay.util.Validator;
 import com.emato.cuspay.util.jackson.JacksonUtil;
+import com.fasterxml.jackson.core.type.TypeReference;
 import com.google.common.base.Strings;
 import com.google.common.collect.Maps;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.StringUtils;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -29,7 +34,7 @@ public class WxCusController {
     private static final Logger logger = LoggerFactory.getLogger(WxCusController.class);
 
     @Autowired
-    private CusPayService customService;
+    private WxCbPayDocService wxCbPayDocService;
 
     /**
      *
@@ -50,17 +55,30 @@ public class WxCusController {
      * @return
      */
     @RequestMapping(value = "/wxcbpay", method = RequestMethod.POST)
-    public ResponseMessage addWxCbPayDoc(HttpServletRequest request) {
+    public ResponseMessage addWxCbPayDoc(HttpServletRequest request ) {
         logger.info("支付单信息入库接口请求开始");
         String result = request.getParameter("result");
         // 检查参数是否齐全
         if (Strings.isNullOrEmpty(result)) {
-            return  new ResponseMessage.Builder().setCode(ResponseStatus.ERROR.getItem()).setMsg("缺少业务数据").build();
+            return  new ResponseMessage.Builder().setCode(ResponseStatus.ERROR.getItem()).setMsg("result不能为空").build();
         }
         logger.info("支付单信息入库接口请求数据:【{}】",result);
 
         //解析数据
-        WxCbPayDoc wxCbPayDoc = JacksonUtil.fromStringJson(result, WxCbPayDoc.class);
+        RequestMessage requestMessage = JacksonUtil.fromStringJson(result, RequestMessage.class);
+        List<WxCbPayDoc> list = null;
+        if(requestMessage != null){
+            list = (List<WxCbPayDoc>) requestMessage.getData();
+            if(list.size() == 0){
+                return  new ResponseMessage.Builder().setCode(ResponseStatus.ERROR.getItem()).setMsg("缺少业务数据").build();
+            }
+        }
+        List<WxCbPayDoc> wxCbPayDocList = JacksonUtil.fromListJson(JacksonUtil.toJson(list), new TypeReference<List<WxCbPayDoc>>(){});
+        WxCbPayDoc wxCbPayDoc = null;
+        if (wxCbPayDocList != null && wxCbPayDocList.size() > 0){
+            wxCbPayDoc = wxCbPayDocList.get(0);
+        }
+
         //数据校验
         Map<String, Object> validate = MapBeanUtils.fromObject(wxCbPayDoc);
         Map<String, Object> beVerified = Maps.newHashMap();
@@ -75,12 +93,18 @@ public class WxCusController {
         beVerified.put("transactionId","微信支付订单号");
         beVerified.put("customs","报送海关");
         beVerified.put("mchCustomsNo","商户海关备案号");
+        beVerified.put("platNo","接入平台内部编号");
 
         ResponseMessage rst = Validator.isEmpty(beVerified, validate);
         if (ResponseStatus.ERROR.getItem().equals(rst.getCode())) {
             return  rst;
         }
 
-        return customService.addWxCbPayDoc(wxCbPayDoc);
+        //身份证如不为空则校验身份证格式是否正确
+        if(StringUtils.hasText(wxCbPayDoc.getCertId()) && !Validator.isCardNo(wxCbPayDoc.getCertId())){
+            return  new ResponseMessage.Builder().setCode(ResponseStatus.ERROR.getItem()).setMsg("身份证格式不正确,请填写正确的号码!").build();
+        }
+
+        return wxCbPayDocService.addWxCbPayDoc(wxCbPayDoc);
     }
 }

+ 7 - 0
src/main/resources/mybatis/mapper/MerchCusCfgMapper.xml

@@ -129,4 +129,11 @@
     </set>
     where cus_cfg_sn = #{cusCfgSn,jdbcType=VARCHAR}
   </update>
+
+  <select id="getMerchCusCfgByMerchSn" resultMap="BaseResultMap" parameterType="java.lang.String" >
+    select
+    <include refid="Base_Column_List" />
+    from merch_cus_cfg
+    where merch_sn = #{merchSn,jdbcType=VARCHAR}
+  </select>
 </mapper>

+ 15 - 5
src/main/resources/mybatis/mapper/MerchPayCfgMapper.xml

@@ -4,6 +4,7 @@
   <resultMap id="BaseResultMap" type="com.emato.cuspay.dto.merch.MerchPayCfg" >
     <id column="pay_cfg_sn" property="payCfgSn" jdbcType="VARCHAR" />
     <result column="merch_sn" property="merchSn" 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" />
     <result column="is_valid" property="isValid" jdbcType="CHAR" />
@@ -15,12 +16,12 @@
     <result column="tstm" property="tstm" jdbcType="TIMESTAMP" />
   </resultMap>
   <sql id="Base_Column_List" >
-    pay_cfg_sn, merch_sn,  notify_url, pay_chnl_flag, is_valid, remark, creater_sn, create_time, moder_sn,
+    pay_cfg_sn, merch_sn, merch_wx_api_key, notify_url, pay_chnl_flag, is_valid, remark, creater_sn, create_time, moder_sn,
     mod_time, tstm
   </sql>
 
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
-    select 
+    select
     <include refid="Base_Column_List" />
     from merch_pay_cfg
     where pay_cfg_sn = #{payCfgSn,jdbcType=VARCHAR}
@@ -38,6 +39,9 @@
       <if test="merchSn != null" >
         merch_sn,
       </if>
+      <if test="merchWxApiKey != null" >
+        merch_wx_api_key,
+      </if>
       <if test="notifyUrl != null">
         notify_url,
       </if>
@@ -73,6 +77,9 @@
       <if test="merchSn != null" >
         #{merchSn,jdbcType=VARCHAR},
       </if>
+      <if test="merchWxApiKey != null" >
+        #{merchWxApiKey,jdbcType=VARCHAR},
+      </if>
       <if test="notifyUrl != null">
         #{notifyUrl,jdbcType=VARCHAR},
       </if>
@@ -108,6 +115,9 @@
       <if test="merchSn != null" >
         merch_sn = #{merchSn,jdbcType=VARCHAR},
       </if>
+      <if test="merchWxApiKey != null" >
+        merch_wx_api_key = #{merchWxApiKey,jdbcType=VARCHAR},
+      </if>
       <if test="notify_url != null">
         notify_url = #{notifyUrl, jdbcType=VARCHAR},
       </if>
@@ -140,8 +150,8 @@
   </update>
 
   <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"
+    SELECT
+    <include refid="Base_Column_List" />
+    FROM merch_pay_cfg WHERE merch_sn = #{merchSn} AND pay_chnl_flag = "weixin"
   </select>
 </mapper>

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

@@ -42,9 +42,10 @@
     <result column="ex_field3" property="exField3" jdbcType="VARCHAR" />
     <result column="ex_field4" property="exField4" jdbcType="VARCHAR" />
     <result column="ex_field5" property="exField5" jdbcType="VARCHAR" />
+    <result column="plat_no" property="platNo" jdbcType="VARCHAR" />
   </resultMap>
   <sql id="Base_Column_List" >
-    wx_pay_sn, merch_sn, merch_name, plat_sn, plat_name, third_party_merch_code, third_party_merch_name, 
+    wx_pay_sn, merch_sn, merch_name, plat_no, 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,
     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,
@@ -75,6 +76,9 @@
       <if test="merchName != null" >
         merch_name,
       </if>
+      <if test="platNo != null" >
+        plat_no,
+      </if>
       <if test="platSn != null" >
         plat_sn,
       </if>
@@ -197,6 +201,9 @@
       <if test="merchName != null" >
         #{merchName,jdbcType=VARCHAR},
       </if>
+      <if test="platNo != null" >
+        #{platNo,jdbcType=VARCHAR},
+      </if>
       <if test="platSn != null" >
         #{platSn,jdbcType=VARCHAR},
       </if>
@@ -320,6 +327,9 @@
       <if test="merchName != null" >
         merch_name = #{merchName,jdbcType=VARCHAR},
       </if>
+      <if test="platNo != null" >
+        plat_no = #{platNo,jdbcType=VARCHAR},
+      </if>
       <if test="platSn != null" >
         plat_sn = #{platSn,jdbcType=VARCHAR},
       </if>
@@ -455,6 +465,7 @@
       wx_pay_sn,
       merch_sn,
       merch_name,
+      plat_no,
       plat_sn,
       plat_name,
       third_party_merch_code,
@@ -498,6 +509,7 @@
           #{wxPaySn,jdbcType=VARCHAR},
           #{merchSn,jdbcType=VARCHAR},
           #{merchName,jdbcType=VARCHAR},
+          #{platNo,jdbcType=VARCHAR}
           #{platSn,jdbcType=VARCHAR},
           #{platName,jdbcType=VARCHAR},
           #{thirdPartyMerchCode,jdbcType=VARCHAR},