change - 超过电阈值定时任务

maser
yinq 1 week ago
parent fa5e01ac66
commit a9703f2322

@ -1,6 +1,8 @@
package com.os.ems.record.service.impl; package com.os.ems.record.service.impl;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -188,9 +190,18 @@ public class EmsRecordAlarmDataServiceImpl implements IEmsRecordAlarmDataService
public void exceedDnbThresholdAlarmsTask() { public void exceedDnbThresholdAlarmsTask() {
EmsBaseMonitorThreshold monitorThreshold = new EmsBaseMonitorThreshold(); EmsBaseMonitorThreshold monitorThreshold = new EmsBaseMonitorThreshold();
monitorThreshold.setMonitorType(2L); monitorThreshold.setMonitorType(2L);
String nowTime = DateUtils.getTime();
String endTime = LocalDateTime
.parse(nowTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))
.plusMinutes(1) // 加一分钟
.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
List<EmsBaseMonitorThreshold> thresholdList = emsBaseMonitorThresholdMapper.selectEmsBaseMonitorThresholdList(monitorThreshold); List<EmsBaseMonitorThreshold> thresholdList = emsBaseMonitorThresholdMapper.selectEmsBaseMonitorThresholdList(monitorThreshold);
EmsRecordDnbInstant dnbInstant = new EmsRecordDnbInstant(); EmsRecordDnbInstant dnbInstant = new EmsRecordDnbInstant();
HashMap<String, Object> selectMap = new HashMap<>();
selectMap.put("beginRecordTime", nowTime);
selectMap.put("endRecordTime", endTime);
dnbInstant.setParams(selectMap);
List<EmsRecordDnbInstant> dnbInstantList = emsRecordDnbInstantMapper.selectEmsRecordDnbInstantList(dnbInstant); List<EmsRecordDnbInstant> dnbInstantList = emsRecordDnbInstantMapper.selectEmsRecordDnbInstantList(dnbInstant);
Map<String, String> thresholdMap = compareThresholdAndRecord(thresholdList, dnbInstantList); Map<String, String> thresholdMap = compareThresholdAndRecord(thresholdList, dnbInstantList);
//防止多次存入异常数据 //防止多次存入异常数据

Loading…
Cancel
Save