From 352166b90fa119725cd54bba314216801e92a037 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期二, 24 十二月 2024 10:13:49 +0800
Subject: [PATCH] 取水漏损日月度统计数量不正确,编程进行修改调整
---
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByIc.java | 52 ++++
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StatisticsJob.java | 2
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoTmp/ChangeMapper.java | 64 +++++
pipIrr-platform/pipIrr-global/src/main/resources/mapper/Temp4ChangeMapper.xml | 94 +++++++
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByIcSv.java | 66 +++++
pipIrr-platform/pipIrr-web/pipIrr-web-temp/说明.txt | 15 +
pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/changeSome/ChSomeIntakeLossSv.java | 188 +++++++++++++++
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByClientSv.java | 66 +++++
pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/changeSome/ChSomeCtrl.java | 60 +++++
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByClient.java | 52 ++++
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoRm/RmIntakeAmountDay.java | 4
11 files changed, 657 insertions(+), 6 deletions(-)
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoTmp/ChangeMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoTmp/ChangeMapper.java
index 8c7af33..64d3e8c 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoTmp/ChangeMapper.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoTmp/ChangeMapper.java
@@ -2,8 +2,11 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dy.pipIrrGlobal.pojoRm.RmIntakeAmountDay;
+import com.dy.pipIrrGlobal.pojoRm.RmLossDay;
import com.dy.pipIrrGlobal.pojoSt.StIntakeAmountMonth;
import com.dy.pipIrrGlobal.pojoSt.StIntakeAmountYear;
+import com.dy.pipIrrGlobal.pojoSt.StLossMonth;
+import com.dy.pipIrrGlobal.pojoSt.StLossYear;
import com.dy.pipIrrGlobal.voSt.VoIntake;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@@ -85,4 +88,65 @@
int saveOneIntakeAmountYear(StIntakeAmountYear pojo);
+ ////////////////////////////////////////
+ //
+ //婕忔崯鐩稿叧
+ //
+ ////////////////////////////////////////
+
+ /**
+ * 鏌ヨ涓�涓彇姘村彛鐨勬棩婕忔崯閲忕粺璁¤褰�
+ *
+ * @return 瀹炰綋闆嗗悎
+ */
+ List<RmLossDay> selectOneIntakeAllLossDay(@Param("intakeId")Long intakeId);
+
+ /**
+ * 鏇存柊涓�涓彇姘村彛鐨勬棩婕忔崯閲忕粺璁�
+ *
+ * @return 褰卞搷瀹炰綋鏁�
+ */
+ int updateOneIntakeLossDay(@Param("id")Long id, @Param("loss")Double loss);
+
+
+
+ /**
+ * 鍒犻櫎鎵�鏈夊彇姘村彛鐨勬湀婕忔崯閲忕粺璁�
+ * @return 褰卞搷瀹炰綋鏁�
+ */
+ int deleteAllIntakeLossMonth();
+
+
+ /**
+ * 缁熻鎵�鏈夊彇姘村彛鐨勬湀婕忔崯閲�
+ * @return 瀹炰綋闆嗗悎
+ */
+ List<StLossMonth> statisticAllIntakeLossMonthFromLossDay(@Param("startDt")Date startDt,
+ @Param("endDt")Date endDt);
+ /**
+ * 淇濆瓨鍙栨按鍙g殑鏈堟紡鎹熼噺缁熻
+ * @return 褰卞搷瀹炰綋鏁�
+ */
+ int saveOneIntakeLossMonth(StLossMonth pojo);
+
+
+ /**
+ * 鍒犻櫎鎵�鏈夊彇姘村彛鐨勫勾婕忔崯閲忕粺璁�
+ * @return 褰卞搷瀹炰綋鏁�
+ */
+ int deleteAllIntakeLossYear();
+
+
+ /**
+ * 缁熻鎵�鏈夊彇姘村彛鐨勫勾婕忔崯閲�
+ * @return 瀹炰綋闆嗗悎
+ */
+ List<StLossYear> statisticAllIntakeLossYearFromLossDay(@Param("startDt")Date startDt,
+ @Param("endDt")Date endDt);
+ /**
+ * 淇濆瓨鍙栨按鍙g殑鏈堟紡鎹熼噺缁熻
+ * @return 褰卞搷瀹炰綋鏁�
+ */
+ int saveOneIntakeLossYear(StLossYear pojo);
+
}
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoRm/RmIntakeAmountDay.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoRm/RmIntakeAmountDay.java
index a09de53..7af8936 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoRm/RmIntakeAmountDay.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoRm/RmIntakeAmountDay.java
@@ -15,7 +15,7 @@
/**
* @Author: liurunyu
* @Date: 2024/7/8 18:53
- * @Description 鍙栨按鍙f棩鍙栨按閲忔紡鎹熼噺
+ * @Description 鍙栨按鍙f棩鍙栨按閲忔垨婕忔崯閲�
*/
@TableName(value="rm_intake_amount_day", autoResultMap = true)
@Data
@@ -23,7 +23,7 @@
@ToString
@NoArgsConstructor
@AllArgsConstructor
-@Schema(name = "鍙栨按鍙f棩鍙栨按閲忔紡鎹熼噺")
+@Schema(name = "鍙栨按鍙f棩鍙栨按閲忔垨婕忔崯閲�")
public class RmIntakeAmountDay implements BaseEntity {
public static final long serialVersionUID = 2024007081854001L;
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/Temp4ChangeMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/Temp4ChangeMapper.xml
index 1380e68..3e94ae3 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/Temp4ChangeMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/Temp4ChangeMapper.xml
@@ -10,6 +10,11 @@
order by id ASC
</select>
+ <!-- ======================================= -->
+ <!-- -->
+ <!-- 鍙栨按閲� -->
+ <!-- -->
+ <!-- ====================================== -->
<!-- 鍙栨按鍙e彇姘撮噺鏃ョ粺璁$浉鍏�, 姝QL涓殑 鈥漮rder by id ASC 鈥滀笉鍙慨鏀� -->
<select id="selectOneIntakeAllAmountDay" resultType="com.dy.pipIrrGlobal.pojoRm.RmIntakeAmountDay">
select id as id,
@@ -90,4 +95,93 @@
)
</insert>
+
+ <!-- ======================================= -->
+ <!-- -->
+ <!-- 婕忔崯 -->
+ <!-- -->
+ <!-- ====================================== -->
+ <!-- 鍙栨按鍙f紡鎹熸棩缁熻鐩稿叧, 姝QL涓殑 鈥漮rder by id ASC 鈥滀笉鍙慨鏀� -->
+ <select id="selectOneIntakeAllLossDay" resultType="com.dy.pipIrrGlobal.pojoRm.RmLossDay">
+ select id as id,
+ intake_id as intakeId ,
+ dt as dt,
+ loss_amount as lossAmount
+ from rm_loss_day
+ where intake_id = #{intakeId}
+ order by id ASC
+ </select>
+
+ <!-- 淇敼鍙栨按鍙f紡鎹熸棩缁熻 -->
+ <update id="updateOneIntakeLossDay" >
+ update rm_loss_day
+ set loss_amount = #{loss, jdbcType=FLOAT}
+ where id = #{id, jdbcType=BIGINT}
+ </update>
+
+
+
+ <delete id="deleteAllIntakeLossMonth">
+ delete from st_loss_month
+ </delete>
+
+ <!-- -->
+ <select id="statisticAllIntakeLossMonthFromLossDay" resultType="com.dy.pipIrrGlobal.pojoSt.StLossMonth">
+ select intake_id as intakeId ,
+ sum(loss_amount) as amount
+ from rm_loss_day
+ where dt <![CDATA[>=]]> #{startDt, jdbcType=DATE}
+ and dt <![CDATA[<=]]> #{endDt, jdbcType=DATE}
+ group by intake_id
+ </select>
+
+ <insert id="saveOneIntakeLossMonth" parameterType="com.dy.pipIrrGlobal.pojoSt.StLossMonth">
+ <!--@mbg.generated-->
+ insert into st_loss_month (
+ id,
+ intake_id,
+ year,
+ month,
+ amount
+ )
+ values (#{id,jdbcType=BIGINT},
+ #{intakeId,jdbcType=BIGINT},
+ #{year,jdbcType=INTEGER},
+ #{month,jdbcType=INTEGER},
+ #{amount,jdbcType=FLOAT}
+ )
+ </insert>
+
+
+
+ <delete id="deleteAllIntakeLossYear">
+ delete from st_loss_year
+ </delete>
+
+ <!-- -->
+ <select id="statisticAllIntakeLossYearFromLossDay" resultType="com.dy.pipIrrGlobal.pojoSt.StLossYear">
+ select intake_id as intakeId ,
+ sum(loss_amount) as amount
+ from rm_loss_day
+ where dt <![CDATA[>=]]> #{startDt, jdbcType=DATE}
+ and dt <![CDATA[<=]]> #{endDt, jdbcType=DATE}
+ group by intake_id
+ </select>
+
+ <insert id="saveOneIntakeLossYear" parameterType="com.dy.pipIrrGlobal.pojoSt.StLossYear">
+ <!--@mbg.generated-->
+ insert into st_intake_amount_year (
+ id,
+ intake_id,
+ year,
+ amount
+ )
+ values (#{id,jdbcType=BIGINT},
+ #{intakeId,jdbcType=BIGINT},
+ #{year,jdbcType=INTEGER},
+ #{amount,jdbcType=FLOAT}
+ )
+ </insert>
+
+
</mapper>
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByClient.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByClient.java
new file mode 100644
index 0000000..6d32ddc
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByClient.java
@@ -0,0 +1,52 @@
+package com.dy.pipIrrStatistics.statistics;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Author: liurunyu
+ * @Date: 2024/12/23 14:55
+ * @Description
+ */
+@Component
+public class StChargeByClient {
+
+ private static Logger log = LogManager.getLogger(StChargeByClient.class.getName()) ;
+
+ @Autowired
+ protected StChargeByClientSv sv ;
+
+ private Integer statisticsYear;
+ private Integer statisticsMonth;
+ private Long statisticsStartId ;
+ private Long statisticsEndId ;
+
+
+ protected void statistics(Integer statisticsYear,
+ Integer statisticsMonth,
+ Long statisticsStartId,
+ Long statisticsEndId){
+ this.statisticsYear = statisticsYear ;
+ this.statisticsMonth = statisticsMonth ;
+ this.statisticsStartId = statisticsStartId ;
+ this.statisticsEndId = statisticsEndId ;
+ this.statisticsMonth() ;
+ this.statisticsYear() ;
+ }
+
+ /**
+ * 鏈堢粺璁�---鍐滄埛鍏呭��
+ */
+ private void statisticsMonth(){
+ sv.statisticsMonth(statisticsYear, statisticsMonth, statisticsStartId, statisticsEndId);
+ }
+
+ /**
+ * 骞寸粺璁�---鍐滄埛鍏呭��
+ */
+ private void statisticsYear(){
+ sv.statisticsYear(statisticsYear);
+ }
+}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByClientSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByClientSv.java
new file mode 100644
index 0000000..c732e8c
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByClientSv.java
@@ -0,0 +1,66 @@
+package com.dy.pipIrrStatistics.statistics;
+
+import com.dy.pipIrrGlobal.pojoSt.StIntakeAmountMonth;
+import com.dy.pipIrrGlobal.pojoSt.StIntakeAmountYear;
+import com.dy.pipIrrGlobal.voSt.VoIntakeAmountStatistics;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * @Author: liurunyu
+ * @Date: 2024/12/23 14:54
+ * @Description
+ */
+@Component
+public class StChargeByClientSv {
+ /**
+ * 鏈堢粺璁�---婕忔崯
+ */
+ @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 = 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;
+// if(po.id == null) {
+// stIntakeAmountMonthDao.insert(po);
+// }else{
+// stIntakeAmountMonthDao.updateByPrimaryKey(po) ;
+// }
+// }
+// }
+ }
+
+ /**
+ * 骞寸粺璁�---婕忔崯
+ */
+ @Transactional
+ protected void statisticsYear(Integer statisticsYear){
+// List<VoIntakeAmountStatistics> list = stIntakeAmountMonthDao.statisticsByIntake(statisticsYear) ;
+// if(list != null && list.size() > 0){
+// for(VoIntakeAmountStatistics vo : list){
+// StIntakeAmountYear po = stIntakeAmountYearDao.selectByIntakeIdAndYear(vo.intakeId, statisticsYear) ;
+// if(po == null){
+// po = new StIntakeAmountYear() ;
+// }
+// po.intakeId = vo.intakeId ;
+// po.year = statisticsYear ;
+// po.amount = vo.amount;
+// if(po.id == null){
+// stIntakeAmountYearDao.insert(po) ;
+// }else{
+// stIntakeAmountYearDao.updateByPrimaryKey(po) ;
+// }
+// }
+// }
+ }
+}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByIc.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByIc.java
new file mode 100644
index 0000000..bf30e7f
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByIc.java
@@ -0,0 +1,52 @@
+package com.dy.pipIrrStatistics.statistics;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Author: liurunyu
+ * @Date: 2024/12/23 14:53
+ * @Description
+ */
+@Component
+public class StChargeByIc {
+
+ private static Logger log = LogManager.getLogger(StChargeByIc.class.getName()) ;
+
+ @Autowired
+ protected StChargeByIcSv sv ;
+
+ private Integer statisticsYear;
+ private Integer statisticsMonth;
+ private Long statisticsStartId ;
+ private Long statisticsEndId ;
+
+
+ protected void statistics(Integer statisticsYear,
+ Integer statisticsMonth,
+ Long statisticsStartId,
+ Long statisticsEndId){
+ this.statisticsYear = statisticsYear ;
+ this.statisticsMonth = statisticsMonth ;
+ this.statisticsStartId = statisticsStartId ;
+ this.statisticsEndId = statisticsEndId ;
+ this.statisticsMonth() ;
+ this.statisticsYear() ;
+ }
+
+ /**
+ * 鏈堢粺璁�---IC鍗″厖鍊�
+ */
+ private void statisticsMonth(){
+ sv.statisticsMonth(statisticsYear, statisticsMonth, statisticsStartId, statisticsEndId);
+ }
+
+ /**
+ * 骞寸粺璁�---IC鍗″厖鍊�
+ */
+ private void statisticsYear(){
+ sv.statisticsYear(statisticsYear);
+ }
+}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByIcSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByIcSv.java
new file mode 100644
index 0000000..fbd0d8b
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByIcSv.java
@@ -0,0 +1,66 @@
+package com.dy.pipIrrStatistics.statistics;
+
+import com.dy.pipIrrGlobal.pojoSt.StIntakeAmountMonth;
+import com.dy.pipIrrGlobal.pojoSt.StIntakeAmountYear;
+import com.dy.pipIrrGlobal.voSt.VoIntakeAmountStatistics;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * @Author: liurunyu
+ * @Date: 2024/12/23 14:53
+ * @Description
+ */
+@Component
+public class StChargeByIcSv {
+ /**
+ * 鏈堢粺璁�---婕忔崯
+ */
+ @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 = 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;
+// if(po.id == null) {
+// stIntakeAmountMonthDao.insert(po);
+// }else{
+// stIntakeAmountMonthDao.updateByPrimaryKey(po) ;
+// }
+// }
+// }
+ }
+
+ /**
+ * 骞寸粺璁�---婕忔崯
+ */
+ @Transactional
+ protected void statisticsYear(Integer statisticsYear){
+// List<VoIntakeAmountStatistics> list = stIntakeAmountMonthDao.statisticsByIntake(statisticsYear) ;
+// if(list != null && list.size() > 0){
+// for(VoIntakeAmountStatistics vo : list){
+// StIntakeAmountYear po = stIntakeAmountYearDao.selectByIntakeIdAndYear(vo.intakeId, statisticsYear) ;
+// if(po == null){
+// po = new StIntakeAmountYear() ;
+// }
+// po.intakeId = vo.intakeId ;
+// po.year = statisticsYear ;
+// po.amount = vo.amount;
+// if(po.id == null){
+// stIntakeAmountYearDao.insert(po) ;
+// }else{
+// stIntakeAmountYearDao.updateByPrimaryKey(po) ;
+// }
+// }
+// }
+ }
+}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StatisticsJob.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StatisticsJob.java
index da3c02b..a180312 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StatisticsJob.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StatisticsJob.java
@@ -50,7 +50,7 @@
statisticsEndId = IDLongGenerator.generateOneDayEndId(statisticsYear, statisticsMonth, 31) ;
}else{
//缁熻鏈湀鐨�
- statisticsYear = ymd[0] ;//缁熻鏈�
+ statisticsYear = ymd[0] ;//缁熻骞�
statisticsMonth = ymd[1] ;//缁熻鏈�
statisticsStartId = IDLongGenerator.generateOneDayStartId(ymd[0], ymd[1], 1) ;
statisticsEndId = IDLongGenerator.generateOneDayEndId(ymd[0], ymd[1], 31) ;
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/changeSome/ChSomeCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/changeSome/ChSomeCtrl.java
index 3c7befe..2ebaaf0 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/changeSome/ChSomeCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/changeSome/ChSomeCtrl.java
@@ -22,11 +22,27 @@
private ChSomeIntakeAmountSv intakeAmountSv;
+ private ChSomeIntakeLossSv intakeLossSv;
+
@Autowired
private void setSv(ChSomeIntakeAmountSv sv) {
this.intakeAmountSv = sv;
}
+ @Autowired
+ private void setSv(ChSomeIntakeLossSv sv) {
+ this.intakeLossSv = sv;
+ }
+
+
+
+
+
+ ///////////////////////////////////////////
+ //
+ // 鍙栨按鍙g浉鍏冲彇姘撮噺
+ //
+ ///////////////////////////////////////////
/**
* 淇敼涓�浜涘彇姘村彛鍙栨按閲忔棩缁熻
* @return
@@ -62,4 +78,48 @@
this.intakeAmountSv.statisticsIntakeAmountYear();
return BaseResponseUtils.buildSuccess(true);
}
+
+
+
+
+ ///////////////////////////////////////////
+ //
+ // 鍙栨按鍙g浉鍏虫紡鎹�
+ //
+ ///////////////////////////////////////////
+ /**
+ * 淇敼涓�浜涘彇姘村彛婕忔崯閲忔棩缁熻
+ * @return
+ */
+ @GetMapping(path = "changeSomeIntakeDayLoss")
+ @SsoAop()
+ public BaseResponse<Boolean> changeSomeIntakeDayLoss() throws Exception{
+ this.intakeLossSv.chIntakeLossDay();
+ return BaseResponseUtils.buildSuccess(true);
+ }
+
+
+ /**
+ * 閲嶆柊缁熻鍙栨按鍙f湀婕忔崯閲�
+ * @return
+ */
+ @GetMapping(path = "reStatisticsAllIntakeMonthLoss")
+ @SsoAop()
+ public BaseResponse<Boolean> reStatisticsAllIntakeMonthLoss() throws Exception{
+ this.intakeLossSv.deleteAllIntakeLossMonth();
+ this.intakeLossSv.statisticsIntakeLossMonth();
+ return BaseResponseUtils.buildSuccess(true);
+ }
+
+ /**
+ * 閲嶆柊缁熻鍙栨按鍙f墍婕忔崯閲�
+ * @return
+ */
+ @GetMapping(path = "reStatisticsAllIntakeYearLoss")
+ @SsoAop()
+ public BaseResponse<Boolean> reStatisticsAllIntakeYearLoss() throws Exception{
+ this.intakeLossSv.deleteAllIntakeLossYear();
+ this.intakeLossSv.statisticsIntakeLossYear();
+ return BaseResponseUtils.buildSuccess(true);
+ }
}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/changeSome/ChSomeIntakeLossSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/changeSome/ChSomeIntakeLossSv.java
new file mode 100644
index 0000000..9a540ed
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/changeSome/ChSomeIntakeLossSv.java
@@ -0,0 +1,188 @@
+package com.dy.pipIrrTemp.changeSome;
+
+import com.dy.common.util.DateTime;
+import com.dy.pipIrrGlobal.daoTmp.ChangeMapper;
+import com.dy.pipIrrGlobal.pojoRm.RmIntakeAmountDay;
+import com.dy.pipIrrGlobal.pojoRm.RmLossDay;
+import com.dy.pipIrrGlobal.pojoSt.StIntakeAmountMonth;
+import com.dy.pipIrrGlobal.pojoSt.StIntakeAmountYear;
+import com.dy.pipIrrGlobal.pojoSt.StLossMonth;
+import com.dy.pipIrrGlobal.pojoSt.StLossYear;
+import com.dy.pipIrrGlobal.voSt.VoIntake;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Author: liurunyu
+ * @Date: 2024/12/24 8:47
+ * @Description
+ */
+@Slf4j
+@Service
+public class ChSomeIntakeLossSv {
+
+ private ChangeMapper dao;
+
+ private static final int IntakeLossDayFlag = 800 ;//2024-12-14缁熻鍏冭皨鏁版嵁搴撳疄鏃舵暟鎹紝鍙戠幇澶т簬800鐨勬纭殑鏁版嵁涓嶅瓨鍦紝鑰屽皬浜�800鐨勫熀鏈负姝g‘鏁版嵁
+
+ @Autowired
+ private void setDao(ChangeMapper dao){
+ this.dao = dao;
+ }
+
+ ////////////////////////////////////////
+ //
+ // 鏈夊叧鏃ョ粺璁�
+ //
+ ///////////////////////////////////////
+ /**
+ * 璋冩暣鍙栨按鍙f棩婕忔崯閲忕粺璁�
+ * @throws Exception
+ */
+ public void chIntakeLossDay() throws Exception{
+ List<VoIntake> list = dao.selectAllPrIntakes() ;
+ if(list != null && list.size() > 0){
+ for(VoIntake vo : list){
+ List<RmLossDay> adList = dao.selectOneIntakeAllLossDay(vo.getIntakeId()) ;
+ if(adList != null && adList.size() > 0){
+ //adList涓暟鎹互id鍗囧簭鎺掑垪
+ for(RmLossDay ad : adList){
+ if(ad.lossAmount != null && ad.lossAmount > IntakeLossDayFlag){
+ this.doUpdateOneIntakeLossDay(ad.id, 0.0);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @Transactional
+ protected int doUpdateOneIntakeLossDay(Long id, Double loss){
+ return dao.updateOneIntakeLossDay(id, loss);
+ }
+
+
+
+ ////////////////////////////////////////
+ //
+ // 鏈夊叧鏈堢粺璁�
+ //
+ ///////////////////////////////////////
+
+ private static final int DealStartYear = 2024 ;
+ private static final int DealStartMonth = 8 ;
+
+ private static final String endDayOfMonth(int year, int month){
+ if(month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12){
+ return "31" ;
+ }else{
+ if(month == 2){
+ if(DateTime.isLeapYear(year)){
+ return "29" ;
+ }else{
+ return "28" ;
+ }
+ }else{
+ return "30" ;
+ }
+ }
+ }
+ /**
+ * 鍒犻櫎鎵�鏈夊彇姘村彛鏈堟紡鎹熼噺缁熻
+ * @throws Exception
+ */
+ @Transactional
+ public void deleteAllIntakeLossMonth(){
+ dao.deleteAllIntakeLossMonth();
+ }
+
+ /**
+ * 缁熻鍙栨按鍙f湀婕忔崯閲�
+ * @throws Exception
+ */
+ public void statisticsIntakeLossMonth() throws Exception{
+ int nowYear = Integer.parseInt(DateTime.yyyy()) ;
+ int nowMonth = Integer.parseInt(DateTime.mm()) ;
+ Date startDt ;
+ Date endDt ;
+ List<StLossMonth> list ;
+ for(int year = DealStartYear; year <= nowYear; year ++){
+ list = null ;
+ if(year < nowYear){
+ for(int month = 1 ; month <= 12 ; month ++){
+ startDt = DateTime.dateFrom_yyyy_MM_dd(year + "-" + month + "-01") ;
+ endDt = DateTime.dateFrom_yyyy_MM_dd(year + "-" + month + "-" + endDayOfMonth(year, month)) ;
+ list = dao.statisticAllIntakeLossMonthFromLossDay(startDt, endDt) ;
+ this.doStatisticsIntakeLossMonth(year, month, list) ;
+ }
+ }else{
+ for(int month = 1 ; month <= nowMonth ; month ++){
+ startDt = DateTime.dateFrom_yyyy_MM_dd(year + "-" + month + "-01") ;
+ endDt = DateTime.dateFrom_yyyy_MM_dd(year + "-" + month + "-" + endDayOfMonth(year, month)) ;
+ list = dao.statisticAllIntakeLossMonthFromLossDay(startDt, endDt) ;
+ this.doStatisticsIntakeLossMonth(year, month, list) ;
+ }
+ }
+ }
+ }
+ @Transactional
+ protected void doStatisticsIntakeLossMonth(int year, int month, List<StLossMonth> list) throws Exception{
+ if(list != null && list.size() > 0){
+ for(StLossMonth po : list){
+ po.year = year ;
+ po.month = month ;
+ dao.saveOneIntakeLossMonth(po) ;
+ }
+ }
+ }
+
+
+
+
+ ////////////////////////////////////////
+ //
+ // 鏈夊叧骞寸粺璁�
+ //
+ ///////////////////////////////////////
+ /**
+ * 鍒犻櫎鎵�鏈夊彇姘村彛骞存紡鎹熼噺缁熻
+ * @throws Exception
+ */
+ @Transactional
+ public void deleteAllIntakeLossYear(){
+ dao.deleteAllIntakeLossYear();
+ }
+
+ /**
+ * 缁熻鍙栨按鍙f湀婕忔崯閲�
+ * @throws Exception
+ */
+ public void statisticsIntakeLossYear() throws Exception{
+ int nowYear = Integer.parseInt(DateTime.yyyy()) ;
+ Date startDt ;
+ Date endDt ;
+ List<StLossYear> list ;
+ for(int year = DealStartYear; year <= nowYear; year ++){
+ list = null ;
+ startDt = DateTime.dateFrom_yyyy_MM_dd(year + "-01-01") ;
+ endDt = DateTime.dateFrom_yyyy_MM_dd(year + "-12-31") ;
+ list = dao.statisticAllIntakeLossYearFromLossDay(startDt, endDt) ;
+ this.doStatisticsIntakeLossYear(year, list) ;
+ }
+ }
+ @Transactional
+ protected void doStatisticsIntakeLossYear(int year, List<StLossYear> list) throws Exception{
+ if(list != null && list.size() > 0){
+ for(StLossYear po : list){
+ po.year = year ;
+ dao.saveOneIntakeLossYear(po) ;
+ }
+ }
+ }
+
+}
diff --git "a/pipIrr-platform/pipIrr-web/pipIrr-web-temp/\350\257\264\346\230\216.txt" "b/pipIrr-platform/pipIrr-web/pipIrr-web-temp/\350\257\264\346\230\216.txt"
index 8a89873..acbb18b 100644
--- "a/pipIrr-platform/pipIrr-web/pipIrr-web-temp/\350\257\264\346\230\216.txt"
+++ "b/pipIrr-platform/pipIrr-web/pipIrr-web-temp/\350\257\264\346\230\216.txt"
@@ -13,7 +13,16 @@
4銆佷慨鏀逛竴浜涘彇姘村彛鏃ュ彇姘撮噺缁熻---鍥燫TU涓�澶╁唴鏁寸偣鎶ヤ腑绱娴侀噺闂存瓏鍑虹幇0鍊硷紝涓ゆ涓婃姤绱娴侀噺宸�间細浜х敓澶у��
/temp/chSome/changeSomeIntakeDayAmount
-5銆侀噸鏂扮粺璁″彇姘村彛鏈堝彇姘撮噺锛堟墽琛屽墠鍏抽棴閫氫俊涓棿浠讹級
+5銆侀噸鏂扮粺璁″彇姘村彛鏈堝彇姘撮噺
/temp/chSome/reStatisticsAllIntakeMonthAmount
-6銆侀噸鏂扮粺璁″彇姘村彛骞村彇姘撮噺锛堟墽琛屽墠鍏抽棴閫氫俊涓棿浠讹級
-/temp/chSome/reStatisticsAllIntakeYearAmount
\ No newline at end of file
+6銆侀噸鏂扮粺璁″彇姘村彛骞村彇姘撮噺
+/temp/chSome/reStatisticsAllIntakeYearAmount
+
+
+
+7銆佷慨鏀逛竴浜涘彇姘村彛鏃ユ紡鎹熼噺缁熻---鍥犱负鏂板畨瑁呮按閲忥紝琛ㄥ簳鍊兼瘮杈冨ぇ
+/temp/chSome/changeSomeIntakeDayLoss
+8銆侀噸鏂扮粺璁″彇姘村彛鏈堟紡鎹熼噺
+/temp/chSome/reStatisticsAllIntakeMonthLoss
+9銆侀噸鏂扮粺璁″彇姘村彛骞存紡鎹熼噺
+/temp/chSome/reStatisticsAllIntakeYearLoss
\ No newline at end of file
--
Gitblit v1.8.0