whyczh
2021-07-01 2e0bc686f2100782fa1d331cc98b5f65ba19c206
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.whyc.service;
 
import com.whyc.dto.Response;
import com.whyc.pojo.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
 
import java.util.HashMap;
import java.util.List;
 
@Service
public class DeviceService {
 
    @Autowired
    private AFECtrlService afeCtrlService;
    @Autowired
    private AFEInverterService afeInverterService;
    @Autowired
    private AFERectifierService afeRectifierService;
    @Autowired
    private CentralMonitorSysCtrlService centralMonitorSysCtrlService;
    @Autowired
    private CentralMonitorSysRTService centralMonitorSysRTService;
    @Autowired
    private CentralMonitorSysSTService centralMonitorSysSTService;
    @Autowired
    private DeviceStateService deviceStateService;
 
    @Autowired
    private MotorSystemInfService motorSystemInfService;
    @Autowired
    private OilCommService oilCommService;
 
    @Autowired
    private RectifierPowerCtrlService rectifierPowerCtrlService;
    @Autowired
    private RectifierPowerService rectifierPowerService;
    @Autowired
    private UPSCommService upsCommService;
    @Autowired
    private WaterCommService waterCommService;
 
    @Qualifier("SER-UPSCommService")
    @Autowired
    private com.whyc.app.service.UPSCommService upsService;
 
    public Response getAllRT(){
        HashMap<String, Object> map = new HashMap<>();
        //进出线屏
        CentralMonitorSysCtrl screenCtrl = centralMonitorSysCtrlService.getInfoByDevId(10001).getData();
        List<CentralMonitorSysRT> screenRTList = centralMonitorSysRTService.getAll().getData();
 
        map.put("screenCtrl",screenCtrl);
        map.put("screenRTList",screenRTList);
 
        //直流主配板
        CentralMonitorSysST dcMainBoard = centralMonitorSysSTService.getInfoByDevId(10005).getData();
        map.put("dcMainBoard",dcMainBoard);
 
        //整流电源
        List<RectifierPowerControl> powerCtrlList = rectifierPowerCtrlService.getAll().getData();
        RectifierPowerRT powerRT = rectifierPowerService.getInfoByDevId(30001).getData();
 
        map.put("powerCtrlList",powerCtrlList);
        map.put("powerRT",powerRT);
 
 
        UPSComm upsComm = upsService.getstatus();
        map.put("upsComm",upsComm);
 
        return new Response().set(1,map);
    }
 
    /**
     * 查询设备实时状态
     * @param deviceId
     * @return
     */
    public Response getStatus(Integer deviceId) {
 
        //int deviceType = deviceId/10000;
        //switch (deviceType){
        switch (deviceId){
            //进出线屏
            case 10001:
            case 10002:
            case 10003:
            case 10004:
                {
                    //创建Map,分别存放数据和控制状态
                    HashMap<String, Object> map = new HashMap<>();
                    CentralMonitorSysCtrl screenCtrl = centralMonitorSysCtrlService.getInfoByDevId(10001).getData();
                    CentralMonitorSysRT screenRT = centralMonitorSysRTService.getInfoByDevId(deviceId).getData();
 
                    map.put("ctrl",screenCtrl);
                    map.put("rt",screenRT);
                    return new Response().set(1,map);
                }
            //直流主配板
            case 10005:
                {
                    return centralMonitorSysSTService.getInfoByDevId(10005);
                }
            case 2:
            //大功率整流电源
            case 30001:
                {
                    //创建Map,分别存放数据和控制状态
                    HashMap<String, Object> map = new HashMap<>();
                    RectifierPowerControl powerCtrl = rectifierPowerCtrlService.getInfoByDevId(10001).getData();
                    RectifierPowerRT powerRT = rectifierPowerService.getInfoByDevId(deviceId).getData();
 
                    map.put("ctrl",powerCtrl);
                    map.put("rt",powerRT);
                    return new Response().set(1,map);
                }
            case 4:
                {
 
                }
            default: return new Response().setMsg(1,"无法查询到设备信息");
        }
    }
}