发现元谋系统农户用水日统计数据中,2025年5月份的数据有重复现象,发生的原因不明,有临时模块中实现删除重复数据的功能。
4个文件已修改
2个文件已添加
116 ■■■■■ 已修改文件
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoTmp/DeleteMapper.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voTmp/VoStClientAmountDay.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/Temp4DeleteMapper.xml 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/delRepeatStClientAmountDay/DelRepeatStClientAmountDaySv.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/delRepeatStClientAmountDay/DelSomeCtrl.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/delSome/DelSomeClientAmountSv.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
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);
}
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 ;
}
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>
pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/delRepeatStClientAmountDay/DelRepeatStClientAmountDaySv.java
New file
@@ -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) ;
                    }
                }
            }
        }
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-temp/src/main/java/com/dy/pipIrrTemp/delRepeatStClientAmountDay/DelSomeCtrl.java
New file
@@ -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);
    }
}
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