From c1d180542ff8b29aefca77855828655e99e6ccf0 Mon Sep 17 00:00:00 2001 From: sunhongfei01 Date: Fri, 12 Jul 2024 17:50:31 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=8F=90=E5=8F=96=E6=9E=9A=E4=B8=BE=E9=A1=B9?= =?UTF-8?q?=E4=B8=8E=E8=B5=84=E6=BA=90=E9=A1=B9=E7=9A=84=E9=80=9A=E7=94=A8?= =?UTF-8?q?=E5=89=8D=E7=BC=80=202.VALIDATE=5FELEMENT=5FPREFIX=20=E8=A1=A5?= =?UTF-8?q?=E5=85=85=E5=8F=82=E6=95=B0=203.VMI8nResourceUtil=20=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E7=BC=96=E7=A0=81=E6=97=A0=E6=B3=95=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=88=B0=E5=AF=B9=E5=BA=94=E8=B5=84=E6=BA=90=E6=97=B6=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E5=BD=93=E5=89=8D=E7=BC=96=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../validate/ViewModelValidator.java | 29 ++++++++++++++++--- .../viewmodel/i18n/VMI8nResourceUtil.java | 21 ++++++++++++++ .../i18n/names/VoResourceKeyNames.java | 21 ++++++++++++-- 3 files changed, 64 insertions(+), 7 deletions(-) diff --git a/view-object-manager/src/main/java/com/inspur/edp/formserver/vmmanager/validate/ViewModelValidator.java b/view-object-manager/src/main/java/com/inspur/edp/formserver/vmmanager/validate/ViewModelValidator.java index 92666de..7c0523d 100644 --- a/view-object-manager/src/main/java/com/inspur/edp/formserver/vmmanager/validate/ViewModelValidator.java +++ b/view-object-manager/src/main/java/com/inspur/edp/formserver/vmmanager/validate/ViewModelValidator.java @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2020 - present, Inspur Genersoft Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.inspur.edp.formserver.vmmanager.validate; import com.inspur.edp.bef.bizentity.GspBizEntityElement; @@ -23,7 +39,11 @@ import com.inspur.edp.das.commonmodel.entity.object.GspCommonObjectType; import com.inspur.edp.formserver.viewmodel.GspViewModel; import com.inspur.edp.formserver.viewmodel.GspViewModelElement; import com.inspur.edp.formserver.viewmodel.GspViewObject; -import com.inspur.edp.formserver.viewmodel.action.*; +import com.inspur.edp.formserver.viewmodel.action.IViewModelParameter; +import com.inspur.edp.formserver.viewmodel.action.MappedCdpAction; +import com.inspur.edp.formserver.viewmodel.action.MappedCdpActionBase; +import com.inspur.edp.formserver.viewmodel.action.ViewModelAction; +import com.inspur.edp.formserver.viewmodel.action.ViewModelActionType; import com.inspur.edp.formserver.viewmodel.action.viewmodelbase.ViewModelReturnValue; import com.inspur.edp.formserver.viewmodel.collection.VMActionCollection; import com.inspur.edp.formserver.viewmodel.collection.ValueHelpConfigCollection; @@ -295,7 +315,8 @@ public class ViewModelValidator { if (allElementList != null && allElementList.size() > 0) { //字段[编号][名称][标签]不允许为空 for (IGspCommonElement element : allElementList) { - String errorMessagePrefix = VMI8nResourceUtil.getMessage(VoResourceKeyNames.VALIDATE_ELEMENT_PREFIX, aObject.getName(), element.getName()); + String errorMessagePrefix = VMI8nResourceUtil.getMessage(VoResourceKeyNames.VALIDATE_ELEMENT_PREFIX, + aObject.getName(), element.getName()); validateElementBasicInfo(element, sb, errorMessagePrefix); } @@ -505,7 +526,7 @@ public class ViewModelValidator { } } if (!isValidate) { - sb.append(VMI8nResourceUtil.getMessage(VoResourceKeyNames.VALIDATE_ELEMENT_DEFAULT_DATATYPE_NOT_FIT)) + sb.append(VMI8nResourceUtil.getMessage(VoResourceKeyNames.VALIDATE_ELEMENT_DEFAULT_DATATYPE_NOT_FIT, errorMessage)) .append("\n"); } return sb.toString(); @@ -638,7 +659,7 @@ public class ViewModelValidator { sb.append("\n"); return sb.toString(); } - ICompParameterCollection compParameterCollection = null; + ICompParameterCollection compParameterCollection; if (metadata.getContent() instanceof VMComponent) { VMComponent component = (VMComponent) metadata.getContent(); compParameterCollection = component.getMethod().getCompParameterCollection(); diff --git a/view-object-model/src/main/java/com/inspur/edp/formserver/viewmodel/i18n/VMI8nResourceUtil.java b/view-object-model/src/main/java/com/inspur/edp/formserver/viewmodel/i18n/VMI8nResourceUtil.java index e973e41..0370777 100644 --- a/view-object-model/src/main/java/com/inspur/edp/formserver/viewmodel/i18n/VMI8nResourceUtil.java +++ b/view-object-model/src/main/java/com/inspur/edp/formserver/viewmodel/i18n/VMI8nResourceUtil.java @@ -1,8 +1,26 @@ +/* + * Copyright (c) 2020 - present, Inspur Genersoft Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.inspur.edp.formserver.viewmodel.i18n; import com.inspur.edp.formserver.viewmodel.i18n.names.VoResourceKeyNames; import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import io.iec.edp.caf.commons.utils.StringUtils; import io.iec.edp.caf.i18n.api.ResourceLocalizer; + import java.text.MessageFormat; public class VMI8nResourceUtil { @@ -27,6 +45,9 @@ public class VMI8nResourceUtil { public static String getMessage(String msgCode, Object... messageParams) { // 获取资源文件中对应消息编码的文本内容 String message = getResourceValue(msgCode); + if (StringUtils.isEmpty(message)) { + return msgCode; + } // 如果消息参数为空,则直接返回消息编码 if (messageParams == null || messageParams.length < 1) { return message; diff --git a/view-object-model/src/main/java/com/inspur/edp/formserver/viewmodel/i18n/names/VoResourceKeyNames.java b/view-object-model/src/main/java/com/inspur/edp/formserver/viewmodel/i18n/names/VoResourceKeyNames.java index 79c0640..a193f7f 100644 --- a/view-object-model/src/main/java/com/inspur/edp/formserver/viewmodel/i18n/names/VoResourceKeyNames.java +++ b/view-object-model/src/main/java/com/inspur/edp/formserver/viewmodel/i18n/names/VoResourceKeyNames.java @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2020 - present, Inspur Genersoft Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.inspur.edp.formserver.viewmodel.i18n.names; import lombok.Getter; @@ -595,9 +611,8 @@ public enum VoResourceKeyNames { @Getter private final String errorCode; - + private final static String PREFIX = "GSP_VIEWOBJECT_MSGTEMP_"; VoResourceKeyNames() { - String prefix = ""; - this.errorCode = prefix + this.name(); + this.errorCode = PREFIX + this.name(); } } -- Gitee