浏览代码

收款账号配置

huangzhiguo 2 年之前
父节点
当前提交
52bfabcccf

+ 7 - 0
src/main/java/com/caimei365/order/mapper/cmOfflineCollectionMapper.java

@@ -2,6 +2,7 @@ package com.caimei365.order.mapper;
 
 
 import com.caimei365.order.model.po.cmOfflineCollectionPo;
 import com.caimei365.order.model.po.cmOfflineCollectionPo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 
 
 /**
 /**
  * Description
  * Description
@@ -16,4 +17,10 @@ public interface cmOfflineCollectionMapper {
      * @return
      * @return
      */
      */
     cmOfflineCollectionPo seData();
     cmOfflineCollectionPo seData();
+
+    /**
+     * 检测银行账号是否删除
+     * @return
+     */
+    cmOfflineCollectionPo detectionAccount(@Param("bankAccount") String bankAccount);
 }
 }

+ 1 - 1
src/main/java/com/caimei365/order/model/po/cmOfflineCollectionPo.java

@@ -16,7 +16,7 @@ public class cmOfflineCollectionPo {
     private String bankAccount;    // 银行账号
     private String bankAccount;    // 银行账号
     private String bankUserName;   // 银行开户名
     private String bankUserName;   // 银行开户名
     private String bankOfDeposit;  // 开户行
     private String bankOfDeposit;  // 开户行
-    private Integer bankCardNo;    // 银行卡号
+    private String bankCardNo;    // 银行卡号
     private String creationTime;     // 创建时间
     private String creationTime;     // 创建时间
     private Integer isDisplay;     // 是否为商城显示:0不显示, 1显示
     private Integer isDisplay;     // 是否为商城显示:0不显示, 1显示
     private Integer isDisable;     // 是否禁用:0禁用,1启用
     private Integer isDisable;     // 是否禁用:0禁用,1启用

+ 27 - 0
src/main/java/com/caimei365/order/service/impl/ReceiptServiceImpl.java

@@ -61,6 +61,9 @@ public class ReceiptServiceImpl implements ReceiptService {
     @Resource
     @Resource
     private BaseMapper baseMapper;
     private BaseMapper baseMapper;
 
 
+    @Resource
+    private cmOfflineCollectionMapper collectionMapper;
+
     /**
     /**
      * 只有当识别出来的收款类型是广发银行-5461 ,中信银行-0897,中信银行0897-财付通 和 中信银行0897-支付宝时,才会显示手续费,并且自动勾选上手续费,默认按收款金额的千分之一计算 (收款金额 - 手续费 = 短信中收到的金额)
      * 只有当识别出来的收款类型是广发银行-5461 ,中信银行-0897,中信银行0897-财付通 和 中信银行0897-支付宝时,才会显示手续费,并且自动勾选上手续费,默认按收款金额的千分之一计算 (收款金额 - 手续费 = 短信中收到的金额)
      */
      */
@@ -200,6 +203,11 @@ public class ReceiptServiceImpl implements ReceiptService {
             // 短信已存在不需要识别
             // 短信已存在不需要识别
             return ResponseJson.error("短信已存在不需要重复识别", null);
             return ResponseJson.error("短信已存在不需要重复识别", null);
         }
         }
+        // 验证银行卡号是否已经被删除
+        String account = detectionAccount(smsContent);
+        if ("-1".equals(account)) {
+            return ResponseJson.error(-2,"该收款银行账号已被删除,请检查短信是否有误或联系管理员!", null);
+        }
         try {
         try {
             // 识别短信内容
             // 识别短信内容
             ResponseJson<ReceiptVo> receipt = identifyMessage(smsContent);
             ResponseJson<ReceiptVo> receipt = identifyMessage(smsContent);
@@ -210,6 +218,25 @@ public class ReceiptServiceImpl implements ReceiptService {
             log.error("【线下收款】短信识别错误!", e);
             log.error("【线下收款】短信识别错误!", e);
         }
         }
         return ResponseJson.error("短信识别错误!", null);
         return ResponseJson.error("短信识别错误!", null);
+
+    }
+
+    /**
+     * 验证银行卡号是否已经被删除
+     * @param message
+     * @return
+     */
+    private String detectionAccount(String message) {
+        if (message.length() > 10) {
+            int index = message.indexOf("尾号");
+            String account = message.substring(index + 2, index + 2 + 4);
+            cmOfflineCollectionPo collectionPo = collectionMapper.detectionAccount(account);
+            if (collectionPo.getIsDisable() == 0) {
+                return "-1";
+            }
+            return "0";
+        }
+        return "-1";
     }
     }
 
 
     /**
     /**

+ 1 - 1
src/main/resources/mapper/ReceiptMapper.xml

@@ -182,7 +182,7 @@
         WHERE user_id = #{userId}
         WHERE user_id = #{userId}
     </select>
     </select>
     <select id="getReceiptType" resultType="com.caimei365.order.model.vo.cmOfflineCollectionVo">
     <select id="getReceiptType" resultType="com.caimei365.order.model.vo.cmOfflineCollectionVo">
-        SELECT type as id, bankAccount as type FROM  cm_offline_collection ORDER BY id
+        SELECT TYPE AS id, bankAccount AS TYPE FROM  cm_offline_collection WHERE isDisable != 0 ORDER BY id
     </select>
     </select>
     <select id="getReceiptTypeById" resultType="com.caimei365.order.model.vo.ReceiptTypeVo">
     <select id="getReceiptTypeById" resultType="com.caimei365.order.model.vo.ReceiptTypeVo">
         SELECT `id`, `type`
         SELECT `id`, `type`

+ 3 - 0
src/main/resources/mapper/cmOfflineCollectionMapper.xml

@@ -5,4 +5,7 @@
         select id, type, bankAccount, bankUserName, bankOfDeposit, bankCardNo
         select id, type, bankAccount, bankUserName, bankOfDeposit, bankCardNo
         from cm_offline_collection where isDisplay = 1
         from cm_offline_collection where isDisplay = 1
     </select>
     </select>
+    <select id="detectionAccount" resultType="com.caimei365.order.model.po.cmOfflineCollectionPo">
+        SELECT * FROM cm_offline_collection WHERE bankAccount LIKE concat('%',#{bankAccount},'%')
+    </select>
 </mapper>
 </mapper>