fix(alarm): 修复报警服务中的消息发送逻辑

- 移除注释掉的appNotificationService调用代码
- 修复事件服务中消息发送参数的条件判断逻辑
- 更新设备模型服务中监测点模板生成逻辑,支持不同设备类型
- 修复心跳服务中设备离线通知逻辑,暂时关闭消息发送功能
- 添加对直接连接设备和便携式设备的特殊处理逻辑
- 优化监测点名称生成规则,增加输出侧监测点支持
This commit is contained in:
xy
2026-07-14 14:42:53 +08:00
parent c6f46cc319
commit 3c369d0244
4 changed files with 49 additions and 31 deletions

View File

@@ -43,6 +43,7 @@ import com.njcn.system.pojo.param.CsWaveParam;
import com.njcn.system.pojo.param.EleEpdPqdParam; import com.njcn.system.pojo.param.EleEpdPqdParam;
import com.njcn.system.pojo.param.EleEvtParam; import com.njcn.system.pojo.param.EleEvtParam;
import com.njcn.system.pojo.po.EleEpdPqd; import com.njcn.system.pojo.po.EleEpdPqd;
import com.njcn.system.pojo.po.SysDicTreePO;
import com.njcn.system.pojo.vo.DictTreeVO; import com.njcn.system.pojo.vo.DictTreeVO;
import com.njcn.web.utils.RequestUtil; import com.njcn.web.utils.RequestUtil;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@@ -125,7 +126,7 @@ public class CsDevModelServiceImpl implements ICsDevModelService {
//2.录入数据集、详细数据(主设备、模块、监测设备、便携式设备...) //2.录入数据集、详细数据(主设备、模块、监测设备、便携式设备...)
analysisDataSet(templateDto,csDevModelPo.getId()); analysisDataSet(templateDto,csDevModelPo.getId());
//3.录入监测点模板表(记录当前模板有几个监测点治理类型的模板目前规定1个监测点电能质量模板根据逻辑子设备来) //3.录入监测点模板表(记录当前模板有几个监测点治理类型的模板目前规定1个监测点电能质量模板根据逻辑子设备来)
addCsLineModel(templateDto,csDevModelPo.getId()); addCsLineModel(templateDto,csDevModelPo.getId(),devType);
//4.如果是云前置的模板录入,重新录入完需要将模板关系信息重新录入 //4.如果是云前置的模板录入,重新录入完需要将模板关系信息重新录入
if (Objects.equals(devType,DicDataEnum.DEV_CLD.getCode())) { if (Objects.equals(devType,DicDataEnum.DEV_CLD.getCode())) {
List<CsEquipmentDeliveryPO> list = eequipmentFeignClient.getAll().getData(); List<CsEquipmentDeliveryPO> list = eequipmentFeignClient.getAll().getData();
@@ -1205,7 +1206,7 @@ public class CsDevModelServiceImpl implements ICsDevModelService {
/** /**
* 根据模板文件来录入监测点模板 * 根据模板文件来录入监测点模板
*/ */
private void addCsLineModel(TemplateDto templateDto,String pId) { private void addCsLineModel(TemplateDto templateDto,String pId,String devType) {
List<CsLineModel> result = new ArrayList<>(); List<CsLineModel> result = new ArrayList<>();
//fixme 先用数据类型来区分模板的类型 //fixme 先用数据类型来区分模板的类型
if (templateDto.getDataList().contains("Apf") || templateDto.getDataList().contains("Dvr")){ if (templateDto.getDataList().contains("Apf") || templateDto.getDataList().contains("Dvr")){
@@ -1217,19 +1218,36 @@ public class CsDevModelServiceImpl implements ICsDevModelService {
result.add(csLineModel); result.add(csLineModel);
} else { } else {
List<ClDevDto> list = templateDto.getClDevDtoList(); List<ClDevDto> list = templateDto.getClDevDtoList();
list.forEach(item->{ //根据设备型号获取设备类型,根据设备类型生成监测点模板表数据
CsLineModel csLineModel = new CsLineModel(); DictTreeVO vo1 = dictTreeFeignClient.queryByCode(devType).getData();
csLineModel.setLineId(IdUtil.fastSimpleUUID()); SysDicTreePO po1 = dictTreeFeignClient.queryById(vo1.getPid()).getData();
csLineModel.setPid(pId); if (Objects.equals(po1.getCode(),"Direct_Connected_Device") || Objects.equals(po1.getCode(),"Portable")){
if (Objects.equals(item.getClDid(),1) || Objects.equals(item.getLocation(), TypeEnum.GUID.getCode())){ list.forEach(item->{
csLineModel.setName("电网侧监测点"); CsLineModel csLineModel = new CsLineModel();
csLineModel.setPosition(dicDataFeignClient.getDicDataByCode(DicDataEnum.GRID_SIDE.getCode()).getData().getId()); csLineModel.setLineId(IdUtil.fastSimpleUUID());
} else if (Objects.equals(item.getClDid(),2) || Objects.equals(item.getLocation(), TypeEnum.LOAD.getCode())){ csLineModel.setPid(pId);
csLineModel.setName("负载侧监测点"); if (Objects.equals(item.getClDid(),1) || Objects.equals(item.getLocation(), TypeEnum.GUID.getCode())){
csLineModel.setPosition(dicDataFeignClient.getDicDataByCode(DicDataEnum.LOAD_SIDE.getCode()).getData().getId()); csLineModel.setName("电网侧监测点");
} csLineModel.setPosition(dicDataFeignClient.getDicDataByCode(DicDataEnum.GRID_SIDE.getCode()).getData().getId());
result.add(csLineModel); } else if (Objects.equals(item.getClDid(),2) || Objects.equals(item.getLocation(), TypeEnum.LOAD.getCode())){
}); csLineModel.setName("负载侧监测点");
csLineModel.setPosition(dicDataFeignClient.getDicDataByCode(DicDataEnum.LOAD_SIDE.getCode()).getData().getId());
} else {
csLineModel.setName("输出侧监测点");
csLineModel.setPosition(dicDataFeignClient.getDicDataByCode(DicDataEnum.OUTPUT_SIDE.getCode()).getData().getId());
}
result.add(csLineModel);
});
} else {
list.forEach(item->{
CsLineModel csLineModel = new CsLineModel();
csLineModel.setLineId(IdUtil.fastSimpleUUID());
csLineModel.setPid(pId);
csLineModel.setName(item.getClDid() + "#监测点");
csLineModel.setPosition("");
result.add(csLineModel);
});
}
} }
if (CollectionUtil.isNotEmpty(result)){ if (CollectionUtil.isNotEmpty(result)){
csLineModelService.addList(result); csLineModelService.addList(result);

View File

@@ -122,7 +122,8 @@ public class CsHeartServiceImpl implements ICsHeartService {
csEquipmentDeliveryService.updateRunStatusBynDid(nDid, AccessEnum.OFFLINE.getCode()); csEquipmentDeliveryService.updateRunStatusBynDid(nDid, AccessEnum.OFFLINE.getCode());
//装置调整为注册状态 //装置调整为注册状态
csEquipmentDeliveryService.updateStatusBynDid(nDid,AccessEnum.REGISTERED.getCode(),null,null); csEquipmentDeliveryService.updateStatusBynDid(nDid,AccessEnum.REGISTERED.getCode(),null,null);
sendMessage(nDid); //设备离线通知关闭
//sendMessage(nDid);
//记录装置掉线时间 //记录装置掉线时间
PqsCommunicateDto dto = new PqsCommunicateDto(); PqsCommunicateDto dto = new PqsCommunicateDto();
dto.setTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN))); dto.setTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)));

View File

@@ -21,7 +21,6 @@ import com.njcn.system.pojo.po.EleEpdPqd;
import com.njcn.system.pojo.po.SysDicTreePO; import com.njcn.system.pojo.po.SysDicTreePO;
import com.njcn.zlevent.mapper.CsEventMapper; import com.njcn.zlevent.mapper.CsEventMapper;
import com.njcn.zlevent.pojo.po.CsEventLogs; import com.njcn.zlevent.pojo.po.CsEventLogs;
//import com.njcn.zlevent.service.AppNotificationService;
import com.njcn.zlevent.service.ICsAlarmService; import com.njcn.zlevent.service.ICsAlarmService;
import com.njcn.zlevent.service.ICsEventLogsService; import com.njcn.zlevent.service.ICsEventLogsService;
import com.njcn.zlevent.service.ICsEventService; import com.njcn.zlevent.service.ICsEventService;
@@ -138,11 +137,9 @@ public class CsAlarmServiceImpl extends ServiceImpl<CsEventMapper, CsEventPO> im
if (Objects.isNull(item.getCode())){ if (Objects.isNull(item.getCode())){
msgSendParam.setEventName(item.getName()); msgSendParam.setEventName(item.getName());
msgSendFeignClient.appMsgSend(msgSendParam); msgSendFeignClient.appMsgSend(msgSendParam);
// appNotificationService.sendAppNotification(2,item.getType(),po.getId(),item.getName(),eventTime,id,po.getNdid(),null,null,null);
} else { } else {
msgSendParam.setEventName(item.getCode()); msgSendParam.setEventName(item.getCode());
msgSendFeignClient.appMsgSend(msgSendParam); msgSendFeignClient.appMsgSend(msgSendParam);
// appNotificationService.sendAppNotification(2,item.getType(),po.getId(),item.getCode(),eventTime,id,po.getNdid(),null, null,null);
//更新字典信息 //更新字典信息
EleEpdPqd eleEpdPqd = epdFeignClient.findByName(item.getName()).getData(); EleEpdPqd eleEpdPqd = epdFeignClient.findByName(item.getName()).getData();
EleEpdPqdParam.EleEpdPqdUpdateParam updateParam = new EleEpdPqdParam.EleEpdPqdUpdateParam(); EleEpdPqdParam.EleEpdPqdUpdateParam updateParam = new EleEpdPqdParam.EleEpdPqdUpdateParam();

View File

@@ -247,18 +247,20 @@ public class EventServiceImpl implements IEventService {
} }
} }
} }
MsgSendParam msgSendParam = new MsgSendParam(); if (Objects.equals(item.getType(),"2")){
msgSendParam.setEventType(1); MsgSendParam msgSendParam = new MsgSendParam();
msgSendParam.setType("2"); msgSendParam.setEventType(1);
msgSendParam.setDevId(po.getId()); msgSendParam.setType("2");
msgSendParam.setEventName(item.getName()); msgSendParam.setDevId(po.getId());
msgSendParam.setEventTime(eventTime); msgSendParam.setEventName(item.getName());
msgSendParam.setId(id); msgSendParam.setEventTime(eventTime);
msgSendParam.setNDid(po.getNdid()); msgSendParam.setId(id);
msgSendParam.setAmplitude(amplitude); msgSendParam.setNDid(po.getNdid());
msgSendParam.setPersistTime(persistTime); msgSendParam.setAmplitude(amplitude);
msgSendParam.setDropZone(dropZone); msgSendParam.setPersistTime(persistTime);
msgSendFeignClient.appMsgSend(msgSendParam); msgSendParam.setDropZone(dropZone);
msgSendFeignClient.appMsgSend(msgSendParam);
}
//如果是暂降事件,则异步发送短信 //如果是暂降事件,则异步发送短信
if (Objects.equals(item.getName(), "Evt_Sys_DipStr")) { if (Objects.equals(item.getName(), "Evt_Sys_DipStr")) {
MsgSendParam msgSendParam2 = new MsgSendParam(); MsgSendParam msgSendParam2 = new MsgSendParam();