From 02b3d584d201ca7cb8a024fd151fe6eddbf43def Mon Sep 17 00:00:00 2001 From: 田源 <lastanimals@163.com> Date: 星期五, 01 三月 2024 16:31:10 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java | 73 +++++++++++++++++++++++++----------- 1 files changed, 51 insertions(+), 22 deletions(-) diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java index 2965981..e808073 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java @@ -177,6 +177,11 @@ private MdmProductCodeService productCodeService; /** + * 杩戜箟璇嶈鍒欐煡璇㈡湇鍔� + */ + @Autowired ICodeSynonymService codeSynonymService; + + /** * 鍙緭鍙�夌殑鏈嶅姟 */ @Resource @@ -358,7 +363,6 @@ */ @Autowired private SaveLogUtil saveLogUtil; - /** * 浣跨敤鍒嗙被鐨勪富閿幏鍙栧彲浠ヤ娇鐢ㄧ殑妯℃澘瀵硅薄 @@ -755,27 +759,36 @@ //娉ㄦ剰鐨勬槸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 = ""; } - wrapperKeyAttrConditionMap(value, keyRuleVO, attrId, trim, ignoreCase, ignoreWidth, trimAll, conditionMap); + wrapperKeyAttrConditionMap(value, keyRuleVO, finalCodeSynonymMaps.get(attrId), attrId, trim, ignoreCase, ignoreWidth, trimAll, conditionMap); }); //娌℃湁闄愬埗鍒嗙被锛屼絾鏄竴涓ā鏉垮彧鍙兘鍦ㄤ竴涓笟鍔$被鍨嬮噷闈紝鎵�浠ョ洿鎺ユ煡璇㈣繖涓笟鍔$被鍨嬪嵆鍙� if (!CollectionUtils.isEmpty(conditionMap)) { // TODO: 鍚屼竴涓簱鍒ら噸涓嶉渶瑕佸尯鍒嗗垎绫籵id // conditionMap.put("CODETEMPLATEOID","'" + orderDTO.getTemplateOid() + "'"); -// final String[] sql = {"select count(*) from " + VciBaseUtil.getTableName(classifyFullInfo.getTopClassifyVO().getBtmtypeid()) + " t where 1 = 1 "}; + // final String[] sql = {"select count(*) from " + VciBaseUtil.getTableName(classifyFullInfo.getTopClassifyVO().getBtmtypeid()) + " t where 1 = 1 "}; R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(classifyFullInfo.getTopClassifyVO().getBtmTypeId())); -// String referTable = VciBaseUtil.getTableName(referVO.getReferType()); + // String referTable = VciBaseUtil.getTableName(referVO.getReferType()); if (!listR.isSuccess() || listR.getData().size() == 0) { throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒"); } @@ -800,7 +813,7 @@ if (Func.isNotEmpty(isParticipateCheckOids)) { sql[0] += " and codeclsfid not in(" + isParticipateCheckOids + ")"; } -// if (boService.queryCountBySql(sql[0], new HashMap<>()) > 0) { + // if (boService.queryCountBySql(sql[0], new HashMap<>()) > 0) { List<String> repeatData = commonsMapper.selectList(sql[0]); if (!repeatData.isEmpty()) { String ruleInfoMsg = keyRuleVO == null ? "" : "鏌ヨ瑙勫垯锛氬幓闄ょ┖鏍�--{0},蹇界暐澶у皬鍐�--{1},蹇界暐鍏ㄥ崐瑙�--{2},蹇界暐鍏ㄩ儴绌烘牸--{3}"; @@ -825,18 +838,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 = ""; } - wrapperKeyAttrConditionMap(value, keyRuleVO, attrId, trim, ignoreCase, ignoreWidth, trimAll, conditionMap); + wrapperKeyAttrConditionMap(value, keyRuleVO, finalCodeSynonymMaps.get(attrId), attrId, trim, ignoreCase, ignoreWidth, trimAll, conditionMap); }); //娌℃湁闄愬埗鍒嗙被锛屼絾鏄竴涓ā鏉垮彧鍙兘鍦ㄤ竴涓笟鍔$被鍨嬮噷闈紝鎵�浠ョ洿鎺ユ煡璇㈣繖涓笟鍔$被鍨嬪嵆鍙� @@ -927,7 +949,7 @@ } //鏄惁绯诲垪 if (!codeBZApplyDTO.isSeries()) { - boolean isSeriesValue = codeBZApplyDTO.getData().get(isSeries).equals("true") ? true : false; + boolean isSeriesValue = Func.toBoolean(codeBZApplyDTO.getData().get(isSeries)); codeBZApplyDTO.setSeries(isSeriesValue); } //鍘熸爣鍑嗗彿 @@ -947,7 +969,7 @@ } //鏄惁鍙樻洿绯诲垪 if (!codeBZApplyDTO.isEditSeries()) { - boolean isEditSeriesValue = codeBZApplyDTO.getData().get(isEditSeries).equals("true") ? true : false; + boolean isEditSeriesValue = Func.toBoolean(codeBZApplyDTO.getData().get(isEditSeries)); codeBZApplyDTO.setEditSeries(isEditSeriesValue); } VciBaseUtil.alertNotNull(codeBZApplyDTO.getOperationType(), "鎿嶄綔绫诲瀷", @@ -965,7 +987,7 @@ } else if (codeBZApplyDTO.getOperationType().equals(CodeBZOperationTypeEnum.CODE_BZ_DISABLE.getValue())) {//浣滃簾 code = amendmentDataBZ(codeBZApplyDTO, authUser); createChangeOder(code, codeBZApplyDTO, authUser); - } else if (codeBZApplyDTO.getOperationType().equals(CodeBZOperationTypeEnum.CODE_BZ_AMENDMENT.getValue())) {//澶囨煡 + } else if (codeBZApplyDTO.getOperationType().equals(CodeBZOperationTypeEnum.CODE_BZ_FOR_REFERENCE.getValue())) {//澶囨煡 code = amendmentDataBZ(codeBZApplyDTO, authUser); createChangeOder(code, codeBZApplyDTO, authUser); } @@ -1235,14 +1257,18 @@ * @param conditionMap 鏌ヨ鏉′欢 */ @Override - public void wrapperKeyAttrConditionMap(String value, CodeKeyAttrRepeatVO keyRuleVO, String attrId, + public void wrapperKeyAttrConditionMap(String value, CodeKeyAttrRepeatVO keyRuleVO, + List<CodeSynonym> codeSynonymMaps, String attrId, boolean trim, boolean ignoreCase, boolean ignoreWidth, boolean trimAll, Map<String, String> conditionMap) { boolean ignoreSpace = trim || trimAll; if (StringUtils.isBlank(value)) { - //涓虹┖鐨勬椂鍊欙紝涓嶈兘鐢≦ueryOperation.ISNULL锛屽钩鍙颁笉鐭ラ亾鍟ユ椂鍊欎笉澶勭悊杩欑浜� + //鍊间负绌虹殑鏃跺�欙紝涓嶈兘鐢≦ueryOperation.ISNULL锛屽钩鍙颁笉鐭ラ亾鍟ユ椂鍊欎笉澶勭悊杩欑浜� conditionMap.put("t." + attrId, QueryOptionConstant.ISNULL); } else { + //杩戜箟璇嶆煡璇㈣鍒檝alu鍊艰浆鎹� + value = this.getValueToSynony(codeSynonymMaps, value); + if (keyRuleVO != null) { String queryKey = ""; String queryValue = ""; @@ -1278,7 +1304,7 @@ conditionMap.put(queryKey, queryValue); } else { if (StringUtils.isNotBlank(value)) { - //涓虹┖鐨勬椂鍊欎笉浠h〃涓嶆牎楠岋紝鍙槸涓嶅幓闄ょ浉鍏崇殑淇℃伅 + //鍏抽敭灞炴�ф煡閲嶈鍒欎负绌虹殑鏃跺�欎笉浠h〃涓嶆牎楠岋紝鍙槸涓嶅幓闄ょ浉鍏崇殑淇℃伅 conditionMap.put("nvl(" + "t." + attrId + ",'/')", "'" + SpecialCharacterConverter.escapeSpecialCharacters(value) + "'"); } else { conditionMap.put("t." + attrId, QueryOptionConstant.ISNULL); @@ -1288,17 +1314,20 @@ } /** - * 灏佽杩戜箟璇嶆煡璇㈣鍒欏睘鎬х殑鏌ヨ璇彞 - * @param value 褰撳墠鐨勫�� - * @param keyRuleVO 灞炴�х殑缂栧彿 - * @param attrId - * @param conditionMap 鏌ヨ鏉′欢 + * 杩戜箟璇嶆煡璇㈣鍒欒浆鎹� + * @param codeSynonymMaps + * @param value + * @return */ - @Override - public void wrapperSynonymAttrConditionMap(String value, CodeKeyAttrRepeatVO keyRuleVO, String attrId, Map<String, String> conditionMap) { - // map鏋勯�犳�濊矾锛�1銆佸厛瀹屾垚姝e悜鏇挎崲sql鍊� - // 2銆佸啀瀹屾垚鍙嶅悜鏇挎崲sql鍊� - + public String getValueToSynony(/*杩戜箟璇嶆煡璇㈣鍒�*/List<CodeSynonym> codeSynonymMaps,String value){ + // 鑾峰彇骞跺垽鏂槸鍚﹂厤缃簡杩戜箟璇嶆煡璇㈣鍒� + // TODO锛氳繎涔夎瘝鏇挎崲鎴愭簮鍊硷紙婧愬�兼槸姝g‘鐨勫�硷紝杩戜箟璇嶆槸鐩稿綋浜庤緭閿欑瑪璇殑瀛楃锛� + if(!codeSynonymMaps.isEmpty()){ + for (int i = 0; i < codeSynonymMaps.size(); i++) { + value = value.replace(codeSynonymMaps.get(i).getSynonymValue(),codeSynonymMaps.get(i).getSourceValue()); + } + } + return value; } /** -- Gitblit v1.9.3