From 1b8120cacac0037fcb1f8ae747c2f54eb735368b Mon Sep 17 00:00:00 2001 From: ludc Date: 星期二, 09 五月 2023 18:50:51 +0800 Subject: [PATCH] 代码整合 --- Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java | 49 +++++++++++++++++++++++-------------------------- 1 files changed, 23 insertions(+), 26 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 0f9d00c..d99f7e4 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 @@ -20,10 +20,10 @@ import com.vci.ubcs.code.mapper.CodeOsbtmtypeMapper; import com.vci.ubcs.code.mapper.CodeRuleMapper; import com.vci.ubcs.code.service.*; -import com.vci.ubcs.code.vo.CodeClstempattrVO; import com.vci.ubcs.code.vo.CodeClstemplateVO; import com.vci.ubcs.code.vo.CodeKeyattrrepeatVO; import com.vci.ubcs.code.vo.pagemodel.CodeBasicSecVO; +import com.vci.ubcs.code.vo.pagemodel.CodeClassifyTemplateAttrVO; import com.vci.ubcs.code.vo.pagemodel.CodeClassifyVO; import com.vci.ubcs.code.vo.pagemodel.CodeRuleVO; import com.vci.ubcs.omd.entity.Dict; @@ -61,7 +61,6 @@ */ @Service public class MdmEngineServiceImpl extends ServiceImpl<CodeAllCodeMapper, CodeAllCode> implements MdmEngineService { - /** * 妯℃澘鐨勬湇鍔� @@ -106,10 +105,8 @@ */ private Logger logger = LoggerFactory.getLogger(getClass()); -// @Autowired -// private CodeOsbtmtypeMapper codeOsbtmtypeMapper; - - + // @Autowired + // private CodeOsbtmtypeMapper codeOsbtmtypeMapper; /** * 浣跨敤鍒嗙被鐨勪富閿幏鍙栧彲浠ヤ娇鐢ㄧ殑妯℃澘瀵硅薄 @@ -142,15 +139,15 @@ * @return 涓嬫媺閫夐」 */ @Override - public List<KeyValue> listComboboxItems(CodeClstempattrVO attrVO) { + public List<KeyValue> listComboboxItems(CodeClassifyTemplateAttrVO attrVO) { List<KeyValue> comboboxKVs = null; - if (StringUtils.isNotBlank(attrVO.getEnumstring())) { - comboboxKVs = JSONObject.parseArray(attrVO.getEnumstring(), KeyValue.class); + if (StringUtils.isNotBlank(attrVO.getEnumString())) { + comboboxKVs = JSONObject.parseArray(attrVO.getEnumString(), KeyValue.class); } else { // comboboxKVs = enumService.getEnum(attrVO.getEnumid()); // Dict dict = new Dict(); // dict.setParentId(Long.valueOf(attrVO.getEnumid())); - R<List<DictBiz>> list = iDictBizClient.getList(attrVO.getEnumid()); + R<List<DictBiz>> list = iDictBizClient.getList(attrVO.getEnumId()); if(list.isSuccess()){ for (DictBiz datum : list.getData()) { KeyValue keyValue = new KeyValue(); @@ -257,8 +254,8 @@ * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭� */ private void switchClassifyLevelOnOrder(CodeClstemplateVO templateVO, CodeClassifyFullInfoBO classifyFullInfoBO, CodeOrderDTO orderDTO) { - Map<String,CodeClstempattrVO> classifyAttrVOMap = templateVO.getAttributes().stream().filter( - s -> StringUtils.isNotBlank(s.getClassifyinvokeattr()) && StringUtils.isNotBlank(s.getClassifyinvokelevel()) + Map<String,CodeClassifyTemplateAttrVO> classifyAttrVOMap = templateVO.getAttributes().stream().filter( + s -> StringUtils.isNotBlank(s.getClassifyInvokeAttr()) && StringUtils.isNotBlank(s.getClassifyInvokeLevel()) ).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); if (classifyFullInfoBO.getTopClassifyVO() == null) { //闇�瑕侀噸鏂版煡璇竴涓嬶紝鍥犱负杩欎釜鏄寚瀹氱殑鍒嗙被杩涙潵鐨� @@ -269,11 +266,11 @@ //鍒嗙被娉ㄥ叆鐨勭紪鍙锋垨鑰呭悕绉帮紝 //灞傜骇鍖呭惈鎸囧畾灞傚拰鏈�灏忓眰 CodeClassifyVO classifyVO = null; - if (!CodeLevelTypeEnum.MIN.getValue().equalsIgnoreCase(attrVO.getClassifyinvokelevel()) && !"min".equalsIgnoreCase(attrVO.getClassifyinvokelevel())) { + if (!CodeLevelTypeEnum.MIN.getValue().equalsIgnoreCase(attrVO.getClassifyInvokeLevel()) && !"min".equalsIgnoreCase(attrVO.getClassifyInvokeLevel())) { //鎸囧畾浜嗗眰绾х殑 //娉ㄦ剰锛屽洜涓烘煡璇笂绾у垎绫诲嚭鏉ョ殑灞傜骇鏄�掑簭鐨勶紝鍗抽《灞傝妭鐐规槸鏈�澶х殑鍊� List<CodeClassifyVO> classifyVOS = classifyFullInfoBO.getParentClassifyVOs().stream().sorted(((o1, o2) -> o2.getDataLevel().compareTo(o1.getDataLevel()))).collect(Collectors.toList()); - int level = VciBaseUtil.getInt(attrVO.getClassifyinvokelevel()); + int level = VciBaseUtil.getInt(attrVO.getClassifyInvokeLevel()); if (classifyVOS.size() >= level && level > 0) { classifyVO = classifyVOS.get(level - 1); } @@ -283,11 +280,11 @@ } if (classifyVO == null) { //璇存槑灞傜骇鏈夎 - orderDTO.getData().put(attrId, "鍒嗙被鏍戜笂娌℃湁灞傜骇[" + attrVO.getClassifyinvokelevel() + "]"); + orderDTO.getData().put(attrId, "鍒嗙被鏍戜笂娌℃湁灞傜骇[" + attrVO.getClassifyInvokeLevel() + "]"); // classifyVO = classifyFullInfoBO.getCurrentClassifyVO(); } else { Map<String, String> classifyDataMap = VciBaseUtil.objectToMapString(classifyVO); - String value = classifyDataMap.getOrDefault(attrVO.getClassifyinvokeattr(), ""); + String value = classifyDataMap.getOrDefault(attrVO.getClassifyInvokeAttr(), ""); orderDTO.getData().put(attrId, value); } }); @@ -328,9 +325,9 @@ * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭� */ private void checkRequiredAttrOnOrder(CodeClstemplateVO templateVO, CodeOrderDTO orderDTO) { - Map<String, CodeClstempattrVO> requiredAttrMap = templateVO.getAttributes().stream().filter( - s -> VciBaseUtil.getBoolean(s.getRequireflag()) && StringUtils.isBlank(s.getComponentrule()) - && StringUtils.isBlank(s.getClassifyinvokeattr())) + Map<String, CodeClassifyTemplateAttrVO> requiredAttrMap = templateVO.getAttributes().stream().filter( + s -> VciBaseUtil.getBoolean(s.getRequireFlag()) && StringUtils.isBlank(s.getComponentRule()) + && StringUtils.isBlank(s.getClassifyInvokeAttr())) .collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); if (!CollectionUtils.isEmpty(requiredAttrMap)) { requiredAttrMap.forEach((attrId, attrVO) -> { @@ -369,7 +366,7 @@ * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭� */ private void switchComponentAttrOnOrder(CodeClstemplateVO templateVO, CodeOrderDTO orderDTO) { - Map<String, CodeClstempattrVO> compAttrVOMap = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getComponentrule())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); + Map<String, CodeClassifyTemplateAttrVO> compAttrVOMap = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getComponentRule())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); if (!CollectionUtils.isEmpty(compAttrVOMap)) { Map<String, String> dataMap = WebUtil.objectToMapString(orderDTO); @@ -413,11 +410,11 @@ * @param orderDTO 缂栫爜鐢宠鐨勭浉鍏崇殑淇℃伅 */ private void checkVerifyOnOrder(CodeClstemplateVO templateVO, CodeOrderDTO orderDTO) { - Map<String, CodeClstempattrVO> verifyAttrVOMap = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getVerifyrule())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); + Map<String, CodeClassifyTemplateAttrVO> verifyAttrVOMap = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getVerifyRule())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); if (!CollectionUtils.isEmpty(verifyAttrVOMap)) { verifyAttrVOMap.forEach((attrId, attrVO) -> { String value = getValueFromOrderDTO(orderDTO, attrId); - if (StringUtils.isNotBlank(value) && !value.matches(attrVO.getVerifyrule())) { + if (StringUtils.isNotBlank(value) && !value.matches(attrVO.getVerifyRule())) { //鏍¢獙姝e垯琛ㄨ揪寮� throw new VciBaseException("灞炴�{0}]鐨勫�间笉绗﹀悎鏍¢獙瑙勫垯鐨勮姹�", new String[]{attrVO.getName()}); } @@ -437,7 +434,7 @@ CodeKeyattrrepeatVO keyRuleVO = keyRuleService.getRuleByClassifyFullInfo(classifyFullInfo); //娉ㄦ剰鐨勬槸keyRuleVO鍙兘涓虹┖锛岃〃绀轰笉浣跨敤瑙勫垯鎺у埗 //鑾峰彇鎵�鏈夌殑鍏抽敭灞炴�� - Map<String, CodeClstempattrVO> ketAttrMap = templateVO.getAttributes().stream().filter(s -> VciBaseUtil.getBoolean(s.getKeyattrflag())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); + 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, String> conditionMap = new HashMap<>(); boolean trimAll = keyRuleVO == null ? false : VciBaseUtil.getBoolean(keyRuleVO.getIgnoreallspaceflag()); //鍏ㄩ儴鍘荤┖鐨勪紭鍏堢骇澶т簬鍘荤┖ @@ -544,7 +541,7 @@ private void checkEnumOnOrder(CodeClstemplateVO templateVO, CodeOrderDTO orderDTO) { //濡傛灉鏋氫妇鍙互淇敼锛屽垯涓嶉渶瑕佹牎楠屾槸鍚︾鍚堟灇涓剧殑閫夐」 - Map<String, CodeClstempattrVO> enumAttrVOMap = templateVO.getAttributes().stream().filter(s -> (StringUtils.isNotBlank(s.getEnumstring()) || StringUtils.isNotBlank(s.getEnumid())) && !VciBaseUtil.getBoolean(s.getEnumeditflag())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); + Map<String, CodeClassifyTemplateAttrVO> enumAttrVOMap = templateVO.getAttributes().stream().filter(s -> (StringUtils.isNotBlank(s.getEnumString()) || StringUtils.isNotBlank(s.getEnumId())) && !VciBaseUtil.getBoolean(s.getEnumEditFlag())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); if (!CollectionUtils.isEmpty(enumAttrVOMap)) { enumAttrVOMap.forEach((attrId, attrVO) -> { String value = getValueFromOrderDTO(orderDTO, attrId); @@ -566,7 +563,7 @@ * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭� */ private void switchDateAttrOnOrder(CodeClstemplateVO templateVO, CodeOrderDTO orderDTO) { - Map<String, CodeClstempattrVO> dateAttrVOMap = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getCodedateformat())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); + Map<String, CodeClassifyTemplateAttrVO> dateAttrVOMap = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getCodeDateFormat())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); if (!CollectionUtils.isEmpty(dateAttrVOMap)) { dateAttrVOMap.forEach((attrId, attrVO) -> { String value = getValueFromOrderDTO(orderDTO, attrId); @@ -757,7 +754,7 @@ // public void batchSaveSelectChar(CodeClstemplateVO templateVO, List<ClientBusinessObject> cboList) { // if (templateVO != null && !CollectionUtils.isEmpty(cboList)) { // //鏄紓姝ョ殑锛屾墍浠ョ洿鎺ュ惊鐜� -// List<CodeClstempattrVO> selectAttrVOs = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getLibraryidentification())).collect(Collectors.toList()); +// List<CodeClassifyTemplateAttrVO> selectAttrVOs = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getLibraryidentification())).collect(Collectors.toList()); // // if (!CollectionUtils.isEmpty(selectAttrVOs)) { //// SessionInfo sessionInfo = VciBaseUtil.getCurrentUserSessionInfo(); -- Gitblit v1.9.3