From 2b6cd5a6e64e00b365707468d600085259d2f069 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期五, 27 十二月 2024 16:13:29 +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/StIntakeSv.java | 38 ++++++++++++++++++++++++++++++--------
1 files changed, 30 insertions(+), 8 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 aecf2fa..3d6e9c7 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,9 +5,7 @@
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;
@@ -32,36 +30,60 @@
protected StIntakeAmountYearMapper stIntakeAmountYearDao ;
/**
- * 鏈堢粺璁�---婕忔崯
+ * 鏈堢粺璁�---鍙栨按鍙g敤姘撮噺
*/
@Transactional
protected void statisticsMonth(Integer statisticsYear, Integer statisticsMonth, Long statisticsStartId, Long statisticsEndId){
List<VoIntakeAmountStatistics> list = rmIntakeAmountDayDao.statisticsByIntake(statisticsStartId, statisticsEndId) ;
if(list != null && list.size() > 0){
for(VoIntakeAmountStatistics vo : list){
- StIntakeAmountMonth po = new StIntakeAmountMonth() ;
+ List<StIntakeAmountMonth> listOfMonth = this.stIntakeAmountMonthDao.selectByIntakeIdAndYearAndMonth(vo.intakeId, statisticsYear, statisticsMonth) ;
+ StIntakeAmountMonth po = null ;
+ if(listOfMonth != null && listOfMonth.size() > 0) {
+ //绋嬪簭閫昏緫鎺у埗涓婏紝闆嗗悎涓彧鏈変竴涓璞�
+ po = listOfMonth.get(0);
+ }
+ 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) ;
+ }
}
}
}
/**
- * 骞寸粺璁�---婕忔崯
+ * 骞寸粺璁�---鍙栨按鍙g敤姘撮噺
*/
@Transactional
protected void statisticsYear(Integer statisticsYear){
List<VoIntakeAmountStatistics> list = stIntakeAmountMonthDao.statisticsByIntake(statisticsYear) ;
if(list != null && list.size() > 0){
for(VoIntakeAmountStatistics vo : list){
- StIntakeAmountYear po = new StIntakeAmountYear() ;
+ List<StIntakeAmountYear> listOfYear = stIntakeAmountYearDao.selectByIntakeIdAndYear(vo.intakeId, statisticsYear) ;
+ StIntakeAmountYear po = null ;
+ if(listOfYear != null && listOfYear.size() > 0) {
+ //绋嬪簭閫昏緫鎺у埗涓婏紝闆嗗悎涓彧鏈変竴涓璞�
+ po = listOfYear.get(0);
+ }
+ 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