| | |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.basic.service.StandardProductListService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.aspectj.weaver.ast.Var; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | if(StandardProductListChcekTypeEnums.CHECK_ING.getCode().equals(list.getCheckStatus())){ |
| | | throw new RuntimeException("审核中不支持修改"); |
| | | } |
| | | // 判断检验项是否为是否委托要求 是的话不需要做备份和状态修改直接更新 |
| | | StructureItemParameter structureItemParameter = structureItemParameterMapper.selectById(standardProductList.getStructureItemParameterId()); |
| | | if(!ObjectUtils.isEmpty(structureItemParameter) && "1".equals(structureItemParameter.getDelegateRequestFlag())){ |
| | | return standardProductListMapper.updateById(list); |
| | | } |
| | | // 判断是否为生效的修改如果是不做备份 |
| | | if(null != list.getState()){ |
| | | return standardProductListMapper.updateById(list); |
| | | } |
| | | // 查询最新的一次关联备份 如果存在说明未审核完继续修改了。不做数据处理。 |
| | | StandardProductListBackupRel standardProductListBackupRel = standardProductListBackupRelMapper.selectById(list.getId()); |
| | | if(ObjectUtils.isEmpty(standardProductListBackupRel)){ |
| | |
| | | |
| | | @Override |
| | | public List<StandardProductList> selectStandardProductList(InsSampleReceiveDto insSample) { |
| | | // 是否没有产品 |
| | | boolean isNoSample = false; |
| | | // String[] models = insSample.getModel().split("-(?=[^-]*$)");//拆分最后一个【-】 |
| | | String model = insSample.getModel(); |
| | | String modelNum = insSample.getModelNum(); |
| | | List<StandardProductList> list = standardProductListMapper.selectDetail(insSample.getStandardMethodListId(), 1, model, insSample.getIsCableTag()); |
| | | if (list.size() == 0) { |
| | | if (Objects.equals(insSample.getFactory(), "") || insSample.getFactory() == null) { |
| | | return null; |
| | | } |
| | | String[] split = insSample.getFactory().split(" - "); |
| | | split[3] = split[3].replace("- ", ""); |
| | | String tree = split[0] + " - " + split[1] + " - " + split[2] + " - " + split[3] + " - null"; |
| | | list = standardProductListMapper.selectDetail2(insSample.getStandardMethodListId(), 1, tree, insSample.getIsCableTag()); |
| | | if (list.size() == 0) { |
| | | String tree1 = split[0] + " - " + split[1] + " - " + split[2] + " - null - " + split[3]; |
| | | list = standardProductListMapper.selectDetail2(insSample.getStandardMethodListId(), 1, tree1, insSample.getIsCableTag()); |
| | | |
| | | // 只有对象的一层 |
| | | if (list.size() == 0) { |
| | | String tree2 = split[0] + " - " + split[1] + " - " + split[2] + " - null - null"; |
| | | list = standardProductListMapper.selectDetail2(insSample.getStandardMethodListId(), 1, tree2, insSample.getIsCableTag()); |
| | | // 样品直接赋值样品分类 |
| | | list.forEach(standardProductList -> standardProductList.setSample(standardProductList.getSampleType())); |
| | | isNoSample = true; |
| | | } |
| | | } |
| | | // 查询检查项目 |
| | | StandardProductListDto standardProductListDto = new StandardProductListDto(); |
| | | standardProductListDto.setTree(insSample.getFactory()); |
| | | standardProductListDto.setStandardMethodListIds(insSample.getStandardMethodListIds()); |
| | | standardProductListDto.setState(insSample.getState()); |
| | | List<StandardProductList> list = new ArrayList<>(); |
| | | if(CollectionUtils.isEmpty(standardProductListDto.getStandardMethodListIds())) { |
| | | return list; |
| | | } |
| | | String[] split1 = insSample.getFactory().split(" - "); |
| | | if (!isNoSample) { |
| | | //判断长度 |
| | | if (split1.length > 4) { |
| | | if (ObjectUtils.isNotEmpty(split1[3])) { |
| | | list = list.stream().filter(list1 -> Objects.nonNull(list1.getSample()) && Objects.equals(list1.getSample(), split1[3])).collect(Collectors.toList()); |
| | | } else if (split1[3].equals("")) { |
| | | list = list.stream().filter(list1 -> Objects.nonNull(list1.getSampleType()) && Objects.equals(list1.getSampleType(), split1[2])).collect(Collectors.toList()); |
| | | } |
| | | } |
| | | } |
| | | list = standardProductListMapper.standardProductListNoPage(standardProductListDto); |
| | | list = list.stream().filter(a -> { |
| | | try { |
| | | if (a.getSection() != null && !Objects.equals(a.getSection(), "")) { |
| | |
| | | StructureItemParameterDto structureItemParameterDto = new StructureItemParameterDto(); |
| | | if(standardMethod.getName().equals("委托要求")){ |
| | | structureItemParameterDto.setDelegateRequestFlag("1"); |
| | | }else { |
| | | structureItemParameterDto.setDelegateRequestFlag("0"); |
| | | } |
| | | structureItemParameterDto.setTree(checkItemQueryTree.toString()); |
| | | |
| | |
| | | // 如果未绑定 |
| | | if(!existFlag){ |
| | | BeanUtils.copyProperties(structureItemParameter, addStandProductList); |
| | | addStandProductList.setTell(structureItemParameter.getAskTell()); |
| | | addStandProductList.setStructureItemParameterId(structureItemParameter.getId()); |
| | | |
| | | addStandProductList.setManHour(Objects.toString(structureItemParameter.getManHour(), "")); |
| | | } |
| | | addStandProductList.setId(addStandProductList.getId() != null ? addStandProductList.getId() : IdWorker.getId()); |
| | | batchInsertStandardProductListArray.add(addStandProductList); |