From 62bf2ee66bb60c98a4c52df5b04ae735e75da583 Mon Sep 17 00:00:00 2001 From: zuoxiao <470321431@qq.com> Date: 星期五, 20 六月 2025 14:22:37 +0800 Subject: [PATCH] feat(card): 添加水卡记录查询功能 --- pipIrr-platform/pipIrr-web/pipIrr-web-terminal/src/main/java/com/dy/pipIrrTerminal/card/CardCtrl.java | 123 +++++++++++++++++++++++++++++++++++++++- 1 files changed, 118 insertions(+), 5 deletions(-) diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-terminal/src/main/java/com/dy/pipIrrTerminal/card/CardCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-terminal/src/main/java/com/dy/pipIrrTerminal/card/CardCtrl.java index defb115..07925c5 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-terminal/src/main/java/com/dy/pipIrrTerminal/card/CardCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-terminal/src/main/java/com/dy/pipIrrTerminal/card/CardCtrl.java @@ -4,11 +4,16 @@ import com.dy.common.webUtil.BaseResponse; import com.dy.common.webUtil.BaseResponseUtils; import com.dy.common.webUtil.QueryResultVo; -import com.dy.pipIrrGlobal.voSe.VoTermActiveCard; -import com.dy.pipIrrGlobal.voSe.VoTermCard; -import com.dy.pipIrrGlobal.voSe.VoTermClient; -import com.dy.pipIrrGlobal.voSe.VoTermCommon; +import com.dy.common.webUtil.ResultCodeMsg; +import com.dy.pipIrrGlobal.voSe.*; import com.dy.pipIrrTerminal.card.dto.*; +import com.dy.pipIrrTerminal.card.qo.QoCards; +import com.dy.pipIrrTerminal.card.qo.QoLostCards; +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 jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -167,6 +172,58 @@ } /** + * 琛ユ墸 + * @param po + * @param bindingResult + * @return + */ + @PostMapping(path = "termRepay", consumes = MediaType.APPLICATION_JSON_VALUE) + @SsoAop() + public BaseResponse<VoRepaySupplement> termRepay(@RequestBody @Valid DtoRepaySupplement po, BindingResult bindingResult) { + if (bindingResult != null && bindingResult.hasErrors()) { + return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } + + if(po.getRepayMorny() == null || po.getRepayMorny() <= 0) { + return BaseResponseUtils.buildErrorMsg("琛ユ墸閲戦涓嶈兘涓虹┖涓旈渶澶т簬0"); + } + + if(po.getRepayMorny() > po.getBalance()) { + return BaseResponseUtils.buildErrorMsg("琛ユ墸閲戦涓嶈兘澶т簬琛ユ墸鍓嶄綑棰�"); + } + + Map map_result = cardSv.repay(po); + if (map_result.get("success").equals(false)) { + return BaseResponseUtils.buildErrorMsg(map_result.get("msg").toString()); + } + return BaseResponseUtils.buildSuccess(map_result.get("content")); + } + + /** + * 杩旇繕 + * @param po + * @param bindingResult + * @return + */ + @PostMapping(path = "supplement", consumes = MediaType.APPLICATION_JSON_VALUE) + @SsoAop() + public BaseResponse<VoRepaySupplement> supplement(@RequestBody @Valid DtoRepaySupplement po, BindingResult bindingResult) { + if (bindingResult != null && bindingResult.hasErrors()) { + return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } + + if(po.getSupplementMoney() == null || po.getSupplementMoney() <= 0) { + return BaseResponseUtils.buildErrorMsg("杩旇繕閲戦涓嶈兘涓虹┖涓旈渶澶т簬0"); + } + + Map map_result = cardSv.supplement(po); + if (map_result.get("success").equals(false)) { + return BaseResponseUtils.buildErrorMsg(map_result.get("msg").toString()); + } + return BaseResponseUtils.buildSuccess(map_result.get("content")); + } + + /** * 鎿嶄綔鎵ц鍥炶皟 * * @param po @@ -196,11 +253,67 @@ @SsoAop() public BaseResponse<VoTermCard> readCard(@RequestParam String cardAddr){ try { - return BaseResponseUtils.buildSuccess(cardSv.readCard(cardAddr)); + VoTermCard voTermCard = cardSv.readCard(cardAddr); + if(voTermCard == null) { + return BaseResponseUtils.buildNonExist(); + } + return BaseResponseUtils.buildSuccess(voTermCard); } 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 = VoCards.class))} + ) + }) + @GetMapping(path = "getcards") + @SsoAop() + public BaseResponse<QueryResultVo<List<VoCards>>> getcards(QoCards vo){ + try { + QueryResultVo<List<VoCards>> res = cardSv.getCards(vo); + 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 = "杩斿洖涓�椤靛凡鎸傚け姘村崱鏁版嵁锛圔aseResponse.content:QueryResultVo[{}]锛�", + content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, + schema = @Schema(implementation = VoCards.class))} + ) + }) + @GetMapping(path = "getlostcards") + @SsoAop() + public BaseResponse<QueryResultVo<List<VoCards>>> getLostCards(QoLostCards vo){ + try { + QueryResultVo<List<VoCards>> res = cardSv.getLostCards(vo); + return BaseResponseUtils.buildSuccess(res); + } catch (Exception e) { + log.error("鏌ヨ宸叉寕澶辨按鍗″紓甯�", e); + return BaseResponseUtils.buildException(e.getMessage()) ; + } + } + } \ No newline at end of file -- Gitblit v1.8.0