fix(service): 修复台账排序功能并优化事件用户查询逻辑

- 在CsEquipmentDeliveryServiceImpl中添加sort字段设置
- 重构CsEventUserPOServiceImpl中的线路电压获取逻辑,修复空指针异常
- 移除旧的模块编号生成条件,统一使用clDid判断逻辑
- 在CsLedgerServiceImpl中为项目列表添加排序功能
- 为IcdServiceImpl中的项目信息和设备信息列表添加按sort字段排序
- 优化线路信息排序逻辑,按clDid和lineNo字段排序
This commit is contained in:
xy
2026-06-29 20:22:29 +08:00
parent 99fb7aab66
commit ff3341549f
4 changed files with 19 additions and 17 deletions

View File

@@ -1215,6 +1215,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
CsLedgerParam.Update csLedgerParam = new CsLedgerParam.Update(); CsLedgerParam.Update csLedgerParam = new CsLedgerParam.Update();
BeanUtils.copyProperties(csLedger, csLedgerParam); BeanUtils.copyProperties(csLedger, csLedgerParam);
csLedgerParam.setName(param.getName()); csLedgerParam.setName(param.getName());
csLedgerParam.setSort(param.getSort());
csLedgerService.updateLedgerTree(csLedgerParam); csLedgerService.updateLedgerTree(csLedgerParam);
} }
//新增台账日志 //新增台账日志

View File

@@ -539,7 +539,9 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
} }
}); });
return new ArrayList<>(projectMap.values()); List<CsLedgerVO> result = new ArrayList<>(projectMap.values());
result.sort(Comparator.comparing(CsLedgerVO::getSort, Comparator.nullsLast(Comparator.naturalOrder())));
return result;
} }
/** /**

View File

@@ -534,6 +534,7 @@ class IcdServiceImpl implements IcdService {
vo1.setTopoId(Objects.isNull(appTopologyDiagramPOMap.get(item.getId()))?null:appTopologyDiagramPOMap.get(item.getId()).getTopoId()); vo1.setTopoId(Objects.isNull(appTopologyDiagramPOMap.get(item.getId()))?null:appTopologyDiagramPOMap.get(item.getId()).getTopoId());
result.add(vo1); result.add(vo1);
}); });
result.sort(Comparator.comparingInt(ProjectVO::getSort));
} }
vo.setProjectInfoList(result); vo.setProjectInfoList(result);
} }
@@ -557,20 +558,13 @@ class IcdServiceImpl implements IcdService {
vo1.setTopoId(Objects.isNull(appTopologyDiagramPOMap.get(item.getId()))?null:appTopologyDiagramPOMap.get(item.getId()).getTopoId()); vo1.setTopoId(Objects.isNull(appTopologyDiagramPOMap.get(item.getId()))?null:appTopologyDiagramPOMap.get(item.getId()).getTopoId());
result.add(vo1); result.add(vo1);
}); });
result.sort(Comparator.comparingInt(ProjectVO::getSort));
} }
vo.setProjectInfoList(result); vo.setProjectInfoList(result);
// 设置设备信息 // 设置设备信息
List<CsEquipmentDeliveryPO> devList = csEquipmentDeliveryService.getDevListByProjectId(id); List<CsEquipmentDeliveryPO> devList = csEquipmentDeliveryService.getDevListByProjectId(id);
devList.sort(Comparator.comparingInt(CsEquipmentDeliveryPO::getSort));
vo.setDeviceInfoList(devList); vo.setDeviceInfoList(devList);
// if (CollectionUtil.isNotEmpty(devList)) {
// //如果不是监测设备,则不展示
// DictTreeVO cldDict = dictTreeFeignClient.queryByCode(DicDataEnum.DEV_CLD.getCode()).getData();
// String cldDevTypeId = cldDict.getId();
// List<CsEquipmentDeliveryPO> cldDevIds = devList.stream()
// .filter(item -> item.getDevType().equals(cldDevTypeId))
// .collect(Collectors.toList());
// vo.setDeviceInfoList(cldDevIds);
// }
} }
/** /**
@@ -594,11 +588,13 @@ class IcdServiceImpl implements IcdService {
vo1.setTopoId(Objects.isNull(appTopologyDiagramPOMap.get(item.getId()))?null:appTopologyDiagramPOMap.get(item.getId()).getTopoId()); vo1.setTopoId(Objects.isNull(appTopologyDiagramPOMap.get(item.getId()))?null:appTopologyDiagramPOMap.get(item.getId()).getTopoId());
result.add(vo1); result.add(vo1);
}); });
result.sort(Comparator.comparingInt(ProjectVO::getSort));
} }
vo.setProjectInfoList(result); vo.setProjectInfoList(result);
} }
// 设置设备信息 // 设置设备信息
List<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS = csEquipmentDeliveryService.listByIds(Collections.singletonList(id)); List<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS = csEquipmentDeliveryService.listByIds(Collections.singletonList(id));
csEquipmentDeliveryPOS.sort(Comparator.comparingInt(CsEquipmentDeliveryPO::getSort));
vo.setDeviceInfoList(csEquipmentDeliveryPOS); vo.setDeviceInfoList(csEquipmentDeliveryPOS);
// 设置线路信息 // 设置线路信息
List<CsLinePO> list = csLinePOService.queryByDevId(id); List<CsLinePO> list = csLinePOService.queryByDevId(id);
@@ -644,6 +640,7 @@ class IcdServiceImpl implements IcdService {
vo1.setTopoId(Objects.isNull(appTopologyDiagramPOMap.get(item.getId()))?null:appTopologyDiagramPOMap.get(item.getId()).getTopoId()); vo1.setTopoId(Objects.isNull(appTopologyDiagramPOMap.get(item.getId()))?null:appTopologyDiagramPOMap.get(item.getId()).getTopoId());
result.add(vo1); result.add(vo1);
}); });
result.sort(Comparator.comparingInt(ProjectVO::getSort));
} }
vo.setProjectInfoList(result); vo.setProjectInfoList(result);
} }
@@ -652,6 +649,7 @@ class IcdServiceImpl implements IcdService {
if (pids.length > 3) { if (pids.length > 3) {
String deviceId = pids[3]; String deviceId = pids[3];
csEquipmentDeliveryPOS = csEquipmentDeliveryService.listByIds(Collections.singletonList(deviceId)); csEquipmentDeliveryPOS = csEquipmentDeliveryService.listByIds(Collections.singletonList(deviceId));
csEquipmentDeliveryPOS.sort(Comparator.comparingInt(CsEquipmentDeliveryPO::getSort));
vo.setDeviceInfoList(csEquipmentDeliveryPOS); vo.setDeviceInfoList(csEquipmentDeliveryPOS);
} else { } else {
csEquipmentDeliveryPOS = new ArrayList<>(); csEquipmentDeliveryPOS = new ArrayList<>();
@@ -668,6 +666,8 @@ class IcdServiceImpl implements IcdService {
} }
item.setLineNo(item.getClDid()); item.setLineNo(item.getClDid());
} }
line.sort(Comparator.comparingInt((CsLinePO cs) -> cs.getClDid() == null ? Integer.MAX_VALUE : cs.getClDid())
.thenComparingInt(cs -> cs.getLineNo() == null ? Integer.MAX_VALUE : cs.getLineNo()));
} }
vo.setLineInfoList(line); vo.setLineInfoList(line);
} }

View File

@@ -469,6 +469,7 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
returnpage = this.getBaseMapper().queryEventPageWeb(returnpage,csEventUserQueryPage,devIds); returnpage = this.getBaseMapper().queryEventPageWeb(returnpage,csEventUserQueryPage,devIds);
} }
returnpage.getRecords().forEach(temp->{ returnpage.getRecords().forEach(temp->{
CsLineDTO dto = map.get(temp.getLineId());
DevDetailDTO devDetail = csLedgerFeignClient.queryDevDetail(temp.getDeviceId()).getData(); DevDetailDTO devDetail = csLedgerFeignClient.queryDevDetail(temp.getDeviceId()).getData();
temp.setEquipmentName(devDetail.getEquipmentName()); temp.setEquipmentName(devDetail.getEquipmentName());
temp.setProjectId(devDetail.getProjectId()); temp.setProjectId(devDetail.getProjectId());
@@ -476,8 +477,11 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
temp.setEngineeringid(devDetail.getEngineeringid()); temp.setEngineeringid(devDetail.getEngineeringid());
temp.setEngineeringName(devDetail.getEngineeringName()); temp.setEngineeringName(devDetail.getEngineeringName());
if (ObjectUtil.isNotNull(temp.getLineId())) { if (ObjectUtil.isNotNull(temp.getLineId())) {
if (!Objects.isNull(map.get(temp.getLineId()))) { if (!Objects.isNull(dto)) {
temp.setLineVoltage(map.get(temp.getLineId()).getVolGrade()); temp.setLineVoltage(dto.getVolGrade());
if (dto.getClDid() == 0) {
temp.setModuleNo("模块" + temp.getClDid());
}
} }
} }
EleEpdPqd ele = epdFeignClient.findByName(temp.getTag()).getData(); EleEpdPqd ele = epdFeignClient.findByName(temp.getTag()).getData();
@@ -488,11 +492,6 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
temp.setShowName(ele.getShowName()); temp.setShowName(ele.getShowName());
temp.setCode(ele.getDefaultValue()); temp.setCode(ele.getDefaultValue());
} }
if (ObjectUtil.isNotNull(temp.getLineId())) {
if (temp.getLineId().endsWith("0")) {
temp.setModuleNo("模块" + temp.getClDid());
}
}
if(Objects.equals(csEventUserQueryPage.getType(),"0")){ if(Objects.equals(csEventUserQueryPage.getType(),"0")){
List<EleEvtParm> data1 = eleEvtFeignClient.queryByPid(ele.getId()).getData(); List<EleEvtParm> data1 = eleEvtFeignClient.queryByPid(ele.getId()).getData();
List<EventDataSetDTO> eventDataSetDTOS = new ArrayList<>(); List<EventDataSetDTO> eventDataSetDTOS = new ArrayList<>();