From 0f2f2cfaeb23fc8f84ce13202bbc94fbc5644531 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期一, 14 七月 2025 11:44:02 +0800
Subject: [PATCH] 修改用水户年用水量统计查询中的bug

---
 pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/stClient/StClientSv.java |   45 +++++++++++++++++++++++++++++++++++----------
 1 files changed, 35 insertions(+), 10 deletions(-)

diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/stClient/StClientSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/stClient/StClientSv.java
index d1c9168..c6fb7af 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/stClient/StClientSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/stClient/StClientSv.java
@@ -1,5 +1,6 @@
 package com.dy.pipIrrStatistics.stClient;
 
+import com.alibaba.fastjson2.JSON;
 import com.dy.common.webUtil.QueryResultVo;
 import com.dy.pipIrrGlobal.daoSt.StClientAmountDayMapper ;
 import com.dy.pipIrrGlobal.daoSt.StClientAmountMonthMapper ;
@@ -93,33 +94,57 @@
      * @param qo
      * @return
      */
-    public QueryResultVo<List<VoStClientAmountYearRecords>> selectStClientAmountYear(StClientQo qo, List<Integer> yearGrp) throws ParseException {
-        QueryResultVo<List<VoStClientAmountYearRecords>> rsVo = new QueryResultVo<>() ;
+    public QueryResultVo<VoStClientAmountYear> selectStClientAmountYear(StClientQo qo, List<Integer> yearGrp) throws ParseException {
+        QueryResultVo<VoStClientAmountYear> rsQrVo = new QueryResultVo<>() ;
+
+        VoStClientAmountYear rsVo = new VoStClientAmountYear();
+        rsVo.yearGrp = yearGrp ;
+        rsQrVo.obj = rsVo ;
+
+        boolean oneYear = yearGrp.size() == 1? true : false ;
         // 鐢熸垚鏌ヨ鍙傛暟
         Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ;
-        params.put("yearGrp", yearGrp);
         // 鑾峰彇绗﹀悎鏉′欢鐨勮褰曟暟
-        Long itemTotal = stClientAmountYearDao.selectCountYearStatistics(params) ;
+        Long itemTotal = 0L ;
+        String clientIdsJson = null ;
+        if(oneYear){
+            itemTotal = stClientAmountYearDao.selectCountYearStatistics4OneYear(params) ;
+        }else{
+            itemTotal = stClientAmountYearDao.selectCountYearStatistics(params) ;
+        }
 
         if(itemTotal != null && itemTotal > 0) {
-            rsVo.pageSize = qo.pageSize;
-            rsVo.pageCurr = qo.pageCurr;
-            rsVo.calculateAndSet(itemTotal, params);
+            rsQrVo.pageSize = qo.pageSize;
+            rsQrVo.pageCurr = qo.pageCurr;
+            rsQrVo.calculateAndSet(itemTotal, params);
+
+            List<VoStClientIdAmountYearRecord> clientIds = stClientAmountYearDao.selectClientIds4YearStatistics(params);
+            clientIdsJson = JSON.toJSONString(clientIds) ;
 
             List<VoStClientAmountYearRecords> group = new ArrayList<>();
             int count = 1 ;
             for(int year: yearGrp){
                 params.put("year", year);
-                List<VoStClientAmountYearRecord> list = stClientAmountYearDao.selectYearStatistics(params);
+                List<VoStClientAmountYearRecord> list ;
+                if(oneYear){
+                    list = stClientAmountYearDao.selectYearStatistics4OneYear(params);
+                }else{
+                    if(clientIdsJson != null){
+                        params.put("clientIdsJson", clientIdsJson);
+                    }
+                    list = stClientAmountYearDao.selectYearStatistics(params);
+                }
+
                 if(group.isEmpty()){
                     this.completion(group, list);
                 }
                 this.merge(count, group, list) ;
                 count += 1 ;
             }
-            rsVo.obj = group ;
+            rsVo.records = group ;
         }
-        return rsVo ;
+
+        return rsQrVo ;
     }
 
     /**

--
Gitblit v1.8.0