whycrzg
2021-02-23 351b9a53cb9ecebdf8f79db0117f540d9c42c2a4
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
package com.fgkj.services;
 
import com.fgkj.dto.*;
import com.fgkj.mapper.impl.Batt_param_lowMapper;
import com.fgkj.mapper.impl.BattinfThirdMapper;
import org.springframework.stereotype.Service;
 
import java.util.ArrayList;
import java.util.List;
 
import javax.annotation.Resource;
@Service
public class Batt_MaintService {
 
    @Resource
    private BattinfThirdMapper mapper;
    @Resource
    private Batt_param_lowMapper paramLowMapper;
    @Resource
    private BatttestdatastopService sservice;
    @Resource
    private Batttestdata_infService tservice;
    @Resource
    private Battresdata_infService  eservice;
    @Resource
    private BattresdataService rservice;
 
    ServiceModel model = new ServiceModel();
 
    // 1.3根据battgroupid和mon_num的值查出测试信息
    // 或者根据battgroupid和mon_num得到内阻信息(旧)
    public List serchMon_num1(Object obj) {
        Batt_Maint_Dealarm bmd = (Batt_Maint_Dealarm) obj;
        BattInf binf = bmd.getBinf();
        Batttestdata_inf tdata = bmd.getTdata();
        Battresdata_inf rinf=new Battresdata_inf();
        Batttestdatastop sdata = new Batttestdatastop();
        Battresdata rdata = new Battresdata();
        
        List<Batt_Maint_Dealarm> list =mapper.serchByCondition(bmd);
        //System.out.println(list.size());
        
        Batt_param_low lowCA=new Batt_param_low();
        lowCA.setLow_type(2);
        lowCA.setLow_nametype(2);//电容告警
        Batt_param_low lowCH=new Batt_param_low();
        lowCH.setLow_type(2);
        lowCH.setLow_nametype(3);//电容更换
        List<Batt_param_low> listCA = paramLowMapper
                .serchByLow(lowCA);
        List<Batt_param_low> listCH = paramLowMapper
                .serchByLow(lowCH);
        Float percentCA = listCA.get(0).getLow_value();
        Float percentCH = listCH.get(0).getLow_value();
        //电导基准/维护建议/电导分析值
        Batt_param_low lowRA=new Batt_param_low();    
        lowRA.setLow_type(3);
        lowRA.setLow_nametype(2);//电导告警
        Batt_param_low lowRH=new Batt_param_low();
        lowRH.setLow_type(3);
        lowRH.setLow_nametype(3);//电导更换
 
        //电导
        List<Batt_param_low> listRA = paramLowMapper
                .serchByLow(lowRA);
        List<Batt_param_low> listRH = paramLowMapper
                .serchByLow(lowRH);
        Float percentRA = listRA.get(0).getLow_value();
        Float percentRH = listRH.get(0).getLow_value();
        int methodRM=listRA.get(0).getLow_method();  //分析方式
        List<AllModel> listAll = new ArrayList<AllModel>();
        
        for (int i = 0; i < list.size(); i++) {
            //System.out.println(list.get(i).getBinf().getBattGroupId());
            tdata.setBattGroupId(list.get(i).getBinf().getBattGroupId());
            
            rinf.setBattGroupId(list.get(i).getBinf().getBattGroupId());
            
            AllModel allmodel = new AllModel();
            if (tservice.judge(tdata).getCode() == 1||eservice.judge(rinf).getCode() == 1) {
                if(tservice.serchByCondition(tdata).getCode() == 1){        
                    if (tdata.getTest_type() == 3) {
                        sdata.setBattGroupId(list.get(i).getBinf().getBattGroupId());
                        sdata.setMon_num(binf.getMonNum());
                        sdata.setTest_record_count(list.get(i).getTdata().getTest_record_count());
                        ServiceModel smodel = sservice.serchByMonNum(sdata);
                        //TODO perry
                        // smodel.setLowCA(percentCA);
                        // smodel.setLowCH(percentCH);
                        allmodel.setSmodel(smodel);
                    }
                }
                if(eservice.serchByCondition(rinf).getCode()==1){
                   if(tdata.getTest_type() == 5){
                       rdata.setBattGroupId(list.get(i).getBinf().getBattGroupId());
                          rdata.setMon_num(binf.getMonNum()!=0?binf.getMonNum()*10+1:0);
                        ServiceModel rmodel = rservice.serchByMonNum(rdata);
                       //TODO perry
                        // rmodel.setLowCA(percentCA);
                        // rmodel.setLowCH(percentCH);
                        // rmodel.setLowRA(percentRA);
                        // rmodel.setLowRH(percentRH);
                        // rmodel.setNewsum(methodRM);//分析方式1:平均值;0:标称值
                        allmodel.setRmodel(rmodel);
                    }
 
                } 
                allmodel.setData(list.get(i));
                //System.out.println(allmodel);
                listAll.add(allmodel);
            }
        }
        
//        for (AllModel a : listAll) {
//            System.out.println(a.getRmodel());
//        }
        return listAll;
    }
    // 1.3根据battgroupid和mon_num的值查出测试信息
    // 或者根据battgroupid和mon_num得到内阻信息(新)
    public ServiceModel serchMon_num(Object obj) {
        Batt_Maint_Dealarm bmd = (Batt_Maint_Dealarm) obj;
        BattInf binf = bmd.getBinf();
        Batttestdata_inf tdata = bmd.getTdata();
        Battresdata_inf rinf=new Battresdata_inf();
        Batttestdatastop sdata = new Batttestdatastop();
        Battresdata rdata = new Battresdata();
        
        List<Batt_Maint_Dealarm> list =mapper.serchByCondition(bmd);
        
        Batt_param_low lowCA=new Batt_param_low();
        lowCA.setLow_type(2);
        lowCA.setLow_nametype(2);//电容告警
        Batt_param_low lowCH=new Batt_param_low();
        lowCH.setLow_type(2);
        lowCH.setLow_nametype(3);//电容更换
        List<Batt_param_low> listCA = paramLowMapper
                .serchByLow(lowCA);
        List<Batt_param_low> listCH = paramLowMapper
                .serchByLow(lowCH);
        Float percentCA = listCA.get(0).getLow_value();
        Float percentCH = listCH.get(0).getLow_value();
        //电导基准/维护建议/电导分析值
        Batt_param_low lowRA=new Batt_param_low();    
        lowRA.setLow_type(3);
        lowRA.setLow_nametype(2);//电导告警
        Batt_param_low lowRH=new Batt_param_low();
        lowRH.setLow_type(3);
        lowRH.setLow_nametype(3);//电导更换
 
        //电导
        List<Batt_param_low> listRA = paramLowMapper
                .serchByLow(lowRA);
        List<Batt_param_low> listRH = paramLowMapper
                .serchByLow(lowRH);
        Float percentRA = listRA.get(0).getLow_value();
        Float percentRH = listRH.get(0).getLow_value();
        int methodRM=listRA.get(0).getLow_method();  //分析方式
        if(list!=null&&list.size()>0){
            model.setCode(1);
            model.setMsg("查询成功!");
            model.setData(list);
            //TODO perry
            // model.setLowCA(percentCA);
            // model.setLowCH(percentCH);
            // model.setLowRA(percentRA);
            // model.setLowRH(percentRH);
            // model.setNewsum(methodRM);//分析方式1:平均值;0:标称值
        }else{
            model.setMsg("查询失败!");
            model.setCode(0);
        }
        return model;
    }
    
    public static void main(String[] args) {
        BattInf binf = new BattInf();
        binf.setStationName("");
        binf.setStationName1("");
        binf.setBattGroupId(1000003);
        binf.setMonNum(0);
        
        Batttestdata_inf tdata=new Batttestdata_inf();
        tdata.setTest_type(5);
        
        Batt_Maint_Dealarm bmd = new Batt_Maint_Dealarm();
        bmd.setBinf(binf);
        bmd.setTdata(tdata);
        
        PageBean pageBean =new PageBean();
        pageBean.setPageCurr(1);
        pageBean.setPageSize(10);
        bmd.setPageBean(pageBean);
        
        Batt_MaintService bs = new Batt_MaintService();
 
        ServiceModel model = bs.serchMon_num(bmd);
    }
}