|
|
|
|
@ -125,10 +125,12 @@ public class OrganizationServiceImpl implements OrganizationService {
|
|
|
|
|
// 设备台账关联产线
|
|
|
|
|
if (updateObj.getMachineId() != null) {
|
|
|
|
|
DeviceLedgerDO deviceLedgerDO = deviceLedgerService.getDeviceLedger(updateObj.getMachineId());
|
|
|
|
|
if (deviceLedgerDO != null){
|
|
|
|
|
deviceLedgerDO.setWorkshop(String.valueOf(updateObj.getParentId()));
|
|
|
|
|
deviceLedgerService.updateDeviceLedger(BeanUtils.toBean(deviceLedgerDO, DeviceLedgerSaveReqVO.class));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void deleteOrganization(Long id) {
|
|
|
|
|
@ -228,39 +230,23 @@ public class OrganizationServiceImpl implements OrganizationService {
|
|
|
|
|
return Collections.emptyList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//关联机台
|
|
|
|
|
// Map<Long, MachineComponentDO> map = machineComponentService.getMap(
|
|
|
|
|
// convertSet(list, OrganizationDO::getMachineId));
|
|
|
|
|
//
|
|
|
|
|
// return BeanUtils.toBean(list, OrganizationRespVO.class, item -> {
|
|
|
|
|
// MapUtils.findAndThen(map, item.getMachineId(),
|
|
|
|
|
// machine -> item.setMachineName(machine.getName()));
|
|
|
|
|
//
|
|
|
|
|
// });
|
|
|
|
|
//关联设备
|
|
|
|
|
Map<Long, DeviceDO> map = deviceService.getMap(
|
|
|
|
|
convertSet(list, OrganizationDO::getDvId));
|
|
|
|
|
|
|
|
|
|
// List<DeviceLedgerDO> deviceLedgerDOList = deviceLedgerService.getDeviceLedgerList();
|
|
|
|
|
// Map<Long, DeviceLedgerDO> resultMap = deviceLedgerDOList.stream()
|
|
|
|
|
// .filter(Objects::nonNull)
|
|
|
|
|
// .collect(Collectors.toMap(
|
|
|
|
|
// DeviceLedgerDO::getId,
|
|
|
|
|
// Function.identity(),
|
|
|
|
|
// (existing, replacement) -> existing // 处理重复key
|
|
|
|
|
// ));
|
|
|
|
|
|
|
|
|
|
// return BeanUtils.toBean(list, OrganizationRespVO.class, item -> {
|
|
|
|
|
// MapUtils.findAndThen(resultMap, item.getDvId(),
|
|
|
|
|
// device -> item.setMachineName(device.getDeviceName()));
|
|
|
|
|
// });
|
|
|
|
|
Set<Long> dvIds = convertSet(list, OrganizationDO::getDvId);
|
|
|
|
|
|
|
|
|
|
return BeanUtils.toBean(list, OrganizationRespVO.class, item -> {
|
|
|
|
|
MapUtils.findAndThen(map, item.getDvId(),
|
|
|
|
|
device -> item.setMachineName(device.getDeviceName()));
|
|
|
|
|
|
|
|
|
|
Map<Long, DeviceDO> deviceMap = deviceService.getMapIncludeDeleted(dvIds);
|
|
|
|
|
|
|
|
|
|
return BeanUtils.toBean(list, OrganizationRespVO.class, item -> {
|
|
|
|
|
MapUtils.findAndThen(deviceMap, item.getDvId(), device -> {
|
|
|
|
|
String deviceName = device.getDeviceName();
|
|
|
|
|
// 按你项目删除标记字段调整,比如 getDeleted()/getIsDeleted()/getStatus()
|
|
|
|
|
if (Boolean.TRUE.equals(device.getDeleted())) {
|
|
|
|
|
deviceName = deviceName + "(已被删除)";
|
|
|
|
|
}
|
|
|
|
|
item.setMachineName(deviceName);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<OrganizationRespVO> buildWorkerVOList(List<OrganizationDO> list) {
|
|
|
|
|
if (CollUtil.isEmpty(list)) {
|
|
|
|
|
|