From 371591d64d37a57e2866e6f0729cf7054b8744ba Mon Sep 17 00:00:00 2001
From: Administrator <zhubaomin>
Date: 星期四, 25 一月 2024 14:29:58 +0800
Subject: [PATCH] 2024-01-25 朱宝民 总账生成功能、总账审核功能

---
 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/activeCard/ActiveCardCtrl.java |   93 ++++++++++++++++++++++++++++++++--------------
 1 files changed, 65 insertions(+), 28 deletions(-)

diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/activeCard/ActiveCardCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/activeCard/ActiveCardCtrl.java
index 68de44c..e31783a 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/activeCard/ActiveCardCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/activeCard/ActiveCardCtrl.java
@@ -7,8 +7,9 @@
 import com.dy.common.webUtil.ResultCodeMsg;
 import com.dy.pipIrrGlobal.pojoSe.SeActiveCard;
 import com.dy.pipIrrGlobal.pojoSe.SeClientCard;
-import com.dy.pipIrrGlobal.voBa.VoAreaCode;
+import com.dy.pipIrrGlobal.util.Constant;
 import com.dy.pipIrrGlobal.voSe.VoActiveCard;
+import com.dy.pipIrrSell.cardOperate.enums.OperateTypeENUM;
 import com.dy.pipIrrSell.clientCard.CardStateENUM;
 import com.dy.pipIrrSell.clientCard.ClientCardSv;
 import com.dy.pipIrrSell.clientCard.LastOperateENUM;
@@ -16,7 +17,6 @@
 import com.dy.pipIrrSell.recharge.RechargeCtrl;
 import com.dy.pipIrrSell.result.SellResultCode;
 import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.Parameter;
 import io.swagger.v3.oas.annotations.media.Content;
 import io.swagger.v3.oas.annotations.media.Schema;
 import io.swagger.v3.oas.annotations.responses.ApiResponse;
@@ -49,6 +49,14 @@
     private final ClientCardSv clientCardSv;
     private final RechargeCtrl rechargeCtrl;
 
+    //@Value("${projectCode.ym}")
+    //private Integer projectCode;
+
+    /**
+     * 鑾峰彇寮�鍗¤褰�
+     * @param vo
+     * @return
+     */
     @Operation(summary = "鑾峰緱涓�椤靛紑鍗¤褰�", description = "杩斿洖涓�椤靛紑鍗℃暟鎹�")
     @ApiResponses(value = {
             @ApiResponse(
@@ -58,9 +66,9 @@
                             schema = @Schema(implementation = VoActiveCard.class))}
             )
     })
-    @GetMapping(path = "/getActiveCards", consumes = MediaType.APPLICATION_JSON_VALUE)
+    @GetMapping(path = "/getActiveCards")
     @SsoAop()
-    public BaseResponse<QueryResultVo<List<VoActiveCard>>> getActiveCards(@RequestBody @Parameter(description = "鏌ヨform琛ㄥ崟json鏁版嵁", required = true) QueryVo vo){
+    public BaseResponse<QueryResultVo<List<VoActiveCard>>> getActiveCards(QueryVo vo){
         try {
             QueryResultVo<List<VoActiveCard>> res = activeCardSv.getActiveCards(vo);
             return BaseResponseUtils.buildSuccess(res);
@@ -70,6 +78,12 @@
         }
     }
 
+    /**
+     * 寮�鍗℃搷浣�
+     * @param po
+     * @param bindingResult
+     * @return
+     */
     @Operation(summary = "寮�鍗�", description = "鏂板紑鍐滄埛鍗�")
     @ApiResponses(value = {
             @ApiResponse(
@@ -82,7 +96,7 @@
     @PostMapping(path = "add_active", consumes = MediaType.APPLICATION_JSON_VALUE)
     @Transactional(rollbackFor = Exception.class)
     @SsoAop()
-    public BaseResponse<Boolean> add_active(@RequestBody @Parameter(description = "form琛ㄥ崟json鏁版嵁", required = true) @Valid DtoActiveCard po, @Parameter(hidden = true) BindingResult bindingResult){
+    public BaseResponse<Boolean> add_active(@RequestBody @Valid DtoActiveCard po, BindingResult bindingResult){
         if(bindingResult != null && bindingResult.hasErrors()){
             return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
         }
@@ -95,16 +109,18 @@
          * townId       闀囩骇鍖哄垝浠g爜
          * villageId    鏉戠骇鍖哄垝浠g爜
          */
-        VoAreaCode voAreaCode = activeCardSv.getAreaCodeByNum(po.getClientNum());
-        if(voAreaCode == null) {
-            return BaseResponseUtils.buildFail(SellResultCode.AREA_CODE_MISTAKE.getMessage());
-        }
-        String provinceId = voAreaCode.getProvinceId();
-        String cityId = voAreaCode.getCityId();
-        String countryId = voAreaCode.getCountryId();
-        String townId = voAreaCode.getTownId();
-        String villageId = voAreaCode.getVillageId();
-        String areaCode = provinceId + cityId + countryId + townId + villageId;
+        //VoAreaCode voAreaCode = activeCardSv.getAreaCodeByNum(po.getClientNum());
+        //if(voAreaCode == null) {
+        //    return BaseResponseUtils.buildFail(SellResultCode.AREA_CODE_MISTAKE.getMessage());
+        //}
+        //String provinceId = voAreaCode.getProvinceId();
+        //String cityId = voAreaCode.getCityId();
+        //String countryId = voAreaCode.getCountryId();
+        //String townId = voAreaCode.getTownId();
+        //String villageId = voAreaCode.getVillageId();
+        //String areaCode = provinceId + cityId + countryId + townId + villageId;
+
+        String areaCode = String.valueOf(activeCardSv.getAreaCodeByNum(po.getClientNum()));
 
         /**
          * 鏍规嵁琛屾斂鍖哄垝涓诧紙areaCode锛夊湪姘村崱琛ㄤ腑閽堝姘村崱缂栧彿锛坈ardNum锛夎繘琛屾ā绯婃煡璇�
@@ -138,6 +154,8 @@
          */
         String cardAddr = po.getCardAddr();
         String clientNum = po.getClientNum();
+        //Long clientId = po.getClientId();
+
         Integer cardCost = po.getCardCost();
         Float amount = po.getAmount();
         Long paymentId = po.getPaymentId();
@@ -146,13 +164,19 @@
         Date createTime = new Date();
 
         /**
+         * 鏍规嵁鍐滄埛缂栧彿鑾峰彇鍐滄埛ID
+         */
+        Long clientId = activeCardSv.getClientIdByNum(clientNum);
+
+        /**
          * 娣诲姞鍐滄埛鍗¤褰�
          */
         SeClientCard seClientCard = new SeClientCard();
         seClientCard.setCardaddr(cardAddr);
         seClientCard.setCardnum(cardNum);
-        seClientCard.setClientnum(clientNum);
-        seClientCard.setMoney(0.0);
+        //seClientCard.setClientnum(clientNum);
+        seClientCard.setClientid(clientId);
+        seClientCard.setMoney(0f);
         seClientCard.setState(CardStateENUM.NORMAL.getCode());
         seClientCard.setCreatedt(createTime);
         seClientCard.setLastoper(LastOperateENUM.ACTIVE.getCode());
@@ -166,8 +190,11 @@
          * 娣诲姞寮�鍗¤褰�
          */
         SeActiveCard activeCard = new SeActiveCard();
-        activeCard.setCardnum(cardNum);
-        activeCard.setClientnum(clientNum);
+        //activeCard.setCardnum(cardNum);
+        //activeCard.setClientnum(clientNum);
+
+        activeCard.setCardid(cardId);
+        activeCard.setClientid(clientId);
         activeCard.setCardcost(cardCost);
         activeCard.setPaymentid(paymentId);
         activeCard.setOperatetype(OperateTypeENUM.ACTIVE.getCode());
@@ -184,6 +211,7 @@
          */
         po.setCardNum(cardNum);
         if(amount != null && amount > 0) {
+            po.setClientId(clientId);
             DtoRecharge dtoRecharge = RechargeDtoMapper.INSTANCT.po2vo(po);
             dtoRecharge.setMoney(0f);
             dtoRecharge.setGift(0f);
@@ -194,7 +222,11 @@
             }
         }
 
-        return BaseResponseUtils.buildSuccess(cardNum) ;
+        Map map = new HashMap();
+        //map.put("projectCode", projectCode);
+        map.put("projectCode", Constant.projectCode_ym);
+        map.put("cardNum", cardNum);
+        return BaseResponseUtils.buildSuccess(map) ;
     }
 
     @Operation(summary = "琛ュ崱", description = "琛ュ崱")
@@ -209,7 +241,7 @@
     @PostMapping(path = "add_reissue", consumes = MediaType.APPLICATION_JSON_VALUE)
     @Transactional(rollbackFor = Exception.class)
     @SsoAop()
-    public BaseResponse<Boolean> add_reissue(@RequestBody @Parameter(description = "form琛ㄥ崟json鏁版嵁", required = true) @Valid DtoActiveCard po, @Parameter(hidden = true) BindingResult bindingResult){
+    public BaseResponse<Boolean> add_reissue(@RequestBody @Valid DtoActiveCard po, BindingResult bindingResult){
         if(bindingResult != null && bindingResult.hasErrors()){
             return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
         }
@@ -217,7 +249,8 @@
         /**
          * cardId           姘村崱缂栧彿锛堥潪浼犲叆鍙傛暟锛岀敱cardNum鍙嶆煡锛屾洿鏂版按鍗¤〃鐢級
          * cardNum          姘村崱缂栧彿
-         * clientNum        鍐滄埛缂栧彿锛堥潪浼犲叆鍙傛暟锛岀敱cardNum鍙嶆煡锛屾坊鍔犺ˉ鍗′娇鐢級
+         //* clientNum        鍐滄埛缂栧彿锛堥潪浼犲叆鍙傛暟锛岀敱cardNum鍙嶆煡锛屾坊鍔犺ˉ鍗′娇鐢級
+         * clientId         鍐滄埛ID锛堥潪浼犲叆鍙傛暟锛岀敱cardNum鍙嶆煡锛屾坊鍔犺ˉ鍗′娇鐢級
          * cardCost         鍗$墖璐圭敤
          * reissueAmount    琛ュ崱閲戦锛岃ˉ鍗℃椂浣跨敤
          * paymentId        鏀粯鏂瑰紡缂栧彿
@@ -227,9 +260,10 @@
          */
         Long cardId = 0L;
         String cardNum = po.getCardNum();
-        String clientNum = "";
+        //String clientNum = "";
+        Long clientId = 0L;
         Integer cardCost = po.getCardCost();
-        Double reissueAmount = po.getReissueAmount();
+        Float reissueAmount = po.getReissueAmount();
         Long paymentId = po.getPaymentId();
         String remarks = po.getRemarks();
         Long operator = po.getOperator();
@@ -243,7 +277,8 @@
             return BaseResponseUtils.buildFail(SellResultCode.CARD_NUMBER_ERROR.getMessage());
         }
         cardId = Long.parseLong(map.get("cardId").toString());
-        clientNum = map.get("clientNum").toString();
+        //clientNum = map.get("clientNum").toString();
+        clientId = Long.parseLong(map.get("clientId").toString());
 
         /**
          * 淇敼鍐滄埛鍗′俊鎭細
@@ -263,12 +298,14 @@
          * 娣诲姞琛ュ崱璁板綍
          */
         SeActiveCard activeCard = new SeActiveCard();
-        activeCard.setCardnum(cardNum);
-        activeCard.setClientnum(clientNum);
+        //activeCard.setCardnum(cardNum);
+        //activeCard.setClientnum(clientNum);
+        activeCard.setCardid(cardId);
+        activeCard.setClientid(clientId);
         activeCard.setCardcost(cardCost);
         activeCard.setPaymentid(paymentId);
         activeCard.setReissueamount(reissueAmount);
-        activeCard.setOperatetype(OperateTypeENUM.REPLACE.getCode());
+        activeCard.setOperatetype(OperateTypeENUM.REISSUE.getCode());
         activeCard.setRemarks(remarks);
         activeCard.setOperator(operator);
         activeCard.setOperatedt(replaceTime);

--
Gitblit v1.8.0