zss
2024-09-14 e700e89f85e58747b57fc0d7e1fd30f3483aacca
inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java
@@ -61,27 +61,28 @@
    @Override
    public List<StandardProductList> selectStandardProductList(InsSample insSample) {
        String[] models = insSample.getModel().split("-(?=[^-]*$)");//拆分最后一个【-】
        List<StandardProductList> list = standardProductListMapper.selectDetail(insSample.getStandardMethodListId(), 1, models[0]);
        List<Integer> ids = Arrays.stream(insSample.getStandardMethodListId().split(","))
                .map(String::trim).map(Integer::parseInt).collect(Collectors.toList());
        List<StandardProductList> list = standardProductListMapper.selectDetail(ids, 1, models[0]);
        if (list.size() == 0) {
            if (Objects.equals(insSample.getFactory(), "") || insSample.getFactory() == null) {
                return null;
            }
            String[] split = insSample.getFactory().split(" - ");
            String tree = split[0] + " - " + split[1] + " - " + split[2] + " - " + split[3] + " - null";
            list = standardProductListMapper.selectDetail2(insSample.getStandardMethodListId(), 1, tree);
            list = standardProductListMapper.selectDetail2(ids, 1, tree);
            if (list.size() == 0) {
                String tree1 = split[0] + " - " + split[1] + " - " + split[2] + " - null - " + split[3];
                list = standardProductListMapper.selectDetail2(insSample.getStandardMethodListId(), 1, tree1);
                list = standardProductListMapper.selectDetail2(ids, 1, tree1);
            }
        }
        String[] split1 = insSample.getFactory().split(" - ");
        //判断长度
        if (split1.length > 3) {
        if (split1.length > 4) {
            if (ObjectUtils.isNotEmpty(split1[3])) {
                list = list.stream().filter(list1 -> list1.getSample().equals(split1[3])).collect(Collectors.toList());
                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 -> list1.getSampleType().equals(split1[2])).collect(Collectors.toList());
                list = list.stream().filter(list1 ->  Objects.nonNull(list1.getSampleType())&&Objects.equals(list1.getSampleType(),split1[2])).collect(Collectors.toList());
            }
        }
        list = list.stream().filter(a -> {
@@ -272,7 +273,7 @@
            int retryCount = 0;
            while (!success && retryCount < 100) {
                try {
                    standardProductListService2.saveBatch(list.stream().map(a -> {
                    standardProductListService2.saveOrUpdateBatch(list.stream().map(a -> {
                        a.setFactory(trees[0]);
                        a.setLaboratory(trees[1]);
                        a.setSampleType(trees[2]);
@@ -281,7 +282,6 @@
                        a.setStandardMethodListId(id);
                        return a;
                    }).collect(Collectors.toList()));
                    ;
                    success = true;
                } catch (Exception e) {
                    retryCount++;