bug
zss
2024-06-26 835951395f01aba7ab567d3a6c7b5450b4e54a1b
bug
已修改11个文件
239 ■■■■■ 文件已修改
cnas-server/src/main/java/com/yuanchu/mom/controller/CapacityScopeController.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-server/src/main/java/com/yuanchu/mom/pojo/StructureItemParameter.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-server/src/main/resources/mapper/StructureItemParameterMapper.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardTreeMapper.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java 130 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardTreeServiceImpl.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/resources/mapper/InsOrderMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/resources/mapper/InsSampleMapper.xml 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/resources/mapper/StandardTreeMapper.xml 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/resources/static/report-template.docx 补丁 | 查看 | 原始文档 | blame | 历史
cnas-server/src/main/java/com/yuanchu/mom/controller/CapacityScopeController.java
@@ -348,6 +348,12 @@
                    }
                } catch (Exception e) {
                }
                try {
                    if (list1.get(24) != null) {
                        str.setLaboratory(list1.get(24) + "");
                    }
                } catch (Exception e) {
                }
                lists.add(str);
            }
        });
cnas-server/src/main/java/com/yuanchu/mom/pojo/StructureItemParameter.java
@@ -49,6 +49,7 @@
    private String price;
    @ApiModelProperty(value = "场所")
    @ValueTableShow(4)
    private String laboratory;
    @ValueTableShow(4)
cnas-server/src/main/resources/mapper/StructureItemParameterMapper.xml
@@ -44,6 +44,7 @@
        WHEN INSTR(sample, ',') > 0 THEN
        SUBSTRING_INDEX(SUBSTRING_INDEX(sample, '","', 1), '"', -1)
        when sample = '[""]' then null
        when sample = '[]' then null
        ELSE
        TRIM(BOTH '["]' FROM SUBSTRING_INDEX(REPLACE(sample, '[["', ''), '"]]', 1))
        END AS samples
inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardTreeMapper.java
@@ -12,11 +12,11 @@
import java.util.List;
/**
* @author Administrator
* @description 针对表【standard_tree(标准树)】的数据库操作Mapper
* @createDate 2024-03-01 15:06:44
* @Entity com.yuanchu.mom.pojo.StandardTree
*/
 * @author Administrator
 * @description 针对表【standard_tree(标准树)】的数据库操作Mapper
 * @createDate 2024-03-01 15:06:44
 * @Entity com.yuanchu.mom.pojo.StandardTree
 */
public interface StandardTreeMapper extends BaseMapper<StandardTree> {
    List<FactoryDto> selectStandardTreeList();
@@ -29,11 +29,11 @@
    List<StandardMethodList> getStandardMethodListBySample(String sampleType);
    List<StandardProductList> selectStandardProductListByTree(String tree, String sample, String model, String trees);
    List<StandardProductList> selectStandardProductListByTree(String tree, String sample, String model, String trees, String laboratory);
    List<StandardProductList> selectStandardProductListByTree2(String tree, String sample, String model, String trees);
    List<StandardProductList> selectStandardProductListByTree2(String tree, String sample, String model, String trees, String laboratory);
    List<StandardProductList> selectStandardProductListByTree3(String tree, String sample, String model, String trees);
    List<StandardProductList> selectStandardProductListByTree3(String tree, String sample, String model, String trees, String laboratory);
    List<SampleTypeDto> getStandardTree2();
inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java
@@ -273,9 +273,12 @@
                JSONObject jo = JSON.parseObject(JSON.toJSONString(v));
                InsProduct insProduct = new InsProduct();
                insProduct.setId(Integer.parseInt(k));
                InsProductResult result = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, insProduct.getId()));
                if (BeanUtil.isEmpty(result)) {
                    result = new InsProductResult();
                List<InsProductResult> results = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, insProduct.getId()));
                InsProductResult result;
                if (CollectionUtils.isEmpty(results)) {
                     result = new InsProductResult();
                } else {
                     result = results.get(0);
                }
                result.setInsProductId(Integer.parseInt(k));
                if (jo.get("insValue") != null) {
@@ -651,10 +654,8 @@
                            } else if (value.equals("试验方法")) {
                                textRenderData.setText(p.getMethodS());
                            } else if (value.equals("检验项")) {
                                Console.log(p.getInspectionItem() + "\n" + p.getInspectionItemEn());
                                textRenderData.setText(p.getInspectionItem() + "\n" + p.getInspectionItemEn());
                            } else if (value.equals("检验子项")) {
                                Console.log(p.getInspectionItemSubclass() + "\n" + p.getInspectionItemSubclassEn());
                                if (ObjectUtils.isEmpty(p.getInspectionItemSubclassEn())) {
                                    textRenderData.setText(p.getInspectionItemSubclass());
                                } else {
inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java
@@ -139,114 +139,6 @@
    @Override
    public Map<String, Object> selectStandardProductListByMethodId(Integer id, String tree, Integer page) {
        /*String[] trees = tree.split(" - ");
        List<StandardProductList> list = new ArrayList<>();
        if (trees.length == 3) {
            List<StandardTree> treeList = standardTreeMapper.selectList(Wrappers.<StandardTree>lambdaQuery().eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]));
            if (treeList.size() == 0) {
                StandardTree standardTree = new StandardTree();
                standardTree.setFactory(trees[0]);
                standardTree.setLaboratory(trees[1]);
                standardTree.setSampleType(trees[2]);
                treeList.add(standardTree);
            }
            for (StandardTree standardTree : treeList) {
                String str = tree + " - " + standardTree.getSample() + " - " + standardTree.getModel();
                list.addAll(standardTreeMapper.selectStandardProductListByTree3("\"" + trees[2] + "\"", standardTree.getSample(), standardTree.getModel(), str));
            }
        } else if (trees.length == 4) {
            List<StandardTree> treeList = standardTreeMapper.selectList(Wrappers.<StandardTree>lambdaQuery().eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]).eq(StandardTree::getSample, trees[3]));
            if (treeList.size() == 0) {
                StandardTree standardTree = new StandardTree();
                standardTree.setFactory(trees[0]);
                standardTree.setLaboratory(trees[1]);
                standardTree.setSampleType(trees[2]);
                standardTree.setSample(trees[2]);
                treeList.add(standardTree);
            }
            for (StandardTree standardTree : treeList) {
                String str = tree + " - " + standardTree.getModel();
                list.addAll(standardTreeMapper.selectStandardProductListByTree("\"" + trees[2] + "\"", standardTree.getSample(), standardTree.getModel(), str));
                list.addAll(standardTreeMapper.selectStandardProductListByTree2("\"" + trees[2] + "\",\"" + trees[3] + "\"", standardTree.getSample(), standardTree.getModel(), str));
            }
        } else {
            list.addAll(standardTreeMapper.selectStandardProductListByTree("\"" + trees[2] + "\"", trees[3], trees[4], tree));
            list.addAll(standardTreeMapper.selectStandardProductListByTree2("\"" + trees[2] + "\",\"" + trees[3] + "\"", trees[3], trees[4], tree));
        }
        for (StandardProductList productList : list) {
            productList.setId(IdWorker.getId());
        }
        List<StandardProductList> standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getStandardMethodListId, id).like(StandardProductList::getTree, tree));
        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.getModel(), pl.getModel())
                        && Objects.equals(sp.getStructureItemParameterId(), pl.getStructureItemParameterId())) {
                    pl.setId(sp.getId());
                    if (sp.getState() != null && !sp.getState().equals("")) {
                        pl.setState(sp.getState());
                    } else {
                        pl.setState(id == 0 ? 1 : 0);
                    }
                    pl.setMethodS(sp.getMethodS());
                    if (sp.getAsk() != null && !sp.getAsk().equals("")) {
                        pl.setAsk(sp.getAsk());
                    }
                    if (sp.getTell() != null && !sp.getTell().equals("")) {
                        pl.setTell(sp.getTell());
                    }
                    if (sp.getPrice() != null && !sp.getPrice().equals("")) {
                        pl.setPrice(sp.getPrice());
                    }
                    if (sp.getManHour() != null && !sp.getManHour().equals("")) {
                        pl.setManHour(sp.getManHour());
                    }
                    if (sp.getSection() != null && !sp.getSection().equals("")) {
                        pl.setSection(sp.getSection());
                    }
                    if (sp.getTemplateId() != null && !sp.getTemplateId().equals("")) {
                        pl.setTemplateId(sp.getTemplateId());
                    }
                    if(sp.getTree() != null && !sp.getTree().equals("")){
                        pl.setTree(sp.getTree());
                    }
                    break;
                }
            }
        }
        if (page == 1) {
            Integer userId = getLook.selectPowerByMethodAndUserId(null).get("userId");
            CompletableFuture.supplyAsync(() -> {
                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]);
                    a.setSampleType(trees[2]);
                    a.setCreateUser(userId);
                    a.setUpdateUser(userId);
                    a.setStandardMethodListId(id);
                    return a;
                }).collect(Collectors.toList()));
                return null;
            }).thenAccept(res -> {
            }).exceptionally(e -> {
                e.printStackTrace();
                return null;
            });
        }
        Map<String, Object> map = new HashMap<>();
        try {
            map.put("productList", list.subList((page - 1) * 50, page * 50));
        } catch (IndexOutOfBoundsException e) {
            map.put("productList", list.subList((page - 1) * 50, list.size()));
        }
        map.put("total", list.size());
        return map;*/
        String[] trees = tree.split(" - ");
        List<StandardProductList> list = new ArrayList<>();
        if (trees.length == 3) {
@@ -276,18 +168,8 @@
            }
            for (StandardTree standardTree2 : treeList) {
                String tree2 = trees[0] + " - " + trees[1] + " - " + trees[2] + " - " + standardTree2.getSample() + " - " + standardTree2.getModel();
                /*if(standardTree2.getSample()!=null){
                    tree2 += trees[0] + " - " + trees[1] + " - " + trees[2] + " - " + standardTree2.getSample();
                }
                if(standardTree2.getModel()!=null){
                    if(standardTree2.getSample()!=null){
                        tree2 += standardTree2.getModel();
                    }else{
                        tree2 += trees[0] + " - " + trees[1] + " - " + trees[2] + " - " + null + " - " + standardTree2.getModel();
                    }
                }*/
                list.addAll(standardTreeMapper.selectStandardProductListByTree("\"" + trees[2] + "\"", standardTree2.getSample(), standardTree2.getModel(), tree2));
                list.addAll(standardTreeMapper.selectStandardProductListByTree2("\"" + trees[2] + "\",\"" + standardTree2.getSample() + "\"", standardTree2.getSample(), standardTree2.getModel(), tree2));
                list.addAll(standardTreeMapper.selectStandardProductListByTree("\"" + trees[2] + "\"", standardTree2.getSample(), standardTree2.getModel(), tree2, trees[1]));
                list.addAll(standardTreeMapper.selectStandardProductListByTree2("\"" + trees[2] + "\",\"" + standardTree2.getSample() + "\"", standardTree2.getSample(), standardTree2.getModel(), tree2, trees[1]));
            }
        } else if (trees.length == 4) {
            List<StandardTree> treeList = standardTreeMapper.selectList(Wrappers.<StandardTree>lambdaQuery().eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]).eq(StandardTree::getSample, trees[3]));
@@ -301,12 +183,12 @@
            }
            for (StandardTree standardTree : treeList) {
                String str = tree + " - " + standardTree.getModel();
                list.addAll(standardTreeMapper.selectStandardProductListByTree("\"" + trees[2] + "\"", standardTree.getSample(), standardTree.getModel(), str));
                list.addAll(standardTreeMapper.selectStandardProductListByTree2("\"" + trees[2] + "\",\"" + trees[3] + "\"", standardTree.getSample(), standardTree.getModel(), str));
                list.addAll(standardTreeMapper.selectStandardProductListByTree("\"" + trees[2] + "\"", standardTree.getSample(), standardTree.getModel(), str, trees[1]));
                list.addAll(standardTreeMapper.selectStandardProductListByTree2("\"" + trees[2] + "\",\"" + trees[3] + "\"", standardTree.getSample(), standardTree.getModel(), str, trees[1]));
            }
        } else {
            list.addAll(standardTreeMapper.selectStandardProductListByTree("\"" + trees[2] + "\"", trees[3].equals("null") ? null : trees[3], trees[4], tree));
            list.addAll(standardTreeMapper.selectStandardProductListByTree2("\"" + trees[2] + "\",\"" + trees[3] + "\"", trees[3].equals("null") ? null : trees[3], trees[4], tree));
            list.addAll(standardTreeMapper.selectStandardProductListByTree("\"" + trees[2] + "\"", trees[3].equals("null") ? null : trees[3], trees[4], tree, trees[1]));
            list.addAll(standardTreeMapper.selectStandardProductListByTree2("\"" + trees[2] + "\",\"" + trees[3] + "\"", trees[3].equals("null") ? null : trees[3], trees[4], tree, trees[1]));
        }
        for (StandardProductList productList : list) {
            productList.setId(IdWorker.getId());
inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardTreeServiceImpl.java
@@ -69,6 +69,10 @@
    @Override
    @Transactional(rollbackFor = Exception.class)
    public int addStandardTree(StandardTree standardTree) {
        StandardTree tree = standardTreeMapper.selectOne(Wrappers.<StandardTree>lambdaQuery().eq(StandardTree::getModel, standardTree.getModel()));
        if (tree != null) {
            throw new ErrorException("该型号已存在");
        }
        return standardTreeMapper.insert(standardTree);
    }
@@ -78,7 +82,11 @@
        String[] trees = tree.split(" - ");
        switch (trees.length) {
            case 5:
                standardTreeMapper.delete(Wrappers.<StandardTree>lambdaUpdate().eq(StandardTree::getFactory, trees[0]).eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]).eq(StandardTree::getSample, trees[3]).eq(StandardTree::getModel, trees[4]));
                if (trees[3] == null) {
                    standardTreeMapper.delete(Wrappers.<StandardTree>lambdaUpdate().eq(StandardTree::getFactory, trees[0]).eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]).isNull(StandardTree::getSample).eq(StandardTree::getModel, trees[4]));
                } else {
                    standardTreeMapper.delete(Wrappers.<StandardTree>lambdaUpdate().eq(StandardTree::getFactory, trees[0]).eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]).eq(StandardTree::getSample, trees[3]).eq(StandardTree::getModel, trees[4]));
                }
                break;
            /*case 4:
                standardTreeMapper.delete(Wrappers.<StandardTree>lambdaUpdate().eq(StandardTree::getFactory, trees[0]).eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]).eq(StandardTree::getSample, trees[3]));
inspect-server/src/main/resources/mapper/InsOrderMapper.xml
@@ -169,8 +169,8 @@
        </if>
    </select>
    <select id="selectDeviceList" resultType="java.util.Map">
        select device_name,specification_model,management_number,DATE_ADD(date_format(last_calibration_date,
        '%Y-%m-%d'),INTERVAL calibration_date month) latest_traceability
        select device_name,specification_model,management_number,<!--DATE_ADD(date_format(last_calibration_date,
        '%Y-%m-%d'),INTERVAL calibration_date month)-->  next_calibration_date latest_traceability
        from device
        where device.management_number in
        <foreach collection="names" index="index" open="(" separator="," close=")" item="val">
inspect-server/src/main/resources/mapper/InsSampleMapper.xml
@@ -141,6 +141,7 @@
               man_day,
               bsm,
               ask,
               tell,
               `last_value`,
               ip.ins_result  ip_ins_result,
               state,
@@ -289,7 +290,7 @@
        left join ins_product ip on isa.id = ip.ins_sample_id
        left join ins_product_result ipr on ip.id = ipr.ins_product_id
        left join ins_order io on io.id = ins_order_id
        where  ip.state = 1
        where ip.state = 1
        and ins_order_id in
        <foreach collection="ids" open="(" close=")" item="id" separator=",">
            #{id}
@@ -499,6 +500,7 @@
        <result property="manDay" column="man_day" jdbcType="INTEGER"/>
        <result property="bsm" column="bsm" jdbcType="VARCHAR"/>
        <result property="ask" column="ask" jdbcType="VARCHAR"/>
        <result property="tell" column="tell" jdbcType="VARCHAR"/>
        <result property="lastValue" column="last_value" jdbcType="VARCHAR"/>
        <result property="insResult" column="ip_ins_result" jdbcType="INTEGER"/>
        <result property="state" column="state" jdbcType="INTEGER"/>
inspect-server/src/main/resources/mapper/StandardTreeMapper.xml
@@ -57,7 +57,7 @@
                 left join product p on p.object_id = sto.id
                 left join standard_tree st on st.sample_type = sto.specimen_name
            and st.sample = p.name
        order by l.id, CAST(sto.code AS DECIMAL), p.id, ISNULL (st.id), st.id
        order by l.id, CAST(sto.code AS DECIMAL), p.id, ISNULL(st.id), st.id
    </select>
    <select id="selectStandardProductById" resultType="com.yuanchu.mom.pojo.StandardProductList">
@@ -161,18 +161,24 @@
               id        structure_item_parameter_id
        from structure_item_parameter
        where (
                      sample is NULL
                      OR sample = ''
                      or sample = '[]'
                      OR sample LIKE CONCAT('%[', #{tree}, ']%')
                  )
        order by case when man_hour_group is NULL then 1
                      when man_hour_group ='' then 1  else 0 end,
                sample is NULL
                OR sample = ''
                or sample = '[]'
                OR sample LIKE CONCAT('%[', #{tree}, ']%')
            )
          and (laboratory is null
            or laboratory=''
            or laboratory = #{laboratory})
        order by case
                     when man_hour_group is NULL then 1
                     when man_hour_group = '' then 1
                     else 0 end,
                 CASE
                     WHEN man_hour_group REGEXP '^[0-9]' THEN CAST(man_hour_group AS UNSIGNED) -- 如果以数字开头,则按照数字大小排序
                     WHEN man_hour_group REGEXP '[0-9]+' THEN CAST(SUBSTRING(man_hour_group, 2)AS UNSIGNED) END -- 提取字母后面的数字部分
                     WHEN man_hour_group REGEXP '[0-9]+'
                         THEN CAST(SUBSTRING(man_hour_group, 2) AS UNSIGNED) END -- 提取字母后面的数字部分
                ,id asc
                , id asc
    </select>
    <select id="selectStandardProductListByTree2" resultType="com.yuanchu.mom.pojo.StandardProductList">
@@ -207,13 +213,19 @@
               id        structure_item_parameter_id
        from structure_item_parameter
        where sample LIKE CONCAT('%[', #{tree}, ']%')
        order by case when man_hour_group is NULL then 1
                      when man_hour_group ='' then 1  else 0 end,
            and (laboratory is null
            or laboratory=''
           or laboratory = #{laboratory})
        order by case
                     when man_hour_group is NULL then 1
                     when man_hour_group = '' then 1
                     else 0 end,
                 CASE
                     WHEN man_hour_group REGEXP '^[0-9]' THEN CAST(man_hour_group AS UNSIGNED) -- 如果以数字开头,则按照数字大小排序
                     WHEN man_hour_group REGEXP '[0-9]+' THEN CAST(SUBSTRING(man_hour_group, 2)AS UNSIGNED) END -- 提取字母后面的数字部分
                     WHEN man_hour_group REGEXP '[0-9]+'
                         THEN CAST(SUBSTRING(man_hour_group, 2) AS UNSIGNED) END -- 提取字母后面的数字部分
                ,id asc
                , id asc
    </select>
    <select id="getStandardTree2" resultMap="SampleTypeDto">
@@ -262,16 +274,22 @@
                      or sample = '[]'
                      OR sample LIKE CONCAT('%', #{tree}, '%')
                  )
        order by case when man_hour_group is NULL then 1
                      when man_hour_group ='' then 1  else 0 end,
            and (laboratory is null
            or laboratory=''
           or laboratory = #{laboratory})
        order by case
                     when man_hour_group is NULL then 1
                     when man_hour_group = '' then 1
                     else 0 end,
                 CASE
                     WHEN man_hour_group REGEXP '^[0-9]' THEN CAST(man_hour_group AS UNSIGNED) -- 如果以数字开头,则按照数字大小排序
                     WHEN man_hour_group REGEXP '[0-9]+' THEN CAST(SUBSTRING(man_hour_group, 2)AS UNSIGNED) END -- 提取字母后面的数字部分
                     WHEN man_hour_group REGEXP '[0-9]+'
                         THEN CAST(SUBSTRING(man_hour_group, 2) AS UNSIGNED) END -- 提取字母后面的数字部分
                ,id asc
                , id asc
    </select>
    <select id="getStandardTree3" resultType="com.yuanchu.mom.dto.SampleDto">
        select model label,
        select  model label,
               model value
        from standard_tree
        where sample_type = #{sampleType}
inspect-server/src/main/resources/static/report-template.docx
Binary files differ