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 | 37 +++++++++++++++++++++++++++++++------
1 files changed, 31 insertions(+), 6 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..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
@@ -30,37 +30,62 @@
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