From a60332d51fec0ae9f1afecc8c7a018c77e4ac101 Mon Sep 17 00:00:00 2001
From: wuzeyu <1223318623@qq.com>
Date: 星期二, 27 二月 2024 10:03:29 +0800
Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV

---
 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletCtrl.java |  441 +++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 393 insertions(+), 48 deletions(-)

diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletCtrl.java
index 8eecd2c..500dd92 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletCtrl.java
@@ -3,27 +3,39 @@
 import com.dy.common.aop.SsoAop;
 import com.dy.common.webUtil.BaseResponse;
 import com.dy.common.webUtil.BaseResponseUtils;
+import com.dy.common.webUtil.QueryResultVo;
 import com.dy.common.webUtil.ResultCodeMsg;
+import com.dy.pipIrrGlobal.pojoSe.SeConsume;
+import com.dy.pipIrrGlobal.pojoSe.SeRefund;
 import com.dy.pipIrrGlobal.pojoSe.SeWallet;
+import com.dy.pipIrrGlobal.pojoSe.SeWalletRecharge;
+import com.dy.pipIrrGlobal.voSe.VoActiveCard;
+import com.dy.pipIrrGlobal.voSe.VoWallet;
+import com.dy.pipIrrGlobal.voSe.VoWalletRecharge;
+import com.dy.pipIrrGlobal.voSe.VoWalletRefund;
+import com.dy.pipIrrSell.result.SellResultCode;
+import com.dy.pipIrrSell.wallet.enums.LastOperateENUM;
+import com.dy.pipIrrSell.wallet.enums.RefundStatusENUM;
+import com.dy.pipIrrSell.wallet.qo.QoWalletRecharge;
+import com.dy.pipIrrSell.wallet.qo.QueryVo;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.media.Content;
 import io.swagger.v3.oas.annotations.media.Schema;
 import io.swagger.v3.oas.annotations.responses.ApiResponse;
 import io.swagger.v3.oas.annotations.responses.ApiResponses;
 import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.validation.Valid;
 import jakarta.validation.constraints.NotNull;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.http.MediaType;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.validation.BindingResult;
 import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
-import java.util.Date;
-import java.util.Optional;
+import java.text.DecimalFormat;
+import java.util.*;
 
 /**
  * @author ZhuBaoMin
@@ -41,6 +53,12 @@
 public class WalletCtrl {
     private final WalletSv walletSv;
 
+    /**
+     * 娉ㄥ唽鐢靛瓙閽卞寘璐︽埛
+     * 闇�瑕佽�冭檻宸叉敞鍐岃处鎴风殑鎯呭喌
+     * @param clientId
+     * @return
+     */
     @Operation(summary = "娉ㄥ唽鐢靛瓙閽卞寘", description = "娉ㄥ唽鐢靛瓙閽卞寘")
     @ApiResponses(value = {
             @ApiResponse(
@@ -50,56 +68,383 @@
                             schema = @Schema(implementation = Boolean.class))}
             )
     })
-    @PostMapping(path = "add")
-    @Transactional(rollbackFor = Exception.class)
+    @PostMapping(path = "add_wallet")
     @SsoAop()
-    //public BaseResponse<Boolean> add(@RequestBody Long clientId){
-    public BaseResponse<Boolean> add(@RequestParam("clientId") @NotNull(message = "鍐滄埛缂栧彿涓嶈兘涓虹┖") Long clientId){
+    public BaseResponse<Boolean> addWallet(@RequestParam("clientId") @NotNull(message = "鍐滄埛缂栧彿涓嶈兘涓虹┖") Long clientId){
         if(clientId == null || clientId < 0) {
-            return BaseResponseUtils.buildFail("鍐滄埛缂栧彿涓嶈兘涓虹┖");
+            return BaseResponseUtils.buildFail(SellResultCode.CLIENT_ID_CANNOT_BE_NULL.getMessage());
+        }
+
+        if(walletSv.getWalletByClientId(clientId) != null) {
+            return BaseResponseUtils.buildFail(SellResultCode.WALLET_ACCOUNT_EXIST.getMessage());
         }
 
         SeWallet seWallet = new SeWallet();
-        seWallet.setClientid(clientId);
-        seWallet.setMoney(0f);
-        seWallet.setCreatedt(new Date());
-        Integer rec = Optional.ofNullable(walletSv.add(seWallet)).orElse(0);
+        seWallet.setClientId(clientId);
+        seWallet.setMoney(0d);
+        seWallet.setLastOperate(LastOperateENUM.OPEN_ACCOUNT.getCode());
+        seWallet.setLastOperateTime(new Date());
+        seWallet.setCreateTime(new Date());
+        Long rec = Optional.ofNullable(walletSv.addWallet(seWallet)).orElse(0L);
         if(rec == 0) {
-            return BaseResponseUtils.buildFail("娉ㄥ唽鐢靛瓙閽卞寘-鐢靛瓙閽卞寘璁板綍鍐欏叆寮傚父");
+            return BaseResponseUtils.buildFail(SellResultCode.WALLET_OPEN_ACCOUNT_FAIL.getMessage());
         }
-
         return BaseResponseUtils.buildSuccess(true) ;
     }
 
-    //@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 = "addRecharge")
-    //@Transactional(rollbackFor = Exception.class)
-    //@SsoAop()
-    //public BaseResponse<Boolean> addRecharge(@RequestBody  @Valid DtoWalletRecharge po, @Parameter(hidden = true) 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());
-    //    }
-    //
-    //
-    //
-    //    SeWallet seWallet = new SeWallet();
-    //    seWallet.setClientid(clientId);
-    //    seWallet.setMoney(0f);
-    //    seWallet.setCreatedt(new Date());
-    //    Integer rec = Optional.ofNullable(walletSv.add(seWallet)).orElse(0);
-    //    if(rec == 0) {
-    //        return BaseResponseUtils.buildFail("娉ㄥ唽鐢靛瓙閽卞寘-鐢靛瓙閽卞寘璁板綍鍐欏叆寮傚父");
-    //    }
-    //
-    //    return BaseResponseUtils.buildSuccess(true) ;
-    //}
+    /**
+     * 鐢靛瓙閽卞寘璐︽埛鍏呭��
+     * 闇�瑕佽�冭檻鏈敞鍐岃处鎴风殑鎯呭喌
+     * @param po
+     * @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 = "add_recharge", consumes = MediaType.APPLICATION_JSON_VALUE)
+    @Transactional(rollbackFor = Exception.class)
+    @SsoAop()
+    public BaseResponse<Boolean> addRecharge(@RequestBody @Valid SeWalletRecharge po, BindingResult bindingResult){
+        Long clientId = Optional.ofNullable(po .getClientId()).orElse(0L);
+        Double amount = Optional.ofNullable(po.getAmount()).orElse(0.0);
+
+        // 楠岃瘉璇ュ啘鎴锋槸鍚﹀凡缁忔敞鍐岀數瀛愰挶鍖呰处鎴峰苟鍙栧嚭ID鍙婂綋鍓嶈处鎴蜂綑棰�
+        SeWallet seWallet = walletSv.getWalletByClientId(clientId);
+        if(seWallet == null) {
+            return BaseResponseUtils.buildFail(SellResultCode.NO_ACCOUNT.getMessage());
+        }
+        Long wallerId = Optional.ofNullable(seWallet.getId()).orElse(0L);
+        Double money = Optional.ofNullable(seWallet.getMoney()).orElse(0.0);
+
+        // 璁$畻鍏呭�煎悗浣欓
+        Double afterRrecharge = money + amount;
+
+        // 淇敼鐢靛瓙閽卞寘浣欓銆佹渶鍚庢搷浣滅被鍨嬨�佹渶鍚庢搷浣滄椂闂�
+        seWallet.setMoney(afterRrecharge);
+        seWallet.setLastOperate(LastOperateENUM.RECHARGE.getCode());
+        seWallet.setLastOperateTime(new Date());
+        Integer rec_updateWaller = Optional.ofNullable(walletSv.updateWallet(seWallet)).orElse(0);
+        if(rec_updateWaller == 0) {
+            return BaseResponseUtils.buildFail(SellResultCode.UPDATE_ACCOUNT_FAIL.getMessage());
+        }
+
+        // 娣诲姞鍏呭�艰褰�
+        po.setWalletId(wallerId);
+        po.setClientId(clientId);
+        po.setMoney(money);
+        po.setAmount(amount);
+        po.setAfterRecharge(afterRrecharge);
+        po.setRechargeTime(new Date());
+        Long rec = Optional.ofNullable(walletSv.addRecharge(po)).orElse(0L);
+        if(rec == 0) {
+            return BaseResponseUtils.buildFail(SellResultCode.RECHARGE_FAIL.getMessage());
+        }
+        return BaseResponseUtils.buildSuccess(true) ;
+    }
+
+    /**
+     * 鐢靛瓙閽卞寘娑堣垂
+     * 闇�瑕佽�冭檻鏈敞鍐岃处鎴风殑鎯呭喌銆佷綑棰濅笉瓒崇殑鎯呭喌
+     * @param po
+     * @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 = "add_consume", consumes = MediaType.APPLICATION_JSON_VALUE)
+    @Transactional(rollbackFor = Exception.class)
+    @SsoAop()
+    public BaseResponse<Boolean> addConsume(@RequestBody @Valid SeConsume po, BindingResult bindingResult){
+        Long clientId = po .getClientId();
+        Double consumption = po.getConsumption();
+        Date vot = po.getVot();
+        Date vct = po.getVct();
+
+        // 璁$畻寮�鍏抽榾鏃堕棿宸強鐢ㄦ按鏃堕暱
+        Long timeDifference = vct.getTime() - vot.getTime();
+        DecimalFormat df = new DecimalFormat("#.00");
+        Double duration = Double.parseDouble(df.format((float)timeDifference / (1000 * 60 * 60)));
+
+        // 楠岃瘉璇ュ啘鎴锋槸鍚﹀凡缁忔敞鍐岀數瀛愰挶鍖呰处鎴峰苟鍙栧嚭ID鍙婂綋鍓嶈处鎴蜂綑棰�
+        SeWallet seWallet = walletSv.getWalletByClientId(clientId);
+        if(seWallet == null) {
+            return BaseResponseUtils.buildFail(SellResultCode.NO_ACCOUNT.getMessage());
+        }
+        Long wallerId = Optional.ofNullable(seWallet.getId()).orElse(0L);
+        Double money = Optional.ofNullable(seWallet.getMoney()).orElse(0.0);
+
+        if(money < consumption) {
+            return BaseResponseUtils.buildFail(SellResultCode.BALANCE_IS_INSUFFICIENT.getMessage());
+        }
+        // 璁$畻娑堣垂鍚庝綑棰�
+        Double afterConsume = money - consumption;
+
+        // 淇敼鐢靛瓙閽卞寘浣欓銆佹渶鍚庢搷浣滅被鍨嬨�佹渶鍚庢搷浣滄椂闂�
+        seWallet.setMoney(afterConsume);
+        seWallet.setLastOperate(LastOperateENUM.CONSUME.getCode());
+        seWallet.setLastOperateTime(new Date());
+        Integer rec_updateWaller = Optional.ofNullable(walletSv.updateWallet(seWallet)).orElse(0);
+        if(rec_updateWaller == 0) {
+            return BaseResponseUtils.buildFail(SellResultCode.UPDATE_ACCOUNT_FAIL.getMessage());
+        }
+
+        // 娣诲姞娑堣垂璁板綍
+        po.setWalletId(wallerId);
+        po.setMoney(money);
+        po.setAfterConsume(afterConsume);
+        po.setDuration(duration);
+        Long rec = Optional.ofNullable(walletSv.addConsume(po)).orElse(0L);
+        if(rec == 0) {
+            return BaseResponseUtils.buildFail(SellResultCode.CONSUME_FAIL.getMessage());
+        }
+        return BaseResponseUtils.buildSuccess(true) ;
+    }
+
+    /**
+     * 鐢宠閫�娆�
+     * 闇�瑕佽�冭檻鐢宠閫�娆鹃噾棰濆ぇ浜庝綑棰濈殑鎯呭喌
+     * @param po
+     * @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 = "add_refund", consumes = MediaType.APPLICATION_JSON_VALUE)
+    @Transactional(rollbackFor = Exception.class)
+    @SsoAop()
+    public BaseResponse<Boolean> addRefund(@RequestBody @Valid SeRefund po, BindingResult bindingResult){
+        Long clientId = po .getClientId();
+        Double refundAmount = po.getRefundAmount();
+
+        // 楠岃瘉璇ュ啘鎴锋槸鍚﹀凡缁忔敞鍐岀數瀛愰挶鍖呰处鎴峰苟鍙栧嚭ID鍙婂綋鍓嶈处鎴蜂綑棰�
+        SeWallet seWallet = walletSv.getWalletByClientId(clientId);
+        if(seWallet == null) {
+            return BaseResponseUtils.buildFail(SellResultCode.NO_ACCOUNT.getMessage());
+        }
+        Long wallerId = Optional.ofNullable(seWallet.getId()).orElse(0L);
+        Double money = Optional.ofNullable(seWallet.getMoney()).orElse(0.0);
+
+        // 楠岃瘉閫�娆鹃噾棰濇槸鍚﹀ぇ浜庝綑棰�
+        if(money < refundAmount) {
+            return BaseResponseUtils.buildFail(SellResultCode.REFUND_AMOUNT_CANNOT_GREATER_THAN_MONEY.getMessage());
+        }
+        // 璁$畻娑堣垂鍚庝綑棰�
+        Double afterRefund = money - refundAmount;
+
+        // 淇敼鐢靛瓙閽卞寘浣欓銆佹渶鍚庢搷浣滅被鍨嬨�佹渶鍚庢搷浣滄椂闂�
+        seWallet.setMoney(afterRefund);
+        seWallet.setLastOperate(LastOperateENUM.APPLY_REFUND.getCode());
+        seWallet.setLastOperateTime(new Date());
+        Integer rec_updateWaller = Optional.ofNullable(walletSv.updateWallet(seWallet)).orElse(0);
+        if(rec_updateWaller == 0) {
+            return BaseResponseUtils.buildFail(SellResultCode.UPDATE_ACCOUNT_FAIL.getMessage());
+        }
+
+        // 娣诲姞娑堣垂璁板綍
+        po.setWalletId(wallerId);
+        po.setMoney(money);
+        po.setAfterRefund(afterRefund);
+        po.setApplicationTime(new Date());
+        po.setRefundStatus(RefundStatusENUM.NO_REFUND.getCode());
+        Long rec = Optional.ofNullable(walletSv.addRefund(po)).orElse(0L);
+        if(rec == 0) {
+            return BaseResponseUtils.buildFail(SellResultCode.APPLICATION_REFUND_FAIL.getMessage());
+        }
+        return BaseResponseUtils.buildSuccess(true) ;
+    }
+
+    /**
+     * 瀹℃牳閫�娆剧敵璇�
+     * 闇�瑕佽�冭檻璇ョ數瀛愰挶鍖呮病鏈夊緟瀹℃牳鐨勯��娆剧敵璇风殑鎯呭喌
+     * @param po
+     * @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 = "audit_refund", consumes = MediaType.APPLICATION_JSON_VALUE)
+    @Transactional(rollbackFor = Exception.class)
+    @SsoAop()
+    public BaseResponse<Boolean> auditRefund(@RequestBody @Valid SeRefund po, BindingResult bindingResult){
+        Long clientId = po.getClientId();
+        Byte refundStatus = po.getRefundStatus();
+        Long auditor = po.getAuditor();
+        String remarks = po.getRemarks();
+
+        // 楠岃瘉璇ュ啘鎴锋槸鍚﹀凡缁忔敞鍐岀數瀛愰挶鍖呰处鎴峰苟鍙栧嚭ID鍙婂綋鍓嶈处鎴蜂綑棰�
+        SeWallet seWallet = walletSv.getWalletByClientId(clientId);
+        if(seWallet == null) {
+            return BaseResponseUtils.buildFail(SellResultCode.NO_ACCOUNT.getMessage());
+        }
+        Long wallerId = Optional.ofNullable(seWallet.getId()).orElse(0L);
+        Double money = Optional.ofNullable(seWallet.getMoney()).orElse(0.0);
+
+        // 楠岃瘉璇ョ數瀛愰挶鍖呮槸鍚︽湁寰呭鏍哥殑閫�娆剧敵璇�(鏍规嵁閽卞寘ID鑾峰彇寰呭鏍哥殑閫�娆剧敵璇峰璞�)
+        SeRefund seRefund = walletSv.getRefundByWallerId(wallerId);
+        if(seRefund == null) {
+            return BaseResponseUtils.buildFail(SellResultCode.NO_TO_AUDIT_REFUND.getMessage());
+        }
+
+        // 淇敼鐢靛瓙閽卞寘鏈�鍚庢搷浣滅被鍨嬨�佹渶鍚庢搷浣滄椂闂�
+        seWallet.setLastOperate(LastOperateENUM.AUDIT_REFUND.getCode());
+        seWallet.setLastOperateTime(new Date());
+        Integer rec_updateWaller = Optional.ofNullable(walletSv.updateWallet(seWallet)).orElse(0);
+        if(rec_updateWaller == 0) {
+            return BaseResponseUtils.buildFail(SellResultCode.UPDATE_ACCOUNT_FAIL.getMessage());
+        }
+
+        // 娣诲姞娑堣垂璁板綍
+        seRefund.setRefundStatus(refundStatus);
+        seRefund.setAuditor(auditor);
+        seRefund.setAuditTime(new Date());
+        seRefund.setRemarks(remarks);
+        Integer rec = Optional.ofNullable(walletSv.auditRefund(seRefund)).orElse(0);
+        if(rec == 0) {
+            return BaseResponseUtils.buildFail(SellResultCode.AUDIT_REFUND_FAIL.getMessage());
+        }
+        return BaseResponseUtils.buildSuccess(true) ;
+    }
+
+    /**
+     * 鏍规嵁鍐滄埛濮撳悕鑾峰彇鐢靛瓙閽卞寘璐︽埛璁板綍
+     * @param vo
+     * @return
+     */
+    @Operation(summary = "鑾峰彇鐢靛瓙閽卞寘璐︽埛璁板綍", description = "杩斿洖鐢靛瓙閽卞寘璐︽埛璁板綍")
+    @ApiResponses(value = {
+            @ApiResponse(
+                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
+                    description = "杩斿洖涓�椤佃ˉ鍗℃暟鎹紙BaseResponse.content:QueryResultVo[{}]锛�",
+                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
+                            schema = @Schema(implementation = VoActiveCard.class))}
+            )
+    })
+    @GetMapping(path = "/get_wallets")
+    @SsoAop()
+    public BaseResponse<QueryResultVo<List<VoWallet>>> getWallets(QueryVo vo){
+        try {
+            QueryResultVo<List<VoWallet>> res = walletSv.getWallets(vo);
+            if(res.itemTotal == 0) {
+                return BaseResponseUtils.buildFail(SellResultCode.No_ReissueCards.getMessage());
+            }
+            return BaseResponseUtils.buildSuccess(res);
+        } catch (Exception e) {
+            log.error("鑾峰彇鐢靛瓙閽卞寘璐︽埛璁板綍", e);
+            return BaseResponseUtils.buildException(e.getMessage()) ;
+        }
+    }
+
+    /**
+     * 鑾峰彇鐢靛瓙閽卞寘鍏呭�艰褰�
+     * @param vo
+     * @return
+     */
+    @Operation(summary = "鑾峰彇鐢靛瓙閽卞寘鍏呭�艰褰�", description = "杩斿洖鐢靛瓙閽卞寘鍏呭�艰褰�")
+    @ApiResponses(value = {
+            @ApiResponse(
+                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
+                    description = "杩斿洖涓�椤佃ˉ鍗℃暟鎹紙BaseResponse.content:QueryResultVo[{}]锛�",
+                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
+                            schema = @Schema(implementation = VoActiveCard.class))}
+            )
+    })
+    @GetMapping(path = "/get_recharges")
+    @SsoAop()
+    public BaseResponse<QueryResultVo<List<VoWalletRecharge>>> getWalletRecharges(QoWalletRecharge vo){
+        try {
+            QueryResultVo<List<VoWalletRecharge>> res = walletSv.getWalletRecharges(vo);
+            if(res.itemTotal == 0) {
+                return BaseResponseUtils.buildFail(SellResultCode.No_WALLER_RECHARGES.getMessage());
+            }
+            return BaseResponseUtils.buildSuccess(res);
+        } catch (Exception e) {
+            log.error("鑾峰彇鐢靛瓙閽卞寘鍏呭�艰褰曞紓甯�", e);
+            return BaseResponseUtils.buildException(e.getMessage()) ;
+        }
+    }
+
+    @Operation(summary = "鑾峰彇鐢靛瓙閽卞寘娑堣垂璁板綍", description = "杩斿洖鐢靛瓙閽卞寘娑堣垂璁板綍")
+    @ApiResponses(value = {
+            @ApiResponse(
+                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
+                    description = "杩斿洖涓�椤佃ˉ鍗℃暟鎹紙BaseResponse.content:QueryResultVo[{}]锛�",
+                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
+                            schema = @Schema(implementation = VoActiveCard.class))}
+            )
+    })
+    @GetMapping(path = "/get_consume")
+    @SsoAop()
+    public BaseResponse<Map> getWalletConsumes(QueryVo vo){
+        Long clientId = Optional.ofNullable(vo.getClientId()).orElse(0L);
+        if(clientId == 0) {
+            return BaseResponseUtils.buildFail(SellResultCode.WALLET_CLIENT_ID_CANNOT_BE_NULL.getMessage());
+        }
+        try {
+            Map res = Optional.ofNullable(walletSv.getWalletConsumes(vo)).orElse(new HashMap());
+            if(res.size() <= 0) {
+                return BaseResponseUtils.buildFail(SellResultCode.No_WALLER_RECHARGES.getMessage());
+            }
+            return BaseResponseUtils.buildSuccess(res);
+        } catch (Exception e) {
+            log.error("鑾峰彇鐢靛瓙閽卞寘鍏呭�艰褰曞紓甯�", e);
+            return BaseResponseUtils.buildException(e.getMessage()) ;
+        }
+    }
+
+    /**
+     * 鑾峰彇鐢靛瓙閽卞寘閫�娆捐褰�
+     * @param vo
+     * @return
+     */
+    @Operation(summary = "鑾峰彇鐢靛瓙閽卞寘閫�娆捐褰�", description = "杩斿洖鐢靛瓙閽卞寘閫�娆捐褰�")
+    @ApiResponses(value = {
+            @ApiResponse(
+                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
+                    description = "杩斿洖涓�椤佃ˉ鍗℃暟鎹紙BaseResponse.content:QueryResultVo[{}]锛�",
+                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
+                            schema = @Schema(implementation = VoActiveCard.class))}
+            )
+    })
+    @GetMapping(path = "/get_refunds")
+    @SsoAop()
+    public BaseResponse<QueryResultVo<List<VoWalletRefund>>> getWalletRefunds(QueryVo vo){
+        try {
+            QueryResultVo<List<VoWalletRefund>> res = walletSv.getWalletRefunds(vo);
+            if(res.itemTotal == 0) {
+                return BaseResponseUtils.buildFail(SellResultCode.No_REFUNDS.getMessage());
+            }
+            return BaseResponseUtils.buildSuccess(res);
+        } catch (Exception e) {
+            log.error("鑾峰彇鐢靛瓙閽卞寘閫�娆捐褰曞紓甯�", e);
+            return BaseResponseUtils.buildException(e.getMessage()) ;
+        }
+    }
 }

--
Gitblit v1.8.0