ludc
2024-05-17 ac4e090952cfa701d7d681ada7d7900e3ce45755
集成申请,历史数据导入,关键属性查重多线程导致判重失误问题
已修改4个文件
27 ■■■■■ 文件已修改
Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/util/DefaultAttrAssimtUtil.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmProductCodeServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/UniversalInterfaceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/util/DefaultAttrAssimtUtil.java
@@ -87,20 +87,19 @@
            baseModel.setFirstV("1");
            baseModel.setLastR("1");
            baseModel.setLastV("1");
            baseModel.setRevisionSeq(1);
            // TODO:目前只有编码规则中有用到,后期需要去掉这段代码的话,就把他加在编码规则新增中去
            if(Func.isBlank(baseModel.getOwner())){
                // 设置所有者
                baseModel.setOwner(Func.isNotEmpty(user) ? user.getUserId().toString():AuthUtil.getUserId().toString());
            }
            baseModel.setVersionSeq(1);
            baseModel.setVersionRule("0");
            baseModel.setVersionValue("1");
            baseModel.setRevisionOid(VciBaseUtil.getPk());
            baseModel.setLastModifier(account);
            baseModel.setVersionRule("0");
            baseModel.setRevisionSeq(1);
            baseModel.setRevisionValue("1");
            baseModel.setRevisionRule("1");
            baseModel.setRevisionOid(VciBaseUtil.getPk());
            baseModel.setLastModifier(account);
            baseModel.setTenantId(Func.isNotEmpty(user) ? user.getTenantId():AuthUtil.getTenantId());
        }catch (VciBaseException e){
            e.printStackTrace();
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java
@@ -2424,7 +2424,7 @@
        //都转换完了。需要批量检查
        //如果出错了,我们依然执行有效的数据,无效的数据写回到excel中
        Map<String, String> errorKeyMap = new HashMap<>();
        Map<String, String> errorKeyMap = new ConcurrentHashMap<>();
        //1.分类注入
        batchSwitchClassifyAttrOnOrder(attrVOS, cboList, classifyFullInfo, false);
        //boolean
@@ -2447,6 +2447,7 @@
        batchSwitchComponentAttrOnOrder(attrVOS, cboList);
        //3.判断关键属性
        CodeImportResultVO keyResultVO = batchCheckKeyAttrOnOrder(classifyFullInfo, templateVO, cboList, false, errorKeyMap);
        log.info("================查重后的errorKeyMap错误信息================="+JSON.toJSONString(errorKeyMap));
        Set<String> selfRepeatRowIndexList = keyResultVO.getSelfRepeatRowIndexList();
        Set<String> keyAttrRepeatRowIndexList = keyResultVO.getKeyAttrRepeatRowIndexList();
@@ -2688,7 +2689,6 @@
            }
        }
    }
    /***
@@ -4423,9 +4423,11 @@
     * @param classifyFullInfo 分类的全部信息
     * @param templateVO       模板的内容,必须包含模板属性
     * @param cboList          批量的数据
     */
     * @param isEdit          是否是修改
     * @param errorMap          必须必须必须是线程安全的集合
     * */
    private CodeImportResultVO batchCheckKeyAttrOnOrder(CodeClassifyFullInfoBO classifyFullInfo, CodeClassifyTemplateVO templateVO,
                                                        List<ClientBusinessObject> cboList, boolean isEdit, Map<String, String> errorMap) {
                                                        List<ClientBusinessObject> cboList, boolean isEdit, Map<String, String> errorMap/*必须要是线程安全的集合*/) {
        //与MdmEngineServiceImpl里的checkKeyAttrOnOrder相似
        //先获取关键属性的规则,也利用继承的方式
        CodeKeyAttrRepeatVO keyRuleVO = keyRuleService.getRuleByClassifyFullInfo(classifyFullInfo);
@@ -4478,7 +4480,7 @@
        // TODO:Thread limit exceeded replacing blocked 异常是这部分代码抛出的
        //  ,所以暂时将parallelStream改成了stream,改成了stream之后发现巨慢
        // customForkJoinPool控制并发度
        List<ClientBusinessObject> finalCboList = cboList;
        final List<ClientBusinessObject> finalCboList = cboList;
        Map<String, List<CodeSynonym>> finalCodeSynonymMaps = codeSynonymMaps;
        List<ClientBusinessObject> repeatDataMap = (List<ClientBusinessObject>) customForkJoinPool.submit(() -> {
            finalCboList.parallelStream().filter(cbo -> {
@@ -4522,6 +4524,7 @@
                        });
                        // 添加错误值
                        String rowIndex = cbo.getAttributeValue(IMPORT_ROW_INDEX);
                        log.info("=============关键属性查询重复的============="+JSON.toJSONString(repeatData));
                        errorMap.put(rowIndex, "重复的记录编号为:" + repeatData.stream().collect(Collectors.joining(",")));
                        if (!CollectionUtils.isEmpty(newCboList)) {
                            indexTODataMap.put(cbo.getAttributeValue(IMPORT_ROW_INDEX), newCboList);
@@ -5365,7 +5368,7 @@
        List<String> codeList = cboList.stream().map(ClientBusinessObject::getId).collect(Collectors.toList());
        List<Map<String, String>> dataList = new ArrayList<>();
        Map<String, String> errorMap = new HashMap<>();
        Map<String, String> errorMap = new ConcurrentHashMap<>();
        batchSwitchCheckExist(errorMap, cboList, classifyFullInfo, templateVO, execGroupCodePortDataDTO, fieldIndexMap);
        //判断必输项
        batchCheckRequiredAttrOnOrder(templateVO, cboList, errorMap);
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmProductCodeServiceImpl.java
@@ -1,5 +1,6 @@
package com.vci.ubcs.code.service.impl;
import com.alibaba.fastjson.JSON;
import com.vci.ubcs.code.algorithm.CustomSerialEnum;
import com.vci.ubcs.code.annotation.MdmSerialAlgorithm;
import com.vci.ubcs.code.annotation.MdmSerialAlgorithmMethod;
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/UniversalInterfaceImpl.java
@@ -293,7 +293,7 @@
                passwordFreeLoginService.pwdFreeLoginByBoolean(systemId.toLowerCase(Locale.ROOT), this.getRequest());
            }catch (Throwable e){
                errorid[0] ="1";
                throw new Throwable("用户鉴权失败.");
                throw new Throwable("用户鉴权失败,原因:"+e.getMessage());
            }
            List<ClassfyVO> classVOList = classfysVO.getClassify();
            //InterParameterVO finalInterParameterVO = interParameterVO;