From 95d8d3df562c8f7fca74ba994cddbbf41564488e Mon Sep 17 00:00:00 2001 From: zhubaomin <zhubaomin> Date: 星期二, 08 四月 2025 20:08:15 +0800 Subject: [PATCH] 优化未完成计划列表、已完成计划列表接口 --- pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/stClient/StClientCtrl.java | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 50 insertions(+), 6 deletions(-) diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/stClient/StClientCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/stClient/StClientCtrl.java index 7b21ee7..e33506e 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/stClient/StClientCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/stClient/StClientCtrl.java @@ -5,7 +5,9 @@ import com.dy.common.webUtil.BaseResponse; import com.dy.common.webUtil.BaseResponseUtils; import com.dy.common.webUtil.QueryResultVo; -import com.dy.pipIrrGlobal.voSt.VoDayIntakeAmount; +import com.dy.pipIrrGlobal.voSt.VoStClientAmountDay; +import com.dy.pipIrrGlobal.voSt.VoStClientAmountMonth; +import com.dy.pipIrrGlobal.voSt.VoStClientAmountYear; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -13,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.ArrayList; import java.util.List; /** @@ -20,12 +23,13 @@ * @Date: 2024/12/30 15:22 * @Description */ - @Slf4j @RestController @RequestMapping(path="stClient") @RequiredArgsConstructor public class StClientCtrl { + + private static final int startYear4YearStatistics = 2024 ; private StClientSv sv ; @@ -34,7 +38,6 @@ this.sv = sv ; } - /** * 鏌ヨ鎸囧畾骞存湀鍐滄埛鍚勬棩鐢ㄦ按閲� * @param qo @@ -42,16 +45,57 @@ */ @GetMapping(path = "/amountOfDay") @SsoAop() - public BaseResponse<QueryResultVo<List<VoDayIntakeAmount>>> amountOfDay(StClientQo qo) throws Exception { + public BaseResponse<QueryResultVo<List<VoStClientAmountDay>>> amountOfDay(StClientQo qo) throws Exception { String yearMonth = qo.getYearMonth(); if(yearMonth == null || yearMonth.trim().equals("")) { return BaseResponseUtils.buildErrorMsg("鏌ヨ鏉′欢骞存湀涓嶈兘涓虹┖"); } - int[] ymd = DateTime.yyyy_MM_ymdGroup(yearMonth) ; qo.year = ymd[0] ; qo.month = ymd[1] ; - return BaseResponseUtils.buildSuccess(this.sv.selectStClientAmountDay(qo)); } + + + /** + * 鏌ヨ鎸囧畾骞村啘鎴峰悇鏈堢敤姘撮噺 + * @param qo + * @return + */ + @GetMapping(path = "/amountOfMonth") + @SsoAop() + public BaseResponse<QueryResultVo<List<VoStClientAmountMonth>>> amountOfMonth(StClientQo qo) throws Exception { + if(qo.year == null) { + return BaseResponseUtils.buildErrorMsg("鏌ヨ鏉′欢骞村害涓嶈兘涓虹┖"); + } + return BaseResponseUtils.buildSuccess(this.sv.selectStClientAmountMonth(qo)); + } + + + + /** + * 鏌ヨ鎸囧畾骞村啘鎴峰悇骞寸敤姘撮噺 + * @param qo + * @return + */ + @GetMapping(path = "/amountOfYear") + @SsoAop() + public BaseResponse<QueryResultVo<List<VoStClientAmountYear>>> amountOfYear(StClientQo qo) throws Exception { + List<Integer> yearGrp = new ArrayList<Integer>(); + int nowYear = Integer.parseInt(DateTime.yyyy()) ; + if(qo.year == null) { + for(int i = startYear4YearStatistics; i <= nowYear; i++) { + yearGrp.add(i) ; + } + }else{ + if(qo.year > nowYear){ + qo.year = nowYear; + } + if(qo.year < startYear4YearStatistics){ + qo.year = startYear4YearStatistics; + } + yearGrp.add(qo.year) ; + } + return BaseResponseUtils.buildSuccess(this.sv.selectStClientAmountYear(qo, yearGrp)); + } } -- Gitblit v1.8.0