From eab5e14c1d11b5352f3fe587fa96f9abb5595c93 Mon Sep 17 00:00:00 2001
From: Administrator <zhubaomin>
Date: 星期五, 28 六月 2024 19:54:37 +0800
Subject: [PATCH] 2024-06-28 朱宝民 充值、注销、冲正、补扣、解锁

---
 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateSv.java   |   23 +++++--
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientCardMapper.xml                              |   18 +++++-
 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateCtrl.java |  108 ++++++++++++++---------------------
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeClientCardMapper.java               |   11 +++
 4 files changed, 83 insertions(+), 77 deletions(-)

diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeClientCardMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeClientCardMapper.java
index e16cd6b..d01603c 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeClientCardMapper.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeClientCardMapper.java
@@ -124,11 +124,18 @@
     List<VoCards> getUnreplaced(Map<?, ?> params);
 
     /**
-     * 鍒ゆ柇鎸囧畾姘村崱鏄惁涓烘寕澶辩姸鎬佷笖鏃犺ˉ鍗¤褰�
+     * 鏍规嵁鎸囧畾姘村崱缂栧彿鑾峰彇鎸傚け浜嬭褰曟暟閲忥紙琛ュ崱銆佽В閿佷娇鐢級
+     * @param cardNum
+     * @return
+     */
+    Integer getLostCount(@Param("cardNum") Long cardNum);
+
+    /**
+     * 鏍规嵁鎸囧畾姘村崱缂栧彿鑾峰彇宸茶ˉ鍗℃暟閲忥紙琛ュ崱銆佽В閿佷娇鐢級
      * @param cardNum 姘村崱缂栧彿
      * @return 绗﹀悎鏉′欢璁板綍鏁帮紝鏈�澶氫竴鏉�
      */
-    Integer isLostAndUnreplaced(@Param("cardNum") Long cardNum);
+    Integer getReplacedCount(@Param("cardNum") Long cardNum);
 
     /**
      * 鏍规嵁鍐滄埛濮撳悕鍜屾墜鏈哄彿鑾峰彇姘村崱鍒楄〃璁板綍鏁帮紝搴旂敤绋嬪簭浣跨敤
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientCardMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientCardMapper.xml
index 8a2ea9f..e3164a4 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientCardMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientCardMapper.xml
@@ -435,12 +435,11 @@
     </trim>
   </select>
 
-  <!--鍒ゆ柇鎸囧畾姘村崱鏄惁涓烘寕澶辩姸鎬佷笖鏃犺ˉ鍗¤褰�-->
-  <select id="isLostAndUnreplaced" resultType="java.lang.Integer">
+  <!--鏍规嵁鎸囧畾姘村崱缂栧彿鑾峰彇鎸傚け浜嬭褰曟暟閲忥紙琛ュ崱銆佽В閿佷娇鐢級-->
+  <select id="getLostCount" resultType="java.lang.Integer">
     SELECT
         COUNT(*) AS recordCount
     FROM se_client_card card
-        INNER JOIN se_client_card card2 ON card2.original_card_id = card.cardNum
     <where>
       AND card.state = 3
       <if test = "cardNum != null and cardNum > 0">
@@ -448,6 +447,19 @@
       </if>
     </where>
   </select>
+
+  <!--鏍规嵁鎸囧畾姘村崱缂栧彿鑾峰彇宸茶ˉ鍗℃暟閲忥紙琛ュ崱銆佽В閿佷娇鐢級-->
+  <select id="getReplacedCount" resultType="java.lang.Integer">
+    SELECT
+        COUNT(*) AS recordCount
+    FROM se_client_card card
+        INNER JOIN se_client_card card2 ON card2.original_card_id = card.id
+    <where>
+      <if test = "cardNum != null and cardNum > 0">
+        AND card.cardNum = #{cardNum}
+      </if>
+    </where>
+  </select>
   <!--鏍规嵁鍐滄埛濮撳悕鍜屾墜鏈哄彿鑾峰彇姘村崱鍒楄〃璁板綍鏁帮紝搴旂敤绋嬪簭浣跨敤-->
   <select id="getCardsByClientNameAndPhoneCount" resultType="java.lang.Long">
     SELECT
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateCtrl.java
index 404e0c2..7ff5012 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateCtrl.java
@@ -38,7 +38,6 @@
 import org.springframework.web.bind.annotation.*;
 
 import java.math.BigDecimal;
-import java.time.format.DateTimeFormatter;
 import java.util.*;
 
 /**
@@ -311,15 +310,6 @@
      * @param bindingResult
      * @return
      */
-    @Operation(summary = "鍏呭��", description = "鍏呭��")
-    @ApiResponses(value = {
-            @ApiResponse(
-                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
-                    description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�",
-                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
-                            schema = @Schema(implementation = Boolean.class))}
-            )
-    })
     @PostMapping(path = "recharge", consumes = MediaType.APPLICATION_JSON_VALUE)
     @Transactional(rollbackFor = Exception.class)
     @SsoAop()
@@ -336,20 +326,10 @@
      * @param bindingResult
      * @return
      */
-    @Operation(summary = "娣诲姞娉ㄩ攢璁板綍", description = "娣诲姞娉ㄩ攢璁板綍")
-    @ApiResponses(value = {
-            @ApiResponse(
-                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
-                    description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�",
-                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
-                            schema = @Schema(implementation = Boolean.class))}
-            )
-    })
     @PostMapping(path = "cancel", consumes = MediaType.APPLICATION_JSON_VALUE)
     @Transactional(rollbackFor = Exception.class)
     @SsoAop()
     public BaseResponse<Boolean> add_cancel(@RequestBody @Valid DtoCancel po, BindingResult bindingResult){
-        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
         if(bindingResult != null && bindingResult.hasErrors()){
             return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
         }
@@ -373,10 +353,17 @@
         Long operator = po.getOperator();
         Date cancelTime = new Date();
 
+        // 濡傛灉浼犲叆鐨勬槸10浣嶇殑姘村崱缂栧彿锛屽崌涓�17浣嶆按鍗$紪鍙�
+        String cardNumS = String.valueOf(cardNum).trim();
+        if(cardNumS.length() == 10) {
+            cardNumS = "100000" + cardNumS.substring(0,6) + "0" + cardNumS.substring(6);
+        }
+        cardNum = Long.valueOf(cardNumS);
+
         // 楠岃瘉姘村崱鐘舵�佹槸鍚︽敮鎸佸綋鍓嶆搷浣�
         String stateName = Optional.ofNullable(clientCardSv.getCardStateByCardNum(cardNum)).orElse("");
         if(stateName.length() == 0 || !stateName.equals("姝e父")) {
-            return BaseResponseUtils.buildFail(stateName + ", " + SellResultCode.THE_CARD_NOT_SUPPORT_THIS_OPERATION.getMessage());
+            return BaseResponseUtils.buildErrorMsg(stateName + ", " + SellResultCode.THE_CARD_NOT_SUPPORT_THIS_OPERATION.getMessage());
         }
 
         /**
@@ -384,7 +371,7 @@
          */
         Map map = Optional.ofNullable(clientCardSv.getCardIdAndClientNum(cardNum)).orElse(new HashMap());
         if(map == null || map.size() <= 0) {
-            return BaseResponseUtils.buildFail(SellResultCode.CARD_NUMBER_MISTAKE.getMessage());
+            return BaseResponseUtils.buildErrorMsg(SellResultCode.CARD_NUMBER_MISTAKE.getMessage());
         }
         cardId = Long.parseLong(map.get("cardId").toString());
         clientId = Long.parseLong(map.get("clientId").toString());
@@ -402,7 +389,7 @@
         seClientCard.setLastoper(LastOperateENUM.CANCEL.getCode());
         Integer rec_updateClientCard = Optional.ofNullable(clientCardSv.UpdateClientCard(seClientCard)).orElse(0);
         if(rec_updateClientCard == 0) {
-            return BaseResponseUtils.buildFail(SellResultCode.CANCEL_FAIL_WRITE_CLIENT_CARD_ERROR.getMessage());
+            return BaseResponseUtils.buildErrorMsg(SellResultCode.CANCEL_FAIL_WRITE_CLIENT_CARD_ERROR.getMessage());
         }
 
         /**
@@ -421,7 +408,7 @@
 
         Long rec = Optional.ofNullable(cardOperateSv.add(seCardOperate)).orElse(0L);
         if(rec == 0) {
-            return BaseResponseUtils.buildFail(SellResultCode.CANCEL_FAIL_WRITE_CANCELL_ERROR.getMessage());
+            return BaseResponseUtils.buildErrorMsg(SellResultCode.CANCEL_FAIL_WRITE_CANCELL_ERROR.getMessage());
         }
 
         return BaseResponseUtils.buildSuccess(true) ;
@@ -529,15 +516,6 @@
      * @param bindingResult
      * @return
      */
-    @Operation(summary = "娣诲姞鍐叉璁板綍", description = "娣诲姞鍐叉璁板綍")
-    @ApiResponses(value = {
-            @ApiResponse(
-                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
-                    description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�",
-                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
-                            schema = @Schema(implementation = Boolean.class))}
-            )
-    })
     @PostMapping(path = "reversal", consumes = MediaType.APPLICATION_JSON_VALUE)
     @Transactional(rollbackFor = Exception.class)
     @SsoAop()
@@ -565,10 +543,17 @@
         Long operator = po.getOperator();
         Date reversalTime = new Date();
 
+        // 濡傛灉浼犲叆鐨勬槸10浣嶇殑姘村崱缂栧彿锛屽崌涓�17浣嶆按鍗$紪鍙�
+        String cardNumS = String.valueOf(cardNum).trim();
+        if(cardNumS.length() == 10) {
+            cardNumS = "100000" + cardNumS.substring(0,6) + "0" + cardNumS.substring(6);
+        }
+        cardNum = Long.valueOf(cardNumS);
+
         // 楠岃瘉姘村崱鐘舵�佹槸鍚︽敮鎸佸綋鍓嶆搷浣�
         String stateName = Optional.ofNullable(clientCardSv.getCardStateByCardNum(cardNum)).orElse("");
         if(stateName.length() == 0 || !stateName.equals("姝e父")) {
-            return BaseResponseUtils.buildFail(stateName + ", " + SellResultCode.THE_CARD_NOT_SUPPORT_THIS_OPERATION.getMessage());
+            return BaseResponseUtils.buildErrorMsg(stateName + ", " + SellResultCode.THE_CARD_NOT_SUPPORT_THIS_OPERATION.getMessage());
         }
 
         /**
@@ -576,7 +561,7 @@
          */
         Map map = Optional.ofNullable(clientCardSv.getCardIdAndClientNum(cardNum)).orElse(new HashMap());
         if(map == null || map.size() <= 0) {
-            return BaseResponseUtils.buildFail(SellResultCode.CARD_NUMBER_MISTAKE.getMessage());
+            return BaseResponseUtils.buildErrorMsg(SellResultCode.CARD_NUMBER_MISTAKE.getMessage());
         }
         cardId = Long.parseLong(map.get("cardId").toString());
         clientId = Long.parseLong(map.get("clientId").toString());
@@ -593,7 +578,7 @@
         seClientCard.setLastoper(LastOperateENUM.REVERSAL.getCode());
         Integer rec_updateClientCard = Optional.ofNullable(clientCardSv.UpdateClientCard(seClientCard)).orElse(0);
         if(rec_updateClientCard == 0) {
-            return BaseResponseUtils.buildFail(SellResultCode.RECHARGE_FAIL_WRITE_CLIENT_CARD_ERROR.getMessage());
+            return BaseResponseUtils.buildErrorMsg(SellResultCode.RECHARGE_FAIL_WRITE_CLIENT_CARD_ERROR.getMessage());
         }
 
         /**
@@ -610,7 +595,7 @@
         seCardOperate.setOperateDt(reversalTime);
         Long rec = Optional.ofNullable(cardOperateSv.add(seCardOperate)).orElse(0L);
         if(rec == 0) {
-            return BaseResponseUtils.buildFail(SellResultCode.REVERSAL_FAIL_WRITE_REVERSAL_ERROR.getMessage());
+            return BaseResponseUtils.buildErrorMsg(SellResultCode.REVERSAL_FAIL_WRITE_REVERSAL_ERROR.getMessage());
         }
 
         return BaseResponseUtils.buildSuccess(true) ;
@@ -622,15 +607,6 @@
      * @param bindingResult
      * @return
      */
-    @Operation(summary = "琛ユ墸", description = "琛ユ墸")
-    @ApiResponses(value = {
-            @ApiResponse(
-                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
-                    description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�",
-                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
-                            schema = @Schema(implementation = Boolean.class))}
-            )
-    })
     @PostMapping(path = "refund", consumes = MediaType.APPLICATION_JSON_VALUE)
     @Transactional(rollbackFor = Exception.class)
     @SsoAop()
@@ -658,10 +634,17 @@
         Long operator = po.getOperator();
         Date refundTime = new Date();
 
+        // 濡傛灉浼犲叆鐨勬槸10浣嶇殑姘村崱缂栧彿锛屽崌涓�17浣嶆按鍗$紪鍙�
+        String cardNumS = String.valueOf(cardNum).trim();
+        if(cardNumS.length() == 10) {
+            cardNumS = "100000" + cardNumS.substring(0,6) + "0" + cardNumS.substring(6);
+        }
+        cardNum = Long.valueOf(cardNumS);
+
         // 楠岃瘉姘村崱鐘舵�佹槸鍚︽敮鎸佸綋鍓嶆搷浣�
         String stateName = Optional.ofNullable(clientCardSv.getCardStateByCardNum(cardNum)).orElse("");
         if(stateName.length() == 0 || !stateName.equals("姝e父")) {
-            return BaseResponseUtils.buildFail(stateName + ", " + SellResultCode.THE_CARD_NOT_SUPPORT_THIS_OPERATION.getMessage());
+            return BaseResponseUtils.buildErrorMsg(stateName + ", " + SellResultCode.THE_CARD_NOT_SUPPORT_THIS_OPERATION.getMessage());
         }
 
         /**
@@ -669,7 +652,7 @@
          */
         Map map = Optional.ofNullable(clientCardSv.getCardIdAndClientNum(cardNum)).orElse(new HashMap());
         if(map == null || map.size() <= 0) {
-            return BaseResponseUtils.buildFail(SellResultCode.CARD_NUMBER_MISTAKE.getMessage());
+            return BaseResponseUtils.buildErrorMsg(SellResultCode.CARD_NUMBER_MISTAKE.getMessage());
         }
         cardId = Long.parseLong(map.get("cardId").toString());
         clientId = Long.parseLong(map.get("clientId").toString());
@@ -686,7 +669,7 @@
         seClientCard.setLastoper(LastOperateENUM.REFUND.getCode());
         Integer rec_updateClientCard = Optional.ofNullable(clientCardSv.UpdateClientCard(seClientCard)).orElse(0);
         if(rec_updateClientCard == 0) {
-            return BaseResponseUtils.buildFail(SellResultCode.RECHARGE_FAIL_WRITE_CLIENT_CARD_ERROR.getMessage());
+            return BaseResponseUtils.buildErrorMsg(SellResultCode.RECHARGE_FAIL_WRITE_CLIENT_CARD_ERROR.getMessage());
         }
 
         /**
@@ -704,7 +687,7 @@
         seCardOperate.setOperateDt(refundTime);
         Long rec = Optional.ofNullable(cardOperateSv.add(seCardOperate)).orElse(0L);
         if(rec == 0) {
-            return BaseResponseUtils.buildFail(SellResultCode.REFUND_FAIL_WRITE_REFUND_ERROR.getMessage());
+            return BaseResponseUtils.buildErrorMsg(SellResultCode.REFUND_FAIL_WRITE_REFUND_ERROR.getMessage());
         }
 
         return BaseResponseUtils.buildSuccess(true) ;
@@ -716,20 +699,10 @@
      * @param bindingResult
      * @return
      */
-    @Operation(summary = "娣诲姞瑙i攣璁板綍", description = "娣诲姞瑙i攣璁板綍")
-    @ApiResponses(value = {
-            @ApiResponse(
-                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
-                    description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�",
-                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
-                            schema = @Schema(implementation = Boolean.class))}
-            )
-    })
     @PostMapping(path = "unlock", consumes = MediaType.APPLICATION_JSON_VALUE)
     @Transactional(rollbackFor = Exception.class)
     @SsoAop()
     public BaseResponse<Boolean> add_unlock(@RequestBody @Valid DtoUnlock po, BindingResult bindingResult){
-        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
         if(bindingResult != null && bindingResult.hasErrors()){
             return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
         }
@@ -751,9 +724,16 @@
         Long operator = po.getOperator();
         Date unlockTime = new Date();
 
+        // 濡傛灉浼犲叆鐨勬槸10浣嶇殑姘村崱缂栧彿锛屽崌涓�17浣嶆按鍗$紪鍙�
+        String cardNumS = String.valueOf(cardNum).trim();
+        if(cardNumS.length() == 10) {
+            cardNumS = "100000" + cardNumS.substring(0,6) + "0" + cardNumS.substring(6);
+        }
+        cardNum = Long.valueOf(cardNumS);
+
         // 鍒ゆ柇褰撳墠姘村崱鏄惁涓烘寕澶辩姸鎬佷笖鏈ˉ鍗★紝浠呭凡缁忔寕澶卞叾鏈ˉ鍗$殑鍙互瑙i攣
         if(!cardOperateSv.isLostAndUnreplaced(cardNum)) {
-            return BaseResponseUtils.buildFail(SellResultCode.THE_CARD_NOT_SUPPORT_THIS_OPERATION.getMessage());
+            return BaseResponseUtils.buildErrorMsg(SellResultCode.THE_CARD_NOT_SUPPORT_THIS_OPERATION.getMessage());
         }
 
         /**
@@ -761,7 +741,7 @@
          */
         Map map = Optional.ofNullable(clientCardSv.getCardIdAndClientNum(cardNum)).orElse(new HashMap());
         if(map == null || map.size() <= 0) {
-            return BaseResponseUtils.buildFail(SellResultCode.CARD_NUMBER_MISTAKE.getMessage());
+            return BaseResponseUtils.buildErrorMsg(SellResultCode.CARD_NUMBER_MISTAKE.getMessage());
         }
         cardId = Long.parseLong(map.get("cardId").toString());
         clientId = Long.parseLong(map.get("clientId").toString());
@@ -779,7 +759,7 @@
         seClientCard.setLastoper(LastOperateENUM.UNLOCK.getCode());
         Integer rec_updateClientCard = Optional.ofNullable(clientCardSv.UpdateClientCard(seClientCard)).orElse(0);
         if(rec_updateClientCard == 0) {
-            return BaseResponseUtils.buildFail(SellResultCode.UNLOCK_FAIL_WRITE_CLIENT_CARD_ERROR.getMessage());
+            return BaseResponseUtils.buildErrorMsg(SellResultCode.UNLOCK_FAIL_WRITE_CLIENT_CARD_ERROR.getMessage());
         }
 
         /**
@@ -795,7 +775,7 @@
         seCardOperate.setOperateDt(unlockTime);
         Long rec = Optional.ofNullable(cardOperateSv.add(seCardOperate)).orElse(0L);
         if(rec == 0) {
-            return BaseResponseUtils.buildFail(SellResultCode.UNLOCK_FAIL_WRITE_UNLOCK_ERROR.getMessage());
+            return BaseResponseUtils.buildErrorMsg(SellResultCode.UNLOCK_FAIL_WRITE_UNLOCK_ERROR.getMessage());
         }
 
         return BaseResponseUtils.buildSuccess(true) ;
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateSv.java
index c2635f3..180bfe9 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateSv.java
@@ -150,11 +150,17 @@
         Long operator = po.getOperator();
         Date rechargeTime = new Date();
 
+        // 濡傛灉浼犲叆鐨勬槸10浣嶇殑姘村崱缂栧彿锛屽崌涓�17浣嶆按鍗$紪鍙�
+        String cardNumS = String.valueOf(cardNum).trim();
+        if(cardNumS.length() == 10) {
+            cardNumS = "100000" + cardNumS.substring(0,6) + "0" + cardNumS.substring(6);
+        }
+        cardNum = Long.valueOf(cardNumS);
 
         // 楠岃瘉姘村崱鐘舵�佹槸鍚︽敮鎸佸綋鍓嶆搷浣�
         String stateName = Optional.ofNullable(clientCardSv.getCardStateByCardNum(cardNum)).orElse("");
         if(stateName.length() == 0 || !stateName.equals("姝e父")) {
-            return BaseResponseUtils.buildFail(stateName + ", " + SellResultCode.THE_CARD_NOT_SUPPORT_THIS_OPERATION.getMessage());
+            return BaseResponseUtils.buildErrorMsg(stateName + ", " + SellResultCode.THE_CARD_NOT_SUPPORT_THIS_OPERATION.getMessage());
         }
 
         /**
@@ -162,7 +168,7 @@
          */
         Map map = Optional.ofNullable(clientCardSv.getCardIdAndClientNum(cardNum)).orElse(new HashMap());
         if(map == null || map.size() <= 0) {
-            return BaseResponseUtils.buildFail(SellResultCode.CARD_NUMBER_MISTAKE.getMessage());
+            return BaseResponseUtils.buildErrorMsg(SellResultCode.CARD_NUMBER_MISTAKE.getMessage());
         }
         cardId = Long.parseLong(map.get("cardId").toString());
         clientId = Long.parseLong(map.get("clientId").toString());
@@ -179,7 +185,7 @@
         seClientCard.setLastoper(LastOperateENUM.RECHARGE.getCode ());
         Integer rec_updateClientCard = Optional.ofNullable(clientCardSv.UpdateClientCard(seClientCard)).orElse(0);
         if(rec_updateClientCard == 0) {
-            return BaseResponseUtils.buildFail(SellResultCode.RECHARGE_FAIL_WRITE_CLIENT_CARD_ERROR.getMessage());
+            return BaseResponseUtils.buildErrorMsg(SellResultCode.RECHARGE_FAIL_WRITE_CLIENT_CARD_ERROR.getMessage());
         }
 
         /**
@@ -201,7 +207,7 @@
         seCardOperateMapper.insert(seCardOperate);
         Long rec = Optional.ofNullable(seCardOperate.getId()).orElse(0L);
         if(rec == 0) {
-            return BaseResponseUtils.buildFail(SellResultCode.REPLACE_FAIL_WRITE_RECHARGE_ERROR.getMessage());
+            return BaseResponseUtils.buildErrorMsg(SellResultCode.REPLACE_FAIL_WRITE_RECHARGE_ERROR.getMessage());
         }
 
         return BaseResponseUtils.buildSuccess(true) ;
@@ -430,11 +436,12 @@
      * @return 鏄惁宸叉寕澶辨湭琛ュ崱
      */
     public Boolean isLostAndUnreplaced(Long cardNum) {
-        Integer rec = seClientCardMapper.isLostAndUnreplaced(cardNum);
-        if(rec != null && rec > 0) {
-            return false;
+        Integer lostCount = seClientCardMapper.getLostCount(cardNum);
+        Integer replacedCount = seClientCardMapper.getReplacedCount(cardNum);
+        if(lostCount > 0 && replacedCount == 0) {
+            return true;
         }
-        return true;
+        return false;
     }
 
     /**

--
Gitblit v1.8.0