代码优化

This commit is contained in:
xy
2025-07-29 15:45:33 +08:00
parent d3294ccdbd
commit 02f8008482

View File

@@ -186,29 +186,31 @@ public class EventDetailServiceImpl extends ServiceImpl<EventDetailMapper, RmpEv
private void pushEvent(RmpEventDetailPO po) { private void pushEvent(RmpEventDetailPO po) {
//根据监测点获取部门 //根据监测点获取部门
DeptLine deptLine = deptLineFeignClient.getLineByLineIds(po.getMeasurementPointId()).getData(); DeptLine deptLine = deptLineFeignClient.getLineByLineIds(po.getMeasurementPointId()).getData();
String id = deptLine.getId(); if(Objects.nonNull(deptLine)){
Set<String> dept = new HashSet<>(); String id = deptLine.getId();
dept.add(id); Set<String> dept = new HashSet<>();
DeptGetLineParam deptGetLineParam = new DeptGetLineParam(); dept.add(id);
deptGetLineParam.setDeptId(id); DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
List<DeptGetBase> deptList = commTerminalGeneralClient.getDeptChildrenByParent(deptGetLineParam).getData(); deptGetLineParam.setDeptId(id);
if (CollectionUtil.isNotEmpty(deptList)) { List<DeptGetBase> deptList = commTerminalGeneralClient.getDeptChildrenByParent(deptGetLineParam).getData();
deptList.forEach(item->{ if (CollectionUtil.isNotEmpty(deptList)) {
dept.addAll(item.getUnitChildrenList()); deptList.forEach(item->{
}); dept.addAll(item.getUnitChildrenList());
});
}
SendEventVO vo = new SendEventVO();
vo.setDeptList(dept);
vo.setTime(po.getStartTime());
vo.setEventValue(po.getFeatureAmplitude());
vo.setPersistTime(po.getDuration());
vo.setEventType(po.getEventType());
vo.setEventReason(po.getAdvanceReason());
List<AreaLineInfoVO> lineInfoVOList = lineFeignClient.getBaseLineAreaInfo(Collections.singletonList(po.getLineId())).getData();
vo.setLineName(lineInfoVOList.get(0).getLineName());
vo.setPowerCompany(lineInfoVOList.get(0).getGdName());
vo.setSubstation(lineInfoVOList.get(0).getSubName());
publisher.send("/sendEvent", PubUtils.obj2json(vo), 1, false);
} }
SendEventVO vo = new SendEventVO();
vo.setDeptList(dept);
vo.setTime(po.getStartTime());
vo.setEventValue(po.getFeatureAmplitude());
vo.setPersistTime(po.getDuration());
vo.setEventType(po.getEventType());
vo.setEventReason(po.getAdvanceReason());
List<AreaLineInfoVO> lineInfoVOList = lineFeignClient.getBaseLineAreaInfo(Collections.singletonList(po.getLineId())).getData();
vo.setLineName(lineInfoVOList.get(0).getLineName());
vo.setPowerCompany(lineInfoVOList.get(0).getGdName());
vo.setSubstation(lineInfoVOList.get(0).getSubName());
publisher.send("/sendEvent", PubUtils.obj2json(vo), 1, false);
} }
public String eventTypeReflection(Integer eventType){ public String eventTypeReflection(Integer eventType){