From 628e79d294458459648235cd435bbf613b159dac Mon Sep 17 00:00:00 2001 From: zhubaomin <zhubaomin> Date: 星期一, 12 八月 2024 11:36:44 +0800 Subject: [PATCH] 2024-08-12 朱宝民 代码优化(yearMonth参数类型) --- pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/ClientCtrl.java | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-) diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/ClientCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/ClientCtrl.java index 6b3e977..2d43649 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/ClientCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/ClientCtrl.java @@ -17,6 +17,8 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.text.SimpleDateFormat; +import java.util.Date; import java.util.List; import java.util.Objects; @@ -141,8 +143,17 @@ @GetMapping(path = "/getDayAmountAndMoney") @SsoAop() public BaseResponse<QueryResultVo<List<VoDayClient>>> getDayAmountAndMoney(ClientAmountQO qo) { - if(qo.getYearMonth() == null) { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + String yearMonth = qo.getYearMonth(); + if(yearMonth == null) { return BaseResponseUtils.buildErrorMsg(StatisticlResultCode.YEAR_AND_MONTH_CANNOT_BE_NULL.getMessage()); + }else { + yearMonth = yearMonth + "-01"; + try { + Date date = dateFormat.parse(yearMonth); + } catch (Exception e) { + return BaseResponseUtils.buildErrorMsg(StatisticlResultCode.YEAR_OR_MONTH_IS_ERROR.getMessage()); + } } try { @@ -172,7 +183,6 @@ } } - /** * 鎸囧畾鏃堕棿娈靛唴寮�鐗╃悊鍗″啘鎴� * @@ -190,8 +200,6 @@ return BaseResponseUtils.buildException(e.getMessage()); } } - - /** * 鎸囧畾鏃堕棿娈靛唴姣忎釜鍐滄埛鍏呭�煎悎璁★紙鐗╃悊鍗★級 -- Gitblit v1.8.0