|  |  |  | 
|---|
|  |  |  | 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.dto.DtoRecharge; | 
|---|
|  |  |  | 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 org.springframework.validation.annotation.Validated; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  | import java.util.Optional; | 
|---|
|  |  |  | import java.text.DecimalFormat; | 
|---|
|  |  |  | import java.util.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @author ZhuBaoMin | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 注册电子钱包账户 | 
|---|
|  |  |  | * 注册钱先验证该农户是否已经注册电子钱包 | 
|---|
|  |  |  | * 需要考虑已注册账户的情况 | 
|---|
|  |  |  | * @param clientId | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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(); | 
|---|
|  |  |  | 
|---|
|  |  |  | 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) ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 电子钱包账户充值 | 
|---|
|  |  |  | * 需要考虑未注册账户的情况 | 
|---|
|  |  |  | * @param po | 
|---|
|  |  |  | * @param bindingResult | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | 
|---|
|  |  |  | @PostMapping(path = "add_recharge", consumes = MediaType.APPLICATION_JSON_VALUE) | 
|---|
|  |  |  | @Transactional(rollbackFor = Exception.class) | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<Boolean> addRecharge(@RequestBody @Valid DtoRecharge po, BindingResult bindingResult){ | 
|---|
|  |  |  | 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); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 添加充值记录 | 
|---|
|  |  |  | SeWalletRecharge seWalletRecharge = new SeWalletRecharge(); | 
|---|
|  |  |  | seWalletRecharge.setWalletId(wallerId); | 
|---|
|  |  |  | seWalletRecharge.setClientId(clientId); | 
|---|
|  |  |  | seWalletRecharge.setMoney(money); | 
|---|
|  |  |  | seWalletRecharge.setAmount(amount); | 
|---|
|  |  |  | seWalletRecharge.setAfterRecharge(afterRrecharge); | 
|---|
|  |  |  | seWalletRecharge.setRechargeTime(new Date()); | 
|---|
|  |  |  | Long rec = Optional.ofNullable(walletSv.addRecharge(seWalletRecharge)).orElse(0L); | 
|---|
|  |  |  | 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.WALLET_OPEN_ACCOUNT_FAIL.getMessage()); | 
|---|
|  |  |  | 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 = "操作结果:true:成功,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 = "操作结果:true:成功,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 = "操作结果:true:成功,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()) ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|