From a2a790968bc8479dda1dec878068da865662889e Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期一, 02 十二月 2024 10:26:58 +0800
Subject: [PATCH] 1、完善代码;
---
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletCtrl.java | 129 +++++++++++++++++++++++++++++++++++++++++-
1 files changed, 125 insertions(+), 4 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 780d2dd..d70c88d 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,14 +3,21 @@
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;
@@ -28,8 +35,7 @@
import org.springframework.web.bind.annotation.*;
import java.text.DecimalFormat;
-import java.util.Date;
-import java.util.Optional;
+import java.util.*;
/**
* @author ZhuBaoMin
@@ -70,7 +76,7 @@
}
if(walletSv.getWalletByClientId(clientId) != null) {
- return BaseResponseUtils.buildFail(SellResultCode.WALLET_ACCOUNT_EXIST.getMessage());
+ //return BaseResponseUtils.buildFail(SellResultCode.WALLET_ACCOUNT_EXIST.getMessage());
}
SeWallet seWallet = new SeWallet();
@@ -81,7 +87,7 @@
seWallet.setCreateTime(new Date());
Long rec = Optional.ofNullable(walletSv.addWallet(seWallet)).orElse(0L);
if(rec == 0) {
- return BaseResponseUtils.buildFail(SellResultCode.WALLET_OPEN_ACCOUNT_FAIL.getMessage());
+ return BaseResponseUtils.buildFail(SellResultCode.VC_OPEN_ACCOUNT_FAIL.getMessage());
}
return BaseResponseUtils.buildSuccess(true) ;
}
@@ -326,4 +332,119 @@
}
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