|
@@ -1,7 +1,6 @@
|
|
|
package com.persagy.apm.diagnose.indicatorrecord.service.impl;
|
|
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.persagy.apm.diagnose.config.ComputePropertiesConfig;
|
|
@@ -23,7 +22,6 @@ import com.persagy.apm.diagnose.service.dto.TimeDataDTO;
|
|
|
import com.persagy.apm.diagnose.timerecord.model.CalculateTimeRecord;
|
|
|
import com.persagy.apm.diagnose.timerecord.service.ICalculateTimeRecordService;
|
|
|
import com.persagy.apm.diagnose.utils.*;
|
|
|
-import com.persagy.apm.energyalarmstarter.alarmdata.service.AlarmConfigServiceImpl;
|
|
|
import com.persagy.framework.ems.data.core.enumeration.EMSOrder;
|
|
|
import com.persagy.framework.ems.data.core.enumeration.SpecialOperator;
|
|
|
import com.persagy.framework.ems.data.mvc.dao.CoreDao;
|
|
@@ -60,10 +58,6 @@ public class MonitorIndicatorRecordServiceImpl implements IMonitorIndicatorRecor
|
|
|
@Autowired
|
|
|
private ICalculateTimeRecordService calculateTimeRecordService;
|
|
|
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private AlarmConfigServiceImpl alarmConfigService;
|
|
|
-
|
|
|
@Autowired
|
|
|
private RedisUtil redisUtil;
|
|
|
|
|
@@ -73,7 +67,6 @@ public class MonitorIndicatorRecordServiceImpl implements IMonitorIndicatorRecor
|
|
|
@Autowired
|
|
|
private ComputePropertiesConfig computePropertiesConfig;
|
|
|
|
|
|
-
|
|
|
@Autowired
|
|
|
private CenterDataService centerDataService;
|
|
|
|
|
@@ -148,7 +141,13 @@ public class MonitorIndicatorRecordServiceImpl implements IMonitorIndicatorRecor
|
|
|
}
|
|
|
}
|
|
|
//通过报警服务查询报警规则
|
|
|
- List<AlarmRuleDTO> projectAlarmRules = energyAlarmService.getProjectAlarmRules(projectDTO.getProjectId());
|
|
|
+ // 查询设备运行诊断的报警类型
|
|
|
+ List<String> eqdxAlarmItemCodeList = energyAlarmService.queryEqdxAlarmItemCodes();
|
|
|
+
|
|
|
+ if (CollectionUtils.isEmpty(eqdxAlarmItemCodeList)) {
|
|
|
+ return new AsyncResult<>("【监测指标数据计算线程】未查询到设备运行诊断的报警类型");
|
|
|
+ }
|
|
|
+ List<AlarmRuleDTO> projectAlarmRules = energyAlarmService.getProjectAlarmRules(projectDTO.getProjectId(), eqdxAlarmItemCodeList);
|
|
|
if (CollectionUtils.isEmpty(projectAlarmRules)) {
|
|
|
return new AsyncResult<>("【监测指标数据计算线程】当前项目:" + projectDTO.getProjectId() + "未设置报警规则");
|
|
|
}
|
|
@@ -180,6 +179,10 @@ public class MonitorIndicatorRecordServiceImpl implements IMonitorIndicatorRecor
|
|
|
}
|
|
|
Date computeEndTime = DateUtils.addDays(lastComputeTime, computePropertiesConfig.getRoundDays());
|
|
|
String formula = calculateMethodDTO.getFormula();
|
|
|
+ if (StringUtils.isBlank(formula)) {
|
|
|
+ log.error("【监测指标数据计算线程】:项目监控指标设置公式为null:" + projectDTO.getProjectId() + ";" + objId + ";" + indicatorId);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
Date computeTime = computeIndicatorData(projectDTO, objId, lastComputeTime, computeEndTime, indicatorId, formula);
|
|
|
saveOrUpdateComputeTime(projectDTO.getProjectId(), objId, indicatorId, computeTime);
|
|
|
}
|
|
@@ -526,10 +529,10 @@ public class MonitorIndicatorRecordServiceImpl implements IMonitorIndicatorRecor
|
|
|
*/
|
|
|
private ConfigItemDataSendTimeDTO getConfigItemSendTimeDTO(ProjectDTO projectDTO, String objIdAndAlarmItemCode) throws Exception {
|
|
|
ConfigItemDataSendTimeDTO sendTimeDTO = null;
|
|
|
- Object obj = redisUtil.get(getRedisSendDataKey(projectDTO.getProjectId(),objIdAndAlarmItemCode));
|
|
|
- if (null != obj){
|
|
|
- sendTimeDTO = JSONUtil.toBean(obj.toString(), ConfigItemDataSendTimeDTO.class);
|
|
|
- }else{
|
|
|
+ Object obj = redisUtil.get(getRedisSendDataKey(projectDTO.getProjectId(), objIdAndAlarmItemCode));
|
|
|
+ if (null != obj) {
|
|
|
+ sendTimeDTO = JSONUtil.toBean(obj.toString(), ConfigItemDataSendTimeDTO.class);
|
|
|
+ } else {
|
|
|
sendTimeDTO = ConfigItemDataSendTimeDTO.builder().lastSendTime(getDefultStartTime()).build();
|
|
|
}
|
|
|
return sendTimeDTO;
|