From e1feed4fb9f3a7722eb0cd646e73e6573bdfb6e1 Mon Sep 17 00:00:00 2001 From: 田源 <lastanimals@163.com> Date: 星期二, 16 四月 2024 20:56:05 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java | 147 ++++++++++++++++++++++++++++++++---------------- 1 files changed, 98 insertions(+), 49 deletions(-) diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java index 0e551e1..b371101 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java @@ -12,6 +12,7 @@ import com.vci.ubcs.code.bo.CodeTemplateAttrSqlBO; import com.vci.ubcs.code.dto.*; import com.vci.ubcs.code.entity.CodeAllCode; +import com.vci.ubcs.code.entity.CodeSynonym; import com.vci.ubcs.code.enumpack.*; import com.vci.ubcs.code.lifecycle.CodeAllCodeLC; import com.vci.ubcs.code.mapper.CommonsMapper; @@ -67,6 +68,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import javax.annotation.Resource; +import javax.xml.bind.ValidationEvent; import java.beans.BeanInfo; import java.beans.Introspector; import java.beans.PropertyDescriptor; @@ -96,7 +98,6 @@ @Service @Slf4j public class MdmIOServiceImpl implements MdmIOService { - /** * 瀛楁 @@ -165,30 +166,40 @@ private ICodeKeyAttrRepeatService keyRuleService; /** + * 杩戜箟璇嶈鍒欐煡璇㈡湇鍔� + */ + @Autowired ICodeSynonymService codeSynonymService; + + /** * 鍏紡鐨勬湇鍔� */ @Autowired private FormulaServiceImpl formulaService; + /** * 瑙勫垯鐨勬湇鍔� */ @Autowired private ICodeRuleService ruleService; + /** * 涓氬姟绫诲瀷鐨勬湇鍔� */ @Autowired private IBtmTypeClient btmTypeClient; + /*** * 鐢宠闆嗗洟缂栫爜鏈嶅姟 */ @Resource private IMdmInterJtClient mdmInterJtClient; + /*** * 瀵嗙骇鏈嶅姟 */ @Resource private IWebSecretClient secretService; + /** * 鏃ュ織淇濆瓨宸ュ叿绫� */ @@ -931,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())); }); } //鍒嗙被娉ㄥ叆 @@ -959,9 +970,7 @@ //鏈�鍚庡紕缁勫悎瑙勫垯 batchSwitchComponentAttrOnOrder(attrVOS,allCboList); - Map<String, ClientBusinessObject> rowIndexCboMap = allCboList.stream().filter(cbo -> cbo != null).collect(Collectors.toList()).stream().collect(Collectors.toMap(s -> s.getAttributeValue((IMPORT_ROW_INDEX)), t -> t)); - List<ClientBusinessObject> needSaveCboList = allCboList.stream().filter(cbo -> { String rowIndex = cbo.getAttributeValue(IMPORT_ROW_INDEX); @@ -1205,12 +1214,12 @@ Set<String> keyAttrRepeatRowIndexList = keyResultVO.getKeyAttrRepeatRowIndexList(); if (!CollectionUtils.isEmpty(selfRepeatRowIndexList)) { selfRepeatRowIndexList.stream().forEach(rowIndex -> { - errorMap.put(rowIndex, errorMap.getOrDefault(rowIndex, "") + ";鍦ㄥ綋鍓峞xcel鏂囦欢涓叧閿睘鎬ч噸澶�"); + errorMap.put(rowIndex, errorMap.getOrDefault(rowIndex, "") + String.format(";鍦ㄥ綋鍓峞xcel鏂囦欢涓叧閿睘鎬ч噸澶峓%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.鏍¢獙瑙勫垯 @@ -1722,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())); }); } //鍒嗙被娉ㄥ叆 @@ -2221,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.鏍¢獙瑙勫垯 @@ -2445,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())); }); } /**** @@ -2466,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())); }); } //鏍¢獙灞炴�ф槸鍚︽纭敊璇俊鎭� @@ -2817,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); @@ -2972,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()); } @@ -3087,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锛氬睘鎬d锛寁alue杩戜箟璇嶆煡璇㈣鍒欏垪琛� + 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); }); //娌℃湁闄愬埗鍒嗙被锛屼絾鏄竴涓ā鏉垮彧鍙兘鍦ㄤ竴涓笟鍔$被鍨嬮噷闈紝鎵�浠ョ洿鎺ユ煡璇㈣繖涓笟鍔$被鍨嬪嵆鍙� @@ -4373,8 +4388,9 @@ }); } } + /** - * 鏍¢獙鍏抽敭灞炴�� + * 鏍¢獙鍏抽敭灞炴�э紝鍜岃繎涔夎瘝鏌ヨ瑙勫垯 * @param classifyFullInfo 鍒嗙被鐨勫叏閮ㄤ俊鎭� * @param templateVO 妯℃澘鐨勫唴瀹癸紝蹇呴』鍖呭惈妯℃澘灞炴�� * @param cboList 鎵归噺鐨勬暟鎹� @@ -4386,7 +4402,16 @@ CodeKeyAttrRepeatVO keyRuleVO = keyRuleService.getRuleByClassifyFullInfo(classifyFullInfo); //娉ㄦ剰鐨勬槸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)); + Map<String/**灞炴�х殑缂栧彿**/, CodeClassifyTemplateAttrVO> keyAttrMap = 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锛氬睘鎬d锛寁alue杩戜箟璇嶆煡璇㈣鍒欏垪琛� + codeSynonymMaps = codeSynonymService.getCodeSynonymByOids(sysonymAttrMaps); + } boolean trimAll =keyRuleVO ==null?false: VciBaseUtil.getBoolean(keyRuleVO.getIgnoreallspaceflag()); //鍏ㄩ儴鍘荤┖鐨勪紭鍏堢骇澶т簬鍘荤┖ @@ -4396,17 +4421,27 @@ //1. 鎴戜滑闇�瑕佸厛鍒ゆ柇excel瀵煎叆鐨勫唴瀹规槸鍚︽纭� CodeImportResultVO resultVO = new CodeImportResultVO(); - resultVO.setKeyAttrRuleInfo(String.format(keyRuleVO ==null?"":"鏌ヨ瑙勫垯锛氬幓闄ょ┖鏍�--{0},蹇界暐澶у皬鍐�--{1},蹇界暐鍏ㄥ崐瑙�--{2},蹇界暐鍏ㄩ儴绌烘牸--{3}", - new String[]{trim?"鏄�":"鍚�",ignoreCase?"鏄�":"鍚�",ignoreWidth?"鏄�":"鍚�",trimAll?"鏄�":"鍚�"})); - //resultVO.setSelfRepeatRowIndexList(getSelfRepeatRowIndex(ketAttrMap,cboList,keyRuleVO)); - getSelfRepeatRowIndex(ketAttrMap,cboList,keyRuleVO,resultVO); + 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,codeSynonymMaps,resultVO); + // 鍐嶅湪琛ㄦ牸涓煡璇㈣繎涔夎瘝鏌ヨ瑙勫垯鐨勫垪 + //getSelfRepeatSysnomRowIndex(sysonymAttrMaps,cboList,codeSynonymMaps,resultVO); + if(!CollectionUtils.isEmpty(resultVO.getSelfRepeatRowIndexList())){ //鎴戜滑绉婚櫎鏈韩閲嶅鐨勬暟鎹� cboList = cboList.stream().filter(s->!resultVO.getSelfRepeatRowIndexList().contains(s.getAttributeValue(IMPORT_ROW_INDEX))).collect(Collectors.toList()); } //2.鍒ゆ柇鍏抽敭灞炴�у湪绯荤粺閲屾槸鍚﹂噸澶� - //鍥犱负鏁版嵁閲忓緢澶э紝鎵�浠ュ緱鎯冲姙娉曞苟琛� - //SessionInfo sessionInfo = VciBaseUtil.getCurrentUserSessionInfo(); Map<String,List<BaseModel>> indexTODataMap=new ConcurrentHashMap<>(); // 鏌ヨ涓嶉渶瑕佸弬涓庡叧閿睘鎬ф牎楠岀殑闄よ嚜宸变互澶栫殑鎵�鏈夊垎绫籵id final String isParticipateCheckOids = classifyService.selectLeafByParentClassifyOid(classifyFullInfo.getTopClassifyVO().getOid(), classifyFullInfo.getCurrentClassifyVO().getOid()); @@ -4415,25 +4450,29 @@ // ,鎵�浠ユ殏鏃跺皢parallelStream鏀规垚浜唖tream锛屾敼鎴愪簡stream涔嬪悗鍙戠幇宸ㄦ參 // customForkJoinPool鎺у埗骞跺彂搴� List<ClientBusinessObject> finalCboList = cboList; + Map<String, List<CodeSynonym>> finalCodeSynonymMaps = codeSynonymMaps; List<ClientBusinessObject> repeatDataMap = (List<ClientBusinessObject>) customForkJoinPool.submit(()->{ finalCboList.parallelStream().filter(cbo -> { //姣忚閮藉緱鏌ヨ.濡傛灉鍏朵腑鍑虹幇浜嗛敊璇紝鎴戜滑灏辩洿鎺ユ姏鍑哄紓甯革紝鍏朵綑鐨勬樉绀� //VciBaseUtil.setCurrentUserSessionInfo(sessionInfo); Map<String, String> conditionMap = new HashMap<>(); - ketAttrMap.forEach((attrId, attrVO) -> { + keyAttrMap.forEach((attrId, attrVO) -> { String value =cbo.getAttributeValue(attrId.toLowerCase(Locale.ROOT)); if (value == null) { value = ""; } value= value.replace(REQUIRED_CHAR,SPECIAL_CHAR); - engineService.wrapperKeyAttrConditionMap(value, keyRuleVO, attrId, trim, ignoreCase, ignoreWidth, trimAll, conditionMap); + // 鍏抽敭灞炴�ф煡璇㈡潯浠秏ap鑾峰彇 + engineService.wrapperKeyAttrConditionMap(value, keyRuleVO, finalCodeSynonymMaps.get(attrId), attrId, trim, ignoreCase, ignoreWidth, trimAll, conditionMap); }); - if (!CollectionUtils.isEmpty(ketAttrMap)) { + + if (!CollectionUtils.isEmpty(keyAttrMap)) { // 娣诲姞涓嶅弬涓庡叧閿睘鎬ф牎楠岀殑鍒嗙被oid鍒ゆ柇 if(Func.isNotBlank(isParticipateCheckOids)){ conditionMap.put("t.codeclsfid",QueryOptionConstant.NOTIN+isParticipateCheckOids); } - if(isEdit){//濡傛灉鏄洿鏀瑰垯闇�鎺掗櫎绯荤粺鏈韩 + //濡傛灉鏄洿鏀瑰垯闇�鎺掗櫎绯荤粺鏈韩 + if(isEdit){ conditionMap.put("t.id",QueryOptionConstant.NOTEQUAL+cbo.getId()); } conditionMap.put("t.lastr", "1"); @@ -4578,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()); @@ -4595,16 +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 = ""; } @@ -4620,8 +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); @@ -4632,17 +4672,17 @@ 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()); + rowIndexKeyStringMap.put(rowIndex, keyString); } }); //鍥犱负鍙槸鍏抽敭灞炴�ч噸澶嶏紝鎵�浠ユ垜浠笉鑳介噸澶嶇殑澶氭潯閫変竴鏉℃潵鎶ラ敊 - resultVO.setKeyAttrRepeatRowIndexList(selfRepeatRowIndexList); +// resultVO.setKeyAttrRepeatRowIndexList(selfRepeatRowIndexList); + resultVO.setSelfRepeatRowIndexList(selfRepeatRowIndexList); resultVO.setKeyAttrOkOidTORepeatOidMap(keyAttrOkOidTORepeatOidMap); } @@ -4671,6 +4711,7 @@ } } } + private List<ClientBusinessObject> ChangeMapTOClientBusinessObjects(List<Map<String,String>> oldDataMap){ List<ClientBusinessObject> clientBusinessObjectList=new ArrayList<>(); DefaultAttrAssimtUtil.mapToLowerCase(oldDataMap,true); @@ -5074,6 +5115,7 @@ bladeRedis.expire(uuid, BATCHADD_REDIS_TIME);//redis杩囨湡鏃堕棿 } } + /** * 鎷疯礉涓氬姟绫诲瀷鍒癿ap * @param cbo 涓氬姟鏁版嵁 @@ -5162,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, "闆嗗洟鐮�"); @@ -5241,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(); @@ -5315,12 +5357,14 @@ Set<String> keyAttrRepeatRowIndexList = keyResultVO.getKeyAttrRepeatRowIndexList(); if (!CollectionUtils.isEmpty(selfRepeatRowIndexList)) { selfRepeatRowIndexList.stream().forEach(rowIndex -> { - errorMap.put(rowIndex, errorMap.getOrDefault(rowIndex, "") + ";鍦ㄥ綋鍓峞xcel鏂囦欢涓叧閿睘鎬ч噸澶�"); + errorMap.put(rowIndex, errorMap.getOrDefault(rowIndex, "") + String.format(";浼犲叆鐨勬暟鎹腑鍏抽敭灞炴�ч噸澶峓%s],[%s];",keyResultVO.getKeyAttrRuleInfo(),keyResultVO.getSynonymRuleInfo())); + // errorMap.put(rowIndex, errorMap.getOrDefault(rowIndex, "") + ";鍦ㄥ綋鍓峞xcel鏂囦欢涓叧閿睘鎬ч噸澶�"); }); } 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<>(); @@ -5366,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<>(); @@ -5485,6 +5530,7 @@ execGroupCodePortDataDTO.setOldList(oldBaseModelList); execGroupCodePortDataDTO.setCodeAllCodeList(codeAllCodeList); } + /** * * @param fieldIndexMap @@ -5513,6 +5559,7 @@ cboList.add(cbo); }); } + /*** * 闆嗗洟瀵煎嚭妯℃澘灞炴�ф槧灏勪俊鎭幏鍙� * @param templateVO @@ -5529,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鏀规垚鐢╧ey鍊煎垽鏂� + if(StringUtils.isNotBlank(dockingPreAttrMappingVO.getTargetAttrKey())){ codeAndGroupCodeAttrMappingDTO.setDefaultValue(dockingPreAttrMappingVO.getDefaultValue()); codeAndGroupCodeAttrMappingDTO.setMetaListId(dockingPreAttrMappingVO.getMetaListId()); codeAndGroupCodeAttrMappingDTO.setSourceAttrKey(dockingPreAttrMappingVO.getSourceAttrKey()); @@ -5576,6 +5624,7 @@ } + /*** * 鏌ヨ鏈湁闆嗗洟鐮佺殑鏁版嵁 * @param classifyFullInfo -- Gitblit v1.9.3