优化暂态事件推送时部门数据的获取

This commit is contained in:
xy
2025-07-30 11:23:21 +08:00
parent 6c2ddfab67
commit c9ecdad7ed
6 changed files with 45 additions and 14 deletions

View File

@@ -1,6 +1,7 @@
package com.njcn.event.service.majornetwork.Impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
@@ -186,19 +187,21 @@ public class EventDetailServiceImpl extends ServiceImpl<EventDetailMapper, RmpEv
private void pushEvent(RmpEventDetailPO po) {
String id = po.getLineId();
//根据监测点获取部门
DeptLine deptLine = deptLineFeignClient.getLineByLineIds(id).getData();
if(Objects.nonNull(deptLine)){
String deptLineId = deptLine.getId();
List<DeptLine> deptLineList = deptLineFeignClient.getDeptListByLineId(id).getData();
if (CollUtil.isNotEmpty(deptLineList)) {
Set<String> dept = new HashSet<>();
dept.add(deptLineId);
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
deptGetLineParam.setDeptId(deptLineId);
List<DeptGetBase> deptList = commTerminalGeneralClient.getDeptChildrenByParent(deptGetLineParam).getData();
if (CollectionUtil.isNotEmpty(deptList)) {
deptList.forEach(item->{
dept.addAll(item.getUnitChildrenList());
});
}
deptLineList.forEach(item->{
String deptLineId = item.getId();
dept.add(deptLineId);
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
deptGetLineParam.setDeptId(deptLineId);
List<DeptGetBase> deptList = commTerminalGeneralClient.getDeptChildrenByParent(deptGetLineParam).getData();
if (CollectionUtil.isNotEmpty(deptList)) {
deptList.forEach(item2->{
dept.addAll(item2.getUnitChildrenList());
});
}
});
SendEventVO vo = new SendEventVO();
vo.setDeptList(dept);
vo.setTime(po.getStartTime());