value
2024-06-18 e514d3b363475831841e6240b35795eafebf3ef7
inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java
@@ -21,6 +21,8 @@
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
@@ -105,21 +107,26 @@
    }
    private boolean getIsIf(String str, String model){
        Matcher matcher = Pattern.compile("\\d+(\\.\\d+)?").matcher(model);
        String model2 = "";
        while (matcher.find()) {
            model2 += matcher.group();
        }
        if (str.contains("≥") || str.contains(">=")) {
            String param = str.replace("≥", "").replace(">=", "");
            return new BigDecimal(model).compareTo(new BigDecimal(param)) > -1;
            return new BigDecimal(model2).compareTo(new BigDecimal(param)) > -1;
        } else if (str.contains("≤") || str.contains("<=")) {
            String param = str.replace("≤", "").replace("<=", "");
            return new BigDecimal(model).compareTo(new BigDecimal(param)) < 1;
            return new BigDecimal(model2).compareTo(new BigDecimal(param)) < 1;
        } else if (str.contains(">")||str.contains(">")) {
            String param = str.replace(">", "").replace(">", "");
            return new BigDecimal(model).compareTo(new BigDecimal(param)) > 0;
            return new BigDecimal(model2).compareTo(new BigDecimal(param)) > 0;
        } else if (str.contains("<")||str.contains("<")) {
            String param = str.replace("<", "").replace("<", "");
            return new BigDecimal(model).compareTo(new BigDecimal(param)) < 0;
            return new BigDecimal(model2).compareTo(new BigDecimal(param)) < 0;
        } else if (str.contains("=")) {
            String param = str.replace("=", "");
            return new BigDecimal(model).compareTo(new BigDecimal(param)) == 0;
            return new BigDecimal(model2).compareTo(new BigDecimal(param)) == 0;
        }
        return false;
    }
@@ -167,7 +174,7 @@
        for (StandardProductList sp : standardProductLists) {
            for (StandardProductList pl : list) {
                if (Objects.equals(sp.getInspectionItem(), pl.getInspectionItem())
                        && Objects.equals(sp.getInspectionItemSubclass() == null ? "" : sp.getInspectionItemSubclass(), pl.getInspectionItemSubclass() == null ? "" : pl.getInspectionItemSubclass())
                        && Objects.equals((sp.getInspectionItemSubclass() == null)? "" : sp.getInspectionItemSubclass(), pl.getInspectionItemSubclass() == null ? "" : pl.getInspectionItemSubclass())
                        && Objects.equals(sp.getModel(), pl.getModel())
                        && Objects.equals(sp.getStructureItemParameterId(), pl.getStructureItemParameterId())) {
                    pl.setId(sp.getId());
@@ -205,7 +212,11 @@
        if (page == 1) {
            Integer userId = getLook.selectPowerByMethodAndUserId(null).get("userId");
            CompletableFuture.supplyAsync(() -> {
                standardProductListMapper.delete(Wrappers.<StandardProductList>lambdaUpdate().eq(StandardProductList::getStandardMethodListId, id).like(StandardProductList::getTree, tree));
                if(trees.length == 5){
                    standardProductListMapper.delete(Wrappers.<StandardProductList>lambdaUpdate().eq(StandardProductList::getStandardMethodListId, id).eq(StandardProductList::getTree, tree));
                }else{
                    standardProductListMapper.delete(Wrappers.<StandardProductList>lambdaUpdate().eq(StandardProductList::getStandardMethodListId, id).like(StandardProductList::getTree, tree));
                }
                standardProductListService2.saveBatch(list.stream().map(a -> {
                    a.setFactory(trees[0]);
                    a.setLaboratory(trees[1]);