From b9367591279f75feba17a1301d7aa9ce8a6325f5 Mon Sep 17 00:00:00 2001 From: ludc Date: 星期二, 19 三月 2024 21:05:55 +0800 Subject: [PATCH] 集成相关更改 --- Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java | 103 +++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 75 insertions(+), 28 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 8c7b56b..6e1dacc 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 @@ -253,8 +258,9 @@ */ @Autowired private ICodeRuleService ruleService; + /** - * 缂栫爜瑙勫垯鐨勬湇鍔� + * 鐮佸�肩殑鏈嶅姟 */ @Autowired private ICodeAllCodeService codeAllCodeService; @@ -359,7 +365,6 @@ @Autowired private SaveLogUtil saveLogUtil; - /** * 浣跨敤鍒嗙被鐨勪富閿幏鍙栧彲浠ヤ娇鐢ㄧ殑妯℃澘瀵硅薄 * @@ -423,8 +428,7 @@ try { VciBaseUtil.alertNotNull(baseModelDTO, "鏁版嵁淇℃伅", baseModelDTO.getOid(), "涓婚敭", baseModelDTO.getBtmname(), "涓氬姟绫诲瀷", baseModelDTO.getLcStatus(), "鐩爣鐘舵��"); List<String> oids = VciBaseUtil.str2List(baseModelDTO.getOid()); - List<BaseModel> baseModels = new ArrayList<>(); - baseModels = selectByTypeAndOid(baseModelDTO.getBtmname(), baseModelDTO.getOid()); + List<BaseModel> baseModels = selectByTypeAndOid(baseModelDTO.getBtmname(), baseModelDTO.getOid()); if (baseModels.size() == 0) { throw new VciBaseException("鏈煡璇㈠埌鐩稿叧鏁版嵁銆�"); } @@ -756,27 +760,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("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒"); } @@ -801,7 +814,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}"; @@ -826,18 +839,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); }); //娌℃湁闄愬埗鍒嗙被锛屼絾鏄竴涓ā鏉垮彧鍙兘鍦ㄤ竴涓笟鍔$被鍨嬮噷闈紝鎵�浠ョ洿鎺ユ煡璇㈣繖涓笟鍔$被鍨嬪嵆鍙� @@ -928,7 +950,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); } //鍘熸爣鍑嗗彿 @@ -948,7 +970,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(), "鎿嶄綔绫诲瀷", @@ -966,7 +988,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); } @@ -1236,14 +1258,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 = ""; @@ -1279,13 +1305,30 @@ 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); } } } + } + + /** + * 杩戜箟璇嶆煡璇㈣鍒欒浆鎹� + * @param codeSynonymMaps + * @param value + * @return + */ + public String getValueToSynony(/*杩戜箟璇嶆煡璇㈣鍒�*/List<CodeSynonym> codeSynonymMaps,String value){ + // 鑾峰彇骞跺垽鏂槸鍚﹂厤缃簡杩戜箟璇嶆煡璇㈣鍒� + // TODO锛氳繎涔夎瘝鏇挎崲鎴愭簮鍊硷紙婧愬�兼槸姝g‘鐨勫�硷紝杩戜箟璇嶆槸鐩稿綋浜庤緭閿欑瑪璇殑瀛楃锛� + if(Func.isNotEmpty(codeSynonymMaps)){ + for (int i = 0; i < codeSynonymMaps.size(); i++) { + value = value.replace(codeSynonymMaps.get(i).getSynonymValue(),codeSynonymMaps.get(i).getSourceValue()); + } + } + return value; } /** @@ -1948,7 +1991,7 @@ boolean ignoreCase = VciBaseUtil.getBoolean(resembleRuleVO.getIgnorecaseflag()); boolean ignoreWidth = VciBaseUtil.getBoolean(resembleRuleVO.getIgnorewidthflag()); boolean trimAll = VciBaseUtil.getBoolean(resembleRuleVO.getIgnoreallspaceflag()); - boolean trim = VciBaseUtil.getBoolean(resembleRuleVO.getIgnoreallspaceflag()); + boolean trim = VciBaseUtil.getBoolean(resembleRuleVO.getIgnorecaseflag()); String temp = ""; if (ignoreCase && ignoreSpace && ignoreWidth) { //蹇界暐澶у皬鍐欙紝涓斿幓绌猴紝蹇界暐鍏ㄥ崐瑙� @@ -1982,7 +2025,7 @@ temp = "replace(" + temp + ",'" + s + "','')"; } } - queryValue = String.format(temp, (trim ? value.trim() : value)); + queryValue = String.format(temp, (trim ? "'"+value.trim()+"'" : "'"+value+"'")); temp = temp.replace("to_single_byte('%s')", "to_single_byte(%s)"); queryKey = String.format(temp, "t." + attrId); conditionMap.put(queryKey, QueryOptionConstant.OR + queryValue); @@ -2008,7 +2051,7 @@ } catch (Exception e) { String errorMessage = e.getMessage(); if (errorMessage.contains("鏃犳硶瑙f瀽鐨勬垚鍛樿闂〃杈惧紡")) { - throw new ServiceException("缂哄皯" + errorMessage.substring(errorMessage.indexOf("[t.") + 1, errorMessage.indexOf("]")) + "瀛楁"); + throw new ServiceException("缂哄皯" + errorMessage.substring(errorMessage.indexOf("[T.") + 1, errorMessage.indexOf("]")) + "瀛楁"); } throw new ServiceException(e.getMessage()); } @@ -2144,7 +2187,6 @@ } } - /** * 澶勭悊鏃堕棿鏍煎紡 * @@ -2171,7 +2213,6 @@ }); } } - /** * 澶勭悊鏋氫妇鐨勫唴瀹癸紝濡傛灉涓嶅湪鏋氫妇涓紝浼氳繑鍥炲師鏈殑鍊� @@ -2965,7 +3006,7 @@ conditionMap = new HashMap<>(); } pageHelper.addDefaultDesc("createTime"); -// pageHelper.addDefaultDesc("id"); + // pageHelper.addDefaultDesc("id"); if (!classifyService.checkHasChild(codeClassifyOid)) { conditionMap.put("t." + CODE_CLASSIFY_OID_FIELD, codeClassifyOid); } else { @@ -2982,6 +3023,9 @@ conditionMap.put("t.lastr", "1"); conditionMap.put("t.lastv", "1"); DataGrid<Map<String, String>> mapDataGrid = queryGrid(btmTypeId, templateVO, conditionMap, pageHelper); + if(templateVO.getAttributes().isEmpty()){ + throw new ServiceException(String.format("涓婚敭涓猴細{}鐨勬ā鏉夸笅锛屾ā鏉垮睘鎬ч厤缃负绌猴紒",templateVO.getOid())); + } //澶勭悊杩斿洖鏁版嵁涓庢ā鏉挎暟鎹厤缃殑瀛楁涓嶄竴鏍烽棶棰� templateVO.getAttributes().stream().forEach(e -> { for (Map<String, String> datum : mapDataGrid.getData()) { @@ -3435,6 +3479,9 @@ dataList.add(cbo); wrapperData(dataList, templateVO, sqlBO.getSelectFieldList(), true); R<List<Map<String, String>>> result = R.data(Collections.singletonList(cbo)); + if(templateVO.getAttributes().isEmpty()){ + throw new ServiceException(String.format("涓婚敭涓猴細{}鐨勬ā鏉夸笅锛屾ā鏉垮睘鎬ч厤缃负绌猴紒",templateVO.getOid())); + } //澶勭悊杩斿洖鏁版嵁涓庢ā鏉挎暟鎹厤缃殑瀛楁涓嶄竴鏍烽棶棰� templateVO.getAttributes().stream().forEach(e -> { for (Map<String, String> datum : result.getData()) { @@ -3909,13 +3956,13 @@ MdmUIInfoVO uiInfoVO = getTableDefineByTemplateVO(getUsedTemplateByClassifyOid(codeClassifyOid)); uiInfoVO.setLeaf(classifyService.countChildrenByClassifyOid(codeClassifyOid) == 0); if (StringUtils.isNotBlank(functionId) && !"~".equalsIgnoreCase(functionId)) { - List<Menu> buttonVOS = iSysClient.getMenuButtonByType(codeClassifyOid, uiInfoVO.getTemplateVO().getBtmTypeId(), "data_auth").getData(); - // List<SmOperationVO> operationVOS = operationService.listButtonByFunctionId(functionId); - // if (operationVOS == null) { - // operationVOS = new ArrayList<>(); - // } - // //鏌ヨ鎵╁睍鎸夐挳 - // List<CodeButtonVO> buttonVOS = listButtonInToolbarByClassifyOid(codeClassifyOid); + // TODO:2024-1-25 18:42妯℃澘涓婄殑btmtypeid鏈夋椂鍊欎細瀛樺湪澶у皬鍐欑殑闂锛屾寜鐞嗘潵璇磋繖鍎跨洿鎺ョ敤functionId灏辫兘婊¤冻鏌ヨ鑿滃崟鎸夐挳浜唘iInfoVO.getTemplateVO().getBtmTypeId() + R<List<Menu>> buttonListR = iSysClient.getMenuButtonByType(codeClassifyOid, functionId, "data_auth"); + if(!buttonListR.isSuccess()){ + throw new ServiceException("鑾峰彇鎸夐挳鎺堟潈鍒楄〃澶辫触锛屽師鍥狅細"+buttonListR.getMsg()); + } + List<Menu> buttonVOS = buttonListR.getData(); + List<SmOperationVO> operationVOS = new ArrayList<>(); if (!CollectionUtils.isEmpty(buttonVOS)) { for (int i = 0; i < buttonVOS.size(); i++) { -- Gitblit v1.9.3