zss
2024-06-19 02e13964dd95077c5f515156bc0da5187f5c8cf3
inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java
@@ -56,16 +56,23 @@
    @Override
    public List<StandardProductList> selectStandardProductList(InsSample insSample) {
        String[] models = insSample.getModel().split("-(?=[^-]*$)");//拆分最后一个【-】
        List<StandardProductList> list = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getStandardMethodListId, insSample.getStandardMethodListId()).eq(StandardProductList::getState, 1).eq(StandardProductList::getModel, models[0]));
        List<StandardProductList> list = standardProductListMapper.selectDetail(insSample.getStandardMethodListId(), 1, models[0]);
       /* List<StandardProductList> list = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery()
                .eq(StandardProductList::getStandardMethodListId, insSample.getStandardMethodListId())
                .eq(StandardProductList::getState, 1)
                .eq(StandardProductList::getModel, models[0])
                .apply("ORDER BY case when man_hour_group is NULL then 1 else 0 end, CAST(man_hour_group as UNSIGNED), man_hour_group REGEXP '^[0-9]', id asc "));*/
        if (list.size() == 0) {
            if(Objects.equals(insSample.getFactory(), "") || insSample.getFactory() == null){
            if (Objects.equals(insSample.getFactory(), "") || insSample.getFactory() == null) {
                return null;
            }
            String[] split = insSample.getFactory().split(" - ");
            list = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery()
            list = standardProductListMapper.selectDetail2(insSample.getStandardMethodListId(), 1, split[0] + " - " + split[1] + " - " + split[2] + " - " + split[3]);
            /*list = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery()
                    .eq(StandardProductList::getStandardMethodListId, insSample.getStandardMethodListId())
                    .eq(StandardProductList::getState, 1)
                    .like(StandardProductList::getTree, split[0] + " - " + split[1] + " - " + split[2] + " - " + split[3]));
                    .like(StandardProductList::getTree, split[0] + " - " + split[1] + " - " + split[2] + " - " + split[3])
                    .apply("ORDER BY case when man_hour_group is NULL then 1 else 0 end, CAST(man_hour_group as UNSIGNED), man_hour_group REGEXP '^[0-9]', id asc "));*/
        }
        list = list.stream().filter(a -> {
            try {
@@ -77,9 +84,9 @@
                    List<String> prices = JSON.parseArray(a.getPrice(), String.class);
                    boolean isIf;
                    for (int i = 0; i < sections.size(); i++) {
                        if(Objects.equals(a.getBsm(), "1")){
                        if (Objects.equals(a.getBsm(), "1")) {
                            return true;
                        }else{
                        } else {
                            if (sections.get(i).contains("&")) {
                                String[] split = sections.get(i).split("&");
                                isIf = getIsIf(split[0], models[1]) && getIsIf(split[1], models[1]);
@@ -106,7 +113,7 @@
        return list;
    }
    private boolean getIsIf(String str, String model){
    private boolean getIsIf(String str, String model) {
        Matcher matcher = Pattern.compile("\\d+(\\.\\d+)?").matcher(model);
        String model2 = "";
        while (matcher.find()) {
@@ -118,10 +125,10 @@
        } else if (str.contains("≤") || str.contains("<=")) {
            String param = str.replace("≤", "").replace("<=", "");
            return new BigDecimal(model2).compareTo(new BigDecimal(param)) < 1;
        } else if (str.contains(">")||str.contains(">")) {
        } else if (str.contains(">") || str.contains(">")) {
            String param = str.replace(">", "").replace(">", "");
            return new BigDecimal(model2).compareTo(new BigDecimal(param)) > 0;
        } else if (str.contains("<")||str.contains("<")) {
        } else if (str.contains("<") || str.contains("<")) {
            String param = str.replace("<", "").replace("<", "");
            return new BigDecimal(model2).compareTo(new BigDecimal(param)) < 0;
        } else if (str.contains("=")) {
@@ -174,7 +181,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());
@@ -202,7 +209,7 @@
                    if (sp.getTemplateId() != null && !sp.getTemplateId().equals("")) {
                        pl.setTemplateId(sp.getTemplateId());
                    }
                    if(sp.getTree() != null && !sp.getTree().equals("")){
                    if (sp.getTree() != null && !sp.getTree().equals("")) {
                        pl.setTree(sp.getTree());
                    }
                    break;
@@ -212,9 +219,9 @@
        if (page == 1) {
            Integer userId = getLook.selectPowerByMethodAndUserId(null).get("userId");
            CompletableFuture.supplyAsync(() -> {
                if(trees.length == 5){
                if (trees.length == 5) {
                    standardProductListMapper.delete(Wrappers.<StandardProductList>lambdaUpdate().eq(StandardProductList::getStandardMethodListId, id).eq(StandardProductList::getTree, tree));
                }else{
                } else {
                    standardProductListMapper.delete(Wrappers.<StandardProductList>lambdaUpdate().eq(StandardProductList::getStandardMethodListId, id).like(StandardProductList::getTree, tree));
                }
                standardProductListService2.saveBatch(list.stream().map(a -> {