From 8ef9e366be48dc5e8e52617ea8ed48b37a0e1f74 Mon Sep 17 00:00:00 2001 From: ludc Date: 星期四, 29 二月 2024 14:33:58 +0800 Subject: [PATCH] 在线部署功能上传,标准申请接口bug修改 --- Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java | 86 ++++++++++++++++++++++++++++++++----------- 1 files changed, 64 insertions(+), 22 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 72feb94..6f42765 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 { - /** * 瀛楁 @@ -142,7 +143,7 @@ * 妯℃澘鐨勬湇鍔� */ @Resource - private CodeClstemplateServiceImpl templateService; + private ICodeClstemplateService templateService; /** * 涓绘暟鎹紩鎿庣殑鏈嶅姟 @@ -165,35 +166,47 @@ 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; + /** * 鏃ュ織淇濆瓨宸ュ叿绫� */ @Autowired private SaveLogUtil saveLogUtil; + + /** * 瀹㈡埛鐜板満excel涓鸿�佺増鏈紝瀵煎嚭鐨勬�绘暟闄愬埗涓�65535 @@ -959,9 +972,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); @@ -971,6 +982,7 @@ Map<String,String>resembleMap=new HashMap<>(); List<DataResembleVO> dataResembleVOS=new ArrayList<>(); String btmtypeid= classifyFullInfo.getTopClassifyVO().getBtmTypeId(); + //鐩镐技椤规煡璇㈣鍒� bathcResembleQuery(codeClassifyOid,templateVO,needSaveCboList,resembleMap,btmtypeid,dataResembleVOS); if(resembleMap.size()>0) { if(!CollectionUtils.isEmpty(dataResembleVOS)) { @@ -1280,6 +1292,7 @@ Map<String, String> resembleMap = new HashMap<>(); List<DataResembleVO> dataResembleVOS = new ArrayList<>(); String btmtypeid = classifyFullInfo.getTopClassifyVO().getBtmTypeId(); + // 鐩镐技椤规煡璇� bathcResembleQuery(templateVO.getCodeclassifyoid(), templateVO, needSaveCboList, resembleMap, btmtypeid, dataResembleVOS); if (resembleMap.size() > 0) { if (!CollectionUtils.isEmpty(dataResembleVOS)) { @@ -1287,6 +1300,7 @@ createRedisDatas(uuid + "-resemble", templateVO, rowIndexCboMap, dataSet, fieldIndexMap, resembleMap, false); } } + //鐢熸垚class缂撳瓨 Map<String, String> rowIndexClsOidMap = cboList.stream().filter(cbo -> cbo != null).collect(Collectors.toList()).stream().collect(Collectors.toMap(s -> s.getAttributeValue((IMPORT_ROW_INDEX)), t -> t.getAttributeValue(CODE_CLASSIFY_OID_FIELD))); createRedisByCodeClassify(uuid + "-class",templateVO,dataSet,fieldIndexMap,true); @@ -1759,6 +1773,7 @@ Map<String,String>resembleMap=new HashMap<>(); List<DataResembleVO> dataResembleVOS=new ArrayList<>(); String btmtypeid= classifyFullInfo.getTopClassifyVO().getBtmTypeId(); + //鐩镐技椤规煡璇� bathcResembleQuery(orderDTO.getCodeClassifyOid(),templateVO,needSaveCboList,resembleMap,btmtypeid,dataResembleVOS); if(resembleMap.size()>0) { isCreateUUid=true; @@ -3083,18 +3098,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); }); //娌℃湁闄愬埗鍒嗙被锛屼絾鏄竴涓ā鏉垮彧鍙兘鍦ㄤ竴涓笟鍔$被鍨嬮噷闈紝鎵�浠ョ洿鎺ユ煡璇㈣繖涓笟鍔$被鍨嬪嵆鍙� @@ -4370,7 +4394,7 @@ } } /** - * 鏍¢獙鍏抽敭灞炴�� + * 鏍¢獙鍏抽敭灞炴�э紝鍜岃繎涔夎瘝鏌ヨ瑙勫垯 * @param classifyFullInfo 鍒嗙被鐨勫叏閮ㄤ俊鎭� * @param templateVO 妯℃澘鐨勫唴瀹癸紝蹇呴』鍖呭惈妯℃澘灞炴�� * @param cboList 鎵归噺鐨勬暟鎹� @@ -4382,7 +4406,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()); //鍏ㄩ儴鍘荤┖鐨勪紭鍏堢骇澶т簬鍘荤┖ @@ -4394,15 +4427,18 @@ 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); + //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()); @@ -4411,25 +4447,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"); @@ -4574,14 +4614,14 @@ } /** - * 鑾峰彇瀵煎叆鐨勫唴瀹逛腑鍏抽敭灞炴�ч噸澶嶇殑琛屽彿 + * 鑾峰彇瀵煎叆鐨勫唴瀹逛腑鍏抽敭灞炴�ц繎涔夎瘝杞崲鍚庨噸澶嶇殑琛屽彿 * @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<>(); boolean trimAll =keyRuleVO ==null?false: VciBaseUtil.getBoolean(keyRuleVO.getIgnoreallspaceflag()); @@ -4597,9 +4637,10 @@ 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); + + // TODO锛� 2024-02-25鏀归�犲疄鐜拌繎涔夎瘝鏌ヨ瑙勫垯鍔熻兘锛涘叧閿睘鎬ч噸澶嶆牎楠屽�煎鐞� + attrVOList.stream().forEach(item->{ + String attrId = item.getId().toLowerCase(Locale.ROOT); String value = cbo.getAttributeValue( attrId); if (value == null) { value = ""; @@ -4616,8 +4657,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); @@ -4628,7 +4670,6 @@ if(keyAttrOkOidTORepeatOidMap.containsKey(okOid)){ List<String> oldOidList = keyAttrOkOidTORepeatOidMap.get(okOid); newOidList.addAll(oldOidList); - } keyAttrOkOidTORepeatOidMap.put(okOid,newOidList); } @@ -4667,6 +4708,7 @@ } } } + private List<ClientBusinessObject> ChangeMapTOClientBusinessObjects(List<Map<String,String>> oldDataMap){ List<ClientBusinessObject> clientBusinessObjectList=new ArrayList<>(); DefaultAttrAssimtUtil.mapToLowerCase(oldDataMap,true); -- Gitblit v1.9.3