发现元谋系统农户用水日统计数据中,2025年5月份的数据有重复现象,发生的原因不明,有临时模块中实现删除重复数据的功能。
| | |
| | | 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; |
| | | |
| | |
| | | */ |
| | | List<VoStClientAmountDay> selectAllStClientDay(); |
| | | |
| | | int deleteStClientDayById(Long id); |
| | | int deleteRmClientDayById(Long id); |
| | | |
| | | |
| | | /** |
| | |
| | | |
| | | int deleteStClientYearById(Long id); |
| | | |
| | | |
| | | /** |
| | | * 查询全部农户年统计 |
| | | * |
| | | * @return 实体集合 |
| | | */ |
| | | List<VoStClientAmountDay> selectStClientAmountDayByYearMonth(@Param("year") int year, @Param("month")int month); |
| | | |
| | | |
| | | int deleteStClientDayById(Long id); |
| | | |
| | | } |
| | |
| | | public class VoStClientAmountDay { |
| | | public Long id ; |
| | | public Long clientId ; |
| | | public Integer year ; |
| | | public Integer month ; |
| | | public Date dt ; |
| | | public Double amount ; |
| | | } |
| | |
| | | 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> |
| | |
| | | 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> |
| | |
| | | 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> |
New file |
| | |
| | | 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) ; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | 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); |
| | | } |
| | | } |
| | |
| | | } |
| | | @Transactional |
| | | int doDelStClientDay(Long id){ |
| | | return dao.deleteStClientDayById(id) ; |
| | | return dao.deleteRmClientDayById(id) ; |
| | | } |
| | | |
| | | @Transactional |