|
@@ -550,7 +550,7 @@ public class ProjectDataRecordServiceImpl implements IProjectDataRecordService {
|
|
|
String operator = thresholdConfig.getOperator();
|
|
|
String tempFormula = thresholdConfig.getTempFormula();
|
|
|
if (!StringUtils.isBlank(operator) && !StringUtils.isBlank(tempFormula)) {
|
|
|
- //获取报警开始时间
|
|
|
+ //获取报警开始时间 不检查当前天的数据
|
|
|
Date startAlarmDate = getStartAlarmDate(start, projectId, objId, indicatorId, operator, tempFormula);
|
|
|
if (null != startAlarmDate) {
|
|
|
dayNum = com.persagy.apm.diagnose.utils.DateUtils.getDayNum(startAlarmDate, start);
|
|
@@ -568,6 +568,7 @@ public class ProjectDataRecordServiceImpl implements IProjectDataRecordService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 获取报警起始日期
|
|
|
*/
|
|
@@ -583,28 +584,18 @@ public class ProjectDataRecordServiceImpl implements IProjectDataRecordService {
|
|
|
queryMonitorIndicatorRecordDTO.setTimeTo(checkEndDate); // <
|
|
|
List<MonitorIndicatorRecord> recordList = monitorIndicatorRecordService.queryMonitorIndicatorRecordList(queryMonitorIndicatorRecordDTO);
|
|
|
if (!CollectionUtils.isEmpty(recordList) && recordList.size() > 0) {
|
|
|
- if (recordList.size() == 1){
|
|
|
- MonitorIndicatorRecord record = recordList.get(0);
|
|
|
+ //倒序排
|
|
|
+ recordList.sort(Comparator.comparing(MonitorIndicatorRecord::getDataTime).reversed());
|
|
|
+ Date checkDate = alarmDate;
|
|
|
+ for (MonitorIndicatorRecord record : recordList) {
|
|
|
boolean isFlag = isAccordWith(operator, Double.valueOf(tempFormula), record.getDataValue());
|
|
|
if (!isFlag) {
|
|
|
return record.getDataTime();
|
|
|
- }else{
|
|
|
- return alarmDate;
|
|
|
- }
|
|
|
- }else{
|
|
|
- //倒序排
|
|
|
- recordList.sort(Comparator.comparing(MonitorIndicatorRecord::getDataTime).reversed());
|
|
|
- Date checkDate = alarmDate;
|
|
|
- for (MonitorIndicatorRecord record : recordList) {
|
|
|
- boolean isFlag = isAccordWith(operator, Double.valueOf(tempFormula), record.getDataValue());
|
|
|
- if (!isFlag) {
|
|
|
- return record.getDataTime();
|
|
|
- }
|
|
|
- checkDate = record.getDataTime();
|
|
|
}
|
|
|
- //继续往前找报警开始日期
|
|
|
- return getStartAlarmDate(checkDate, projectId, objId, indicatorId, operator, tempFormula);
|
|
|
+ checkDate = record.getDataTime();
|
|
|
}
|
|
|
+ //继续往前找报警开始日期
|
|
|
+ return getStartAlarmDate(checkDate, projectId, objId, indicatorId, operator, tempFormula);
|
|
|
}
|
|
|
return alarmDate;
|
|
|
}
|
|
@@ -670,16 +661,14 @@ public class ProjectDataRecordServiceImpl implements IProjectDataRecordService {
|
|
|
for (Date dayDate = startDate; dayDate.before(endDate); dayDate = DateUtils.addDays(dayDate, 1)) {
|
|
|
//计算 日均值 并构造实体对象
|
|
|
Double dayAvg = computeDayAvg(dayDate, dateRunDataMap, dayCoolWaterMainReturnTempMap, dayTwdTempMap);
|
|
|
- if (null != dayAvg){
|
|
|
- //构造实体对象
|
|
|
- MonitorIndicatorRecord monitorIndicatorRecord = new MonitorIndicatorRecord();
|
|
|
- monitorIndicatorRecord.setMonitorIndicatorId(indicatorType.getCode());
|
|
|
- monitorIndicatorRecord.setDataTime(dayDate);
|
|
|
- monitorIndicatorRecord.setObjId(cTObjId);
|
|
|
- monitorIndicatorRecord.setProject(projectDTO.getProjectId());
|
|
|
- monitorIndicatorRecord.setDataValue(dayAvg);
|
|
|
- monitorIndicatorRecordService.saveOrUpdateByPk(monitorIndicatorRecord);
|
|
|
- }
|
|
|
+ //构造实体对象
|
|
|
+ MonitorIndicatorRecord monitorIndicatorRecord = new MonitorIndicatorRecord();
|
|
|
+ monitorIndicatorRecord.setMonitorIndicatorId(indicatorType.getCode());
|
|
|
+ monitorIndicatorRecord.setDataTime(dayDate);
|
|
|
+ monitorIndicatorRecord.setObjId(cTObjId);
|
|
|
+ monitorIndicatorRecord.setProject(projectDTO.getProjectId());
|
|
|
+ monitorIndicatorRecord.setDataValue(dayAvg);
|
|
|
+ monitorIndicatorRecordService.saveOrUpdateByPk(monitorIndicatorRecord);
|
|
|
runDate = dayDate;
|
|
|
}
|
|
|
return runDate;
|
|
@@ -719,16 +708,14 @@ public class ProjectDataRecordServiceImpl implements IProjectDataRecordService {
|
|
|
for (Date dayDate = startDate; dayDate.before(endDate); dayDate = DateUtils.addDays(dayDate, 1)) {
|
|
|
//计算冷凝器/蒸发器 日均值 并构造实体对象
|
|
|
Double dayAvg = computeDayAvg(dayDate, dateRunDataMap, firstDayTempDataMap, secondDayTempDataMap);
|
|
|
- if (null != dayAvg){
|
|
|
- //构造实体对象
|
|
|
- MonitorIndicatorRecord monitorIndicatorRecord = new MonitorIndicatorRecord();
|
|
|
- monitorIndicatorRecord.setMonitorIndicatorId(indicatorType.getCode());
|
|
|
- monitorIndicatorRecord.setDataTime(dayDate);
|
|
|
- monitorIndicatorRecord.setObjId(objId);
|
|
|
- monitorIndicatorRecord.setProject(projectId);
|
|
|
- monitorIndicatorRecord.setDataValue(dayAvg);
|
|
|
- monitorIndicatorRecordService.saveOrUpdateByPk(monitorIndicatorRecord);
|
|
|
- }
|
|
|
+ //构造实体对象
|
|
|
+ MonitorIndicatorRecord monitorIndicatorRecord = new MonitorIndicatorRecord();
|
|
|
+ monitorIndicatorRecord.setMonitorIndicatorId(indicatorType.getCode());
|
|
|
+ monitorIndicatorRecord.setDataTime(dayDate);
|
|
|
+ monitorIndicatorRecord.setObjId(objId);
|
|
|
+ monitorIndicatorRecord.setProject(projectId);
|
|
|
+ monitorIndicatorRecord.setDataValue(dayAvg);
|
|
|
+ monitorIndicatorRecordService.saveOrUpdateByPk(monitorIndicatorRecord);
|
|
|
runDate = dayDate;
|
|
|
}
|
|
|
return runDate;
|