|
@@ -1,5 +1,6 @@
|
|
package com.persagy.apm.diagnose.indicatorrecord.service.impl;
|
|
package com.persagy.apm.diagnose.indicatorrecord.service.impl;
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.persagy.apm.diagnose.config.ComputePropertiesConfig;
|
|
import com.persagy.apm.diagnose.config.ComputePropertiesConfig;
|
|
import com.persagy.apm.diagnose.constant.DiAgnoseConst;
|
|
import com.persagy.apm.diagnose.constant.DiAgnoseConst;
|
|
@@ -11,6 +12,7 @@ import com.persagy.apm.diagnose.indicatorrecord.model.dto.*;
|
|
import com.persagy.apm.diagnose.indicatorrecord.service.IMonitorIndicatorRecordService;
|
|
import com.persagy.apm.diagnose.indicatorrecord.service.IMonitorIndicatorRecordService;
|
|
import com.persagy.apm.diagnose.service.CenterDataService;
|
|
import com.persagy.apm.diagnose.service.CenterDataService;
|
|
import com.persagy.apm.diagnose.service.EnergyAlarmServiceImpl;
|
|
import com.persagy.apm.diagnose.service.EnergyAlarmServiceImpl;
|
|
|
|
+import com.persagy.apm.diagnose.service.MsgProducer;
|
|
import com.persagy.apm.diagnose.service.dto.AlarmRuleDTO;
|
|
import com.persagy.apm.diagnose.service.dto.AlarmRuleDTO;
|
|
import com.persagy.apm.diagnose.service.dto.CalculateMethodDTO;
|
|
import com.persagy.apm.diagnose.service.dto.CalculateMethodDTO;
|
|
import com.persagy.apm.diagnose.service.dto.ProjectDTO;
|
|
import com.persagy.apm.diagnose.service.dto.ProjectDTO;
|
|
@@ -85,6 +87,8 @@ public class MonitorIndicatorRecordServiceImpl implements IMonitorIndicatorRecor
|
|
|
|
|
|
@Resource(name = "ZillionDao")
|
|
@Resource(name = "ZillionDao")
|
|
private CoreDao coredao;
|
|
private CoreDao coredao;
|
|
|
|
+ @Autowired
|
|
|
|
+ private MsgProducer msgProducer;
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -354,6 +358,12 @@ public class MonitorIndicatorRecordServiceImpl implements IMonitorIndicatorRecor
|
|
|
|
|
|
for (Map.Entry<String, List<String>> entry : objIdAlarmItemCodeAndInfoCodes.entrySet()) {
|
|
for (Map.Entry<String, List<String>> entry : objIdAlarmItemCodeAndInfoCodes.entrySet()) {
|
|
String objIdAndAlarmItemCode = entry.getKey();
|
|
String objIdAndAlarmItemCode = entry.getKey();
|
|
|
|
+ long time = System.currentTimeMillis() + (20 * 1000);
|
|
|
|
+ if (!lockUtil.lock(projectDTO.getProjectId()+objIdAndAlarmItemCode+ "_sendData", String.valueOf(time))) {
|
|
|
|
+ // 获取不到锁,略过
|
|
|
|
+ log.error("【监测指标数据计算线程】:项目:" + projectDTO.getProjectId() +objIdAndAlarmItemCode+ "被占用");
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
|
|
int indexOf = objIdAndAlarmItemCode.indexOf("_");
|
|
int indexOf = objIdAndAlarmItemCode.indexOf("_");
|
|
String objId = objIdAndAlarmItemCode.substring(0, indexOf);
|
|
String objId = objIdAndAlarmItemCode.substring(0, indexOf);
|
|
@@ -380,9 +390,11 @@ public class MonitorIndicatorRecordServiceImpl implements IMonitorIndicatorRecor
|
|
sendTimeKeyAndDataList.put(dateListEntry.getKey(),value);
|
|
sendTimeKeyAndDataList.put(dateListEntry.getKey(),value);
|
|
endTime = DateUtils.str2Date(dateListEntry.getKey(), DateUtils.SDFSECOND);
|
|
endTime = DateUtils.str2Date(dateListEntry.getKey(), DateUtils.SDFSECOND);
|
|
}
|
|
}
|
|
- String sentValue = CollectDataUtil.batchBuildSendParam(sendTimeKeyAndDataList,alarmItemCode);
|
|
|
|
- AlarmWebSocketServer.sendMsgToClients(projectDTO.getProjectId(), sentValue);
|
|
|
|
- log.error("指标发送报表服务数据:" + projectDTO.getProjectId()+";"+ sentValue);
|
|
|
|
|
|
+ JSONArray sendArray = CollectDataUtil.batchBuildSendJsonParam(sendTimeKeyAndDataList,alarmItemCode);
|
|
|
|
+ msgProducer.sendIndicatorMsg(sendArray);
|
|
|
|
+// String sentValue = CollectDataUtil.batchBuildSendParam(sendTimeKeyAndDataList,alarmItemCode);
|
|
|
|
+ //AlarmWebSocketServer.sendMsgToClients(projectDTO.getProjectId(), sentValue);
|
|
|
|
+ log.error("指标发送报表服务数据:" + projectDTO.getProjectId()+";"+ sendArray);
|
|
configItemSendTimeDTO.setLastSendTime(endTime);
|
|
configItemSendTimeDTO.setLastSendTime(endTime);
|
|
configItemSendTimeDTO.setUpdateTime(new Date());
|
|
configItemSendTimeDTO.setUpdateTime(new Date());
|
|
updateRedisConfigItemSendTimeDTO(projectDTO.getProjectId(), objIdAndAlarmItemCode, configItemSendTimeDTO);
|
|
updateRedisConfigItemSendTimeDTO(projectDTO.getProjectId(), objIdAndAlarmItemCode, configItemSendTimeDTO);
|