zhuo
2025-02-27 e7652ccba51bca69f1a8da50b959b694544267f8
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java
@@ -591,22 +591,27 @@
        return insSampleUserMapper.insert(insSampleUser);
    }
    /**
     * 查询模板内容
     * @param order
     * @param insProducts
     */
    private void getTemplateThing(InsOrder order, List<InsProduct> insProducts) {
        Set<Integer> set = new HashSet<>();
        // 检验项分类+检验项+检验子项的拼接
        List<String> itemNameList = insProducts.stream().map(insProduct -> {
            String itemName = "";
            if (StringUtils.isNotBlank(insProduct.getInspectionItemClass())) {
                itemName += insProduct.getInspectionItemClass().trim();
            }
            if (StringUtils.isNotBlank(insProduct.getInspectionItem())) {
                itemName += insProduct.getInspectionItem().trim();
            }
            if (StringUtils.isNotBlank(insProduct.getInspectionItemSubclass())) {
                itemName += insProduct.getInspectionItemSubclass().trim();
            }
            return itemName;
        }).collect(Collectors.toList());
//        List<String> itemNameList = insProducts.stream().map(insProduct -> {
//            String itemName = "";
//            if (StringUtils.isNotBlank(insProduct.getInspectionItemClass())) {
//                itemName += insProduct.getInspectionItemClass().trim();
//            }
//            if (StringUtils.isNotBlank(insProduct.getInspectionItem())) {
//                itemName += insProduct.getInspectionItem().trim();
//            }
//            if (StringUtils.isNotBlank(insProduct.getInspectionItemSubclass())) {
//                itemName += insProduct.getInspectionItemSubclass().trim();
//            }
//            return itemName;
//        }).collect(Collectors.toList());
        // 查询订单状态判断是否是查历史模板
        if (order.getIsFirstSubmit() != null && order.getIsFirstSubmit().equals(1)) {
            InsOrderState insOrderState = insOrderStateMapper.selectOne(Wrappers.<InsOrderState>lambdaQuery()
@@ -627,11 +632,8 @@
                        thing = one.getThing();
                        if (StrUtil.isNotEmpty(thing)) {
                            thing = GZipUtil.uncompress(thing);
                            JSONObject sheet = JSON.parseObject(JSON.toJSONString(JSON.parseArray(JSON.toJSONString(JSON.parseObject(thing).get("data"))).get(0)));
                            // 清除没有关联的检验项
                            eliminateItem(sheet, itemNameList);
                            JSONObject config = JSON.parseObject(JSON.toJSONString(sheet.get("config")));
                            JSONObject sheet = JSON.parseObject(thing).getJSONArray("data").getJSONObject(0);
                            JSONObject config = sheet.getJSONObject("config");
                            List<JSONObject> cellData = JSON.parseArray(JSON.toJSONString(sheet.get("celldata")), JSONObject.class);
                            Map<String, Object> style = new HashMap<>();
                            style.put("rowlen", config.get("rowlen"));
@@ -654,10 +656,8 @@
                thing = standardTemplateService.getStandTempThingById(product.getTemplateId());
            }
            if (StrUtil.isNotEmpty(thing)) {
                JSONObject sheet = JSON.parseObject(JSON.toJSONString(JSON.parseArray(JSON.toJSONString(JSON.parseObject(thing).get("data"))).get(0)));
                // 清除没有关联的检验项
                eliminateItem(sheet, itemNameList);
                JSONObject config = JSON.parseObject(JSON.toJSONString(sheet.get("config")));
                JSONObject sheet = JSON.parseObject(thing).getJSONArray("data").getJSONObject(0);
                JSONObject config = sheet.getJSONObject("config");
                List<JSONObject> cellData = JSON.parseArray(JSON.toJSONString(sheet.get("celldata")), JSONObject.class);
                Map<String, Object> style = new HashMap<>();
                style.put("rowlen", config.get("rowlen"));
@@ -670,7 +670,7 @@
    }
    /**
     * 清除没有使用的检验项
     * todo: 清除没有使用的检验项
     * @param sheet
     * @param itemNameList
     */