|
@@ -3,6 +3,7 @@ package com.persagy.apm.diagnose.indicatorrecord.service.impl;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.persagy.apm.diagnose.config.ComputePropertiesConfig;
|
|
|
+import com.persagy.apm.diagnose.config.JmsConfig;
|
|
|
import com.persagy.apm.diagnose.constant.DiAgnoseConst;
|
|
|
import com.persagy.apm.diagnose.constant.EnumDataTimeType;
|
|
|
import com.persagy.apm.diagnose.constant.EnumTimeType;
|
|
@@ -12,7 +13,6 @@ import com.persagy.apm.diagnose.indicatorrecord.model.dto.*;
|
|
|
import com.persagy.apm.diagnose.indicatorrecord.service.IMonitorIndicatorRecordService;
|
|
|
import com.persagy.apm.diagnose.service.CenterDataService;
|
|
|
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.CalculateMethodDTO;
|
|
|
import com.persagy.apm.diagnose.service.dto.ProjectDTO;
|
|
@@ -21,7 +21,6 @@ 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.apm.energyalarmstarter.collectdata.websocket.AlarmWebSocketServer;
|
|
|
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;
|
|
@@ -88,7 +87,7 @@ public class MonitorIndicatorRecordServiceImpl implements IMonitorIndicatorRecor
|
|
|
@Resource(name = "ZillionDao")
|
|
|
private CoreDao coredao;
|
|
|
@Autowired
|
|
|
- private MsgProducer msgProducer;
|
|
|
+ private JmsConfig jmsConfig;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -358,16 +357,16 @@ public class MonitorIndicatorRecordServiceImpl implements IMonitorIndicatorRecor
|
|
|
|
|
|
for (Map.Entry<String, List<String>> entry : objIdAlarmItemCodeAndInfoCodes.entrySet()) {
|
|
|
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("_");
|
|
|
String objId = objIdAndAlarmItemCode.substring(0, indexOf);
|
|
|
String alarmItemCode = objIdAndAlarmItemCode.substring(indexOf + 1);
|
|
|
+ String lockKey = objId+"-"+alarmItemCode;
|
|
|
+ Object isLock = redisUtil.get(lockKey);
|
|
|
+ if (null == isLock){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ long time = System.currentTimeMillis() + (10 * 1000);
|
|
|
+ lockUtil.lock(lockKey, String.valueOf(time));
|
|
|
|
|
|
List<String> infCodeList = entry.getValue();
|
|
|
|
|
@@ -391,10 +390,7 @@ public class MonitorIndicatorRecordServiceImpl implements IMonitorIndicatorRecor
|
|
|
endTime = DateUtils.str2Date(dateListEntry.getKey(), DateUtils.SDFSECOND);
|
|
|
}
|
|
|
JSONArray sendArray = CollectDataUtil.batchBuildSendJsonParam(sendTimeKeyAndDataList,alarmItemCode);
|
|
|
- msgProducer.sendIndicatorMsg(sendArray);
|
|
|
- //加锁
|
|
|
- long time1 = System.currentTimeMillis() + (20 * 1000);
|
|
|
- lockUtil.lock(projectDTO.getProjectId()+objIdAndAlarmItemCode+ "_sendData", String.valueOf(time1));
|
|
|
+ jmsConfig.sendMsg(sendArray);
|
|
|
// String sentValue = CollectDataUtil.batchBuildSendParam(sendTimeKeyAndDataList,alarmItemCode);
|
|
|
//AlarmWebSocketServer.sendMsgToClients(projectDTO.getProjectId(), sentValue);
|
|
|
log.error("指标发送报表服务数据:" + projectDTO.getProjectId()+";"+ sendArray);
|