|
@@ -540,28 +540,28 @@ public class ProjectDataRecordServiceImpl implements IProjectDataRecordService {
|
|
|
saveIndicatorType = EnumMaintenanceIndicatorType.ACCCOT_ContinuousOperation;
|
|
|
}
|
|
|
}
|
|
|
- if (null != thresholdConfig && null != timeConfig && null != saveIndicatorType) {
|
|
|
- //>=、>、<=、<、==
|
|
|
- String operator = thresholdConfig.getOperator();
|
|
|
- String tempFormula = thresholdConfig.getTempFormula();
|
|
|
- if (!StringUtils.isBlank(operator) && !StringUtils.isBlank(tempFormula)) {
|
|
|
- for (Date start = lastComputeTime; start.before(todayDate); start = DateUtils.addDays(start, 1)) {
|
|
|
+ for (Date start = lastComputeTime; start.before(todayDate); start = DateUtils.addDays(start, 1)) {
|
|
|
+ Integer dayNum = 0;
|
|
|
+ if (null != thresholdConfig && null != timeConfig && null != saveIndicatorType) {
|
|
|
+ //>=、>、<=、<、==
|
|
|
+ String operator = thresholdConfig.getOperator();
|
|
|
+ String tempFormula = thresholdConfig.getTempFormula();
|
|
|
+ if (!StringUtils.isBlank(operator) && !StringUtils.isBlank(tempFormula)) {
|
|
|
//获取报警开始时间
|
|
|
Date startAlarmDate = getStartAlarmDate(start, projectId, objId, indicatorId, operator, tempFormula);
|
|
|
- Integer dayNum = 0;
|
|
|
if (null != startAlarmDate) {
|
|
|
dayNum = com.persagy.apm.diagnose.utils.DateUtils.getDayNum(startAlarmDate, start);
|
|
|
}
|
|
|
- //构造实体对象
|
|
|
- MonitorIndicatorRecord monitorIndicatorRecord = new MonitorIndicatorRecord();
|
|
|
- monitorIndicatorRecord.setMonitorIndicatorId(saveIndicatorType.getCode());
|
|
|
- monitorIndicatorRecord.setDataTime(start);
|
|
|
- monitorIndicatorRecord.setObjId(objId);
|
|
|
- monitorIndicatorRecord.setProject(projectId);
|
|
|
- monitorIndicatorRecord.setDataValue(Double.valueOf(dayNum));
|
|
|
- monitorIndicatorRecordService.saveOrUpdateByPk(monitorIndicatorRecord);
|
|
|
}
|
|
|
}
|
|
|
+ //构造实体对象
|
|
|
+ MonitorIndicatorRecord monitorIndicatorRecord = new MonitorIndicatorRecord();
|
|
|
+ monitorIndicatorRecord.setMonitorIndicatorId(saveIndicatorType.getCode());
|
|
|
+ monitorIndicatorRecord.setDataTime(start);
|
|
|
+ monitorIndicatorRecord.setObjId(objId);
|
|
|
+ monitorIndicatorRecord.setProject(projectId);
|
|
|
+ monitorIndicatorRecord.setDataValue(Double.valueOf(dayNum));
|
|
|
+ monitorIndicatorRecordService.saveOrUpdateByPk(monitorIndicatorRecord);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -575,23 +575,19 @@ public class ProjectDataRecordServiceImpl implements IProjectDataRecordService {
|
|
|
queryMonitorIndicatorRecordDTO.setProjectId(projectId);
|
|
|
queryMonitorIndicatorRecordDTO.setObjId(objId);
|
|
|
queryMonitorIndicatorRecordDTO.setMonitorIndicatorId(indicatorId);
|
|
|
- queryMonitorIndicatorRecordDTO.setTimeFrom(checkStartDate);
|
|
|
- queryMonitorIndicatorRecordDTO.setTimeTo(alarmDate);
|
|
|
+ queryMonitorIndicatorRecordDTO.setTimeFrom(checkStartDate); // >=
|
|
|
+ queryMonitorIndicatorRecordDTO.setTimeTo(alarmDate); // <=
|
|
|
List<MonitorIndicatorRecord> recordList = monitorIndicatorRecordService.queryMonitorIndicatorRecordList(queryMonitorIndicatorRecordDTO);
|
|
|
- if (!CollectionUtils.isEmpty(recordList)) {
|
|
|
+ if (!CollectionUtils.isEmpty(recordList) && recordList.size() > 0) {
|
|
|
//倒序排
|
|
|
recordList.sort(Comparator.comparing(MonitorIndicatorRecord::getDataTime).reversed());
|
|
|
Date checkDate = alarmDate;
|
|
|
- if (!StringUtils.isBlank(tempFormula)) {
|
|
|
- if (!CollectionUtils.isEmpty(recordList)) {
|
|
|
- for (MonitorIndicatorRecord record : recordList) {
|
|
|
- boolean isFlag = isAccordWith(operator, Double.valueOf(tempFormula), record.getDataValue());
|
|
|
- if (!isFlag) {
|
|
|
- return record.getDataTime();
|
|
|
- }
|
|
|
- checkDate = record.getDataTime();
|
|
|
- }
|
|
|
+ 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);
|
|
@@ -673,14 +669,16 @@ public class ProjectDataRecordServiceImpl implements IProjectDataRecordService {
|
|
|
for (Date dayDate = startDate; dayDate.before(endDate); dayDate = DateUtils.addDays(dayDate, 1)) {
|
|
|
//计算 日均值 并构造实体对象
|
|
|
Double dayAvg = computeDayAvg(dayDate, dateRunDataMap, dayCoolWaterMainReturnTempMap, dayTwdTempMap);
|
|
|
- //构造实体对象
|
|
|
- MonitorIndicatorRecord monitorIndicatorRecord = new MonitorIndicatorRecord();
|
|
|
- monitorIndicatorRecord.setMonitorIndicatorId(indicatorType.getCode());
|
|
|
- monitorIndicatorRecord.setDataTime(dayDate);
|
|
|
- monitorIndicatorRecord.setObjId(cTObjId);
|
|
|
- monitorIndicatorRecord.setProject(projectDTO.getProjectId());
|
|
|
- monitorIndicatorRecord.setDataValue(dayAvg);
|
|
|
- monitorIndicatorRecordService.saveOrUpdateByPk(monitorIndicatorRecord);
|
|
|
+ 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);
|
|
|
+ }
|
|
|
runDate = dayDate;
|
|
|
}
|
|
|
return runDate;
|
|
@@ -720,14 +718,16 @@ public class ProjectDataRecordServiceImpl implements IProjectDataRecordService {
|
|
|
for (Date dayDate = startDate; dayDate.before(endDate); dayDate = DateUtils.addDays(dayDate, 1)) {
|
|
|
//计算冷凝器/蒸发器 日均值 并构造实体对象
|
|
|
Double dayAvg = computeDayAvg(dayDate, dateRunDataMap, firstDayTempDataMap, secondDayTempDataMap);
|
|
|
- //构造实体对象
|
|
|
- MonitorIndicatorRecord monitorIndicatorRecord = new MonitorIndicatorRecord();
|
|
|
- monitorIndicatorRecord.setMonitorIndicatorId(indicatorType.getCode());
|
|
|
- monitorIndicatorRecord.setDataTime(dayDate);
|
|
|
- monitorIndicatorRecord.setObjId(objId);
|
|
|
- monitorIndicatorRecord.setProject(projectId);
|
|
|
- monitorIndicatorRecord.setDataValue(dayAvg);
|
|
|
- monitorIndicatorRecordService.saveOrUpdateByPk(monitorIndicatorRecord);
|
|
|
+ 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);
|
|
|
+ }
|
|
|
runDate = dayDate;
|
|
|
}
|
|
|
return runDate;
|