RemoteAlarmService.java
1.96 KB
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
package cn.com.glsx.admin.modules.remote;
import cn.com.glsx.alarm.api.AlarmFeignClient;
import cn.com.glsx.alarm.services.model.PowerOffBo;
import cn.com.glsx.alarm.services.model.TearDownBo;
import cn.hutool.core.collection.CollectionUtil;
import com.glsx.plat.core.web.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* AlarmFeignClient 服务的处理层
*
* @author yll
*/
@Slf4j
@Service
public class RemoteAlarmService {
@Autowired
private AlarmFeignClient alarmFeignClient;
public Integer getPowerOffAlertCount(List<String> sns, String startTime, String endTime) {
Integer powerOffAlertCount = 0;
if (CollectionUtil.isEmpty(sns)) {
return powerOffAlertCount;
}
PowerOffBo powerOffBo = new PowerOffBo();
powerOffBo.setSns(sns);
powerOffBo.setStartTime(startTime);
powerOffBo.setEndTime(endTime);
R<Integer> powerOffAlertCountR = alarmFeignClient.getPowerOffAlertCount(powerOffBo);
powerOffAlertCount = powerOffAlertCountR.getData(Integer.class);
if (powerOffAlertCount == null) {
powerOffAlertCount = 0;
}
return powerOffAlertCount;
}
public Integer getTearDownAlarmCount(List<String> sns, String startTime, String endTime) {
Integer tearDownAlarmCount = 0;
if (CollectionUtil.isEmpty(sns)) {
return tearDownAlarmCount;
}
TearDownBo tearDownBo = new TearDownBo();
tearDownBo.setSns(sns);
tearDownBo.setStartTime(startTime);
tearDownBo.setEndTime(endTime);
R<Integer> tearDownAlarmCountR = alarmFeignClient.getTearDownAlarmCount(tearDownBo);
tearDownAlarmCount = tearDownAlarmCountR.getData(Integer.class);
if (tearDownAlarmCount == null) {
tearDownAlarmCount = 0;
}
return tearDownAlarmCount;
}
}