设备统计问题,由于和便携式设备合并树导致的问题

This commit is contained in:
hzj
2024-08-01 15:53:33 +08:00
parent 8c7ea7e997
commit 279cf7d628
2 changed files with 34 additions and 3 deletions

View File

@@ -162,7 +162,13 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
}
List<CsLedgerVO> deviceTree = iCsLedgerService.getDeviceTree();
List<String> collect1 = deviceTree.stream().filter(temp -> temp.getId().equals(id)).map(CsLedgerVO::getChildren).flatMap(Collection::stream).map(CsLedgerVO::getChildren).flatMap(Collection::stream).map(CsLedgerVO::getId).collect(Collectors.toList());
//由于多加了一程便携式设备
List<String> collect1 = deviceTree.stream()
.map(CsLedgerVO::getChildren).flatMap(Collection::stream)
.filter(temp -> temp.getId().equals(id))
.map(CsLedgerVO::getChildren).flatMap(Collection::stream)
.map(CsLedgerVO::getChildren).flatMap(Collection::stream)
.map(CsLedgerVO::getId).collect(Collectors.toList());
//求交集
device.retainAll(collect1);
if(CollectionUtils.isEmpty(device)){

View File

@@ -194,10 +194,35 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
}
).
sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
checkDevSetData(deviceList);
projectList.forEach(pro -> pro.setChildren(getChildren(pro, deviceList)));
engineeringList.forEach(eng -> eng.setChildren(getChildren(eng, projectList)));
return engineeringList;
//整理整个树并新增便携式设备树
CsLedgerVO portable = new CsLedgerVO();
portable.setLevel(0);
portable.setName(DataParam.portableDev);
portable.setPid("0");
portable.setId(IdUtil.simpleUUID());
List<CsLedgerVO> portables = wlRecordMapper.getAll();
checkDevSetData(portables);
for(CsLedgerVO c : portables){
c.setPid(portable.getId());
CsEquipmentDeliveryPO csEquipmentDeliveryPO = csEquipmentDeliveryMapper.selectById(c.getId());
c.setComFlag(Integer.parseInt(csEquipmentDeliveryPO.getStatus()));
}
portable.setChildren(portables);
CsLedgerVO government = new CsLedgerVO();
government.setLevel(0);
government.setName(DataParam.governmentDev);
government.setPid("0");
government.setId(IdUtil.simpleUUID());
government.setChildren(engineeringList);
List<CsLedgerVO> tree = new ArrayList<>();
tree.add(portable);
tree.add(government);
return tree;
//return engineeringList;
}
@Override