| | |
| | | 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; |
| | |
| | | |
| | | @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(), "")) { |