| New file | 
 |  |  | 
 |  |  | package com.dy.pipIrrTemp.delSome; | 
 |  |  |  | 
 |  |  | import com.dy.pipIrrGlobal.daoTmp.DeleteMapper; | 
 |  |  | import com.dy.pipIrrGlobal.voTmp.VoStLossAmountDay; | 
 |  |  | import com.dy.pipIrrGlobal.voTmp.VoStLossAmountMonth; | 
 |  |  | import com.dy.pipIrrGlobal.voTmp.VoStLossAmountYear; | 
 |  |  | 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.List; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * @Author: liurunyu | 
 |  |  |  * @Date: 2024/12/11 10:54 | 
 |  |  |  * @Description | 
 |  |  |  */ | 
 |  |  |  | 
 |  |  | @Slf4j | 
 |  |  | @Service | 
 |  |  | public class DelSomeLossAmountSv { | 
 |  |  |  | 
 |  |  |     private DeleteMapper dao; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private void setDao(DeleteMapper dao){ | 
 |  |  |         this.dao = dao; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void delStLossDay(){ | 
 |  |  |         VoStLossAmountDay first = null ; | 
 |  |  |         List<VoStLossAmountDay> list = dao.selectAllStLossDay() ; | 
 |  |  |         if(list != null && list.size() > 0){ | 
 |  |  |             for(VoStLossAmountDay vo : list){ | 
 |  |  |                 if(first == null){ | 
 |  |  |                     first = vo ; | 
 |  |  |                 }else{ | 
 |  |  |                     if(first.intakeId.longValue() != vo.intakeId.longValue()){ | 
 |  |  |                         //取水口变了 | 
 |  |  |                         first = vo ; | 
 |  |  |                     }else{ | 
 |  |  |                         if(!first.dt.equals(vo.dt)) { | 
 |  |  |                             //日期变了 | 
 |  |  |                             first = vo ; | 
 |  |  |                         }else{ | 
 |  |  |                             //同一个取水口同日期 | 
 |  |  |                             doDelStLossDay(vo.id) ; | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void delStLossMonth(){ | 
 |  |  |         VoStLossAmountMonth first = null ; | 
 |  |  |         List<VoStLossAmountMonth> list = dao.selectAllStLossMonth() ; | 
 |  |  |         if(list != null && list.size() > 0){ | 
 |  |  |             for(VoStLossAmountMonth vo : list){ | 
 |  |  |                 if(first == null){ | 
 |  |  |                     first = vo ; | 
 |  |  |                 }else{ | 
 |  |  |                     if(first.intakeId.longValue() != vo.intakeId.longValue()){ | 
 |  |  |                         //取水口变了 | 
 |  |  |                         first = vo ; | 
 |  |  |                     }else{ | 
 |  |  |                         if(first.year.intValue() != vo.year.intValue()) { | 
 |  |  |                             //年度变了 | 
 |  |  |                             first = vo ; | 
 |  |  |                         }else{ | 
 |  |  |                             if(first.month.intValue() != vo.month.intValue()){ | 
 |  |  |                                 //月份变了 | 
 |  |  |                                 first = vo ; | 
 |  |  |                             }else{ | 
 |  |  |                                 //同一个取水口同年同月 | 
 |  |  |                                 doDelStLossMonth(vo.id) ; | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     public void delStLossYear(){ | 
 |  |  |         VoStLossAmountYear first = null ; | 
 |  |  |         List<VoStLossAmountYear> list = dao.selectAllStLossYear() ; | 
 |  |  |         if(list != null && list.size() > 0){ | 
 |  |  |             for(VoStLossAmountYear vo : list){ | 
 |  |  |                 if(first == null){ | 
 |  |  |                     first = vo ; | 
 |  |  |                 }else{ | 
 |  |  |                     if(first.intakeId.longValue() != vo.intakeId.longValue()){ | 
 |  |  |                         //取水口变了 | 
 |  |  |                         first = vo ; | 
 |  |  |                     }else{ | 
 |  |  |                         if(first.year.intValue() != vo.year.intValue()) { | 
 |  |  |                             //年度变了 | 
 |  |  |                             first = vo ; | 
 |  |  |                         }else{ | 
 |  |  |                             //同一个取水口同年 | 
 |  |  |                             doDelStLossYear(vo.id) ; | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |     @Transactional | 
 |  |  |     int doDelStLossDay(Long id){ | 
 |  |  |         return dao.deleteStLossDayById(id) ; | 
 |  |  |     } | 
 |  |  |     @Transactional | 
 |  |  |     int doDelStLossMonth(Long id){ | 
 |  |  |         return dao.deleteStLossMonthById(id) ; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Transactional | 
 |  |  |     int doDelStLossYear(Long id){ | 
 |  |  |         return dao.deleteStLossYearById(id) ; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } |