代码优化

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) {
//根据监测点获取部门
DeptLine deptLine = deptLineFeignClient.getLineByLineIds(po.getMeasurementPointId()).getData();
String id = deptLine.getId();
Set<String> dept = new HashSet<>();
dept.add(id);
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
deptGetLineParam.setDeptId(id);
List<DeptGetBase> deptList = commTerminalGeneralClient.getDeptChildrenByParent(deptGetLineParam).getData();
if (CollectionUtil.isNotEmpty(deptList)) {
deptList.forEach(item->{
dept.addAll(item.getUnitChildrenList());
});
if(Objects.nonNull(deptLine)){
String id = deptLine.getId();
Set<String> dept = new HashSet<>();
dept.add(id);
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
deptGetLineParam.setDeptId(id);
List<DeptGetBase> deptList = commTerminalGeneralClient.getDeptChildrenByParent(deptGetLineParam).getData();
if (CollectionUtil.isNotEmpty(deptList)) {
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){