liurunyu
2025-01-11 528c72d94c539554a7fd6dcf4abdbda6a28eff67
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
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) ;
    }
 
}