|
|
|
@ -1,15 +1,24 @@
|
|
|
|
|
package com.hw.dms.service.impl;
|
|
|
|
|
|
|
|
|
|
import java.rmi.ServerException;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
|
|
|
|
import com.hw.common.core.constant.DmsConstants;
|
|
|
|
|
import com.hw.common.core.constant.SecurityConstants;
|
|
|
|
|
import com.hw.common.core.constant.SystemConstants;
|
|
|
|
|
import com.hw.common.core.utils.DateUtils;
|
|
|
|
|
import com.hw.common.security.utils.SecurityUtils;
|
|
|
|
|
import com.hw.system.api.RemoteSysCommonService;
|
|
|
|
|
import com.hw.system.api.domain.common.SysPointRouter;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import com.hw.dms.mapper.DmsRecordAlarmInfoMapper;
|
|
|
|
|
import com.hw.dms.domain.DmsRecordAlarmInfo;
|
|
|
|
|
import com.hw.dms.service.IDmsRecordAlarmInfoService;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 设备报警记录Service业务层处理
|
|
|
|
@ -22,6 +31,9 @@ public class DmsRecordAlarmInfoServiceImpl implements IDmsRecordAlarmInfoService
|
|
|
|
|
@Autowired
|
|
|
|
|
private DmsRecordAlarmInfoMapper dmsRecordAlarmInfoMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private RemoteSysCommonService remoteSysCommonService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询设备报警记录
|
|
|
|
|
*
|
|
|
|
@ -92,6 +104,7 @@ public class DmsRecordAlarmInfoServiceImpl implements IDmsRecordAlarmInfoService
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 设备报警人工处理
|
|
|
|
|
*
|
|
|
|
|
* @param dmsRecordAlarmInfo
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
@ -104,4 +117,47 @@ public class DmsRecordAlarmInfoServiceImpl implements IDmsRecordAlarmInfoService
|
|
|
|
|
dmsRecordAlarmInfo.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
|
return dmsRecordAlarmInfoMapper.updateDmsRecordAlarmInfo(dmsRecordAlarmInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 设备报警消息通知
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = ServerException.class)
|
|
|
|
|
public int alarmNotification() {
|
|
|
|
|
DmsRecordAlarmInfo selectAlarmInfo = new DmsRecordAlarmInfo();
|
|
|
|
|
selectAlarmInfo.setNoticeType(SystemConstants.DMS_NOTICE_TYPE_WEB);
|
|
|
|
|
selectAlarmInfo.setNoticeStatus(SystemConstants.DMS_NOTICE_STATUS_FALSE);
|
|
|
|
|
List<DmsRecordAlarmInfo> alarmInfoList = dmsRecordAlarmInfoMapper.selectDmsRecordAlarmInfoList(selectAlarmInfo);
|
|
|
|
|
if (alarmInfoList.size() == 0) {
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
List<SysPointRouter> webRouterList = new ArrayList<>();
|
|
|
|
|
Gson gson = new Gson();
|
|
|
|
|
HashMap<String, Object> map = new HashMap<>();
|
|
|
|
|
for (DmsRecordAlarmInfo alarmInfo : alarmInfoList) {
|
|
|
|
|
SysPointRouter pointRouter = new SysPointRouter();
|
|
|
|
|
pointRouter.setModuleCode(SystemConstants.DMS);
|
|
|
|
|
pointRouter.setPointType(SystemConstants.SYS_ROUTER_POINT_TYPE_ALARM);
|
|
|
|
|
pointRouter.setRouterAddress(SystemConstants.SYS_ROUTER_DMS_ALARM_URL);
|
|
|
|
|
map.put("alarmId", alarmInfo.getAlarmId());
|
|
|
|
|
String json = gson.toJson(map);
|
|
|
|
|
pointRouter.setRouterAddressDetail(json);
|
|
|
|
|
pointRouter.setRemark(alarmInfo.getAlarmReason());
|
|
|
|
|
webRouterList.add(pointRouter);
|
|
|
|
|
}
|
|
|
|
|
//WEB通知
|
|
|
|
|
remoteSysCommonService.insertSysPointRouterPort(webRouterList, SecurityConstants.INNER);
|
|
|
|
|
for (DmsRecordAlarmInfo alarmInfo : alarmInfoList) {
|
|
|
|
|
DmsRecordAlarmInfo recordAlarmInfo = new DmsRecordAlarmInfo();
|
|
|
|
|
recordAlarmInfo.setAlarmId(alarmInfo.getAlarmId());
|
|
|
|
|
recordAlarmInfo.setNoticeStatus(SystemConstants.DMS_NOTICE_STATUS_TRUE);
|
|
|
|
|
this.updateDmsRecordAlarmInfo(recordAlarmInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//公众号通知
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|