fix(service): 修复台账排序功能并优化事件用户查询逻辑
- 在CsEquipmentDeliveryServiceImpl中添加sort字段设置 - 重构CsEventUserPOServiceImpl中的线路电压获取逻辑,修复空指针异常 - 移除旧的模块编号生成条件,统一使用clDid判断逻辑 - 在CsLedgerServiceImpl中为项目列表添加排序功能 - 为IcdServiceImpl中的项目信息和设备信息列表添加按sort字段排序 - 优化线路信息排序逻辑,按clDid和lineNo字段排序
This commit is contained in:
@@ -1215,6 +1215,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
CsLedgerParam.Update csLedgerParam = new CsLedgerParam.Update();
|
||||
BeanUtils.copyProperties(csLedger, csLedgerParam);
|
||||
csLedgerParam.setName(param.getName());
|
||||
csLedgerParam.setSort(param.getSort());
|
||||
csLedgerService.updateLedgerTree(csLedgerParam);
|
||||
}
|
||||
//新增台账日志
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -534,6 +534,7 @@ class IcdServiceImpl implements IcdService {
|
||||
vo1.setTopoId(Objects.isNull(appTopologyDiagramPOMap.get(item.getId()))?null:appTopologyDiagramPOMap.get(item.getId()).getTopoId());
|
||||
result.add(vo1);
|
||||
});
|
||||
result.sort(Comparator.comparingInt(ProjectVO::getSort));
|
||||
}
|
||||
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());
|
||||
result.add(vo1);
|
||||
});
|
||||
result.sort(Comparator.comparingInt(ProjectVO::getSort));
|
||||
}
|
||||
vo.setProjectInfoList(result);
|
||||
// 设置设备信息
|
||||
List<CsEquipmentDeliveryPO> devList = csEquipmentDeliveryService.getDevListByProjectId(id);
|
||||
devList.sort(Comparator.comparingInt(CsEquipmentDeliveryPO::getSort));
|
||||
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());
|
||||
result.add(vo1);
|
||||
});
|
||||
result.sort(Comparator.comparingInt(ProjectVO::getSort));
|
||||
}
|
||||
vo.setProjectInfoList(result);
|
||||
}
|
||||
// 设置设备信息
|
||||
List<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS = csEquipmentDeliveryService.listByIds(Collections.singletonList(id));
|
||||
csEquipmentDeliveryPOS.sort(Comparator.comparingInt(CsEquipmentDeliveryPO::getSort));
|
||||
vo.setDeviceInfoList(csEquipmentDeliveryPOS);
|
||||
// 设置线路信息
|
||||
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());
|
||||
result.add(vo1);
|
||||
});
|
||||
result.sort(Comparator.comparingInt(ProjectVO::getSort));
|
||||
}
|
||||
vo.setProjectInfoList(result);
|
||||
}
|
||||
@@ -652,6 +649,7 @@ class IcdServiceImpl implements IcdService {
|
||||
if (pids.length > 3) {
|
||||
String deviceId = pids[3];
|
||||
csEquipmentDeliveryPOS = csEquipmentDeliveryService.listByIds(Collections.singletonList(deviceId));
|
||||
csEquipmentDeliveryPOS.sort(Comparator.comparingInt(CsEquipmentDeliveryPO::getSort));
|
||||
vo.setDeviceInfoList(csEquipmentDeliveryPOS);
|
||||
} else {
|
||||
csEquipmentDeliveryPOS = new ArrayList<>();
|
||||
@@ -668,6 +666,8 @@ class IcdServiceImpl implements IcdService {
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user