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

---
 pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StIntakeSv.java |   25 +++++++++++++++++++++----
 1 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StIntakeSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StIntakeSv.java
index 7118779..0fa3e7e 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StIntakeSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StIntakeSv.java
@@ -5,7 +5,9 @@
 import com.dy.pipIrrGlobal.daoSt.StIntakeAmountYearMapper;
 import com.dy.pipIrrGlobal.pojoSt.StIntakeAmountMonth;
 import com.dy.pipIrrGlobal.pojoSt.StIntakeAmountYear;
+import com.dy.pipIrrGlobal.pojoSt.StLossYear;
 import com.dy.pipIrrGlobal.voSt.VoIntakeAmountStatistics;
+import com.dy.pipIrrGlobal.voSt.VoIntakeLossStatistics;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import org.springframework.transaction.annotation.Transactional;
@@ -37,12 +39,19 @@
         List<VoIntakeAmountStatistics> list = rmIntakeAmountDayDao.statisticsByIntake(statisticsStartId, statisticsEndId) ;
         if(list != null && list.size() > 0){
             for(VoIntakeAmountStatistics vo : list){
-                StIntakeAmountMonth po = new StIntakeAmountMonth() ;
+                StIntakeAmountMonth po = this.stIntakeAmountMonthDao.selectByIntakeIdAndYearAndMonth(vo.intakeId, statisticsYear, statisticsMonth) ;
+                if(po == null){
+                    po = new StIntakeAmountMonth() ;
+                }
                 po.intakeId = vo.intakeId ;
                 po.year = statisticsYear ;
                 po.month = statisticsMonth ;
                 po.amount = vo.amount;
-                stIntakeAmountMonthDao.insert(po) ;
+                if(po.id == null) {
+                    stIntakeAmountMonthDao.insert(po);
+                }else{
+                    stIntakeAmountMonthDao.updateByPrimaryKey(po) ;
+                }
             }
         }
     }
@@ -55,12 +64,20 @@
         List<VoIntakeAmountStatistics> list = stIntakeAmountMonthDao.statisticsByIntake(statisticsYear) ;
         if(list != null && list.size() > 0){
             for(VoIntakeAmountStatistics vo : list){
-                StIntakeAmountYear po = new StIntakeAmountYear() ;
+                StIntakeAmountYear po = stIntakeAmountYearDao.selectByIntakeIdAndYear(vo.intakeId, statisticsYear) ;
+                if(po == null){
+                    po = new StIntakeAmountYear() ;
+                }
                 po.intakeId = vo.intakeId ;
                 po.year = statisticsYear ;
                 po.amount = vo.amount;
-                stIntakeAmountYearDao.insert(po) ;
+                if(po.id == null){
+                    stIntakeAmountYearDao.insert(po) ;
+                }else{
+                    stIntakeAmountYearDao.updateByPrimaryKey(po) ;
+                }
             }
         }
     }
+
 }

--
Gitblit v1.8.0