New file |
| | |
| | | package com.dy.pipIrrTemp.delSome; |
| | | |
| | | import com.dy.pipIrrGlobal.daoTmp.DeleteMapper; |
| | | import com.dy.pipIrrGlobal.voTmp.VoStIntakeAmountDay; |
| | | import com.dy.pipIrrGlobal.voTmp.VoStIntakeAmountMonth; |
| | | import com.dy.pipIrrGlobal.voTmp.VoStIntakeAmountYear; |
| | | 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 DelSomeIntakeAmountSv { |
| | | |
| | | private DeleteMapper dao; |
| | | |
| | | @Autowired |
| | | private void setDao(DeleteMapper dao){ |
| | | this.dao = dao; |
| | | } |
| | | |
| | | public void delStIntakeDay(){ |
| | | VoStIntakeAmountDay first = null ; |
| | | List<VoStIntakeAmountDay> list = dao.selectAllStIntakeDay() ; |
| | | if(list != null && list.size() > 0){ |
| | | for(VoStIntakeAmountDay 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{ |
| | | //同一个取水口同日期 |
| | | doDelStIntakeDay(vo.id) ; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | public void delStIntakeMonth(){ |
| | | VoStIntakeAmountMonth first = null ; |
| | | List<VoStIntakeAmountMonth> list = dao.selectAllStIntakeMonth() ; |
| | | if(list != null && list.size() > 0){ |
| | | for(VoStIntakeAmountMonth 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{ |
| | | //同一个取水口同年同月 |
| | | doDelStIntakeMonth(vo.id) ; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | public void delStIntakeYear(){ |
| | | VoStIntakeAmountYear first = null ; |
| | | List<VoStIntakeAmountYear> list = dao.selectAllStIntakeYear() ; |
| | | if(list != null && list.size() > 0){ |
| | | for(VoStIntakeAmountYear 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{ |
| | | //同一个取水口同年 |
| | | doDelStIntakeYear(vo.id) ; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Transactional |
| | | int doDelStIntakeDay(Long id){ |
| | | return dao.deleteStIntakeDayById(id) ; |
| | | } |
| | | |
| | | @Transactional |
| | | int doDelStIntakeMonth(Long id){ |
| | | return dao.deleteStIntakeMonthById(id) ; |
| | | } |
| | | |
| | | @Transactional |
| | | int doDelStIntakeYear(Long id){ |
| | | return dao.deleteStIntakeYearById(id) ; |
| | | } |
| | | |
| | | } |