| | |
| | | throw new ErrorException("零件号为" + partNo + "的原材料没有对应的标准库配置"); |
| | | } |
| | | RawMaterialStandardTreeDto rawMaterialStandardTreeDto = new RawMaterialStandardTreeDto(); |
| | | Set<String> sampleTypeValues = new HashSet<>(); |
| | | for (FactoryDto factoryDto : factoryDtos) { |
| | | for (LaboratoryDto laboratoryDto : factoryDto.getChildren()) { |
| | | for (SampleTypeDto sampleTypeDto : laboratoryDto.getChildren()) { |
| | | if (sampleTypeDto.getChildren().size() == 0) { |
| | | sampleTypeValues.add(sampleTypeDto.getValue()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // 批量查询所有 sampleTypeDto 的数据 |
| | | List<SampleDto> standardList = standardTreeMapper.getStandardTree3Batch(sampleTypeValues); |
| | | Map<String, List<SampleDto>> standardTreeMap = standardList.stream().collect(Collectors.groupingBy(SampleDto::getValue)); |
| | | |
| | | for (FactoryDto factoryDto : factoryDtos) { |
| | | for (LaboratoryDto laboratoryDto : factoryDto.getChildren()) { |
| | | for (SampleTypeDto sampleTypeDto : laboratoryDto.getChildren()) { |
| | | List<SampleDto> standardTreeList = standardTreeMap.get(sampleTypeDto.getValue()); |
| | | if (sampleTypeDto.getChildren().size() == 0) { |
| | | sampleTypeDto.getChildren().addAll(standardTreeList); |
| | | sampleTypeDto.setChildren(standardTreeMapper.getStandardTree3(sampleTypeDto.getValue())); |
| | | } |
| | | // 判断绑定的是否是当前零件号 |
| | | if (sampleTypeDto.getPartNo() != null && sampleTypeDto.getPartNo().equals(partNo)) { |