liding
2025-04-07 ecef4e046635a6eb78c92cd72dd96a84401164d9
1.检验项查询拼接类型 2,设备检验项优化
已修改5个文件
165 ■■■■■ 文件已修改
basic-server/src/main/java/com/ruoyi/basic/service/impl/CapacityScopeServiceImpl.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTreeServiceImpl.java 80 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/resources/mapper/StructureItemParameterMapper.xml 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/resources/application-test.yml 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/UserMapper.xml 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/service/impl/CapacityScopeServiceImpl.java
@@ -197,12 +197,12 @@
    @Override
    public List<Model> getProductTypes(ModelDto modelDto) {
        return modelMapper.selectList(Wrappers.<Model>lambdaQuery().eq(Model::getProductId,modelDto.getProductId()));
        return modelMapper.selectList(Wrappers.<Model>lambdaQuery().eq(Model::getProductId, modelDto.getProductId()));
    }
    @Override
    public List<ProductPart> getPartNoList(ProductPartDto productPartDto) {
        return productPartMapper.selectList(Wrappers.<ProductPart>lambdaQuery().eq(ProductPart::getProductId,productPartDto.getProductId()));
        return productPartMapper.selectList(Wrappers.<ProductPart>lambdaQuery().eq(ProductPart::getProductId, productPartDto.getProductId()));
    }
    @Transactional(rollbackFor = Exception.class)
@@ -379,7 +379,7 @@
            List<StructureTestObject> insertedObjects) {
        insertedObjects.forEach(obj -> {
            String key = obj.getSpecimenName() + "|" + obj.getSpecimenNameEn()+ "|" + obj.getObjectType();
            String key = obj.getSpecimenName() + "|" + obj.getSpecimenNameEn() + "|" + obj.getObjectType();
            existStructureTestObjects.get(key).setId(obj.getId()); // 更新缓存中的ID
        });
    }
@@ -393,7 +393,7 @@
        // 阶段5原有产品处理逻辑迁移至此
        pendingProducts.forEach(i -> {
            String specimenKey = i.getSpecimenName() + "|" + i.getSpecimenNameEn()+ "|" + i.getObjectType();
            String specimenKey = i.getSpecimenName() + "|" + i.getSpecimenNameEn() + "|" + i.getObjectType();
            StructureTestObject sto = structureTestObjectCache.get(specimenKey);
            processProductData(
basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTreeServiceImpl.java
@@ -81,21 +81,21 @@
            basicTreeDto.setValue(String.valueOf(model.getId()));
            basicTreeDto.setLabel(model.getModelName());
            basicTreeDto.setChildren(null);
            if(model.getProductId() != null) {
                if(CollectionUtils.isEmpty(productModelMap.get(model.getProductId()))){
            if (model.getProductId() != null) {
                if (CollectionUtils.isEmpty(productModelMap.get(model.getProductId()))) {
                    List<BasicTreeDto> basicTreeDtoList = new ArrayList<>();
                    basicTreeDtoList.add(basicTreeDto);
                    productModelMap.put(model.getProductId(),basicTreeDtoList);
                }else {
                    productModelMap.put(model.getProductId(), basicTreeDtoList);
                } else {
                    productModelMap.get(model.getProductId()).add(basicTreeDto);
                }
            }
            if(model.getStructureTestObjectId() != null) {
                if(CollectionUtils.isEmpty(testObjectModelMap.get(model.getStructureTestObjectId()))){
            if (model.getStructureTestObjectId() != null) {
                if (CollectionUtils.isEmpty(testObjectModelMap.get(model.getStructureTestObjectId()))) {
                    List<BasicTreeDto> basicTreeDtoList = new ArrayList<>();
                    basicTreeDtoList.add(basicTreeDto);
                    testObjectModelMap.put(model.getStructureTestObjectId(),basicTreeDtoList);
                }else {
                    testObjectModelMap.put(model.getStructureTestObjectId(), basicTreeDtoList);
                } else {
                    testObjectModelMap.get(model.getStructureTestObjectId()).add(basicTreeDto);
                }
            }
@@ -122,15 +122,15 @@
                                    StructureTestObjectDto structureTestObjectDto = new StructureTestObjectDto();
                                    BeanUtils.copyProperties(structureTestObject, structureTestObjectDto);
                                    List<BasicTreeDto> children = new ArrayList<>();
                                    if(!CollectionUtils.isEmpty(productMap.get(structureTestObject.getId()))){
                                    if (!CollectionUtils.isEmpty(productMap.get(structureTestObject.getId()))) {
                                        children.addAll(productMap.get(structureTestObject.getId()));
                                    }
                                    if(!CollectionUtils.isEmpty(testObjectModelMap.get(structureTestObject.getId()))){
                                    if (!CollectionUtils.isEmpty(testObjectModelMap.get(structureTestObject.getId()))) {
                                        children.addAll(testObjectModelMap.get(structureTestObject.getId()));
                                    }
                                    structureTestObjectDto.setChildren(children);
                                    return structureTestObjectDto;
                                },Collectors.toList())
                                }, Collectors.toList())
                        )
                )
        );
@@ -178,7 +178,7 @@
                                }
                            }
                            workShopTreeDto.setChildren(testObjectChildren);
                            if(!CollectionUtils.isEmpty(testObjectChildren)){
                            if (!CollectionUtils.isEmpty(testObjectChildren)) {
                                workShopTreeDtoList.add(workShopTreeDto);
                            }
                        }
@@ -201,7 +201,7 @@
            return laboratoryTreeDto;
        }).collect(Collectors.toList());
        List<BasicTreeDto> factoryList = new ArrayList<>();
        factoryList.add(new BasicTreeDto(BasicTreeEnums.FACTORY_TYPE.getCode(),"中天科技","1",laboratoryTreeDtoList));
        factoryList.add(new BasicTreeDto(BasicTreeEnums.FACTORY_TYPE.getCode(), "中天科技", "1", laboratoryTreeDtoList));
        return factoryList;
    }
@@ -210,27 +210,27 @@
    @Transactional(rollbackFor = Exception.class)
    public int addStandardTree(ModelAddDto modelAddDto) {
        // 校验
        if(StringUtils.isEmpty(modelAddDto.getParentId())){
        if (StringUtils.isEmpty(modelAddDto.getParentId())) {
            throw new RuntimeException("缺少父层级绑定关系");
        }
        Model model = new Model();
        String parentLevel = modelAddDto.getParentLevel();
        // 名称重复性性校验
        QueryWrapper<Model> modelQueryWrapper = new QueryWrapper<>();
        if(BasicTreeEnums.PRODUCT_TYPE.getCode().equals(parentLevel)){
        if (BasicTreeEnums.PRODUCT_TYPE.getCode().equals(parentLevel)) {
            model.setProductId(Integer.valueOf(modelAddDto.getParentId()));
            modelQueryWrapper.eq("product_id", model.getProductId());
        }else if(BasicTreeEnums.STRUCTURE_TEST_OBJECT_TYPE.getCode().equals(parentLevel)){
        } else if (BasicTreeEnums.STRUCTURE_TEST_OBJECT_TYPE.getCode().equals(parentLevel)) {
            model.setStructureTestObjectId(Integer.valueOf(modelAddDto.getParentId()));
            modelQueryWrapper.eq("structure_test_object_id", model.getStructureTestObjectId());
        }else {
        } else {
            throw new RuntimeException("型号只能绑定对象和产品");
        }
        model.setModelName(modelAddDto.getModelName());
        modelQueryWrapper.eq("model_name", model.getModelName());
        Model modelResult = modelMapper.selectOne(modelQueryWrapper);
        if(ObjectUtils.isNotEmpty(modelResult)){
        if (ObjectUtils.isNotEmpty(modelResult)) {
            throw new RuntimeException("请勿添加重复型号");
        }
        return modelMapper.insert(model);
@@ -238,8 +238,8 @@
    @Override
    @Transactional(rollbackFor = Exception.class)
    public int delStandardTree(String level,String id) {
        if(BasicTreeEnums.MODEL_TYPE.getCode().equals(level)){
    public int delStandardTree(String level, String id) {
        if (BasicTreeEnums.MODEL_TYPE.getCode().equals(level)) {
            modelMapper.deleteById(id);
        }
        return 1;
@@ -262,21 +262,21 @@
            basicTreeDto.setValue(model.getModelName());
            basicTreeDto.setLabel(model.getModelName());
            basicTreeDto.setChildren(null);
            if(model.getProductId() != null) {
                if(CollectionUtils.isEmpty(productModelMap.get(model.getProductId()))){
            if (model.getProductId() != null) {
                if (CollectionUtils.isEmpty(productModelMap.get(model.getProductId()))) {
                    List<BasicTreeDto> basicTreeDtoList = new ArrayList<>();
                    basicTreeDtoList.add(basicTreeDto);
                    productModelMap.put(model.getProductId(),basicTreeDtoList);
                }else {
                    productModelMap.put(model.getProductId(), basicTreeDtoList);
                } else {
                    productModelMap.get(model.getProductId()).add(basicTreeDto);
                }
            }
            if(model.getStructureTestObjectId() != null) {
                if(CollectionUtils.isEmpty(testObjectModelMap.get(model.getStructureTestObjectId()))){
            if (model.getStructureTestObjectId() != null) {
                if (CollectionUtils.isEmpty(testObjectModelMap.get(model.getStructureTestObjectId()))) {
                    List<BasicTreeDto> basicTreeDtoList = new ArrayList<>();
                    basicTreeDtoList.add(basicTreeDto);
                    testObjectModelMap.put(model.getStructureTestObjectId(),basicTreeDtoList);
                }else {
                    testObjectModelMap.put(model.getStructureTestObjectId(), basicTreeDtoList);
                } else {
                    testObjectModelMap.get(model.getStructureTestObjectId()).add(basicTreeDto);
                }
            }
@@ -296,8 +296,8 @@
        // 对检测对象先按照实验室在按照检查对象类别分类
        List<BasicTreeDto> testProjectBasicTreeList = structureTestObjectList.stream().map(structureTestObject -> {
            BasicTreeDto basicTreeDto = new BasicTreeDto();
            basicTreeDto.setValue(structureTestObject.getSpecimenName());
            basicTreeDto.setLabel(structureTestObject.getSpecimenName());
            basicTreeDto.setValue(structureTestObject.getSpecimenName() + "(" + structureTestObject.getObjectType() + ")");
            basicTreeDto.setLabel(structureTestObject.getSpecimenName() + "(" + structureTestObject.getObjectType() + ")");
            basicTreeDto.setLevel(BasicTreeEnums.STRUCTURE_TEST_OBJECT_TYPE.getCode());
            List<BasicTreeDto> children = new ArrayList<>();
            if (!CollectionUtils.isEmpty(productMap.get(structureTestObject.getId()))) {
@@ -339,6 +339,7 @@
    /**
     * 河口检测中心导入
     *
     * @param file
     */
    @Override
@@ -618,37 +619,38 @@
    /**
     * 修改标准数
     *
     * @param modelAddDto
     * @return
     */
    @Override
    public int updateStandardTree(ModelAddDto modelAddDto) {
        if(modelAddDto.getId() == null){
        if (modelAddDto.getId() == null) {
            throw new RuntimeException("缺少型号主键");
        }
        Model model = modelMapper.selectById(modelAddDto.getId());
        if(ObjectUtils.isEmpty(model)){
        if (ObjectUtils.isEmpty(model)) {
            throw new RuntimeException("型号查找失败");
        }
        QueryWrapper<Model> modelQueryWrapper = new QueryWrapper<>();
        if(model.getStructureTestObjectId() != null){
        if (model.getStructureTestObjectId() != null) {
            modelQueryWrapper.eq("structure_test_object_id", model.getStructureTestObjectId());
        }
        if(model.getProductId() != null){
        if (model.getProductId() != null) {
            modelQueryWrapper.eq("product_id", model.getProductId());
        }
        modelQueryWrapper.eq("model_name", modelAddDto.getModelName());
        model.setModelName(modelAddDto.getModelName());
        List<Model> modelList = modelMapper.selectList(modelQueryWrapper);
        if(CollectionUtils.isEmpty(modelList)){
        if (CollectionUtils.isEmpty(modelList)) {
            return modelMapper.updateById(model);
        }else if (modelList.size() == 1) {
            if( !model.getId().equals(modelList.get(0).getId())){
        } else if (modelList.size() == 1) {
            if (!model.getId().equals(modelList.get(0).getId())) {
                throw new RuntimeException("型号名称重复");
            }else {
            } else {
                return modelMapper.updateById(model);
            }
        }else {
        } else {
            throw new RuntimeException("型号名称重复");
        }
    }
basic-server/src/main/resources/mapper/StructureItemParameterMapper.xml
@@ -145,28 +145,46 @@
        <result property="name" column="subclass"/>
    </resultMap>
    <select id="getInsProduction" resultMap="getInsProductions">
        select distinct id,
                        CASE
                            WHEN INSTR(sample, ',') > 0 THEN
                                SUBSTRING_INDEX(SUBSTRING_INDEX(sample, '","', 1), '"', -1)
                            when sample = '[""]' then '*'
                            ELSE
                                TRIM(BOTH '["]' FROM SUBSTRING_INDEX(REPLACE(sample, '[["', ''), '"]]', 1))
                            END
                                                              as sample,
                        inspection_item,
                        case
                            when inspection_item_subclass is null or inspection_item_subclass = '' then inspection_item
                            else inspection_item_subclass end as subclass,
                        case
                            when inspection_item_class is null or inspection_item_class = '' then inspection_item
                            else inspection_item_class end as item_class
        from structure_item_parameter
        SELECT DISTINCT
            id,
            CASE
                WHEN INSTR(sample, ',') > 0 THEN
                    TRIM(BOTH '"' FROM SUBSTRING_INDEX(SUBSTRING_INDEX(sample, '","', - 1), '"]]', 1))
                WHEN sample = '[""]' THEN
                    '*'
                ELSE
                    TRIM(BOTH '["]' FROM SUBSTRING_INDEX(REPLACE(sample, '[["', ''), '"]]', 1))
                END AS sample,
            inspection_item,
            CASE
                WHEN inspection_item_subclass IS NULL
                    OR TRIM(inspection_item_subclass) = '' THEN
                    inspection_item
                ELSE
                    inspection_item_subclass
                END AS subclass,
            CASE
                WHEN inspection_item_class IS NULL
                    OR TRIM(inspection_item_class) = '' THEN
                    inspection_item
                ELSE
                    inspection_item_class
                END AS item_class
        FROM
            structure_item_parameter;
    </select>
    <select id="getItemTree" resultMap="itemDto">
        select sto.id sId, sto.specimen_name sName, p.id pId, p.name pName
        from structure_test_object sto
                 left join product p on p.object_id = sto.id
        SELECT
            sto.id AS sId,
            CONCAT(sto.specimen_name, ' (', sto.object_type, ')') AS sName,
            p.id AS pId,
            p.name AS pName,
            sto.object_type
        FROM
            structure_test_object sto
                LEFT JOIN
            product p
            ON p.object_id = sto.id;
    </select>
    <resultMap id="itemDto" type="com.ruoyi.basic.dto.TestItemDto">
ruoyi-admin/src/main/resources/application-test.yml
@@ -143,16 +143,16 @@
# 人事系统
personnel:
  # 正式地址
  code:
  code: https://ztt-sso.ztt.cn/oauth2/token
  # 装备人事正式库
  appId:
  appSecret:
  companies:
  simple:
  appId: f6f3d70f-3666-4d3d-b9c5-430de3f6007c
  appSecret: a18923496542302066b0a7bec993a4e2
  companies: https://ztt-connector.ztt.cn/api/org/v1/companies
  simple: https://ztt-connector.ztt.cn/api/org/v1/employees/simple?companyId=
  # 人员密码获取
  password:
  department:
  person:
  password: https://ztt-connector.ztt.cn/api/org/v1/employees/original_pwd/
  department: https://ztt-connector.ztt.cn/api/org/v1/companies/companyId/departments
  person: https://ztt-connector.ztt.cn/api/org/v1/employees/simple/
ifs:
  contract:
ruoyi-system/src/main/resources/mapper/system/UserMapper.xml
@@ -24,8 +24,7 @@
        company,
        is_custom
        from user
        where del_flag = '0'
        and id != ) a
        where del_flag = '0') a
        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
            ${ew.customSqlSegment}
        </if>