田源
2024-04-16 e1feed4fb9f3a7722eb0cd646e73e6573bdfb6e1
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java
@@ -165,6 +165,9 @@
   @Autowired
   private ICodeKeyAttrRepeatService keyRuleService;
   /**
    * 近义词规则查询服务
    */
   @Autowired ICodeSynonymService codeSynonymService;
   /**
@@ -202,8 +205,6 @@
    */
   @Autowired
   private SaveLogUtil saveLogUtil;
   /**
    * 客户现场excel为老版本,导出的总数限制为65535
@@ -941,12 +942,12 @@
         Set<String> keyAttrRepeatRowIndexList = keyResultVO.getKeyAttrRepeatRowIndexList();
         if(!CollectionUtils.isEmpty(selfRepeatRowIndexList)){
            selfRepeatRowIndexList.stream().forEach(rowIndex->{
               errorMap.put(rowIndex,errorMap.getOrDefault(rowIndex,"") + ";在当前处理的数据文件中关键属性重复" );
               errorMap.put(rowIndex, errorMap.getOrDefault(rowIndex, "") + String.format(";在当前处理的数据文件中关键属性重复[%s],[%s];",keyResultVO.getKeyAttrRuleInfo(),keyResultVO.getSynonymRuleInfo()));
            });
         }
         if(!CollectionUtils.isEmpty(keyAttrRepeatRowIndexList)){
            keyAttrRepeatRowIndexList.stream().forEach(rowIndex->{
               errorMap.put(rowIndex, "关键属性与系统中的重复;" + errorMap.getOrDefault(rowIndex,"") );
               errorMap.put(rowIndex, errorMap.getOrDefault(rowIndex, "") + String.format("关键属性与系统中的重复[%s],[%s];",keyResultVO.getKeyAttrRuleInfo(),keyResultVO.getSynonymRuleInfo()));
            });
         }
         //分类注入
@@ -1213,12 +1214,12 @@
            Set<String> keyAttrRepeatRowIndexList = keyResultVO.getKeyAttrRepeatRowIndexList();
            if (!CollectionUtils.isEmpty(selfRepeatRowIndexList)) {
               selfRepeatRowIndexList.stream().forEach(rowIndex -> {
                  errorMap.put(rowIndex, errorMap.getOrDefault(rowIndex, "") + ";在当前excel文件中关键属性重复");
                  errorMap.put(rowIndex, errorMap.getOrDefault(rowIndex, "") + String.format(";在当前excel文件中关键属性重复[%s],[%s];",keyResultVO.getKeyAttrRuleInfo(),keyResultVO.getSynonymRuleInfo()));
               });
            }
            if (!CollectionUtils.isEmpty(keyAttrRepeatRowIndexList)) {
               keyAttrRepeatRowIndexList.stream().forEach(rowIndex -> {
                  errorMap.put(rowIndex, "关键属性与系统中的重复;" + errorMap.getOrDefault(rowIndex, ""));
                  errorMap.put(rowIndex, errorMap.getOrDefault(rowIndex, "") + String.format("关键属性与系统中的重复[%s],[%s];",keyResultVO.getKeyAttrRuleInfo(),keyResultVO.getSynonymRuleInfo()));
               });
            }
            //4.校验规则
@@ -1730,12 +1731,12 @@
         Set<String> keyAttrRepeatRowIndexList = keyResultVO.getKeyAttrRepeatRowIndexList();
         if(!CollectionUtils.isEmpty(selfRepeatRowIndexList)){
            selfRepeatRowIndexList.stream().forEach(rowIndex->{
               errorMap.put(rowIndex,errorMap.getOrDefault(rowIndex,"") + ";在当前处理的数据文件中关键属性重复" );
               errorMap.put(rowIndex, errorMap.getOrDefault(rowIndex, "") + String.format(";在当前处理的数据文件中关键属性重复[%s],[%s];",keyResultVO.getKeyAttrRuleInfo(),keyResultVO.getSynonymRuleInfo()));
            });
         }
         if(!CollectionUtils.isEmpty(keyAttrRepeatRowIndexList)){
            keyAttrRepeatRowIndexList.stream().forEach(rowIndex->{
               errorMap.put(rowIndex,"关键属性与系统中的重复;" + errorMap.getOrDefault(rowIndex,""));
               errorMap.put(rowIndex, errorMap.getOrDefault(rowIndex, "") + String.format("关键属性与系统中的重复[%s],[%s];",keyResultVO.getKeyAttrRuleInfo(),keyResultVO.getSynonymRuleInfo()));
            });
         }
         //分类注入
@@ -2229,7 +2230,7 @@
         Set<String> keyAttrRepeatRowIndexList = keyResultVO.getKeyAttrRepeatRowIndexList();
         if(!CollectionUtils.isEmpty(keyAttrRepeatRowIndexList)){
            keyAttrRepeatRowIndexList.stream().forEach(rowIndex->{
               errorMap.put(rowIndex,"关键属性与系统中的重复;" + errorMap.getOrDefault(rowIndex,""));
               errorMap.put(rowIndex, errorMap.getOrDefault(rowIndex, "") + String.format("关键属性与系统中的重复[%s],[%s];",keyResultVO.getKeyAttrRuleInfo(),keyResultVO.getSynonymRuleInfo()));
            });
         }
         //4.校验规则
@@ -2453,7 +2454,7 @@
                resultDataObjectDetailDO.setMsg(errorMap.getOrDefault(rowIndex,"") + ";关键属性重复");
                resultDataObjectDetailDOs.add(resultDataObjectDetailDO);
                */
            errorKeyMap.put(rowIndex,errorMap.getOrDefault(rowIndex,"") + ";传入的数据中关键属性重复");
            errorKeyMap.put(rowIndex, errorKeyMap.getOrDefault(rowIndex, "") + String.format(";传入的数据中关键属性重复[%s],[%s];",keyResultVO.getKeyAttrRuleInfo(),keyResultVO.getSynonymRuleInfo()));
         });
      }
      /****
@@ -2474,7 +2475,7 @@
            if(indexTODataMap.containsKey(rowIndex)){
               List<BaseModel> baseModelList= indexTODataMap.get(rowIndex);
            }
            errorKeyMap.put(rowIndex, "关键属性与系统中的重复;" + errorKeyMap.getOrDefault(rowIndex,""));
            errorKeyMap.put(rowIndex, errorKeyMap.getOrDefault(rowIndex, "") + String.format("关键属性与系统中的重复[%s],[%s];",keyResultVO.getKeyAttrRuleInfo(),keyResultVO.getSynonymRuleInfo()));
         });
      }
      //校验属性是否正确错误信息
@@ -2825,9 +2826,9 @@
      List<CodeAllCode> codeAllCodeList = new ArrayList<>();
      List<String> deleteList = new ArrayList<>();
      CodeClassifyTemplateVO firstTemplateVO = templateService.getObjectHasAttrByOid(orderDTOMap.values().stream().findFirst().get().getTemplateOid());
      // CodeClassifyTemplateVO firstTemplateVO = templateService.getObjectHasAttrByOid(orderDTOMap.values().stream().findFirst().get().getTemplateOid());
      Map<String, ClientBusinessObject> cboMap = cboList.stream().filter(cbo -> cbo != null).collect(Collectors.toList()).stream().collect(Collectors.toMap(s -> s.getId(), t -> t));
      //  boolean finalIsProcess = isProcess;
      // boolean finalIsProcess = isProcess;
      orderDTOMap.keySet().stream().forEach(code -> {
         CodeOrderDTO orderDTO = orderDTOMap.get(code);
         ClientBusinessObject cbo = cboMap.get(code);
@@ -2980,9 +2981,6 @@
            //是否调用集团接口申请接口
            if(isCodeOrGroupCode){
               List<String> IdList=resultDataObjectDetailDOs.stream().filter(xMLResultDataObjectDetailDO-> com.alibaba.cloud.commons.lang.StringUtils.isNotBlank(xMLResultDataObjectDetailDO.getId())).map(XMLResultDataObjectDetailDO::getId).distinct().collect(Collectors.toList());
               if(!CollectionUtils.isEmpty(IdList)) {
                  this.sendApplyGroupcode(IdList, classifyFullInfo.getTopClassifyVO().getBtmTypeId(),sysIntegrationPushTypeEnum.ACCPET_EDITCODE.getValue());
               }
@@ -3095,18 +3093,27 @@
      //注意的是keyRuleVO可能为空,表示不使用规则控制
      //获取所有的关键属性
      Map<String, CodeClassifyTemplateAttrVO> ketAttrMap = templateVO.getAttributes().stream().filter(s -> VciBaseUtil.getBoolean(s.getKeyAttrFlag())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
      // TODO:2024-02-01 先获取配置了近义词查询规则的属性,不同于关键属性,设置了近义词查询规则的属性可能是多条不同的近义词查询规则
      Map<String, CodeClassifyTemplateAttrVO> sysonymAttrMaps = templateVO.getAttributes().stream().filter(item -> Func.isNotBlank(item.getSysonymRuleOids())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
      // 获取是否有配置近义词查询规则属性
      Map<String, List<CodeSynonym>> codeSynonymMaps = new HashMap<>();
      if(!sysonymAttrMaps.isEmpty()){
         // 查询近义词规则,存储方式key:属性id,value近义词查询规则列表
         codeSynonymMaps = codeSynonymService.getCodeSynonymByOids(sysonymAttrMaps);
      }
      Map<String, String> conditionMap = new HashMap<>();
      boolean trimAll = keyRuleVO == null ? false : VciBaseUtil.getBoolean(keyRuleVO.getIgnoreallspaceflag());
      //全部去空的优先级大于去空
      boolean trim = keyRuleVO == null ? false : VciBaseUtil.getBoolean(keyRuleVO.getIgnorespaceflag());
      boolean ignoreCase = keyRuleVO == null ? false : VciBaseUtil.getBoolean(keyRuleVO.getIgnorecaseflag());
      boolean ignoreWidth = keyRuleVO == null ? false : VciBaseUtil.getBoolean(keyRuleVO.getIgnorewidthflag());
      Map<String, List<CodeSynonym>> finalCodeSynonymMaps = codeSynonymMaps;
      ketAttrMap.forEach((attrId, attrVO) -> {
         String value = getValueFromOrderDTO(orderDTO, attrId);
         if (value == null) {
            value = "";
         }
         engineService.wrapperKeyAttrConditionMap(value, keyRuleVO, attrId, trim, ignoreCase, ignoreWidth, trimAll, conditionMap);
         engineService.wrapperKeyAttrConditionMap(value, keyRuleVO, finalCodeSynonymMaps.get(attrId), attrId, trim, ignoreCase, ignoreWidth, trimAll, conditionMap);
      });
      //没有限制分类,但是一个模板只可能在一个业务类型里面,所以直接查询这个业务类型即可
@@ -4381,6 +4388,7 @@
         });
      }
   }
   /**
    * 校验关键属性,和近义词查询规则
    * @param classifyFullInfo 分类的全部信息
@@ -4398,7 +4406,7 @@
      // TODO:2024-02-01 先获取配置了近义词查询规则的属性,不同于关键属性,设置了近义词查询规则的属性可能是多条不同的近义词查询规则
      Map<String, CodeClassifyTemplateAttrVO> sysonymAttrMaps = templateVO.getAttributes().stream().filter(item -> Func.isNotBlank(item.getSysonymRuleOids())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
      // 有配置近义词查询规则属性
      // 获取是否有配置近义词查询规则属性
      Map<String, List<CodeSynonym>> codeSynonymMaps = new HashMap<>();
      if(!sysonymAttrMaps.isEmpty()){
         // 查询近义词规则,存储方式key:属性id,value近义词查询规则列表
@@ -4413,12 +4421,19 @@
      //1. 我们需要先判断excel导入的内容是否正确
      CodeImportResultVO resultVO = new CodeImportResultVO();
      resultVO.setKeyAttrRuleInfo(String.format(keyRuleVO ==null?"":"查询规则:去除空格--{0},忽略大小写--{1},忽略全半角--{2},忽略全部空格--{3}",
         new String[]{trim?"是":"否",ignoreCase?"是":"否",ignoreWidth?"是":"否",trimAll?"是":"否"}));
      StringBuilder synonymResString = new StringBuilder();
      if(Func.isNotEmpty(codeSynonymMaps)){
         codeSynonymMaps.keySet().stream().forEach(item->{
            synonymResString.append(item);
            synonymResString.append(",");
         });
      }
      resultVO.setSynonymRuleInfo(Func.isEmpty(codeSynonymMaps) ? "":String.format("以下[%s]被设置了近义词查询规则的关键属性,中出现了重复:",synonymResString));
      resultVO.setKeyAttrRuleInfo(keyRuleVO == null ? "":String.format("查询规则:去除空格--{%s},忽略大小写--{%s},忽略全半角--{%s},忽略全部空格--{%s}"
         ,trim?"是":"否",ignoreCase?"是":"否",ignoreWidth?"是":"否",trimAll?"是":"否"));
      //resultVO.setSelfRepeatRowIndexList(getSelfRepeatRowIndex(keyAttrMap,cboList,keyRuleVO));
      // 先在表格中查询关键属性重复的列
      getSelfRepeatRowIndex(keyAttrMap,cboList,keyRuleVO,resultVO);
      // 先在表格中查询关键属性和近义词转换后重复的列
      getSelfRepeatRowIndex(keyAttrMap,cboList,keyRuleVO,codeSynonymMaps,resultVO);
      // 再在表格中查询近义词查询规则的列
      //getSelfRepeatSysnomRowIndex(sysonymAttrMaps,cboList,codeSynonymMaps,resultVO);
@@ -4435,6 +4450,7 @@
      //  ,所以暂时将parallelStream改成了stream,改成了stream之后发现巨慢
      // customForkJoinPool控制并发度
      List<ClientBusinessObject> finalCboList = cboList;
      Map<String, List<CodeSynonym>> finalCodeSynonymMaps = codeSynonymMaps;
      List<ClientBusinessObject> repeatDataMap = (List<ClientBusinessObject>) customForkJoinPool.submit(()->{
         finalCboList.parallelStream().filter(cbo -> {
            //每行都得查询.如果其中出现了错误,我们就直接抛出异常,其余的显示
@@ -4447,9 +4463,7 @@
               }
               value= value.replace(REQUIRED_CHAR,SPECIAL_CHAR);
               // 关键属性查询条件map获取
               engineService.wrapperKeyAttrConditionMap(value, keyRuleVO, attrId, trim, ignoreCase, ignoreWidth, trimAll, conditionMap);
               // 近义词查询规则条件map获取
               //engineService.wrapperSynonymAttrConditionMap(value);
               engineService.wrapperKeyAttrConditionMap(value, keyRuleVO, finalCodeSynonymMaps.get(attrId), attrId, trim, ignoreCase, ignoreWidth, trimAll, conditionMap);
            });
            if (!CollectionUtils.isEmpty(keyAttrMap)) {
@@ -4603,16 +4617,16 @@
   }
   /**
    * 获取导入的内容中关键属性重复的行号
    * 获取导入的内容中关键属性近义词转换后重复的行号
    * @param ketAttrMap 关键属性的映射
    * @param dataList 导入的数据
    * @param keyRuleVO 关键属性控制规则
    * @return 重复的行号
    */
   private void getSelfRepeatRowIndex(Map<String/**属性的编号**/, CodeClassifyTemplateAttrVO> ketAttrMap,
                              List<ClientBusinessObject> dataList,CodeKeyAttrRepeatVO keyRuleVO,CodeImportResultVO resultVO){
                              List<ClientBusinessObject> dataList,CodeKeyAttrRepeatVO keyRuleVO,/*近义词查询规则*/Map<String,List<CodeSynonym>> codeSynonymMaps, CodeImportResultVO resultVO){
      Set<String> selfRepeatRowIndexList = new CopyOnWriteArraySet<>();
      Map<String,List<String>> keyAttrOkOidTORepeatOidMap=new HashMap<>();
      Map<String,List<String>> keyAttrOkOidTORepeatOidMap=new ConcurrentHashMap<>();
      boolean trimAll =keyRuleVO ==null?false: VciBaseUtil.getBoolean(keyRuleVO.getIgnoreallspaceflag());
      //全部去空的优先级大于去空
      boolean trim =keyRuleVO ==null?false:  VciBaseUtil.getBoolean(keyRuleVO.getIgnorespaceflag());
@@ -4620,17 +4634,16 @@
      boolean ignoreWidth = keyRuleVO ==null?false: VciBaseUtil.getBoolean(keyRuleVO.getIgnorewidthflag());
      //必须将属性按照顺序排序好
      List<CodeClassifyTemplateAttrVO> attrVOList = ketAttrMap.values().stream().sorted(((o1, o2) -> o1.getOrderNum().compareTo(o2.getOrderNum()))).collect(Collectors.toList());
      Map<String/**行号**/,String/**关键属性的组合内容**/> rowIndexKeyStringMap = new HashMap<>();
      Map<String/**关键属性的组合内容**/,String/**第一个关键属性的数据oid**/> okOidKeyStringMap = new HashMap<>();
      dataList.parallelStream().forEach(cbo-> {
      Map<String/**行号**/,String/**关键属性的组合内容**/> rowIndexKeyStringMap = new ConcurrentHashMap<>();
      Map<String/**关键属性的组合内容**/,String/**第一个关键属性的数据oid**/> okOidKeyStringMap = new ConcurrentHashMap<>();
      dataList.stream().forEach(cbo-> {
         String rowIndex = cbo.getAttributeValue(IMPORT_ROW_INDEX);
         String oid=cbo.getOid();
         StringBuilder sb = new StringBuilder();
         // 关键属性重复校验值处理
         for (int i = 0; i < attrVOList.size(); i++) {
            CodeClassifyTemplateAttrVO attrVO = attrVOList.get(i);
            String attrId = attrVO.getId().toLowerCase(Locale.ROOT);
            String value = cbo.getAttributeValue( attrId);
         // TODO: 2024-02-25改造实现近义词查询规则功能;关键属性重复校验值处理
         attrVOList.stream().forEach(item->{
            String attrId = item.getId().toLowerCase(Locale.ROOT);
            String value = cbo.getAttributeValue(attrId);
            if (value == null) {
               value = "";
            }
@@ -4646,61 +4659,9 @@
            if(ignoreWidth){
               value = VciBaseUtil.toDBC(value);
            }
            value = mdmEngineService.getValueToSynony(codeSynonymMaps.get(attrId),value);
            sb.append(value).append("${ks}");
         }
         String keyString = sb.toString();
         if(rowIndexKeyStringMap.containsValue(keyString) && StringUtils.isNotBlank(keyString)){
            selfRepeatRowIndexList.add(rowIndex);
            String okOid=okOidKeyStringMap.getOrDefault(keyString,"");
            if(StringUtils.isNotBlank(okOid)){
               List<String>newOidList=new ArrayList<>();
               newOidList.add(oid);
               if(keyAttrOkOidTORepeatOidMap.containsKey(okOid)){
                  List<String> oldOidList = keyAttrOkOidTORepeatOidMap.get(okOid);
                  newOidList.addAll(oldOidList);
               }
               keyAttrOkOidTORepeatOidMap.put(okOid,newOidList);
            }
         }else {
            okOidKeyStringMap.put(sb.toString(),oid);
            rowIndexKeyStringMap.put(rowIndex, sb.toString());
         }
      });
      //因为只是关键属性重复,所以我们不能重复的多条选一条来报错
      resultVO.setKeyAttrRepeatRowIndexList(selfRepeatRowIndexList);
      resultVO.setKeyAttrOkOidTORepeatOidMap(keyAttrOkOidTORepeatOidMap);
   }
   /**
    * 获取近义词查询存在相同的行号
    * @param sysonymAttr
    * @param dataList
    * @param CodeSynonymMaps
    * @param resultVO
    */
   private void getSelfRepeatSysnomRowIndex(Map<String/**属性的编号**/, CodeClassifyTemplateAttrVO> sysonymAttr,
                                  List<ClientBusinessObject> dataList, Map<String, List<CodeSynonym>> CodeSynonymMaps,CodeImportResultVO resultVO) {
      Set<String> selfRepeatRowIndexList = new CopyOnWriteArraySet<>();
      Map<String,List<String>> keyAttrOkOidTORepeatOidMap=new HashMap<>();
      //必须将属性按照顺序排序好
      List<CodeClassifyTemplateAttrVO> attrVOList = sysonymAttr.values().stream().sorted(((o1, o2) -> o1.getOrderNum().compareTo(o2.getOrderNum()))).collect(Collectors.toList());
      Map<String/**行号**/,String/**关键属性的组合内容**/> rowIndexKeyStringMap = new HashMap<>();
      Map<String/**关键属性的组合内容**/,String/**第一个关键属性的数据oid**/> okOidKeyStringMap = new HashMap<>();
      dataList.parallelStream().forEach(cbo-> {
         String rowIndex = cbo.getAttributeValue(IMPORT_ROW_INDEX);
         String oid = cbo.getOid();
         StringBuilder sb = new StringBuilder();
         for (int i = 0; i < attrVOList.size(); i++) {
            CodeClassifyTemplateAttrVO attrVO = attrVOList.get(i);
            String attrId = attrVO.getId().toLowerCase(Locale.ROOT);
            String value = cbo.getAttributeValue(attrId);
            List<CodeSynonym> codeSynonyms = CodeSynonymMaps.get(attrId);
            // 对近义词查询值进行转换
            value = synonymConversion(codeSynonyms,value);
            // 如果codeSynonyms是多个就需要考虑组合问题
            sb.append(value).append("${sys}");
         }
         });
         String keyString = sb.toString();
         if(rowIndexKeyStringMap.containsValue(keyString) && StringUtils.isNotBlank(keyString)){
            selfRepeatRowIndexList.add(rowIndex);
@@ -4716,29 +4677,13 @@
            }
         }else {
            okOidKeyStringMap.put(sb.toString(),oid);
            rowIndexKeyStringMap.put(rowIndex, sb.toString());
            rowIndexKeyStringMap.put(rowIndex, keyString);
         }
      });
      //因为只是关键属性重复,所以我们不能重复的多条选一条来报错
      resultVO.setKeyAttrRepeatRowIndexList(selfRepeatRowIndexList);
//      resultVO.setKeyAttrRepeatRowIndexList(selfRepeatRowIndexList);
      resultVO.setSelfRepeatRowIndexList(selfRepeatRowIndexList);
      resultVO.setKeyAttrOkOidTORepeatOidMap(keyAttrOkOidTORepeatOidMap);
   }
   /**
    * 近义词与源值相互转换
    * @param codeSynonyms
    * @param value
    * @return
    */
   private String synonymConversion(List<CodeSynonym> codeSynonyms,String value){
      // 只有一条近义词查询规则时
      if(codeSynonyms.isEmpty() || codeSynonyms.size() == 1){
         return value.replace(codeSynonyms.get(0).getSourceValue(),codeSynonyms.get(0).getSynonymValue());
      }
      // 近义词规则可能出现的情况是一个源值对应多个近义词,而反查时同样会出现一个近义词对应多个源值
//      codeSynonyms.stream().map()
      return value;
   }
   /**
@@ -5170,6 +5115,7 @@
         bladeRedis.expire(uuid, BATCHADD_REDIS_TIME);//redis过期时间
      }
   }
   /**
    * 拷贝业务类型到map
    * @param cbo 业务数据
@@ -5258,7 +5204,7 @@
      Map<String, CodeClassifyTemplateAttrVO> attrVOMap = templateVO.getAttributes().stream().filter(s-> finalFieldList.contains(s.getId().toLowerCase(Locale.ROOT))).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
      List<WriteExcelData> excelDataList = new ArrayList<>();
      Workbook workbook = new HSSFWorkbook();
      List<CodeAndGroupCodeAttrMappingDTO>  codeAndGroupCodeAttrMappingDTOList=   execGroupCodePortDataDTO.getCodeAttrMapGroupAttrDTOS();
      List<CodeAndGroupCodeAttrMappingDTO> codeAndGroupCodeAttrMappingDTOList = execGroupCodePortDataDTO.getCodeAttrMapGroupAttrDTOS();
      Map<String, CodeAndGroupCodeAttrMappingDTO> jAttrVOMap = codeAndGroupCodeAttrMappingDTOList.stream().filter(s-> finalFieldList.contains(s.getTargetAttrKey().toLowerCase(Locale.ROOT))).collect(Collectors.toMap(s -> s.getTargetAttrKey().toLowerCase(Locale.ROOT), t -> t));
      WriteExcelData codeExcelData = new WriteExcelData(0, 0, "企业编码");
      WriteExcelData groupExcelData = new WriteExcelData(0, 1, "集团码");
@@ -5337,8 +5283,8 @@
    * @param file
    * @return
    */
   @Transactional(rollbackFor = VciBaseException.class)
   @Override
   @Transactional(rollbackFor = Exception.class)
   public String importGroupCode(String codeClassifyOid, File file) throws Throwable {
      VciBaseUtil.alertNotNull(codeClassifyOid,"分类的主键");
      ReadExcelOption reo = new ReadExcelOption();
@@ -5411,12 +5357,14 @@
      Set<String> keyAttrRepeatRowIndexList = keyResultVO.getKeyAttrRepeatRowIndexList();
      if (!CollectionUtils.isEmpty(selfRepeatRowIndexList)) {
         selfRepeatRowIndexList.stream().forEach(rowIndex -> {
            errorMap.put(rowIndex, errorMap.getOrDefault(rowIndex, "") + ";在当前excel文件中关键属性重复");
            errorMap.put(rowIndex, errorMap.getOrDefault(rowIndex, "") + String.format(";传入的数据中关键属性重复[%s],[%s];",keyResultVO.getKeyAttrRuleInfo(),keyResultVO.getSynonymRuleInfo()));
            // errorMap.put(rowIndex, errorMap.getOrDefault(rowIndex, "") + ";在当前excel文件中关键属性重复");
         });
      }
      if (!CollectionUtils.isEmpty(keyAttrRepeatRowIndexList)) {
         keyAttrRepeatRowIndexList.stream().forEach(rowIndex -> {
            errorMap.put(rowIndex, "关键属性与系统中的重复;" + errorMap.getOrDefault(rowIndex, ""));
            errorMap.put(rowIndex, errorMap.getOrDefault(rowIndex, "") + String.format("关键属性与系统中的重复[%s],[%s];",keyResultVO.getKeyAttrRuleInfo(),keyResultVO.getSynonymRuleInfo()));
            // errorMap.put(rowIndex, "关键属性与系统中的重复;" + errorMap.getOrDefault(rowIndex, ""));
         });
      }
      Map<String,List<WriteExcelData>> shetNameMap=new HashMap<>();
@@ -5462,6 +5410,7 @@
      }
      return excelFileName;
   }
   public void batchSwitchCheckExist(Map<String,String> errorMap,List<ClientBusinessObject> cboList,CodeClassifyFullInfoBO classifyFullInfo,CodeClassifyTemplateVO templateVO,ExecGroupCodePortDataDTO execGroupCodePortDataDTO,Map<Integer/**列号**/,String/**字段的名称**/> fieldIndexMap){
      List<BaseModel> oldBaseModelList=new ArrayList<>();
      List<CodeAllCode> codeAllCodeList=new ArrayList<>();
@@ -5581,6 +5530,7 @@
      execGroupCodePortDataDTO.setOldList(oldBaseModelList);
      execGroupCodePortDataDTO.setCodeAllCodeList(codeAllCodeList);
   }
   /**
    *
    * @param fieldIndexMap
@@ -5609,6 +5559,7 @@
         cboList.add(cbo);
      });
   }
   /***
    * 集团导出模板属性映射信息获取
    * @param templateVO
@@ -5625,7 +5576,8 @@
         LinkedList<String> colNameList=new LinkedList<>();
         dockingPreAttrMappingVOList.stream().forEach(dockingPreAttrMappingVO -> {
            CodeAndGroupCodeAttrMappingDTO codeAndGroupCodeAttrMappingDTO=new CodeAndGroupCodeAttrMappingDTO();
            if(StringUtils.isNotBlank(dockingPreAttrMappingVO.getTargetAttrId())){
            // TODO:2024/4/16改成用key值判断
            if(StringUtils.isNotBlank(dockingPreAttrMappingVO.getTargetAttrKey())){
               codeAndGroupCodeAttrMappingDTO.setDefaultValue(dockingPreAttrMappingVO.getDefaultValue());
               codeAndGroupCodeAttrMappingDTO.setMetaListId(dockingPreAttrMappingVO.getMetaListId());
               codeAndGroupCodeAttrMappingDTO.setSourceAttrKey(dockingPreAttrMappingVO.getSourceAttrKey());
@@ -5672,6 +5624,7 @@
   }
   /***
    * 查询未有集团码的数据
    * @param classifyFullInfo