ke
2024-05-13 659d3e60c6fe5e5bcd8c4cbb3dd8077e29f13a38
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
package cn.gistack.nky.service.impl;
 
import cn.gistack.nky.entity.AlarmGet;
import cn.gistack.nky.mapper.AlarmGetMapper;
import cn.gistack.nky.requestpojo.AlarmGetPo;
import cn.gistack.nky.requestpojo.BatchDataPo;
import cn.gistack.nky.resultpojo.DataResChildrenPo;
import cn.gistack.nky.resultpojo.DataResPo;
import cn.gistack.nky.service.IAlarmGetService;
import cn.gistack.nky.service.INkyService;
import cn.gistack.nky.service.IZtApiService;
import cn.gistack.nky.vo.AlarmGetVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
 
import java.util.ArrayList;
import java.util.List;
 
@AllArgsConstructor
@Service
public class AlarmGetServiceImpl extends ServiceImpl<AlarmGetMapper, AlarmGet> implements IAlarmGetService {
 
    private final INkyService nkyService;
    private final IZtApiService ztApiService;
 
    @Override
    public void batchData(String type) {
 
        List<DataResPo> cdList = getResCdList(type);
        cdList.forEach(dataResPo -> {
            if (dataResPo.getChildren() != null && dataResPo.getChildren().size()>0){
                BatchDataPo batchDataPo = new BatchDataPo(dataResPo, type);
                nkyService.batchData(batchDataPo);
            }
        });
 
    }
 
    @Override
    public void alarmGetData(String type) {
        List<DataResChildrenPo> cdList = getCdList(type);
 
        cdList.forEach(dataResChildrenPo -> {
            AlarmGetPo alarmGetPo = new AlarmGetPo(dataResChildrenPo,type);
 
            nkyService.alarmGetData(alarmGetPo);
 
        });
 
    }
 
    @Override
    public List<AlarmGetVO> getAlarmDetail(AlarmGetVO alarmGet) {
        return baseMapper.getAlarmDetail(alarmGet);
    }
 
    @Override
    public IPage<AlarmGetVO> getAlarmDetailPage(IPage<AlarmGetVO> page, AlarmGetVO alarmGet) {
            return  page.setRecords(baseMapper.getAlarmDetailPage(page,alarmGet));
    }
 
    @Override
    public AlarmGetVO getAlarmVO(AlarmGetVO alarmGet) {
        return baseMapper.getAlarmVo(alarmGet);
    }
 
    /**
     * 获取水库集
     *
     * @param type
     * @return
     */
    public List<DataResPo> getResCdList(String type) {
        List<DataResPo> cdList = new ArrayList<>();
        if (type.equals("1")) {
            //获取渗压测点
            cdList = ztApiService.getResSy();
        } else if (type.equals("2")) {
            //获取渗流测点
            cdList=ztApiService.getResSl();
        } else if (type.equals("3") || type.equals("4") || type.equals("5")) {
            //获取位移测点
            cdList = ztApiService.getResWy();
        } else {
            return null;
        }
        return cdList;
    }
 
    public  List<DataResChildrenPo> getCdList(String type){
        List<DataResChildrenPo> cdList = new ArrayList<>();
        if (type.equals("1")){
            //获取渗压测点
            cdList = ztApiService.getSy();
        }else if (type.equals("2")){
            //获取渗流测点
            return null;
        }else if (type.equals("3") || type.equals("4") || type.equals("5")){
            //获取位移测点
            cdList = ztApiService.getWy();
        }else {
            return null;
        }
        return cdList;
    }
}