| | |
| | | basicTreeDto.setValue(String.valueOf(model.getId())); |
| | | basicTreeDto.setLabel(model.getModelName()); |
| | | basicTreeDto.setChildren(null); |
| | | if(model.getProductId() != null) { |
| | | if(CollectionUtils.isEmpty(productModelMap.get(model.getProductId()))){ |
| | | if (model.getProductId() != null) { |
| | | if (CollectionUtils.isEmpty(productModelMap.get(model.getProductId()))) { |
| | | List<BasicTreeDto> basicTreeDtoList = new ArrayList<>(); |
| | | basicTreeDtoList.add(basicTreeDto); |
| | | productModelMap.put(model.getProductId(),basicTreeDtoList); |
| | | }else { |
| | | productModelMap.put(model.getProductId(), basicTreeDtoList); |
| | | } else { |
| | | productModelMap.get(model.getProductId()).add(basicTreeDto); |
| | | } |
| | | } |
| | | if(model.getStructureTestObjectId() != null) { |
| | | if(CollectionUtils.isEmpty(testObjectModelMap.get(model.getStructureTestObjectId()))){ |
| | | if (model.getStructureTestObjectId() != null) { |
| | | if (CollectionUtils.isEmpty(testObjectModelMap.get(model.getStructureTestObjectId()))) { |
| | | List<BasicTreeDto> basicTreeDtoList = new ArrayList<>(); |
| | | basicTreeDtoList.add(basicTreeDto); |
| | | testObjectModelMap.put(model.getStructureTestObjectId(),basicTreeDtoList); |
| | | }else { |
| | | testObjectModelMap.put(model.getStructureTestObjectId(), basicTreeDtoList); |
| | | } else { |
| | | testObjectModelMap.get(model.getStructureTestObjectId()).add(basicTreeDto); |
| | | } |
| | | } |
| | |
| | | StructureTestObjectDto structureTestObjectDto = new StructureTestObjectDto(); |
| | | BeanUtils.copyProperties(structureTestObject, structureTestObjectDto); |
| | | List<BasicTreeDto> children = new ArrayList<>(); |
| | | if(!CollectionUtils.isEmpty(productMap.get(structureTestObject.getId()))){ |
| | | if (!CollectionUtils.isEmpty(productMap.get(structureTestObject.getId()))) { |
| | | children.addAll(productMap.get(structureTestObject.getId())); |
| | | } |
| | | if(!CollectionUtils.isEmpty(testObjectModelMap.get(structureTestObject.getId()))){ |
| | | if (!CollectionUtils.isEmpty(testObjectModelMap.get(structureTestObject.getId()))) { |
| | | children.addAll(testObjectModelMap.get(structureTestObject.getId())); |
| | | } |
| | | structureTestObjectDto.setChildren(children); |
| | | return structureTestObjectDto; |
| | | },Collectors.toList()) |
| | | }, Collectors.toList()) |
| | | ) |
| | | ) |
| | | ); |
| | |
| | | } |
| | | } |
| | | workShopTreeDto.setChildren(testObjectChildren); |
| | | if(!CollectionUtils.isEmpty(testObjectChildren)){ |
| | | if (!CollectionUtils.isEmpty(testObjectChildren)) { |
| | | workShopTreeDtoList.add(workShopTreeDto); |
| | | } |
| | | } |
| | |
| | | return laboratoryTreeDto; |
| | | }).collect(Collectors.toList()); |
| | | List<BasicTreeDto> factoryList = new ArrayList<>(); |
| | | factoryList.add(new BasicTreeDto(BasicTreeEnums.FACTORY_TYPE.getCode(),"中天科技","1",laboratoryTreeDtoList)); |
| | | factoryList.add(new BasicTreeDto(BasicTreeEnums.FACTORY_TYPE.getCode(), "中天科技", "1", laboratoryTreeDtoList)); |
| | | return factoryList; |
| | | } |
| | | |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int addStandardTree(ModelAddDto modelAddDto) { |
| | | // 校验 |
| | | if(StringUtils.isEmpty(modelAddDto.getParentId())){ |
| | | if (StringUtils.isEmpty(modelAddDto.getParentId())) { |
| | | throw new RuntimeException("缺少父层级绑定关系"); |
| | | } |
| | | Model model = new Model(); |
| | | String parentLevel = modelAddDto.getParentLevel(); |
| | | // 名称重复性性校验 |
| | | QueryWrapper<Model> modelQueryWrapper = new QueryWrapper<>(); |
| | | if(BasicTreeEnums.PRODUCT_TYPE.getCode().equals(parentLevel)){ |
| | | if (BasicTreeEnums.PRODUCT_TYPE.getCode().equals(parentLevel)) { |
| | | model.setProductId(Integer.valueOf(modelAddDto.getParentId())); |
| | | modelQueryWrapper.eq("product_id", model.getProductId()); |
| | | }else if(BasicTreeEnums.STRUCTURE_TEST_OBJECT_TYPE.getCode().equals(parentLevel)){ |
| | | } else if (BasicTreeEnums.STRUCTURE_TEST_OBJECT_TYPE.getCode().equals(parentLevel)) { |
| | | model.setStructureTestObjectId(Integer.valueOf(modelAddDto.getParentId())); |
| | | modelQueryWrapper.eq("structure_test_object_id", model.getStructureTestObjectId()); |
| | | }else { |
| | | } else { |
| | | throw new RuntimeException("型号只能绑定对象和产品"); |
| | | } |
| | | model.setModelName(modelAddDto.getModelName()); |
| | | modelQueryWrapper.eq("model_name", model.getModelName()); |
| | | Model modelResult = modelMapper.selectOne(modelQueryWrapper); |
| | | |
| | | if(ObjectUtils.isNotEmpty(modelResult)){ |
| | | if (ObjectUtils.isNotEmpty(modelResult)) { |
| | | throw new RuntimeException("请勿添加重复型号"); |
| | | } |
| | | return modelMapper.insert(model); |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int delStandardTree(String level,String id) { |
| | | if(BasicTreeEnums.MODEL_TYPE.getCode().equals(level)){ |
| | | public int delStandardTree(String level, String id) { |
| | | if (BasicTreeEnums.MODEL_TYPE.getCode().equals(level)) { |
| | | modelMapper.deleteById(id); |
| | | } |
| | | return 1; |
| | |
| | | basicTreeDto.setValue(model.getModelName()); |
| | | basicTreeDto.setLabel(model.getModelName()); |
| | | basicTreeDto.setChildren(null); |
| | | if(model.getProductId() != null) { |
| | | if(CollectionUtils.isEmpty(productModelMap.get(model.getProductId()))){ |
| | | if (model.getProductId() != null) { |
| | | if (CollectionUtils.isEmpty(productModelMap.get(model.getProductId()))) { |
| | | List<BasicTreeDto> basicTreeDtoList = new ArrayList<>(); |
| | | basicTreeDtoList.add(basicTreeDto); |
| | | productModelMap.put(model.getProductId(),basicTreeDtoList); |
| | | }else { |
| | | productModelMap.put(model.getProductId(), basicTreeDtoList); |
| | | } else { |
| | | productModelMap.get(model.getProductId()).add(basicTreeDto); |
| | | } |
| | | } |
| | | if(model.getStructureTestObjectId() != null) { |
| | | if(CollectionUtils.isEmpty(testObjectModelMap.get(model.getStructureTestObjectId()))){ |
| | | if (model.getStructureTestObjectId() != null) { |
| | | if (CollectionUtils.isEmpty(testObjectModelMap.get(model.getStructureTestObjectId()))) { |
| | | List<BasicTreeDto> basicTreeDtoList = new ArrayList<>(); |
| | | basicTreeDtoList.add(basicTreeDto); |
| | | testObjectModelMap.put(model.getStructureTestObjectId(),basicTreeDtoList); |
| | | }else { |
| | | testObjectModelMap.put(model.getStructureTestObjectId(), basicTreeDtoList); |
| | | } else { |
| | | testObjectModelMap.get(model.getStructureTestObjectId()).add(basicTreeDto); |
| | | } |
| | | } |
| | |
| | | // 对检测对象先按照实验室在按照检查对象类别分类 |
| | | List<BasicTreeDto> testProjectBasicTreeList = structureTestObjectList.stream().map(structureTestObject -> { |
| | | BasicTreeDto basicTreeDto = new BasicTreeDto(); |
| | | basicTreeDto.setValue(structureTestObject.getSpecimenName()); |
| | | basicTreeDto.setLabel(structureTestObject.getSpecimenName()); |
| | | basicTreeDto.setValue(structureTestObject.getSpecimenName() + "(" + structureTestObject.getObjectType() + ")"); |
| | | basicTreeDto.setLabel(structureTestObject.getSpecimenName() + "(" + structureTestObject.getObjectType() + ")"); |
| | | basicTreeDto.setLevel(BasicTreeEnums.STRUCTURE_TEST_OBJECT_TYPE.getCode()); |
| | | List<BasicTreeDto> children = new ArrayList<>(); |
| | | if (!CollectionUtils.isEmpty(productMap.get(structureTestObject.getId()))) { |
| | |
| | | |
| | | /** |
| | | * 河口检测中心导入 |
| | | * |
| | | * @param file |
| | | */ |
| | | @Override |
| | |
| | | |
| | | /** |
| | | * 修改标准数 |
| | | * |
| | | * @param modelAddDto |
| | | * @return |
| | | */ |
| | | @Override |
| | | public int updateStandardTree(ModelAddDto modelAddDto) { |
| | | if(modelAddDto.getId() == null){ |
| | | if (modelAddDto.getId() == null) { |
| | | throw new RuntimeException("缺少型号主键"); |
| | | } |
| | | Model model = modelMapper.selectById(modelAddDto.getId()); |
| | | if(ObjectUtils.isEmpty(model)){ |
| | | if (ObjectUtils.isEmpty(model)) { |
| | | throw new RuntimeException("型号查找失败"); |
| | | } |
| | | QueryWrapper<Model> modelQueryWrapper = new QueryWrapper<>(); |
| | | if(model.getStructureTestObjectId() != null){ |
| | | if (model.getStructureTestObjectId() != null) { |
| | | modelQueryWrapper.eq("structure_test_object_id", model.getStructureTestObjectId()); |
| | | } |
| | | if(model.getProductId() != null){ |
| | | if (model.getProductId() != null) { |
| | | modelQueryWrapper.eq("product_id", model.getProductId()); |
| | | } |
| | | modelQueryWrapper.eq("model_name", modelAddDto.getModelName()); |
| | | model.setModelName(modelAddDto.getModelName()); |
| | | List<Model> modelList = modelMapper.selectList(modelQueryWrapper); |
| | | if(CollectionUtils.isEmpty(modelList)){ |
| | | if (CollectionUtils.isEmpty(modelList)) { |
| | | return modelMapper.updateById(model); |
| | | }else if (modelList.size() == 1) { |
| | | if( !model.getId().equals(modelList.get(0).getId())){ |
| | | } else if (modelList.size() == 1) { |
| | | if (!model.getId().equals(modelList.get(0).getId())) { |
| | | throw new RuntimeException("型号名称重复"); |
| | | }else { |
| | | } else { |
| | | return modelMapper.updateById(model); |
| | | } |
| | | }else { |
| | | } else { |
| | | throw new RuntimeException("型号名称重复"); |
| | | } |
| | | } |