|
|
@@ -50,20 +50,19 @@ public class HardwareDeviceMonitor {
|
|
|
@Autowired
|
|
|
private RemoteLabHardwareService remoteLabHardwareService;
|
|
|
|
|
|
- @Scheduled(cron = "0 */9 * * * ?")
|
|
|
+ @Scheduled(cron = "0 */2 * * * ?")
|
|
|
public void checkPowerUse() {
|
|
|
if (dingTalkNotice != null && dingTalkNotice) {
|
|
|
- log.info("【设备监听提醒】 开始执行检查..............");
|
|
|
ResultData result = remoteLabHardwareService.statistics();
|
|
|
if (result != null && result.getCode() == HttpStatus.SUCCESS && result.getData() != null) {
|
|
|
String jsonStr = JSONObject.toJSONString(result.getData());
|
|
|
JSONObject json = JSONObject.parseObject(jsonStr);
|
|
|
Integer offline = json.getInteger("powerSupplyOffline");
|
|
|
- log.info("【设备监听提醒】 异常设备掉线数量:" + offline);
|
|
|
+ log.info("【设备监听提醒】 继电器异常监控--掉线数量:" + offline);
|
|
|
if (offline != null && offline > 0) {
|
|
|
//获取离线列表
|
|
|
ResultData data = remoteLabHardwareService.list("SWITCH", "OFFLINE");
|
|
|
- //log.info("【设备监听提醒】 获取异常列表:"+JSONObject.toJSONString(data));
|
|
|
+ log.info("【设备监听提醒】 继电器异常监控--获取异常列表:"+JSONObject.toJSONString(data));
|
|
|
if (data != null && data.getCode() == HttpStatus.SUCCESS && data.getData() != null) {
|
|
|
//log.info("【设备监听提醒】 异常设备列表信息:" + data.getData());
|
|
|
String listStr = JSONObject.toJSONString(data.getData());
|
|
|
@@ -96,9 +95,8 @@ public class HardwareDeviceMonitor {
|
|
|
}
|
|
|
//通知
|
|
|
if (isSend) {
|
|
|
- String msg = "{\"msgtype\": \"text\",\"text\": {\"content\":\"" + buffer.toString() + "\"}}";
|
|
|
- DingTalkAlert.sendAlert(msg);
|
|
|
- //log.info("【设备监听提醒】 钉钉通知响应:" + rs);
|
|
|
+ String resp = DingTalkAlert.sendAlert(buffer.toString());
|
|
|
+ log.info("【设备监听提醒】 继电器异常监控--钉钉通知响应:" + resp);
|
|
|
}
|
|
|
}
|
|
|
}
|