|
@@ -13,10 +13,7 @@ import com.persagy.apm.diagnose.maintenance.constant.*;
|
|
|
import com.persagy.apm.diagnose.maintenance.model.dto.CalculateMethodDTO;
|
|
|
import com.persagy.apm.diagnose.maintenance.model.dto.WeatherDTO;
|
|
|
import com.persagy.apm.diagnose.maintenance.service.IProjectDataRecordService;
|
|
|
-import com.persagy.apm.diagnose.service.CenterDataService;
|
|
|
-import com.persagy.apm.diagnose.service.EnergyAlarmServiceImpl;
|
|
|
-import com.persagy.apm.diagnose.service.SaasService;
|
|
|
-import com.persagy.apm.diagnose.service.WeatherServiceImpl;
|
|
|
+import com.persagy.apm.diagnose.service.*;
|
|
|
import com.persagy.apm.diagnose.service.dto.AlarmRuleDTO;
|
|
|
import com.persagy.apm.diagnose.service.dto.ProjectDTO;
|
|
|
import com.persagy.apm.diagnose.service.dto.TimeDataDTO;
|
|
@@ -96,6 +93,8 @@ public class ProjectDataRecordServiceImpl implements IProjectDataRecordService {
|
|
|
|
|
|
@Resource(name = "ZillionDao")
|
|
|
private CoreDao coredao;
|
|
|
+ @Autowired
|
|
|
+ private MsgProducer msgProducer;
|
|
|
|
|
|
@Override
|
|
|
@Async("asyncComputeMaintenanceDataExecutor")
|
|
@@ -280,7 +279,12 @@ public class ProjectDataRecordServiceImpl implements IProjectDataRecordService {
|
|
|
|
|
|
for (Map.Entry<String, List<String>> entry : objIdAlarmItemCodeAndInfoCodes.entrySet()) {
|
|
|
String objIdAndAlarmItemCode = entry.getKey();
|
|
|
-
|
|
|
+ long time = System.currentTimeMillis() + (20 * 1000);
|
|
|
+ if (!lockUtil.lock(projectId +objIdAndAlarmItemCode+ "_sendMaintenance", String.valueOf(time))) {
|
|
|
+ // 获取不到锁,略过
|
|
|
+ log.error("【监测维保数据推送线程】:项目:" + projectId + "被占用");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
int indexOf = objIdAndAlarmItemCode.indexOf("_");
|
|
|
String objId = objIdAndAlarmItemCode.substring(0, indexOf);
|
|
|
String alarmItemCode = objIdAndAlarmItemCode.substring(indexOf + 1);
|
|
@@ -314,9 +318,11 @@ public class ProjectDataRecordServiceImpl implements IProjectDataRecordService {
|
|
|
sendTimeKeyAndDataList.put(dateListEntry.getKey(),value);
|
|
|
endTime = com.persagy.apm.diagnose.utils.DateUtils.str2Date(dateListEntry.getKey(), com.persagy.apm.diagnose.utils.DateUtils.SDFSECOND);
|
|
|
}
|
|
|
- String sentValue = CollectDataUtil.batchBuildSendParam(sendTimeKeyAndDataList,alarmItemCode);
|
|
|
- AlarmWebSocketServer.sendMsgToClients(projectId, sentValue);
|
|
|
- log.info("设备维保发送数据服务数据:" + projectId+";"+ sentValue);
|
|
|
+ JSONArray sendArray = CollectDataUtil.batchBuildSendJsonParam(sendTimeKeyAndDataList,alarmItemCode);
|
|
|
+ msgProducer.sendMaintenanceMsg(sendArray);
|
|
|
+// String sentValue = CollectDataUtil.batchBuildSendParam(sendTimeKeyAndDataList,alarmItemCode);
|
|
|
+ // AlarmWebSocketServer.sendMsgToClients(projectId, sentValue);
|
|
|
+ log.info("设备维保发送数据服务数据:" + projectId+";"+ sendArray);
|
|
|
configItemSendTimeDTO.setLastSendTime(endTime);
|
|
|
configItemSendTimeDTO.setUpdateTime(new Date());
|
|
|
updateRedisConfigItemSendTimeDTO(projectId, objIdAndAlarmItemCode, configItemSendTimeDTO);
|