From 94c1624661719ddcb5433accf179c77770ce7d8e Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期四, 26 十二月 2024 17:12:03 +0800
Subject: [PATCH] 1、实现农户IC卡充值日、月、年自动化统计; 2、实现农户充值日、月、年自动化统计。

---
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml                                  |   15 
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoClientConsumeStatistics.java                        |   17 
 pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StConsumeByIcSv.java     |  510 ++++++++++++--------------
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmOpenCloseValveHistoryMapper.java                   |   15 
 pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StConsumeByClientSv.java |  522 ++++++++++++--------------
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoIcConsumeStatistics.java                            |    6 
 6 files changed, 523 insertions(+), 562 deletions(-)

diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmOpenCloseValveHistoryMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmOpenCloseValveHistoryMapper.java
index cffa01f..01dc0fb 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmOpenCloseValveHistoryMapper.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmOpenCloseValveHistoryMapper.java
@@ -351,5 +351,20 @@
     //缁熻鐩稿叧                                //
     //                                      //
     //////////////////////////////////////////
+
+    /**
+     * 浠ュ啘鎴枫�佸啘鎴稩C鍗′负鍗曚綅杩涜缁熻
+     * @param startDt
+     * @param endDt
+     * @return
+     */
     List<VoIcConsumeStatistics> statisticsByIc(@Param("startDt")Date startDt, @Param("endDt")Date endDt);
+
+    /**
+     * 浠ュ啘鎴蜂负鍗曚綅杩涜缁熻
+     * @param startDt
+     * @param endDt
+     * @return
+     */
+    List<VoClientConsumeStatistics> statisticsByClient(@Param("startDt")Date startDt, @Param("endDt")Date endDt);
 }
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoClientConsumeStatistics.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoClientConsumeStatistics.java
new file mode 100644
index 0000000..f1817fc
--- /dev/null
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoClientConsumeStatistics.java
@@ -0,0 +1,17 @@
+package com.dy.pipIrrGlobal.voSt;
+
+import lombok.Data;
+
+/**
+ * @Author: liurunyu
+ * @Date: 2024/12/26 16:40
+ * @Description
+ */
+@Data
+public class VoClientConsumeStatistics {
+    public Long clientId ;
+    public Double water;//鐢ㄦ按閲忥紙m3锛�
+    public Double amount;//鑺辫垂閲戦(鎵h垂)锛堝厓锛�
+    public Integer duration; //鏃堕暱(鍒嗛挓)
+    public Integer times;//鐢ㄦ按娆℃暟
+}
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoIcConsumeStatistics.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoIcConsumeStatistics.java
index a1a7846..0b6bf31 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoIcConsumeStatistics.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoIcConsumeStatistics.java
@@ -11,6 +11,8 @@
 public class VoIcConsumeStatistics {
     public Long clientId ;
     public Long cardId ;
-    public Double amount;//鑺辫垂閲戦(鎵h垂)
-    public Integer times;//鑺辫垂娆℃暟
+    public Double water;//鐢ㄦ按閲忥紙m3锛�
+    public Double amount;//鑺辫垂閲戦(鎵h垂)锛堝厓锛�
+    public Integer duration; //鏃堕暱(鍒嗛挓)
+    public Integer times;//鐢ㄦ按娆℃暟
 }
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml
index 48a5d81..946ed18 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml
@@ -1376,12 +1376,25 @@
     <select id="statisticsByIc" resultType="com.dy.pipIrrGlobal.voSt.VoIcConsumeStatistics">
         select ocvh.client_id as clientId,
         cc.id as cardId,
+        sum(ocvh.cl_this_amount) as water,
         sum(ocvh.cl_this_money) as amount,
+        sum(ocvh.cl_this_time) as duration,
         count(ocvh.id) as times
         from rm_open_close_valve_history ocvh
-        inner join se_client_card cc on cc.cardNum = ocvh.cl_ic_card_no
+        inner join se_client_card cc on CAST(cc.cardNum AS CHAR) = ocvh.cl_ic_card_no
         where ocvh.cl_dt <![CDATA[>=]]> #{startDt, jdbcType=BIGINT}
         and ocvh.cl_dt <![CDATA[<=]]> #{endDt, jdbcType=BIGINT}
         group by ocvh.client_id, cc.id
     </select>
+    <select id="statisticsByClient" resultType="com.dy.pipIrrGlobal.voSt.VoClientConsumeStatistics">
+        select client_id as clientId,
+        sum(cl_this_amount) as water,
+        sum(cl_this_money) as amount,
+        sum(cl_this_time) as duration,
+        count(id) as times
+        from rm_open_close_valve_history
+        where cl_dt <![CDATA[>=]]> #{startDt, jdbcType=BIGINT}
+        and cl_dt <![CDATA[<=]]> #{endDt, jdbcType=BIGINT}
+        group by client_id
+    </select>
 </mapper>
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StConsumeByClientSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StConsumeByClientSv.java
index b411e0a..0062d5e 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StConsumeByClientSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StConsumeByClientSv.java
@@ -7,11 +7,13 @@
 import com.dy.pipIrrGlobal.pojoSt.StConsumeClientDay;
 import com.dy.pipIrrGlobal.pojoSt.StConsumeClientMonth;
 import com.dy.pipIrrGlobal.pojoSt.StConsumeClientYear;
+import com.dy.pipIrrGlobal.voSt.VoClientConsumeStatistics;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.Date;
+import java.util.List;
 
 
 /**
@@ -41,24 +43,24 @@
     @Transactional
     protected void statisticsDay(Integer statisticsYear, Integer statisticsMonth, Integer statisticsDay, Date statisticsStartDt, Date statisticsEndDt){
         //浠ョ敤姘存埛涓哄崟浣嶇粺璁℃煇涓�鏃ョ殑鎵�鏈夊厖鍊艰褰�
-//        List<VoClientConsumeStatistics> list = seConsumeHistoryMapper.statisticsByClient(statisticsStartId, statisticsEndId) ;
-//        if(list != null && list.size() > 0){
-//            for(VoClientConsumeStatistics vo : list){
-//                StConsumeClientDay po = this.stConsumeClientDayMapper.selectByClientAndYearAndMonth(vo.clientId, statisticsYear, statisticsMonth) ;
-//                if(po == null){
-//                    po = new StConsumeClientDay() ;
-//                    po.clientId = vo.clientId ;
-//                    po.year = statisticsYear ;
-//                    po.month = statisticsMonth ;
-//                }
-//                this.setValueOfDayOfMonth(statisticsDay, vo, po);
-//                if(po.id == null) {
-//                    stConsumeClientDayMapper.insert(po);
-//                }else{
-//                    stConsumeClientDayMapper.updateByPrimaryKeySelective(po) ;
-//                }
-//            }
-//        }
+        List<VoClientConsumeStatistics> list = rmOpenCloseValveHistoryMapper.statisticsByClient(statisticsStartDt, statisticsEndDt) ;
+        if(list != null && list.size() > 0){
+            for(VoClientConsumeStatistics vo : list){
+                StConsumeClientDay po = this.stConsumeClientDayMapper.selectByClientAndYearAndMonth(vo.clientId, statisticsYear, statisticsMonth) ;
+                if(po == null){
+                    po = new StConsumeClientDay() ;
+                    po.clientId = vo.clientId ;
+                    po.year = statisticsYear ;
+                    po.month = statisticsMonth ;
+                }
+                this.setValueOfDayOfMonth(statisticsDay, vo, po);
+                if(po.id == null) {
+                    stConsumeClientDayMapper.insert(po);
+                }else{
+                    stConsumeClientDayMapper.updateByPrimaryKeySelective(po) ;
+                }
+            }
+        }
     }
 
     /**
@@ -67,23 +69,23 @@
     @Transactional
     protected void statisticsMonth(Integer statisticsYear, Integer statisticsMonth){
         //浠ョ敤姘存埛涓哄崟浣嶇粺璁℃煇涓�鏈堢殑鎵�鏈夊厖鍊艰褰�
-//        List<VoClientConsumeStatistics> list = stConsumeClientDayMapper.statisticsByClient(statisticsYear, statisticsMonth) ;
-//        if(list != null && list.size() > 0){
-//            for(VoClientConsumeStatistics vo : list){
-//                StConsumeClientMonth po = this.stConsumeClientMonthMapper.selectByClientAndYear(vo.clientId, statisticsYear) ;
-//                if(po == null){
-//                    po = new StConsumeClientMonth() ;
-//                    po.clientId = vo.clientId ;
-//                    po.year = statisticsYear ;
-//                }
-//                this.setValueOfMonthOfYear(statisticsMonth, vo, po);
-//                if(po.id == null) {
-//                    stConsumeClientMonthMapper.insert(po);
-//                }else{
-//                    stConsumeClientMonthMapper.updateByPrimaryKeySelective(po) ;
-//                }
-//            }
-//        }
+        List<VoClientConsumeStatistics> list = stConsumeClientDayMapper.statisticsByClient(statisticsYear, statisticsMonth) ;
+        if(list != null && list.size() > 0){
+            for(VoClientConsumeStatistics vo : list){
+                StConsumeClientMonth po = this.stConsumeClientMonthMapper.selectByClientAndYear(vo.clientId, statisticsYear) ;
+                if(po == null){
+                    po = new StConsumeClientMonth() ;
+                    po.clientId = vo.clientId ;
+                    po.year = statisticsYear ;
+                }
+                this.setValueOfMonthOfYear(statisticsMonth, vo, po);
+                if(po.id == null) {
+                    stConsumeClientMonthMapper.insert(po);
+                }else{
+                    stConsumeClientMonthMapper.updateByPrimaryKeySelective(po) ;
+                }
+            }
+        }
     }
 
     /**
@@ -92,253 +94,209 @@
     @Transactional
     protected void statisticsYear(Integer statisticsYear){
         //浠ョ敤姘存埛涓哄崟浣嶇粺璁℃煇涓�骞寸殑鎵�鏈夊厖鍊艰褰�
-//        List<VoClientConsumeStatistics> list = stConsumeClientMonthMapper.statisticsByClient(statisticsYear) ;
-//        if(list != null && list.size() > 0){
-//            for(VoClientConsumeStatistics vo : list){
-//                StConsumeClientYear po = this.stConsumeClientYearMapper.selectByClientAndYear(vo.clientId, statisticsYear) ;
-//                if(po == null){
-//                    po = new StConsumeClientYear() ;
-//                    po.clientId = vo.clientId ;
-//                    po.year = statisticsYear ;
-//                }
-//                this.setValueOfYear(vo, po);
-//                if(po.id == null) {
-//                    stConsumeClientYearMapper.insert(po);
-//                }else{
-//                    stConsumeClientYearMapper.updateByPrimaryKeySelective(po) ;
-//                }
-//            }
-//        }
+        List<VoClientConsumeStatistics> list = stConsumeClientMonthMapper.statisticsByClient(statisticsYear) ;
+        if(list != null && list.size() > 0){
+            for(VoClientConsumeStatistics vo : list){
+                StConsumeClientYear po = this.stConsumeClientYearMapper.selectByClientAndYear(vo.clientId, statisticsYear) ;
+                if(po == null){
+                    po = new StConsumeClientYear() ;
+                    po.clientId = vo.clientId ;
+                    po.year = statisticsYear ;
+                }
+                this.setValueOfYear(vo, po);
+                if(po.id == null) {
+                    stConsumeClientYearMapper.insert(po);
+                }else{
+                    stConsumeClientYearMapper.updateByPrimaryKeySelective(po) ;
+                }
+            }
+        }
     }
 
-//    private void setValueOfDayOfMonth(Integer statisticsDay, VoClientConsumeStatistics vo, StConsumeClientDay po){
-//        switch (statisticsDay) {
-//            case 1:
-//                po.amount1 = vo.amount;
-//                po.gift1 = vo.gift;
-//                po.times1 = vo.times;
-//                break;
-//            case 2:
-//                po.amount2 = vo.amount;
-//                po.gift2 = vo.gift;
-//                po.times2 = vo.times;
-//                break;
-//            case 3:
-//                po.amount3 = vo.amount;
-//                po.gift3 = vo.gift;
-//                po.times3 = vo.times;
-//                break;
-//            case 4:
-//                po.amount4 = vo.amount;
-//                po.gift4 = vo.gift;
-//                po.times4 = vo.times;
-//                break;
-//            case 5:
-//                po.amount5 = vo.amount;
-//                po.gift5 = vo.gift;
-//                po.times5 = vo.times;
-//                break;
-//            case 6:
-//                po.amount6 = vo.amount;
-//                po.gift6 = vo.gift;
-//                po.times6 = vo.times;
-//                break;
-//            case 7:
-//                po.amount7 = vo.amount;
-//                po.gift7 = vo.gift;
-//                po.times7 = vo.times;
-//                break;
-//            case 8:
-//                po.amount8 = vo.amount;
-//                po.gift8 = vo.gift;
-//                po.times8 = vo.times;
-//                break;
-//            case 9:
-//                po.amount9 = vo.amount;
-//                po.gift9 = vo.gift;
-//                po.times9 = vo.times;
-//                break;
-//            case 10:
-//                po.amount10 = vo.amount;
-//                po.gift10 = vo.gift;
-//                po.times10 = vo.times;
-//                break;
-//            case 11:
-//                po.amount11 = vo.amount;
-//                po.gift11 = vo.gift;
-//                po.times11 = vo.times;
-//                break;
-//            case 12:
-//                po.amount12 = vo.amount;
-//                po.gift12 = vo.gift;
-//                po.times12 = vo.times;
-//                break;
-//            case 13:
-//                po.amount13 = vo.amount;
-//                po.gift13 = vo.gift;
-//                po.times13 = vo.times;
-//                break;
-//            case 14:
-//                po.amount14 = vo.amount;
-//                po.gift14 = vo.gift;
-//                po.times14 = vo.times;
-//                break;
-//            case 15:
-//                po.amount15 = vo.amount;
-//                po.gift15 = vo.gift;
-//                po.times15 = vo.times;
-//                break;
-//            case 16:
-//                po.amount16 = vo.amount;
-//                po.gift16 = vo.gift;
-//                po.times16 = vo.times;
-//                break;
-//            case 17:
-//                po.amount17 = vo.amount;
-//                po.gift17 = vo.gift;
-//                po.times17 = vo.times;
-//                break;
-//            case 18:
-//                po.amount18 = vo.amount;
-//                po.gift18 = vo.gift;
-//                po.times18 = vo.times;
-//                break;
-//            case 19:
-//                po.amount19 = vo.amount;
-//                po.gift19 = vo.gift;
-//                po.times19 = vo.times;
-//                break;
-//            case 20:
-//                po.amount20 = vo.amount;
-//                po.gift20 = vo.gift;
-//                po.times20 = vo.times;
-//                break;
-//            case 21:
-//                po.amount21 = vo.amount;
-//                po.gift21 = vo.gift;
-//                po.times21 = vo.times;
-//                break;
-//            case 22:
-//                po.amount22 = vo.amount;
-//                po.gift22 = vo.gift;
-//                po.times22 = vo.times;
-//                break;
-//            case 23:
-//                po.amount23 = vo.amount;
-//                po.gift23 = vo.gift;
-//                po.times23 = vo.times;
-//                break;
-//            case 24:
-//                po.amount24 = vo.amount;
-//                po.gift24 = vo.gift;
-//                po.times24 = vo.times;
-//                break;
-//            case 25:
-//                po.amount25 = vo.amount;
-//                po.gift25 = vo.gift;
-//                po.times25 = vo.times;
-//                break;
-//            case 26:
-//                po.amount26 = vo.amount;
-//                po.gift26 = vo.gift;
-//                po.times26 = vo.times;
-//                break;
-//            case 27:
-//                po.amount27 = vo.amount;
-//                po.gift27 = vo.gift;
-//                po.times27 = vo.times;
-//                break;
-//            case 28:
-//                po.amount28 = vo.amount;
-//                po.gift28 = vo.gift;
-//                po.times28 = vo.times;
-//                break;
-//            case 29:
-//                po.amount29 = vo.amount;
-//                po.gift29 = vo.gift;
-//                po.times29 = vo.times;
-//                break;
-//            case 30:
-//                po.amount30 = vo.amount;
-//                po.gift30 = vo.gift;
-//                po.times30 = vo.times;
-//                break;
-//            case 31:
-//                po.amount31 = vo.amount;
-//                po.gift31 = vo.gift;
-//                po.times31 = vo.times;
-//                break;
-//        }
-//    }
-//
-//    private void setValueOfMonthOfYear(Integer statisticsMonth, VoClientConsumeStatistics vo, StConsumeClientMonth po){
-//        switch (statisticsMonth) {
-//            case 1:
-//                po.amount1 = vo.amount;
-//                po.gift1 = vo.gift;
-//                po.times1 = vo.times;
-//                break;
-//            case 2:
-//                po.amount2 = vo.amount;
-//                po.gift2 = vo.gift;
-//                po.times2 = vo.times;
-//                break;
-//            case 3:
-//                po.amount3 = vo.amount;
-//                po.gift3 = vo.gift;
-//                po.times3 = vo.times;
-//                break;
-//            case 4:
-//                po.amount4 = vo.amount;
-//                po.gift4 = vo.gift;
-//                po.times4 = vo.times;
-//                break;
-//            case 5:
-//                po.amount5 = vo.amount;
-//                po.gift5 = vo.gift;
-//                po.times5 = vo.times;
-//                break;
-//            case 6:
-//                po.amount6 = vo.amount;
-//                po.gift6 = vo.gift;
-//                po.times6 = vo.times;
-//                break;
-//            case 7:
-//                po.amount7 = vo.amount;
-//                po.gift7 = vo.gift;
-//                po.times7 = vo.times;
-//                break;
-//            case 8:
-//                po.amount8 = vo.amount;
-//                po.gift8 = vo.gift;
-//                po.times8 = vo.times;
-//                break;
-//            case 9:
-//                po.amount9 = vo.amount;
-//                po.gift9 = vo.gift;
-//                po.times9 = vo.times;
-//                break;
-//            case 10:
-//                po.amount10 = vo.amount;
-//                po.gift10 = vo.gift;
-//                po.times10 = vo.times;
-//                break;
-//            case 11:
-//                po.amount11 = vo.amount;
-//                po.gift11 = vo.gift;
-//                po.times11 = vo.times;
-//                break;
-//            case 12:
-//                po.amount12 = vo.amount;
-//                po.gift12 = vo.gift;
-//                po.times12 = vo.times;
-//                break;
-//        }
-//    }
-//
-//    private void setValueOfYear(VoClientConsumeStatistics vo, StConsumeClientYear po){
-//        po.amount = vo.amount;
-//        po.gift = vo.gift;
-//        po.times = vo.times;
-//    }
+    private void setValueOfDayOfMonth(Integer statisticsDay, VoClientConsumeStatistics vo, StConsumeClientDay po){
+        switch (statisticsDay) {
+            case 1:
+                po.amount1 = vo.amount;
+                po.times1 = vo.times;
+                break;
+            case 2:
+                po.amount2 = vo.amount;
+                po.times2 = vo.times;
+                break;
+            case 3:
+                po.amount3 = vo.amount;
+                po.times3 = vo.times;
+                break;
+            case 4:
+                po.amount4 = vo.amount;
+                po.times4 = vo.times;
+                break;
+            case 5:
+                po.amount5 = vo.amount;
+                po.times5 = vo.times;
+                break;
+            case 6:
+                po.amount6 = vo.amount;
+                po.times6 = vo.times;
+                break;
+            case 7:
+                po.amount7 = vo.amount;
+                po.times7 = vo.times;
+                break;
+            case 8:
+                po.amount8 = vo.amount;
+                po.times8 = vo.times;
+                break;
+            case 9:
+                po.amount9 = vo.amount;
+                po.times9 = vo.times;
+                break;
+            case 10:
+                po.amount10 = vo.amount;
+                po.times10 = vo.times;
+                break;
+            case 11:
+                po.amount11 = vo.amount;
+                po.times11 = vo.times;
+                break;
+            case 12:
+                po.amount12 = vo.amount;
+                po.times12 = vo.times;
+                break;
+            case 13:
+                po.amount13 = vo.amount;
+                po.times13 = vo.times;
+                break;
+            case 14:
+                po.amount14 = vo.amount;
+                po.times14 = vo.times;
+                break;
+            case 15:
+                po.amount15 = vo.amount;
+                po.times15 = vo.times;
+                break;
+            case 16:
+                po.amount16 = vo.amount;
+                po.times16 = vo.times;
+                break;
+            case 17:
+                po.amount17 = vo.amount;
+                po.times17 = vo.times;
+                break;
+            case 18:
+                po.amount18 = vo.amount;
+                po.times18 = vo.times;
+                break;
+            case 19:
+                po.amount19 = vo.amount;
+                po.times19 = vo.times;
+                break;
+            case 20:
+                po.amount20 = vo.amount;
+                po.times20 = vo.times;
+                break;
+            case 21:
+                po.amount21 = vo.amount;
+                po.times21 = vo.times;
+                break;
+            case 22:
+                po.amount22 = vo.amount;
+                po.times22 = vo.times;
+                break;
+            case 23:
+                po.amount23 = vo.amount;
+                po.times23 = vo.times;
+                break;
+            case 24:
+                po.amount24 = vo.amount;
+                po.times24 = vo.times;
+                break;
+            case 25:
+                po.amount25 = vo.amount;
+                po.times25 = vo.times;
+                break;
+            case 26:
+                po.amount26 = vo.amount;
+                po.times26 = vo.times;
+                break;
+            case 27:
+                po.amount27 = vo.amount;
+                po.times27 = vo.times;
+                break;
+            case 28:
+                po.amount28 = vo.amount;
+                po.times28 = vo.times;
+                break;
+            case 29:
+                po.amount29 = vo.amount;
+                po.times29 = vo.times;
+                break;
+            case 30:
+                po.amount30 = vo.amount;
+                po.times30 = vo.times;
+                break;
+            case 31:
+                po.amount31 = vo.amount;
+                po.times31 = vo.times;
+                break;
+        }
+    }
+
+    private void setValueOfMonthOfYear(Integer statisticsMonth, VoClientConsumeStatistics vo, StConsumeClientMonth po){
+        switch (statisticsMonth) {
+            case 1:
+                po.amount1 = vo.amount;
+                po.times1 = vo.times;
+                break;
+            case 2:
+                po.amount2 = vo.amount;
+                po.times2 = vo.times;
+                break;
+            case 3:
+                po.amount3 = vo.amount;
+                po.times3 = vo.times;
+                break;
+            case 4:
+                po.amount4 = vo.amount;
+                po.times4 = vo.times;
+                break;
+            case 5:
+                po.amount5 = vo.amount;
+                po.times5 = vo.times;
+                break;
+            case 6:
+                po.amount6 = vo.amount;
+                po.times6 = vo.times;
+                break;
+            case 7:
+                po.amount7 = vo.amount;
+                po.times7 = vo.times;
+                break;
+            case 8:
+                po.amount8 = vo.amount;
+                po.times8 = vo.times;
+                break;
+            case 9:
+                po.amount9 = vo.amount;
+                po.times9 = vo.times;
+                break;
+            case 10:
+                po.amount10 = vo.amount;
+                po.times10 = vo.times;
+                break;
+            case 11:
+                po.amount11 = vo.amount;
+                po.times11 = vo.times;
+                break;
+            case 12:
+                po.amount12 = vo.amount;
+                po.times12 = vo.times;
+                break;
+        }
+    }
+
+    private void setValueOfYear(VoClientConsumeStatistics vo, StConsumeClientYear po){
+        po.amount = vo.amount;
+        po.times = vo.times;
+    }
 }
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StConsumeByIcSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StConsumeByIcSv.java
index a45c2ef..24775a4 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StConsumeByIcSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StConsumeByIcSv.java
@@ -43,25 +43,25 @@
     @Transactional
     protected void statisticsDay(Integer statisticsYear, Integer statisticsMonth, Integer statisticsDay, Date statisticsStartDt, Date statisticsEndDt){
         //浠ョ敤姘存埛鍜孖C涓哄崟浣嶇粺璁℃煇涓�鏃ョ殑鎵�鏈夊厖鍊艰褰�
-//        List<VoIcConsumeStatistics> list = rmOpenCloseValveHistoryMapper.statisticsByIc(statisticsStartDt, statisticsEndDt) ;
-//        if(list != null && list.size() > 0){
-//            for(VoIcConsumeStatistics vo : list){
-//                StConsumeIcDay po = this.stConsumeIcDayMapper.selectByClientAndCardAndYearAndMonth(vo.clientId, vo.cardId, statisticsYear, statisticsMonth) ;
-//                if(po == null){
-//                    po = new StConsumeIcDay() ;
-//                    po.clientId = vo.clientId ;
-//                    po.cardId = vo.cardId ;
-//                    po.year = statisticsYear ;
-//                    po.month = statisticsMonth ;
-//                }
-//                this.setValueOfDayOfMonth(statisticsDay, vo, po);
-//                if(po.id == null) {
-//                    stConsumeIcDayMapper.insert(po);
-//                }else{
-//                    stConsumeIcDayMapper.updateByPrimaryKeySelective(po) ;
-//                }
-//            }
-//        }
+        List<VoIcConsumeStatistics> list = rmOpenCloseValveHistoryMapper.statisticsByIc(statisticsStartDt, statisticsEndDt) ;
+        if(list != null && list.size() > 0){
+            for(VoIcConsumeStatistics vo : list){
+                StConsumeIcDay po = this.stConsumeIcDayMapper.selectByClientAndCardAndYearAndMonth(vo.clientId, vo.cardId, statisticsYear, statisticsMonth) ;
+                if(po == null){
+                    po = new StConsumeIcDay() ;
+                    po.clientId = vo.clientId ;
+                    po.cardId = vo.cardId ;
+                    po.year = statisticsYear ;
+                    po.month = statisticsMonth ;
+                }
+                this.setValueOfDayOfMonth(statisticsDay, vo, po);
+                if(po.id == null) {
+                    stConsumeIcDayMapper.insert(po);
+                }else{
+                    stConsumeIcDayMapper.updateByPrimaryKeySelective(po) ;
+                }
+            }
+        }
     }
 
     /**
@@ -70,24 +70,24 @@
     @Transactional
     protected void statisticsMonth(Integer statisticsYear, Integer statisticsMonth){
         //浠ョ敤姘存埛鍜孖C涓哄崟浣嶇粺璁℃煇涓�鏈堢殑鎵�鏈夊厖鍊艰褰�
-//        List<VoIcConsumeStatistics> list = stConsumeIcDayMapper.statisticsByIc(statisticsYear, statisticsMonth) ;
-//        if(list != null && list.size() > 0){
-//            for(VoIcConsumeStatistics vo : list){
-//                StConsumeIcMonth po = this.stConsumeIcMonthMapper.selectByClientAndCardAndYear(vo.clientId, vo.cardId, statisticsYear) ;
-//                if(po == null){
-//                    po = new StConsumeIcMonth() ;
-//                    po.clientId = vo.clientId ;
-//                    po.cardId = vo.cardId ;
-//                    po.year = statisticsYear ;
-//                }
-//                this.setValueOfMonthOfYear(statisticsMonth, vo, po);
-//                if(po.id == null) {
-//                    stConsumeIcMonthMapper.insert(po);
-//                }else{
-//                    stConsumeIcMonthMapper.updateByPrimaryKeySelective(po) ;
-//                }
-//            }
-//        }
+        List<VoIcConsumeStatistics> list = stConsumeIcDayMapper.statisticsByIc(statisticsYear, statisticsMonth) ;
+        if(list != null && list.size() > 0){
+            for(VoIcConsumeStatistics vo : list){
+                StConsumeIcMonth po = this.stConsumeIcMonthMapper.selectByClientAndCardAndYear(vo.clientId, vo.cardId, statisticsYear) ;
+                if(po == null){
+                    po = new StConsumeIcMonth() ;
+                    po.clientId = vo.clientId ;
+                    po.cardId = vo.cardId ;
+                    po.year = statisticsYear ;
+                }
+                this.setValueOfMonthOfYear(statisticsMonth, vo, po);
+                if(po.id == null) {
+                    stConsumeIcMonthMapper.insert(po);
+                }else{
+                    stConsumeIcMonthMapper.updateByPrimaryKeySelective(po) ;
+                }
+            }
+        }
     }
 
     /**
@@ -96,254 +96,210 @@
     @Transactional
     protected void statisticsYear(Integer statisticsYear){
         //浠ョ敤姘存埛鍜孖C涓哄崟浣嶇粺璁℃煇涓�骞寸殑鎵�鏈夊厖鍊艰褰�
-//        List<VoIcConsumeStatistics> list = stConsumeIcMonthMapper.statisticsByIc(statisticsYear) ;
-//        if(list != null && list.size() > 0){
-//            for(VoIcConsumeStatistics vo : list){
-//                StConsumeIcYear po = this.stConsumeIcYearMapper.selectByClientAndCardAndYear(vo.clientId, vo.cardId, statisticsYear) ;
-//                if(po == null){
-//                    po = new StConsumeIcYear() ;
-//                    po.clientId = vo.clientId ;
-//                    po.cardId = vo.cardId ;
-//                    po.year = statisticsYear ;
-//                }
-//                this.setValueOfYear(vo, po);
-//                if(po.id == null) {
-//                    stConsumeIcYearMapper.insert(po);
-//                }else{
-//                    stConsumeIcYearMapper.updateByPrimaryKeySelective(po) ;
-//                }
-//            }
-//        }
+        List<VoIcConsumeStatistics> list = stConsumeIcMonthMapper.statisticsByIc(statisticsYear) ;
+        if(list != null && list.size() > 0){
+            for(VoIcConsumeStatistics vo : list){
+                StConsumeIcYear po = this.stConsumeIcYearMapper.selectByClientAndCardAndYear(vo.clientId, vo.cardId, statisticsYear) ;
+                if(po == null){
+                    po = new StConsumeIcYear() ;
+                    po.clientId = vo.clientId ;
+                    po.cardId = vo.cardId ;
+                    po.year = statisticsYear ;
+                }
+                this.setValueOfYear(vo, po);
+                if(po.id == null) {
+                    stConsumeIcYearMapper.insert(po);
+                }else{
+                    stConsumeIcYearMapper.updateByPrimaryKeySelective(po) ;
+                }
+            }
+        }
     }
 
     private void setValueOfDayOfMonth(Integer statisticsDay, VoIcConsumeStatistics vo, StConsumeIcDay po){
-//        switch (statisticsDay) {
-//            case 1:
-//                po.amount1 = vo.amount;
-//                po.gift1 = vo.gift;
-//                po.times1 = vo.times;
-//                break;
-//            case 2:
-//                po.amount2 = vo.amount;
-//                po.gift2 = vo.gift;
-//                po.times2 = vo.times;
-//                break;
-//            case 3:
-//                po.amount3 = vo.amount;
-//                po.gift3 = vo.gift;
-//                po.times3 = vo.times;
-//                break;
-//            case 4:
-//                po.amount4 = vo.amount;
-//                po.gift4 = vo.gift;
-//                po.times4 = vo.times;
-//                break;
-//            case 5:
-//                po.amount5 = vo.amount;
-//                po.gift5 = vo.gift;
-//                po.times5 = vo.times;
-//                break;
-//            case 6:
-//                po.amount6 = vo.amount;
-//                po.gift6 = vo.gift;
-//                po.times6 = vo.times;
-//                break;
-//            case 7:
-//                po.amount7 = vo.amount;
-//                po.gift7 = vo.gift;
-//                po.times7 = vo.times;
-//                break;
-//            case 8:
-//                po.amount8 = vo.amount;
-//                po.gift8 = vo.gift;
-//                po.times8 = vo.times;
-//                break;
-//            case 9:
-//                po.amount9 = vo.amount;
-//                po.gift9 = vo.gift;
-//                po.times9 = vo.times;
-//                break;
-//            case 10:
-//                po.amount10 = vo.amount;
-//                po.gift10 = vo.gift;
-//                po.times10 = vo.times;
-//                break;
-//            case 11:
-//                po.amount11 = vo.amount;
-//                po.gift11 = vo.gift;
-//                po.times11 = vo.times;
-//                break;
-//            case 12:
-//                po.amount12 = vo.amount;
-//                po.gift12 = vo.gift;
-//                po.times12 = vo.times;
-//                break;
-//            case 13:
-//                po.amount13 = vo.amount;
-//                po.gift13 = vo.gift;
-//                po.times13 = vo.times;
-//                break;
-//            case 14:
-//                po.amount14 = vo.amount;
-//                po.gift14 = vo.gift;
-//                po.times14 = vo.times;
-//                break;
-//            case 15:
-//                po.amount15 = vo.amount;
-//                po.gift15 = vo.gift;
-//                po.times15 = vo.times;
-//                break;
-//            case 16:
-//                po.amount16 = vo.amount;
-//                po.gift16 = vo.gift;
-//                po.times16 = vo.times;
-//                break;
-//            case 17:
-//                po.amount17 = vo.amount;
-//                po.gift17 = vo.gift;
-//                po.times17 = vo.times;
-//                break;
-//            case 18:
-//                po.amount18 = vo.amount;
-//                po.gift18 = vo.gift;
-//                po.times18 = vo.times;
-//                break;
-//            case 19:
-//                po.amount19 = vo.amount;
-//                po.gift19 = vo.gift;
-//                po.times19 = vo.times;
-//                break;
-//            case 20:
-//                po.amount20 = vo.amount;
-//                po.gift20 = vo.gift;
-//                po.times20 = vo.times;
-//                break;
-//            case 21:
-//                po.amount21 = vo.amount;
-//                po.gift21 = vo.gift;
-//                po.times21 = vo.times;
-//                break;
-//            case 22:
-//                po.amount22 = vo.amount;
-//                po.gift22 = vo.gift;
-//                po.times22 = vo.times;
-//                break;
-//            case 23:
-//                po.amount23 = vo.amount;
-//                po.gift23 = vo.gift;
-//                po.times23 = vo.times;
-//                break;
-//            case 24:
-//                po.amount24 = vo.amount;
-//                po.gift24 = vo.gift;
-//                po.times24 = vo.times;
-//                break;
-//            case 25:
-//                po.amount25 = vo.amount;
-//                po.gift25 = vo.gift;
-//                po.times25 = vo.times;
-//                break;
-//            case 26:
-//                po.amount26 = vo.amount;
-//                po.gift26 = vo.gift;
-//                po.times26 = vo.times;
-//                break;
-//            case 27:
-//                po.amount27 = vo.amount;
-//                po.gift27 = vo.gift;
-//                po.times27 = vo.times;
-//                break;
-//            case 28:
-//                po.amount28 = vo.amount;
-//                po.gift28 = vo.gift;
-//                po.times28 = vo.times;
-//                break;
-//            case 29:
-//                po.amount29 = vo.amount;
-//                po.gift29 = vo.gift;
-//                po.times29 = vo.times;
-//                break;
-//            case 30:
-//                po.amount30 = vo.amount;
-//                po.gift30 = vo.gift;
-//                po.times30 = vo.times;
-//                break;
-//            case 31:
-//                po.amount31 = vo.amount;
-//                po.gift31 = vo.gift;
-//                po.times31 = vo.times;
-//                break;
-//        }
+        switch (statisticsDay) {
+            case 1:
+                po.amount1 = vo.amount;
+                po.times1 = vo.times;
+                break;
+            case 2:
+                po.amount2 = vo.amount;
+                po.times2 = vo.times;
+                break;
+            case 3:
+                po.amount3 = vo.amount;
+                po.times3 = vo.times;
+                break;
+            case 4:
+                po.amount4 = vo.amount;
+                po.times4 = vo.times;
+                break;
+            case 5:
+                po.amount5 = vo.amount;
+                po.times5 = vo.times;
+                break;
+            case 6:
+                po.amount6 = vo.amount;
+                po.times6 = vo.times;
+                break;
+            case 7:
+                po.amount7 = vo.amount;
+                po.times7 = vo.times;
+                break;
+            case 8:
+                po.amount8 = vo.amount;
+                po.times8 = vo.times;
+                break;
+            case 9:
+                po.amount9 = vo.amount;
+                po.times9 = vo.times;
+                break;
+            case 10:
+                po.amount10 = vo.amount;
+                po.times10 = vo.times;
+                break;
+            case 11:
+                po.amount11 = vo.amount;
+                po.times11 = vo.times;
+                break;
+            case 12:
+                po.amount12 = vo.amount;
+                po.times12 = vo.times;
+                break;
+            case 13:
+                po.amount13 = vo.amount;
+                po.times13 = vo.times;
+                break;
+            case 14:
+                po.amount14 = vo.amount;
+                po.times14 = vo.times;
+                break;
+            case 15:
+                po.amount15 = vo.amount;
+                po.times15 = vo.times;
+                break;
+            case 16:
+                po.amount16 = vo.amount;
+                po.times16 = vo.times;
+                break;
+            case 17:
+                po.amount17 = vo.amount;
+                po.times17 = vo.times;
+                break;
+            case 18:
+                po.amount18 = vo.amount;
+                po.times18 = vo.times;
+                break;
+            case 19:
+                po.amount19 = vo.amount;
+                po.times19 = vo.times;
+                break;
+            case 20:
+                po.amount20 = vo.amount;
+                po.times20 = vo.times;
+                break;
+            case 21:
+                po.amount21 = vo.amount;
+                po.times21 = vo.times;
+                break;
+            case 22:
+                po.amount22 = vo.amount;
+                po.times22 = vo.times;
+                break;
+            case 23:
+                po.amount23 = vo.amount;
+                po.times23 = vo.times;
+                break;
+            case 24:
+                po.amount24 = vo.amount;
+                po.times24 = vo.times;
+                break;
+            case 25:
+                po.amount25 = vo.amount;
+                po.times25 = vo.times;
+                break;
+            case 26:
+                po.amount26 = vo.amount;
+                po.times26 = vo.times;
+                break;
+            case 27:
+                po.amount27 = vo.amount;
+                po.times27 = vo.times;
+                break;
+            case 28:
+                po.amount28 = vo.amount;
+                po.times28 = vo.times;
+                break;
+            case 29:
+                po.amount29 = vo.amount;
+                po.times29 = vo.times;
+                break;
+            case 30:
+                po.amount30 = vo.amount;
+                po.times30 = vo.times;
+                break;
+            case 31:
+                po.amount31 = vo.amount;
+                po.times31 = vo.times;
+                break;
+        }
     }
 
     private void setValueOfMonthOfYear(Integer statisticsMonth, VoIcConsumeStatistics vo, StConsumeIcMonth po){
-//        switch (statisticsMonth) {
-//            case 1:
-//                po.amount1 = vo.amount;
-//                po.gift1 = vo.gift;
-//                po.times1 = vo.times;
-//                break;
-//            case 2:
-//                po.amount2 = vo.amount;
-//                po.gift2 = vo.gift;
-//                po.times2 = vo.times;
-//                break;
-//            case 3:
-//                po.amount3 = vo.amount;
-//                po.gift3 = vo.gift;
-//                po.times3 = vo.times;
-//                break;
-//            case 4:
-//                po.amount4 = vo.amount;
-//                po.gift4 = vo.gift;
-//                po.times4 = vo.times;
-//                break;
-//            case 5:
-//                po.amount5 = vo.amount;
-//                po.gift5 = vo.gift;
-//                po.times5 = vo.times;
-//                break;
-//            case 6:
-//                po.amount6 = vo.amount;
-//                po.gift6 = vo.gift;
-//                po.times6 = vo.times;
-//                break;
-//            case 7:
-//                po.amount7 = vo.amount;
-//                po.gift7 = vo.gift;
-//                po.times7 = vo.times;
-//                break;
-//            case 8:
-//                po.amount8 = vo.amount;
-//                po.gift8 = vo.gift;
-//                po.times8 = vo.times;
-//                break;
-//            case 9:
-//                po.amount9 = vo.amount;
-//                po.gift9 = vo.gift;
-//                po.times9 = vo.times;
-//                break;
-//            case 10:
-//                po.amount10 = vo.amount;
-//                po.gift10 = vo.gift;
-//                po.times10 = vo.times;
-//                break;
-//            case 11:
-//                po.amount11 = vo.amount;
-//                po.gift11 = vo.gift;
-//                po.times11 = vo.times;
-//                break;
-//            case 12:
-//                po.amount12 = vo.amount;
-//                po.gift12 = vo.gift;
-//                po.times12 = vo.times;
-//                break;
-//        }
+        switch (statisticsMonth) {
+            case 1:
+                po.amount1 = vo.amount;
+                po.times1 = vo.times;
+                break;
+            case 2:
+                po.amount2 = vo.amount;
+                po.times2 = vo.times;
+                break;
+            case 3:
+                po.amount3 = vo.amount;
+                po.times3 = vo.times;
+                break;
+            case 4:
+                po.amount4 = vo.amount;
+                po.times4 = vo.times;
+                break;
+            case 5:
+                po.amount5 = vo.amount;
+                po.times5 = vo.times;
+                break;
+            case 6:
+                po.amount6 = vo.amount;
+                po.times6 = vo.times;
+                break;
+            case 7:
+                po.amount7 = vo.amount;
+                po.times7 = vo.times;
+                break;
+            case 8:
+                po.amount8 = vo.amount;
+                po.times8 = vo.times;
+                break;
+            case 9:
+                po.amount9 = vo.amount;
+                po.times9 = vo.times;
+                break;
+            case 10:
+                po.amount10 = vo.amount;
+                po.times10 = vo.times;
+                break;
+            case 11:
+                po.amount11 = vo.amount;
+                po.times11 = vo.times;
+                break;
+            case 12:
+                po.amount12 = vo.amount;
+                po.times12 = vo.times;
+                break;
+        }
     }
 
     private void setValueOfYear(VoIcConsumeStatistics vo, StConsumeIcYear po){
-//        po.amount = vo.amount;
-//        po.gift = vo.gift;
-//        po.times = vo.times;
+        po.amount = vo.amount;
+        po.times = vo.times;
     }
 }

--
Gitblit v1.8.0