diff --git a/.gitignore b/.gitignore index 19fd071d11a2920852d96137bd39e8071aa64d12..a8125fbc1ff1c165e3fc0b3abd5d6eb90842ebae 100644 --- a/.gitignore +++ b/.gitignore @@ -756,3 +756,4 @@ ASALocalRun/ # flatten plugin xml **/.flattened-pom.xml +/approval-patch.bat diff --git a/approval-format/web-approval-format-api/src/main/java/com/inspur/edp/web/approvalformat/api/entity/ApprovalFormUpdateRequestBody.java b/approval-format/web-approval-format-api/src/main/java/com/inspur/edp/web/approvalformat/api/entity/ApprovalFormUpdateRequestBody.java index c71e3c974ab0b8c91a9fac6bae10a69e02613bc5..ef09b516ca5fc6d29634b783c3fc564b3f7e859f 100644 --- a/approval-format/web-approval-format-api/src/main/java/com/inspur/edp/web/approvalformat/api/entity/ApprovalFormUpdateRequestBody.java +++ b/approval-format/web-approval-format-api/src/main/java/com/inspur/edp/web/approvalformat/api/entity/ApprovalFormUpdateRequestBody.java @@ -32,9 +32,7 @@ public class ApprovalFormUpdateRequestBody { /** * 审批单据id */ - @NotNull( - message = "审批单据的元数据id不能为空" - ) + @NotNull private String formMetadataId; /** diff --git a/approval-format/web-approval-format-api/src/main/java/com/inspur/edp/web/approvalformat/api/entity/ApprovalFormatDimensionUpdateRequestBody.java b/approval-format/web-approval-format-api/src/main/java/com/inspur/edp/web/approvalformat/api/entity/ApprovalFormatDimensionUpdateRequestBody.java index 3b004f81410ff4f259d93c0ae4e8230915a18055..1e6f15aac3c1cec6646db154eff62d45149559ac 100644 --- a/approval-format/web-approval-format-api/src/main/java/com/inspur/edp/web/approvalformat/api/entity/ApprovalFormatDimensionUpdateRequestBody.java +++ b/approval-format/web-approval-format-api/src/main/java/com/inspur/edp/web/approvalformat/api/entity/ApprovalFormatDimensionUpdateRequestBody.java @@ -30,9 +30,7 @@ public class ApprovalFormatDimensionUpdateRequestBody { /** * 审批单据id */ - @NotNull( - message = "审批格式的id不能为空" - ) + @NotNull private String id; /** diff --git a/approval-format/web-approval-format-api/src/main/java/com/inspur/edp/web/approvalformat/api/entity/ApprovalFormatUpdateRequestBody.java b/approval-format/web-approval-format-api/src/main/java/com/inspur/edp/web/approvalformat/api/entity/ApprovalFormatUpdateRequestBody.java index 04c49160ca1effc324628ab879757cc050f3edbf..b1fef948cc50e0bab91c5003f7f247684c98e7c9 100644 --- a/approval-format/web-approval-format-api/src/main/java/com/inspur/edp/web/approvalformat/api/entity/ApprovalFormatUpdateRequestBody.java +++ b/approval-format/web-approval-format-api/src/main/java/com/inspur/edp/web/approvalformat/api/entity/ApprovalFormatUpdateRequestBody.java @@ -30,9 +30,7 @@ public class ApprovalFormatUpdateRequestBody { /** * 审批单据id */ - @NotNull( - message = "审批格式的id不能为空" - ) + @NotNull private String approvalFormatId; /** diff --git a/approval-format/web-approval-format-api/src/main/java/com/inspur/edp/web/approvalformat/api/entity/ApprovalViewObjectUpdateRequestBody.java b/approval-format/web-approval-format-api/src/main/java/com/inspur/edp/web/approvalformat/api/entity/ApprovalViewObjectUpdateRequestBody.java index d649033273f3a221a95b3c375bf9d2290f095ade..d7737edecc3124298df8446ec8d9d04422eb6e29 100644 --- a/approval-format/web-approval-format-api/src/main/java/com/inspur/edp/web/approvalformat/api/entity/ApprovalViewObjectUpdateRequestBody.java +++ b/approval-format/web-approval-format-api/src/main/java/com/inspur/edp/web/approvalformat/api/entity/ApprovalViewObjectUpdateRequestBody.java @@ -32,9 +32,7 @@ public class ApprovalViewObjectUpdateRequestBody { /** * 审批单据id */ - @NotNull( - message = "审批单据的元数据id不能为空" - ) + @NotNull private String viewModelId; /** diff --git a/approval-format/web-approval-format-core/pom.xml b/approval-format/web-approval-format-core/pom.xml index 92d726e53eb535016012c09968036b1744050dd4..bcd096780ebaee9d1277b9b7792570adb4a6eb00 100644 --- a/approval-format/web-approval-format-core/pom.xml +++ b/approval-format/web-approval-format-core/pom.xml @@ -94,6 +94,5 @@ caf-framework-licservice-api 0.1.1 - diff --git a/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/domain/manager/ApprovalFormatManager.java b/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/domain/manager/ApprovalFormatManager.java index b83bea319bbad4f8a8766894d90fdaf26c53aa32..d63669321f84af9be73ca33268e67dadc34568a2 100644 --- a/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/domain/manager/ApprovalFormatManager.java +++ b/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/domain/manager/ApprovalFormatManager.java @@ -54,7 +54,6 @@ public class ApprovalFormatManager { if (secondDimension == null || secondDimension.isEmpty()) { list = this.repository.findAllByBeIdAndDim1IsNullAndDim2IsNull(bizEntityId); } else { - //throw new RuntimeException("第一维度为空时,第二维度必须为空。请联系开发人员处理"); list = this.repository.findAllByBeIdAndDim1IsNullAndDim2IsNull(bizEntityId); } } else { @@ -92,7 +91,6 @@ public class ApprovalFormatManager { if (secondDimension == null || secondDimension.isEmpty()) { list = this.repository.findAllByBillCategoryIdAndDim1IsNullAndDim2IsNull(billCategoryId); } else { - //throw new RuntimeException("第一维度为空时,第二维度必须为空。请联系开发人员处理"); list = this.repository.findAllByBillCategoryIdAndDim1IsNullAndDim2IsNull(billCategoryId); } } else { diff --git a/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/i18n/Translator.java b/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/i18n/Translator.java new file mode 100644 index 0000000000000000000000000000000000000000..c806c5b246235fb283ac47fbb33f2f7cd79e4994 --- /dev/null +++ b/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/i18n/Translator.java @@ -0,0 +1,31 @@ +package com.inspur.edp.web.approvalformat.core.i18n; + +import com.inspur.edp.web.approvalformat.core.i18n.utils.LanguageUtil; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import io.iec.edp.caf.i18n.api.ResourceLocalizer; + +public class Translator { + + ResourceLocalizer resource = SpringBeanUtils.getBean(ResourceLocalizer.class); + + private static Translator instance; + + private String currentLanguage = ""; + + public static Translator getInstance() { + String currentLanguage = new LanguageUtil().getLanguage(); + if (instance == null || !currentLanguage.equals(instance.currentLanguage)) { + instance = new Translator(); + } + return instance; + } + + private Translator() { + currentLanguage = new LanguageUtil().getLanguage(); + } + + public String translate(String key) { + String str = resource.getString(key, "MobileApproveFormatException.properties", "Bcc", currentLanguage); + return str; + } +} \ No newline at end of file diff --git a/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/i18n/utils/LanguageUtil.java b/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/i18n/utils/LanguageUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..bf9b33d567d30aa99ae31c4bce6b6f99881b0ff2 --- /dev/null +++ b/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/i18n/utils/LanguageUtil.java @@ -0,0 +1,20 @@ +package com.inspur.edp.web.approvalformat.core.i18n.utils; + +import io.iec.edp.caf.boot.context.CAFContext; + +public class LanguageUtil { + /** + * 获取当前用户的系统语言 + * + * @return zh-CHS,en,zh-CHT + */ + public String getLanguage() { + String language = getLanguageFromExternalAPI(); + return language; + } + + private String getLanguageFromExternalAPI() { + return CAFContext.current.getLanguage(); + } + +} \ No newline at end of file diff --git a/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/service/ApprovalFormMetadataServiceImpl.java b/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/service/ApprovalFormMetadataServiceImpl.java index d28bcddaeaa76a1b08cb7a7d012de2af95e2a968..6991e5bc52fc7c32925384431e672a83d85ff601 100644 --- a/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/service/ApprovalFormMetadataServiceImpl.java +++ b/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/service/ApprovalFormMetadataServiceImpl.java @@ -32,6 +32,7 @@ import com.inspur.edp.web.approvalformat.api.service.ApprovalFormMetadataService import com.inspur.edp.web.approvalformat.core.util.ApprovalFormSchemaUtil; import com.inspur.edp.web.approvalformat.core.util.ApprovalFormUtil; import com.inspur.edp.web.approvalformat.core.util.ApprovalFormatPermission; +import com.inspur.edp.web.approvalformat.core.util.ApprovalFormatTranslateUtil; import com.inspur.edp.web.common.customexception.WebCustomException; import com.inspur.edp.web.common.utility.StringUtility; import com.inspur.edp.web.formmetadata.metadata.FormMetadataContent; @@ -41,11 +42,12 @@ import org.springframework.transaction.annotation.Transactional; /** * 审批单据元数据服务实现类 + * * @author Xu‘fa Wang * @date 2020/5/17 18:10 */ public class ApprovalFormMetadataServiceImpl implements ApprovalFormMetadataService { - private final CustomizationService customizationService = SpringBeanUtils.getBean(CustomizationService.class); + private final CustomizationService customizationService = SpringBeanUtils.getBean(CustomizationService.class); @Override public void updateApprovalFormMetadata(ApprovalFormUpdateRequestBody approvalFormUpdateRequestBody) { @@ -54,7 +56,7 @@ public class ApprovalFormMetadataServiceImpl implements ApprovalFormMetadataServ AbstractMetadataContent approvalFormMetadataContent = approvalFormUpdateRequestBody.getFormMetadataContent(); GspMetadata approvalFormMetadata = this.customizationService.getMetadata(approvalFormMetadataId); - if(approvalFormMetadata == null) { + if (approvalFormMetadata == null) { return; } approvalFormMetadata.setContent(approvalFormMetadataContent); @@ -68,7 +70,7 @@ public class ApprovalFormMetadataServiceImpl implements ApprovalFormMetadataServ GspViewModel viewModelContent = approvalViewObjectUpdateRequestBody.getViewModelContent(); GspMetadata viewModelMetadata = this.customizationService.getMetadata(viewModelContent.getID()); - if(viewModelMetadata == null) { + if (viewModelMetadata == null) { return; } viewModelMetadata.setContent(viewModelContent); @@ -77,9 +79,9 @@ public class ApprovalFormMetadataServiceImpl implements ApprovalFormMetadataServ } @Override - @Transactional(rollbackFor=Exception.class, propagation = Propagation.REQUIRED) + @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED) public void createApprovalForm(ApprovalFormatCreateRequestBody approvalFormatCreateRequestBody) { - if(StringUtility.isNullOrEmpty(approvalFormatCreateRequestBody.getBasicFormId())) { + if (StringUtility.isNullOrEmpty(approvalFormatCreateRequestBody.getBasicFormId())) { ApprovalFormUtil.createRootApprovalForm(approvalFormatCreateRequestBody, "Form"); } else { //永远不会进else 20210825 @@ -88,28 +90,28 @@ public class ApprovalFormMetadataServiceImpl implements ApprovalFormMetadataServ } @Override - @Transactional(rollbackFor=Exception.class, propagation = Propagation.REQUIRED) + @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED) public void createApprovalFormViewObject(ApprovalFormatCreateRequestBody request) { - if(StringUtility.isNullOrEmpty(request.getBasicVoId())) { + if (StringUtility.isNullOrEmpty(request.getBasicVoId())) { ApprovalFormUtil.createRootApprovalForm(request, "GSPViewModel"); } else { ApprovalFormUtil.createChildApprovalForm(request, "GSPViewModel"); } } - + @Override public FormMetadataContent getApprovalFormMetadataContent(String approvalFormMetadataId) { new ApprovalFormatPermission().checkModulePermission(); GspMetadata approvalFormMetadata = this.customizationService.getMetadata(approvalFormMetadataId); - if(approvalFormMetadata == null) { + if (approvalFormMetadata == null) { return null; } - return (FormMetadataContent)approvalFormMetadata.getContent(); + return (FormMetadataContent) approvalFormMetadata.getContent(); } @Override - @Transactional(rollbackFor=Exception.class, propagation = Propagation.REQUIRED) + @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED) public String createSchemaFromVo(JsonNode voContent) { try { ObjectMapper mapper = Utils.getMapper(); @@ -118,7 +120,8 @@ public class ApprovalFormMetadataServiceImpl implements ApprovalFormMetadataServ FormSchema schema = ApprovalFormSchemaUtil.constructSchema(vm); return new ObjectMapper().writeValueAsString(schema); } catch (JsonProcessingException e) { - throw new WebCustomException("Schema序列化失败,id=" + voContent.get("ID")); + Object[] params = {voContent.get("ID")}; + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("schemaSerializationFailed", params)); } } } diff --git a/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/service/ApprovalFormatServiceImpl.java b/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/service/ApprovalFormatServiceImpl.java index 3968e5c2b84d052da46f8d70bf2af362d19f04a0..f3849da075532d1bf6e134884cdeefff705d3c20 100644 --- a/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/service/ApprovalFormatServiceImpl.java +++ b/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/service/ApprovalFormatServiceImpl.java @@ -31,7 +31,6 @@ import com.inspur.edp.bef.api.lcp.IStandardLcp; import com.inspur.edp.bef.api.services.IBefSessionManager; import com.inspur.edp.cef.entity.condition.*; import com.inspur.edp.cef.entity.condition.EntityFilter; -import com.inspur.edp.cef.entity.dependenceTemp.Pagination; import com.inspur.edp.cef.entity.entity.IEntityData; import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import com.inspur.edp.lcm.metadata.api.entity.Metadata4Ref; @@ -110,7 +109,8 @@ public class ApprovalFormatServiceImpl implements ApprovalFormatService { public Map getEntityDataByBizEntityId(String dataId, String bizEntityId) { String targetServiceUnitCode = getServiceUnitCode(bizEntityId); if (targetServiceUnitCode == null || targetServiceUnitCode.isEmpty()) { - throw new WebCustomException("当前BE对应su的编号为空。当前BE的id是:" + bizEntityId); + Object[] params = {bizEntityId}; + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("beSUNull", params)); } RpcClient client = SpringBeanUtils.getBean(RpcClient.class); LinkedHashMap parameterHashMap = new LinkedHashMap<>(); @@ -123,7 +123,8 @@ public class ApprovalFormatServiceImpl implements ApprovalFormatService { parameterHashMap, null); } catch (Exception e) { - throw new WebCustomException("调用RPC服务发生异常。当前BE的id是:" + bizEntityId + ",获取到的su编号:" + targetServiceUnitCode, e); + Object[] params = {bizEntityId, targetServiceUnitCode}; + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("invokeRPCServiceError", params), e); } } @@ -159,7 +160,8 @@ public class ApprovalFormatServiceImpl implements ApprovalFormatService { public List queryEntityData(String bizEntityId) { String targetServiceUnitCode = getServiceUnitCode(bizEntityId); if (targetServiceUnitCode == null || targetServiceUnitCode.isEmpty()) { - throw new WebCustomException("当前BE对应su的编号为空。当前BE的id是:" + bizEntityId); + Object[] params = {bizEntityId}; + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("beSUNull", params)); } LinkedHashMap parameterHashMap = new LinkedHashMap<>(); @@ -173,7 +175,8 @@ public class ApprovalFormatServiceImpl implements ApprovalFormatService { parameterHashMap, null); } catch (Exception e) { - throw new WebCustomException("调用RPC服务发生异常。当前BE的id是:" + bizEntityId + ",获取到的su编号:" + targetServiceUnitCode + e.getMessage(), e); + Object[] params = {bizEntityId, targetServiceUnitCode}; + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("invokeRPCServiceError", params) + e.getMessage(), e); } } @@ -182,7 +185,8 @@ public class ApprovalFormatServiceImpl implements ApprovalFormatService { String bizEntityId = queryStringMap.get("bizEntityId").asText(); String targetServiceUnitCode = getServiceUnitCode(bizEntityId); if (targetServiceUnitCode == null || targetServiceUnitCode.isEmpty()) { - throw new WebCustomException("当前BE对应su的编号为空。当前BE的id是:" + bizEntityId); + Object[] params = {bizEntityId}; + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("beSUNull", params)); } LinkedHashMap parameterHashMap = new LinkedHashMap<>(); @@ -196,7 +200,8 @@ public class ApprovalFormatServiceImpl implements ApprovalFormatService { parameterHashMap, null); } catch (Exception e) { - throw new WebCustomException("调用RPC服务发生异常。当前BE的id是:" + bizEntityId + ",获取到的su编号:" + targetServiceUnitCode + e.getMessage(), e); + Object[] params = {bizEntityId, targetServiceUnitCode}; + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("invokeRPCServiceError", params) + e.getMessage(), e); } } @@ -208,7 +213,8 @@ public class ApprovalFormatServiceImpl implements ApprovalFormatService { if (checkIfExistsByBillCategoryIdAndDimension(approvalFormatCreateRequestBody.getBillCategoryId(), approvalFormatCreateRequestBody.getDim1(), approvalFormatCreateRequestBody.getDim2())) { - throw new WebCustomException("不允许相同单据种类id下,存在两个维度定义相同的记录,请检查。"); + Object[] params = {approvalFormatCreateRequestBody.getBillCategoryId()}; + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("bizTypeIdAndDimsRepeat", params)); } @@ -217,18 +223,19 @@ public class ApprovalFormatServiceImpl implements ApprovalFormatService { try { ApprovalFormUtil.saveCheck(approvalFormatCreateRequestBody, "Form"); } catch (Exception e) { - throw new WebCustomException("已存在格式编号为" + formatCode + "的审批格式,请更换格式编号后重试。", e); + Object[] params = {formatCode}; + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("formatCodeRepeat", params)); } - //todo 改为vo创建后,新增一个方法执行vo创建格式 + // todo 改为vo创建后,新增一个方法执行vo创建格式 this.approvalFormMetadataService.createApprovalForm(approvalFormatCreateRequestBody); if (!isCreatedByViewModel(approvalFormatCreateRequestBody)) { this.approvalFormMetadataService.createApprovalFormViewObject(approvalFormatCreateRequestBody); } else { - //不允许使用审批格式的VO创建新的审批格式 + // 不允许使用审批格式的VO创建新的审批格式 if (checkIfExistsByViewModelId(approvalFormatCreateRequestBody.getVoId())) { - throw new WebCustomException("当前视图对象已经创建过审批格式,不允许重复创建!"); + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("currentVOUsed")); } - //根据VO创建eapi元数据 + // 根据VO创建eapi元数据 ApprovalFormUtil.deployManualVOandEapi(approvalFormatCreateRequestBody, approvalFormatCreateRequestBody.getVoId(), ""); } @@ -292,14 +299,15 @@ public class ApprovalFormatServiceImpl implements ApprovalFormatService { try { this.deleteFilesGeneratedInPreviewApprovalFormat(approvalFormId); } catch (Exception e) { - throw new WebCustomException("删除移动审批相关文件失败。详细信息如下:" + e.getMessage()); + Object[] params = {e.getMessage()}; + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("deleteFormatFilesError", params)); } //根据表单元数据获取Eapi的ID GspMetadata approvalFormMetaData = null; approvalFormMetaData = this.customizationService.getMetadata(approvalFormId); if (approvalFormMetaData == null) { - throw new WebCustomException("获取审批格式失败"); + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("getFormatError")); } // 删除审批单据 this.customizationService.deleteGeneratedMetadata(approvalFormId); @@ -329,13 +337,13 @@ public class ApprovalFormatServiceImpl implements ApprovalFormatService { @Override public ApprovalFormat updateApprovalFormat(ApprovalFormatUpdateRequestBody approvalFormatUpdateRequestBody) { if (!approvalFormatUpdateRequestBody.getApprovalFormatId().equals(approvalFormatUpdateRequestBody.getApprovalFormatInstance().getId())) { - throw new WebCustomException("待更新审批格式id与待更新内容中id不一致,请检查。"); + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("inconsistentFormatCode")); } ApprovalFormat approvalFormatInstance = approvalFormatUpdateRequestBody.getApprovalFormatInstance(); ApprovalFormat approvalFormatFromDatabase = this.approvalFormatManager.getApprovalFormatById(approvalFormatInstance.getId()); if (approvalFormatFromDatabase == null) { - throw new WebCustomException("待更新审批格式不存在,不能调用更新接口。请联系开发人员处理"); + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("formatNotExist")); } if (ApprovalFormatUtil.isEqual(approvalFormatInstance, approvalFormatFromDatabase)) { return approvalFormatInstance; @@ -343,7 +351,8 @@ public class ApprovalFormatServiceImpl implements ApprovalFormatService { ApprovalFormatDO approvalFormatDO = ApprovalFormatConverter.toDo(approvalFormatInstance); if (this.approvalFormatManager.checkIfExistsByBillCategoryIdAndDimension(approvalFormatDO)) { - throw new WebCustomException("不允许相同单据种类id下,存在两个维度定义相同的记录,请检查。"); + Object[] params = {approvalFormatDO.getBillCategoryId()}; + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("bizTypeIdAndDimsRepeat", params)); } return this.approvalFormatManager.save(approvalFormatDO); @@ -352,13 +361,13 @@ public class ApprovalFormatServiceImpl implements ApprovalFormatService { @Override public ApprovalFormat updateApprovalFormatFormUrl(ApprovalFormatUpdateRequestBody approvalFormatUpdateRequestBody) { if (!approvalFormatUpdateRequestBody.getApprovalFormatId().equals(approvalFormatUpdateRequestBody.getApprovalFormatInstance().getId())) { - throw new WebCustomException("待更新审批格式id与待更新内容中id不一致,请检查。"); + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("inconsistentFormatCode")); } ApprovalFormat approvalFormatInstance = approvalFormatUpdateRequestBody.getApprovalFormatInstance(); ApprovalFormat approvalFormatFromDatabase = this.approvalFormatManager.getApprovalFormatById(approvalFormatInstance.getId()); if (approvalFormatFromDatabase == null) { - throw new WebCustomException("待更新审批格式不存在,不能调用更新接口。请联系开发人员处理"); + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("formatNotExist")); } // 检测到未修改,直接返回 if (approvalFormatInstance.getApprovalFormPublishUri().equals(approvalFormatFromDatabase.getApprovalFormPublishUri())) { @@ -374,7 +383,7 @@ public class ApprovalFormatServiceImpl implements ApprovalFormatService { public ApprovalFormat updateApprovalFormatDimension(ApprovalFormatDimensionUpdateRequestBody approvalFormatDimensionUpdateRequestBody) { ApprovalFormat approvalFormatFromDatabase = this.approvalFormatManager.getApprovalFormatById(approvalFormatDimensionUpdateRequestBody.getId()); if (approvalFormatFromDatabase == null) { - throw new WebCustomException("待更新审批格式不存在,不能调用更新接口。请联系开发人员处理"); + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("formatNotExist")); } // 检测到未修改,直接返回 @@ -432,7 +441,7 @@ public class ApprovalFormatServiceImpl implements ApprovalFormatService { return null; } if (approvalFormatCollection.size() > 1) { - throw new WebCustomException("表中存在重复数据,请联系开发人员处理。"); + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("duplicateData")); } return approvalFormatCollection.get(0); @@ -445,7 +454,7 @@ public class ApprovalFormatServiceImpl implements ApprovalFormatService { return null; } if (approvalFormatCollection.size() > 1) { - throw new WebCustomException("表中存在重复数据,请联系开发人员处理。"); + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("duplicateData")); } return approvalFormatCollection.get(0); @@ -523,7 +532,8 @@ public class ApprovalFormatServiceImpl implements ApprovalFormatService { for (ApprovalFormat approvalFormat : approvalFormatCollection) { String currentFormId = approvalFormat.getApprovalFormId(); if (formIdApprovalFormatMap.containsKey(currentFormId)) { - throw new WebCustomException("审批格式和审批单据的一对一映射被破坏,请联系开发人员处理。审批单据id是:" + approvalFormat.getApprovalFormId()); + Object[] params = {approvalFormat.getApprovalFormId()}; + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("relationError", params)); } formIdApprovalFormatMap.put(currentFormId, approvalFormat); } @@ -543,7 +553,7 @@ public class ApprovalFormatServiceImpl implements ApprovalFormatService { try { children = this.customizationService.getMetadataInfoRecusively(metadataHeader.getId(), metadataHeader.getCertId()); } catch (Exception e) { - throw new WebCustomException("getMetadataInfoRecusively Error.", e); + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("getMetadataInfoRecusivelyError")); } if (children != null && children.size() > 0) { @@ -564,7 +574,7 @@ public class ApprovalFormatServiceImpl implements ApprovalFormatService { return null; } if (approvalFormatCollection.size() > 1) { - throw new WebCustomException("表中存在重复数据,请联系开发人员处理。"); + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("duplicateData")); } return approvalFormatCollection.get(0); @@ -633,7 +643,7 @@ public class ApprovalFormatServiceImpl implements ApprovalFormatService { */ private void deleteFilesGeneratedInPreviewApprovalFormat(String formId) throws Exception { if (formId == null || formId.isEmpty()) { - throw new WebCustomException("删除移动审批相关文件失败,表单编号为空。"); + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("formatMetadataCodeNull")); } GspMetadata gspMetadata = ApproveFormatPreviewUtil.getGspMetadataWithFormId(formId); @@ -654,7 +664,8 @@ public class ApprovalFormatServiceImpl implements ApprovalFormatService { for (ApprovalFormat approvalFormat : approvalFormatCollection) { GspMetadata approvalForm = this.customizationService.getMetadata(approvalFormat.getApprovalFormId()); if (approvalForm == null) { - throw new WebCustomException("获取元数据失败。待获取元数据ID是:" + approvalFormat.getApprovalFormId()); + Object[] params = {approvalFormat.getApprovalFormId()}; + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("getMetadataError", params)); } MetadataHeader approvalFormMetadataHeader = approvalForm.getHeader(); approvalFormat.setCode(approvalFormMetadataHeader.getCode()); @@ -694,7 +705,8 @@ public class ApprovalFormatServiceImpl implements ApprovalFormatService { ApprovalFormatQueryResponseBody approvalFormatQueryResponseBody = ApprovalFormatUtil.convertToApprovalFormatQueryResponseBody(approvalFormat); GspMetadata approvalForm = this.customizationService.getMetadata(approvalFormatQueryResponseBody.getApprovalFormId()); if (approvalForm == null) { - throw new WebCustomException("获取元数据失败。待获取元数据ID是:" + approvalFormatQueryResponseBody.getApprovalFormId()); + Object[] params = {approvalFormat.getApprovalFormId()}; + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("getMetadataError", params)); } MetadataHeader approvalFormMetadataHeader = approvalForm.getHeader(); approvalFormatQueryResponseBody.setCode(approvalFormMetadataHeader.getCode()); @@ -830,13 +842,13 @@ public class ApprovalFormatServiceImpl implements ApprovalFormatService { } catch (JsonProcessingException e) { WebLogger.Instance.error(e); - throw new WebCustomException("getJsonNode出现错误", e); + throw new WebCustomException("JsonProcessingException:", e); } } private boolean isCreatedByViewModel(ApprovalFormatCreateRequestBody approvalFormatCreateRequestBody) { if (approvalFormatCreateRequestBody == null) { - throw new WebCustomException("参数为空,请检查!"); + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("argumentsNull")); } return StringUtility.isNullOrEmpty(approvalFormatCreateRequestBody.getBeId()); @@ -847,7 +859,8 @@ public class ApprovalFormatServiceImpl implements ApprovalFormatService { //String targetServiceUnitCode = getServiceUnitCode(approvalFormat.getBizEntityId()); String targetServiceUnitCode = "bcc"; if (targetServiceUnitCode == null || targetServiceUnitCode.isEmpty()) { - throw new RuntimeException("当前BE对应su的编号为空。当前BE的id是:" + approvalFormat.getBizEntityId()); + Object[] params = {approvalFormat.getBizEntityId()}; + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("beSUNull", params)); } RpcClient client = SpringBeanUtils.getBean(RpcClient.class); LinkedHashMap parameterHashMap = new LinkedHashMap<>(); @@ -859,10 +872,11 @@ public class ApprovalFormatServiceImpl implements ApprovalFormatService { parameterHashMap, null); } catch (Exception e) { - throw new RuntimeException("调用RPC服务发生异常。当前BE的id是:" + approvalFormat.getBizEntityId() + ",传递的su编号:" + targetServiceUnitCode, e); + Object[] params = {approvalFormat.getBizEntityId(), targetServiceUnitCode}; + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("invokeRPCServiceError", params)); } + } return ""; } - -} +} \ No newline at end of file diff --git a/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/service/BusinessEntityServiceImpl.java b/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/service/BusinessEntityServiceImpl.java index 452da2ede58e9b5a60fade8c7f8d1707f5ac2b87..007877d5367c4decd52c4ce559295b189abbcb3c 100644 --- a/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/service/BusinessEntityServiceImpl.java +++ b/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/service/BusinessEntityServiceImpl.java @@ -20,32 +20,36 @@ import com.inspur.edp.bef.bizentity.GspBusinessEntity; import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import com.inspur.edp.metadata.rtcustomization.api.CustomizationService; import com.inspur.edp.web.approvalformat.api.service.BusinessEntityService; +import com.inspur.edp.web.approvalformat.core.util.ApprovalFormatTranslateUtil; import com.inspur.edp.web.common.customexception.WebCustomException; import io.iec.edp.caf.commons.utils.SpringBeanUtils; /** * 业务实体服务实现类 + * * @author Xu‘fa Wang * @date 2020/5/16 19:15 */ public class BusinessEntityServiceImpl implements BusinessEntityService { - private final CustomizationService customizationService = SpringBeanUtils.getBean(CustomizationService.class); + private final CustomizationService customizationService = SpringBeanUtils.getBean(CustomizationService.class); @Override public GspBusinessEntity getBusinessEntity(String bizEntityId) { GspMetadata bizEntityMetadata = this.customizationService.getMetadata(bizEntityId); - if(bizEntityMetadata == null) { - throw new WebCustomException("The Metadata to search is null. The Searching Metadata ID is: " + bizEntityId); + if (bizEntityMetadata == null) { + Object[] params = {bizEntityId}; + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("parameterConversionFailed", params)); } - return (GspBusinessEntity)bizEntityMetadata.getContent(); + return (GspBusinessEntity) bizEntityMetadata.getContent(); } @Override public GspMetadata getBusinessEntityMetadata(String bizEntityId) { GspMetadata bizEntityMetadata = this.customizationService.getMetadata(bizEntityId); - if(bizEntityMetadata == null) { - throw new WebCustomException("The Metadata to search is null. The Searching Metadata ID is: " + bizEntityId); + if (bizEntityMetadata == null) { + Object[] params = {bizEntityId}; + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("parameterConversionFailed", params)); } return bizEntityMetadata; diff --git a/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/util/ApprovalFormSchemaUtil.java b/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/util/ApprovalFormSchemaUtil.java index 1decc62f44418279a986b457052029d9b0a0204b..36a3d24eaaf376a6168972d8713452582c333597 100644 --- a/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/util/ApprovalFormSchemaUtil.java +++ b/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/util/ApprovalFormSchemaUtil.java @@ -25,6 +25,7 @@ import com.inspur.edp.web.approvalformat.api.entity.schema.Entity; import com.inspur.edp.web.approvalformat.api.entity.schema.Field; import com.inspur.edp.web.approvalformat.api.entity.schema.FormSchema; import com.inspur.edp.web.approvalformat.api.entity.schema.type.EntityType; +import com.inspur.edp.web.common.customexception.WebCustomException; import com.inspur.edp.web.common.utility.StringUtility; import java.util.ArrayList; @@ -33,6 +34,7 @@ import java.util.List; /** * 审批单据schema工具类 + * * @author Xu‘fa Wang * @date 2020/6/8 16:23 */ @@ -42,10 +44,11 @@ public class ApprovalFormSchemaUtil { /** * 基于ViewModel构建表单Schema + * * @param vm * @return */ - public static FormSchema constructSchema(GspViewModel vm){ + public static FormSchema constructSchema(GspViewModel vm) { FormSchema schema = new FormSchema() { { this.setId(vm.getId()); @@ -62,19 +65,19 @@ public class ApprovalFormSchemaUtil { private static List constructFields(CommonVariableCollection variables) { List variableList = new ArrayList<>(); - if(variables == null || variables.size() <= 0) { + if (variables == null || variables.size() <= 0) { return variableList; } variables.forEach(field -> { TypeBuildingContext context = TypeBuildingContext.createTypeBuildingContext(field, null); - Field variable = FieldUtil.constructField(context,null); + Field variable = FieldUtil.constructField(context, null); variableList.add(variable); }); return variableList; } private static Entity constructEntity(GspViewObject mainObject) { - Entity entity = new Entity(){ + Entity entity = new Entity() { { this.setId(mainObject.getId()); this.setCode(mainObject.getCode()); @@ -87,19 +90,20 @@ public class ApprovalFormSchemaUtil { } private static EntityType constructEntityType(GspViewObject mainObject) { - if(mainObject.getIDElement() == null){ - throw new RuntimeException("标识为"+mainObject.getID()+"的视图对象"+mainObject.getName()+"的IDElement属性不允许为null。"); + if (mainObject.getIDElement() == null) { + Object[] params = {mainObject.getID(), mainObject.getName()}; + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("VOIDElementNull", params)); } List fields = new ArrayList<>(); - for(IGspCommonField element : mainObject.getContainElements()) { + for (IGspCommonField element : mainObject.getContainElements()) { fields.add(FieldUtil.createField(element, null)); } List entities = new ArrayList<>(); - for(IGspCommonObject childObject : mainObject.getContainChildObjects()){ + for (IGspCommonObject childObject : mainObject.getContainChildObjects()) { entities.add(constructEntity((GspViewObject) childObject)); } - EntityType entityType = new EntityType(mainObject.getCode(),mainObject.getName(), - StringUtility.toCamelCase(mainObject.getIDElement().getLabelID()),fields, entities); + EntityType entityType = new EntityType(mainObject.getCode(), mainObject.getName(), + StringUtility.toCamelCase(mainObject.getIDElement().getLabelID()), fields, entities); return entityType; } } diff --git a/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/util/ApprovalFormUtil.java b/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/util/ApprovalFormUtil.java index 8cbdfdefe147ce1ffce814b49e78e89fec1db62b..c6a609ce797502dbdfea2dbf4397d57ac11d1587 100644 --- a/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/util/ApprovalFormUtil.java +++ b/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/util/ApprovalFormUtil.java @@ -144,7 +144,8 @@ public class ApprovalFormUtil { try { customizationService.saveCheck(metadata); } catch (Exception e) { - throw new WebCustomException("元数据namespace + code + type发生重复", e); + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("uniqueVerificationFailed") + ); } } @@ -225,7 +226,8 @@ public class ApprovalFormUtil { try { eapiRuntimeDeployment.deploy(RtEapiMetadata.getHeader().getId()); } catch (Exception e) { - throw new RuntimeException("部署eapi元数据失败!" + e.getMessage()); + Object[] params = {e.getMessage()}; + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("deployEapiError", params)); } //记录baseUri放置到表单元数据中 SgMetadata sgMetadata = (SgMetadata) RtEapiMetadata.getContent(); @@ -319,7 +321,8 @@ public class ApprovalFormUtil { try { return mapper.readValue(requestBody.getVoContent(), GspViewModel.class); } catch (JsonProcessingException e) { - throw new WebCustomException("创建" + metaDataType + "元数据失败"); + Object[] params = {metaDataType}; + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("createMetadataError", params)); } default: return null; @@ -388,7 +391,7 @@ public class ApprovalFormUtil { GspMetadata RtEapiMetadata = eapiMetadataRtService.createRtEapi(voMetadataCopy); DeployEapiMetadataAndSyncToFormMetadata(request, RtEapiMetadata); } catch (Exception e) { - throw new WebCustomException("只支持使用手工创建且没有部署过Eapi的视图对象来创建审批格式!", e); + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("VOHasBeenDeployed")); } } diff --git a/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/util/ApprovalFormatTranslateUtil.java b/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/util/ApprovalFormatTranslateUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..72312e65b48a4572118a6d009f92dd4169dd79d6 --- /dev/null +++ b/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/util/ApprovalFormatTranslateUtil.java @@ -0,0 +1,29 @@ +package com.inspur.edp.web.approvalformat.core.util; + +import com.inspur.edp.web.approvalformat.core.i18n.Translator; + +import java.text.MessageFormat; + +public class ApprovalFormatTranslateUtil { + + /** + * 根据资源编号获取国际化之后的资源 + * + * @param resourceID 资源编号 + * @return 翻译之后的国际化资源 + */ + public static String getMessage(String resourceID) { + return Translator.getInstance().translate(resourceID); + } + + /** + * 根据资源编号和格式化参数获取国际化之后的资源 + * + * @param resourceID 资源编号 + * @param params 格式化参数 + * @return 翻译之后的国际化资源 + */ + public static String getMessage(String resourceID, Object[] params) { + return MessageFormat.format(Translator.getInstance().translate(resourceID), params); + } +} diff --git a/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/util/ApproveFormatPreviewUtil.java b/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/util/ApproveFormatPreviewUtil.java index 370584a110f00aac8ef17cb770ef38df30bc11d8..b658711ddf91e6e963bd69b7ba2d995743f7fd6d 100644 --- a/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/util/ApproveFormatPreviewUtil.java +++ b/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/util/ApproveFormatPreviewUtil.java @@ -18,6 +18,7 @@ package com.inspur.edp.web.approvalformat.core.util; import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import com.inspur.edp.metadata.rtcustomization.api.CustomizationService; +import com.inspur.edp.web.common.customexception.WebCustomException; import com.inspur.edp.web.common.io.FileUtility; import io.iec.edp.caf.commons.utils.SpringBeanUtils; @@ -42,7 +43,7 @@ public class ApproveFormatPreviewUtil { public static GspMetadata getGspMetadataWithFormId(String formId) throws Exception { GspMetadata gspMetadata = customizationService.getMetadata(formId); if (gspMetadata == null) { - throw new Exception("根据formId 获取元数据为空"); + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("getMetadataErrorByFormID")); } return gspMetadata; } diff --git a/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/util/FieldUtil.java b/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/util/FieldUtil.java index f1a81bd63b38d6b8eb0d98d6ad6c5fd265b7ff4b..1b4a8220cc19f74028a81319f3e1985311d23219 100644 --- a/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/util/FieldUtil.java +++ b/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/util/FieldUtil.java @@ -54,13 +54,13 @@ public class FieldUtil { public static Field createField(IGspCommonField element, TypeBuildingContext parentContext) { Field createdField; // 按照从子类到父类的方式检查使用的类型 - if(element instanceof GspViewModelElement) { + if (element instanceof GspViewModelElement) { createdField = constructField((GspViewModelElement) element, parentContext); - } else if(element instanceof UdtElement) { + } else if (element instanceof UdtElement) { createdField = constructField((UdtElement) element, parentContext); } else { - throw new RuntimeException("不支持类型,请联系开发人员支持。当前字段是: " - + element.getCode() + " : " + element.getName()); + Object[] params = {element.getCode(), element.getName()}; + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("fieldTypeNotSupported", params)); } return createdField; @@ -81,7 +81,7 @@ public class FieldUtil { return constructField(elementContext, parentContext); } - public static Field constructField(TypeBuildingContext elementContext, TypeBuildingContext parentContext){ + public static Field constructField(TypeBuildingContext elementContext, TypeBuildingContext parentContext) { String prefix = constructBindingFieldPrefix(parentContext); Map elementParams = elementContext.getParams(); String id = (String) elementParams.get("id"); @@ -100,10 +100,10 @@ public class FieldUtil { String path = (String) elementParams.get("path"); elementParams.put("bindingPath", constructBindingPath(elementContext, parentContext)); - String bindingPath =(String) elementParams.get("bindingPath"); + String bindingPath = (String) elementParams.get("bindingPath"); - if(elementContext.hasAssociation() || elementContext.hasUnifiedDataType() || elementContext.isDynamicField()){ - return new ComplexField(){ + if (elementContext.hasAssociation() || elementContext.hasUnifiedDataType() || elementContext.isDynamicField()) { + return new ComplexField() { { this.setId(revisedElementId); this.setOriginalId(id); @@ -120,7 +120,7 @@ public class FieldUtil { Boolean require = (Boolean) elementContext.getParams().get("require"); String defaultValue = (String) elementContext.getParams().get("defaultValue"); Boolean isReadOnly = (Boolean) elementContext.getParams().get("readonly"); - return new SimpleField(){ + return new SimpleField() { { this.setId(revisedElementId); this.setOriginalId(id); @@ -140,9 +140,9 @@ public class FieldUtil { }; } - private static String constructBindingFieldPrefix(TypeBuildingContext context){ + private static String constructBindingFieldPrefix(TypeBuildingContext context) { String prefix = ""; - if (context != null){ + if (context != null) { prefix = context.getParams().get("bindingField") + "_"; } return prefix; @@ -155,37 +155,37 @@ public class FieldUtil { prefix = (String) parentTypeBuildingContext.getParams().get("path"); } if (!prefix.isEmpty()) { - return prefix+"."+label; + return prefix + "." + label; } return label; } - private static String constructBindingPath(TypeBuildingContext elementContext, TypeBuildingContext parentTypeBuildingContext){ + private static String constructBindingPath(TypeBuildingContext elementContext, TypeBuildingContext parentTypeBuildingContext) { String label = StringUtility.toCamelCase((String) elementContext.getParams().get("label")); String prefix = ""; if (parentTypeBuildingContext != null) { prefix = (String) parentTypeBuildingContext.getParams().get("bindingPath"); } if (!prefix.isEmpty()) { - return prefix+"."+label; + return prefix + "." + label; } return label; } private static FieldType constructFieldType(TypeBuildingContext elementContext, TypeBuildingContext parentContext) { - if(elementContext.hasUnifiedDataType()) { + if (elementContext.hasUnifiedDataType()) { return constructObjectFieldType(elementContext); } - if(elementContext.hasAssociation()) { - return constructEntityFieldType(elementContext,parentContext); + if (elementContext.hasAssociation()) { + return constructEntityFieldType(elementContext, parentContext); } - if(elementContext.getObjectType() == GspElementObjectType.Enum) { + if (elementContext.getObjectType() == GspElementObjectType.Enum) { return constructEnumFieldType(elementContext); } - if(elementContext.isDynamicField()) { + if (elementContext.isDynamicField()) { return constructDynamicFieldType(elementContext); } @@ -196,9 +196,9 @@ public class FieldUtil { UnifiedDataTypeDef udtTypeDef = constructUnifiedDataType(elementContext.getUnifiedDataType()); List fields = new ArrayList<>(); String typeName = "", displayTypeName = ""; - if(udtTypeDef instanceof SimpleDataTypeDef) { + if (udtTypeDef instanceof SimpleDataTypeDef) { Field field = constructField((SimpleDataTypeDef) udtTypeDef, elementContext); - if(field instanceof SimpleField){ + if (field instanceof SimpleField) { ((SimpleField) field).setRequire((Boolean) elementContext.getParams().get("require")); ((SimpleField) field).setReadonly((Boolean) elementContext.getParams().get("readonly")); } @@ -206,24 +206,25 @@ public class FieldUtil { displayTypeName = udtTypeDef.getName(); fields.add(field); } - if(udtTypeDef instanceof ComplexDataTypeDef) { - typeName = elementContext.reviseTypeName(udtTypeDef.getID(),udtTypeDef.getCode()); + if (udtTypeDef instanceof ComplexDataTypeDef) { + typeName = elementContext.reviseTypeName(udtTypeDef.getID(), udtTypeDef.getCode()); displayTypeName = udtTypeDef.getName(); ElementCollection elementCollection = ((ComplexDataTypeDef) udtTypeDef).getElements(); - if(elementCollection != null && elementCollection.size() > 0) { + if (elementCollection != null && elementCollection.size() > 0) { elementCollection.forEach(field -> { Field createdField = createField(field, elementContext); fields.add(createdField); }); } } - if(!(udtTypeDef instanceof SimpleDataTypeDef)&&!(udtTypeDef instanceof ComplexDataTypeDef)) { - throw new WebCustomException("Id为"+udtTypeDef.getId()+"的统一数据类型元数据为未识别的类型。"); + if (!(udtTypeDef instanceof SimpleDataTypeDef) && !(udtTypeDef instanceof ComplexDataTypeDef)) { + Object[] params = {udtTypeDef.getId()}; + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("unrecognizedType", params)); } ObjectType objectType = new ObjectType(typeName, displayTypeName, fields); - if("dbfbe55d-ba65-4a7f-a9d4-4f664ec6ec68".equals(udtTypeDef.getId()) + if ("dbfbe55d-ba65-4a7f-a9d4-4f664ec6ec68".equals(udtTypeDef.getId()) || "12be876c-368c-4262-88ab-4112688540b0".equals(udtTypeDef.getId())) { objectType = new HierarchyType(typeName, displayTypeName, fields); } @@ -234,24 +235,25 @@ public class FieldUtil { private static FieldType constructEntityFieldType(TypeBuildingContext elementContext, TypeBuildingContext parentContext) { GspAssociationCollection associations = elementContext.getAssociations(); if (associations == null || associations.size() == 0) { - throw new WebCustomException("字段" + elementContext.getParams().get("name") + "不包含关联实体信息。"); + Object[] params = {elementContext.getParams().get("name")}; + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("notIncludeAssociatedEntityInformation", params)); } TypeBuildingContext originalFieldContext = TypeBuildingContext.createSimpleTypeContextFromAssociation(elementContext, parentContext); Field originalField = constructField(originalFieldContext, parentContext); List typeFields = new ArrayList<>(); typeFields.add(originalField); GspAssociationCollection associationCollection = elementContext.getAssociations(); - if(associationCollection != null && associationCollection.size() > 0) { + if (associationCollection != null && associationCollection.size() > 0) { associationCollection.forEach(association -> { GspFieldCollection refElementCollection = association.getRefElementCollection(); List fieldCollection = new LinkedList<>(); - if(refElementCollection != null && refElementCollection.size() > 0) { + if (refElementCollection != null && refElementCollection.size() > 0) { refElementCollection.forEach(refEle -> { Field createdField = createField(refEle, elementContext); fieldCollection.add(createdField); }); } - if(fieldCollection.size() > 0) { + if (fieldCollection.size() > 0) { typeFields.addAll(fieldCollection); } }); @@ -265,8 +267,9 @@ public class FieldUtil { private static UnifiedDataTypeDef constructUnifiedDataType(String uri) { GspMetadata udtMetadata = customizationService.getMetadata(uri); - if(udtMetadata == null) { - throw new RuntimeException("未获取到id为" + uri + "的统一数据类型(UDT)元数据。"); + if (udtMetadata == null) { + Object[] params = {uri}; + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("getUDTMetadataError", params)); } UnifiedDataTypeDef typeDef = (UnifiedDataTypeDef) udtMetadata.getContent(); @@ -278,7 +281,7 @@ public class FieldUtil { List enumValues = new ArrayList<>(); GspEnumValueCollection enumValueCollection = elementContext.getEnums(); - if(enumValueCollection != null && enumValueCollection.size() > 0) { + if (enumValueCollection != null && enumValueCollection.size() > 0) { enumValueCollection.forEach(item -> enumValues.add(new EnumItem(item.getValue(), item.getName()))); } @@ -298,25 +301,25 @@ public class FieldUtil { return new DateType(); case Decimal: case Integer: - return new NumericType((Integer)elementContext.getParams().get("length"), (Integer)elementContext.getParams().get("precision")); + return new NumericType((Integer) elementContext.getParams().get("length"), (Integer) elementContext.getParams().get("precision")); case Text: - return new TextType((Integer)elementContext.getParams().get("length")); + return new TextType((Integer) elementContext.getParams().get("length")); default: - return new StringType((Integer)elementContext.getParams().get("length")); + return new StringType((Integer) elementContext.getParams().get("length")); } } private static FieldEditor constructFieldEditor(TypeBuildingContext elementContext) { - if(elementContext.getObjectType() == GspElementObjectType.Enum) { + if (elementContext.getObjectType() == GspElementObjectType.Enum) { return new EnumField(); } - if(elementContext.isMultiLanguageField()) { + if (elementContext.isMultiLanguageField()) { return new LanguageTextBox(); } - if(elementContext.getObjectType() == GspElementObjectType.None) { - switch (elementContext.getDataType()){ + if (elementContext.getObjectType() == GspElementObjectType.None) { + switch (elementContext.getDataType()) { case Boolean: return new CheckBox(); case Date: diff --git a/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/util/TypeBuildingContext.java b/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/util/TypeBuildingContext.java index a8f0cbccfde048702f946c6fa83b070a9ad4ec8c..dd9eb067a64805c2c1ff43093e5ddd269af0e397 100644 --- a/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/util/TypeBuildingContext.java +++ b/approval-format/web-approval-format-core/src/main/java/com/inspur/edp/web/approvalformat/core/util/TypeBuildingContext.java @@ -115,7 +115,8 @@ public class TypeBuildingContext { public static TypeBuildingContext create(GspCommonElement element, TypeBuildingContext parentContext) { if (element.getIsUdt()) { if (StringUtils.isEmpty(element.getUdtID()) || StringUtils.isEmpty(element.getUdtID().trim())) { - throw new RuntimeException("标识为" + element.getId() + ",标签为" + element.getLabelID() + "的字段" + element.getName() + "被定义为'UnifiedDataType'字段,但是没有指定'UnifiedDataType'标识,请检查业务实体。"); + Object[] params = {element.getId(), element.getLabelID(), element.getName()}; + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("checkBEMetadata", params)); } } TypeBuildingContext context = new TypeBuildingContext() { @@ -184,7 +185,8 @@ public class TypeBuildingContext { public static TypeBuildingContext create(UdtElement udtTypeDef, TypeBuildingContext parentContext) { if (udtTypeDef.getIsUdt()) { if (StringUtility.isNullOrEmpty(udtTypeDef.getUdtID()) || StringUtility.isNullOrEmpty(udtTypeDef.getUdtID().trim())) { - throw new WebCustomException("标识为" + udtTypeDef.getId() + ",标签为" + udtTypeDef.getLabelID() + "的字段" + udtTypeDef.getName() + "被定义为'UnifiedDataType'字段,但是没有指定'UnifiedDataType'标识,请检查业务实体。"); + Object[] params = {udtTypeDef.getId(), udtTypeDef.getLabelID(), udtTypeDef.getName()}; + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("checkBEMetadata", params)); } } TypeBuildingContext typeBuildingContext = new TypeBuildingContext() { @@ -248,7 +250,8 @@ public class TypeBuildingContext { public static TypeBuildingContext createSimpleTypeContextFromAssociation(TypeBuildingContext context, TypeBuildingContext parent) { GspAssociationCollection associations = context.getAssociations(); if (associations == null || associations.size() == 0) { - throw new RuntimeException("字段" + context.getParams().get("name") + "不包含关联实体信息。"); + Object[] params = {context.getParams().get("name")}; + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("notIncludeAssociatedEntityInformation", params)); } Map params = context.getParams(); return new TypeBuildingContext() { diff --git a/approval-format/web-approval-format-rpc/src/main/java/com/inspur/edp/web/approvalformat/rpc/config/RtcValidationApproveConfiguration.java b/approval-format/web-approval-format-rpc/src/main/java/com/inspur/edp/web/approvalformat/rpc/config/RtcValidationApproveConfiguration.java index bef3553ac2a4e22fbcbf230eb72e878689cc1e40..fbaf2773800f0511643d0a2bdf349dd32bba9c84 100644 --- a/approval-format/web-approval-format-rpc/src/main/java/com/inspur/edp/web/approvalformat/rpc/config/RtcValidationApproveConfiguration.java +++ b/approval-format/web-approval-format-rpc/src/main/java/com/inspur/edp/web/approvalformat/rpc/config/RtcValidationApproveConfiguration.java @@ -56,20 +56,4 @@ public class RtcValidationApproveConfiguration { } } - -// @Bean -// public CustomFormServletFilter getCustomFormFilter() { -// return new CustomFormServletFilter(); -// } -// -// @Bean -// public FilterRegistrationBean filterRegistrationBean() { -// //注册过滤器 -// FilterRegistrationBean registrationBean = new FilterRegistrationBean<>(); -// registrationBean.setFilter(new CustomFormServletFilter()); -// -// //设置过滤器执行次序,值越小越靠后 -// registrationBean.setOrder(Integer.MIN_VALUE); -// return registrationBean; -// } } diff --git a/approval-format/web-approval-format-rpc/src/main/java/com/inspur/edp/web/approvalformat/rpc/i18n/Translator.java b/approval-format/web-approval-format-rpc/src/main/java/com/inspur/edp/web/approvalformat/rpc/i18n/Translator.java new file mode 100644 index 0000000000000000000000000000000000000000..3ded2cc06fa484cf69754de10d897099344d476f --- /dev/null +++ b/approval-format/web-approval-format-rpc/src/main/java/com/inspur/edp/web/approvalformat/rpc/i18n/Translator.java @@ -0,0 +1,31 @@ +package com.inspur.edp.web.approvalformat.rpc.i18n; + +import com.inspur.edp.web.approvalformat.rpc.i18n.utils.LanguageUtil; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import io.iec.edp.caf.i18n.api.ResourceLocalizer; + +public class Translator { + + ResourceLocalizer resource = SpringBeanUtils.getBean(ResourceLocalizer.class); + + private static Translator instance; + + private String currentLanguage = ""; + + public static Translator getInstance() { + String currentLanguage = new LanguageUtil().getLanguage(); + if (instance == null || !currentLanguage.equals(instance.currentLanguage)) { + instance = new Translator(); + } + return instance; + } + + private Translator() { + currentLanguage = new LanguageUtil().getLanguage(); + } + + public String translate(String key) { + String str = resource.getString(key, "MobileApproveFormatRpcException.properties", "pfcommon", currentLanguage); + return str; + } +} \ No newline at end of file diff --git a/approval-format/web-approval-format-rpc/src/main/java/com/inspur/edp/web/approvalformat/rpc/i18n/utils/LanguageUtil.java b/approval-format/web-approval-format-rpc/src/main/java/com/inspur/edp/web/approvalformat/rpc/i18n/utils/LanguageUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..2c1d410f7c1baf8ede51350587b667cda09f375b --- /dev/null +++ b/approval-format/web-approval-format-rpc/src/main/java/com/inspur/edp/web/approvalformat/rpc/i18n/utils/LanguageUtil.java @@ -0,0 +1,19 @@ +package com.inspur.edp.web.approvalformat.rpc.i18n.utils; + +import io.iec.edp.caf.boot.context.CAFContext; + +public class LanguageUtil { + /** + * 获取当前用户的系统语言 + * + * @return zh-CHS,en,zh-CHT + */ + public String getLanguage() { + String language = getLanguageFromExternalAPI(); + return language; + } + + private String getLanguageFromExternalAPI() { + return CAFContext.current.getLanguage(); + } +} \ No newline at end of file diff --git a/approval-format/web-approval-format-rpc/src/main/java/com/inspur/edp/web/approvalformat/rpc/rpcservice/ApprovalFormatRpcServiceImpl.java b/approval-format/web-approval-format-rpc/src/main/java/com/inspur/edp/web/approvalformat/rpc/rpcservice/ApprovalFormatRpcServiceImpl.java index 9e4c111286241e4b2a0e7186e9b7fa84befdf210..1358514818af39c2367f2114d6831b104de20292 100644 --- a/approval-format/web-approval-format-rpc/src/main/java/com/inspur/edp/web/approvalformat/rpc/rpcservice/ApprovalFormatRpcServiceImpl.java +++ b/approval-format/web-approval-format-rpc/src/main/java/com/inspur/edp/web/approvalformat/rpc/rpcservice/ApprovalFormatRpcServiceImpl.java @@ -27,6 +27,7 @@ import com.inspur.edp.cef.entity.dependenceTemp.Pagination; import com.inspur.edp.cef.entity.entity.IEntityData; import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import com.inspur.edp.metadata.rtcustomization.api.CustomizationService; +import com.inspur.edp.web.common.customexception.WebCustomException; import io.iec.edp.caf.commons.utils.SpringBeanUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -97,12 +98,12 @@ public class ApprovalFormatRpcServiceImpl implements IApprovalFormatRpcService { try { node = JsonUtil.getMapper().readTree(entityFilterStr); } catch (IOException e) { - throw new RuntimeException(e); + throw new WebCustomException("",e); } try { filter = JsonUtil.toObject(node, EntityFilter.class); } catch (Exception e) { - throw new RuntimeException( + throw new WebCustomException( MessageFormat.format("{0}", new Object[]{e.getMessage()})); } } diff --git a/approval-format/web-approval-format-rpc/src/main/java/com/inspur/edp/web/approvalformat/rpc/service/deployapprovalformat/DeployApprovalFormatImpl.java b/approval-format/web-approval-format-rpc/src/main/java/com/inspur/edp/web/approvalformat/rpc/service/deployapprovalformat/DeployApprovalFormatImpl.java index 3fda93181ecd1260b441029c4bdb2dc9127b6f98..169311c55afb2eb88d466e570fe9f34cbc2b3055 100644 --- a/approval-format/web-approval-format-rpc/src/main/java/com/inspur/edp/web/approvalformat/rpc/service/deployapprovalformat/DeployApprovalFormatImpl.java +++ b/approval-format/web-approval-format-rpc/src/main/java/com/inspur/edp/web/approvalformat/rpc/service/deployapprovalformat/DeployApprovalFormatImpl.java @@ -17,6 +17,7 @@ package com.inspur.edp.web.approvalformat.rpc.service.deployapprovalformat; import com.fasterxml.jackson.databind.JsonNode; +import com.inspur.edp.web.approvalformat.rpc.util.ApprovalFormatTranslateUtil; import com.inspur.edp.web.common.customexception.WebCustomException; import com.inspur.edp.web.jitruntimebuild.scriptcache.api.entity.ScriptCacheResponse; import com.inspur.edp.web.jitruntimebuild.scriptcache.localserver.LocalServerVersionManager; @@ -28,7 +29,7 @@ import java.util.Map; public class DeployApprovalFormatImpl implements DeployApprovalFormat { @Override public Map deployApprovalFormat(JsonNode queryStringMap) { - //两个参数 projectName 和相对地址 + // 两个参数 projectName和相对地址 String projectName = queryStringMap.get("projectName").asText(); String projectrelativepath = queryStringMap.get("projectrelativepath").asText(); @@ -40,13 +41,14 @@ public class DeployApprovalFormatImpl implements DeployApprovalFormat { if (scriptCacheResponse != null) { if (scriptCacheResponse.isSuccess()) { - result.put("flag", "true"); // 是否解析型 + // 处理成功 + result.put("flag", "true"); return result; } else { throw new WebCustomException(scriptCacheResponse.getErrorMessage()); } } else { - throw new WebCustomException("beforeNavigate 参数转换失败"); + throw new WebCustomException(ApprovalFormatTranslateUtil.getMessage("parameterConversionFailed")); } } } diff --git a/approval-format/web-approval-format-rpc/src/main/java/com/inspur/edp/web/approvalformat/rpc/util/ApprovalFormatTranslateUtil.java b/approval-format/web-approval-format-rpc/src/main/java/com/inspur/edp/web/approvalformat/rpc/util/ApprovalFormatTranslateUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..dc031cd0efd1bc0ad6adcd655cbffc6a2e081141 --- /dev/null +++ b/approval-format/web-approval-format-rpc/src/main/java/com/inspur/edp/web/approvalformat/rpc/util/ApprovalFormatTranslateUtil.java @@ -0,0 +1,29 @@ +package com.inspur.edp.web.approvalformat.rpc.util; + +import com.inspur.edp.web.approvalformat.rpc.i18n.Translator; + +import java.text.MessageFormat; + +public class ApprovalFormatTranslateUtil { + + /** + * 根据资源编号获取国际化之后的资源 + * + * @param resourceID 资源编号 + * @return 翻译之后的国际化资源 + */ + public static String getMessage(String resourceID) { + return Translator.getInstance().translate(resourceID); + } + + /** + * 根据资源编号和格式化参数获取国际化之后的资源 + * + * @param resourceID 资源编号 + * @param params 格式化参数 + * @return 翻译之后的国际化资源 + */ + public static String getMessage(String resourceID, Object[] params) { + return MessageFormat.format(Translator.getInstance().translate(resourceID), params); + } +} diff --git a/form-process/pom.xml b/form-process/pom.xml index f333cbdc7b5f8d8d79ed343b4c0aee11e862a517..75f2e35f93958446e6c699bb64baafe4d1824686 100644 --- a/form-process/pom.xml +++ b/form-process/pom.xml @@ -6,13 +6,13 @@ com.inspur.edp web - ${custom.version} + 0.1.9-SNAPSHOT ../pom.xml form-process pom - ${custom.version} + 0.1.9-SNAPSHOT web-form-process diff --git a/form-process/web-form-process/pom.xml b/form-process/web-form-process/pom.xml index f7b480b5da163a462f4a82a2098748bbab4f9e62..bf8ab992cdc85fb89d1336ab2f0f6eba9310f4ba 100644 --- a/form-process/web-form-process/pom.xml +++ b/form-process/web-form-process/pom.xml @@ -37,6 +37,13 @@ com.inspur.edp lcm-metadata-api + 0.1.23 + + + com.inspur.edp + lcm-metadata-api + 0.1.23 + compile com.inspur.edp @@ -62,7 +69,38 @@ com.inspur.edp web-form-process-api + + com.inspur.edp + dynamic-form-api + + + com.inspur.edp + dynamic-form-api + 0.0.1 + system + ${pom.basedir}/libs/dynamic-form-api.jar + + + com.inspur.edp + web-jitengine-formmetadata + + + com.inspur.edp + task-api + 0.3.34 + + + io.iec.edp + caf-runtime-framework-function-api + 0.3.7 + + + com.inspur.edp + bef-bizentity + 0.2.18 + + - + \ No newline at end of file diff --git a/form-process/web-form-process/src/main/java/com/inspur/edp/web/form/process/constant/I18nExceptionConstant.java b/form-process/web-form-process/src/main/java/com/inspur/edp/web/form/process/constant/I18nExceptionConstant.java new file mode 100644 index 0000000000000000000000000000000000000000..05ff3b53b6b830783c986d4e9c7e11d9000d6192 --- /dev/null +++ b/form-process/web-form-process/src/main/java/com/inspur/edp/web/form/process/constant/I18nExceptionConstant.java @@ -0,0 +1,8 @@ +package com.inspur.edp.web.form.process.constant; + +public class I18nExceptionConstant { + public final static String WEB_FORM_PROCESS_ERROR_0001 = "WEB_FORM_PROCESS_ERROR_0001"; + public final static String WEB_FORM_PROCESS_ERROR_0002 = "WEB_FORM_PROCESS_ERROR_0002"; + public final static String WEB_FORM_PROCESS_ERROR_0003 = "WEB_FORM_PROCESS_ERROR_0003"; + public final static String WEB_FORM_PROCESS_ERROR_0004 = "WEB_FORM_PROCESS_ERROR_0004"; +} diff --git a/form-process/web-form-process/src/main/java/com/inspur/edp/web/form/process/entity/ProcessParam.java b/form-process/web-form-process/src/main/java/com/inspur/edp/web/form/process/entity/ProcessParam.java new file mode 100644 index 0000000000000000000000000000000000000000..e66ef8027b86b785d2d55132a1b7f2f215042586 --- /dev/null +++ b/form-process/web-form-process/src/main/java/com/inspur/edp/web/form/process/entity/ProcessParam.java @@ -0,0 +1,28 @@ +package com.inspur.edp.web.form.process.entity; + + +import lombok.Data; + +@Data +public class ProcessParam { + //表单id,必须 + private String formId; + + //表单路径,必须 + private String formPath; + + //流程分类id,必须 + private String processCategory; + + //业务种类id,通过接口获取 + private String bizCategory; + + //菜单id,必须 + private String formMenu; + //菜单图片路径,可选,暂未使用 + private String iconUrl; + //描述,可选,暂未使用 + private String description; + //是否启用 + private Boolean enable; +} diff --git a/form-process/web-form-process/src/main/java/com/inspur/edp/web/form/process/service/FormProcessManager.java b/form-process/web-form-process/src/main/java/com/inspur/edp/web/form/process/service/FormProcessManager.java index 1123ae3bf4667cdcc44dc58562bbd8cb23abe769..39bbd3d251012f075a6b799a9c34bf304fbcd73a 100755 --- a/form-process/web-form-process/src/main/java/com/inspur/edp/web/form/process/service/FormProcessManager.java +++ b/form-process/web-form-process/src/main/java/com/inspur/edp/web/form/process/service/FormProcessManager.java @@ -1,20 +1,45 @@ package com.inspur.edp.web.form.process.service; +import com.fasterxml.jackson.databind.JsonNode; +import com.inspur.edp.formserver.viewmodel.GspViewModel; import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import com.inspur.edp.lcm.metadata.api.entity.GspProject; import com.inspur.edp.lcm.metadata.api.entity.MetadataHeader; import com.inspur.edp.lcm.metadata.api.service.MetadataService; import com.inspur.edp.metadata.businesstype.api.MdBizTypeMappingService; -import com.inspur.edp.wf.bizprocess.entity.FormFormat; -import com.inspur.edp.wf.bizprocess.entity.UrlParameter; +import com.inspur.edp.task.entity.ActionParameter; +import com.inspur.edp.task.entity.TaskCenterRegistry; +import com.inspur.edp.task.entity.TaskRpcDefinition; +import com.inspur.edp.web.common.customexception.WebCustomException; +import com.inspur.edp.web.common.metadata.MetadataUtility; +import com.inspur.edp.web.common.serialize.SerializeUtility; +import com.inspur.edp.web.form.process.constant.I18nExceptionConstant; +import com.inspur.edp.web.form.process.entity.ProcessParam; +import com.inspur.edp.web.form.process.utils.BEUtils; +import com.inspur.edp.web.form.process.utils.VOUtils; +import com.inspur.edp.web.formmetadata.formformat.FormFormatHandler; +import com.inspur.edp.web.formmetadata.metadata.FormMetadataContent; +import com.inspur.edp.web.formmetadata.metadata.formdom.FormDOM; +import com.inspur.edp.wf.bizprocess.entity.*; import com.inspur.edp.wf.bizprocess.service.FormFormatRpcService; +import io.iec.edp.caf.businessobject.api.entity.DevBasicBoInfo; +import io.iec.edp.caf.businessobject.api.service.DevBasicInfoService; import io.iec.edp.caf.commons.utils.SpringBeanUtils; import io.iec.edp.caf.rpc.client.RpcClassHolder; - +import io.iec.edp.caf.runtime.function.api.data.FunctionObject; +import io.iec.edp.caf.runtime.function.api.manager.FuncManager; +import com.inspur.edp.task.service.TaskCenterRegistryService; +import org.apache.commons.lang3.StringUtils; +import javax.transaction.Transactional; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class FormProcessManager { + private TaskCenterRegistryService registryService; + private FuncManager funcManager; + private DevBasicInfoService devBasicInfoService; + private static class LazyHolder { private static final FormProcessManager INSTANCE = new FormProcessManager(); } @@ -27,27 +52,99 @@ public class FormProcessManager { return LazyHolder.INSTANCE; } - public void publishFormFormat(String formId, String formPath) { - if (formPath == null || formPath.equals("")) { - throw new RuntimeException("参数path不允许为空。"); + private TaskCenterRegistryService getRegistryService() { + if (this.registryService == null) { + this.registryService = SpringBeanUtils.getBean(TaskCenterRegistryService.class); + } + return this.registryService; + } + private FuncManager getFuncManager() { + if (this.funcManager == null) { + this.funcManager = SpringBeanUtils.getBean(FuncManager.class); + } + return this.funcManager; + } + + + private DevBasicInfoService getDevBasicInfoService(){ + if (this.devBasicInfoService == null) { + this.devBasicInfoService = SpringBeanUtils.getBean(DevBasicInfoService.class); } + return this.devBasicInfoService; + } + + /** + * 发布为表单格式 + * @param formId + * @param formPath + */ + public void publishFormFormat(String formId, String formPath) { + List gspMetadataList = MetadataUtility.getInstance().getMetadataListWithDesign(formPath); String unifiedPath = formPath.replace('\\', '/'); if (unifiedPath.startsWith("/")) { unifiedPath = unifiedPath.substring(1); } - MetadataService metadataService = (MetadataService) SpringBeanUtils.getBean(MetadataService.class); - List mdList = metadataService.getMetadataList(unifiedPath); - GspMetadata md = mdList.stream().filter(item -> item.getHeader().getId().equals(formId)).findFirst().orElse(null); + //1.获取表单元数据 + GspMetadata md = gspMetadataList.stream().filter(item -> item.getHeader().getId().equals(formId)).findFirst().orElse(null); if (md == null) { - throw new RuntimeException("找不到表单元数据: " + formId + "。文件路径:" + unifiedPath + "。"); + throw new WebCustomException(I18nExceptionConstant.WEB_FORM_PROCESS_ERROR_0001, new String[]{formId, unifiedPath}); } + md = MetadataUtility.getInstance().getMetadataWithDesign(md.getHeader().getFileName(),unifiedPath); + + MetadataHeader header = md.getHeader(); + RpcClassHolder rpcHelper = SpringBeanUtils.getBean(RpcClassHolder.class); + FormFormatRpcService service = rpcHelper.getRpcClass(FormFormatRpcService.class); + MetadataService metadataService = SpringBeanUtils.getBean(MetadataService.class); + GspProject project = metadataService.getGspProjectInfo(formPath); + FormFormatHandler handler = FormFormatHandler.getFormFormatHandler(header.getType()); + + FormMetadataContent content = (FormMetadataContent) md.getContent(); + JsonNode formContent = content.getContents(); + JsonNode formRulePushModeNode = formContent.at("/options/formRulePushMode"); + String formRulePushMode = ""; + if (formRulePushModeNode != null) { + formRulePushMode = formRulePushModeNode.textValue(); + } + + // 判断是否历史数据参数 + if ("MobileForm".equals(header.getType())) { + if (formRulePushMode == null || StringUtils.isBlank(formRulePushMode) || "pushToWF".equals(formRulePushMode)) { + //查找出主表卡片页面 + JsonNode page = this.getMobilePages( md); + FormFormat formFormat = this.generateFormFormat( md,project,page); + service.addFormFormat(formFormat); + } else { + handler.pushFormFormat(md, "pf", formPath); + } + } else { + if (formRulePushMode == null || StringUtils.isBlank(formRulePushMode) || "pushToWF".equals(formRulePushMode)) { + FormFormat formFormat = this.generateFormFormat( md,project,null); + service.addFormFormat(formFormat); + } else { + handler.pushFormFormat(md, "pf", formPath); + } + } + } + + /** + * 构造表单格式信息 + * @param md + * @param project + * @return + */ + private FormFormat generateFormFormat(GspMetadata md,GspProject project,JsonNode page){ MetadataHeader header = md.getHeader(); - GspProject project = metadataService.getGspProjectInfo(unifiedPath); String deploymentPath = project.getSuDeploymentPath(); String projectName = project.getMetadataProjectName().toLowerCase(); String url = "/" + deploymentPath + "/web/" + projectName + "/index.html#/" + header.getCode(); + + if ("MobileForm".equals(header.getType())) { + String uri = page.get("route").get("uri").asText(); + url = "/" + deploymentPath + "/mob/" + projectName + "/index.html#/" + header.getCode()+ "/" + uri; + } + FormFormat ff = new FormFormat(); - ff.setId(formId); + ff.setId(header.getId()); ff.setCode(header.getCode()); ff.setName(header.getName()); ff.setUrlType("url"); @@ -55,7 +152,11 @@ public class FormProcessManager { UrlParameter actionParam = new UrlParameter(); actionParam.setCode("action"); actionParam.setName("动作"); - actionParam.setValue("LoadAndView1"); + if ("MobileForm".equals(header.getType())) { + actionParam.setValue("LoadAndEditForCard"); + }else{ + actionParam.setValue("LoadAndView1"); + } UrlParameter idParam = new UrlParameter(); idParam.setCode("id"); idParam.setName("内码"); @@ -66,9 +167,25 @@ public class FormProcessManager { String boId = project.getBizobjectID(); ff.setBizCategory(getBizTypeId(boId)); ff.setTerminal("PC"); - RpcClassHolder rpcHelper = (RpcClassHolder) SpringBeanUtils.getBean(RpcClassHolder.class); - FormFormatRpcService service = (FormFormatRpcService) rpcHelper.getRpcClass(FormFormatRpcService.class); - service.addFormFormat(ff); + + if ("MobileForm".equals(header.getType())) { + ff.setTerminal("Mobile"); + MobileWFFormFormatManager mobileWFFormFormatManager = MobileWFFormFormatManager.getInstance(); + FormMetadataContent content = (FormMetadataContent) md.getContent(); + JsonNode formContent = content.getContents(); + // 提取按钮 + List btnList = mobileWFFormFormatManager.getButtons(formContent, ff.getId()); + ff.setFormButtons(btnList); + // 提取字段 + List fields = mobileWFFormFormatManager.getFields(formContent, ff.getId()); + ff.setFormFields(fields); + // 提取方法,暂时未用到 +// List methods = mobileWFFormFormatManager.getMethods(formContent, ff.getId()); +// ff.setFormMethods(methods); + + } + + return ff; } private String getBizTypeId(String bizObjectId) { @@ -76,5 +193,192 @@ public class FormProcessManager { List bizTypeIds = service.getBizTypeIdsByBoId(bizObjectId); return (bizTypeIds == null || bizTypeIds.size() == 0) ? "" : bizTypeIds.get(0); } + + /** + * 获取移动主表卡片页面 + * @param md + * @return + */ + private JsonNode getMobilePages(GspMetadata md){ + JsonNode result = null; + + FormMetadataContent content = (FormMetadataContent) md.getContent(); + JsonNode formContent = content.getContents(); + + JsonNode components = formContent.get("module").get("components"); + JsonNode viewmodels = formContent.get("module").get("viewmodels"); + + if(components != null && components.size() > 0 && viewmodels != null && viewmodels.size() > 0 ){ + for(JsonNode component:components){ + //页面 + if(component.get("componentType") == null || !component.get("componentType").asText().equals("Page") ){ + continue; + } + //卡片 + if(component.get("pageType") == null || !component.get("pageType").asText().equals("Card")){ + continue; + } + //有路由地址 + if(component.get("route") == null || component.get("route").get("uri") == null){ + continue; + } + //主表 + for(JsonNode viewmodel:viewmodels){ + if(viewmodel.get("id") == null || !viewmodel.get("id").equals(component.get("viewModel"))){ + continue; + } + if(viewmodel.get("bindTo") == null || viewmodel.get("bindTo").asText().equals("") || viewmodel.get("bindTo").asText().equals("/") ){ + result = component; + + } + } + if(result != null){ + break; + } + } + } + return result; + } + + + /** + * 注册流程到流程中心 + * @param param + * @return + */ + @Transactional + public boolean mobileRegisterToProccessCenter(ProcessParam param) { + String formPath = param.getFormPath(); + List gspMetadataList = MetadataUtility.getInstance().getMetadataListWithDesign(formPath); + String unifiedPath = formPath.replace('\\', '/'); + if (unifiedPath.startsWith("/")) { + unifiedPath = unifiedPath.substring(1); + } + //1.获取设计时表单元数据 + GspMetadata formMetadata = gspMetadataList.stream().filter(item -> item.getHeader().getId().equals(param.getFormId())).findFirst().orElse(null); + if (formMetadata == null) { + throw new WebCustomException(I18nExceptionConstant.WEB_FORM_PROCESS_ERROR_0001, new String[]{param.getFormId(), unifiedPath}); + } + formMetadata = MetadataUtility.getInstance().getMetadataWithDesign(formMetadata.getHeader().getFileName(),unifiedPath); + FormMetadataContent content = (FormMetadataContent) formMetadata.getContent(); + JsonNode formContent = content.getContents(); + String voId = formContent.at("/module/schemas/0/id").textValue(); + if(StringUtils.isBlank(voId)){ + throw new WebCustomException(I18nExceptionConstant.WEB_FORM_PROCESS_ERROR_0002); + } + + //2.设计时获取vo,草稿使用 + GspMetadata voMetadata = gspMetadataList.stream().filter(item -> item.getHeader().getId().equals(voId)).findFirst().orElse(null); + if(voMetadata != null){ + voMetadata = MetadataUtility.getInstance().getMetadataWithDesign(voMetadata.getHeader().getFileName(),unifiedPath); + } + + //3.设计时获取be,草稿需要 + GspMetadata beMetadata = null; + String beId = ""; + String backProjectPath = ""; + String bePath = ""; + if(voMetadata != null ){ + bePath = unifiedPath.replace("-front/metadata/components","-back/metadata/be"); + backProjectPath = unifiedPath.replace("-front/metadata/components","-back/metadata"); + + List backMetadataList = MetadataUtility.getInstance().getMetadataListWithDesign(bePath); + String curBeId = ((GspViewModel) voMetadata.getContent()).getMapping().getTargetMetadataId(); + beId = curBeId; + if(StringUtils.isNotBlank(beId) && backMetadataList !=null && backMetadataList.size() > 0){ + beMetadata = backMetadataList.stream().filter(item -> item.getHeader().getId().equals(curBeId)).findFirst().orElse(null); + if(beMetadata != null){ + beMetadata = MetadataUtility.getInstance().getMetadataWithDesign(beMetadata.getHeader().getFileName(),bePath); + } + } + } + + //4.注册到流程中心 + this.addTaskRegistry(param,beMetadata); + + //5.处理be和vo添加草稿构件的逻辑。 + if(voMetadata !=null){ + if(beMetadata != null){ + //表单和be、vo在同一个工程下,在vo和be上添加构件 + boolean needAddDraftCmp = BEUtils.addDraftCmpAndSave(beMetadata, true,backProjectPath); + if (needAddDraftCmp) { + VOUtils.addDraftCmp(param, beMetadata,voMetadata); + } + }else if(StringUtils.isNotBlank(beId)){ + //如果表单和be不在同一个工程下 + beMetadata = MetadataUtility.getInstance().getMetadataInRuntime(beId); + boolean needAddDraftCmp = BEUtils.addDraftCmpAndSave(beMetadata, false,backProjectPath); + if (needAddDraftCmp) { + VOUtils.addDraftCmp(param, beMetadata,voMetadata); + } + } + } + + + return true; + } + + /** + * 注册到流程中心 + * @param param + */ + private void addTaskRegistry(ProcessParam param,GspMetadata beMetadata) { + String menuId = param.getFormMenu(); + //1.新建实体,并设置属性值 + TaskCenterRegistry registry = new TaskCenterRegistry(); + registry.setProcessCategory(param.getProcessCategory()); //流程分类id,必须 + registry.setIcon("");//图标,可选 + registry.setDescription(param.getDescription()); //流程描述,可选 + registry.setBizCategory(param.getBizCategory());//业务种类id + registry.setUrlType("app"); + registry.setFormUrl(menuId); + registry.setTerminal("mobile");//启用终端,web:PC端;app:移动端 + FunctionObject menu = this.getFuncManager().getFunc(menuId); + if (menu == null) { + throw new WebCustomException(I18nExceptionConstant.WEB_FORM_PROCESS_ERROR_0003, new String[]{menuId}); + } + registry.setBizOperationId(menu.getBizOpId()); + registry.setEnable(param.getEnable());//是否启用,必须 + + //2.设置打开制单页面需要的参数(可选) + ArrayList actionParameters = new ArrayList<>(); + ActionParameter actionParameter = new ActionParameter("action", "LoadAndAddForCard"); + actionParameters.add(actionParameter); + ActionParameter backUrlParameter = new ActionParameter("backUrl", "/platform/runtime/wf/webapp/proc-center-mobile/index.html"); + actionParameters.add(backUrlParameter); + registry.setFormParams(actionParameters); // 设置打开制单页面需要的参数 + + //3.设置打开草稿页面需要的参数(使用我的草稿时预置,可选) + ArrayList draftParams = new ArrayList<>(); + ActionParameter mobileEditParam = new ActionParameter("action", "LoadAndEditForCard"); + draftParams.add(mobileEditParam); + draftParams.add(backUrlParameter); + + + draftParams.add(new ActionParameter("id", "${TaskDraft.dataId}")); + registry.setDraftParams(draftParams); + + //4.设置删除草稿的rpc接口地址(使用我的草稿时预置,可选) + if(beMetadata != null){ + DevBasicBoInfo devBasicBoInfo = this.getDevBasicInfoService().getDevBasicBoInfo(beMetadata.getHeader().getBizobjectID()); + String suCode = devBasicBoInfo.getSuCode(); + TaskRpcDefinition taskRpcDefinition = new TaskRpcDefinition(); + taskRpcDefinition.setSuCode(suCode);//su code + taskRpcDefinition.setServiceId("com.inspur.common.component.api.service.draft.service.ITaskDraftCallBackService.delete");//删除业务单据的serviceId + ArrayList rpcParams = new ArrayList<>();//删除接口需要的参数 + // 顺序必须是 beId id。 + rpcParams.add(new ActionParameter("beId", beMetadata.getHeader().getId())); + rpcParams.add(new ActionParameter("id", "${TaskDraft.dataId}"));//变量取值,表示取草稿的数据id + taskRpcDefinition.setParameters(rpcParams); + registry.setBizInstDeleteRpc(taskRpcDefinition); + } + + //5.调用RPC,执行新增 + TaskCenterRegistry taskEntity = this.getRegistryService().addTaskCenterRegistry(registry); + if (taskEntity == null) { + throw new WebCustomException(I18nExceptionConstant.WEB_FORM_PROCESS_ERROR_0004, new String[]{menu.getName()}); + } + } + } diff --git a/form-process/web-form-process/src/main/java/com/inspur/edp/web/form/process/service/FormProcessWebService.java b/form-process/web-form-process/src/main/java/com/inspur/edp/web/form/process/service/FormProcessWebService.java index 9fe63fdac8ea44c195f34f19249c489c46d43641..5e68d10a1bf212225ea17ae7d24988af3e51f744 100755 --- a/form-process/web-form-process/src/main/java/com/inspur/edp/web/form/process/service/FormProcessWebService.java +++ b/form-process/web-form-process/src/main/java/com/inspur/edp/web/form/process/service/FormProcessWebService.java @@ -1,4 +1,6 @@ package com.inspur.edp.web.form.process.service; + import com.inspur.edp.web.form.process.entity.ProcessParam; + import javax.ws.rs.*; @Path("/") @@ -10,5 +12,11 @@ public void publishFormFormat(@QueryParam("id") String formId, @QueryParam("path") String path) { FormProcessManager.getInstance().publishFormFormat(formId, path); } + + @Path("/mobile-register-proccess") + @POST + public void mobileRegisterToProccessCenter(ProcessParam param) { + FormProcessManager.getInstance().mobileRegisterToProccessCenter(param); + } } diff --git a/form-process/web-form-process/src/main/java/com/inspur/edp/web/form/process/service/MobileWFFormFormatManager.java b/form-process/web-form-process/src/main/java/com/inspur/edp/web/form/process/service/MobileWFFormFormatManager.java new file mode 100644 index 0000000000000000000000000000000000000000..5942cecc6e9a11038669819cc6f12873f3da85ea --- /dev/null +++ b/form-process/web-form-process/src/main/java/com/inspur/edp/web/form/process/service/MobileWFFormFormatManager.java @@ -0,0 +1,322 @@ +package com.inspur.edp.web.form.process.service; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.inspur.edp.dynamic.form.api.model.FarrisContainerType; +import com.inspur.edp.dynamic.form.api.model.FormButtonTree; +import com.inspur.edp.wf.bizprocess.entity.FormButton; +import com.inspur.edp.wf.bizprocess.entity.FormField; +import com.inspur.edp.wf.bizprocess.entity.FormFieldData; + +import java.util.*; + +/** + * 移动低代码表单把按钮和字段,推送到工作流。 + */ +public class MobileWFFormFormatManager { + private MobileWFFormFormatManager() { + } + + /** + * 静态单例属性 + */ + private static final MobileWFFormFormatManager Instance = new MobileWFFormFormatManager(); + + + + public static MobileWFFormFormatManager getInstance() { + return MobileWFFormFormatManager.Instance; + } + + public List getButtons(JsonNode formContent, String formatId) { + // 递归 找 Toolbar,Button + JsonNode componentArr = formContent.at("/module/components"); + FormButtonTree buttonTree = new FormButtonTree(); + componentArr.forEach(component->{ + //跳过列表页 + if( component.get("componentType") != null && "Page".equals(component.get("componentType").asText()) + && ( component.get("pageType") == null || !"Card".equals(component.get("pageType").asText())) ){ + return; + } + searchComponentsForButton(component, buttonTree, formatId); + }); + + List buttonList = new ArrayList<>(); + buttonTree.getChildren().forEach(tree -> buttonList.addAll(tree.getChildButtons())); + return buttonList; + } + + private void searchComponentsForButton(JsonNode root, FormButtonTree buttonTree, String formatId) { + if(root.isArray()) { + for (JsonNode jsonNode : root) { + searchComponentsForButton(jsonNode, buttonTree, formatId); + } + } + if(root.isObject()){ + JsonNode type = root.get("type"); + //"NavigationBar", + if(type != null && Arrays.asList("ListView","ToolBarArea","ToolBar","Button","ButtonGroup","Card","LightAttachment").contains(type.asText())){ + this.findButtons(root, buttonTree, formatId); + } else if(type != null && Arrays.asList("NavigationBar").contains(type.asText())) { + //导航栏不做处理 + }else { + Iterator fieldNames = root.fieldNames(); + while(fieldNames.hasNext()) { + String fieldName = fieldNames.next(); + JsonNode fieldValue = root.get(fieldName); + if(fieldValue.isArray() || fieldValue.isObject()){ + searchComponentsForButton(fieldValue, buttonTree, formatId); + } + } + } + } + } + + private void findButtons(JsonNode node, FormButtonTree buttonTree, String formatId){ + JsonNode type = node.get("type"); + switch (type.asText()){ + case "NavigationBar":{ + JsonNode toolbar = node.get("toolbar"); + if(null == toolbar){ + break; + } + ArrayNode items = (ArrayNode) toolbar.get("items"); + if(items !=null && items.size() > 0 ){ + this.findComplexButtons( items, node , buttonTree, formatId); + } + break; + } + case "ListView":{ + JsonNode swipeToolbar = node.get("swipeToolbar"); + if(null == swipeToolbar){ + break; + } + ArrayNode items = (ArrayNode) swipeToolbar.get("items"); + if(items !=null && items.size() > 0 ){ + this.findComplexButtons( items, node , buttonTree, formatId); + } + break; + } + case "ToolBarArea": + case "ToolBar":{ + ArrayNode items = (ArrayNode) node.get("items"); + ArrayNode contents = (ArrayNode) node.get("contents"); + if((null == items || items.size() == 0 ) && contents.size() > 0){ + searchComponentsForButton(contents, buttonTree, formatId); + break; + } + if(items != null && items.size() > 0 ){ + this.findComplexButtons( items, node , buttonTree, formatId); + } + } + case "Button":{ + findSingleButton(node, buttonTree, formatId); + break; + } + case "ButtonGroup":{ + ArrayNode items = (ArrayNode) node.get("items"); + if(items != null && items.size() > 0 ){ + this.findComplexButtons( items, node , buttonTree, formatId); + } + break; + } + case "Card":{ + ArrayNode items = (ArrayNode) node.get("actions"); + if(items != null && items.size() > 0 ){ + this.findComplexButtons( items, node , buttonTree, formatId); + } + break; + } + case "LightAttachment":{ + this.findLightAttachmentButton( node , buttonTree, formatId); + break; + } + + } + } + + /** + * 查找简单按钮 + * @param node + * @param formButtonTree + * @param formatId + */ + private void findSingleButton(JsonNode node, FormButtonTree formButtonTree, String formatId) { + FormButtonTree treeNode = new FormButtonTree(); + // button 当前没有分组信息,用方法名暂时做分组名 + FormButton parent = new FormButton(); + parent.setId(UUID.randomUUID().toString()); + parent.setButtonId(node.get("id").asText()); + parent.setButtonName(node.get("click")==null?"":node.get("click").asText()); + treeNode.setData(parent); + + FormButtonTree childNode = new FormButtonTree(); + FormButton buttonData = new FormButton(); + buttonData.setId(UUID.randomUUID().toString()); + buttonData.setButtonId(node.get("id").asText()); + if(node.get("text") != null){ + buttonData.setButtonName(node.get("text").asText()); + }else if(node.get("title") != null){ + buttonData.setButtonName(node.get("title").asText()); + }else{ + buttonData.setButtonName("按钮"); + } + buttonData.setFormFormatId(formatId); + childNode.setData(buttonData); + + treeNode.getChildren().add(childNode); + formButtonTree.getChildren().add(treeNode); + } + + /** + * 查找复杂按钮 + * @param childNodes 按钮项 + * @param parentNode 按钮父级信息(可能父父级) + * @param formButtonTree + * @param formatId + */ + private void findComplexButtons(ArrayNode childNodes, JsonNode parentNode , FormButtonTree formButtonTree, String formatId){ + FormButtonTree treeNode = new FormButtonTree(); + FormButton parent = new FormButton(); + parent.setId(UUID.randomUUID().toString()); + parent.setButtonId(parentNode.get("id").asText()); + String title= parentNode.get("title") == null?"卡片":parentNode.get("title").textValue(); + parent.setButtonName(title); + + treeNode.setData(parent); + childNodes.forEach(item -> { + FormButtonTree button = new FormButtonTree(); + FormButton buttonData = new FormButton(); + buttonData.setId(UUID.randomUUID().toString()); + buttonData.setButtonId(item.get("id").asText()); + if(item.get("text") != null){ + buttonData.setButtonName(item.get("text").asText()); + }else if(item.get("title") != null){ + buttonData.setButtonName(item.get("title").asText()); + }else{ + buttonData.setButtonName("按钮"); + } + buttonData.setFormFormatId(formatId); + button.setData(buttonData); + treeNode.getChildren().add(button); + }); + formButtonTree.getChildren().add(treeNode); + } + + /** + * 查找附件 + * @param node + * @param formButtonTree + * @param formatId + */ + private void findLightAttachmentButton(JsonNode node, FormButtonTree formButtonTree, String formatId) { + FormButtonTree treeNode = new FormButtonTree(); + FormButton parent = new FormButton(); + parent.setId(UUID.randomUUID().toString()); + parent.setButtonId(node.get("id").asText()); + String title= node.get("title") == null?"卡片":node.get("title").textValue(); + parent.setButtonName(title); + treeNode.setData(parent); + + FormButtonTree button_add = new FormButtonTree(); + FormButton buttonData_add = new FormButton(); + buttonData_add.setId(UUID.randomUUID().toString()); + buttonData_add.setButtonId(node.get("id").asText() + "_attachment_upload_btn"); + buttonData_add.setButtonName(node.get("text") == null ?"附件上传按钮":node.get("text").asText()+"上传按钮"); + buttonData_add.setFormFormatId(formatId); + button_add.setData(buttonData_add); + treeNode.getChildren().add(button_add); + + FormButtonTree button_remove = new FormButtonTree(); + FormButton buttonData_remove = new FormButton(); + buttonData_remove.setId(UUID.randomUUID().toString()); + buttonData_remove.setButtonId(node.get("id").asText() + "_attachment_delete_btn"); + buttonData_remove.setButtonName(node.get("text") == null ?"附件删除按钮":node.get("text").asText()+"删除按钮"); + buttonData_remove.setFormFormatId(formatId); + button_remove.setData(buttonData_remove); + treeNode.getChildren().add(button_remove); + + formButtonTree.getChildren().add(treeNode); + } + + + public List getFields(JsonNode formContent, String formatId) { + FormFieldData root = new FormFieldData(); + JsonNode viewModelArr = formContent.at("/module/viewmodels"); + JsonNode componentArr = formContent.at("/module/components"); + componentArr.forEach(cmp -> { + //找出卡片页面 + if( cmp.get("componentType") != null && "Page".equals(cmp.get("componentType").asText()) + && cmp.get("pageType") != null && "Card".equals(cmp.get("pageType").asText()) ){ + // module/components的节点都有componentType属性 + FormFieldData containerData = new FormFieldData(); + + FormField container = new FormField(); + container.setId(UUID.randomUUID().toString()); + container.setFieldId(cmp.get("id").asText()); + container.setFieldName(cmp.get("title").asText()); + + containerData.setData(container); + containerData.setChildren(new ArrayList<>()); + + root.getChildren().add(containerData); + JsonNode form = this.findForm( cmp); + if(form !=null && form.get("contents") !=null ){ + extractFormControls(form.get("contents"), containerData, formatId); + } + } + }); + return root.getChildren(); + } + + + private void extractFormControls(JsonNode controls, FormFieldData containerData, String formatId) { + if(controls != null && controls.size() > 0){ + FormFieldData fieldData; + JsonNode child; + for(int index = 0; index < controls.size(); index ++){ + child = controls.get(index); + FormField field = new FormField(); + field.setId(UUID.randomUUID().toString()); + field.setFieldId(child.get("id").asText()); + field.setFieldName(child.get("title").asText()); + field.setFormFormatId(formatId); + fieldData = new FormFieldData(); + fieldData.setData(field); + fieldData.setChildren(new ArrayList<>()); + // 如果是fieldset 就把它的contents继续 + if(FarrisContainerType.FieldSet.name().equals(child.get("type").asText())){ + extractFormControls(child.get("contents"), fieldData, formatId); + } + containerData.getChildren().add(fieldData); + } + } + } + + private Map findPageNames(JsonNode viewModelArr){ + Map map = new HashMap<>(); + viewModelArr.forEach(vm -> { + map.put(vm.get("id").asText(), vm.get("name").asText()); + }); + return map; + } + + private JsonNode findForm(JsonNode cmp){ + if(cmp == null ){ + return null; + } + if("Form".equals(cmp.get("type").asText())){ + return cmp; + } + JsonNode result = null; + if(cmp.get("contents") != null && cmp.get("contents").isArray()){ + for(JsonNode content:cmp.get("contents")) { + result = this.findForm(content); + if (result != null) { + break; + } + } + } + return result; + } +} diff --git a/form-process/web-form-process/src/main/java/com/inspur/edp/web/form/process/utils/BEUtils.java b/form-process/web-form-process/src/main/java/com/inspur/edp/web/form/process/utils/BEUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..17ac65c44bf761cc157752d7d85c0d1f92eb30a2 --- /dev/null +++ b/form-process/web-form-process/src/main/java/com/inspur/edp/web/form/process/utils/BEUtils.java @@ -0,0 +1,215 @@ +package com.inspur.edp.web.form.process.utils; + + +import com.inspur.edp.bef.bizentity.GspBusinessEntity; +import com.inspur.edp.bef.bizentity.operation.BizCommonDetermination; +import com.inspur.edp.cef.designtime.api.IGspCommonField; +import com.inspur.edp.cef.designtime.api.collection.CommonDtmCollection; +import com.inspur.edp.cef.designtime.api.element.GspElementDataType; +import com.inspur.edp.cef.designtime.api.operation.CommonDetermination; +import com.inspur.edp.cef.designtime.api.operation.ExecutingDataStatus; +import com.inspur.edp.cef.designtime.api.variable.CommonVariable; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.bef.bizentity.common.BizEntityAtionUtil; +import com.inspur.edp.lcm.metadata.api.service.MdpkgService; +import com.inspur.edp.web.common.metadata.MetadataUtility; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; + +import java.util.*; + +public class BEUtils { + private static final String BEFORESAVE_COMPONENTID = "50914966-674a-43d5-9935-df726cfd51a6"; + private static final String DELETE_COMPONENTID = "d4h18e5f-4cq7-497g-b018-s41220zv145k"; + private static final String BEFORESAVE_DETERMINATION_ID = "6b3f4f6a-26f2-4199-8159-e36435c63245"; + private static final String DELETE_DETERMINATION_ID = "0e7d3731-049b-49b9-9e46-2046ef957843"; + + /** + * 添加草稿相关构件到be元数据。 + * + * @param beMeta 需要添加构件的be元数据 + * @param canAddCmp 是否需要给be添加构件 + * @param backProjectPath 后端工程路径 + * @return 是否添加 + */ + public static boolean addDraftCmpAndSave(GspMetadata beMeta, boolean canAddCmp,String backProjectPath) { + if (beMeta == null) { + return false; + } + GspBusinessEntity be = (GspBusinessEntity) beMeta.getContent(); + if (be == null) { + return false; + } + + if (existDraftCmp(be) && existVariables(be)) { + return true; + } + + if(canAddCmp){ + addDepedency(backProjectPath); + addActions(be); + MetadataUtility.getInstance().saveMetadataWithDesign(beMeta); + return true; + } + return false; + } + + /** + * 是否存在变量 + * @param be + * @return + */ + private static boolean existVariables(GspBusinessEntity be) { + List variables = Arrays.asList("befTaskDraftBeId","befTaskDraftProcessCategory","befTaskDraftBizCategory","befTaskDraftSummary","befTaskDraftEnableDelDtm"); + boolean isExistedVar = true; + for(String variable:variables){ + if(!isExistedVariable(be, variable)){ + isExistedVar = false; + } + } + return isExistedVar; + } + + /** + * 是否存在构件 + * @param be + * @return + */ + private static boolean existDraftCmp(GspBusinessEntity be) { + CommonDtmCollection commonDeterminations = be.getMainObject().getDtmBeforeSave(); + boolean existSave = false; + boolean existDelete = false; + + for (CommonDetermination commonDetermination : commonDeterminations) { + if (BEFORESAVE_COMPONENTID.equals(commonDetermination.getComponentId())) { + existSave = true; + } + if (DELETE_COMPONENTID.equals(commonDetermination.getComponentId())) { + existDelete = true; + } + } + return existSave && existDelete; + } + + /** + * 添加依赖 + * @param backProjectPath + */ + private static void addDepedency(String backProjectPath) { + MdpkgService mdpkgService = SpringBeanUtils.getBean(MdpkgService.class); + List metadataPackages = Arrays.asList("Inspur.Gsp.Common.CommonCmp"); + mdpkgService.addDepedencyAndRestore(backProjectPath,metadataPackages); + } + + public static void addActions(GspBusinessEntity be) { + addDtm(be); + addVariables(be); + } + + /** + * 添加保存前事件 + * @param be + */ + public static void addDtm(GspBusinessEntity be) { + boolean isExistedBeforeSave = isExistedDtm(be, "50914966-674a-43d5-9935-df726cfd51a6"); + if (!isExistedBeforeSave) { + BizCommonDetermination beforeSaveDtm = new BizCommonDetermination(); + beforeSaveDtm.setID(BEFORESAVE_DETERMINATION_ID); + beforeSaveDtm.setCode("DraftBeforeSaveDtm"); + beforeSaveDtm.setName("DraftBeforeSaveDtm"); + beforeSaveDtm.setComponentId("50914966-674a-43d5-9935-df726cfd51a6"); + beforeSaveDtm.setComponentName("DraftBeforeSaveDetermination"); + beforeSaveDtm.setIsGenerateComponent(false); + beforeSaveDtm.setGetExecutingDataStatus(EnumSet.of(ExecutingDataStatus.forValue(1))); + be.getMainObject().getDtmBeforeSave().add(beforeSaveDtm); + } + + boolean isExistedDelete = isExistedDtm(be, "d4h18e5f-4cq7-497g-b018-s41220zv145k"); + if (!isExistedDelete) { + BizCommonDetermination deleteDtm = new BizCommonDetermination(); + deleteDtm.setID(DELETE_DETERMINATION_ID); + deleteDtm.setCode("DraftDeleteDtm"); + deleteDtm.setName("DraftDeleteDtm"); + deleteDtm.setComponentId("d4h18e5f-4cq7-497g-b018-s41220zv145k"); + deleteDtm.setComponentName("DraftDeleteDetermination"); + deleteDtm.setGetExecutingDataStatus(EnumSet.of(ExecutingDataStatus.forValue(4))); + deleteDtm.setIsGenerateComponent(false); + be.getMainObject().getDtmBeforeSave().add(deleteDtm); + } + + } + + private static CommonVariable getCommonVariable(String varCode, GspElementDataType dataType) { + CommonVariable variable = new CommonVariable(); + variable.setID(UUID.randomUUID().toString()); + variable.setCode(varCode); + variable.setName(varCode); + variable.setMDataType(dataType); + variable.setLabelID(varCode); + variable.setLength(36); + variable.setEnableRtrim(true); + return variable; + } + + /** + * 添加变量 + * @param be + */ + private static void addVariables(GspBusinessEntity be) { + addVariable(be, "befTaskDraftBeId", GspElementDataType.String); + addVariable(be, "befTaskDraftProcessCategory", GspElementDataType.String); + addVariable(be, "befTaskDraftBizCategory", GspElementDataType.String); + addVariable(be, "befTaskDraftSummary", GspElementDataType.String); + addVariable(be, "befTaskDraftEnableDelDtm", GspElementDataType.Boolean); + } + + private static void addVariable(GspBusinessEntity be, String varCode, GspElementDataType dataType) { + boolean isExistedVar = isExistedVariable(be, varCode); + if (!isExistedVar) { + CommonVariable var = getCommonVariable(varCode, dataType); + be.getVariables().getContainElements().addField(var); + } + } + + private static boolean isExistedVariable(GspBusinessEntity vm, String varCode) { + boolean isExistedVariable = false; + if (vm.getVariables().getContainElements() == null || vm.getVariables().getContainElements().size() == 0) { + isExistedVariable = false; + return isExistedVariable; + } + + Iterator var3 = vm.getVariables().getContainElements().iterator(); + + while(var3.hasNext()) { + IGspCommonField variable = (IGspCommonField)var3.next(); + if (varCode.equals(variable.getCode())) { + isExistedVariable = true; + break; + } + } + + return isExistedVariable; + } + + private static boolean isExistedDtm(GspBusinessEntity be, String componentId) { + boolean isExist = false; + if (be.getMainObject().getDtmBeforeSave() == null || be.getMainObject().getDtmBeforeSave().size() == 0) { + isExist = false; + return isExist; + } + + Iterator var3 = be.getMainObject().getDtmBeforeSave().iterator(); + + while(var3.hasNext()) { + BizCommonDetermination action = (BizCommonDetermination)var3.next(); + if (componentId.equals(action.getComponentId())) { + isExist = true; + break; + } + } + + return isExist; + } + + + +} diff --git a/form-process/web-form-process/src/main/java/com/inspur/edp/web/form/process/utils/VOUtils.java b/form-process/web-form-process/src/main/java/com/inspur/edp/web/form/process/utils/VOUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..ba09afaacbc25285589143a334ebd6b1bc6e622f --- /dev/null +++ b/form-process/web-form-process/src/main/java/com/inspur/edp/web/form/process/utils/VOUtils.java @@ -0,0 +1,28 @@ +package com.inspur.edp.web.form.process.utils; + + +import com.inspur.edp.formserver.viewmodel.GspViewModel; +import com.inspur.edp.formserver.viewmodel.common.ViewModelActionUtil; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.web.common.metadata.MetadataUtility; +import com.inspur.edp.web.form.process.entity.ProcessParam; + +public class VOUtils { + + /** + * 添加草稿相关构件到vo元数据。 + *

注意这里会立即保存vo元数据。

+ * + * @param app 流程信息。 + * @param beMetadata be元数据。 + * @param voMd vo元数据。 + */ + public static void addDraftCmp(ProcessParam app, GspMetadata beMetadata,GspMetadata voMd) { + // 给vo添加存储参数的变量 + String processCategory = app.getProcessCategory(); + String bizCategory = app.getBizCategory(); + ViewModelActionUtil.addVoActions((GspViewModel) voMd.getContent(), beMetadata.getHeader().getId(), processCategory, bizCategory, null); + MetadataUtility.getInstance().saveMetadataWithDesign(voMd); + } + +} diff --git a/form-process/web-form-process/src/main/resources/META-INF/spring.factories b/form-process/web-form-process/src/main/resources/META-INF/spring.factories new file mode 100644 index 0000000000000000000000000000000000000000..586f9dfb43e218df8a7ab16223998142254496e6 --- /dev/null +++ b/form-process/web-form-process/src/main/resources/META-INF/spring.factories @@ -0,0 +1,2 @@ +org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ +com.inspur.edp.web.form.process.config.FormProcessConfiguration diff --git a/i18n/server/platform/common/resources/WebErrorCode.properties b/i18n/server/platform/common/resources/WebErrorCode.properties new file mode 100644 index 0000000000000000000000000000000000000000..69f63e263d5082fe4215c435852c56e0ddfee963 --- /dev/null +++ b/i18n/server/platform/common/resources/WebErrorCode.properties @@ -0,0 +1,267 @@ +WEB_COMMON_ERROR_0001=编码失败:{0} +WEB_COMMON_ERROR_0002=base64Decode失败 +WEB_COMMON_ERROR_0003=未知的数据类型转换成TerminalType,对应数据类型为:{0} +WEB_COMMON_ERROR_0004=获取工程信息出现错误 +WEB_COMMON_ERROR_0005=元数据请求参数,目标元数据参数不能为空 +WEB_COMMON_ERROR_0006=当前元数据非命令元数据。元数据id是:{0} +WEB_COMMON_ERROR_0007=标识为{0}的服务构件为null。 +WEB_COMMON_ERROR_0008=不支持的操作系统类型,请联系开发人员处理 +WEB_COMMON_ERROR_0009=未识别的操作系统系统。请联系开发人员处理。 +WEB_COMMON_ERROR_0010=未识别的终端类型,请联系管理员处理。当前终端类型是:{0} + +WEB_FRONT_PROJECT_ERROR_0001=页面流文件(后缀为.pf)中包含绝对路径,依赖于单个环境路径配置,请调整为相对路径。具体操作:打开页面流文件,通过将表单从页面流中先移除再添加的方式,自动进行调整。 对应表单元数据为:{0},当前绝对路径为:{1} +WEB_FRONT_PROJECT_ERROR_0002=页面流文件(后缀为.pf)中配置表单元数据路径不正确,请移除。对应表单元数据code:{0},name: {1} +#WEB_FRONT_PROJECT_ERROR_0003=未识别的终端类型,请联系管理员处理。当前终端类型是:{0} +WEB_FRONT_PROJECT_ERROR_0004=表单元数据提取,buildFormList参数不能为空 +WEB_FRONT_PROJECT_ERROR_0005=请设置默认首页参数 +WEB_FRONT_PROJECT_ERROR_0006=请设置路由参数 +WEB_FRONT_PROJECT_ERROR_0007=默认首页参数必须以index.html作为后缀,请修正! +WEB_FRONT_PROJECT_ERROR_0008=请设置正确的路径参数,例如:apps/scm/sd/sales/index.html +WEB_FRONT_PROJECT_ERROR_0009=零代码编译入参不能为null +WEB_FRONT_PROJECT_ERROR_0010=零代码编译入参路径参数absoluteBasePath不能为空 +WEB_FRONT_PROJECT_ERROR_0011=零代码编译入参工程名称projectName不能为空 +WEB_FRONT_PROJECT_ERROR_0012=零代码编译入参依赖node_modules 路径不能为空 +WEB_FRONT_PROJECT_ERROR_0013=零代码编译入参,至少包含一个表单参数 +WEB_FRONT_PROJECT_ERROR_0014=服务单元serviceUnitPath参数未配置 + +WEB_JIT_ENGINE_ERROR_0001=暂不支持的终端类型:{0}。请联系管理员处理。 +WEB_JIT_ENGINE_ERROR_0002=标识为{0}的服务构件为null。 + +WEB_FORM_METADATA_ERROR_0001=获取command元数据{0}失败 +WEB_FORM_METADATA_ERROR_0002=获取ts文件名出错,对应的web构件id不能为空。 +WEB_FORM_METADATA_ERROR_0003=获取ts文件名出错,web构件上获取的文件名异常。 +WEB_FORM_METADATA_ERROR_0004=表单元数据转换为JsonNode失败,对应元数据为:{0} +WEB_FORM_METADATA_ERROR_0005=标识为{0}的服务构件为null。 +WEB_FORM_METADATA_ERROR_0006=不存在标识为{0}的服务构件 +WEB_FORM_METADATA_ERROR_0007=标识为{0}的服务构件name属性不允许为null。 +WEB_FORM_METADATA_ERROR_0008="标识为{0}的服务构件path属性不允许为null。" +WEB_FORM_METADATA_ERROR_0009=暂时无法处理frmJsonSavePath为空场景,请咨询开发人员该功能完成情况 +WEB_FORM_METADATA_ERROR_0010=元数据获取,构造目标元数据信息supplierAction不能为空 +WEB_FORM_METADATA_ERROR_0011=根据VoId获取对应元数据为空,对应voId为:{0} +WEB_FORM_METADATA_ERROR_0012=目前仅支持同一个业务对象(Business Object)内的表单复制。如果需要其他场景的复制,请联系开发人员。 +WEB_FORM_METADATA_ERROR_0013=未能正常获取元数据传输序列化器,请检查配置,对应元数据类型为:{0} +WEB_FORM_METADATA_ERROR_0014=复制表单时,同步目标工程信息失败。源表单ID是:{0}更多异常信息如下:{1} +WEB_FORM_METADATA_ERROR_0015=源表单存储相对路径属性不包含工程名,请检查。 +WEB_FORM_METADATA_ERROR_0016=根据业务对象获取对应关键应用信息,业务对象id不能为空 +WEB_FORM_METADATA_ERROR_0017=根据业务对象获取bo信息为空,对应业务对象id为:{0} +WEB_FORM_METADATA_ERROR_0018=待复制表单元数据ID或路径为空。请检查前端请求参数是否正常。 +WEB_FORM_METADATA_ERROR_0019=目标元数据Code或Name不能为空 +WEB_FORM_METADATA_ERROR_0020=表单复制,获取元数据为空。待获取元数据ID是:{0} +WEB_FORM_METADATA_ERROR_0021=待复制元数据所在工程的工程名为空。待复制元数据ID是:{0} +WEB_FORM_METADATA_ERROR_0022=获取表单关联元数据,参数不能为空 +WEB_FORM_METADATA_ERROR_0023=设计时获取元数据,元数据文件名称及路径不能为空 +WEB_FORM_METADATA_ERROR_0024=运行时获取元数据,元数据id参数不能为空 + +WEB_NPM_PACKAGE_ERROR_0001=未获取到npm配置仓库实例 +WEB_NPM_PACKAGE_ERROR_0002=npm安装参数不能为空 + +WEB_TS_FILE_ERROR_0001=获取工程路径信息为空,对应工程路径为:{0} +WEB_TS_FILE_ERROR_0002=没有找到表单对应的web构件。表单路径:{0},web构件id:{1} + +WEB_DESIGN_SCHEMA_ERROR_0001=标识为{0}的视图对象{1}的IDElement属性不允许为null。 +WEB_DESIGN_SCHEMA_ERROR_0002=不支持的业务字段嵌套层次,请联系技术人员 +WEB_DESIGN_SCHEMA_ERROR_0003=字段{0}不包含关联实体信息。 +WEB_DESIGN_SCHEMA_ERROR_0004=Id为{0}的统一数据类型元数据为未识别的类型。 +WEB_DESIGN_SCHEMA_ERROR_0005=未获取到id为{0}的统一数据类型(UDT)元数据。 +WEB_DESIGN_SCHEMA_ERROR_0006=字段{0}不包含关联实体信息。 +WEB_DESIGN_SCHEMA_ERROR_0007=标识为{0},标签为{1}的字段{2}被定义为'UnifiedDataType'字段,但是没有指定'UnifiedDataType'标识,请检查业务实体。 +WEB_DESIGN_SCHEMA_ERROR_0008=表单DOM结构错误:未找到module.schemas节点 + +WEB_JIT_ENGINE_API_ERROR_0001=根据formId 获取元数据为空 + +WEB_FORM_PROCESS_ERROR_0001=找不到表单元数据: {0}。文件路径:{1}。 +WEB_FORM_PROCESS_ERROR_0002=表单Vo内码[{0}]不存在! +WEB_FORM_PROCESS_ERROR_0003=菜单[id:{0}]不存在,无法注册到流程中心! +WEB_FORM_PROCESS_ERROR_0004=菜单[{0}]注册到流程中心失败! + +#rtc-template +DYNAMIC_FORM_ERROR_0001=FormType类型转换,无效的参数类型,参数不能为空 +DYNAMIC_FORM_ERROR_0002=FormType类型转换,无效的类型参数:{0} +DYNAMIC_FORM_ERROR_0003=无效的类型,具体参数值为:{0},待转换的类型为ExtractFormType +DYNAMIC_FORM_ERROR_0004=根据格式定义id获取格式定义信息,格式定义id参数不能为空 +DYNAMIC_FORM_ERROR_0005=表单类型为空。 +DYNAMIC_FORM_ERROR_0006=标识为{0}的服务构件为null。 +DYNAMIC_FORM_ERROR_0007=获取command元数据{0}失败 +DYNAMIC_FORM_ERROR_0008=formId参数不能为空 +DYNAMIC_FORM_ERROR_0009=根据元数据id:{0} 获取对应元数据信息为空 + +RTC_PATCH_ERROR_0001={0}克隆失败 +RTC_PATCH_ERROR_0002=beforeNavigate 参数转换失败 + +RTC_TEMPLATE_ERROR_0001=创建扩展表单时,反序列化request body失败。{0} +RTC_TEMPLATE_ERROR_0002=Form元数据获取失败:{0} +RTC_TEMPLATE_ERROR_0003=运行时定制扩展表单删除,元数据id为空 +RTC_TEMPLATE_ERROR_0004=依据元数据id:{0}获取元数据为空 +RTC_TEMPLATE_ERROR_0005=元数据扩展检测,依据{0}:{1} 获取元数据信息为空 +RTC_TEMPLATE_ERROR_0006=获取帮助元数据{0}失败。 +RTC_TEMPLATE_ERROR_0007=获取{0}元数据失败,id为:{1} +RTC_TEMPLATE_ERROR_0008=根据元数据id获取元数据信息,元数据id为空 +RTC_TEMPLATE_ERROR_0009=Help元数据关联得VO元数据获取失败,id={0} +RTC_TEMPLATE_ERROR_0010=暂不支持虚拟VO创建的帮助 +RTC_TEMPLATE_ERROR_0011=标识为{0}的服务构件为null。 +RTC_TEMPLATE_ERROR_0012=获取command元数据{0}失败 + +NO_CODE_RUNTIME_ERROR_0001=当前登录用户名为空!请联系管理员设置当前登录用户当前语言下的用户名。如已设置,请联系平台维护用户登录功能的同事处理。 +NO_CODE_RUNTIME_ERROR_0002=当前登录用户名为空!请联系平台维护用户登录功能的同事处理。 +NO_CODE_RUNTIME_ERROR_0003=当前登录组织id(CAFContext.current.getCurrentSession().getSysOrgId())为空!请联系平台维护用户登录功能的同事处理。 +NO_CODE_RUNTIME_ERROR_0004=属性名不存在:{0} + + + +#Message +WEB_COMMON_MSG_0001=错误提示 +WEB_COMMON_MSG_0002=若已安装,请尝试重启iGIX服务。 +WEB_COMMON_MSG_0003=当前环境 +WEB_COMMON_MSG_0004=提示 +WEB_COMMON_MSG_0005=%s %s命令不可用,请安装Nodejs,请参考:Nodejs安装。 %s +WEB_COMMON_MSG_0006=%s Jit-Engine未部署,请先部署。请参考:Jit-Engine安装。$s +WEB_COMMON_MSG_0007=%s 未部署依赖ng命令,请先部署,请参考: Angular-Cli安装。$s +WEB_COMMON_MSG_0008= 未找到对应版本,请修正后重新执行安装! +WEB_COMMON_MSG_0009=当前仓库%s包不存在,请切换至其他仓库或修正包版本,然后重新进行安装! +WEB_COMMON_MSG_0010=连接服务器超时,请重新安装或切换至其他仓库,然后重新进行安装! +WEB_COMMON_MSG_0011=权限不足,请以管理员权限运行以进行Npm在线安装! + +WEB_FRONT_PROJECT_MSG_0001=找不到页面流元数据,请检查对应app.config.json文件中配置页面流元数据id是否正确或页面流元数据是否被移除。 +WEB_FRONT_PROJECT_MSG_0002=找不到对应页面流元数据,对应页面流元数据id为:%s +WEB_FRONT_PROJECT_MSG_0003=读取IDE配置文件出现错误,请检查文件内容 + +WEB_JIT_ENGINE_MSG_0001=编译依赖node_modules未部署,请先部署。部署路径为:%s +WEB_JIT_ENGINE_MSG_0002=编译依赖node_modules未部署,请先部署。部署路径为:%s或开启Npm在线安装(需要网络连接)。 +WEB_JIT_ENGINE_MSG_0003=当前node_modules不包含移动npm包,请使用Npm在线安装或更新最新node_modules离线包。请注意:移动表单编译不再使用mobile目录下的node_modules,使用工程目录下node_modules。 + +WEB_FORM_METADATA_MSG_0001=获取命令元数据为空,对应元数据id为:%s +WEB_FORM_METADATA_MSG_0002=获取WebComponent元数据为空,对应元数据id为:%s +WEB_FORM_METADATA_MSG_0003=获取web构件元数据为空,对应元数据id为:%s +WEB_FORM_METADATA_MSG_0004=根据元数据id获取元数据信息为空,对应元数据id:%s,元数据类型为:%s +WEB_FORM_METADATA_MSG_0005=获取ts命令元数据为空,对应ts命令元数据id:%s +WEB_FORM_METADATA_MSG_0006=目标元数据存在,无法进行复制。对应目标元数据名称:%s,所属工程路径:%s +WEB_FORM_METADATA_MSG_0007=待复制表单元数据内容为空 +WEB_FORM_METADATA_MSG_0008=仅支持表单元数据复制 +WEB_FORM_METADATA_MSG_0009=待复制的表单元数据不存在,请确认该元数据是否已被删除。 +WEB_FORM_METADATA_MSG_0010=表单复制失败,待复制的表单元数据不存在,请确认该元数据是否已被删除 + +WEB_NPM_PACKAGE_MSG_0001=请设置npm install 运行位置参数:ExecuteEnvironment +WEB_NPM_PACKAGE_MSG_0002=请设置帐号 +WEB_NPM_PACKAGE_MSG_0003=请设置密码 +WEB_NPM_PACKAGE_MSG_0004=请设置待更新的npm包及其版本,或设置全部更新 +WEB_NPM_PACKAGE_MSG_0005=当前为从不更新模式,无法在线执行install操作 +WEB_NPM_PACKAGE_MSG_0006=当前为离线模式,无需执行install操作 +WEB_NPM_PACKAGE_MSG_0007=npm 正在全局安装,若需重新安装,请删除lock文件! +WEB_NPM_PACKAGE_MSG_0008=执行全局离线包安装 +WEB_NPM_PACKAGE_MSG_0009=全局离线包临时文件路径为:%s +WEB_NPM_PACKAGE_MSG_0010=全局离线包安装失败,%s +WEB_NPM_PACKAGE_MSG_0011=全局离线包安装完成 +WEB_NPM_PACKAGE_MSG_0012=全局离线包版本未发生变更,无需执行全局离线包安装 +WEB_NPM_PACKAGE_MSG_0013=不支持的操作系统类型,请联系开发人员处理 +WEB_NPM_PACKAGE_MSG_0014=npm登录失败,请查看网络是否正常连接 +WEB_NPM_PACKAGE_MSG_0015=然后重新执行更新操作。 +WEB_NPM_PACKAGE_MSG_0016=请检查Url地址是否正确或网络是否可以联通,%s +WEB_NPM_PACKAGE_MSG_0017=用户名或密码错误,请修正后重新执行更新操作。 +WEB_NPM_PACKAGE_MSG_0018=请检查Url地址是否正确或用户名是否存在,请修正后重新执行更新操作。 +WEB_NPM_PACKAGE_MSG_0019=npm配置信息为空,请设置 +WEB_NPM_PACKAGE_MSG_0020=WEB_NPM_PACKAGE_ERROR_0003 +WEB_NPM_PACKAGE_MSG_0021=离线模式下无法执行在线install +WEB_NPM_PACKAGE_MSG_0022=执行离线包缓存清理 +WEB_NPM_PACKAGE_MSG_0023=未获取到当前配置npm仓库 +WEB_NPM_PACKAGE_MSG_0024=当前配置策略不是自动更新,无法执行在线install操作。 +WEB_NPM_PACKAGE_MSG_0025=升级工具执行,npm包版本不进行检测 +WEB_NPM_PACKAGE_MSG_0026=未配置编译依赖node_modules,请在 Npm包管理进行在线安装。node_modules路径为:%s +WEB_NPM_PACKAGE_MSG_0027=npm包版本存在更新,为保证最终脚本运行正确,需先进行更新。请在选项->设置->Npm包管理进行更新! +WEB_NPM_PACKAGE_MSG_0028=正在执行安装操作,请勿重复执行! +WEB_NPM_PACKAGE_MSG_0029=开启离线模式,自动更新离线包停止 +WEB_NPM_PACKAGE_MSG_0030=离线包更新策略为手工,自动更新离线包停止 +WEB_NPM_PACKAGE_MSG_0031=离线包更新策略为从不,自动更新离线包停止 +WEB_NPM_PACKAGE_MSG_0032=npm 正在安装,若需重新安装,请删除lock文件! +WEB_NPM_PACKAGE_MSG_0033=server不包含package.json 文件,server path is :%s +WEB_NPM_PACKAGE_MSG_0034=离线包版本未发生变更,无需执行离线包安装 +WEB_NPM_PACKAGE_MSG_0035=开始执行npm install 安装 +WEB_NPM_PACKAGE_MSG_0036=开始执行npm install 命令 +WEB_NPM_PACKAGE_MSG_0037=执行npm登录操作 +WEB_NPM_PACKAGE_MSG_0038=执行npm登出操作 +WEB_NPM_PACKAGE_MSG_0039=npm install 执行完毕 + +WEB_DESIGN_SCHEMA_MSG_0001=beBindingFieldId不能为空 +WEB_DESIGN_SCHEMA_MSG_0002=未在实体上找到对应的字段,请检查业务字段配置信息 +WEB_DESIGN_SCHEMA_MSG_0003=更新表单schema,关联字段元数据找不到,请修正。对应字段元数据id为:%s +WEB_DESIGN_SCHEMA_MSG_0004=更新表单Schema,获取UDT字段元数据失败,元数据不存在。对应元数据id为:%s +WEB_DESIGN_SCHEMA_MSG_0005=根据表单元数据获取VO元数据为空,请检查表单元数据module>schemas>id 是否正确,此参数为表单对应VO元数据id参数! + +WEB_RUNTIME_BUILD_MSG_0001=待写入的目标文件路径为:%s + +WEB_SCRIPT_CACHE_MSG_0001=表单元数据id为空 +WEB_SCRIPT_CACHE_MSG_0002=根据元数据id获取文件列表为空,对应元数据id:%s +WEB_SCRIPT_CACHE_MSG_0003=打开当前维度失败,请在【业务配置中心】,检查此维度是否进行了保存预览操作。相关元数据id: +WEB_SCRIPT_CACHE_MSG_0004=元数据对应的工程缓存信息为空,元数据id为:%s +WEB_SCRIPT_CACHE_MSG_0005=数据库存储的脚本文件内容为空,contentId:%s +WEB_SCRIPT_CACHE_MSG_0006=开始执行元数据版本更新检测 +WEB_SCRIPT_CACHE_MSG_0007=元数据版本更新检测完成,id:%s,version:%s +WEB_SCRIPT_CACHE_MSG_0008=清理DBO及BE缓存,表单元数据id为:%s +WEB_SCRIPT_CACHE_MSG_0009="元数据版本更新检测失败,id:%s version:%s +WEB_SCRIPT_CACHE_MSG_0010=清理VO元数据,元数据id为:%s +WEB_SCRIPT_CACHE_MSG_0011=清理DBO,对应id为:%s +WEB_SCRIPT_CACHE_MSG_0012=清理be元数据,元数据id为:%s +WEB_SCRIPT_CACHE_MSG_0013=未找到工程对应的脚本缓存信息,工程名称:%s +WEB_SCRIPT_CACHE_MSG_0014=absoluteBaseDirectory:%s 获取文件列表个数为:%s +WEB_SCRIPT_CACHE_MSG_0015=开始执行元数据版本更新 +WEB_SCRIPT_CACHE_MSG_0016=元数据版本更新完成,id:%s,version:%s +WEB_SCRIPT_CACHE_MSG_0017=元数据版本更新失败,id:%s,version:%s +WEB_SCRIPT_CACHE_MSG_0018=脚本检测,工程名称不能为空 +WEB_SCRIPT_CACHE_MSG_0019=脚本检测,工程路径不能为空 + +#rtc-template +DYNAMIC_FORM_MSG_0001=格式定义 +DYNAMIC_FORM_MSG_0002=未知 +DYNAMIC_FORM_MSG_0003=PC表单 +DYNAMIC_FORM_MSG_0004=移动表单 +DYNAMIC_FORM_MSG_0005=是否可见 +DYNAMIC_FORM_MSG_0006=是否禁用 +DYNAMIC_FORM_MSG_0007=是否必填 +DYNAMIC_FORM_MSG_0008=是否只读 +DYNAMIC_FORM_MSG_0009=获取合适的格式定义,入参为空 +DYNAMIC_FORM_MSG_0010=获取合适的格式定义,元数据id参数为空 +DYNAMIC_FORM_MSG_0011=实获取合适的格式定义,实体数据code参数不能为空 +DYNAMIC_FORM_MSG_0012=格式定义保存,配置参数不能为空。 +DYNAMIC_FORM_MSG_0013=格式定义保存,元数据id参数不能为空。 +DYNAMIC_FORM_MSG_0014=格式定义编号不能为空。 +DYNAMIC_FORM_MSG_0015=格式定义名称不能为空。 +DYNAMIC_FORM_MSG_0016=格式定义操作状态不能为空,可为add或edit其中之一。 +DYNAMIC_FORM_MSG_0017=格式定义更新参数不能为空 +DYNAMIC_FORM_MSG_0018=格式定义更新,格式定义id参数不能为空 +DYNAMIC_FORM_MSG_0019=格式定义更新,关联元数据id参数不能为空 +DYNAMIC_FORM_MSG_0020=格式定义更新,关联元数据不能为空 +DYNAMIC_FORM_MSG_0021=使用格式定义:%s +DYNAMIC_FORM_MSG_0022=格式分配条件表达式解析失败,已跳过该表达式解析。对应表达式为:%s +DYNAMIC_FORM_MSG_0023=使用格式定义:%s,格式定义分配条件为空。 +DYNAMIC_FORM_MSG_0024=格式定义分配,配置参数不能为空。 +DYNAMIC_FORM_MSG_0025=格式定义分配条件获取,格式定义id不能为空。 +DYNAMIC_FORM_MSG_0026=格式定义分配条件获取,元数据id不能为空。 +DYNAMIC_FORM_MSG_0027=格式定义分配条件保存,参数不能为空! +DYNAMIC_FORM_MSG_0028=格式定义分配条件保存,格式定义id参数不能为空! +DYNAMIC_FORM_MSG_0029=格式定义分配条件保存,元数据id参数不能为空! +DYNAMIC_FORM_MSG_0030=未匹配到任何格式定义 +DYNAMIC_FORM_MSG_0031=是否允许删除格式定义,格式定义id参数不能为空 +DYNAMIC_FORM_MSG_0032=删除格式定义,格式定义id不能为空 +DYNAMIC_FORM_MSG_0033=依据格式定义id删除对应格式定义失败,%s +DYNAMIC_FORM_MSG_0034=格式定义分配条件,根据元数据id获取元数据为空,对应元数据id为:%s +DYNAMIC_FORM_MSG_0035=格式定义id不能为空。 +DYNAMIC_FORM_MSG_0036=依据格式定义id获取格式定义信息为空,请检查格式定义id是否正确,格式定义id参数为:%s +DYNAMIC_FORM_MSG_0037=根据元数据id获取元数据信息为空,对应元数据id为:%s +DYNAMIC_FORM_MSG_0038=格式定义关联元数据只能为表单类型,对应元数据id:%s,元数据编号为:%s +DYNAMIC_FORM_MSG_0039=添加格式定义必须参数元数据id为空 +DYNAMIC_FORM_MSG_0040=根据元数据id获取元数据信息失败,无法对其添加格式定义,元数据id为: +DYNAMIC_FORM_MSG_0041=根据元数据id获取元数据失败,%s +DYNAMIC_FORM_MSG_0042=内码 +DYNAMIC_FORM_MSG_0043=动作 +DYNAMIC_FORM_MSG_0044=列表 +DYNAMIC_FORM_MSG_0045=附件 + +RTC_TEMPLATE_MSG_0001=系统模板 +RTC_TEMPLATE_MSG_0002=扩展模板 +RTC_TEMPLATE_MSG_0003=简单字段类型 +RTC_TEMPLATE_MSG_0004=复杂字段类型 + +RTC_MENU_MSG_0001=获取菜单扩展查询参数时反序列化失败,funcId {0}||{1} + +RTC_PATCH_MSG_0001=当前表单需要更新发布,请联系管理员前往业务配置中心预览升级。 + + diff --git a/i18n/server/platform/common/resources/en/WebErrorCode.en.properties b/i18n/server/platform/common/resources/en/WebErrorCode.en.properties new file mode 100644 index 0000000000000000000000000000000000000000..0d65fc0e13a110bf5622a23272f26068cfa35056 --- /dev/null +++ b/i18n/server/platform/common/resources/en/WebErrorCode.en.properties @@ -0,0 +1,266 @@ +WEB_COMMON_ERROR_0001=Encoding failed: {0} +WEB_COMMON_ERROR_0002=base64Decode failed +WEB_COMMON_ERROR_0003=Unknown data type converted to TerminalType, corresponding data type is: {0} +WEB_COMMON_ERROR_0004=Error occurred while getting project information, {0} +WEB_COMMON_ERROR_0005=Metadata request parameters, the target metadata parameter cannot be empty +WEB_COMMON_ERROR_0006=The current metadata is not a command metadata. Metadata id is: {0} +WEB_COMMON_ERROR_0007=The service component identified as {0} is null. +WEB_COMMON_ERROR_0008=Unsupported operating system type, please contact the developer for assistance +WEB_COMMON_ERROR_0009=Unrecognized operating system system. Please contact the developer for assistance. +WEB_COMMON_ERROR_0010=Unrecognized terminal type, please contact the administrator. The current terminal type is: {0} + +WEB_FRONT_PROJECT_ERROR_0001=The page flow file (with the extension .pf) contains absolute paths, which rely on a single environment path configuration. Please adjust to relative paths. Specific operation: Open the page flow file and automatically adjust by removing and re-adding the form from the page flow. The corresponding table unit data is: {0}, the current absolute path is: {1} +WEB_FRONT_PROJECT_ERROR_0002=The path for table unit data in the page flow file (with the extension .pf) is incorrect. Please remove it. The corresponding table unit data code is: {0}, name: {1} +WEB_FRONT_PROJECT_ERROR_0003=Unrecognized terminal type, please contact the administrator. The current terminal type is: {0} +WEB_FRONT_PROJECT_ERROR_0004=The buildFormList parameter for table unit data extraction cannot be empty. +WEB_FRONT_PROJECT_ERROR_0005=Please set the default home page parameter. +WEB_FRONT_PROJECT_ERROR_0006=Please set the route parameter. +WEB_FRONT_PROJECT_ERROR_0007=The default home page parameter must have "index.html" as the suffix, please correct it! +WEB_FRONT_PROJECT_ERROR_0008=Please set the correct path parameter, e.g., apps/scm/sd/sales/index.html +WEB_FRONT_PROJECT_ERROR_0009=The zero-code compilation input cannot be null. +WEB_FRONT_PROJECT_ERROR_0010=The absoluteBasePath parameter of the zero-code compilation input cannot be empty. +WEB_FRONT_PROJECT_ERROR_0011=The projectName parameter of the zero-code compilation input cannot be empty. +WEB_FRONT_PROJECT_ERROR_0012=The dependency node_modules path of the zero-code compilation input cannot be empty. +WEB_FRONT_PROJECT_ERROR_0013=The zero-code compilation input must include at least one form parameter. +WEB_FRONT_PROJECT_ERROR_0014=The serviceUnitPath parameter is not configured. + +WEB_JIT_ENGINE_ERROR_0001=Unsupported terminal type: {0}. Please contact the administrator for assistance. +WEB_JIT_ENGINE_ERROR_0002=The service component identified as {0} is null. + +WEB_FORM_METADATA_ERROR_0001=Failed to get command metadata {0}. +WEB_FORM_METADATA_ERROR_0002=Error occurred while getting the ts file name. The corresponding web component id cannot be empty. +WEB_FORM_METADATA_ERROR_0003=Error occurred while getting the ts file name. An exception occurred while getting the file name from the web component. +WEB_FORM_METADATA_ERROR_0004=Failed to convert table unit data to JsonNode. The corresponding metadata is: {0}. +WEB_FORM_METADATA_ERROR_0005=The service component identified as {0} is null. +WEB_FORM_METADATA_ERROR_0006=No service component with the identifier {0} exists. +WEB_FORM_METADATA_ERROR_0007=The name attribute of the service component identified as {0} cannot be null. +WEB_FORM_METADATA_ERROR_0008="The path attribute of the service component identified as {0} cannot be null." +WEB_FORM_METADATA_ERROR_0009=The scenario where frmJsonSavePath is empty cannot be processed temporarily. Please consult the developer for the completion status of this feature. +WEB_FORM_METADATA_ERROR_0010=The supplierAction parameter for constructing the target metadata cannot be empty during metadata retrieval. +WEB_FORM_METADATA_ERROR_0011=No corresponding metadata found based on the VoId. The corresponding voId is: {0}. +WEB_FORM_METADATA_ERROR_0012=Currently, only form copying within the same business object (Business Object) is supported. If you need copying for other scenarios, please contact the developer. +WEB_FORM_METADATA_ERROR_0013=Failed to normally retrieve the metadata transfer serializer. Please check the configuration, and the corresponding metadata type is: {0}. +WEB_FORM_METADATA_ERROR_0014=Failed to synchronize target engineering information during form copying. The source form ID is: {0}. More exception information is as follows: {1}. +WEB_FORM_METADATA_ERROR_0015=The relative path attribute of the source form storage does not contain the project name. Please check it. +WEB_FORM_METADATA_ERROR_0016=The business object id cannot be empty when getting the corresponding key application information based on the business object. +WEB_FORM_METADATA_ERROR_0017=The business object information is empty when getting it based on the business object id: {0}. +WEB_FORM_METADATA_ERROR_0018=The ID or path of the table unit data to be copied is empty. Please check whether the front-end request parameters are normal. +WEB_FORM_METADATA_ERROR_0019=The target metadata Code or Name cannot be empty. +WEB_FORM_METADATA_ERROR_0020=No metadata retrieved during form copying. The ID of the metadata to be retrieved is: {0}. +WEB_FORM_METADATA_ERROR_0021=The project name of the target metadata's original project is empty. The ID of the metadata to be copied is: {0}. +WEB_FORM_METADATA_ERROR_0022=The parameter for getting associated metadata cannot be empty during design time. +WEB_FORM_METADATA_ERROR_0023=Both the file name and path of metadata cannot be empty during run time for getting metadata. +WEB_FORM_METADATA_ERROR_0024=The parameter for getting metadata at runtime cannot be empty when retrieving it by id. + +WEB_NPM_PACKAGE_ERROR_0001=Failed to get npm configuration repository instance. +WEB_NPM_PACKAGE_ERROR_0002=Npm installation parameters cannot be empty. + +WEB_TS_FILE_ERROR_0001=No project path information obtained. The corresponding project path is: {0}. +WEB_TS_FILE_ERROR_0002=No web component found for the form. Form path: {0}, web component id: {1}. + +WEB_DESIGN_SCHEMA_ERROR_0001=The IDElement property of the view object {1} with the identifier {0} is not allowed to be null. +WEB_DESIGN_SCHEMA_ERROR_0002=Unsupported business field nesting level. Please contact technical personnel. +WEB_DESIGN_SCHEMA_ERROR_0003=The field {0} does not contain associated entity information. +WEB_DESIGN_SCHEMA_ERROR_0004=The unified data type metadata with an Id of {0} is an unrecognized type. +WEB_DESIGN_SCHEMA_ERROR_0005=Failed to retrieve the unified data type (UDT) metadata with an id of {0}. +WEB_DESIGN_SCHEMA_ERROR_0006=The field {0} does not contain associated entity information. +WEB_DESIGN_SCHEMA_ERROR_0007=The field identified as {0} and labeled as {1} is defined as a 'UnifiedDataType' field, but no 'UnifiedDataType' identifier is specified. Please check the business entity. +WEB_DESIGN_SCHEMA_ERROR_0008=Error in the form's DOM structure: unable to reach the module.schemas node. + +WEB_JIT_ENGINE_API_ERROR_0001=No metadata retrieved based on the formId. + +WEB_FORM_PROCESS_ERROR_0001=FormMetadata not found: {0}. File path: {1}. +WEB_FORM_PROCESS_ERROR_0002=Form Vo internal code [{0}] does not exist! +WEB_FORM_PROCESS_ERROR_0003=Menu [id:{0}] does not exist and cannot be registered to the process center! +WEB_FORM_PROCESS_ERROR_0004=Failed to register menu [{0}] to the process center! + + +#rtc-template +DYNAMIC_FORM_ERROR_0001=Invalid parameter type for FormType conversion. The parameter cannot be empty. +DYNAMIC_FORM_ERROR_0002=Invalid type parameter for FormType conversion: {0} +DYNAMIC_FORM_ERROR_0003=Invalid type. The specific parameter value is: {0}. The type to be converted is ExtractFormType. +DYNAMIC_FORM_ERROR_0004=Cannot get format definition information based on format definition id. The format definition id parameter cannot be empty. +DYNAMIC_FORM_ERROR_0005=The form type is empty. +DYNAMIC_FORM_ERROR_0006=The service component identified as {0} is null. +DYNAMIC_FORM_ERROR_0007=Failed to get command metadata {0} +DYNAMIC_FORM_ERROR_0008=The formId parameter cannot be empty +DYNAMIC_FORM_ERROR_0009=No corresponding metadata information can be obtained based on metadata id: {0} + +RTC_PATCH_ERROR_0001={0} cloning failed +RTC_PATCH_ERROR_0002=Parameter conversion failed for beforeNavigate + +RTC_TEMPLATE_ERROR_0001=Failed to deserialize the request body during the creation of an extended form. {0} +RTC_TEMPLATE_ERROR_0002=Failed to get Form metadata: {0} +RTC_TEMPLATE_ERROR_0003=Runtime custom extended form deletion, metadata id is empty +RTC_TEMPLATE_ERROR_0004=No metadata can be obtained based on metadata id: {0} +RTC_TEMPLATE_ERROR_0005=Metadata extension detection, no metadata information can be obtained based on {0}: {1} +RTC_TEMPLATE_ERROR_0006=Failed to get help metadata {0} +RTC_TEMPLATE_ERROR_0007=Failed to get metadata for {0}, id: {1} +RTC_TEMPLATE_ERROR_0008=No metadata information can be obtained based on metadata id. The metadata id is empty. +RTC_TEMPLATE_ERROR_0009=Failed to get the VO metadata associated with Help, id={0} +RTC_TEMPLATE_ERROR_0010=Temporary unsupported help for virtual VO creation +RTC_TEMPLATE_ERROR_0011=The service component identified as {0} is null. +RTC_TEMPLATE_ERROR_0012=Failed to get command metadata {0} + +NO_CODE_RUNTIME_ERROR_0001=The current login username is null,Please contact the administrator to set the current login username in the current language. If it has been set, please contact the colleagues who maintain the user login function on the platform to handle it. +NO_CODE_RUNTIME_ERROR_0002=The current login username is null,Please contact the platform maintenance personnel who are responsible for user login functions to resolve this issue. +NO_CODE_RUNTIME_ERROR_0003=The current login username is null,Please contact the platform maintenance personnel who are responsible for user login functions to resolve this issue. +NO_CODE_RUNTIME_ERROR_0004=Attribute name does not exist:{0} + +#Message +WEB_COMMON_MSG_0001=Error message +WEB_COMMON_MSG_0002=If it is already installed, try restarting the iGIX service. +WEB_COMMON_MSG_0003=Current environment +WEB_COMMON_MSG_0004=Prompt +WEB_COMMON_MSG_0005=%s node command is not available. Please install Nodejs. Reference: Nodejs installation. %3$s +WEB_COMMON_MSG_0006=%s Jit-Engine is not deployed. Please deploy it first. Reference: Jit-Engine installation.%3$s +WEB_COMMON_MSG_0007=%s Dependency ng command is not deployed. Please deploy it first. Reference: Angular-Cli installation.%3$s +WEB_COMMON_MSG_0008= No corresponding version found. Please correct and try again! +WEB_COMMON_MSG_0009=The package in current repository %s does not exist. Please switch to other repositories or correct the package version, and then try installation again! +WEB_COMMON_MSG_0010=Connection to the server timed out. Please reinstall or switch to other repositories, and then try installation again! +WEB_COMMON_MSG_0011=Insufficient permissions. Please run with administrator privileges for online Npm installation! + +WEB_FRONT_PROJECT_MSG_0001=The page flow metadata cannot be found. Please check if the configuration page flow metadata id in the corresponding app.config.json file is correct or if the page flow metadata has been removed. +WEB_FRONT_PROJECT_MSG_0002=The corresponding page flow metadata cannot be found. The id of the page flow metadata is: %s +WEB_FRONT_PROJECT_MSG_0003=An error occurred while reading the IDE configuration file. Please check the file content. + +WEB_JIT_ENGINE_MSG_0001=The compilation dependency node_modules has not been deployed. Please deploy it first. Deployment path: %s +WEB_JIT_ENGINE_MSG_0002=The compilation dependency node_modules has not been deployed. Please deploy it first. Deployment path: %s or enable online Npm installation (requires a network connection). +WEB_JIT_ENGINE_MSG_0003=The current node_modules does not contain the mobile npm package. Please install it online or update the latest offline node_modules package. Note: The mobile form compilation no longer uses the node_modules directory under mobile, but instead uses the node_modules directory under the project. + +WEB_FORM_METADATA_MSG_0001=The command metadata is empty, corresponding metadata id: %s +WEB_FORM_METADATA_MSG_0002=The WebComponent metadata is empty, corresponding metadata id: %s +WEB_FORM_METADATA_MSG_0003=The web component metadata is empty, corresponding metadata id: %s +WEB_FORM_METADATA_MSG_0004=No metadata information can be retrieved based on the metadata id, corresponding metadata id: %s, metadata type: %s +WEB_FORM_METADATA_MSG_0005=The ts command metadata is empty, corresponding ts command metadata id: %s +WEB_FORM_METADATA_MSG_0006=The target metadata exists and cannot be copied. Corresponding target metadata name: %s, belonging to project path: %s +WEB_FORM_METADATA_MSG_0007=The copied FormMetadata content is empty +WEB_FORM_METADATA_MSG_0008=Only FormMetadata can be copied +WEB_FORM_METADATA_MSG_0009=The copied FormMetadata does not exist, please confirm if the metadata has been deleted. +WEB_FORM_METADATA_MSG_0010=Form copy failed, the copied FormMetadata does not exist, please confirm if the metadata has been deleted. + +WEB_NPM_PACKAGE_MSG_0001=Please set the parameter for npm install execution location: ExecuteEnvironment +WEB_NPM_PACKAGE_MSG_0002=Please set your account +WEB_NPM_PACKAGE_MSG_0003=Please set your password +WEB_NPM_PACKAGE_MSG_0004=Please set the npm package(s) to be updated, or select to update all +WEB_NPM_PACKAGE_MSG_0005=The current mode is never update, online install operation cannot be performed +WEB_NPM_PACKAGE_MSG_0006=The current mode is offline, no need to perform install operation +WEB_NPM_PACKAGE_MSG_0007=npm is installing globally. If reinstallation is needed, delete the lock file! +WEB_NPM_PACKAGE_MSG_0008=Executing global offline package installation +WEB_NPM_PACKAGE_MSG_0009=Global offline package temporary file path is: %s +WEB_NPM_PACKAGE_MSG_0010=Global offline package installation failed, %s +WEB_NPM_PACKAGE_MSG_0011=Global offline package installation completed +WEB_NPM_PACKAGE_MSG_0012=Global offline package version has not changed, no need to perform global offline package installation +WEB_NPM_PACKAGE_MSG_0013=Unsupported operating system type, please contact the developer for assistance +WEB_NPM_PACKAGE_MSG_0014=npm login failed, please check if the network connection is stable +WEB_NPM_PACKAGE_MSG_0015=Please check if the URL address is correct or if the network is accessible, %s +WEB_NPM_PACKAGE_MSG_0016=Please check if the URL address is correct or if the username exists, please correct and try again. +WEB_NPM_PACKAGE_MSG_0017=Username or password is incorrect, please correct and try again. +WEB_NPM_PACKAGE_MSG_0018=Please check if the URL address is correct or if the username exists, please correct and try again. +WEB_NPM_PACKAGE_MSG_0019=npm configuration information is empty, please set it +WEB_NPM_PACKAGE_MSG_0020=WEB_NPM_PACKAGE_ERROR_0003 +WEB_NPM_PACKAGE_MSG_0021=Offline mode cannot execute online install operation +WEB_NPM_PACKAGE_MSG_0022=Executing offline package cache cleanup +WEB_NPM_PACKAGE_MSG_0023=Current configured npm repository not retrieved +WEB_NPM_PACKAGE_MSG_0024=Current configuration strategy is not automatic update, online install operation cannot be performed. +WEB_NPM_PACKAGE_MSG_0025=Upgrade tool execution, npm package version will not be checked +WEB_NPM_PACKAGE_MSG_0026=No compiled dependency node-modules configured, please install online at Npm Package Management. node-modules path is: %s +WEB_NPM_PACKAGE_MSG_0027=There is an update available for the npm package. To ensure the correct operation of the final script, an update is required. Please update at Options -> Settings -> Npm Package Management! +WEB_NPM_PACKAGE_MSG_0028=Installation operation is in progress, please do not execute repeatedly! +WEB_NPM_PACKAGE_MSG_0029=Offline mode enabled, automatic update of offline packages stopped +WEB_NPM_PACKAGE_MSG_0030=The offline package update strategy is manual, automatic update of offline packages stopped +WEB_NPM_PACKAGE_MSG_0031=The offline package update strategy is Never, automatic update of offline packages stopped +WEB_NPM_PACKAGE_MSG_0032=npm is installing, if reinstallation is needed, delete the lock file! +WEB_NPM_PACKAGE_MSG_0033=The server does not contain a package.json file, server path is: %s +WEB_NPM_PACKAGE_MSG_0034=Offline package version has not changed, no need to perform offline package installation +WEB_NPM_PACKAGE_MSG_0035=Starting npm install installation +WEB_NPM_PACKAGE_MSG_0036=Starting npm install command execution +WEB_NPM_PACKAGE_MSG_0037=Executing npm login operation +WEB_NPM_PACKAGE_MSG_0038=Executing npm logout operation +WEB_NPM_PACKAGE_MSG_0039=npm install execution completed + +WEB_DESIGN_SCHEMA_MSG_0001=beBindingFieldId cannot be empty +WEB_DESIGN_SCHEMA_MSG_0002=The corresponding field cannot be found on the entity. Please check the business field configuration information. +WEB_DESIGN_SCHEMA_MSG_0003=Updating form schema, related field metadata cannot be found. Please fix. The corresponding field metadata ID is: %s +WEB_DESIGN_SCHEMA_MSG_0004=Updating form Schema, UDT field metadata retrieval failed. Metadata does not exist. The corresponding metadata ID is: %s +WEB_DESIGN_SCHEMA_MSG_0005=VO metadata retrieved based on FormMetadata is empty. Please check if the module>schemas>id of FormMetadata is correct. This parameter is the VO metadata ID parameter corresponding to the form! + +WEB_RUNTIME_BUILD_MSG_0001=The target file path to be written is: %s + +WEB_SCRIPT_CACHE_MSG_0001=FormMetadata ID is empty +WEB_SCRIPT_CACHE_MSG_0002=Retrieving file list based on metadata ID is empty. The corresponding metadata ID is: %s +WEB_SCRIPT_CACHE_MSG_0003=Failed to open the current dimension. Please check in the "Business Configuration Center" if this dimension has performed a save preview operation. Relevant metadata ID: +WEB_SCRIPT_CACHE_MSG_0004=The project cache information corresponding to metadata is empty. Metadata ID: %s +WEB_SCRIPT_CACHE_MSG_0005=The script file content stored in the database is empty. contentId:%s +WEB_SCRIPT_CACHE_MSG_0006=Starting metadata version update detection +WEB_SCRIPT_CACHE_MSG_0007=Metadata version update detection complete, ID: %s, version: %s +WEB_SCRIPT_CACHE_MSG_0008=Cleaning up DBO and BE caches, FormMetadata ID: %s +WEB_SCRIPT_CACHE_MSG_0009="Metadata version update detection failed, ID: %s version: %s" +WEB_SCRIPT_CACHE_MSG_0010=Cleaning up VO metadata, metadata ID: %s +WEB_SCRIPT_CACHE_MSG_0011=Cleaning up DBO, corresponding ID: %s +WEB_SCRIPT_CACHE_MSG_0012=Cleaning up BE metadata, metadata ID: %s +WEB_SCRIPT_CACHE_MSG_0013=No script cache information corresponding to the project found. Project name: %s +WEB_SCRIPT_CACHE_MSG_0014=absoluteBaseDirectory:%s Number of files retrieved: %s +WEB_SCRIPT_CACHE_MSG_0015=Starting metadata version update +WEB_SCRIPT_CACHE_MSG_0016=Metadata version update complete, ID: %s, version: %s +WEB_SCRIPT_CACHE_MSG_0017=Metadata version update failed, ID: %s, version: %s +WEB_SCRIPT_CACHE_MSG_0018=Script detection, project name cannot be empty. +WEB_SCRIPT_CACHE_MSG_0019=Script detection, project path cannot be empty. + +#rtc-template +DYNAMIC_FORM_MSG_0001=Format Definition +DYNAMIC_FORM_MSG_0002=Unknown +DYNAMIC_FORM_MSG_0003=PC Form +DYNAMIC_FORM_MSG_0004=Mobile Form +DYNAMIC_FORM_MSG_0005=Visibility +DYNAMIC_FORM_MSG_0006=Disabled +DYNAMIC_FORM_MSG_0007=Required +DYNAMIC_FORM_MSG_0008=Read-only +DYNAMIC_FORM_MSG_0009=Retrieve appropriate format definition. The input parameter is empty. +DYNAMIC_FORM_MSG_0010=Retrieve appropriate format definition. The metadata id parameter is empty. +DYNAMIC_FORM_MSG_0011=Retrieve appropriate format definition. The entity data code parameter cannot be empty. +DYNAMIC_FORM_MSG_0012=The configuration parameter cannot be empty when saving format definitions. +DYNAMIC_FORM_MSG_0013=The metadata id parameter cannot be empty when saving format definitions. +DYNAMIC_FORM_MSG_0014=The format definition ID cannot be empty. +DYNAMIC_FORM_MSG_0015=The format definition name cannot be empty. +DYNAMIC_FORM_MSG_0016=The operation status of the format definition cannot be empty. It can be add or edit. +DYNAMIC_FORM_MSG_0017=The parameters for updating the format definition cannot be empty. +DYNAMIC_FORM_MSG_0018=The format definition ID parameter cannot be empty when updating the format definition. +DYNAMIC_FORM_MSG_0019=The associated metadata ID parameter cannot be empty when updating the format definition. +DYNAMIC_FORM_MSG_0020=The associated metadata cannot be empty when updating the format definition. +DYNAMIC_FORM_MSG_0021=Using format definition: %s +DYNAMIC_FORM_MSG_0022=Failed to parse the conditional expression for the format allocation. The corresponding expression is: %s +DYNAMIC_FORM_MSG_0023=Using format definition: %s, the allocation condition for the format definition is empty. +DYNAMIC_FORM_MSG_0024=The configuration parameter cannot be empty when allocating formats. +DYNAMIC_FORM_MSG_0025=The format definition ID cannot be empty when getting the allocation condition. +DYNAMIC_FORM_MSG_0026=The metadata ID cannot be empty when getting the allocation condition. +DYNAMIC_FORM_MSG_0027=The parameters cannot be empty when saving the allocation condition! +DYNAMIC_FORM_MSG_0028=The format definition ID parameter cannot be empty when saving the allocation condition! +DYNAMIC_FORM_MSG_0029=The metadata ID parameter cannot be empty when saving the allocation condition! +DYNAMIC_FORM_MSG_0030=No matching format definitions found +DYNAMIC_FORM_MSG_0031=Whether to allow deleting format definitions, the format definition ID parameter cannot be empty. +DYNAMIC_FORM_MSG_0032=Deleting format definitions, the format definition ID cannot be empty. +DYNAMIC_FORM_MSG_0033=Failed to delete the corresponding format definition based on the format definition ID, %s +DYNAMIC_FORM_MSG_0034=The metadata associated with the format definition can only be form types. The corresponding metadata ID is: %s, and the metadata number is: %s. +DYNAMIC_FORM_MSG_0035=The format definition ID cannot be empty. +DYNAMIC_FORM_MSG_0036=The format definition information retrieved based on the format definition id is empty. Please check if the format definition id is correct. The format definition id parameter is: %s +DYNAMIC_FORM_MSG_0037=The metadata information retrieved based on the metadata id is empty. The corresponding metadata id is: %s +DYNAMIC_FORM_MSG_0038=The format definition associated metadata can only be of form type. The corresponding metadata id is: %s, the metadata number is: %s +DYNAMIC_FORM_MSG_0039=The essential parameter metadata id is empty for adding format definitions. +DYNAMIC_FORM_MSG_0040=Failed to retrieve metadata information based on the metadata id, unable to add format definitions to it. The metadata id is: %s +DYNAMIC_FORM_MSG_0041=Failed to retrieve metadata based on the metadata id, %s +DYNAMIC_FORM_MSG_0042=Inner Code +DYNAMIC_FORM_MSG_0043=Action +DYNAMIC_FORM_MSG_0044=List +DYNAMIC_FORM_MSG_0045=Attachment + +RTC_TEMPLATE_MSG_0001=System Template +RTC_TEMPLATE_MSG_0002=Extension Template +RTC_TEMPLATE_MSG_0003=Simple Field Type +RTC_TEMPLATE_MSG_0004=Complex Field Type + +RTC_MENU_MSG_0001=Failed to deserialize when retrieving menu extension query parameters, funcId {0}||{1} + +RTC_PATCH_MSG_0001=The current form needs to be updated and published. Please contact the administrator to preview the upgrade in the business configuration center. + + diff --git a/i18n/server/platform/common/resources/zh-CHT/WebErrorCode.zh-CHT.properties b/i18n/server/platform/common/resources/zh-CHT/WebErrorCode.zh-CHT.properties new file mode 100644 index 0000000000000000000000000000000000000000..ea3cbf28d6074703715cd74d3695b098e2d53c6d --- /dev/null +++ b/i18n/server/platform/common/resources/zh-CHT/WebErrorCode.zh-CHT.properties @@ -0,0 +1,265 @@ +WEB_COMMON_ERROR_0001=編碼失敗:{0} +WEB_COMMON_ERROR_0002=base64Decode失敗 +WEB_COMMON_ERROR_0003=未知的數據類型轉換成TerminalType,對應數據類型為:{0} +WEB_COMMON_ERROR_0004=獲取工程信息出現錯誤,{0} +WEB_COMMON_ERROR_0005=元數據請求參數,目標元數據參數不能為空 +WEB_COMMON_ERROR_0006=當前元數據非命令元數據。元數據id是:{0} +WEB_COMMON_ERROR_0007=標識為{0}的服務構件為null。 +WEB_COMMON_ERROR_0008=不支持的操作系統類型,請聯繫開發人員處理 +WEB_COMMON_ERROR_0009=未識別的操作系統系統。請聯繫開發人員處理。 +WEB_COMMON_ERROR_0010=未識別的終端類型,請聯繫管理員處理。當前終端類型是:{0} + +WEB_FRONT_PROJECT_ERROR_0001=頁面流文件(後綴為.pf)中包含絕對路徑,依賴於單個環境路徑配置,請調整為相對路徑。具體操作:打開頁面流文件,通過將表單從頁面流中先移除再添加的方式,自動進行調整。 對應表單元數據為:{0},當前絕對路徑為:{1} +WEB_FRONT_PROJECT_ERROR_0002=頁面流文件(後綴為.pf)中配置表單元數據路徑不正確,請移除。對應表單元數據code:{0},name: {1} +#WEB_FRONT_PROJECT_ERROR_0003=未識別的終端類型,請聯繫管理員處理。當前終端類型是:{0} +WEB_FRONT_PROJECT_ERROR_0004=表單元數據提取,buildFormList參數不能為空 +WEB_FRONT_PROJECT_ERROR_0005=請設置默認首頁參數 +WEB_FRONT_PROJECT_ERROR_0006=請設置路由參數 +WEB_FRONT_PROJECT_ERROR_0007=默認首頁參數必須以index.html作為後綴,請修正! +WEB_FRONT_PROJECT_ERROR_0008=請設置正確的路徑參數,例如:apps/scm/sd/sales/index.html +WEB_FRONT_PROJECT_ERROR_0009=零代碼編譯入參不能為null +WEB_FRONT_PROJECT_ERROR_0010=零代碼編譯入參路徑參數absoluteBasePath不能為空 +WEB_FRONT_PROJECT_ERROR_0011=零代碼編譯入參工程名稱projectName不能為空 +WEB_FRONT_PROJECT_ERROR_0012=零代碼編譯入參依賴node_modules 路徑不能為空 +WEB_FRONT_PROJECT_ERROR_0013=零代碼編譯入參,至少包含一個表單參數 +WEB_FRONT_PROJECT_ERROR_0014=服務單元serviceUnitPath參數未配置 + +WEB_JIT_ENGINE_ERROR_0001=暫不支持的終端類型:{0}。請聯繫管理員處理。 +WEB_JIT_ENGINE_ERROR_0002=標識為{0}的服務構件為null。 + +WEB_FORM_METADATA_ERROR_0001=獲取command元數據{0}失敗 +WEB_FORM_METADATA_ERROR_0002=獲取ts文件名出錯,對應的web構件id不能為空。 +WEB_FORM_METADATA_ERROR_0003=獲取ts文件名出錯,web構件上獲取的文件名異常。 +WEB_FORM_METADATA_ERROR_0004=表單元數據轉換為JsonNode失敗,對應元數據為:{0} +WEB_FORM_METADATA_ERROR_0005=標識為{0}的服務構件為null。 +WEB_FORM_METADATA_ERROR_0006=不存在標識為{0}的服務構件 +WEB_FORM_METADATA_ERROR_0007=標識為{0}的服務構件name屬性不允許為null。 +WEB_FORM_METADATA_ERROR_0008="標識為{0}的服務構件path屬性不允許為null。" +WEB_FORM_METADATA_ERROR_0009=暫時無法處理frmJsonSavePath為空場景,請諮詢開發人員該功能完成情況 +WEB_FORM_METADATA_ERROR_0010=元數據獲取,構造目標元數據信息supplierAction不能為空 +WEB_FORM_METADATA_ERROR_0011=根據VoId獲取對應元數據為空,對應voId為:{0} +WEB_FORM_METADATA_ERROR_0012=目前僅支持同一個業務對象(Business Object)內的表單複製。如果需要其他場景的複製,請聯繫開發人員。 +WEB_FORM_METADATA_ERROR_0013=未能正常獲取元數據傳輸序列化器,請檢查配置,對應元數據類型為:{0} +WEB_FORM_METADATA_ERROR_0014=複製表單時,同步目標工程信息失敗。源表單ID是:{0}更多異常信息如下:{1} +WEB_FORM_METADATA_ERROR_0015=源表單存儲相對路徑屬性不包含工程名,請檢查。 +WEB_FORM_METADATA_ERROR_0016=根據業務對象獲取對應關鍵應用信息,業務對象id不能為空 +WEB_FORM_METADATA_ERROR_0017=根據業務對象獲取bo信息為空,對應業務對象id為:{0} +WEB_FORM_METADATA_ERROR_0018=待複製表單元數據ID或路徑為空。請檢查前端請求參數是否正常。 +WEB_FORM_METADATA_ERROR_0019=目標元數據Code或Name不能為空 +WEB_FORM_METADATA_ERROR_0020=表單複製,獲取元數據為空。待獲取元數據ID是:{0} +WEB_FORM_METADATA_ERROR_0021=待複製元數據所在工程的工程名為空。待複製元數據ID是:{0} +WEB_FORM_METADATA_ERROR_0022=獲取表單關聯元數據,參數不能為空 +WEB_FORM_METADATA_ERROR_0023=設計時獲取元數據,元數據文件名稱及路徑不能為空 +WEB_FORM_METADATA_ERROR_0024=運行時獲取元數據,元數據id參數不能為空 + +WEB_NPM_PACKAGE_ERROR_0001=未獲取到npm配置倉庫實例 +WEB_NPM_PACKAGE_ERROR_0002=npm安裝參數不能為空 + +WEB_TS_FILE_ERROR_0001=獲取工程路徑信息為空,對應工程路徑為:{0} +WEB_TS_FILE_ERROR_0002=沒有找到表單對應的web構件。表單路徑:{0},web構件id:{1} + +WEB_DESIGN_SCHEMA_ERROR_0001=標識為{0}的視圖對象{1}的IDElement屬性不允許為null。 +WEB_DESIGN_SCHEMA_ERROR_0002=不支持的業務字段嵌套層次,請聯繫技術人員 +WEB_DESIGN_SCHEMA_ERROR_0003=字段{0}不包含關聯實體信息。 +WEB_DESIGN_SCHEMA_ERROR_0004=Id為{0}的統一數據類型元數據為未識別的類型。 +WEB_DESIGN_SCHEMA_ERROR_0005=未獲取到id為{0}的統一數據類型(UDT)元數據。 +WEB_DESIGN_SCHEMA_ERROR_0006=字段{0}不包含關聯實體信息。 +WEB_DESIGN_SCHEMA_ERROR_0007=標識為{0},標籤為{1}的字段{2}被定義為'UnifiedDataType'字段,但是沒有指定'UnifiedDataType'標識,請檢查業務實體。 +WEB_DESIGN_SCHEMA_ERROR_0008=表單DOM結構錯誤:未找到module.schemas節點 + +WEB_JIT_ENGINE_API_ERROR_0001=根據formId 獲取元數據為空 + +WEB_FORM_PROCESS_ERROR_0001=找不到表單元數據: {0}。文件路徑:{1}。 +WEB_FORM_PROCESS_ERROR_0002=表單Vo內碼[{0}]不存在! +WEB_FORM_PROCESS_ERROR_0003=菜單[id:{0}]不存在,無法註冊到流程中心! +WEB_FORM_PROCESS_ERROR_0004=菜單[{0}]註冊到流程中心失敗! + +#rtc-template +DYNAMIC_FORM_ERROR_0001=FormType類型轉換,無效的參數類型,參數不能為空 +DYNAMIC_FORM_ERROR_0002=FormType類型轉換,無效的類型參數:{0} +DYNAMIC_FORM_ERROR_0003=無效的類型,具體參數值為:{0},待轉換的類型為ExtractFormType +DYNAMIC_FORM_ERROR_0004=根據格式定義id獲取格式定義信息,格式定義id參數不能為空 +DYNAMIC_FORM_ERROR_0005=表單類型為空。 +DYNAMIC_FORM_ERROR_0006=標識為{0}的服務構件為null。 +DYNAMIC_FORM_ERROR_0007=獲取command元數據{0}失敗 +DYNAMIC_FORM_ERROR_0008=formId參數不能為空 +DYNAMIC_FORM_ERROR_0009=根據元數據id:{0} 獲取對應元數據信息為空 + +RTC_PATCH_ERROR_0001={0}克隆失敗 +RTC_PATCH_ERROR_0002=beforeNavigate 參數轉換失敗 + +RTC_TEMPLATE_ERROR_0001=創建擴展表單時,反序列化request body失敗。{0} +RTC_TEMPLATE_ERROR_0002=Form元數據獲取失敗:{0} +RTC_TEMPLATE_ERROR_0003=運行時定製擴展表單刪除,元數據id為空 +RTC_TEMPLATE_ERROR_0004=依據元數據id:{0}獲取元數據為空 +RTC_TEMPLATE_ERROR_0005=元數據擴展檢測,依據{0}:{1} 獲取元數據信息為空 +RTC_TEMPLATE_ERROR_0006=獲取幫助元數據{0}失敗。 +RTC_TEMPLATE_ERROR_0007=獲取{0}元數據失敗,id為:{1} +RTC_TEMPLATE_ERROR_0008=根據元數據id獲取元數據信息,元數據id為空 +RTC_TEMPLATE_ERROR_0009=Help元數據關聯得VO元數據獲取失敗,id={0} +RTC_TEMPLATE_ERROR_0010=暫不支持虛擬VO創建的幫助 +RTC_TEMPLATE_ERROR_0011=標識為{0}的服務構件為null。 +RTC_TEMPLATE_ERROR_0012=獲取command元數據{0}失敗 + +NO_CODE_RUNTIME_ERROR_0001=當前登錄用戶名為空!請聯繫管理員設置當前登錄用戶當前語言下的用戶名。如已設置,請聯繫平台維護用戶登錄功能的同事處理。 +NO_CODE_RUNTIME_ERROR_0002=當前登錄用戶名為空!請聯繫平台維護用戶登錄功能的同事處理。 +NO_CODE_RUNTIME_ERROR_0003=當前登錄組織為空!請聯繫平台維護用戶登錄功能的同事處理。 +NO_CODE_RUNTIME_ERROR_0004=屬性名不存在:{0} + + +WEB_COMMON_MSG_0001=錯誤提示 +WEB_COMMON_MSG_0002=若已安裝,請嘗試重啟iGIX服務。 +WEB_COMMON_MSG_0003=當前環境 +WEB_COMMON_MSG_0004=提示 +WEB_COMMON_MSG_0005=%s node命令不可用,請安裝Nodejs,請參考:Nodejs安裝。 %3$s +WEB_COMMON_MSG_0006=%s Jit-Engine未部署,請先部署。請參考:Jit-Engine安裝。%3$s +WEB_COMMON_MSG_0007=%s 未部署依賴ng命令,請先部署,請參考: Angular-Cli安裝。%3$s +WEB_COMMON_MSG_0008= 未找到對應版本,請修正後重新執行安裝! +WEB_COMMON_MSG_0009=當前倉庫%s包不存在,請切換至其他倉庫或修正包版本,然後重新進行安裝! +WEB_COMMON_MSG_0010=連接服務器超時,請重新安裝或切換至其他倉庫,然後重新進行安裝! +WEB_COMMON_MSG_0011=權限不足,請以管理員權限運行以進行Npm在線安裝! + +WEB_FRONT_PROJECT_MSG_0001=找不到頁面流元數據,請檢查對應app.config.json文件中配置頁面流元數據id是否正確或頁面流元數據是否被移除。 +WEB_FRONT_PROJECT_MSG_0002=找不到對應頁面流元數據,對應頁面流元數據id為:%s +WEB_FRONT_PROJECT_MSG_0003=讀取IDE配置文件出現錯誤,請檢查文件內容 + +WEB_JIT_ENGINE_MSG_0001=編譯依賴node_modules未部署,請先部署。部署路徑為:%s +WEB_JIT_ENGINE_MSG_0002=編譯依賴node_modules未部署,請先部署。部署路徑為:%s或開啟Npm在線安裝(需要網絡連接)。 +WEB_JIT_ENGINE_MSG_0003=當前node_modules不包含移動npm包,請使用Npm在線安裝或更新最新node_modules離線包。請注意:移動表單編譯不再使用mobile目錄下的node_modules,使用工程目錄下node_modules。 + +WEB_FORM_METADATA_MSG_0001=獲取命令元數據為空,對應元數據id為:%s +WEB_FORM_METADATA_MSG_0002=獲取WebComponent元數據為空,對應元數據id為:%s +WEB_FORM_METADATA_MSG_0003=獲取web構件元數據為空,對應元數據id為:%s +WEB_FORM_METADATA_MSG_0004=根據元數據id獲取元數據信息為空,對應元數據id:%s,元數據類型為:%s +WEB_FORM_METADATA_MSG_0005=獲取ts命令元數據為空,對應ts命令元數據id:%s +WEB_FORM_METADATA_MSG_0006=目標元數據存在,無法進行複製。對應目標元數據名稱:%s,所屬工程路徑:%s +WEB_FORM_METADATA_MSG_0007=待複製表單元數據內容為空 +WEB_FORM_METADATA_MSG_0008=僅支持表單元數據複製 +WEB_FORM_METADATA_MSG_0009=待複製的表單元數據不存在,請確認該元數據是否已被刪除。 +WEB_FORM_METADATA_MSG_0010=表單複製失敗,待複製的表單元數據不存在,請確認該元數據是否已被刪除 + +WEB_NPM_PACKAGE_MSG_0001=請設置npm install 運行位置參數:ExecuteEnvironment +WEB_NPM_PACKAGE_MSG_0002=請設置帳號 +WEB_NPM_PACKAGE_MSG_0003=請設置密碼 +WEB_NPM_PACKAGE_MSG_0004=請設置待更新的npm包及其版本,或設置全部更新 +WEB_NPM_PACKAGE_MSG_0005=當前為從不更新模式,無法在線執行install操作 +WEB_NPM_PACKAGE_MSG_0006=當前為離線模式,無需執行install操作 +WEB_NPM_PACKAGE_MSG_0007=npm 正在全局安裝,若需重新安裝,請刪除lock文件! +WEB_NPM_PACKAGE_MSG_0008=執行全局離線包安裝 +WEB_NPM_PACKAGE_MSG_0009=全局離線包臨時文件路徑為:%s +WEB_NPM_PACKAGE_MSG_0010=全局離線包安裝失敗,%s +WEB_NPM_PACKAGE_MSG_0011=全局離線包安裝完成 +WEB_NPM_PACKAGE_MSG_0012=全局離線包版本未發生變更,無需執行全局離線包安裝 +WEB_NPM_PACKAGE_MSG_0013=不支持的操作系統類型,請聯繫開發人員處理 +WEB_NPM_PACKAGE_MSG_0014=npm登錄失敗,請查看網絡是否正常連接 +WEB_NPM_PACKAGE_MSG_0015=然後重新執行更新操作。 +WEB_NPM_PACKAGE_MSG_0016=請檢查Url地址是否正確或網絡是否可以聯通,%s +WEB_NPM_PACKAGE_MSG_0017=用戶名或密碼錯誤,請修正後重新執行更新操作。 +WEB_NPM_PACKAGE_MSG_0018=請檢查Url地址是否正確或用戶名是否存在,請修正後重新執行更新操作。 +WEB_NPM_PACKAGE_MSG_0019=npm配置信息為空,請設置 +WEB_NPM_PACKAGE_MSG_0020=WEB_NPM_PACKAGE_ERROR_0003 +WEB_NPM_PACKAGE_MSG_0021=離線模式下無法執行在線install +WEB_NPM_PACKAGE_MSG_0022=執行離線包緩存清理 +WEB_NPM_PACKAGE_MSG_0023=未獲取到當前配置npm倉庫 +WEB_NPM_PACKAGE_MSG_0024=當前配置策略不是自動更新,無法執行在線install操作。 +WEB_NPM_PACKAGE_MSG_0025=升級工具執行,npm包版本不進行檢測 +WEB_NPM_PACKAGE_MSG_0026=未配置編譯依賴node_modules,請在 Npm包管理進行在線安裝。node_modules路徑為:%s +WEB_NPM_PACKAGE_MSG_0027=npm包版本存在更新,為保證最終腳本運行正確,需先進行更新。請在選項->設置->Npm包管理進行更新! +WEB_NPM_PACKAGE_MSG_0028=正在執行安裝操作,請勿重複執行! +WEB_NPM_PACKAGE_MSG_0029=開啟離線模式,自動更新離線包停止 +WEB_NPM_PACKAGE_MSG_0030=離線包更新策略為手工,自動更新離線包停止 +WEB_NPM_PACKAGE_MSG_0031=離線包更新策略為從不,自動更新離線包停止 +WEB_NPM_PACKAGE_MSG_0032=npm 正在安裝,若需重新安裝,請刪除lock文件! +WEB_NPM_PACKAGE_MSG_0033=server不包含package.json 文件,server path is :%s +WEB_NPM_PACKAGE_MSG_0034=離線包版本未發生變更,無需執行離線包安裝 +WEB_NPM_PACKAGE_MSG_0035=開始執行npm install 安裝 +WEB_NPM_PACKAGE_MSG_0036=開始執行npm install 命令 +WEB_NPM_PACKAGE_MSG_0037=執行npm登錄操作 +WEB_NPM_PACKAGE_MSG_0038=執行npm登出操作 +WEB_NPM_PACKAGE_MSG_0039=npm install 執行完畢 + +WEB_DESIGN_SCHEMA_MSG_0001=beBindingFieldId不能為空 +WEB_DESIGN_SCHEMA_MSG_0002=未在實體上找到對應的字段,請檢查業務字段配置信息 +WEB_DESIGN_SCHEMA_MSG_0003=更新表單schema,關聯字段元數據找不到,請修正。對應字段元數據id為:%s +WEB_DESIGN_SCHEMA_MSG_0004=更新表單Schema,獲取UDT字段元數據失敗,元數據不存在。對應元數據id為:%s +WEB_DESIGN_SCHEMA_MSG_0005=根據表單元數據獲取VO元數據為空,請檢查表單元數據module>schemas>id 是否正確,此參數為表單對應VO元數據id參數! + +WEB_RUNTIME_BUILD_MSG_0001=待寫入的目標文件路徑為:%s + +WEB_SCRIPT_CACHE_MSG_0001=表單元數據id為空 +WEB_SCRIPT_CACHE_MSG_0002=根據元數據id獲取文件列表為空,對應元數據id:%s +WEB_SCRIPT_CACHE_MSG_0003=打開當前維度失敗,請在【業務配置中心】,檢查此維度是否進行了保存預覽操作。相關元數據id: +WEB_SCRIPT_CACHE_MSG_0004=元數據對應的工程緩存信息為空,元數據id為:%s +WEB_SCRIPT_CACHE_MSG_0005=數據庫存儲的腳本文件內容為空,contentId:%s +WEB_SCRIPT_CACHE_MSG_0006=開始執行元數據版本更新檢測 +WEB_SCRIPT_CACHE_MSG_0007=元數據版本更新檢測完成,id:%s,version:%s +WEB_SCRIPT_CACHE_MSG_0008=清理DBO及BE緩存,表單元數據id為:%s +WEB_SCRIPT_CACHE_MSG_0009="元數據版本更新檢測失敗,id:%s version:%s +WEB_SCRIPT_CACHE_MSG_0010=清理VO元數據,元數據id為:%s +WEB_SCRIPT_CACHE_MSG_0011=清理DBO,對應id為:%s +WEB_SCRIPT_CACHE_MSG_0012=清理be元數據,元數據id為:%s +WEB_SCRIPT_CACHE_MSG_0013=未找到工程對應的腳本緩存信息,工程名稱:%s +WEB_SCRIPT_CACHE_MSG_0014=absoluteBaseDirectory:%s 獲取文件列表個數為:%s +WEB_SCRIPT_CACHE_MSG_0015=開始執行元數據版本更新 +WEB_SCRIPT_CACHE_MSG_0016=元數據版本更新完成,id:%s,version:%s +WEB_SCRIPT_CACHE_MSG_0017=元數據版本更新失敗,id:%s,version:%s +WEB_SCRIPT_CACHE_MSG_0018=腳本檢測,工程名稱不能為空 +WEB_SCRIPT_CACHE_MSG_0019=腳本檢測,工程路徑不能為空 + +#rtc-template +DYNAMIC_FORM_MSG_0001=格式定義 +DYNAMIC_FORM_MSG_0002=未知 +DYNAMIC_FORM_MSG_0003=PC表單 +DYNAMIC_FORM_MSG_0004=移動表單 +DYNAMIC_FORM_MSG_0005=是否可見 +DYNAMIC_FORM_MSG_0006=是否禁用 +DYNAMIC_FORM_MSG_0007=是否必填 +DYNAMIC_FORM_MSG_0008=是否只讀 +DYNAMIC_FORM_MSG_0009=獲取合適的格式定義,入參為空 +DYNAMIC_FORM_MSG_0010=獲取合適的格式定義,元數據id參數為空 +DYNAMIC_FORM_MSG_0011=實獲取合適的格式定義,實體數據code參數不能為空 +DYNAMIC_FORM_MSG_0012=格式定義保存,配置參數不能為空。 +DYNAMIC_FORM_MSG_0013=格式定義保存,元數據id參數不能為空。 +DYNAMIC_FORM_MSG_0014=格式定義編號不能為空。 +DYNAMIC_FORM_MSG_0015=格式定義名稱不能為空。 +DYNAMIC_FORM_MSG_0016=格式定義操作狀態不能為空,可為add或edit其中之一。 +DYNAMIC_FORM_MSG_0017=格式定義更新參數不能為空 +DYNAMIC_FORM_MSG_0018=格式定義更新,格式定義id參數不能為空 +DYNAMIC_FORM_MSG_0019=格式定義更新,關聯元數據id參數不能為空 +DYNAMIC_FORM_MSG_0020=格式定義更新,關聯元數據不能為空 +DYNAMIC_FORM_MSG_0021=使用格式定義:%s +DYNAMIC_FORM_MSG_0022=格式分配條件表達式解析失敗,已跳過該表達式解析。對應表達式為:%s +DYNAMIC_FORM_MSG_0023=使用格式定義:%s,格式定義分配條件為空。 +DYNAMIC_FORM_MSG_0024=格式定義分配,配置參數不能為空。 +DYNAMIC_FORM_MSG_0025=格式定義分配條件獲取,格式定義id不能為空。 +DYNAMIC_FORM_MSG_0026=格式定義分配條件獲取,元數據id不能為空。 +DYNAMIC_FORM_MSG_0027=格式定義分配條件保存,參數不能為空! +DYNAMIC_FORM_MSG_0028=格式定義分配條件保存,格式定義id參數不能為空! +DYNAMIC_FORM_MSG_0029=格式定義分配條件保存,元數據id參數不能為空! +DYNAMIC_FORM_MSG_0030=未匹配到任何格式定義 +DYNAMIC_FORM_MSG_0031=是否允許刪除格式定義,格式定義id參數不能為空 +DYNAMIC_FORM_MSG_0032=刪除格式定義,格式定義id不能為空 +DYNAMIC_FORM_MSG_0033=依據格式定義id刪除對應格式定義失敗,%s +DYNAMIC_FORM_MSG_0034=格式定義分配條件,根據元數據id獲取元數據為空,對應元數據id為:%s +DYNAMIC_FORM_MSG_0035=格式定義id不能為空。 +DYNAMIC_FORM_MSG_0036=依據格式定義id獲取格式定義信息為空,請檢查格式定義id是否正確,格式定義id參數為:%s +DYNAMIC_FORM_MSG_0037=根據元數據id獲取元數據信息為空,對應元數據id為:%s +DYNAMIC_FORM_MSG_0038=格式定義關聯元數據只能為表單類型,對應元數據id:%s,元數據編號為:%s +DYNAMIC_FORM_MSG_0039=添加格式定義必須參數元數據id為空 +DYNAMIC_FORM_MSG_0040=根據元數據id獲取元數據信息失敗,無法對其添加格式定義,元數據id為: +DYNAMIC_FORM_MSG_0041=根據元數據id獲取元數據失敗,%s +DYNAMIC_FORM_MSG_0042=內碼 +DYNAMIC_FORM_MSG_0043=動作 +DYNAMIC_FORM_MSG_0044=列表 +DYNAMIC_FORM_MSG_0045=附件 + +RTC_TEMPLATE_MSG_0001=系統模板 +RTC_TEMPLATE_MSG_0002=擴展模板 +RTC_TEMPLATE_MSG_0003=簡單字段類型 +RTC_TEMPLATE_MSG_0004=複雜字段類型 + +RTC_MENU_MSG_0001=獲取菜單擴展查詢參數時反序列化失敗,funcId {0}||{1} + +RTC_PATCH_MSG_0001=當前表單需要更新發布,請聯繫管理員前往業務配置中心預覽升級。 + + diff --git a/jitengine-web-api/src/main/java/com/inspur/edp/web/jitengine/web/api/constant/I18nExceptionConstant.java b/jitengine-web-api/src/main/java/com/inspur/edp/web/jitengine/web/api/constant/I18nExceptionConstant.java new file mode 100644 index 0000000000000000000000000000000000000000..d345d32f203493dba89f49af6950838e89123631 --- /dev/null +++ b/jitengine-web-api/src/main/java/com/inspur/edp/web/jitengine/web/api/constant/I18nExceptionConstant.java @@ -0,0 +1,5 @@ +package com.inspur.edp.web.jitengine.web.api.constant; + +public class I18nExceptionConstant { + public final static String WEB_JIT_ENGINE_API_ERROR_0001 = "WEB_JIT_ENGINE_API_ERROR_0001"; +} diff --git a/jitengine-web-core/src/main/java/com/inspur/edp/web/jitengine/web/core/service/JitEngineServiceImpl.java b/jitengine-web-core/src/main/java/com/inspur/edp/web/jitengine/web/core/service/JitEngineServiceImpl.java index 6764879304f85eab596d4f5f2779e32cd396965f..e64ed4322d17dc31473095cf5aef86832662a0e0 100644 --- a/jitengine-web-core/src/main/java/com/inspur/edp/web/jitengine/web/core/service/JitEngineServiceImpl.java +++ b/jitengine-web-core/src/main/java/com/inspur/edp/web/jitengine/web/core/service/JitEngineServiceImpl.java @@ -17,6 +17,7 @@ package com.inspur.edp.web.jitengine.web.core.service; import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.web.common.customexception.WebCustomException; import com.inspur.edp.web.common.io.FileUtility; import com.inspur.edp.web.common.logger.WebLogger; import com.inspur.edp.web.common.utility.StringUtility; @@ -27,7 +28,7 @@ public class JitEngineServiceImpl implements JitEngineService { @Override public void deleteMobileApproveDevSource(String formId) throws Exception { if (StringUtility.isNullOrEmpty(formId)) { - throw new Exception("delete mobileapprove dev source failed,the formId is null"); + throw new WebCustomException("delete mobileapprove dev source failed,the formId is null"); } GspMetadata gspMetadata = MobileApprovePreviewImpl.getGspMetadataWithFormId(formId); diff --git a/jitengine-web-core/src/main/java/com/inspur/edp/web/jitengine/web/core/service/MobileApprovePreviewImpl.java b/jitengine-web-core/src/main/java/com/inspur/edp/web/jitengine/web/core/service/MobileApprovePreviewImpl.java index 7426ee7522d05a849fa5dd1ae7537ca89caa5a43..d41f57ae2a26e7ff9865d731ba09f929ab503e3e 100644 --- a/jitengine-web-core/src/main/java/com/inspur/edp/web/jitengine/web/core/service/MobileApprovePreviewImpl.java +++ b/jitengine-web-core/src/main/java/com/inspur/edp/web/jitengine/web/core/service/MobileApprovePreviewImpl.java @@ -20,6 +20,7 @@ import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import com.inspur.edp.web.common.customexception.WebCustomException; import com.inspur.edp.web.common.io.FileUtility; import com.inspur.edp.web.common.metadata.MetadataUtility; +import com.inspur.edp.web.jitengine.web.api.constant.I18nExceptionConstant; import com.inspur.edp.web.jitengine.web.api.service.MobileApproveReviewParameter; import io.iec.edp.caf.businessobject.api.entity.DevBasicBoInfo; import io.iec.edp.caf.businessobject.api.service.DevBasicInfoService; @@ -56,7 +57,7 @@ public class MobileApprovePreviewImpl { GspMetadata gspMetadata = MetadataUtility.getInstance().getMetadataInRuntime(formId); if (gspMetadata == null) { - throw new WebCustomException("根据formId 获取元数据为空"); + throw new WebCustomException(I18nExceptionConstant.WEB_JIT_ENGINE_API_ERROR_0001); } return gspMetadata; } diff --git a/metadata/web-pageflow-metadata/src/main/java/com/inspur/edp/web/pageflow/metadata/entity/PagePublish.java b/metadata/web-pageflow-metadata/src/main/java/com/inspur/edp/web/pageflow/metadata/entity/PagePublish.java index 2d79caf5248801204b417caae4941c27991a4ce4..c36478ee67b43c38ae3f7d579fe706a3a169c608 100644 --- a/metadata/web-pageflow-metadata/src/main/java/com/inspur/edp/web/pageflow/metadata/entity/PagePublish.java +++ b/metadata/web-pageflow-metadata/src/main/java/com/inspur/edp/web/pageflow/metadata/entity/PagePublish.java @@ -16,9 +16,17 @@ package com.inspur.edp.web.pageflow.metadata.entity; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter public class PagePublish { private String id; private String entry; + private String type; + private String processCategory; + public String getId() { return id; diff --git a/metadata/web-pageflow-metadata/src/main/java/com/inspur/edp/web/pageflow/metadata/service/RouteMetadataService.java b/metadata/web-pageflow-metadata/src/main/java/com/inspur/edp/web/pageflow/metadata/service/RouteMetadataService.java index fdd5cb780e637816cba6187b2c48f92ea9f33be1..e7fc74b4585e3bc0050a22869ba6c2ab061ba826 100644 --- a/metadata/web-pageflow-metadata/src/main/java/com/inspur/edp/web/pageflow/metadata/service/RouteMetadataService.java +++ b/metadata/web-pageflow-metadata/src/main/java/com/inspur/edp/web/pageflow/metadata/service/RouteMetadataService.java @@ -99,7 +99,7 @@ public class RouteMetadataService { */ public static String getCurrentPageRouteUri(PageFlowMetadataEntity pageFlowMetadataEntity, String pageId) { if (pageFlowMetadataEntity == null || StringUtility.isNullOrEmpty(pageId)) { - throw new WebCustomException("Current Route Metadata Content is Null or the Page id is Nulll or Empty.", null, ExceptionLevel.Warning); + throw new WebCustomException("Current Route Metadata Content is Null or the Page id is Nulll or Empty.", ExceptionLevel.Warning); } return PageFlowMetadataEntityManager.getPageRouteUri(pageFlowMetadataEntity, pageId); diff --git a/npmpackage/web-npmpackage-api/src/main/java/com/inspur/edp/web/npmpackage/api/constant/I18nExceptionConstant.java b/npmpackage/web-npmpackage-api/src/main/java/com/inspur/edp/web/npmpackage/api/constant/I18nExceptionConstant.java new file mode 100644 index 0000000000000000000000000000000000000000..f822c2dac4fa109fddf2ac8645cfa701b5ce89fe --- /dev/null +++ b/npmpackage/web-npmpackage-api/src/main/java/com/inspur/edp/web/npmpackage/api/constant/I18nExceptionConstant.java @@ -0,0 +1,19 @@ +package com.inspur.edp.web.npmpackage.api.constant; + +public class I18nExceptionConstant { + public final static String WEB_NPM_PACKAGE_ERROR_0001 = "WEB_NPM_PACKAGE_ERROR_0001"; + public final static String WEB_NPM_PACKAGE_ERROR_0002 = "WEB_NPM_PACKAGE_ERROR_0002"; + public final static String WEB_NPM_PACKAGE_ERROR_0003 = "WEB_NPM_PACKAGE_ERROR_0003"; + public final static String WEB_NPM_PACKAGE_ERROR_0004 = "WEB_NPM_PACKAGE_ERROR_0004"; + public final static String WEB_NPM_PACKAGE_ERROR_0005 = "WEB_NPM_PACKAGE_ERROR_0005"; + public final static String WEB_NPM_PACKAGE_ERROR_0006 = "WEB_NPM_PACKAGE_ERROR_0006"; + public final static String WEB_NPM_PACKAGE_ERROR_0007 = "WEB_NPM_PACKAGE_ERROR_0007"; + public final static String WEB_NPM_PACKAGE_ERROR_0008 = "WEB_NPM_PACKAGE_ERROR_0008"; + public final static String WEB_NPM_PACKAGE_ERROR_0009 = "WEB_NPM_PACKAGE_ERROR_0009"; + public final static String WEB_NPM_PACKAGE_ERROR_0010 = "WEB_NPM_PACKAGE_ERROR_0010"; + public final static String WEB_NPM_PACKAGE_ERROR_0011 = "WEB_NPM_PACKAGE_ERROR_0011"; + public final static String WEB_NPM_PACKAGE_ERROR_0012 = "WEB_NPM_PACKAGE_ERROR_0012"; + public final static String WEB_NPM_PACKAGE_ERROR_0013 = "WEB_NPM_PACKAGE_ERROR_0013"; + public final static String WEB_NPM_PACKAGE_ERROR_0014 = "WEB_NPM_PACKAGE_ERROR_0014"; + public final static String WEB_NPM_PACKAGE_ERROR_0015 = "WEB_NPM_PACKAGE_ERROR_0015"; +} diff --git a/npmpackage/web-npmpackage-api/src/main/java/com/inspur/edp/web/npmpackage/api/constant/I18nMsgConstant.java b/npmpackage/web-npmpackage-api/src/main/java/com/inspur/edp/web/npmpackage/api/constant/I18nMsgConstant.java new file mode 100644 index 0000000000000000000000000000000000000000..eaad7362c797d4aaef721e418f2483889cd9fbc1 --- /dev/null +++ b/npmpackage/web-npmpackage-api/src/main/java/com/inspur/edp/web/npmpackage/api/constant/I18nMsgConstant.java @@ -0,0 +1,44 @@ +package com.inspur.edp.web.npmpackage.api.constant; + +public class I18nMsgConstant { + public final static String WEB_NPM_PACKAGE_MSG_0001 = "WEB_NPM_PACKAGE_MSG_0001"; + public final static String WEB_NPM_PACKAGE_MSG_0002 = "WEB_NPM_PACKAGE_MSG_0002"; + public final static String WEB_NPM_PACKAGE_MSG_0003 = "WEB_NPM_PACKAGE_MSG_0003"; + public final static String WEB_NPM_PACKAGE_MSG_0004 = "WEB_NPM_PACKAGE_MSG_0004"; + public final static String WEB_NPM_PACKAGE_MSG_0005 = "WEB_NPM_PACKAGE_MSG_0005"; + public final static String WEB_NPM_PACKAGE_MSG_0006 = "WEB_NPM_PACKAGE_MSG_0006"; + public final static String WEB_NPM_PACKAGE_MSG_0007 = "WEB_NPM_PACKAGE_MSG_0007"; + public final static String WEB_NPM_PACKAGE_MSG_0008 = "WEB_NPM_PACKAGE_MSG_0008"; + public final static String WEB_NPM_PACKAGE_MSG_0009 = "WEB_NPM_PACKAGE_MSG_0009"; + public final static String WEB_NPM_PACKAGE_MSG_0010 = "WEB_NPM_PACKAGE_MSG_0010"; + public final static String WEB_NPM_PACKAGE_MSG_0011 = "WEB_NPM_PACKAGE_MSG_0011"; + public final static String WEB_NPM_PACKAGE_MSG_0012 = "WEB_NPM_PACKAGE_MSG_0012"; + public final static String WEB_NPM_PACKAGE_MSG_0013 = "WEB_NPM_PACKAGE_MSG_0013"; + public final static String WEB_NPM_PACKAGE_MSG_0014 = "WEB_NPM_PACKAGE_MSG_0014"; + public final static String WEB_NPM_PACKAGE_MSG_0015 = "WEB_NPM_PACKAGE_MSG_0015"; + public final static String WEB_NPM_PACKAGE_MSG_0016 = "WEB_NPM_PACKAGE_MSG_0016"; + public final static String WEB_NPM_PACKAGE_MSG_0017 = "WEB_NPM_PACKAGE_MSG_0017"; + public final static String WEB_NPM_PACKAGE_MSG_0018 = "WEB_NPM_PACKAGE_MSG_0018"; + public final static String WEB_NPM_PACKAGE_MSG_0019 = "WEB_NPM_PACKAGE_MSG_0019"; + public final static String WEB_NPM_PACKAGE_MSG_0020 = "WEB_NPM_PACKAGE_MSG_0020"; + public final static String WEB_NPM_PACKAGE_MSG_0021 = "WEB_NPM_PACKAGE_MSG_0021"; + public final static String WEB_NPM_PACKAGE_MSG_0022 = "WEB_NPM_PACKAGE_MSG_0022"; + public final static String WEB_NPM_PACKAGE_MSG_0023 = "WEB_NPM_PACKAGE_MSG_0023"; + public final static String WEB_NPM_PACKAGE_MSG_0024 = "WEB_NPM_PACKAGE_MSG_0024"; + public final static String WEB_NPM_PACKAGE_MSG_0025 = "WEB_NPM_PACKAGE_MSG_0025"; + public final static String WEB_NPM_PACKAGE_MSG_0026 = "WEB_NPM_PACKAGE_MSG_0026"; + public final static String WEB_NPM_PACKAGE_MSG_0027 = "WEB_NPM_PACKAGE_MSG_0027"; + public final static String WEB_NPM_PACKAGE_MSG_0028 = "WEB_NPM_PACKAGE_MSG_0028"; + public final static String WEB_NPM_PACKAGE_MSG_0029 = "WEB_NPM_PACKAGE_MSG_0029"; + public final static String WEB_NPM_PACKAGE_MSG_0030 = "WEB_NPM_PACKAGE_MSG_0030"; + public final static String WEB_NPM_PACKAGE_MSG_0031 = "WEB_NPM_PACKAGE_MSG_0031"; + public final static String WEB_NPM_PACKAGE_MSG_0032 = "WEB_NPM_PACKAGE_MSG_0032"; + public final static String WEB_NPM_PACKAGE_MSG_0033 = "WEB_NPM_PACKAGE_MSG_0033"; + public final static String WEB_NPM_PACKAGE_MSG_0034 = "WEB_NPM_PACKAGE_MSG_0034"; + public final static String WEB_NPM_PACKAGE_MSG_0035 = "WEB_NPM_PACKAGE_MSG_0035"; + public final static String WEB_NPM_PACKAGE_MSG_0036 = "WEB_NPM_PACKAGE_MSG_0036"; + public final static String WEB_NPM_PACKAGE_MSG_0037 = "WEB_NPM_PACKAGE_MSG_0037"; + public final static String WEB_NPM_PACKAGE_MSG_0038 = "WEB_NPM_PACKAGE_MSG_0038"; + public final static String WEB_NPM_PACKAGE_MSG_0039 = "WEB_NPM_PACKAGE_MSG_0039"; + +} diff --git a/npmpackage/web-npmpackage-core/pom.xml b/npmpackage/web-npmpackage-core/pom.xml index fc752b6adc57c9396c4d671dfa1f8dab2f78bf86..986a25f5ad77ee008cd6a84fa20dbdd8cd27d636 100644 --- a/npmpackage/web-npmpackage-core/pom.xml +++ b/npmpackage/web-npmpackage-core/pom.xml @@ -44,5 +44,9 @@ com.inspur.edp lcm-logging-service + + io.iec.edp + caf-boot-commons-cryptography + diff --git a/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/cacheclean/NpmCacheCleanCommandExecutor.java b/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/cacheclean/NpmCacheCleanCommandExecutor.java index 7afd9f807f9988c10b92abf1815bd5c1ba3ee7a8..788ae2dbf4c2212144e587f1a96210a569cf4853 100644 --- a/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/cacheclean/NpmCacheCleanCommandExecutor.java +++ b/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/cacheclean/NpmCacheCleanCommandExecutor.java @@ -22,7 +22,9 @@ import com.inspur.edp.web.common.io.FileUtility; import com.inspur.edp.web.common.io.NodejsFunctionUtility; import com.inspur.edp.web.common.logger.WebLogger; import com.inspur.edp.web.common.utility.CommandLineUtility; +import com.inspur.edp.web.common.utility.ResourceLocalizeUtil; import com.inspur.edp.web.common.utility.StringUtility; +import com.inspur.edp.web.npmpackage.api.constant.I18nMsgConstant; import com.inspur.edp.web.npmpackage.api.entity.NpmInstallParameter; import com.inspur.edp.web.npmpackage.api.entity.NpmPackageResponse; @@ -41,7 +43,7 @@ public class NpmCacheCleanCommandExecutor { // 构造install 命令参数 执行npm包安装操作 - WebLogger.Instance.info("执行离线包缓存清理", NpmCacheCleanCommandExecutor.class.getName()); + WebLogger.Instance.info(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0022), NpmCacheCleanCommandExecutor.class.getName()); boolean isUpgradeTool = npmInstallParameter.getExecuteEnvironment() == ExecuteEnvironment.UpgradeTool; String currentWorkPath = FileUtility.getCurrentWorkPath(isUpgradeTool); diff --git a/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/npminstall/NpmInstallManager.java b/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/npminstall/NpmInstallManager.java index 5e9544f8cc4e7fb4307be0dc16853f1d7a3062d0..94009ad5b542eb0dbecf94d1d3576f9c4fbe8dcc 100644 --- a/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/npminstall/NpmInstallManager.java +++ b/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/npminstall/NpmInstallManager.java @@ -20,7 +20,9 @@ import com.inspur.edp.web.common.environment.ExecuteEnvironment; import com.inspur.edp.web.common.io.FileUtility; import com.inspur.edp.web.common.logger.WebLogger; import com.inspur.edp.web.common.utility.CommonUtility; +import com.inspur.edp.web.common.utility.ResourceLocalizeUtil; import com.inspur.edp.web.common.utility.StringUtility; +import com.inspur.edp.web.npmpackage.api.constant.I18nMsgConstant; import com.inspur.edp.web.npmpackage.api.entity.NpmInstallParameter; import com.inspur.edp.web.npmpackage.api.entity.NpmPackageConstants; import com.inspur.edp.web.npmpackage.api.entity.NpmPackageResponse; @@ -80,7 +82,7 @@ public class NpmInstallManager { FileUtility.deleteFile(lockFilePath); } else { if (FileUtility.exists(lockFilePath)) { - return NpmPackageResponse.createError("正在执行安装操作,请勿重复执行!"); + return NpmPackageResponse.createError(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0028)); } } } @@ -129,15 +131,15 @@ public class NpmInstallManager { } if (!enableForceUpdate) { if (npmInstallParameter.isOfflineMode()) { - WebLogger.Instance.info("开启离线模式,自动更新离线包停止", NpmInstallManager.class.getName()); + WebLogger.Instance.info(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0029), NpmInstallManager.class.getName()); return npmPackageResponse; } if (npmInstallParameter.getUpdatePolicy().equals(NpmUpdatePolicy.manual)) { - WebLogger.Instance.info("离线包更新策略为手工,自动更新离线包停止", NpmInstallManager.class.getName()); + WebLogger.Instance.info(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0030), NpmInstallManager.class.getName()); return npmPackageResponse; } if (npmInstallParameter.getUpdatePolicy().equals(NpmUpdatePolicy.never)) { - WebLogger.Instance.info("离线包更新策略为Never,自动更新离线包停止", NpmInstallManager.class.getName()); + WebLogger.Instance.info(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0031), NpmInstallManager.class.getName()); return npmPackageResponse; } } @@ -165,12 +167,13 @@ public class NpmInstallManager { // 避免多线程同时访问造成 synchronized (_lockObj) { if (FileUtility.exists(lockFilePath)) { - return NpmPackageResponse.createError("npm 正在安装,若需重新安装,请删除lock文件!"); + return NpmPackageResponse.createError(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0032)); } } String packageJsonPathInServer = PackageJsonPathGenerator.generate(currentWorkPath, npmInstallParameter.isMobile()); if (!FileUtility.exists(packageJsonPathInServer)) { - String errorMessage = "server不包含package.json 文件,server path is :" + packageJsonPathInServer; + + String errorMessage = ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0033, packageJsonPathInServer); WebLogger.Instance.info(errorMessage, NpmInstallManager.class.getName()); return NpmPackageResponse.create(); } @@ -188,7 +191,7 @@ public class NpmInstallManager { NpmPackageJsonInfo nodeModulesPackageJsonInfo = NpmPackageCheck.packageJsonInfoGenerate(nodeModulesPackageJsonContent); if (serverPackageJsonInfo.equals(nodeModulesPackageJsonInfo)) { - WebLogger.Instance.info("离线包版本未发生变更,无需执行离线包安装", NpmInstallManager.class.getName()); + WebLogger.Instance.info(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0034), NpmInstallManager.class.getName()); deleteLockFile(lockFilePath); return NpmPackageResponse.create(); } @@ -206,16 +209,16 @@ public class NpmInstallManager { if (!FileUtility.exists(parentNode_ModulesPath)) { FileUtility.createDirectory(parentNode_ModulesPath); } - WebLogger.Instance.info("开始执行npm install 安装", NpmInstallManager.class.getName()); + WebLogger.Instance.info(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0035), NpmInstallManager.class.getName()); - WebLogger.Instance.info("开始执行npm install 命令", NpmInstallManager.class.getName()); + WebLogger.Instance.info(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0036), NpmInstallManager.class.getName()); // 仅在帐号和密码都设置的前提下进行登录操作 boolean needLogin = !StringUtility.isNullOrEmpty(npmInstallParameter.getUserName()) && !StringUtility.isNullOrEmpty(npmInstallParameter.getPassword()); if (needLogin) { - WebLogger.Instance.info("执行npm登录操作", NpmInstallManager.class.getName()); + WebLogger.Instance.info(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0037), NpmInstallManager.class.getName()); NpmPackageResponse loginPackageResponse = NpmLoginCommandExecutor.execute(npmInstallParameter, currentWorkPath); if (!loginPackageResponse.isSuccess()) { deleteLockFile(lockFilePath); @@ -241,7 +244,7 @@ public class NpmInstallManager { if (false) { // 仅在需要登录的前提下执行登录退出操作 - WebLogger.Instance.info("执行npm登出操作", NpmInstallManager.class.getName()); + WebLogger.Instance.info(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0038), NpmInstallManager.class.getName()); NpmPackageResponse logoutPackgaeResponse = NpmLogoutCommandExecutor.execute(npmInstallParameter, currentWorkPath); if (!logoutPackgaeResponse.isSuccess()) { deleteLockFile(lockFilePath); @@ -255,7 +258,7 @@ public class NpmInstallManager { deleteLockFile(lockFilePath); - WebLogger.Instance.info("npm install 执行完毕", NpmInstallManager.class.getName()); + WebLogger.Instance.info(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0039), NpmInstallManager.class.getName()); return NpmPackageResponse.create(); } diff --git a/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/npminstall/NpmInstallParameterValidator.java b/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/npminstall/NpmInstallParameterValidator.java index 61ea7dc18140244fe1143994ec0a14d23fd54517..5a054916cc25baf90b2b53438fdd9894d54a9e93 100644 --- a/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/npminstall/NpmInstallParameterValidator.java +++ b/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/npminstall/NpmInstallParameterValidator.java @@ -17,7 +17,9 @@ package com.inspur.edp.web.npmpackage.core.npminstall; import com.inspur.edp.web.common.environment.ExecuteEnvironment; +import com.inspur.edp.web.common.utility.ResourceLocalizeUtil; import com.inspur.edp.web.common.utility.StringUtility; +import com.inspur.edp.web.npmpackage.api.constant.I18nMsgConstant; import com.inspur.edp.web.npmpackage.api.entity.NpmInstallParameter; import com.inspur.edp.web.npmpackage.api.entity.NpmPackageResponse; import com.inspur.edp.web.npmpackage.api.entity.NpmPackageResponseLevel; @@ -39,25 +41,25 @@ class NpmInstallParameterValidator { ExecuteEnvironment executeEnvironment = npmInstallParameter.getExecuteEnvironment(); if (executeEnvironment.equals(ExecuteEnvironment.None)) { // 表示是设计时 - return NpmPackageResponse.createError("请设置npm install 运行位置参数:ExecuteEnvironment"); + return NpmPackageResponse.createError(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0001)); } if (StringUtility.isNullOrEmpty(npmInstallParameter.getUserName()) && !StringUtility.isNullOrEmpty(npmInstallParameter.getPassword())) { - return NpmPackageResponse.createError("请设置帐号"); + return NpmPackageResponse.createError(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0002)); } if (StringUtility.isNullOrEmpty(npmInstallParameter.getPassword()) && !StringUtility.isNullOrEmpty(npmInstallParameter.getUserName())) { - return NpmPackageResponse.createError("请设置密码"); + return NpmPackageResponse.createError(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0003)); } if (!npmInstallParameter.isUpdateAll() && npmInstallParameter.getNpmInstallPackageParameterList().size() == 0) { - return NpmPackageResponse.createError("请设置待更新的npm包及其版本,或设置全部更新"); + return NpmPackageResponse.createError(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0004)); } // 如果更新策略为never if (npmInstallParameter.getUpdatePolicy().equals(NpmUpdatePolicy.never)) { NpmPackageResponse npmPackageResponse = new NpmPackageResponse(); npmPackageResponse.setResponseLevel(NpmPackageResponseLevel.Info); npmPackageResponse.setSuccess(true); - npmPackageResponse.setErrorMessage("当前为从不更新模式,无法在线执行install操作"); + npmPackageResponse.setErrorMessage(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0005)); return npmPackageResponse; } @@ -66,7 +68,7 @@ class NpmInstallParameterValidator { NpmPackageResponse npmPackageResponse = new NpmPackageResponse(); npmPackageResponse.setResponseLevel(NpmPackageResponseLevel.Info); npmPackageResponse.setSuccess(true); - npmPackageResponse.setErrorMessage("当前为离线模式,无需执行install操作"); + npmPackageResponse.setErrorMessage(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0006)); return npmPackageResponse; } return NpmPackageResponse.create(); diff --git a/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/npminstall/global/NpmInstallGlobalChecker.java b/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/npminstall/global/NpmInstallGlobalChecker.java index aa9c66a1eccdaad555a76cc746b821a0ba2d4542..aa68fa6d768537e1cb09428f926c3bf6f6d9e719 100644 --- a/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/npminstall/global/NpmInstallGlobalChecker.java +++ b/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/npminstall/global/NpmInstallGlobalChecker.java @@ -3,6 +3,8 @@ package com.inspur.edp.web.npmpackage.core.npminstall.global; import com.inspur.edp.web.common.environment.ExecuteEnvironment; import com.inspur.edp.web.common.io.FileUtility; import com.inspur.edp.web.common.logger.WebLogger; +import com.inspur.edp.web.common.utility.ResourceLocalizeUtil; +import com.inspur.edp.web.npmpackage.api.constant.I18nMsgConstant; import com.inspur.edp.web.npmpackage.api.entity.NpmInstallParameter; import com.inspur.edp.web.npmpackage.api.entity.NpmPackageResponse; import com.inspur.edp.web.npmpackage.api.entity.packagejson.NpmPackageJsonInfo; @@ -34,15 +36,15 @@ public class NpmInstallGlobalChecker { public static NpmInstallGlobalCheckResult check(NpmInstallParameter npmInstallParameter) { NpmInstallGlobalCheckResult checkResult = NpmInstallGlobalCheckResult.init(); if (npmInstallParameter.isOfflineMode()) { - String errorMessage = "开启离线模式,自动更新离线包停止"; + String errorMessage = ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0029); return checkResult.setReason(errorMessage); } if (npmInstallParameter.getUpdatePolicy().equals(NpmUpdatePolicy.manual)) { - String errorMessage = "离线包更新策略为手工,自动更新离线包停止"; + String errorMessage = ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0030); return checkResult.setReason(errorMessage); } if (npmInstallParameter.getUpdatePolicy().equals(NpmUpdatePolicy.never)) { - String errorMessage = "离线包更新策略为Never,自动更新离线包停止"; + String errorMessage = ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0031); return checkResult.setReason(errorMessage); } @@ -101,7 +103,7 @@ public class NpmInstallGlobalChecker { } public NpmInstallGlobalCheckResult setReason(String reason) { - this.setReason(reason); + this.reason = reason; this.setNeedInstall(false); return this; } diff --git a/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/npminstall/global/NpmInstallGlobalManager.java b/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/npminstall/global/NpmInstallGlobalManager.java index c42dac25a477b733044850f66ff7c89360016056..5dd6571a4be455a5d5d1ab3d4ac19be462c2bbe0 100644 --- a/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/npminstall/global/NpmInstallGlobalManager.java +++ b/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/npminstall/global/NpmInstallGlobalManager.java @@ -22,7 +22,9 @@ import com.inspur.edp.web.common.environment.checker.ExecuteEnvironmentChecker; import com.inspur.edp.web.common.io.FileUtility; import com.inspur.edp.web.common.logger.WebLogger; import com.inspur.edp.web.common.utility.CommonUtility; +import com.inspur.edp.web.common.utility.ResourceLocalizeUtil; import com.inspur.edp.web.common.utility.StringUtility; +import com.inspur.edp.web.npmpackage.api.constant.I18nMsgConstant; import com.inspur.edp.web.npmpackage.api.entity.NpmInstallParameter; import com.inspur.edp.web.npmpackage.api.entity.NpmPackageResponse; import com.inspur.edp.web.npmpackage.api.entity.packagejson.NpmPackageJsonInfo; @@ -106,8 +108,8 @@ public class NpmInstallGlobalManager { synchronized (_lockObj) { if (FileUtility.exists(lockFilePath)) { - WebLogger.Instance.info("npm 正在全局安装,若需重新安装,请删除lock文件!", currentClassName); - return NpmPackageResponse.createError("npm 正在全局安装,若需重新安装,请删除lock文件!"); + WebLogger.Instance.info(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0007), currentClassName); + return NpmPackageResponse.createError(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0007)); } } @@ -162,8 +164,8 @@ public class NpmInstallGlobalManager { synchronized (_lockObj) { FileUtility.createFile(lockFilePath); } - WebLogger.Instance.info("执行全局离线包安装", currentClassName); - WebLogger.Instance.info("全局离线包临时文件路径为:" + tmpPackageJsonFilePath, currentClassName); + WebLogger.Instance.info(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0008), currentClassName); + WebLogger.Instance.info(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0009, tmpPackageJsonFilePath), currentClassName); NpmPackageJsonInfo finalNodeModulesPackageJsonInfo = tmpPackageJsonInfo; boolean finalIsSameCopiledFile = isSameCopiledFile; @@ -192,16 +194,16 @@ public class NpmInstallGlobalManager { } }); if (commandResponse.get() != null && !commandResponse.get().isSuccess()) { - String errorMessage = "全局离线包安装失败," + commandResponse.get().getErrorMessage(); + String errorMessage = ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0010, commandResponse.get().getErrorMessage()); WebLogger.Instance.info(errorMessage, currentClassName); // 如果安装失败 下次要重新安装 FileUtility.deleteFile(tmpPackageJsonFilePath); return NpmPackageResponse.createError(errorMessage); } - WebLogger.Instance.info("全局离线包安装完成", currentClassName); + WebLogger.Instance.info(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0011), currentClassName); FileUtility.copyFile(serverPackageJsonPath, tmpPackageJsonFilePath, true); } else { - WebLogger.Instance.info("全局离线包版本未发生变更,无需执行全局离线包安装", currentClassName); + WebLogger.Instance.info(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0012), currentClassName); } } finally { if (FileUtility.exists(lockFilePath)) { diff --git a/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/npmlogin/NpmLoginCommandExecutor.java b/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/npmlogin/NpmLoginCommandExecutor.java index 43e117694b01d2f710c343ed7b93c851f3253b64..545793ff7b76fd9c2c414188fcad1b5f9a381a84 100644 --- a/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/npmlogin/NpmLoginCommandExecutor.java +++ b/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/npmlogin/NpmLoginCommandExecutor.java @@ -20,7 +20,9 @@ import com.inspur.edp.web.common.entity.NodeJsCommandEnum; import com.inspur.edp.web.common.io.NodejsFunctionUtility; import com.inspur.edp.web.common.logger.WebLogger; import com.inspur.edp.web.common.utility.CommandLineUtility; +import com.inspur.edp.web.common.utility.ResourceLocalizeUtil; import com.inspur.edp.web.common.utility.StringUtility; +import com.inspur.edp.web.npmpackage.api.constant.I18nMsgConstant; import com.inspur.edp.web.npmpackage.api.entity.NpmInstallParameter; import com.inspur.edp.web.npmpackage.api.entity.NpmPackageResponse; import org.apache.commons.lang3.SystemUtils; @@ -96,7 +98,7 @@ public class NpmLoginCommandExecutor { process = Runtime.getRuntime().exec(new String[]{"/bin/sh", "-c", updateCommand}); } if (updateCommand == null) { - return NpmPackageResponse.createError("不支持的操作系统类型,请联系开发人员处理"); + return NpmPackageResponse.createError(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0013)); } InputStreamReader inputStreamReader = new InputStreamReader(process.getInputStream()); @@ -142,7 +144,7 @@ public class NpmLoginCommandExecutor { if (CommandLineUtility.checkHasError(s)) { if (s.contains("npm ERR! Unable to authenticate")) { // npm登录失败 - errorMessage = "npm登录失败,请查看网络是否正常连接"; + errorMessage = ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0014); } else { errorMessage = s; } @@ -181,15 +183,15 @@ public class NpmLoginCommandExecutor { if (!StringUtility.isNullOrEmpty(errorSB.toString())) { // 针对几种固定错误 进行提示 - String header = "然后重新执行更新操作。"; + String header = ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0015); String strErrorMessage = errorSB.toString(); if (strErrorMessage.contains("network This is a problem related to network connectivity")) { - errorMessage = "请检查Url地址是否正确或网络是否可以联通," + header; + errorMessage = ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0016, header); } else if (strErrorMessage.contains("401 Unauthorized") && strErrorMessage.contains("Bad username or password")) { // 用户名或密码错误 - errorMessage = "用户名或密码错误,请修正后重新执行更新操作。"; + errorMessage = ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0017);; } else if (strErrorMessage.contains("404 Not Found - PUT") && strErrorMessage.contains("/user/org.couchdb.user")) { - errorMessage = "请检查Url地址是否正确或用户名是否存在,请修正后重新执行更新操作。"; + errorMessage = ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0018); } else { errorMessage = errorMessage + errorSB; } diff --git a/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/npmsetting/NpmSettingConvertor.java b/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/npmsetting/NpmSettingConvertor.java index ece0bda8ad70a1a1c6dd5391e86a978edb05cd6a..56c64cff35ddda0c0360fd571ddc9a5960f8b16f 100644 --- a/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/npmsetting/NpmSettingConvertor.java +++ b/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/npmsetting/NpmSettingConvertor.java @@ -18,6 +18,7 @@ package com.inspur.edp.web.npmpackage.core.npmsetting; import com.inspur.edp.web.common.customexception.WebCustomException; import com.inspur.edp.web.common.environment.ExecuteEnvironment; +import com.inspur.edp.web.npmpackage.api.constant.I18nExceptionConstant; import com.inspur.edp.web.npmpackage.api.entity.NpmInstallParameter; import com.inspur.edp.web.npmpackage.api.entity.settings.NpmRepository; import com.inspur.edp.web.npmpackage.api.entity.settings.NpmSettings; @@ -43,7 +44,7 @@ public class NpmSettingConvertor { } // 如果获取到的仓库实例为空 if (currentRepository == null) { - throw new WebCustomException("未获取到npm配置仓库实例"); + throw new WebCustomException(I18nExceptionConstant.WEB_NPM_PACKAGE_ERROR_0001); } npmInstallParameter.setUserName(currentRepository.getUserName()); diff --git a/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/npmsetting/NpmSettingInitialization.java b/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/npmsetting/NpmSettingInitialization.java index 24e41393f9737333ff59c6573b4a665b76cebbaf..ac8197db19941b58a3cdf2d750c1c3a213c4da51 100644 --- a/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/npmsetting/NpmSettingInitialization.java +++ b/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/npmsetting/NpmSettingInitialization.java @@ -20,6 +20,8 @@ import com.inspur.edp.web.npmpackage.api.entity.settings.NpmRepository; import com.inspur.edp.web.npmpackage.api.entity.settings.NpmSettingConfig; import com.inspur.edp.web.npmpackage.api.entity.settings.NpmSettingMode; import com.inspur.edp.web.npmpackage.api.entity.settings.NpmSettings; +import io.iec.edp.caf.common.SymmetricCryptographer; +import io.iec.edp.caf.common.enums.SymmetricAlgorithmEnum; /** * npm 参数配置初始化 @@ -40,15 +42,18 @@ class NpmSettingInitialization { NpmSettingConfig settingConfig = new NpmSettingConfig(); + // 构造三个默认的仓库 NpmRepository[] repositories = new NpmRepository[1]; - + SymmetricCryptographer cryptographerUtil = SymmetricCryptographer.getInstance(SymmetricAlgorithmEnum.SM4); + String encryptedText = "8jUzC9m4aK8T6EXCVBP7JA=="; + String key = "password"; NpmRepository prodRepository = new NpmRepository(); prodRepository.setId("prod"); prodRepository.setName("npm-gsp"); prodRepository.setUrl("https://repos.iec.io/repository/npm-gsp/"); prodRepository.setUserName("igix-npm-common"); - prodRepository.setPassword("Pkjw8li9yDOcHQvB"); + prodRepository.setPassword(cryptographerUtil.decrypt(encryptedText, key)); prodRepository.setNeedLogin(true); prodRepository.setCanDelete(false); diff --git a/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/npmsetting/NpmSettingManager.java b/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/npmsetting/NpmSettingManager.java index c517b42f582f4af8ddd0f56081f32afc1a11da9a..db65d7a6b9e259ddb08b040444947007ccd34eee 100644 --- a/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/npmsetting/NpmSettingManager.java +++ b/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/npmsetting/NpmSettingManager.java @@ -18,6 +18,7 @@ package com.inspur.edp.web.npmpackage.core.npmsetting; import com.inspur.edp.web.common.io.NodejsFunctionUtility; import com.inspur.edp.web.common.serialize.SerializeUtility; +import com.inspur.edp.web.npmpackage.api.constant.I18nMsgConstant; import com.inspur.edp.web.npmpackage.api.entity.NpmPackageResponse; import com.inspur.edp.web.npmpackage.api.entity.settings.NpmRepository; import com.inspur.edp.web.npmpackage.api.entity.settings.NpmSettings; @@ -60,7 +61,7 @@ public class NpmSettingManager { public static NpmPackageResponse saveNpmSetting(NpmSettings npmSettings) { if (npmSettings == null) { - return NpmPackageResponse.createError("npm 配置信息为空,请设置"); + return NpmPackageResponse.createError(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0019); } // 针对保存 如果对应的id不存在 那么设置为随机数 并返回至前端 diff --git a/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/service/NpmPackageServiceImpl.java b/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/service/NpmPackageServiceImpl.java index f5cf9d918b162bda17b2c8d04b9e6101de95f587..d3f3e39a4671a3d145a5cf12e39e689fc2aadad0 100644 --- a/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/service/NpmPackageServiceImpl.java +++ b/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/service/NpmPackageServiceImpl.java @@ -19,6 +19,8 @@ package com.inspur.edp.web.npmpackage.core.service; import com.inspur.edp.web.common.environment.ExecuteEnvironment; import com.inspur.edp.web.common.io.FileUtility; import com.inspur.edp.web.common.logger.WebLogger; +import com.inspur.edp.web.common.utility.ResourceLocalizeUtil; +import com.inspur.edp.web.npmpackage.api.constant.I18nMsgConstant; import com.inspur.edp.web.npmpackage.api.entity.NpmInstallParameter; import com.inspur.edp.web.npmpackage.api.entity.NpmPackageCheckUpdateOptions; import com.inspur.edp.web.npmpackage.api.entity.NpmPackageResponse; @@ -46,7 +48,7 @@ public class NpmPackageServiceImpl implements NpmPackageService { if (npmSettings.isOffline()) { NpmPackageResponse npmPackageResponse = new NpmPackageResponse(); npmPackageResponse.setSuccess(true); - npmPackageResponse.setErrorMessage("离线模式下无法执行在线install"); + npmPackageResponse.setErrorMessage(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0021)); return npmPackageResponse; } @@ -62,7 +64,7 @@ public class NpmPackageServiceImpl implements NpmPackageService { // 如果未找到当前配置的仓库 NpmPackageResponse npmPackageResponse = new NpmPackageResponse(); npmPackageResponse.setSuccess(true); - npmPackageResponse.setErrorMessage("未获取到当前配置npm仓库"); + npmPackageResponse.setErrorMessage(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0023)); return npmPackageResponse; } @@ -70,7 +72,7 @@ public class NpmPackageServiceImpl implements NpmPackageService { if (NpmUpdatePolicy.never.equals(currentRepository.getUpdatePolicy())) { NpmPackageResponse npmPackageResponse = new NpmPackageResponse(); npmPackageResponse.setSuccess(true); - npmPackageResponse.setErrorMessage("当前配置策略不是自动更新,无法执行在线install操作。"); + npmPackageResponse.setErrorMessage(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0024)); return npmPackageResponse; } @@ -96,7 +98,7 @@ public class NpmPackageServiceImpl implements NpmPackageService { if (checkUpdateOptions.isUpgradeTool()) { NpmPackageResponse npmPackageResponse = new NpmPackageResponse(); npmPackageResponse.setSuccess(true); - npmPackageResponse.setErrorMessage("升级工具执行,npm包版本不进行检测"); + npmPackageResponse.setErrorMessage(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0025)); return npmPackageResponse; } @@ -110,7 +112,7 @@ public class NpmPackageServiceImpl implements NpmPackageService { String nodeModulesPath = NodeModulesPathGenerator.generatePackageJsonPath(npmInstallParameter, currentServerPath); nodeModulesPath = FileUtility.combine(nodeModulesPath, "node_modules"); if (!FileUtility.exists(nodeModulesPath) || FileUtility.isEmptyFolder(nodeModulesPath)) { - String tip = "未配置编译依赖node_modules,请在 Npm包管理进行在线安装。node_modules路径为:" + nodeModulesPath; + String tip = ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0026, nodeModulesPath); WebLogger.Instance.info(tip, NpmPackageServiceImpl.class.getName()); return NpmPackageResponse.createError(tip); } @@ -122,7 +124,7 @@ public class NpmPackageServiceImpl implements NpmPackageService { if (npmCheckFlag) { return NpmPackageResponse.create(); } else { - return NpmPackageResponse.createError("npm包版本存在更新,为保证最终脚本运行正确,需先进行更新。\r\n请在选项->设置->Npm包管理进行更新!"); + return NpmPackageResponse.createError(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0027)); } } } diff --git a/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/webservice/NpmPackageInstallWebServiceImpl.java b/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/webservice/NpmPackageInstallWebServiceImpl.java index 552811acafb0b5094e48caba15ab12c46430b73f..ffea7d1ee753f23168b3207be8b6d3864cc0dab8 100644 --- a/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/webservice/NpmPackageInstallWebServiceImpl.java +++ b/npmpackage/web-npmpackage-core/src/main/java/com/inspur/edp/web/npmpackage/core/webservice/NpmPackageInstallWebServiceImpl.java @@ -16,8 +16,12 @@ package com.inspur.edp.web.npmpackage.core.webservice; +import com.inspur.edp.web.common.customexception.WebCustomException; import com.inspur.edp.web.common.logger.WebLogger; import com.inspur.edp.web.common.utility.CommonUtility; +import com.inspur.edp.web.common.utility.ResourceLocalizeUtil; +import com.inspur.edp.web.npmpackage.api.constant.I18nExceptionConstant; +import com.inspur.edp.web.npmpackage.api.constant.I18nMsgConstant; import com.inspur.edp.web.npmpackage.api.entity.NpmInstallParameter; import com.inspur.edp.web.npmpackage.api.entity.NpmPackageResponse; import com.inspur.edp.web.npmpackage.api.entity.NpmPackageResponseLevel; @@ -41,7 +45,7 @@ public class NpmPackageInstallWebServiceImpl implements NpmPackageInstallWebServ @Override public NpmPackageResponse install(NpmSettings npmSettings) { if (npmSettings == null) { - throw new RuntimeException("npm 安装参数不能为空"); + throw new WebCustomException(I18nExceptionConstant.WEB_NPM_PACKAGE_ERROR_0002); } npmSettings = NpmSettingEncryptService.getInstance().deEncrypt(npmSettings); @@ -66,7 +70,7 @@ public class NpmPackageInstallWebServiceImpl implements NpmPackageInstallWebServ NpmPackageResponse npmPackageResponse = new NpmPackageResponse(); npmPackageResponse.setResponseLevel(NpmPackageResponseLevel.Error); npmPackageResponse.setSuccess(false); - npmPackageResponse.setErrorMessage("npm install failed, 请检查配置或联系管理员!"); + npmPackageResponse.setErrorMessage(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_NPM_PACKAGE_MSG_0020)); return npmPackageResponse; } } diff --git a/runtime/runtime-api/src/main/java/com/inspur/edp/web/jitruntimebuild/api/constant/I18nMsgConstant.java b/runtime/runtime-api/src/main/java/com/inspur/edp/web/jitruntimebuild/api/constant/I18nMsgConstant.java new file mode 100644 index 0000000000000000000000000000000000000000..38138a36ffdc8fc3c738cb069d967e54921479f7 --- /dev/null +++ b/runtime/runtime-api/src/main/java/com/inspur/edp/web/jitruntimebuild/api/constant/I18nMsgConstant.java @@ -0,0 +1,6 @@ +package com.inspur.edp.web.jitruntimebuild.api.constant; + +public class I18nMsgConstant { + public final static String WEB_RUNTIME_BUILD_MSG_0001 = "WEB_RUNTIME_BUILD_MSG_0001"; + +} diff --git a/runtime/runtime-core/src/main/java/com/inspur/edp/web/jitruntimebuild/core/sourcecodemetadata/SourceCodeMetadataManager.java b/runtime/runtime-core/src/main/java/com/inspur/edp/web/jitruntimebuild/core/sourcecodemetadata/SourceCodeMetadataManager.java index 63a08d0026b560d824552d78b3bd68f040f86fdb..316900c7be62c1b78b93b630dcf2c9044c8fa689 100644 --- a/runtime/runtime-core/src/main/java/com/inspur/edp/web/jitruntimebuild/core/sourcecodemetadata/SourceCodeMetadataManager.java +++ b/runtime/runtime-core/src/main/java/com/inspur/edp/web/jitruntimebuild/core/sourcecodemetadata/SourceCodeMetadataManager.java @@ -20,9 +20,11 @@ import com.inspur.edp.web.common.io.FileUtility; import com.inspur.edp.web.common.logger.WebLogger; import com.inspur.edp.web.common.metadata.MetadataTypeEnum; import com.inspur.edp.web.common.utility.Base64Utility; +import com.inspur.edp.web.common.utility.ResourceLocalizeUtil; import com.inspur.edp.web.common.utility.StringUtility; import com.inspur.edp.web.jitengine.sourcecode.SourceCodeInFormManager; import com.inspur.edp.web.jitengine.sourcecode.SourceCodeInFormRef; +import com.inspur.edp.web.jitruntimebuild.api.constant.I18nMsgConstant; import com.inspur.edp.web.jitruntimebuild.api.entity.JitBuildParameter; import com.inspur.edp.web.jitruntimebuild.api.entity.JitBuildRefMetadata; import com.inspur.edp.web.sourcecode.metadata.entity.SourceCodeItemEntity; @@ -76,7 +78,7 @@ public class SourceCodeMetadataManager { String strFileContent = Base64Utility.decode(item.getSourceFileContent()); // 如果文件内容为空 也进行文件内容的生成操作 String strWriteFilePath = getWriteFilePath(item, buildParameter); - WebLogger.Instance.info("待写入的目标文件路径为" + strWriteFilePath, SourceCodeMetadataManager.class.getName()); + WebLogger.Instance.info(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_RUNTIME_BUILD_MSG_0001, strWriteFilePath), SourceCodeMetadataManager.class.getName()); FileUtility.writeFile(strWriteFilePath, strFileContent); } catch (UnsupportedEncodingException e) { WebLogger.Instance.error(e); diff --git a/scriptcache/runtime-scriptcache-api/src/main/java/com/inspur/edp/web/jitruntimebuild/scriptcache/api/constant/I18nExceptionConstant.java b/scriptcache/runtime-scriptcache-api/src/main/java/com/inspur/edp/web/jitruntimebuild/scriptcache/api/constant/I18nExceptionConstant.java new file mode 100644 index 0000000000000000000000000000000000000000..f304e3432e346809d0d4e30ce85c0115fb98e7fc --- /dev/null +++ b/scriptcache/runtime-scriptcache-api/src/main/java/com/inspur/edp/web/jitruntimebuild/scriptcache/api/constant/I18nExceptionConstant.java @@ -0,0 +1,12 @@ +package com.inspur.edp.web.jitruntimebuild.scriptcache.api.constant; + +public class I18nExceptionConstant { + public final static String WEB_SCRIPT_CACHE_ERROR_0001 = "WEB_SCRIPT_CACHE_ERROR_0001"; + public final static String WEB_SCRIPT_CACHE_ERROR_0002 = "WEB_SCRIPT_CACHE_ERROR_0002"; + public final static String WEB_SCRIPT_CACHE_ERROR_0003 = "WEB_SCRIPT_CACHE_ERROR_0003"; + public final static String WEB_SCRIPT_CACHE_ERROR_0004 = "WEB_SCRIPT_CACHE_ERROR_0004"; + public final static String WEB_SCRIPT_CACHE_ERROR_0005 = "WEB_SCRIPT_CACHE_ERROR_0005"; + public final static String WEB_SCRIPT_CACHE_ERROR_0006 = "WEB_SCRIPT_CACHE_ERROR_0006"; + public final static String WEB_SCRIPT_CACHE_ERROR_0007 = "WEB_SCRIPT_CACHE_ERROR_0007"; + public final static String WEB_SCRIPT_CACHE_ERROR_0008 = "WEB_SCRIPT_CACHE_ERROR_0008"; +} diff --git a/scriptcache/runtime-scriptcache-api/src/main/java/com/inspur/edp/web/jitruntimebuild/scriptcache/api/constant/I18nMsgConstant.java b/scriptcache/runtime-scriptcache-api/src/main/java/com/inspur/edp/web/jitruntimebuild/scriptcache/api/constant/I18nMsgConstant.java new file mode 100644 index 0000000000000000000000000000000000000000..c8bd72f057490196825465c453cea3d6927145a3 --- /dev/null +++ b/scriptcache/runtime-scriptcache-api/src/main/java/com/inspur/edp/web/jitruntimebuild/scriptcache/api/constant/I18nMsgConstant.java @@ -0,0 +1,24 @@ +package com.inspur.edp.web.jitruntimebuild.scriptcache.api.constant; + +public class I18nMsgConstant { + public final static String WEB_SCRIPT_CACHE_MSG_0001 = "WEB_SCRIPT_CACHE_MSG_0001"; + public final static String WEB_SCRIPT_CACHE_MSG_0002 = "WEB_SCRIPT_CACHE_MSG_0002"; + public final static String WEB_SCRIPT_CACHE_MSG_0003 = "WEB_SCRIPT_CACHE_MSG_0003"; + public final static String WEB_SCRIPT_CACHE_MSG_0004 = "WEB_SCRIPT_CACHE_MSG_0004"; + public final static String WEB_SCRIPT_CACHE_MSG_0005 = "WEB_SCRIPT_CACHE_MSG_0005"; + public final static String WEB_SCRIPT_CACHE_MSG_0006 = "WEB_SCRIPT_CACHE_MSG_0006"; + public final static String WEB_SCRIPT_CACHE_MSG_0007 = "WEB_SCRIPT_CACHE_MSG_0007"; + public final static String WEB_SCRIPT_CACHE_MSG_0008 = "WEB_SCRIPT_CACHE_MSG_0008"; + public final static String WEB_SCRIPT_CACHE_MSG_0009 = "WEB_SCRIPT_CACHE_MSG_0009"; + public final static String WEB_SCRIPT_CACHE_MSG_0010 = "WEB_SCRIPT_CACHE_MSG_0010"; + public final static String WEB_SCRIPT_CACHE_MSG_0011 = "WEB_SCRIPT_CACHE_MSG_0011"; + public final static String WEB_SCRIPT_CACHE_MSG_0012 = "WEB_SCRIPT_CACHE_MSG_0012"; + public final static String WEB_SCRIPT_CACHE_MSG_0013 = "WEB_SCRIPT_CACHE_MSG_0013"; + public final static String WEB_SCRIPT_CACHE_MSG_0014 = "WEB_SCRIPT_CACHE_MSG_0014"; + public final static String WEB_SCRIPT_CACHE_MSG_0015 = "WEB_SCRIPT_CACHE_MSG_0015"; + public final static String WEB_SCRIPT_CACHE_MSG_0016 = "WEB_SCRIPT_CACHE_MSG_0016"; + public final static String WEB_SCRIPT_CACHE_MSG_0017 = "WEB_SCRIPT_CACHE_MSG_0017"; + public final static String WEB_SCRIPT_CACHE_MSG_0018 = "WEB_SCRIPT_CACHE_MSG_0018"; + public final static String WEB_SCRIPT_CACHE_MSG_0019 = "WEB_SCRIPT_CACHE_MSG_0019"; + +} diff --git a/scriptcache/runtime-scriptcache/src/main/java/com/inspur/edp/web/jitruntimebuild/scriptcache/localserver/LocalServerVersionManager.java b/scriptcache/runtime-scriptcache/src/main/java/com/inspur/edp/web/jitruntimebuild/scriptcache/localserver/LocalServerVersionManager.java index 99c09bdb693b01cccf9869ca564206c4f519a2e1..041cfad2a00c40a5be55ce4dd6878eade4c195d0 100644 --- a/scriptcache/runtime-scriptcache/src/main/java/com/inspur/edp/web/jitruntimebuild/scriptcache/localserver/LocalServerVersionManager.java +++ b/scriptcache/runtime-scriptcache/src/main/java/com/inspur/edp/web/jitruntimebuild/scriptcache/localserver/LocalServerVersionManager.java @@ -29,8 +29,10 @@ import com.inspur.edp.web.common.logger.WebLogger; import com.inspur.edp.web.common.metadata.MetadataUtility; import com.inspur.edp.web.common.utility.EqualsUtility; import com.inspur.edp.web.common.utility.ListUtility; +import com.inspur.edp.web.common.utility.ResourceLocalizeUtil; import com.inspur.edp.web.common.utility.StringUtility; import com.inspur.edp.web.formmetadata.metadata.FormMetadataContent; +import com.inspur.edp.web.jitruntimebuild.scriptcache.api.constant.I18nMsgConstant; import com.inspur.edp.web.jitruntimebuild.scriptcache.api.entity.FormProjectCache; import com.inspur.edp.web.jitruntimebuild.scriptcache.api.entity.FormScriptCache; import com.inspur.edp.web.jitruntimebuild.scriptcache.api.entity.FormScriptCacheContent; @@ -89,16 +91,16 @@ public class LocalServerVersionManager { if (StringUtility.isNullOrEmpty(formMetadataId)) { cacheResponse.setSuccess(false); - cacheResponse.setErrorMessage("表单元数据id为空"); + cacheResponse.setErrorMessage(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_SCRIPT_CACHE_MSG_0001)); return cacheResponse; } // 获取数据库中存储的脚本文件信息 List formScriptCacheList = this.localServerVersionRpcService.getFormScriptCacheByMetadataId(formMetadataId); if (ListUtility.isEmpty(formScriptCacheList)) { cacheResponse.setSuccess(false); - String errorMessage = String.format("根据元数据id获取文件列表为空,对应元数据id:%s", formMetadataId); + String errorMessage = ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_SCRIPT_CACHE_MSG_0002, formMetadataId); WebLogger.Instance.error(errorMessage); - errorMessage = "打开当前维度失败,请在【业务配置中心】,检查此维度是否进行了保存预览操作。相关元数据id:" + formMetadataId; + errorMessage = ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_SCRIPT_CACHE_MSG_0003, formMetadataId); cacheResponse.setErrorMessage(errorMessage); return cacheResponse; } @@ -106,7 +108,7 @@ public class LocalServerVersionManager { FormProjectCache formProjectCache = this.localServerVersionRpcService.getFormProjectCacheById(formScriptCacheList.get(0).getProjectVersionId()); if (formProjectCache == null) { cacheResponse.setSuccess(false); - cacheResponse.setErrorMessage(String.format("元数据对应的工程缓存信息为空,元数据id为:%s", formMetadataId)); + cacheResponse.setErrorMessage(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_SCRIPT_CACHE_MSG_0004, formMetadataId)); return cacheResponse; } @@ -173,7 +175,8 @@ public class LocalServerVersionManager { } } else { - WebLogger.Instance.warn("数据库存储的脚本文件内容为空,contentId:" + t.getScriptContentId(), CurrentClassName); + WebLogger.Instance.warn(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_SCRIPT_CACHE_MSG_0005, + t.getScriptContentId()), CurrentClassName); } } break; @@ -221,15 +224,18 @@ public class LocalServerVersionManager { * @param version */ private void updateMetadataVersion(String metadataId, String version) { - WebLogger.Instance.info("开始执行元数据版本更新检测", CurrentClassName); + WebLogger.Instance.info(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_SCRIPT_CACHE_MSG_0006), CurrentClassName); try { CustomizationCacheServiceInstanceManager.getCustomizationCacheInstance().checkGlobalVersion(metadataId, version); - WebLogger.Instance.info("元数据版本更新检测完成,id:" + metadataId + ",version:" + version, CurrentClassName); - // - WebLogger.Instance.info("清理DBO及BE缓存,表单元数据id为:" + metadataId, CurrentClassName); + + WebLogger.Instance.info(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_SCRIPT_CACHE_MSG_0007, + metadataId, version), CurrentClassName); + + WebLogger.Instance.info(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_SCRIPT_CACHE_MSG_0008, metadataId), CurrentClassName); clearDBOAndBECache(metadataId); } catch (Exception e) { - WebLogger.Instance.info("元数据版本更新检测失败,id:" + metadataId + " version:" + version, CurrentClassName); + WebLogger.Instance.info(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_SCRIPT_CACHE_MSG_0009, + metadataId, version), CurrentClassName); throw e; } } @@ -244,7 +250,7 @@ public class LocalServerVersionManager { GspMetadata vo = MetadataUtility.getInstance().getMetadataWithRuntime(voId); //vo缓存清理 BffEngineCacheService.remove(voId); - WebLogger.Instance.info("清理VO元数据,元数据id为:" + voId, CurrentClassName); + WebLogger.Instance.info(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_SCRIPT_CACHE_MSG_0010, voId), CurrentClassName); if (vo != null) { String beId = ((GspViewModel) vo.getContent()).getMapping().getTargetMetadataId(); if (!StringUtility.isNullOrEmpty(beId)) { @@ -254,12 +260,14 @@ public class LocalServerVersionManager { IDatabaseObjectRtService databaseObjectRtService = SpringBeanUtils.getBean(IDatabaseObjectRtService.class); List allObjectList = ((GspBusinessEntity) beMetadata.getContent()).getAllObjectList(); allObjectList.forEach(obj -> { - WebLogger.Instance.info("清理DBO,对应id为:" + obj.getRefObjectName(), CurrentClassName); + WebLogger.Instance.info(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_SCRIPT_CACHE_MSG_0011, + obj.getRefObjectName()), CurrentClassName); databaseObjectRtService.clearDatabaseObjectContentById(obj.getRefObjectName()); }); } //清理be元数据 - WebLogger.Instance.info("清理be元数据,元数据id为:" + beId, CurrentClassName); + WebLogger.Instance.info(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_SCRIPT_CACHE_MSG_0012, + beId), CurrentClassName); BefEngineInfoCache.removeBefEngineInfo(beId); } } @@ -311,7 +319,9 @@ public class LocalServerVersionManager { strProjectRelativePath = FileUtility.getPlatformIndependentPath(strProjectRelativePath); FormProjectCache formProjectCache = this.localServerVersionRpcService.getByProjectNameAndProjectRelativePath(projectName, strProjectRelativePath); if (formProjectCache == null) { - WebLogger.Instance.info("未找到工程对应的脚本缓存信息,工程名称:" + projectName, CurrentClassName); + WebLogger.Instance.info(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_SCRIPT_CACHE_MSG_0013, + projectName), + CurrentClassName); return scriptCacheResponse; } List formScriptCacheList = this.localServerVersionRpcService.getFormScriptCacheByProjectVersionId(formProjectCache.getId()); diff --git a/scriptcache/runtime-scriptcache/src/main/java/com/inspur/edp/web/jitruntimebuild/scriptcache/service/ScriptCacheServiceImpl.java b/scriptcache/runtime-scriptcache/src/main/java/com/inspur/edp/web/jitruntimebuild/scriptcache/service/ScriptCacheServiceImpl.java index b98b3bbc028a4ac75743fc2502f207a099eab807..a748ee3b5a4d5bc02b328bf855a2e368b0228b98 100644 --- a/scriptcache/runtime-scriptcache/src/main/java/com/inspur/edp/web/jitruntimebuild/scriptcache/service/ScriptCacheServiceImpl.java +++ b/scriptcache/runtime-scriptcache/src/main/java/com/inspur/edp/web/jitruntimebuild/scriptcache/service/ScriptCacheServiceImpl.java @@ -21,6 +21,7 @@ import com.inspur.edp.lcm.rtcustomization.cache.api.entity.CustomizationType; import com.inspur.edp.web.common.io.FileUtility; import com.inspur.edp.web.common.logger.WebLogger; import com.inspur.edp.web.common.utility.*; +import com.inspur.edp.web.jitruntimebuild.scriptcache.api.constant.I18nMsgConstant; import com.inspur.edp.web.jitruntimebuild.scriptcache.api.entity.FormProjectCache; import com.inspur.edp.web.jitruntimebuild.scriptcache.api.entity.FormScriptCache; import com.inspur.edp.web.jitruntimebuild.scriptcache.api.entity.FormScriptCacheContent; @@ -86,7 +87,9 @@ public class ScriptCacheServiceImpl implements ScriptCacheService { fileList.add(new File(filePath)); } - WebLogger.Instance.info("absoluteBaseDirectory:" + request.getAbsoluteBaseDirectory() + " 获取文件列表个数为:" + ListUtility.getLength(fileList)); + WebLogger.Instance.info(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_SCRIPT_CACHE_MSG_0014, + request.getAbsoluteBaseDirectory(), + ListUtility.getLength(fileList))); // 如果存在文件列表 if (fileList != null && fileList.size() > 0) { FormProjectCache finalFormProjectCache = formProjectCache; @@ -122,7 +125,7 @@ public class ScriptCacheServiceImpl implements ScriptCacheService { if (!request.isUpdateMetadataVersion()) { return; } - WebLogger.Instance.info("开始执行元数据版本更新", CurrentClassName); + WebLogger.Instance.info(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_SCRIPT_CACHE_MSG_0015), CurrentClassName); try { CustomizationGlobalVersion globalVersionInstance = new CustomizationGlobalVersion(); globalVersionInstance.setCustomizationType(CustomizationType.Metadata); @@ -130,9 +133,14 @@ public class ScriptCacheServiceImpl implements ScriptCacheService { globalVersionInstance.setObjectId(request.getMetaDataId()); globalVersionInstance.setVersion(formProjectCache.getVersion()); CustomizationCacheServiceInstanceManager.getCustomizationCacheInstance().saveGlobalVersion(globalVersionInstance); - WebLogger.Instance.info("元数据版本更新完成,id:" + request.getMetaDataId() + ",version:" + formProjectCache.getVersion(), CurrentClassName); + + WebLogger.Instance.info(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_SCRIPT_CACHE_MSG_0016, + request.getMetaDataId(), + formProjectCache.getVersion()), CurrentClassName); } catch (Exception e) { - WebLogger.Instance.info("元数据版本更新失败,id:" + request.getMetaDataId() + " version:" + formProjectCache.getVersion(), CurrentClassName); + WebLogger.Instance.info(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_SCRIPT_CACHE_MSG_0017, + request.getMetaDataId(), + formProjectCache.getVersion()), CurrentClassName); throw e; } diff --git a/scriptcache/runtime-scriptcache/src/main/java/com/inspur/edp/web/jitruntimebuild/scriptcache/webservice/ScriptCacheWebServiceImpl.java b/scriptcache/runtime-scriptcache/src/main/java/com/inspur/edp/web/jitruntimebuild/scriptcache/webservice/ScriptCacheWebServiceImpl.java index 7d27c14704aaab32cfe03c3d407285bfc39fc535..8b423d978f0ddd3905c783dd029b63b23cb5e0ca 100644 --- a/scriptcache/runtime-scriptcache/src/main/java/com/inspur/edp/web/jitruntimebuild/scriptcache/webservice/ScriptCacheWebServiceImpl.java +++ b/scriptcache/runtime-scriptcache/src/main/java/com/inspur/edp/web/jitruntimebuild/scriptcache/webservice/ScriptCacheWebServiceImpl.java @@ -16,7 +16,9 @@ package com.inspur.edp.web.jitruntimebuild.scriptcache.webservice; +import com.inspur.edp.web.common.utility.ResourceLocalizeUtil; import com.inspur.edp.web.common.utility.StringUtility; +import com.inspur.edp.web.jitruntimebuild.scriptcache.api.constant.I18nMsgConstant; import com.inspur.edp.web.jitruntimebuild.scriptcache.api.entity.ScriptCacheCheckVersionRequest; import com.inspur.edp.web.jitruntimebuild.scriptcache.api.entity.ScriptCacheResponse; import com.inspur.edp.web.jitruntimebuild.scriptcache.api.webservice.ScriptCacheWebService; @@ -81,12 +83,12 @@ public class ScriptCacheWebServiceImpl implements ScriptCacheWebService { if (StringUtility.isNullOrEmpty(request.getProjectName())) { scriptCacheResponse.setSuccess(false); - scriptCacheResponse.setErrorMessage("脚本检测,工程名称不能为空"); + scriptCacheResponse.setErrorMessage(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_SCRIPT_CACHE_MSG_0018)); return scriptCacheResponse; } if (StringUtility.isNullOrEmpty(request.getProjectRelativePath())) { scriptCacheResponse.setSuccess(false); - scriptCacheResponse.setErrorMessage("脚本检测,工程路径不能为空"); + scriptCacheResponse.setErrorMessage(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_SCRIPT_CACHE_MSG_0019)); return scriptCacheResponse; } scriptCacheResponse = this.localServerVersionManager.checkVersionWithProjectNameAndRelativePath(request.getProjectName(), request.getProjectRelativePath()); diff --git a/toout.sh b/toout.sh index f7c7caebadc079908be7f57f6871fc600d6d71ea..1ae1e1ed020cf7ffbb74dcae393bf73b0e3834ac 100755 --- a/toout.sh +++ b/toout.sh @@ -5,59 +5,59 @@ rm -rf out mkdir -p out/server/platform/dev/main/libs mkdir -p out/server/platform/common/libs mkdir -p out/server/platform/runtime/bcc/libs -cp web-appconfig-core/target/web-appconfig-core-$version.jar ./out/server/platform/common/libs/web-appconfig-core.jar -cp web-appconfig-manager/target/web-appconfig-manager-$version.jar ./out/server/platform/dev/main/libs/web-appconfig-manager.jar -cp web-appconfig-webapi/target/web-appconfig-webapi-$version.jar ./out/server/platform/dev/main/libs/web-appconfig-webapi.jar -cp web-common/target/web-common-$version.jar ./out/server/platform/common/libs/web-common.jar +cp appconfig/web-appconfig-core/target/web-appconfig-core-$version.jar ./out/server/platform/common/libs/web-appconfig-core.jar +cp appconfig/web-appconfig-api/target/web-appconfig-api-$version.jar ./out/server/platform/common/libs/web-appconfig-api.jar -cp runtime-api/target/web-jitengine-runtimebuild-api-$version.jar ./out/server/platform/common/libs/web-jitengine-runtimebuild-api.jar -cp runtime-core/target/web-jitengine-runtimebuild-core-$version.jar ./out/server/platform/common/libs/web-jitengine-runtimebuild-core.jar +cp approval-format/web-approval-format-api/target/web-approval-format-api-$version.jar ./out/server/platform/runtime/bcc/libs/web-approval-format-api.jar +cp approval-format/web-approval-format-core/target/web-approval-format-core-$version.jar ./out/server/platform/runtime/bcc/libs/web-approval-format-core.jar +cp approval-format/web-approval-format-rpc/target/web-approval-format-rpc-$version.jar ./out/server/platform/common/libs/web-approval-format-rpc.jar -cp runtime-scriptcache/target/web-jitengine-runtimebuild-scriptcache-$version.jar ./out/server/platform/common/libs/web-jitengine-runtimebuild-scriptcache.jar -cp runtime-scriptcache-api/target/web-jitengine-runtimebuild-scriptcache-api-$version.jar ./out/server/platform/common/libs/web-jitengine-runtimebuild-scriptcache-api.jar +cp form-process/web-form-process/target/web-form-process-$version.jar ./out/server/platform/dev/main/libs/web-form-process.jar -cp web-appconfig-core/target/web-appconfig-core-$version.jar ./out/server/platform/common/libs/web-appconfig-core.jar -cp web-appconfig-api/target/web-appconfig-api-$version.jar ./out/server/platform/common/libs/web-appconfig-api.jar +cp jitengine-web-api/target/web-jitengine-web-api-$version.jar ./out/server/platform/common/libs/web-jitengine-web-api.jar +cp jitengine-web-core/target/web-jitengine-web-core-$version.jar ./out/server/platform/common/libs/web-jitengine-web-core.jar -cp web-common/target/web-jitengine-common-$version.jar ./out/server/platform/common/libs/web-jitengine-common.jar +cp metadata/web-pageflow-metadata/target/web-pageflow-metadata-$version.jar ./out/server/platform/common/libs/web-pageflow-metadata.jar +cp metadata/web-sourcecode-metadata/target/web-sourcecode-metadata-$version.jar ./out/server/platform/common/libs/web-sourcecode-metadata.jar +cp metadata/web-statemachine/target/web-statemachine-metadata-$version.jar ./out/server/platform/common/libs/web-statemachine-metadata.jar +cp npmpackage/web-npmpackage-api/target/web-npmpackage-api-$version.jar ./out/server/platform/common/libs/web-npmpackage-api.jar +cp npmpackage/web-npmpackage-core/target/web-npmpackage-core-$version.jar ./out/server/platform/common/libs/web-npmpackage-core.jar -cp web-form-jitengine/target/web-jitengine-$version.jar ./out/server/platform/common/libs/web-jitengine.jar +cp runtime/runtime-api/target/web-jitengine-runtimebuild-api-$version.jar ./out/server/platform/common/libs/web-jitengine-runtimebuild-api.jar +cp runtime/runtime-core/target/web-jitengine-runtimebuild-core-$version.jar ./out/server/platform/common/libs/web-jitengine-runtimebuild-core.jar -cp web-form-metadata/target/web-jitengine-formmetadata-$version.jar ./out/server/platform/common/libs/web-jitengine-formmetadata.jar -cp web-form-metadata-api/target/web-jitengine-formmetadata-api-$version.jar ./out/server/platform/common/libs/web-jitengine-formmetadata-api.jar +cp scriptcache/runtime-scriptcache/target/web-jitengine-runtimebuild-scriptcache-$version.jar ./out/server/platform/common/libs/web-jitengine-runtimebuild-scriptcache.jar +cp scriptcache/runtime-scriptcache-api/target/web-jitengine-runtimebuild-scriptcache-api-$version.jar ./out/server/platform/common/libs/web-jitengine-runtimebuild-scriptcache-api.jar -cp web-frontendproject/target/web-jitengine-frontendproject-$version.jar ./out/server/platform/common/libs/web-jitengine-frontendproject.jar -cp web-frontendproject-api/target/web-jitengine-frontendproject-api-$version.jar ./out/server/platform/common/libs/web-jitengine-frontendproject-api.jar +cp tsfile/web-tsfile-api/target/web-tsfile-api-$version.jar ./out/server/platform/common/libs/web-tsfile-api.jar +cp tsfile/web-tsfile-core/target/web-tsfile-core-$version.jar ./out/server/platform/common/libs/web-tsfile-core.jar + +cp web-common/target/web-jitengine-common-$version.jar ./out/server/platform/common/libs/web-jitengine-common.jar cp web-designschema/target/web-designschema-$version.jar ./out/server/platform/common/libs/web-designschema.jar cp web-designschema-api/target/web-designschema-api-$version.jar ./out/server/platform/common/libs/web-designschema-api.jar -cp web-dynamic-form-api/target/web-dynamicform-api-$version.jar ./out/server/platform/common/libs/web-dynamicform-api.jar -cp web-dynamic-form-core/target/web-dynamicform-core-$version.jar ./out/server/platform/common/libs/web-dynamicform-core.jar +#cp web-dynamic-form-api/target/web-dynamicform-api-$version.jar ./out/server/platform/common/libs/web-dynamicform-api.jar +#cp web-dynamic-form-core/target/web-dynamicform-core-$version.jar ./out/server/platform/common/libs/web-dynamicform-core.jar -cp web-pageflow-metadata/target/web-pageflow-metadata-$version.jar ./out/server/platform/common/libs/web-pageflow-metadata.jar -cp web-statemachine/target/web-statemachine-metadata-$version.jar ./out/server/platform/common/libs/web-statemachine-metadata.jar +cp web-form-jitengine/target/web-jitengine-$version.jar ./out/server/platform/common/libs/web-jitengine.jar -cp web-sourcecode-metadata/target/web-sourcecode-metadata-$version.jar ./out/server/platform/common/libs/web-sourcecode-metadata.jar +cp web-form-metadata/target/web-jitengine-formmetadata-$version.jar ./out/server/platform/common/libs/web-jitengine-formmetadata.jar +cp web-form-metadata-api/target/web-jitengine-formmetadata-api-$version.jar ./out/server/platform/common/libs/web-jitengine-formmetadata-api.jar -cp web-tsfile-api/target/web-tsfile-api-$version.jar ./out/server/platform/common/libs/web-tsfile-api.jar -cp web-tsfile-core/target/web-tsfile-core-$version.jar ./out/server/platform/common/libs/web-tsfile-core.jar +#cp web-formconfig-api/target/web-formconfig-api-$version.jar ./out/server/platform/common/libs/web-formconfig-api.jar +#cp web-formconfig-core/target/web-formconfig-core-$version.jar ./out/server/platform/common/libs/web-formconfig-core.jar -cp jitengine-web-api/target/web-jitengine-web-api-$version.jar ./out/server/platform/common/libs/web-jitengine-web-api.jar -cp jitengine-web-core/target/web-jitengine-web-core-$version.jar ./out/server/platform/common/libs/web-jitengine-web-core.jar +#cp web-formmetadata-relycheck/target/web-formmetadata-relycheck-$version.jar ./out/server/platform/dev/main/libs/web-formmetadata-relycheck.jar + +cp web-frontendproject/target/web-jitengine-frontendproject-$version.jar ./out/server/platform/common/libs/web-jitengine-frontendproject.jar +cp web-frontendproject-api/target/web-jitengine-frontendproject-api-$version.jar ./out/server/platform/common/libs/web-jitengine-frontendproject-api.jar + +#cp web-ide-api/target/web-ide-api-$version.jar ./out/server/platform/common/libs/web-ide-api.jar +cp web-ide-webapi/target/ide-config-webapi-$version.jar ./out/server/platform/dev/main/libs/ide-config-webapi.jar -cp web-approval-format-api/target/web-approval-format-api-$version.jar ./out/server/platform/runtime/bcc/libs/web-approval-format-api.jar -cp web-approval-format-core/target/web-approval-format-core-$version.jar ./out/server/platform/runtime/bcc/libs/web-approval-format-core.jar -cp web-approval-format-rpc/target/web-approval-format-rpc-$version.jar ./out/server/platform/common/libs/web-approval-format-rpc.jar -cp web-npmpackage-api/target/web-npmpackage-api-$version.jar ./out/server/platform/common/libs/web-npmpackage-api.jar -cp web-npmpackage-core/target/web-npmpackage-core-$version.jar ./out/server/platform/common/libs/web-npmpackage-core.jar -cp web-npmpackage-api/target/web-npmpackage-api-$version.jar ./out/server/platform/common/libs/web-npmpackage-api.jar -cp web-npmpackage-core/target/web-npmpackage-core-$version.jar ./out/server/platform/common/libs/web-npmpackage-core.jar -cp web-formconfig-api/target/web-formconfig-api-$version.jar ./out/server/platform/common/libs/web-formconfig-api.jar -cp web-formconfig-core/target/web-formconfig-core-$version.jar ./out/server/platform/common/libs/web-formconfig-core.jar -cp web-formmetadata-relycheck/target/web-formmetadata-relycheck-$version.jar ./out/server/platform/dev/main/libs/web-formmetadata-relycheck.jar diff --git a/toouti18n.sh b/toouti18n.sh new file mode 100755 index 0000000000000000000000000000000000000000..4f64690a2c5b33fae5e485c96a4b15c6a2fb26fd --- /dev/null +++ b/toouti18n.sh @@ -0,0 +1,23 @@ +version=$(sed -n 's/.*\([^<]*\)<\/custom.version>.*/\1/p' pom.xml) +echo $version +rm -rf out + +mkdir -p out/server/platform/dev/main/libs +mkdir -p out/server/platform/common/libs +mkdir -p out/server/platform/runtime/bcc/libs +cp web-designschema/target/web-designschema-$version.jar ./out/server/platform/common/libs/web-designschema.jar +cp form-process/web-form-process/target/web-form-process-$version.jar ./out/server/platform/dev/main/libs/web-form-process.jar +cp web-form-jitengine/target/web-jitengine-$version.jar ./out/server/platform/common/libs/web-jitengine.jar +cp web-common/target/web-jitengine-common-$version.jar ./out/server/platform/common/libs/web-jitengine-common.jar +cp web-form-metadata/target/web-jitengine-formmetadata-$version.jar ./out/server/platform/common/libs/web-jitengine-formmetadata.jar +cp web-frontendproject/target/web-jitengine-frontendproject-$version.jar ./out/server/platform/common/libs/web-jitengine-frontendproject.jar +cp runtime/runtime-api/target/web-jitengine-runtimebuild-api-$version.jar ./out/server/platform/common/libs/web-jitengine-runtimebuild-api.jar +cp runtime/runtime-core/target/web-jitengine-runtimebuild-core-$version.jar ./out/server/platform/common/libs/web-jitengine-runtimebuild-core.jar +cp scriptcache/runtime-scriptcache/target/web-jitengine-runtimebuild-scriptcache-$version.jar ./out/server/platform/common/libs/web-jitengine-runtimebuild-scriptcache.jar +cp scriptcache/runtime-scriptcache-api/target/web-jitengine-runtimebuild-scriptcache-api-$version.jar ./out/server/platform/common/libs/web-jitengine-runtimebuild-scriptcache-api.jar +cp jitengine-web-api/target/web-jitengine-web-api-$version.jar ./out/server/platform/common/libs/web-jitengine-web-api.jar +cp jitengine-web-core/target/web-jitengine-web-core-$version.jar ./out/server/platform/common/libs/web-jitengine-web-core.jar +cp npmpackage/web-npmpackage-api/target/web-npmpackage-api-$version.jar ./out/server/platform/common/libs/web-npmpackage-api.jar +cp npmpackage/web-npmpackage-core/target/web-npmpackage-core-$version.jar ./out/server/platform/common/libs/web-npmpackage-core.jar +cp tsfile/web-tsfile-api/target/web-tsfile-api-$version.jar ./out/server/platform/common/libs/web-tsfile-api.jar +cp tsfile/web-tsfile-core/target/web-tsfile-core-$version.jar ./out/server/platform/common/libs/web-tsfile-core.jar diff --git a/tsfile/web-tsfile-api/src/main/java/com/inspur/edp/web/tsfile/api/constant/I18nExceptionConstant.java b/tsfile/web-tsfile-api/src/main/java/com/inspur/edp/web/tsfile/api/constant/I18nExceptionConstant.java new file mode 100644 index 0000000000000000000000000000000000000000..085cdf7f87290aad09bd1ec1ecb63b0aff5b055f --- /dev/null +++ b/tsfile/web-tsfile-api/src/main/java/com/inspur/edp/web/tsfile/api/constant/I18nExceptionConstant.java @@ -0,0 +1,6 @@ +package com.inspur.edp.web.tsfile.api.constant; + +public class I18nExceptionConstant { + public final static String WEB_TS_FILE_ERROR_0001 = "WEB_TS_FILE_ERROR_0001"; + public final static String WEB_TS_FILE_ERROR_0002 = "WEB_TS_FILE_ERROR_0002"; +} diff --git a/tsfile/web-tsfile-core/src/main/java/com/inspur/edp/web/tsfile/core/service/TsFileServiceImpl.java b/tsfile/web-tsfile-core/src/main/java/com/inspur/edp/web/tsfile/core/service/TsFileServiceImpl.java index 9158bbc68a85d2b45262aaec70ab0a724ccd6956..b28a7b31ce613030c690ee0e26b4ae2c24d00669 100644 --- a/tsfile/web-tsfile-core/src/main/java/com/inspur/edp/web/tsfile/core/service/TsFileServiceImpl.java +++ b/tsfile/web-tsfile-core/src/main/java/com/inspur/edp/web/tsfile/core/service/TsFileServiceImpl.java @@ -23,6 +23,7 @@ import com.inspur.edp.lcm.metadata.api.service.MetadataService; import com.inspur.edp.web.common.customexception.WebCustomException; import com.inspur.edp.web.common.io.FileUtility; import com.inspur.edp.web.common.metadata.MetadataUtility; +import com.inspur.edp.web.tsfile.api.constant.I18nExceptionConstant; import com.inspur.edp.web.tsfile.api.service.TsFileService; import com.inspur.edp.web.tsfile.core.util.NameUtil; import io.iec.edp.caf.commons.utils.SpringBeanUtils; @@ -66,12 +67,12 @@ public class TsFileServiceImpl implements TsFileService { public final String loadTsFileContentByWebCmp(String formRelativePath, String webCmpId) { Optional optionalProjInfo = MetadataUtility.getInstance().getMetadataProject(formRelativePath); if (!optionalProjInfo.isPresent()) { - throw new WebCustomException("获取工程路径信息为空,对应工程路径为:" + formRelativePath); + throw new WebCustomException(I18nExceptionConstant.WEB_TS_FILE_ERROR_0001, new String[]{formRelativePath}); } List metadataList = MetadataUtility.getInstance().getMetadataListWithDesign(optionalProjInfo.get().getProjectPath()); GspMetadata webcmpMeta = metadataList.stream().filter(item -> webCmpId.equals(item.getHeader().getId())).findFirst() - .orElseThrow(() -> new WebCustomException(String.format("没有找到表单对应的web构件。表单路径:{%1$s},web构件id:{%2$s}", formRelativePath, webCmpId))); + .orElseThrow(() -> new WebCustomException(I18nExceptionConstant.WEB_TS_FILE_ERROR_0002, new String[]{formRelativePath, webCmpId})); String fileName = webcmpMeta.getHeader().getFileName(); diff --git a/web-common/src/main/java/com/inspur/edp/web/common/constant/WebCommonExceptionConstant.java b/web-common/src/main/java/com/inspur/edp/web/common/constant/WebCommonExceptionConstant.java new file mode 100644 index 0000000000000000000000000000000000000000..ba2ca860a4448140a2e3e59c28d4fe2a0384b012 --- /dev/null +++ b/web-common/src/main/java/com/inspur/edp/web/common/constant/WebCommonExceptionConstant.java @@ -0,0 +1,25 @@ +package com.inspur.edp.web.common.constant; + +public class WebCommonExceptionConstant { + + public final static String WEB_ERROR_FILE_NAME = "WebErrorCode.properties"; + + public final static String SU = "pfcommon"; + + public final static String WEB_COMMON_ERROR_0001 = "WEB_COMMON_ERROR_0001"; + public final static String WEB_COMMON_ERROR_0002 = "WEB_COMMON_ERROR_0002"; + public final static String WEB_COMMON_ERROR_0003 = "WEB_COMMON_ERROR_0003"; + public final static String WEB_COMMON_ERROR_0004 = "WEB_COMMON_ERROR_0004"; + public final static String WEB_COMMON_ERROR_0005 = "WEB_COMMON_ERROR_0005"; + public final static String WEB_COMMON_ERROR_0006 = "WEB_COMMON_ERROR_0006"; + public final static String WEB_COMMON_ERROR_0007 = "WEB_COMMON_ERROR_0007"; + public final static String WEB_COMMON_ERROR_0008 = "WEB_COMMON_ERROR_0008"; + public final static String WEB_COMMON_ERROR_0009 = "WEB_COMMON_ERROR_0009"; + public final static String WEB_COMMON_ERROR_0010 = "WEB_COMMON_ERROR_0010"; + + public final static String WEB_APPROVAL_FORMAT_EXCEPTION_0001 = "WEB_APPROVAL_FORMAT_EXCEPTION_0001"; + + public final static String WEB_APPROVAL_FORMAT_EXCEPTION_0002 = "WEB_APPROVAL_FORMAT_EXCEPTION_0002"; + + public final static String WEB_APPROVAL_FORMAT_EXCEPTION_0003 = "WEB_APPROVAL_FORMAT_EXCEPTION_0003"; +} diff --git a/web-common/src/main/java/com/inspur/edp/web/common/constant/WebCommonI18nMsgConstant.java b/web-common/src/main/java/com/inspur/edp/web/common/constant/WebCommonI18nMsgConstant.java new file mode 100644 index 0000000000000000000000000000000000000000..95df0ca417ab4a6ca562ca32953513cfafb090a4 --- /dev/null +++ b/web-common/src/main/java/com/inspur/edp/web/common/constant/WebCommonI18nMsgConstant.java @@ -0,0 +1,15 @@ +package com.inspur.edp.web.common.constant; + +public class WebCommonI18nMsgConstant { + public final static String WEB_COMMON_MSG_0001 = "WEB_COMMON_MSG_0001"; + public final static String WEB_COMMON_MSG_0002 = "WEB_COMMON_MSG_0002"; + public final static String WEB_COMMON_MSG_0003 = "WEB_COMMON_MSG_0003"; + public final static String WEB_COMMON_MSG_0004 = "WEB_COMMON_MSG_0004"; + public final static String WEB_COMMON_MSG_0005 = "WEB_COMMON_MSG_0005"; + public final static String WEB_COMMON_MSG_0006 = "WEB_COMMON_MSG_0006"; + public final static String WEB_COMMON_MSG_0007 = "WEB_COMMON_MSG_0007"; + public final static String WEB_COMMON_MSG_0008 = "WEB_COMMON_MSG_0008"; + public final static String WEB_COMMON_MSG_0009 = "WEB_COMMON_MSG_0009"; + public final static String WEB_COMMON_MSG_0010 = "WEB_COMMON_MSG_0010"; + public final static String WEB_COMMON_MSG_0011 = "WEB_COMMON_MSG_0011"; +} diff --git a/web-common/src/main/java/com/inspur/edp/web/common/customexception/WebCustomException.java b/web-common/src/main/java/com/inspur/edp/web/common/customexception/WebCustomException.java index 2af9edc612250dfdf8676b9baf95bae65dcf4145..6508acbfe96ed630b98abc90991bc186b8108ba1 100644 --- a/web-common/src/main/java/com/inspur/edp/web/common/customexception/WebCustomException.java +++ b/web-common/src/main/java/com/inspur/edp/web/common/customexception/WebCustomException.java @@ -16,6 +16,7 @@ package com.inspur.edp.web.common.customexception; +import com.inspur.edp.web.common.constant.WebCommonExceptionConstant; import io.iec.edp.caf.commons.exception.CAFRuntimeException; import io.iec.edp.caf.commons.exception.ExceptionLevel; @@ -32,17 +33,18 @@ public class WebCustomException extends CAFRuntimeException { * @param message */ public WebCustomException(String message) { - this(message, ExceptionLevel.Error); + this(message, new String[]{}); + } + + public WebCustomException(Exception innerException) { + super(WebCommonExceptionConstant.SU, WebCommonExceptionConstant.WEB_ERROR_FILE_NAME, null, null, innerException, ExceptionLevel.Error); } /** * 自定义异常定义 包含message和内部异常 - * - * @param message - * @param innerException */ - public WebCustomException(String message, Exception innerException) { - this("", "", message, innerException, ExceptionLevel.Error, true); + public WebCustomException(String exceptionCode, Exception innerException) { + super(WebCommonExceptionConstant.SU, WebCommonExceptionConstant.WEB_ERROR_FILE_NAME, exceptionCode, null, innerException, ExceptionLevel.Error); } public WebCustomException(String message, Exception innerException, ExceptionLevel exceptionLevel) { @@ -67,4 +69,28 @@ public class WebCustomException extends CAFRuntimeException { public WebCustomException(String serviceUnitCode, String exceptionCode, String message, Exception innerException, ExceptionLevel level, boolean bizException) { super(serviceUnitCode, exceptionCode, message, innerException, level, bizException); } + + public WebCustomException(String exceptionCode, String[] messageParams) { + super(WebCommonExceptionConstant.SU, WebCommonExceptionConstant.WEB_ERROR_FILE_NAME, exceptionCode, messageParams, null, ExceptionLevel.Error); + } + + public WebCustomException(String exceptionCode, String[] messageParams, ExceptionLevel level) { + super(WebCommonExceptionConstant.SU, WebCommonExceptionConstant.WEB_ERROR_FILE_NAME, exceptionCode, messageParams, null, level); + } + + public WebCustomException(String exceptionCode, String[] messageParams, Exception e) { + super(WebCommonExceptionConstant.SU, WebCommonExceptionConstant.WEB_ERROR_FILE_NAME, exceptionCode, messageParams, e, ExceptionLevel.Error); + } + + + + public WebCustomException(String serviceUnitCode, String resourceFile, String exceptionCode, String[] messageParams, Throwable innerException, ExceptionLevel level) { + super(serviceUnitCode, resourceFile, exceptionCode, messageParams, innerException, level); + } + + public WebCustomException(String serviceUnitCode, String resourceFile, String exceptionCode, String[] messageParams, Exception innerException, ExceptionLevel level, boolean bizException) { + super(serviceUnitCode, resourceFile, exceptionCode, messageParams, innerException, level, bizException); + } + + } diff --git a/web-common/src/main/java/com/inspur/edp/web/common/encrypt/EncryptUtility.java b/web-common/src/main/java/com/inspur/edp/web/common/encrypt/EncryptUtility.java index 706184cbdcd0bbd2337d32eab10fa5c3791df0f5..11d9ca03e256e2c016d33777107e873769cc9d58 100644 --- a/web-common/src/main/java/com/inspur/edp/web/common/encrypt/EncryptUtility.java +++ b/web-common/src/main/java/com/inspur/edp/web/common/encrypt/EncryptUtility.java @@ -16,6 +16,7 @@ package com.inspur.edp.web.common.encrypt; +import com.inspur.edp.web.common.constant.WebCommonExceptionConstant; import com.inspur.edp.web.common.customexception.WebCustomException; import com.inspur.edp.web.common.logger.WebLogger; import com.sun.org.apache.xerces.internal.impl.dv.util.Base64; @@ -313,7 +314,7 @@ public class EncryptUtility { try { result = Base64.encode(res.getBytes(charset)); } catch (Exception e) { - throw new WebCustomException("编码失败:" + res, e); + throw new WebCustomException(WebCommonExceptionConstant.WEB_COMMON_ERROR_0001, new String[]{res}, e); } return result; } @@ -331,7 +332,7 @@ public class EncryptUtility { try { return new String(Base64.decode(res), charset); } catch (Exception e) { - throw new WebCustomException("base64Decode失败", e); + throw new WebCustomException(WebCommonExceptionConstant.WEB_COMMON_ERROR_0002, e); } } diff --git a/web-common/src/main/java/com/inspur/edp/web/common/entity/TerminalType.java b/web-common/src/main/java/com/inspur/edp/web/common/entity/TerminalType.java index 6e64ac17352b672219173a86012df15ec4e0af52..09dd3855636740e20a4605beb7933fe6f117d97a 100644 --- a/web-common/src/main/java/com/inspur/edp/web/common/entity/TerminalType.java +++ b/web-common/src/main/java/com/inspur/edp/web/common/entity/TerminalType.java @@ -18,6 +18,7 @@ package com.inspur.edp.web.common.entity; import com.inspur.edp.web.common.JITEngineConstants; import com.inspur.edp.web.common.constant.FrontendProjectConstant; +import com.inspur.edp.web.common.constant.WebCommonExceptionConstant; import com.inspur.edp.web.common.customexception.WebCustomException; import com.inspur.edp.web.common.io.FileUtility; import lombok.Data; @@ -435,7 +436,7 @@ public enum TerminalType { } else if (TerminalType.MOBILE.getMetadataType().equals(sourceMetadataType)) { return TerminalType.MOBILE; } else { - throw new WebCustomException("未知的数据类型转换成TerminalType,对应数据类型为:" + sourceMetadataType); + throw new WebCustomException(WebCommonExceptionConstant.WEB_COMMON_ERROR_0003, new String[]{sourceMetadataType}); } } diff --git a/web-common/src/main/java/com/inspur/edp/web/common/environment/EnvironmentException.java b/web-common/src/main/java/com/inspur/edp/web/common/environment/EnvironmentException.java index 438ab709934740c8331f61d40e3bfa76696f2463..df5743fa38c19e8bd40c18dc217ecc13509a5efd 100644 --- a/web-common/src/main/java/com/inspur/edp/web/common/environment/EnvironmentException.java +++ b/web-common/src/main/java/com/inspur/edp/web/common/environment/EnvironmentException.java @@ -16,6 +16,8 @@ package com.inspur.edp.web.common.environment; +import com.inspur.edp.web.common.constant.WebCommonI18nMsgConstant; +import com.inspur.edp.web.common.utility.ResourceLocalizeUtil; import io.iec.edp.caf.commons.exception.ExceptionLevel; /** @@ -26,6 +28,8 @@ import io.iec.edp.caf.commons.exception.ExceptionLevel; */ public class EnvironmentException extends RuntimeException { + + /** * 级别 主要用于在客户端进行展现 */ @@ -42,9 +46,14 @@ public class EnvironmentException extends RuntimeException { /** * 用于界面展现的title标题展示 */ - private String title = "错误提示"; + private String title; + + public EnvironmentException() { + this.title = ResourceLocalizeUtil.getString(WebCommonI18nMsgConstant.WEB_COMMON_MSG_0001); + } public String getTitle() { + ResourceLocalizeUtil.getString(this.title); return this.title; } diff --git a/web-common/src/main/java/com/inspur/edp/web/common/environment/checker/ExecuteEnvironmentChecker.java b/web-common/src/main/java/com/inspur/edp/web/common/environment/checker/ExecuteEnvironmentChecker.java index 6af0b017285a812f1281e7b246c5cc55770947fd..4c57891c5e7001583e1931612d9f0404dac1e2f7 100644 --- a/web-common/src/main/java/com/inspur/edp/web/common/environment/checker/ExecuteEnvironmentChecker.java +++ b/web-common/src/main/java/com/inspur/edp/web/common/environment/checker/ExecuteEnvironmentChecker.java @@ -16,9 +16,11 @@ package com.inspur.edp.web.common.environment.checker; +import com.inspur.edp.web.common.constant.WebCommonI18nMsgConstant; import com.inspur.edp.web.common.environment.EnvironmentException; import com.inspur.edp.web.common.utility.CommandLineUtility; import com.inspur.edp.web.common.utility.OperatingSystemUtility; +import com.inspur.edp.web.common.utility.ResourceLocalizeUtil; import com.inspur.edp.web.common.utility.StringUtility; import io.iec.edp.caf.commons.exception.ExceptionLevel; @@ -30,13 +32,21 @@ import io.iec.edp.caf.commons.exception.ExceptionLevel; * @Create: 2022/7/29 15:20 */ public class ExecuteEnvironmentChecker { - private static final String endMessage = "若已安装,请尝试重启iGIX服务。"; - private static final String prefixMessage = "当前环境"; + public static String getEndMessage() { + return ResourceLocalizeUtil.getString(WebCommonI18nMsgConstant.WEB_COMMON_MSG_0002); + } + + + public static String getPrefixMessage() { + return ResourceLocalizeUtil.getString(WebCommonI18nMsgConstant.WEB_COMMON_MSG_0003); + } /** * 默认的弹窗标题 */ - private static final String defaultModalTitle = "提示"; + public static String getDefaultModalTitle() { + return ResourceLocalizeUtil.getString(WebCommonI18nMsgConstant.WEB_COMMON_MSG_0004); + } /** * 默认的弹窗级别 */ @@ -72,7 +82,11 @@ public class ExecuteEnvironmentChecker { return checkResult; } checkResult.setSuccess(false); - checkResult.setErrorMessage(prefixMessage + "node命令不可用,请安装Nodejs,请参考:Nodejs安装。 " + endMessage); + checkResult.setErrorMessage(ResourceLocalizeUtil.getString(WebCommonI18nMsgConstant.WEB_COMMON_MSG_0005, + getPrefixMessage(), + "node", + getKnowledgeUrl(), + getEndMessage())); return checkResult; } @@ -94,7 +108,11 @@ public class ExecuteEnvironmentChecker { return checkResult; } checkResult.setSuccess(false); - checkResult.setErrorMessage(String.format(prefixMessage + "npm命令不可用,请安装Nodejs,请参考:Nodejs安装。%s ", endMessage)); + checkResult.setErrorMessage(ResourceLocalizeUtil.getString(WebCommonI18nMsgConstant.WEB_COMMON_MSG_0005, + getPrefixMessage(), + "npm", + getKnowledgeUrl(), + getEndMessage())); return checkResult; } @@ -116,7 +134,10 @@ public class ExecuteEnvironmentChecker { return checkResult; } checkResult.setSuccess(false); - checkResult.setErrorMessage(prefixMessage + "Jit-Engine未部署,请先部署。请参考:Jit-Engine安装。" + endMessage); + checkResult.setErrorMessage(ResourceLocalizeUtil.getString(WebCommonI18nMsgConstant.WEB_COMMON_MSG_0006, + getPrefixMessage(), + getKnowledgeUrl(), + getEndMessage())); return checkResult; } @@ -137,7 +158,10 @@ public class ExecuteEnvironmentChecker { return checkResult; } checkResult.setSuccess(false); - checkResult.setErrorMessage(prefixMessage + "未部署依赖ng命令,请先部署,请参考:" + "Angular-Cli安装。" + endMessage); + checkResult.setErrorMessage(ResourceLocalizeUtil.getString(WebCommonI18nMsgConstant.WEB_COMMON_MSG_0007, + getPrefixMessage(), + getKnowledgeUrl(), + getEndMessage())); return checkResult; } @@ -148,16 +172,16 @@ public class ExecuteEnvironmentChecker { /// 不考虑npm使用安装盘的情况 ExecuteEnvironmentCheckResult nodeCheckResult = ExecuteEnvironmentChecker.checkGlobalNodeInstalled(); if (!nodeCheckResult.isSuccess()) { - throw new EnvironmentException(nodeCheckResult.getErrorMessage(), defaultModalTitle, defaultModalLevel); + throw new EnvironmentException(nodeCheckResult.getErrorMessage(), getDefaultModalTitle(), defaultModalLevel); } ExecuteEnvironmentCheckResult npmCheckResult = ExecuteEnvironmentChecker.checkGlobalNpmInstalled(); if (!npmCheckResult.isSuccess()) { - throw new EnvironmentException(npmCheckResult.getErrorMessage(), defaultModalTitle, defaultModalLevel); + throw new EnvironmentException(npmCheckResult.getErrorMessage(), getDefaultModalTitle(), defaultModalLevel); } ExecuteEnvironmentCheckResult ngCheckResult = ExecuteEnvironmentChecker.checkGlobalNgInstalled(); if (!ngCheckResult.isSuccess()) { - throw new EnvironmentException(ngCheckResult.getErrorMessage(), defaultModalTitle, defaultModalLevel); + throw new EnvironmentException(ngCheckResult.getErrorMessage(), getDefaultModalTitle(), defaultModalLevel); } } @@ -168,12 +192,12 @@ public class ExecuteEnvironmentChecker { /// 不考虑npm使用安装盘的情况 ExecuteEnvironmentCheckResult nodeCheckResult = ExecuteEnvironmentChecker.checkGlobalNodeInstalled(); if (!nodeCheckResult.isSuccess()) { - throw new EnvironmentException(nodeCheckResult.getErrorMessage(), defaultModalTitle, defaultModalLevel); + throw new EnvironmentException(nodeCheckResult.getErrorMessage(), getDefaultModalTitle(), defaultModalLevel); } ExecuteEnvironmentCheckResult jitCheckResult = ExecuteEnvironmentChecker.checkGlobalJitEngineInstalled(); if (!jitCheckResult.isSuccess()) { - throw new EnvironmentException(jitCheckResult.getErrorMessage(), defaultModalTitle, defaultModalLevel); + throw new EnvironmentException(jitCheckResult.getErrorMessage(), getDefaultModalTitle(), defaultModalLevel); } } } diff --git a/web-common/src/main/java/com/inspur/edp/web/common/metadata/GspProjectUtility.java b/web-common/src/main/java/com/inspur/edp/web/common/metadata/GspProjectUtility.java index 3c339e121f1a26704f568b4ef77539deaf67bbc3..b37ecd52af59a78478d1c9ebcec13527188df8a5 100644 --- a/web-common/src/main/java/com/inspur/edp/web/common/metadata/GspProjectUtility.java +++ b/web-common/src/main/java/com/inspur/edp/web/common/metadata/GspProjectUtility.java @@ -18,6 +18,7 @@ package com.inspur.edp.web.common.metadata; import com.inspur.edp.lcm.metadata.api.entity.GspProject; import com.inspur.edp.lcm.metadata.api.service.GspProjectService; +import com.inspur.edp.web.common.constant.WebCommonExceptionConstant; import com.inspur.edp.web.common.customexception.WebCustomException; import com.inspur.edp.web.common.logger.WebLogger; import io.iec.edp.caf.commons.exception.ExceptionLevel; @@ -40,7 +41,7 @@ public class GspProjectUtility { return GspProjectServiceInstance.get().getGspProjectInfo(projectPath); } catch (Exception ex) { WebLogger.Instance.error(ex, GspProjectUtility.class.getName()); - throw new WebCustomException("获取工程信息出现错误," + ex.getMessage(), ExceptionLevel.Error); + throw new WebCustomException(WebCommonExceptionConstant.WEB_COMMON_ERROR_0004, ExceptionLevel.Error); } } diff --git a/web-common/src/main/java/com/inspur/edp/web/common/metadata/MetadataGetterParameter.java b/web-common/src/main/java/com/inspur/edp/web/common/metadata/MetadataGetterParameter.java index fa3b5a0ac3fc5f75b2b8e2c8534c4633b0042649..8beda93dc9294ca610d82632eaeb4b7d04b5cd68 100644 --- a/web-common/src/main/java/com/inspur/edp/web/common/metadata/MetadataGetterParameter.java +++ b/web-common/src/main/java/com/inspur/edp/web/common/metadata/MetadataGetterParameter.java @@ -17,6 +17,7 @@ package com.inspur.edp.web.common.metadata; import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.web.common.constant.WebCommonExceptionConstant; import com.inspur.edp.web.common.customexception.WebCustomException; import lombok.Data; import lombok.Getter; @@ -97,7 +98,7 @@ public class MetadataGetterParameter implements Serializable { */ public WebMetadataUri getTargetMetadataUri() { if (this.getTargetMetadataInfo() == null) { - throw new WebCustomException("元数据请求参数,目标元数据参数不能为空"); + throw new WebCustomException(WebCommonExceptionConstant.WEB_COMMON_ERROR_0005); } return new WebMetadataUri(this.getTargetMetadataInfo().getId(), this.getTargetMetadataInfo().getCode(), diff --git a/web-common/src/main/java/com/inspur/edp/web/common/metadata/MetadataUtility.java b/web-common/src/main/java/com/inspur/edp/web/common/metadata/MetadataUtility.java index 970eba13c2cbc8a0c4057dbee765fd46bcb712c1..a1f5acaf1f3e40a62433fcfc99248d971d90466d 100644 --- a/web-common/src/main/java/com/inspur/edp/web/common/metadata/MetadataUtility.java +++ b/web-common/src/main/java/com/inspur/edp/web/common/metadata/MetadataUtility.java @@ -22,6 +22,7 @@ import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; import com.inspur.edp.web.command.component.metadata.*; +import com.inspur.edp.web.common.constant.WebCommonExceptionConstant; import com.inspur.edp.web.common.customexception.WebCustomException; import com.inspur.edp.web.common.environment.ExecuteEnvironment; import com.inspur.edp.web.common.io.FileUtility; @@ -305,7 +306,7 @@ public final class MetadataUtility { try { commandMetadataContent = (WebCommandsMetadata) commandMetadata.getContent(); } catch (RuntimeException e) { - throw new WebCustomException("当前元数据非命令元数据。元数据id是:" + commandMetadata.getHeader().getId(), e); + throw new WebCustomException(WebCommonExceptionConstant.WEB_COMMON_ERROR_0006, new String[]{commandMetadata.getHeader().getId()} , e); } if (commandMetadataContent == null) { @@ -348,7 +349,7 @@ public final class MetadataUtility { } else { WebComponentMetadata cmpMetadataContent = (WebComponentMetadata) webComponentMetadata.getContent(); if (cmpMetadataContent == null) { - throw new WebCustomException(String.format("标识为'%1$s'的服务构件为null。", methodReferingItem.getComponentId())); + throw new WebCustomException(WebCommonExceptionConstant.WEB_COMMON_ERROR_0007, new String[]{methodReferingItem.getComponentId()}); } diff --git a/web-common/src/main/java/com/inspur/edp/web/common/utility/CommandExecuteInterceptor.java b/web-common/src/main/java/com/inspur/edp/web/common/utility/CommandExecuteInterceptor.java index bd27664974ea24f90e0b37aa628bf0ef17881356..e801b31315c0de2eeb9b91ca7a308a21b39a4b73 100644 --- a/web-common/src/main/java/com/inspur/edp/web/common/utility/CommandExecuteInterceptor.java +++ b/web-common/src/main/java/com/inspur/edp/web/common/utility/CommandExecuteInterceptor.java @@ -16,6 +16,7 @@ package com.inspur.edp.web.common.utility; +import com.inspur.edp.web.common.constant.WebCommonI18nMsgConstant; import com.inspur.edp.web.common.logger.WebLogger; import org.apache.commons.lang3.SystemUtils; @@ -91,7 +92,7 @@ public class CommandExecuteInterceptor extends Thread { errorSB.delete(0, errorSB.length()); addErrorMessage(errorSB, "npm ERR! ", needAddErrorMessage); addErrorMessage(errorSB, notMatchedPackageVersion, needAddErrorMessage); - addErrorMessage(errorSB, " 未找到对应版本,请修正后重新执行安装!", needAddErrorMessage); + addErrorMessage(errorSB, ResourceLocalizeUtil.getString(WebCommonI18nMsgConstant.WEB_COMMON_MSG_0008), needAddErrorMessage); needAddErrorMessage = false; } else if (line.contains("npm ERR! 404") && line.contains("is not in the npm registry")) { @@ -104,7 +105,8 @@ public class CommandExecuteInterceptor extends Thread { String notExistsPackage = line.substring(line.indexOf(notMatchingVersionTest) + notMatchingVersionTest.length(), line.indexOf(lastIndexText)); errorSB.delete(0, errorSB.length()); addErrorMessage(errorSB, "npm ERR! ", needAddErrorMessage); - addErrorMessage(errorSB, "当前仓库" + notExistsPackage + "包不存在,请切换至其他仓库或修正包版本,然后重新进行安装!", needAddErrorMessage); + addErrorMessage(errorSB, ResourceLocalizeUtil.getString(WebCommonI18nMsgConstant.WEB_COMMON_MSG_0009, notExistsPackage), + needAddErrorMessage); needAddErrorMessage = false; } else if (line.contains("npm ERR! errno ERR_SOCKET_TIMEOUT")) { if (!needAddErrorMessage) { @@ -112,7 +114,7 @@ public class CommandExecuteInterceptor extends Thread { } errorSB.delete(0, errorSB.length()); addErrorMessage(errorSB, "npm ERR! ", needAddErrorMessage); - addErrorMessage(errorSB, "连接服务器超时,请重新安装或切换至其他仓库,然后重新进行安装!", needAddErrorMessage); + addErrorMessage(errorSB, ResourceLocalizeUtil.getString(WebCommonI18nMsgConstant.WEB_COMMON_MSG_0010), needAddErrorMessage); needAddErrorMessage = false; needReInstall = true; @@ -122,7 +124,7 @@ public class CommandExecuteInterceptor extends Thread { } errorSB.delete(0, errorSB.length()); addErrorMessage(errorSB, "npm ERR! ", needAddErrorMessage); - addErrorMessage(errorSB, "权限不足,请以管理员权限运行以进行Npm在线安装!", needAddErrorMessage); + addErrorMessage(errorSB, ResourceLocalizeUtil.getString(WebCommonI18nMsgConstant.WEB_COMMON_MSG_0011), needAddErrorMessage); needAddErrorMessage = false; needReInstall = true; diff --git a/web-common/src/main/java/com/inspur/edp/web/common/utility/CommandLineUtility.java b/web-common/src/main/java/com/inspur/edp/web/common/utility/CommandLineUtility.java index c9b7b890a68a109ad96ff9ac8b9105b2d44f8afe..b8b4139c63bdcde0bb73ce46c634473027559161 100644 --- a/web-common/src/main/java/com/inspur/edp/web/common/utility/CommandLineUtility.java +++ b/web-common/src/main/java/com/inspur/edp/web/common/utility/CommandLineUtility.java @@ -16,6 +16,7 @@ package com.inspur.edp.web.common.utility; +import com.inspur.edp.web.common.constant.WebCommonExceptionConstant; import com.inspur.edp.web.common.customexception.WebCustomException; import com.inspur.edp.web.common.logger.WebLogger; import org.apache.commons.lang3.StringUtils; @@ -136,7 +137,7 @@ public class CommandLineUtility { process = Runtime.getRuntime().exec(new String[]{"/bin/sh", "-c", updateCommand}); } if (updateCommand == null) { - throw new WebCustomException("不支持的操作系统类型,请联系开发人员处理"); + throw new WebCustomException(WebCommonExceptionConstant.WEB_COMMON_ERROR_0008); } return process; } @@ -163,7 +164,7 @@ public class CommandLineUtility { return "/bin/bash"; } - throw new WebCustomException("未识别的操作系统系统。请联系开发人员处理。"); + throw new WebCustomException(WebCommonExceptionConstant.WEB_COMMON_ERROR_0009); } } diff --git a/web-common/src/main/java/com/inspur/edp/web/common/utility/ResourceLocalizeUtil.java b/web-common/src/main/java/com/inspur/edp/web/common/utility/ResourceLocalizeUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..e8e3b0241f66fd6fe4f68aac8ae7eac2346c0f92 --- /dev/null +++ b/web-common/src/main/java/com/inspur/edp/web/common/utility/ResourceLocalizeUtil.java @@ -0,0 +1,36 @@ +package com.inspur.edp.web.common.utility; + +import com.inspur.edp.web.common.constant.WebCommonExceptionConstant; +import com.inspur.edp.web.common.logger.WebLogger; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import io.iec.edp.caf.i18n.api.I18nContextService; +import io.iec.edp.caf.i18n.api.ResourceLocalizer; + +public class ResourceLocalizeUtil { + public ResourceLocalizeUtil() { + + } + + public static String getString(String i18nCode) { + ResourceLocalizer resourceLocalizer = SpringBeanUtils.getBean(ResourceLocalizer.class); + I18nContextService i18nContextService = SpringBeanUtils.getBean(I18nContextService.class); + String language = i18nContextService.getLanguage(); + return resourceLocalizer.getString(i18nCode, WebCommonExceptionConstant.WEB_ERROR_FILE_NAME, WebCommonExceptionConstant.SU, language); + } + + public static String getZhChsString(String i18nCode) { + ResourceLocalizer resourceLocalizer = SpringBeanUtils.getBean(ResourceLocalizer.class); + return resourceLocalizer.getString(i18nCode, WebCommonExceptionConstant.WEB_ERROR_FILE_NAME, WebCommonExceptionConstant.SU, "zh-CHS"); + } + + public static String getString(String i18nCode, Object ...params) { + String result; + try{ + result = String.format(getString(i18nCode), params); + } catch (RuntimeException e) { + result = getString(i18nCode); + WebLogger.Instance.error(e.getMessage()); + } + return result; + } +} diff --git a/web-designschema/src/main/java/com/inspur/edp/web/designschema/constant/I18nExceptionConstant.java b/web-designschema/src/main/java/com/inspur/edp/web/designschema/constant/I18nExceptionConstant.java new file mode 100644 index 0000000000000000000000000000000000000000..eacc2062ddaf90ef54bb81c2e21a17a460579735 --- /dev/null +++ b/web-designschema/src/main/java/com/inspur/edp/web/designschema/constant/I18nExceptionConstant.java @@ -0,0 +1,12 @@ +package com.inspur.edp.web.designschema.constant; + +public class I18nExceptionConstant { + public final static String WEB_DESIGN_SCHEMA_ERROR_0001 = "WEB_DESIGN_SCHEMA_ERROR_0001"; + public final static String WEB_DESIGN_SCHEMA_ERROR_0002 = "WEB_DESIGN_SCHEMA_ERROR_0002"; + public final static String WEB_DESIGN_SCHEMA_ERROR_0003 = "WEB_DESIGN_SCHEMA_ERROR_0003"; + public final static String WEB_DESIGN_SCHEMA_ERROR_0004 = "WEB_DESIGN_SCHEMA_ERROR_0004"; + public final static String WEB_DESIGN_SCHEMA_ERROR_0005 = "WEB_DESIGN_SCHEMA_ERROR_0005"; + public final static String WEB_DESIGN_SCHEMA_ERROR_0006 = "WEB_DESIGN_SCHEMA_ERROR_0006"; + public final static String WEB_DESIGN_SCHEMA_ERROR_0007 = "WEB_DESIGN_SCHEMA_ERROR_0007"; + public final static String WEB_DESIGN_SCHEMA_ERROR_0008 = "WEB_DESIGN_SCHEMA_ERROR_0008"; +} diff --git a/web-designschema/src/main/java/com/inspur/edp/web/designschema/constant/I18nMsgConstant.java b/web-designschema/src/main/java/com/inspur/edp/web/designschema/constant/I18nMsgConstant.java new file mode 100644 index 0000000000000000000000000000000000000000..cd21ab3586565cb60fd0059384a22583dea807ea --- /dev/null +++ b/web-designschema/src/main/java/com/inspur/edp/web/designschema/constant/I18nMsgConstant.java @@ -0,0 +1,10 @@ +package com.inspur.edp.web.designschema.constant; + +public class I18nMsgConstant { + public final static String WEB_DESIGN_SCHEMA_MSG_0001 = "WEB_DESIGN_SCHEMA_MSG_0001"; + public final static String WEB_DESIGN_SCHEMA_MSG_0002 = "WEB_DESIGN_SCHEMA_MSG_0002"; + public final static String WEB_DESIGN_SCHEMA_MSG_0003 = "WEB_DESIGN_SCHEMA_MSG_0003"; + public final static String WEB_DESIGN_SCHEMA_MSG_0004 = "WEB_DESIGN_SCHEMA_MSG_0004"; + public final static String WEB_DESIGN_SCHEMA_MSG_0005 = "WEB_DESIGN_SCHEMA_MSG_0005"; + +} diff --git a/web-designschema/src/main/java/com/inspur/edp/web/designschema/generator/EntityBuilder.java b/web-designschema/src/main/java/com/inspur/edp/web/designschema/generator/EntityBuilder.java index 57d585575ad7c52dfff433832b74cdaad45b9841..4aea020c691213fa391c8324b14e08320e287bb0 100644 --- a/web-designschema/src/main/java/com/inspur/edp/web/designschema/generator/EntityBuilder.java +++ b/web-designschema/src/main/java/com/inspur/edp/web/designschema/generator/EntityBuilder.java @@ -21,6 +21,7 @@ import com.inspur.edp.formserver.viewmodel.GspViewModelElement; import com.inspur.edp.udt.designtime.api.entity.SimpleDataTypeDef; import com.inspur.edp.web.common.customexception.WebCustomException; import com.inspur.edp.web.common.utility.StringUtility; +import com.inspur.edp.web.designschema.constant.I18nExceptionConstant; import com.inspur.edp.web.designschema.elements.Entity; import com.inspur.edp.web.designschema.elements.Field; import com.inspur.edp.web.designschema.elements.type.EntityType; @@ -97,7 +98,7 @@ public class EntityBuilder { private void VerifyViewObject(IGspCommonObject viewObject) { if (viewObject.getIDElement() == null) { - throw new WebCustomException(String.format("标识为'%1$s'的视图对象'%2$s'的IDElement属性不允许为null。", viewObject, viewObject.getName())); + throw new WebCustomException(I18nExceptionConstant.WEB_DESIGN_SCHEMA_ERROR_0001, new String[]{ viewObject.getBelongModelID(), viewObject.getName()}); } } } diff --git a/web-designschema/src/main/java/com/inspur/edp/web/designschema/generator/FieldBuilder.java b/web-designschema/src/main/java/com/inspur/edp/web/designschema/generator/FieldBuilder.java index 77e758ef9a9608265194e2bf728bdf1ec40ad6fe..f98c3a98065841d96d48d8bb764a64c7c94175af 100644 --- a/web-designschema/src/main/java/com/inspur/edp/web/designschema/generator/FieldBuilder.java +++ b/web-designschema/src/main/java/com/inspur/edp/web/designschema/generator/FieldBuilder.java @@ -34,7 +34,10 @@ import com.inspur.edp.web.common.environment.ExecuteEnvironment; import com.inspur.edp.web.common.metadata.MetadataGetterParameter; import com.inspur.edp.web.common.metadata.MetadataTypeEnum; import com.inspur.edp.web.common.metadata.MetadataUtility; +import com.inspur.edp.web.common.utility.ResourceLocalizeUtil; import com.inspur.edp.web.common.utility.StringUtility; +import com.inspur.edp.web.designschema.constant.I18nExceptionConstant; +import com.inspur.edp.web.designschema.constant.I18nMsgConstant; import com.inspur.edp.web.designschema.elements.ComplexField; import com.inspur.edp.web.designschema.elements.Field; import com.inspur.edp.web.designschema.elements.SimpleField; @@ -558,7 +561,7 @@ public class FieldBuilder { } private String transferBindingFieldId(String beBindingFieldId, ComplexField bizField, TypeBuildingContext elementContext, RefObject refObject) { - Objects.requireNonNull(beBindingFieldId, "beBindingFieldId不能为空"); + Objects.requireNonNull(beBindingFieldId, ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_DESIGN_SCHEMA_MSG_0001)); // 找到业务字段 // IBusinessFieldService businessFieldService = SpringBeanUtils.getBean(IBusinessFieldService.class); // BusinessField businessField = businessFieldService.getBusinessField(elementContext.getBusinessFieldId()); @@ -601,7 +604,7 @@ public class FieldBuilder { } } } - Objects.requireNonNull(beField, "未在实体上找到对应的字段,请检查业务字段配置信息"); + Objects.requireNonNull(beField, ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_DESIGN_SCHEMA_MSG_0002)); // 根据字段的belongField,判断类型: 1. 单值 2. 多值 3.关联 switch (fieldGenType) { @@ -645,7 +648,7 @@ public class FieldBuilder { refObject.argvalue = schemaField; return schemaField.getId(); default: - throw new WebCustomException("不支持的业务字段嵌套层次,请联系技术人员"); + throw new WebCustomException(I18nExceptionConstant.WEB_DESIGN_SCHEMA_ERROR_0002); } } @@ -658,7 +661,7 @@ public class FieldBuilder { }, null, ExecuteEnvironment.Runtime, false); } else { MetadataGetterParameter metadataGetterParameter = MetadataGetterParameter.getNewInstance(id, null, MetadataTypeEnum.ViewModel); - metadataGetterParameter.setTargetMetadataNotFoundMessage("更新表单schema,关联字段元数据找不到,请修正。对应字段元数据id为:" + id); + metadataGetterParameter.setTargetMetadataNotFoundMessage(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_DESIGN_SCHEMA_MSG_0003, id)); return MetadataUtility.getInstance().getMetadataWithDesign(metadataGetterParameter); } } diff --git a/web-designschema/src/main/java/com/inspur/edp/web/designschema/generator/FieldTypeBuilder.java b/web-designschema/src/main/java/com/inspur/edp/web/designschema/generator/FieldTypeBuilder.java index 17bda720f5b8115b7e147b3aa6aa156d20e13c14..1a535008ff94c351685b4533d6aac684f1a36325 100644 --- a/web-designschema/src/main/java/com/inspur/edp/web/designschema/generator/FieldTypeBuilder.java +++ b/web-designschema/src/main/java/com/inspur/edp/web/designschema/generator/FieldTypeBuilder.java @@ -31,6 +31,9 @@ import com.inspur.edp.web.common.customexception.WebCustomException; import com.inspur.edp.web.common.metadata.MetadataGetterParameter; import com.inspur.edp.web.common.metadata.MetadataTypeEnum; import com.inspur.edp.web.common.metadata.MetadataUtility; +import com.inspur.edp.web.common.utility.ResourceLocalizeUtil; +import com.inspur.edp.web.designschema.constant.I18nExceptionConstant; +import com.inspur.edp.web.designschema.constant.I18nMsgConstant; import com.inspur.edp.web.designschema.elements.Field; import com.inspur.edp.web.designschema.elements.SimpleField; import com.inspur.edp.web.designschema.elements.type.*; @@ -140,7 +143,7 @@ public class FieldTypeBuilder { private EntityType GenerateEntityFieldType(TypeBuildingContext context, TypeBuildingContext parentContext, String scene) { GspAssociationCollection associations = context.getAssociations(); if (associations == null || associations.size() == 0) { - throw new WebCustomException(String.format("字段'%1$s'不包含关联实体信息。", context.Get("Name", String.class))); + throw new WebCustomException(I18nExceptionConstant.WEB_DESIGN_SCHEMA_ERROR_0003, new String[]{context.Get("Name", String.class)}); } TypeBuildingContext originalFieldContext = TypeBuildingContext.CreateSimpleTypeContextFromAssociation(context, parentContext); Field originalField = fieldBuilder.build(originalFieldContext, parentContext, scene); @@ -199,7 +202,7 @@ public class FieldTypeBuilder { .map(e -> fieldBuilder.build(e, context, scene)).collect(Collectors.toList()); } else { - throw new ClassCastException("Id为'uri'的统一数据类型元数据为未识别的类型。"); + throw new WebCustomException(I18nExceptionConstant.WEB_DESIGN_SCHEMA_ERROR_0004, new String[]{context.getUnifiedDataType()}); } FormUdtExtension formUdtExtension = (FormUdtExtension) unifiedDataType.getUdtExtensions().get("Form"); context.getParams().put("ExtendProperty", formUdtExtension); @@ -232,11 +235,11 @@ public class FieldTypeBuilder { typeMetadata = customizationService.getMetadata(uri); } else { MetadataGetterParameter metadataGetterParameter = MetadataGetterParameter.getNewInstance(uri, null, MetadataTypeEnum.ViewModel); - metadataGetterParameter.setTargetMetadataNotFoundMessage("更新表单Schema,获取UDT字段元数据失败,元数据不存在。对应元数据id为:" + uri); + metadataGetterParameter.setTargetMetadataNotFoundMessage(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_DESIGN_SCHEMA_MSG_0004, uri)); typeMetadata = MetadataUtility.getInstance().getMetadataWithDesign(metadataGetterParameter); } if (typeMetadata == null) { - throw new WebCustomException(String.format("未获取到id为'%1$s'的统一数据类型(UDT)元数据。", uri)); + throw new WebCustomException(I18nExceptionConstant.WEB_DESIGN_SCHEMA_ERROR_0005, new String[]{uri}); } unifiedDataType = (UnifiedDataTypeDef) ((typeMetadata.getContent() instanceof UnifiedDataTypeDef) ? typeMetadata.getContent() : null); return unifiedDataType; diff --git a/web-designschema/src/main/java/com/inspur/edp/web/designschema/generator/TypeBuildingContext.java b/web-designschema/src/main/java/com/inspur/edp/web/designschema/generator/TypeBuildingContext.java index 67d9ca08557538a578df45ec1c0626f9f8560c69..8039501b715face31dc2559defec8209708c4395 100644 --- a/web-designschema/src/main/java/com/inspur/edp/web/designschema/generator/TypeBuildingContext.java +++ b/web-designschema/src/main/java/com/inspur/edp/web/designschema/generator/TypeBuildingContext.java @@ -34,7 +34,10 @@ import com.inspur.edp.web.common.customexception.WebCustomException; import com.inspur.edp.web.common.metadata.MetadataGetterParameter; import com.inspur.edp.web.common.metadata.MetadataTypeEnum; import com.inspur.edp.web.common.metadata.MetadataUtility; +import com.inspur.edp.web.common.utility.ResourceLocalizeUtil; import com.inspur.edp.web.common.utility.StringUtility; +import com.inspur.edp.web.designschema.constant.I18nExceptionConstant; +import com.inspur.edp.web.designschema.constant.I18nMsgConstant; import io.iec.edp.caf.commons.utils.SpringBeanUtils; import org.apache.commons.lang3.ObjectUtils; @@ -446,7 +449,7 @@ public class TypeBuildingContext { public static TypeBuildingContext CreateSimpleTypeContextFromAssociation(TypeBuildingContext context, TypeBuildingContext parent) { GspAssociationCollection associations = context.getAssociations(); if (associations == null || associations.size() == 0) { - throw new WebCustomException(String.format("字段'%1$s'不包含关联实体信息。", context.Get("Name", String.class))); + throw new WebCustomException(I18nExceptionConstant.WEB_DESIGN_SCHEMA_ERROR_0006, new String[]{context.Get("Name", String.class)}); } String tempVar = context.Get("Label", String.class); @@ -487,7 +490,7 @@ public class TypeBuildingContext { private static void VerifyUnifiedDataType(IGspCommonField element) { if (element.getIsUdt()) { if (StringUtility.isNullOrEmpty(element.getUdtID().trim())) { - throw new WebCustomException(String.format("标识为'%1$s',标签为'%2$s'的字段'%3$s'被定义为'UnifiedDataType'字段,但是没有指定'UnifiedDataType'标识,请检查业务实体。", element.getID(), element.getLabelID(), element.getName())); + throw new WebCustomException(I18nExceptionConstant.WEB_DESIGN_SCHEMA_ERROR_0007, new String[]{element.getID(), element.getLabelID(), element.getName()}); } } } @@ -501,11 +504,11 @@ public class TypeBuildingContext { typeMetadata = customizationService.getMetadata(uri); } else { MetadataGetterParameter metadataGetterParameter = MetadataGetterParameter.getNewInstance(uri, null, MetadataTypeEnum.ViewModel); - metadataGetterParameter.setTargetMetadataNotFoundMessage("更新表单Schema,获取UDT字段元数据失败,元数据不存在。对应元数据id为:" + uri); + metadataGetterParameter.setTargetMetadataNotFoundMessage(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_DESIGN_SCHEMA_MSG_0004, uri)); typeMetadata = MetadataUtility.getInstance().getMetadataWithDesign(metadataGetterParameter); } if (typeMetadata == null) { - throw new WebCustomException(String.format("未获取到id为'%1$s'的统一数据类型(UDT)元数据。", uri)); + throw new WebCustomException(I18nExceptionConstant.WEB_DESIGN_SCHEMA_ERROR_0005, new String[]{uri}); } unifiedDataType = (UnifiedDataTypeDef) ((typeMetadata.getContent() instanceof UnifiedDataTypeDef) ? typeMetadata.getContent() : null); this.setUnifiedDataTypeDefInstance(unifiedDataType); diff --git a/web-designschema/src/main/java/com/inspur/edp/web/designschema/synchronization/BaseDesignSchemaChangeHandler.java b/web-designschema/src/main/java/com/inspur/edp/web/designschema/synchronization/BaseDesignSchemaChangeHandler.java index 3606847269a53256a273744fd08b8e6b63c75d03..eb44a6d1d03b763ddc27b32b4c767726b614b79e 100644 --- a/web-designschema/src/main/java/com/inspur/edp/web/designschema/synchronization/BaseDesignSchemaChangeHandler.java +++ b/web-designschema/src/main/java/com/inspur/edp/web/designschema/synchronization/BaseDesignSchemaChangeHandler.java @@ -22,6 +22,7 @@ import com.inspur.edp.formserver.viewmodel.GspViewModel; import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import com.inspur.edp.web.common.customexception.WebCustomException; import com.inspur.edp.web.common.serialize.SerializeUtility; +import com.inspur.edp.web.designschema.constant.I18nExceptionConstant; import com.inspur.edp.web.designschema.elements.Schema; import com.inspur.edp.web.designschema.synchronization.helplinkconfig.VoMetadataHelpLinkConfigModifierBeforeSaving; import com.inspur.edp.web.formmetadata.metadata.FormMetadataContent; @@ -64,7 +65,7 @@ public abstract class BaseDesignSchemaChangeHandler { } } } else { - throw new WebCustomException("表单DOM结构错误:未到module.schemas节点"); + throw new WebCustomException(I18nExceptionConstant.WEB_DESIGN_SCHEMA_ERROR_0008); } } diff --git a/web-designschema/src/main/java/com/inspur/edp/web/designschema/synchronization/FormMetadataUpdate.java b/web-designschema/src/main/java/com/inspur/edp/web/designschema/synchronization/FormMetadataUpdate.java index 6939079887184bb13946199b342c9c4a5875040e..b21e7ba738ecc5b43a5767992d1d206c753e82bb 100644 --- a/web-designschema/src/main/java/com/inspur/edp/web/designschema/synchronization/FormMetadataUpdate.java +++ b/web-designschema/src/main/java/com/inspur/edp/web/designschema/synchronization/FormMetadataUpdate.java @@ -26,7 +26,10 @@ import com.inspur.edp.web.common.metadata.MetadataGetterParameter; import com.inspur.edp.web.common.metadata.MetadataTypeEnum; import com.inspur.edp.web.common.metadata.MetadataUtility; import com.inspur.edp.web.common.serialize.SerializeUtility; +import com.inspur.edp.web.common.utility.ResourceLocalizeUtil; import com.inspur.edp.web.common.utility.StringUtility; +import com.inspur.edp.web.designschema.constant.I18nExceptionConstant; +import com.inspur.edp.web.designschema.constant.I18nMsgConstant; import com.inspur.edp.web.designschema.elements.Schema; import com.inspur.edp.web.designschema.synchronization.helplinkconfig.VoMetadataHelpLinkConfigModifierBeforeSaving; import com.inspur.edp.web.formmetadata.metadata.FormMetadataContent; @@ -66,7 +69,7 @@ public class FormMetadataUpdate { metadataGetterParameter.setTargetMetadataCode(schema.getCode()); metadataGetterParameter.setTargetMetadataName(schema.getName()); metadataGetterParameter.setTargetMetadataNamespace(voNameSpace); - metadataGetterParameter.setTargetMetadataNotFoundMessage("根据表单元数据获取VO元数据为空,请检查表单元数据module>schemas>id 是否正确,此参数为表单对应VO元数据id参数!"); + metadataGetterParameter.setTargetMetadataNotFoundMessage(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_DESIGN_SCHEMA_MSG_0005)); GspMetadata metadata = MetadataUtility.getInstance().getMetadataWithDesign(metadataGetterParameter); GspViewModel viewObject = (GspViewModel) ((metadata.getContent() instanceof GspViewModel) ? metadata.getContent() : null); @@ -80,7 +83,7 @@ public class FormMetadataUpdate { } } } else { - throw new WebCustomException("表单DOM结构错误:未到module.schemas节点"); + throw new WebCustomException(I18nExceptionConstant.WEB_DESIGN_SCHEMA_ERROR_0008); } } } diff --git a/web-form-jitengine/src/main/java/com/inspur/edp/web/jitengine/JITEngineManager.java b/web-form-jitengine/src/main/java/com/inspur/edp/web/jitengine/JITEngineManager.java index 4b4c5a0360dbbd65c34c3d960e42ab4eecc774c4..124cff57de1057a3ed8f1ea46058e69c861ce579 100644 --- a/web-form-jitengine/src/main/java/com/inspur/edp/web/jitengine/JITEngineManager.java +++ b/web-form-jitengine/src/main/java/com/inspur/edp/web/jitengine/JITEngineManager.java @@ -19,6 +19,7 @@ package com.inspur.edp.web.jitengine; import com.inspur.edp.lcm.metadata.api.entity.*; import com.inspur.edp.web.common.JITEngineConstants; import com.inspur.edp.web.common.constant.FrontendProjectConstant; +import com.inspur.edp.web.common.constant.WebCommonExceptionConstant; import com.inspur.edp.web.common.customexception.WebCustomException; import com.inspur.edp.web.common.entity.NodeJsCommandEnum; import com.inspur.edp.web.common.entity.TerminalType; @@ -42,6 +43,8 @@ import com.inspur.edp.web.formmetadata.resolver.ResolveFormMetadataItem; import com.inspur.edp.web.formmetadata.service.FormMetadataService; import com.inspur.edp.web.frontendproject.entity.FrontendProjectGenerateParameter; import com.inspur.edp.web.jitengine.babelgrnerate.GenerateForBabel; +import com.inspur.edp.web.jitengine.constant.I18nExceptionConstant; +import com.inspur.edp.web.jitengine.constant.I18nMsgConstant; import com.inspur.edp.web.jitengine.dynamicform.htmltemplate.HtmlTemplateEntity; import com.inspur.edp.web.jitengine.dynamicform.htmltemplate.HtmlTemplateManager; import com.inspur.edp.web.jitengine.expressions.ExpressionFormGenerator; @@ -122,7 +125,7 @@ public class JITEngineManager { // 针对升级工具 不执行在线安装 if (!buildParameter.isMobileApprove() && !buildParameter.isBabelCompile() && !buildParameter.isInUpgradeTool() && !FileUtility.exists(buildParameter.getBuildNodeModulePath())) { - String errorMessage = "编译依赖node_modules未部署,请先部署。部署路径为:" + buildParameter.getBuildNodeModulePath(); + String errorMessage = ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_JIT_ENGINE_MSG_0001, buildParameter.getBuildNodeModulePath()); WebLogger.Instance.error(errorMessage, JITEngineManager.class.getName()); return errorMessage; } @@ -211,7 +214,7 @@ public class JITEngineManager { } break; default: - throw new WebCustomException("暂不支持的终端类型:" + terminalType + "。请联系管理员处理。"); + throw new WebCustomException(I18nExceptionConstant.WEB_JIT_ENGINE_ERROR_0001, new String[]{String.valueOf(terminalType)}); } return refNodeModulesPath; @@ -239,7 +242,7 @@ public class JITEngineManager { projectFormRelativeResolvePath = path.resolve(TerminalType.MOBILE.getWebDevPathName()).toString(); break; default: - throw new WebCustomException("未识别的终端类型,请联系管理员处理。当前终端类型是:" + terminalType); + throw new WebCustomException(WebCommonExceptionConstant.WEB_COMMON_ERROR_0010, new String[]{String.valueOf(terminalType)}); } return projectFormRelativeResolvePath; @@ -267,7 +270,7 @@ public class JITEngineManager { projectFormRelativeGeneratePath = path.resolve(TerminalType.MOBILE.getAppPathName()).toString(); break; default: - throw new WebCustomException("未识别的终端类型,请联系管理员处理。当前终端类型是:" + terminalType); + throw new WebCustomException(WebCommonExceptionConstant.WEB_COMMON_ERROR_0010, new String[]{String.valueOf(terminalType)}); } return projectFormRelativeGeneratePath; @@ -384,13 +387,13 @@ public class JITEngineManager { // Resolve StateMachine StateMachineAnalysis stateMachineAnalysis=new StateMachineAnalysis(ExecuteEnvironment.Design,false); - stateMachineAnalysis.resolveStateMachine(formDom, formMetadataName, targetStorageBasePath, relativePath); + stateMachineAnalysis.resolveStateMachine(formDom, formMetadataName, targetStorageBasePath, baseFormPath); } // Resolve Command // 增加是否解析表单参数 如果为解析表单 那么不再生成对应的command.json 文件 CommandsAnalysis commandsAnalysis = new CommandsAnalysis(ExecuteEnvironment.Design, false, !resolveFormMetadataItem.getCalculateIsDynamicForm()); - commandsAnalysis.resolveCommand(CommandsAnalysis.ResolveCommandParameter.init(resolveFormMetadataItem.getGspMetadata(), formDom), + commandsAnalysis.resolveCommand(CommandsAnalysis.ResolveCommandParameter.init(resolveFormMetadataItem.getGspMetadata(), formDom, baseFormPath), formMetadataName, targetStorageBasePath, projectCmpList); if (!resolveFormMetadataItem.getCalculateIsDynamicForm()) { @@ -673,8 +676,8 @@ public class JITEngineManager { String currentNodeModulesPath = FileUtility.combine(parentNode_ModulesPath, "node_modules"); if (!FileUtility.exists(currentNodeModulesPath)) { - String errorMessage = "编译依赖node_modules未部署,请先部署。部署路径为:" + currentNodeModulesPath + "或开启Npm在线安装(需要网络连接)。请参考:Npm在线安装。"; - throw new RuntimeException(errorMessage); + String errorMessage = ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_JIT_ENGINE_MSG_0002, currentNodeModulesPath); + throw new WebCustomException(errorMessage); } } @@ -691,9 +694,9 @@ public class JITEngineManager { File mobileSpecialCli = new File(FileUtility.combine(node_modulesPath, "@farris", "mobile-cli")); if (!mobileSpecialCli.exists()) { // 如果移动npm包不存在 那么进行提示 - String tipInfo = "当前node_modules不包含移动npm包,请使用Npm在线安装或更新最新node_modules离线包。请注意:移动表单编译不再使用mobile目录下的node_modules,使用工程目录下node_modules。"; + String tipInfo = ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_JIT_ENGINE_MSG_0003); WebLogger.Instance.info(tipInfo, JITEngineManager.class.getName()); - throw new RuntimeException(tipInfo); + throw new WebCustomException(tipInfo); } } } @@ -716,7 +719,7 @@ public class JITEngineManager { projectBuildPath = FileUtility.combine(projectPath, FrontendProjectConstant.FRONTEND_PROJECT_COMPILE_PATH, TerminalType.MOBILE.getAppPathName()); break; default: - throw new WebCustomException("暂不支持的终端类型:" + terminalType + "。请联系管理员处理。"); + throw new WebCustomException(I18nExceptionConstant.WEB_JIT_ENGINE_ERROR_0001, new String[]{String.valueOf(terminalType)}); } return projectBuildPath; diff --git a/web-form-jitengine/src/main/java/com/inspur/edp/web/jitengine/NpmInstallBeforeGenerate.java b/web-form-jitengine/src/main/java/com/inspur/edp/web/jitengine/NpmInstallBeforeGenerate.java index c19798a95bfc6acfc3bd5110605dda4cfaf6031e..daa8fe9742fbfe426484198a28676b2855c45fdf 100644 --- a/web-form-jitengine/src/main/java/com/inspur/edp/web/jitengine/NpmInstallBeforeGenerate.java +++ b/web-form-jitengine/src/main/java/com/inspur/edp/web/jitengine/NpmInstallBeforeGenerate.java @@ -16,6 +16,7 @@ package com.inspur.edp.web.jitengine; +import com.inspur.edp.web.common.customexception.WebCustomException; import com.inspur.edp.web.common.environment.ExecuteEnvironment; import com.inspur.edp.web.npmpackage.api.entity.NpmPackageResponse; import com.inspur.edp.web.npmpackage.core.npminstall.NpmInstallManager; @@ -39,7 +40,7 @@ public class NpmInstallBeforeGenerate { } if (packageResponse != null && !packageResponse.isSuccess()) { - throw new RuntimeException(packageResponse.getErrorMessage()); + throw new WebCustomException(packageResponse.getErrorMessage()); } } } diff --git a/web-form-jitengine/src/main/java/com/inspur/edp/web/jitengine/constant/I18nExceptionConstant.java b/web-form-jitengine/src/main/java/com/inspur/edp/web/jitengine/constant/I18nExceptionConstant.java new file mode 100644 index 0000000000000000000000000000000000000000..66e39bdc86e7a61bafb2de55a7693b2e05b88ce1 --- /dev/null +++ b/web-form-jitengine/src/main/java/com/inspur/edp/web/jitengine/constant/I18nExceptionConstant.java @@ -0,0 +1,5 @@ +package com.inspur.edp.web.jitengine.constant; + +public class I18nExceptionConstant { + public final static String WEB_JIT_ENGINE_ERROR_0001 = "WEB_JIT_ENGINE_ERROR_0001"; +} diff --git a/web-form-jitengine/src/main/java/com/inspur/edp/web/jitengine/constant/I18nMsgConstant.java b/web-form-jitengine/src/main/java/com/inspur/edp/web/jitengine/constant/I18nMsgConstant.java new file mode 100644 index 0000000000000000000000000000000000000000..1a14f3f4e81f2c9dabc3f2e4d1a0b2a2affa8484 --- /dev/null +++ b/web-form-jitengine/src/main/java/com/inspur/edp/web/jitengine/constant/I18nMsgConstant.java @@ -0,0 +1,8 @@ +package com.inspur.edp.web.jitengine.constant; + +public class I18nMsgConstant { + public final static String WEB_JIT_ENGINE_MSG_0001 = "WEB_JIT_ENGINE_MSG_0001"; + public final static String WEB_JIT_ENGINE_MSG_0002 = "WEB_JIT_ENGINE_MSG_0002"; + public final static String WEB_JIT_ENGINE_MSG_0003 = "WEB_JIT_ENGINE_MSG_0003"; + +} diff --git a/web-form-jitengine/src/main/java/com/inspur/edp/web/jitengine/expressions/ExpressionFormGenerator.java b/web-form-jitengine/src/main/java/com/inspur/edp/web/jitengine/expressions/ExpressionFormGenerator.java index 3e089fdd98483452007c8e09f901e40cd22d6769..03470fed9a0dc1adaa265ed62b54bcaaa18fd4dd 100644 --- a/web-form-jitengine/src/main/java/com/inspur/edp/web/jitengine/expressions/ExpressionFormGenerator.java +++ b/web-form-jitengine/src/main/java/com/inspur/edp/web/jitengine/expressions/ExpressionFormGenerator.java @@ -74,6 +74,27 @@ public class ExpressionFormGenerator { ModuleFormExpressionFieldItem moduleFormExpressionFieldItem = new ModuleFormExpressionFieldItem(); moduleFormExpressionFieldItem.setFieldId(item.getFieldId()); moduleFormExpressionFieldItem.setSourceType("Field"); + if ("Button".equals(item.getSourceType())) { + moduleFormExpressionFieldItem.setFieldCode(item.getFieldId()); + moduleFormExpressionFieldItem.setFieldLabel(item.getFieldId()); + moduleFormExpressionFieldItem.setSourceType(item.getSourceType()); + if (fieldExpressionList != null && fieldExpressionList.size() > 0) { + for (ModuleExpressionStatement fieldExpressionItem : fieldExpressionList) { + String fieldExpressionType = fieldExpressionItem.getType(); + String expressionValue = fieldExpressionItem.getValue(); + ModuleExpressionStatement moduleExpressionStatement = new ModuleExpressionStatement(); + moduleExpressionStatement.setValue(expressionValue); + moduleExpressionStatement.setType(fieldExpressionType); + moduleExpressionStatement.setMessage(fieldExpressionItem.getMessage()); + moduleExpressionStatement.setMessageType(fieldExpressionItem.getMessageType()); + moduleExpressionStatement.setId(fieldExpressionItem.getId()); + moduleFormExpressionFieldItem.getExpression().add(moduleExpressionStatement); + } + // 追加 + moduleFormExpressions.getExpressions().add(moduleFormExpressionFieldItem); + } + continue; + } FieldInfo fieldInfo = ExpressionUtility.getFieldInfoById(item.getFieldId(), formDom); if (fieldInfo != null && fieldInfo.getSchemaFields() != null) { HashMap fieldInfoSchemaFields = (HashMap) fieldInfo.getSchemaFields(); @@ -105,7 +126,6 @@ public class ExpressionFormGenerator { } } } - } return moduleFormExpressions; diff --git a/web-form-metadata/libs/com.inspur.edp.formserver.viewmodel.jar b/web-form-metadata/libs/com.inspur.edp.formserver.viewmodel.jar new file mode 100644 index 0000000000000000000000000000000000000000..7b59bc93ae9d1421b0f246235d965d41a912e16e Binary files /dev/null and b/web-form-metadata/libs/com.inspur.edp.formserver.viewmodel.jar differ diff --git a/web-form-metadata/libs/com.inspur.edp.formserver.viewmodel.webapi.jar b/web-form-metadata/libs/com.inspur.edp.formserver.viewmodel.webapi.jar new file mode 100644 index 0000000000000000000000000000000000000000..6065a38047ce4dfb38978828ca140fd03b9e5307 Binary files /dev/null and b/web-form-metadata/libs/com.inspur.edp.formserver.viewmodel.webapi.jar differ diff --git a/web-form-metadata/libs/com.inspur.edp.formserver.vmmanager.jar b/web-form-metadata/libs/com.inspur.edp.formserver.vmmanager.jar new file mode 100644 index 0000000000000000000000000000000000000000..334ac1ac5c98d51f78534984b9a46bde5447ea43 Binary files /dev/null and b/web-form-metadata/libs/com.inspur.edp.formserver.vmmanager.jar differ diff --git a/web-form-metadata/libs/i18n-resource-api.jar b/web-form-metadata/libs/i18n-resource-api.jar new file mode 100644 index 0000000000000000000000000000000000000000..2b86226b9fbcd846a9c25eab9077789ac1ed7270 Binary files /dev/null and b/web-form-metadata/libs/i18n-resource-api.jar differ diff --git a/web-form-metadata/libs/install-3rd-lib.text b/web-form-metadata/libs/install-3rd-lib.text new file mode 100644 index 0000000000000000000000000000000000000000..cba2ef1500c4a3a106f6b22d430a515797261874 --- /dev/null +++ b/web-form-metadata/libs/install-3rd-lib.text @@ -0,0 +1,14 @@ +mvn install:install-file -Dfile=com.inspur.edp.formserver.vmmanager.jar -DgroupId=com.inspur.edp -DartifactId=view-object-manage -Dversion=0.1.1 -Dpackaging=jar + +mvn install:install-file -Dfile=com.inspur.edp.formserver.viewmodel.jar -DgroupId=com.inspur.edp -DartifactId=formserver-viewmodel -Dversion=0.2.16 -Dpackaging=jar + +mvn install:install-file -Dfile=runtime-customize-api.jar -DgroupId=com.inspur.edp -DartifactId=runtime-customize-api -Dversion=0.1.0 -Dpackaging=jar + + +mvn install:install-file -Dfile=view-object-api.jar -DgroupId=com.inspur.edp -DartifactId=view-object-api -Dversion=0.1.1 -Dpackaging=jar +mvn install:install-file -Dfile=view-object-model.jar -DgroupId=com.inspur.edp -DartifactId=view-object-model -Dversion=0.1.1 -Dpackaging=jar +mvn install:install-file -Dfile=runtime-customize-api.jar -DgroupId=com.inspur.edp -DartifactId=runtime-customize-api -Dversion=0.1.0 -Dpackaging=jar + +mvn install:install-file -Dfile=runtime-customize-form.jar -DgroupId=com.inspur.edp -DartifactId=runtime-customize-form -Dversion=0.1.1 -Dpackaging=jar + + diff --git a/web-form-metadata/libs/runtime-customize-api.jar b/web-form-metadata/libs/runtime-customize-api.jar new file mode 100644 index 0000000000000000000000000000000000000000..cfd4fee31bb3b5804c5fef99e0c7c8f1f5f10d4b Binary files /dev/null and b/web-form-metadata/libs/runtime-customize-api.jar differ diff --git a/web-form-metadata/libs/runtime-customize-core.jar b/web-form-metadata/libs/runtime-customize-core.jar new file mode 100644 index 0000000000000000000000000000000000000000..1674be2b54de015361bdbe71dac05b3eea39af8a Binary files /dev/null and b/web-form-metadata/libs/runtime-customize-core.jar differ diff --git a/web-form-metadata/libs/runtime-customize-form.jar b/web-form-metadata/libs/runtime-customize-form.jar new file mode 100644 index 0000000000000000000000000000000000000000..840bd6e45340844483fa1176e53f70f772457a88 Binary files /dev/null and b/web-form-metadata/libs/runtime-customize-form.jar differ diff --git a/web-form-metadata/libs/view-object-api.jar b/web-form-metadata/libs/view-object-api.jar new file mode 100644 index 0000000000000000000000000000000000000000..a254c6996a0c38a760fa3b0fe7613af3a4e2532d Binary files /dev/null and b/web-form-metadata/libs/view-object-api.jar differ diff --git a/web-form-metadata/pom.xml b/web-form-metadata/pom.xml index 86706e60b74db878bd51acfd79d218db20899f33..f33d86091910499bd2c69f949f10a83feb8b0b29 100644 --- a/web-form-metadata/pom.xml +++ b/web-form-metadata/pom.xml @@ -21,7 +21,7 @@ web com.inspur.edp - ${custom.version} + 0.1.9-SNAPSHOT 4.0.0 @@ -96,6 +96,35 @@ caf-boot-core-context compile + + com.inspur.edp + view-object-model + 0.1.1 + + + com.inspur.edp + view-object-manager + 0.1.1 + + + com.inspur.edp + wf-bizprocess-api + 0.3.2 + + + com.inspur.edp + runtime-customize-api + + + com.inspur.edp + view-object-api + 0.1.1 + + + com.inspur.edp + runtime-customize-form + 0.1.1 + diff --git a/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/constant/I18nExceptionConstant.java b/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/constant/I18nExceptionConstant.java new file mode 100644 index 0000000000000000000000000000000000000000..92789893f5aa2afb785ecccfe17deba07aa93898 --- /dev/null +++ b/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/constant/I18nExceptionConstant.java @@ -0,0 +1,28 @@ +package com.inspur.edp.web.formmetadata.constant; + +public class I18nExceptionConstant { + public final static String WEB_FORM_METADATA_ERROR_0001 = "WEB_FORM_METADATA_ERROR_0001"; + public final static String WEB_FORM_METADATA_ERROR_0002 = "WEB_FORM_METADATA_ERROR_0002"; + public final static String WEB_FORM_METADATA_ERROR_0003 = "WEB_FORM_METADATA_ERROR_0003"; + public final static String WEB_FORM_METADATA_ERROR_0004 = "WEB_FORM_METADATA_ERROR_0004"; + public final static String WEB_FORM_METADATA_ERROR_0005 = "WEB_FORM_METADATA_ERROR_0005"; + public final static String WEB_FORM_METADATA_ERROR_0006 = "WEB_FORM_METADATA_ERROR_0006"; + public final static String WEB_FORM_METADATA_ERROR_0007 = "WEB_FORM_METADATA_ERROR_0007"; + public final static String WEB_FORM_METADATA_ERROR_0008 = "WEB_FORM_METADATA_ERROR_0008"; + public final static String WEB_FORM_METADATA_ERROR_0009 = "WEB_FORM_METADATA_ERROR_0009"; + public final static String WEB_FORM_METADATA_ERROR_0010 = "WEB_FORM_METADATA_ERROR_0010"; + public final static String WEB_FORM_METADATA_ERROR_0011 = "WEB_FORM_METADATA_ERROR_0011"; + public final static String WEB_FORM_METADATA_ERROR_0012 = "WEB_FORM_METADATA_ERROR_0012"; + public final static String WEB_FORM_METADATA_ERROR_0013 = "WEB_FORM_METADATA_ERROR_0013"; + public final static String WEB_FORM_METADATA_ERROR_0014 = "WEB_FORM_METADATA_ERROR_0014"; + public final static String WEB_FORM_METADATA_ERROR_0015 = "WEB_FORM_METADATA_ERROR_0015"; + public final static String WEB_FORM_METADATA_ERROR_0016 = "WEB_FORM_METADATA_ERROR_0016"; + public final static String WEB_FORM_METADATA_ERROR_0017 = "WEB_FORM_METADATA_ERROR_0017"; + public final static String WEB_FORM_METADATA_ERROR_0018 = "WEB_FORM_METADATA_ERROR_0018"; + public final static String WEB_FORM_METADATA_ERROR_0019 = "WEB_FORM_METADATA_ERROR_0019"; + public final static String WEB_FORM_METADATA_ERROR_0020 = "WEB_FORM_METADATA_ERROR_0020"; + public final static String WEB_FORM_METADATA_ERROR_0021 = "WEB_FORM_METADATA_ERROR_0021"; + public final static String WEB_FORM_METADATA_ERROR_0022 = "WEB_FORM_METADATA_ERROR_0022"; + public final static String WEB_FORM_METADATA_ERROR_0023 = "WEB_FORM_METADATA_ERROR_0023"; + public final static String WEB_FORM_METADATA_ERROR_0024 = "WEB_FORM_METADATA_ERROR_0024"; +} diff --git a/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/constant/I18nMsgConstant.java b/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/constant/I18nMsgConstant.java new file mode 100644 index 0000000000000000000000000000000000000000..3ff18857d4add403c1459a4b5fe58d39b9cf2417 --- /dev/null +++ b/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/constant/I18nMsgConstant.java @@ -0,0 +1,15 @@ +package com.inspur.edp.web.formmetadata.constant; + +public class I18nMsgConstant { + public final static String WEB_FORM_METADATA_MSG_0001 = "WEB_FORM_METADATA_MSG_0001"; + public final static String WEB_FORM_METADATA_MSG_0002 = "WEB_FORM_METADATA_MSG_0002"; + public final static String WEB_FORM_METADATA_MSG_0003 = "WEB_FORM_METADATA_MSG_0003"; + public final static String WEB_FORM_METADATA_MSG_0004 = "WEB_FORM_METADATA_MSG_0004"; + public final static String WEB_FORM_METADATA_MSG_0005 = "WEB_FORM_METADATA_MSG_0005"; + public final static String WEB_FORM_METADATA_MSG_0006 = "WEB_FORM_METADATA_MSG_0006"; + public final static String WEB_FORM_METADATA_MSG_0007 = "WEB_FORM_METADATA_MSG_0007"; + public final static String WEB_FORM_METADATA_MSG_0008 = "WEB_FORM_METADATA_MSG_0008"; + public final static String WEB_FORM_METADATA_MSG_0009 = "WEB_FORM_METADATA_MSG_0009"; + public final static String WEB_FORM_METADATA_MSG_0010 = "WEB_FORM_METADATA_MSG_0010"; + +} diff --git a/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/event/FormMetadataSaveEventListener.java b/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/event/FormMetadataSaveEventListener.java index f7f513c4d98b0b4b7adc09f462aac7f3c0a97b6c..4cfa0d09665e3017491db839a93dbdeac4d8c922 100644 --- a/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/event/FormMetadataSaveEventListener.java +++ b/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/event/FormMetadataSaveEventListener.java @@ -16,6 +16,7 @@ package com.inspur.edp.web.formmetadata.event; +import com.fasterxml.jackson.databind.JsonNode; import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; import com.inspur.edp.lcm.metadata.api.service.MetadataProjectService; @@ -29,9 +30,11 @@ import com.inspur.edp.web.common.metadata.MetadataTypeEnum; import com.inspur.edp.web.common.metadata.MetadataUtility; import com.inspur.edp.web.common.serialize.SerializeUtility; import com.inspur.edp.web.formmetadata.entity.ResourceMetadataType; +import com.inspur.edp.web.formmetadata.formformat.FormFormatHandler; import com.inspur.edp.web.formmetadata.metadata.FormMetadataContent; import com.inspur.edp.web.formmetadata.metadata.formdom.FormDOM; import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import org.apache.commons.lang3.StringUtils; import java.io.File; import java.util.ArrayList; @@ -52,7 +55,7 @@ public class FormMetadataSaveEventListener implements MetadataEventListener { */ @Override public void fireMetadataSavingEvent(MetadataEventArgs metadataEventArgs) { - + publishFormFormat(metadataEventArgs); } /** @@ -60,8 +63,41 @@ public class FormMetadataSaveEventListener implements MetadataEventListener { */ @Override public void fireMetadataSavedEvent(MetadataEventArgs metadataEventArgs) { + } - + private static void publishFormFormat(MetadataEventArgs metadataEventArgs) { + GspMetadata metadata = metadataEventArgs.getMetadata(); + // 判断是否为表单元数据 + String type = metadata.getHeader().getType(); + if ("Form".equals(type) || "MobileForm".equals(type)) { + FormMetadataContent formMetadataContent = (FormMetadataContent) metadata.getContent(); + JsonNode content = formMetadataContent.getContents(); + JsonNode formRulePushModeNode = content.at("/options/formRulePushMode"); + String formRulePushMode = ""; + if (formRulePushModeNode != null) { + formRulePushMode = formRulePushModeNode.textValue(); + } + if (formRulePushMode == null|| StringUtils.isBlank(formRulePushMode) || "pushToWF".equals(formRulePushMode)) { + return; + } + JsonNode webCmdNode = content.at("/module/webcmds"); + FormFormatHandler handler = FormFormatHandler.getFormFormatHandler(type); + if (webCmdNode != null) { + for (JsonNode cmd : webCmdNode) { + JsonNode idNode = cmd.get("id"); + if (idNode != null) { + String id = idNode.asText(); + if ("a7cb7d01-9df1-4a32-8202-99c9d0f4c339".equals(id)) { + // pc推送表单格式 + handler.pushFormFormat(metadata, "pf", metadataEventArgs.getPath()); + }else if ("91cc23fb-2ecf-418b-9700-99469eab2e84".equals(id)) { + // 移动推送表单格式 + handler.pushFormFormat(metadata, "pf", metadataEventArgs.getPath()); + } + } + } + } + } } diff --git a/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/event/WebCommandMetadataDelete.java b/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/event/WebCommandMetadataDelete.java index 72b2683ceb545a88ac3b519549c50bcfd3980e5c..bed87d89c268fc08c1191a9bc5722ff99f7920b2 100644 --- a/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/event/WebCommandMetadataDelete.java +++ b/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/event/WebCommandMetadataDelete.java @@ -26,7 +26,10 @@ import com.inspur.edp.web.common.logger.WebLogger; import com.inspur.edp.web.common.metadata.MetadataGetterParameter; import com.inspur.edp.web.common.metadata.MetadataTypeEnum; import com.inspur.edp.web.common.metadata.MetadataUtility; +import com.inspur.edp.web.common.utility.ResourceLocalizeUtil; import com.inspur.edp.web.common.utility.StringUtility; +import com.inspur.edp.web.formmetadata.constant.I18nExceptionConstant; +import com.inspur.edp.web.formmetadata.constant.I18nMsgConstant; import com.inspur.edp.web.formmetadata.metadata.formdom.FormDOM; import java.util.*; @@ -106,7 +109,7 @@ class WebCommandMetadataDelete { projectCmpList.put(cmpMetadata.getId(), cmpMetadata); } } catch (Exception ex) { - throw new Exception("获取command元数据" + cmpMetadata.getId() + "失败", ex); + throw new WebCustomException(I18nExceptionConstant.WEB_FORM_METADATA_ERROR_0001, new String[]{cmpMetadata.getId()}, ex); } } else { cmpMetadata = projectCmpList.get(((CmpMethodRefering) item).getComponentId()); @@ -127,7 +130,7 @@ class WebCommandMetadataDelete { private WebCommandsMetadata getWebCommands(String id) { MetadataGetterParameter metadataGetterParameter = MetadataGetterParameter.getNewInstance(id, null, MetadataTypeEnum.Command); - metadataGetterParameter.setTargetMetadataNotFoundMessage("获取命令元数据为空,对应元数据id为:" + id); + metadataGetterParameter.setTargetMetadataNotFoundMessage(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_FORM_METADATA_MSG_0001, id)); GspMetadata webCommandMetadata = MetadataUtility.getInstance().getMetadataWithDesign(metadataGetterParameter); if (webCommandMetadata == null) { return null; @@ -137,7 +140,7 @@ class WebCommandMetadataDelete { public WebComponentMetadata getComponentMetadata(String id) { MetadataGetterParameter metadataGetterParameter = MetadataGetterParameter.getNewInstance(id, null, MetadataTypeEnum.Component); - metadataGetterParameter.setTargetMetadataNotFoundMessage("获取WebComponent元数据为空,对应元数据id为:" + id); + metadataGetterParameter.setTargetMetadataNotFoundMessage(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_FORM_METADATA_MSG_0002, id)); GspMetadata webComponentMetadata = MetadataUtility.getInstance().getMetadataWithDesign(metadataGetterParameter); if (webComponentMetadata == null) { throw new WebCustomException("load webComponent metadata is null,the metaDataId is " + id); @@ -236,11 +239,12 @@ class WebCommandMetadataDelete { // 最理想的方式:路径来自webcmp构件路径,名称来自path(即元数据的Source属性) // 先用webcmp的文件名构造,后续可以考虑调整 if (cmpId == null || cmpId.isEmpty()) { - throw new Exception("获取ts文件名出错,对应的web构件id不能为空。"); + throw new WebCustomException(I18nExceptionConstant.WEB_FORM_METADATA_ERROR_0002); } MetadataGetterParameter metadataGetterParameter = MetadataGetterParameter.getNewInstance(cmpId, null, MetadataTypeEnum.TS); - metadataGetterParameter.setTargetMetadataNotFoundMessage("获取web构件元数据为空,对应元数据id为:" + cmpId); + + metadataGetterParameter.setTargetMetadataNotFoundMessage(ResourceLocalizeUtil.getString(I18nMsgConstant.WEB_FORM_METADATA_MSG_0003, cmpId)); GspMetadata metadata = MetadataUtility.getInstance().getMetadataWithDesign(metadataGetterParameter); if (metadata != null) { @@ -254,7 +258,7 @@ class WebCommandMetadataDelete { } else if (cmpFileName.contains(metadata.getHeader().getCode())) { fileName = cmpFileName; } else { - throw new Exception("获取ts文件名出错,web构件上获取的文件名不对。"); + throw new WebCustomException(I18nExceptionConstant.WEB_FORM_METADATA_ERROR_0003); } return path + "/" + fileName + ".ts"; diff --git a/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/formformat/FormFormatHandler.java b/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/formformat/FormFormatHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..0dabb44cfa53cd10c3c1df4787976a45ce38c248 --- /dev/null +++ b/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/formformat/FormFormatHandler.java @@ -0,0 +1,40 @@ +package com.inspur.edp.web.formmetadata.formformat; + +import com.fasterxml.jackson.databind.JsonNode; +import com.inspur.edp.formserver.viewmodel.formentity.ButtonGroup; +import com.inspur.edp.formserver.viewmodel.formentity.ObjectData; +import com.inspur.edp.formserver.viewmodel.formentity.VoFormModel; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.metadata.rtcustomization.api.entity.DimensionExtendEntity; +import com.inspur.edp.web.formmetadata.formformat.handler.WFFormFormatMobileHandler; +import com.inspur.edp.web.formmetadata.formformat.handler.WFFormFormatPcHandler; + +import java.util.List; + +/** + * 表单格式化处理handler + * + */ +public abstract class FormFormatHandler { + + public abstract String getFormType(); +// public abstract List getDefaultUrlParams(); + public abstract List getButtons(JsonNode formContent); + public abstract ObjectData getObjectData(JsonNode formContent); + + public abstract VoFormModel getVoFormModel(GspMetadata formMetadata, String formatType, String basePath); + +// public abstract List getAttachmentGroups(JsonNode formContent); + + public abstract void pushFormFormat(GspMetadata formMetadata, String formatType, String formPath); + + public abstract void pushRtcFormFormat(GspMetadata formMetadata, String formatType, DimensionExtendEntity dimension); + + public static FormFormatHandler getFormFormatHandler(String formType) { + if ("Form".equals(formType)) { + return new WFFormFormatPcHandler(); + } else { + return new WFFormFormatMobileHandler(); + } + } +} diff --git a/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/formformat/handler/WFFormFormatMobileHandler.java b/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/formformat/handler/WFFormFormatMobileHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..f9d2170e0f28f7956b56b480ceec9a060d6b9097 --- /dev/null +++ b/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/formformat/handler/WFFormFormatMobileHandler.java @@ -0,0 +1,718 @@ +package com.inspur.edp.web.formmetadata.formformat.handler; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.inspur.edp.customize.form.api.RuntimeCheckVoFormVariableService; +import com.inspur.edp.customize.service.VoRuntimeBuildFormFormatService; +import com.inspur.edp.formserver.viewmodel.formentity.*; +import com.inspur.edp.formserver.vmapi.formconfig.VoBuildFormFormatService; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspProject; +import com.inspur.edp.lcm.metadata.api.entity.MetadataHeader; +import com.inspur.edp.lcm.metadata.api.service.MetadataProjectService; +import com.inspur.edp.lcm.metadata.api.service.MetadataService; +import com.inspur.edp.metadata.rtcustomization.api.entity.DimensionExtendEntity; +import com.inspur.edp.web.formmetadata.formformat.FormFormatHandler; +import com.inspur.edp.web.formmetadata.metadata.FormMetadataContent; +import io.iec.edp.caf.businessobject.api.entity.DevBasicBoInfo; +import io.iec.edp.caf.businessobject.api.service.DevBasicInfoService; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import org.apache.commons.lang3.StringUtils; + +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.*; +import com.inspur.edp.formserver.viewmodel.formentity.ButtonGroup; +import com.inspur.edp.formserver.viewmodel.formentity.ObjectData; +import com.inspur.edp.formserver.viewmodel.formentity.VoFormModel; + +import java.util.List; + + +/** + * 向vo推送按钮、字段、命令,用于权限控制 + */ +public class WFFormFormatMobileHandler extends FormFormatHandler { + + private final List controlsWithButton = Arrays.asList("ListView","Button","ButtonGroup","Card","Section"); + + /** + * 表单类型 + * @return + */ + @Override + public String getFormType() { + return "Mobile"; + } + + @Override + public void pushFormFormat(GspMetadata formMetadata, String formatType, String formPath) { + MetadataProjectService projectService = SpringBeanUtils.getBean(MetadataProjectService.class); + Path path = Paths.get(formPath); + Path parentPath = path.getParent(); + String formPathExcludeFileName = parentPath != null ? parentPath.toString() : ""; + String projectPath = projectService.getProjPath(formPathExcludeFileName); + VoBuildFormFormatService formFormatService = SpringBeanUtils.getBean(VoBuildFormFormatService.class); + FormMetadataContent formContents = (FormMetadataContent) formMetadata.getContent(); + JsonNode content = formContents.getContents(); + String voId = content.at("/module/schemas/0/id").textValue(); + formFormatService.buildFormFormat(getVoFormModel(formMetadata, formatType, projectPath), voId, formMetadata.getHeader().getBizobjectID()); + } + + @Override + public void pushRtcFormFormat(GspMetadata formMetadata, String formatType, DimensionExtendEntity dimension) { + FormMetadataContent formContents = (FormMetadataContent) formMetadata.getContent(); + JsonNode content = formContents.getContents(); + String voId = content.at("/module/schemas/0/id").textValue(); + RuntimeCheckVoFormVariableService runtimeCheckVoFormVariableService = SpringBeanUtils.getBean(RuntimeCheckVoFormVariableService.class); + boolean isPushRtcForm = runtimeCheckVoFormVariableService.checkVoFormVariable(voId); + if (!isPushRtcForm) { + return; + } + VoRuntimeBuildFormFormatService voRuntimeBuildFormFormatService = SpringBeanUtils.getBean(VoRuntimeBuildFormFormatService.class); + + VoFormModel voFormModel = getVoFormModel(formMetadata, formatType, null); + String dim1 = StringUtils.isNotBlank(dimension.getFirstDimension())?dimension.getFirstDimension():"public"; + String dim2 = StringUtils.isNotBlank(dimension.getSecondDimension())?dimension.getSecondDimension():"public"; + + generateParameters(voFormModel.getUrlParameters(), "dim1", "维度一", dim1); + generateParameters(voFormModel.getUrlParameters(), "dim2", "维度二", dim2); + generateParameters(voFormModel.getUrlParameters(), "metadataId", "元数据id", dimension.getBasicMetadataId()); + + voRuntimeBuildFormFormatService.buildFormFormat(voFormModel, dimension, voId, formMetadata.getHeader().getBizobjectID()); + } + + /** + * 获取表单模型 + * @param formMetadata + * @param formatType + * @return + */ + @Override + public VoFormModel getVoFormModel(GspMetadata formMetadata, String formatType, String basePath) { + VoFormModel voFormModel = new VoFormModel(); + MetadataHeader header = formMetadata.getHeader(); + FormMetadataContent formContents = (FormMetadataContent) formMetadata.getContent(); + + JsonNode content = formContents.getContents(); + String voId = content.at("/module/schemas/0/id").textValue(); + voFormModel.setId(header.getId()); + voFormModel.setCode(header.getCode()); + voFormModel.setName(header.getName()); + voFormModel.setTerminal(getFormType()); + voFormModel.setFormatType(formatType); + voFormModel.setObjectAuthInfo(this.getObjectData(content)); + voFormModel.setMethods(this.getMethods(content)); + voFormModel.setButtonGroup(this.getButtons(content)); + //voFormModel.setAttachmentGroup(getAttachmentGroups(content)); +// voFormModel.setBizcategory(header.getBizobjectID()); +// voFormModel.setRefId(voId); + voFormModel.setProjectPath(basePath); + generateFormFormat(voFormModel, formMetadata, basePath); + + + return voFormModel; + } + +// @Override +// public List getAttachmentGroups(JsonNode formContent) { +// // 获取component中字段信息 +// JsonNode components = formContent.at("/module/components"); +// List attachmentGroups = new ArrayList<>(); +// extractAttachment(null, components, attachmentGroups); +// return attachmentGroups; +// } + + /** + * 获取实体信息 + * @param formContent + * @return + */ + @Override + public ObjectData getObjectData(JsonNode formContent) { + // 1.提取viewmodel中的字段 + JsonNode viewModels = formContent.at("/module/viewmodels"); + List fieldIds = new ArrayList<>(); + viewModels.forEach(viewModel -> { + JsonNode fields = viewModel.get("fields"); + if (fields != null && !fields.isEmpty()) { + fieldIds.addAll(fields.findValuesAsText("id")); + } + }); + JsonNode schema = formContent.at("/module/schemas/0"); + if (schema == null || schema.isEmpty()) { + return null; + } + + // 2.获取component中字段信息 + JsonNode components = formContent.at("/module/components"); + Map fieldMap = new HashMap<>(); + extractComponents(components, fieldMap, fieldIds); + + // 3.构件实体树 + JsonNode mainEntity = schema.at("/entities/0"); + ObjectData root = new ObjectData(); + extractEntities(mainEntity, root, fieldMap); + return root; + } + + + + + /** + * 提取按钮 + * @param formContent 表单内容 + * @return 按钮信息 + */ + @Override + public List getButtons(JsonNode formContent){ + // 递归找Button + JsonNode componentArr = formContent.at("/module/components"); + JsonNode viewmodelArr = formContent.at("/module/viewmodels"); + + List buttonGroupList = new ArrayList<>(); + List cardPageviewModelIdList = new ArrayList<>(); + + componentArr.forEach(component->{ + String componentType = getValue(component,"componentType",null); + String pageType = getValue(component,"pageType",null); + String viewModelId = getValue(component,"viewModel",null); + + //找到卡片页面的视图模型 + if( "Page".equals(componentType) && "Card".equals(pageType) && StringUtils.isNotBlank(viewModelId)){ + cardPageviewModelIdList.add(viewModelId); + } + }); + + for(JsonNode component :componentArr){ + String viewModelId = getValue(component,"viewModel",null); + JsonNode parentViewModel = findParentViewModelId( viewmodelArr, viewModelId); + + //只提取卡片页面及其子组件 + if( cardPageviewModelIdList.contains(getValue(parentViewModel,"id",null))){ + searchComponentsForButton(component, buttonGroupList); + } + } + + return buttonGroupList; + } + + private JsonNode findParentViewModelId(JsonNode viewmodelArr,String curViewmodelId){ + JsonNode result = null; + if(StringUtils.isNotBlank(curViewmodelId) ){ + for(JsonNode viewmodel :viewmodelArr){ + if(curViewmodelId.equals(getValue(viewmodel,"id",null))){ + result = viewmodel; + String parentViewModelId = getValue(viewmodel,"parent",null); + if(StringUtils.isNotBlank(parentViewModelId)){ + JsonNode parentViewModel = findParentViewModelId( viewmodelArr, parentViewModelId); + if(parentViewModel != null ){ + result = parentViewModel; + + } + } + break; + } + } + } + return result; + } + + /** + * 提取方法 + * @param formContent + * @return + */ + public List getMethods(JsonNode formContent) { + // 1.遍历页面组件 + JsonNode componentArr = formContent.at("/module/components"); + String cardViewModelId = null; + for(JsonNode component:componentArr){ + String componentType = getValue(component,"componentType",null); + String pageType = getValue(component,"pageType",null); + + //找到卡片页面 + if( "Page".equals(componentType) && "Card".equals(pageType)){ + cardViewModelId = getValue(component,"viewModel",""); + break; + } + + } + + List methodGroupList = new ArrayList<>(); + if(StringUtils.isNotBlank(cardViewModelId)){ + JsonNode viewModelArr = formContent.at("/module/viewmodels"); + //2.遍历视图模型 + for(JsonNode viewModel:viewModelArr){ + String viewModelId = getValue(viewModel,"id",null); + if(StringUtils.isNotBlank(viewModelId) && cardViewModelId.equals(viewModelId)){ + JsonNode commands = viewModel.get("commands"); + //3.遍历命令 + if(commands != null && commands.size() > 0){ + commands.forEach(command->{ + MethodGroup methodGroup = new MethodGroup(); + methodGroup.setId(getValue(command,"id",null)); + methodGroup.setMethodCode(getValue(command,"code",null)); + methodGroup.setMethodName(getValue(command,"name",null)); + //4.遍历命令参数 + JsonNode params = command.get("params"); + if(params != null && params.size() > 0){ + List methodParamList = new ArrayList<>(); + params.forEach(param->{ + MethodParam methodParam = new MethodParam(); + methodParam.setCode(getValue(param,"name",null)); + methodParam.setName(getValue(param,"shownName",null)); + methodParam.setValue(null); + methodParamList.add(methodParam); + + }); + methodGroup.setMethodParam(methodParamList); + } + methodGroupList.add(methodGroup); + + }); + + } + } + } + } + return methodGroupList; + } + + + /** + * 查找带按钮的组件 + * @param root 页面组件 + * @param buttonGroupList 按钮组列表 + */ + private void searchComponentsForButton(JsonNode root, List buttonGroupList) { + if(root.isArray()) { + for (JsonNode jsonNode : root) { + searchComponentsForButton(jsonNode, buttonGroupList); + } + } + if(root.isObject()){ + JsonNode type = root.get("type"); + if(type != null && controlsWithButton.contains(type.asText())){ + this.findButtons(root, buttonGroupList); + }else { + Iterator fieldNames = root.fieldNames(); + while(fieldNames.hasNext()) { + String fieldName = fieldNames.next(); + JsonNode fieldValue = root.get(fieldName); + if(fieldValue.isArray() || fieldValue.isObject()){ + searchComponentsForButton(fieldValue, buttonGroupList); + } + } + } + } + } + + /** + * 查找控件中按钮 + * @param node 组件节点 + * @param buttonGroupList 按钮组列表 + */ + private void findButtons(JsonNode node,List buttonGroupList){ + String type = node.get("type").asText(); + switch (type){ + case "NavigationBar":{ + JsonNode toolbar = node.get("toolbar"); + if(null == toolbar){ + break; + } + ArrayNode items = (ArrayNode) toolbar.get("items"); + if(items !=null && items.size() > 0 ){ + this.findComplexButtons( items, node , buttonGroupList); + } + break; + } + case "ListView":{ + //删除 + JsonNode swipeToolbar = node.get("swipeToolbar"); + if(swipeToolbar != null){ + ArrayNode items = (ArrayNode) swipeToolbar.get("items"); + if(items != null && items.size() > 0 ){ + this.findComplexButtons( items, node , buttonGroupList); + } + } + + //多选 + JsonNode toolbar = node.get("toolbar"); + if(toolbar != null){ + ArrayNode items = (ArrayNode) toolbar.get("items"); + if(items != null && items.size() > 0 ){ + this.findComplexButtons( items, node , buttonGroupList); + } + } + break; + } + case "Button":{ + findSingleButton(node, buttonGroupList); + break; + } + case "ButtonGroup":{ + ArrayNode items = (ArrayNode) node.get("items"); + if(items != null && items.size() > 0 ){ + this.findComplexButtons( items, node , buttonGroupList); + } + break; + } + case "Card":{ + ArrayNode items = (ArrayNode) node.get("actions"); + if(items != null && items.size() > 0 ){ + this.findComplexButtons( items, node , buttonGroupList); + } + break; + } + case "Section":{ + JsonNode footerToolbar = node.get("footerToolbar"); + if(null == footerToolbar){ + break; + } + ArrayNode items = (ArrayNode) footerToolbar.get("items"); + if(items !=null && items.size() > 0 ){ + this.findComplexButtons( items, node , buttonGroupList); + } + break; + } + } + } + + /** + * 查找简单按钮 + * @param node 组件节点 + * @param buttonGroupList 按钮组列表 + */ + private void findSingleButton(JsonNode node, List buttonGroupList) { + // 1.创建按钮组。button 当前没有分组信息,用方法名暂时做分组名 + ButtonGroup buttonGroup = new ButtonGroup(); + buttonGroup.setId(UUID.randomUUID().toString()); + buttonGroup.setCode(buttonGroup.getId()); + String name = "按钮"; + String id = ""; + if (node.get("id") != null) { + id = node.get("id").asText(); + } + name += "[" + id + "]"; + buttonGroup.setName(name); + + //3.创建按钮 + List configAbleAttrs = getConfigAbleAttrs(node); + if (!configAbleAttrs.isEmpty()) { + Button button = new Button(); + button.setId(node.get("id").asText()); + button.setCode(node.get("id").asText()); + button.setType(node.get("type").asText()); + button.setName(getName(node,"按钮")); + + button.setConfigurableAttrs(configAbleAttrs); + buttonGroup.setButtons(Collections.singletonList(button)); + } + + buttonGroupList.add(buttonGroup); + } + + /** + * 查找复杂按钮 + * @param childNodes 按钮项 + * @param parentNode 按钮父级信息 + * @param buttonGroupList 按钮组列表 + */ + private void findComplexButtons(ArrayNode childNodes, JsonNode parentNode , List buttonGroupList){ + // 1.创建按钮组。button 当前没有分组信息,用方法名暂时做分组名 + ButtonGroup buttonGroup = new ButtonGroup(); + buttonGroup.setId(parentNode.get("id").asText()); + buttonGroup.setCode(parentNode.get("id").asText()); + String name= getName(parentNode,"按钮"); + String id = ""; + if (parentNode.get("id") != null) { + id = parentNode.get("id").asText(); + } + name += "[" + id + "]"; + buttonGroup.setName(name); + + List