From bd2e51593ae4d80506d7031a759eefd1aa4154b6 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期三, 30 七月 2025 09:29:39 +0800
Subject: [PATCH] 发现元谋系统农户用水日统计数据中,2025年5月份的数据有重复现象,发生的原因不明,有临时模块中实现删除重复数据的功能。
---
pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/delRepeatStClientAmountDay/DelSomeCtrl.java | 38 +++++++++++++++++++
pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/delSome/DelSomeClientAmountSv.java | 2
pipIrr-platform/pipIrr-global/src/main/resources/mapper/Temp4DeleteMapper.xml | 19 ++++++++-
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voTmp/VoStClientAmountDay.java | 2 +
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoTmp/DeleteMapper.java | 14 ++++++
pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/delRepeatStClientAmountDay/DelRepeatStClientAmountDaySv.java | 41 ++++++++++++++++++++
6 files changed, 111 insertions(+), 5 deletions(-)
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoTmp/DeleteMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoTmp/DeleteMapper.java
index 017e23b..b9534cb 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoTmp/DeleteMapper.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoTmp/DeleteMapper.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dy.pipIrrGlobal.voTmp.*;
import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -78,7 +79,7 @@
*/
List<VoStClientAmountDay> selectAllStClientDay();
- int deleteStClientDayById(Long id);
+ int deleteRmClientDayById(Long id);
/**
@@ -99,4 +100,15 @@
int deleteStClientYearById(Long id);
+
+ /**
+ * 鏌ヨ鍏ㄩ儴鍐滄埛骞寸粺璁�
+ *
+ * @return 瀹炰綋闆嗗悎
+ */
+ List<VoStClientAmountDay> selectStClientAmountDayByYearMonth(@Param("year") int year, @Param("month")int month);
+
+
+ int deleteStClientDayById(Long id);
+
}
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voTmp/VoStClientAmountDay.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voTmp/VoStClientAmountDay.java
index a85815d..78665fa 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voTmp/VoStClientAmountDay.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voTmp/VoStClientAmountDay.java
@@ -13,6 +13,8 @@
public class VoStClientAmountDay {
public Long id ;
public Long clientId ;
+ public Integer year ;
+ public Integer month ;
public Date dt ;
public Double amount ;
}
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/Temp4DeleteMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/Temp4DeleteMapper.xml
index 7abeae4..3948cfd 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/Temp4DeleteMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/Temp4DeleteMapper.xml
@@ -103,7 +103,7 @@
order by client_id DESC, id DESC
</select>
- <delete id="deleteStClientDayById" parameterType="java.lang.Long">
+ <delete id="deleteRmClientDayById" parameterType="java.lang.Long">
delete from rm_client_amount_day
where id = #{id,jdbcType=BIGINT}
</delete>
@@ -112,8 +112,6 @@
select id as id,
client_id as clientId ,
year as year,
- month as month,
- amount as amount
from st_client_amount_month
order by client_id DESC, id DESC
</select>
@@ -137,4 +135,19 @@
where id = #{id,jdbcType=BIGINT}
</delete>
+
+ <select id="selectStClientAmountDayByYearMonth" resultType="com.dy.pipIrrGlobal.voTmp.VoStClientAmountDay">
+ select id as id,
+ client_id as clientId ,
+ year as year,
+ month as month
+ from st_client_amount_day
+ where year = #{year} and month = #{month}
+ order by client_id ASC, id ASC
+ </select>
+
+ <delete id="deleteStClientDayById" parameterType="java.lang.Long">
+ delete from st_client_amount_day
+ where id = #{id,jdbcType=BIGINT}
+ </delete>
</mapper>
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/delRepeatStClientAmountDay/DelRepeatStClientAmountDaySv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/delRepeatStClientAmountDay/DelRepeatStClientAmountDaySv.java
new file mode 100644
index 0000000..8deab02
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/delRepeatStClientAmountDay/DelRepeatStClientAmountDaySv.java
@@ -0,0 +1,41 @@
+package com.dy.pipIrrTemp.delRepeatStClientAmountDay;
+
+import com.dy.pipIrrGlobal.daoTmp.DeleteMapper;
+import com.dy.pipIrrGlobal.voTmp.VoStClientAmountDay;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * @Author: liurunyu
+ * @Date: 2025/7/30 9:05
+ * @Description
+ */
+@Slf4j
+@Service
+public class DelRepeatStClientAmountDaySv {
+ private DeleteMapper dao ;
+
+
+ @Transactional
+ public void delStClientAmountDay(){
+ VoStClientAmountDay client = null ;
+ List<VoStClientAmountDay> list = dao.selectStClientAmountDayByYearMonth(2025, 5) ;
+ if(list != null && list.size() > 0){
+ for(VoStClientAmountDay vo : list){
+ if(client == null){
+ client = vo ;
+ }else{
+ if(client.clientId.longValue() != vo.clientId.longValue()){
+ //鍐滄埛鍙樹簡
+ client = vo ;
+ }else{
+ dao.deleteStClientDayById(vo.id) ;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/delRepeatStClientAmountDay/DelSomeCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/delRepeatStClientAmountDay/DelSomeCtrl.java
new file mode 100644
index 0000000..0dba21d
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/delRepeatStClientAmountDay/DelSomeCtrl.java
@@ -0,0 +1,38 @@
+package com.dy.pipIrrTemp.delRepeatStClientAmountDay;
+
+import com.dy.common.aop.SsoAop;
+import com.dy.common.webUtil.BaseResponse;
+import com.dy.common.webUtil.BaseResponseUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @Author: liurunyu
+ * @Date: 2025/7/30 9:03
+ * @Description
+ */
+@Slf4j
+@RestController
+@RequestMapping(path = "delRepeatStClientAmountDay")
+public class DelSomeCtrl {
+ private DelRepeatStClientAmountDaySv sv ;
+
+ @Autowired
+ private void setSv(DelRepeatStClientAmountDaySv sv) {
+ this.sv = sv;
+ }
+
+ /**
+ * 鍒犻櫎涓�浜涙紡鎹熺粺璁�
+ * @return
+ */
+ @GetMapping(path = "deleteSomeStatisticClientDayAmount")
+ @SsoAop()
+ public BaseResponse<Boolean> deleteSomeStatisticClientDayAmount(){
+ this.sv.delStClientAmountDay() ;
+ return BaseResponseUtils.buildSuccess(true);
+ }
+}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/delSome/DelSomeClientAmountSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/delSome/DelSomeClientAmountSv.java
index 8f3b788..b4f2bc8 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/delSome/DelSomeClientAmountSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/delSome/DelSomeClientAmountSv.java
@@ -111,7 +111,7 @@
}
@Transactional
int doDelStClientDay(Long id){
- return dao.deleteStClientDayById(id) ;
+ return dao.deleteRmClientDayById(id) ;
}
@Transactional
--
Gitblit v1.8.0