From d6cfbecac57cf88eb8f63bd9c260e41f49e1e381 Mon Sep 17 00:00:00 2001
From: wuzeyu <1223318623@qq.com>
Date: 星期三, 11 十二月 2024 14:10:31 +0800
Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV

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

diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StClientSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StClientSv.java
index e453ab8..000b497 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StClientSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StClientSv.java
@@ -37,12 +37,19 @@
         List<VoClientAmountStatistics> list = rmClientAmountDayDao.statisticsByClient(statisticsStartId, statisticsEndId) ;
         if(list != null && list.size() > 0){
             for(VoClientAmountStatistics vo : list){
-                StClientAmountMonth po = new StClientAmountMonth() ;
+                StClientAmountMonth po = stClientAmountMonthDao.selectByClientIdAndYearAndMonth(vo.clientId, statisticsYear, statisticsMonth) ;
+                if(po == null) {
+                    po = new StClientAmountMonth();
+                }
                 po.clientId = vo.clientId ;
                 po.year = statisticsYear ;
                 po.month = statisticsMonth ;
                 po.amount = vo.amount;
-                stClientAmountMonthDao.insert(po) ;
+                if(po.id == null) {
+                    stClientAmountMonthDao.insert(po);
+                }else{
+                    stClientAmountMonthDao.updateByPrimaryKey(po) ;
+                }
             }
         }
     }
@@ -55,11 +62,18 @@
         List<VoClientAmountStatistics> list = stClientAmountMonthDao.statisticsByClient(statisticsYear) ;
         if(list != null && list.size() > 0){
             for(VoClientAmountStatistics vo : list){
-                StClientAmountYear po = new StClientAmountYear() ;
+                StClientAmountYear po = stClientAmountYearDao.selectByClientIdAndYear(vo.clientId, statisticsYear) ;
+                if(po == null) {
+                    po = new StClientAmountYear();
+                }
                 po.clientId = vo.clientId ;
                 po.year = statisticsYear ;
                 po.amount = vo.amount;
-                stClientAmountYearDao.insert(po) ;
+                if(po.id == null) {
+                    stClientAmountYearDao.insert(po);
+                }else{
+                    stClientAmountYearDao.updateByPrimaryKey(po) ;
+                }
             }
         }
     }

--
Gitblit v1.8.0