From ded0f0e8022573e9ded3d7ab605cff531f66bb3a Mon Sep 17 00:00:00 2001 From: guozhiqi Date: Thu, 20 Jul 2023 13:48:55 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E8=B0=83=E6=95=B4ts-file=20=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LocalServerVersionManager.java | 10 +- .../service/ScriptCacheServiceImpl.java | 7 +- .../web/tsfile/core/TsFileWebServiceImpl.java | 5 +- .../core/config/TsFileConfiguration.java | 4 +- .../core/service/TsFileManagerService.java | 27 +++-- .../inspur/edp/web/common/CopyJarFile.java | 105 ++++++++++++------ 6 files changed, 104 insertions(+), 54 deletions(-) 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 151636ae..99c09bdb 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 @@ -42,6 +42,7 @@ import io.iec.edp.caf.commons.utils.SpringBeanUtils; import io.iec.edp.caf.databaseobject.api.service.IDatabaseObjectRtService; import io.iec.edp.caf.rpc.client.RpcClassHolder; +import javax.annotation.PostConstruct; import javax.annotation.Resource; import java.util.ArrayList; import java.util.List; @@ -59,7 +60,7 @@ public class LocalServerVersionManager { private static final String CurrentClassName = LocalServerVersionManager.class.getName(); - private final LocalServerVersionRpcService localServerVersionRpcService; + private LocalServerVersionRpcService localServerVersionRpcService; @Resource private ScriptCacheVersionManager scriptCacheVersionManagerInstance; @@ -67,9 +68,14 @@ public class LocalServerVersionManager { @Resource private RpcClassHolder rpcClassHolder; + @PostConstruct + private void init(){ + // 此参数不能通过构造函数获取 + this.localServerVersionRpcService = rpcClassHolder.getRpcClass("bcc", LocalServerVersionRpcService.class); + } public LocalServerVersionManager() { - this.localServerVersionRpcService = rpcClassHolder.getRpcClass("bcc", LocalServerVersionRpcService.class); + } 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 39760cfd..342b774e 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 @@ -30,6 +30,7 @@ import com.inspur.edp.web.jitruntimebuild.scriptcache.manager.CustomizationCache import com.inspur.edp.web.jitruntimebuild.scriptcache.manager.ScriptCacheVersionManager; import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import javax.annotation.Resource; import java.io.File; import java.util.ArrayList; @@ -41,13 +42,11 @@ import java.util.ArrayList; */ public class ScriptCacheServiceImpl implements ScriptCacheService { - private final ScriptCacheVersionManager scriptCacheVersionManager; + @Resource + private ScriptCacheVersionManager scriptCacheVersionManager; private static final String CurrentClassName = ScriptCacheServiceImpl.class.getName(); - public ScriptCacheServiceImpl() { - this.scriptCacheVersionManager = SpringBeanUtils.getBean(ScriptCacheVersionManager.class); - } /** * 发布文件目录下的脚本文件 如果发生变化 则更新对应的版本 diff --git a/tsfile/web-tsfile-core/src/main/java/com/inspur/edp/web/tsfile/core/TsFileWebServiceImpl.java b/tsfile/web-tsfile-core/src/main/java/com/inspur/edp/web/tsfile/core/TsFileWebServiceImpl.java index 7126efc3..99364832 100644 --- a/tsfile/web-tsfile-core/src/main/java/com/inspur/edp/web/tsfile/core/TsFileWebServiceImpl.java +++ b/tsfile/web-tsfile-core/src/main/java/com/inspur/edp/web/tsfile/core/TsFileWebServiceImpl.java @@ -33,9 +33,12 @@ import java.util.Map; */ public class TsFileWebServiceImpl implements TsFileWebService { - @Resource private TsFileManagerService tsFileManagerService; + public TsFileWebServiceImpl(TsFileManagerService tsFileManagerService) { + this.tsFileManagerService = tsFileManagerService; + } + @Override public Object loadTsFileContent(String path) { Map map = new HashMap<>(); diff --git a/tsfile/web-tsfile-core/src/main/java/com/inspur/edp/web/tsfile/core/config/TsFileConfiguration.java b/tsfile/web-tsfile-core/src/main/java/com/inspur/edp/web/tsfile/core/config/TsFileConfiguration.java index c2386bae..f56cf27c 100644 --- a/tsfile/web-tsfile-core/src/main/java/com/inspur/edp/web/tsfile/core/config/TsFileConfiguration.java +++ b/tsfile/web-tsfile-core/src/main/java/com/inspur/edp/web/tsfile/core/config/TsFileConfiguration.java @@ -43,7 +43,7 @@ public class TsFileConfiguration { } @Bean() - public RESTEndpoint tsFileWebapiEndPoint() { - return new RESTEndpoint("/dev/main/v1.0/tsfile", new TsFileWebServiceImpl()); + public RESTEndpoint tsFileWebapiEndPoint(TsFileManagerService tsFileManagerService) { + return new RESTEndpoint("/dev/main/v1.0/tsfile", new TsFileWebServiceImpl(tsFileManagerService)); } } diff --git a/tsfile/web-tsfile-core/src/main/java/com/inspur/edp/web/tsfile/core/service/TsFileManagerService.java b/tsfile/web-tsfile-core/src/main/java/com/inspur/edp/web/tsfile/core/service/TsFileManagerService.java index 6e8f9b0d..14ae62cb 100644 --- a/tsfile/web-tsfile-core/src/main/java/com/inspur/edp/web/tsfile/core/service/TsFileManagerService.java +++ b/tsfile/web-tsfile-core/src/main/java/com/inspur/edp/web/tsfile/core/service/TsFileManagerService.java @@ -18,7 +18,6 @@ package com.inspur.edp.web.tsfile.core.service; import com.inspur.edp.web.common.io.FileUtility; import com.inspur.edp.web.tsfile.api.service.TsFileService; -import io.iec.edp.caf.commons.utils.SpringBeanUtils; import javax.annotation.Resource; import java.util.List; @@ -31,54 +30,54 @@ public class TsFileManagerService { * 注入TsFileService */ @Resource - private TsFileService service; + private TsFileService tsFileService; public final void deleteTsFile(String fullPath) { - service.deleteTsFile(fullPath); + tsFileService.deleteTsFile(fullPath); } public final List getTsFileList(String path) { - return service.getTsFileList(path); + return tsFileService.getTsFileList(path); } public final boolean isTsFileExist(String path, String fileName) { String filePathAndName = FileUtility.combine(path, fileName); - return service.isTsFileExist(filePathAndName); + return tsFileService.isTsFileExist(filePathAndName); } public final boolean isTsFileExist(String fullPath) { - return service.isTsFileExist(fullPath); + return tsFileService.isTsFileExist(fullPath); } public final String loadTsFile(String fullPath) { - return service.loadTsFileContent(fullPath); + return tsFileService.loadTsFileContent(fullPath); } public final String loadTsFileByWebCmp(String formRelativePath, String webCmpId) { - return service.loadTsFileContentByWebCmp(formRelativePath, webCmpId); + return tsFileService.loadTsFileContentByWebCmp(formRelativePath, webCmpId); } public final void renameTsFile(String fullPath, String newName) { - service.renameTsFile(fullPath, newName); + tsFileService.renameTsFile(fullPath, newName); } public final void saveTsFile(String fullPath, String content) { - service.saveTsFile(fullPath, content); + tsFileService.saveTsFile(fullPath, content); } public final void createTypescriptFile(String fullPath) { - String normalized = service.getTsClassNameByPath(fullPath); + String normalized = tsFileService.getTsClassNameByPath(fullPath); String contentSB = "import { Injectable } from '@angular/core';" + "\r\n" + "\r\n@Injectable()" + "\r\n" + "export class " + normalized + " {" + "\r\n" + " constructor() {}" + "\r\n" + "}" + "\r\n"; - service.saveTsFile(fullPath, contentSB); + tsFileService.saveTsFile(fullPath, contentSB); } public final void createMobileTsFile(String fullPath) { - String normalized = service.getTsClassNameByPath(fullPath); + String normalized = tsFileService.getTsClassNameByPath(fullPath); String contentSB = "import { BaseDataService } from '@farris/mobile-command-services';\r\n" + "import { ViewModelContext} from '@farris/mobile-devkit';\r\n" + @@ -88,6 +87,6 @@ public class TsFileManagerService { " super(viewModelContext)\r\n" + " }\r\n" + "}\r\n"; - service.saveTsFile(fullPath, contentSB); + tsFileService.saveTsFile(fullPath, contentSB); } } diff --git a/web-common/src/test/java/com/inspur/edp/web/common/CopyJarFile.java b/web-common/src/test/java/com/inspur/edp/web/common/CopyJarFile.java index 2cd3d4a2..b4fea7cb 100644 --- a/web-common/src/test/java/com/inspur/edp/web/common/CopyJarFile.java +++ b/web-common/src/test/java/com/inspur/edp/web/common/CopyJarFile.java @@ -58,28 +58,71 @@ public class CopyJarFile { Model pomModel = getPom(projectPath); Map moduleMap = this.getModulePath(); - pomModel.getModules().forEach(moduleItem -> { - if (moduleMap.containsKey(moduleItem)) { - String moduleId = moduleMap.get(moduleItem).moduleId; - if (StringUtility.isNullOrEmpty(moduleId)) { - WebLogger.Instance.error("无法找到对应的moduleId" + moduleItem); - } else { - String modulePath = FileUtility.combine(projectPath, StringUtility.convertNullToEmptyString(moduleMap.get(moduleItem).moduleIdPath), moduleItem); - String moduleJarFilePath = FileUtility.combine(modulePath, "target", moduleId + "-" + version + ".jar"); - if (!new File(moduleJarFilePath).exists()) { - WebLogger.Instance.error("目标文件不存在," + moduleJarFilePath); - } else { - String targetJarPath = FileUtility.combine(baseTargetJarPath, moduleMap.get(moduleItem).getRelativePath()); - String targetJarFilePath = FileUtility.combine(targetJarPath, moduleId + ".jar"); - FileUtility.copyFile(moduleJarFilePath, targetJarFilePath, true); - } - } - } + pomModel.getModules().forEach((moduleItem) -> { + copyWithSpecificModule(projectPath, version, baseTargetJarPath, moduleMap, moduleItem); + + + }); + + Model appConfigPomModel = getPom(FileUtility.combine(projectPath, "appconfig")); + appConfigPomModel.getModules().forEach((moduleItem) -> { + copyWithSpecificModule(projectPath, version, baseTargetJarPath, moduleMap, moduleItem); + }); + Model approvalFormatPomModel = getPom(FileUtility.combine(projectPath, "approval-format")); + approvalFormatPomModel.getModules().forEach((moduleItem) -> { + copyWithSpecificModule(projectPath, version, baseTargetJarPath, moduleMap, moduleItem); + }); + + Model formProcessPomModel = getPom(FileUtility.combine(projectPath, "form-process")); + formProcessPomModel.getModules().forEach((moduleItem) -> { + copyWithSpecificModule(projectPath, version, baseTargetJarPath, moduleMap, moduleItem); + }); + Model metadataPomModel = getPom(FileUtility.combine(projectPath, "metadata")); + metadataPomModel.getModules().forEach((moduleItem) -> { + copyWithSpecificModule(projectPath, version, baseTargetJarPath, moduleMap, moduleItem); }); + Model npmPackagePomModel = getPom(FileUtility.combine(projectPath, "npmpackage")); + npmPackagePomModel.getModules().forEach((moduleItem) -> { + copyWithSpecificModule(projectPath, version, baseTargetJarPath, moduleMap, moduleItem); + }); + Model runtimePomModel = getPom(FileUtility.combine(projectPath, "runtime")); + runtimePomModel.getModules().forEach((moduleItem) -> { + copyWithSpecificModule(projectPath, version, baseTargetJarPath, moduleMap, moduleItem); + }); + + Model scriptcachePomModel = getPom(FileUtility.combine(projectPath, "scriptcache")); + scriptcachePomModel.getModules().forEach((moduleItem) -> { + copyWithSpecificModule(projectPath, version, baseTargetJarPath, moduleMap, moduleItem); + }); + + Model tsFilePomModel = getPom(FileUtility.combine(projectPath, "tsfile")); + tsFilePomModel.getModules().forEach((moduleItem) -> { + copyWithSpecificModule(projectPath, version, baseTargetJarPath, moduleMap, moduleItem); + }); + } + + private static void copyWithSpecificModule(String projectPath, String version, String baseTargetJarPath, Map moduleMap, String moduleItem) { + if (moduleMap.containsKey(moduleItem)) { + String moduleId = moduleMap.get(moduleItem).moduleId; + if (StringUtility.isNullOrEmpty(moduleId)) { + WebLogger.Instance.error("无法找到对应的moduleId" + moduleItem); + } else { + String modulePath = FileUtility.combine(projectPath, StringUtility.convertNullToEmptyString(moduleMap.get(moduleItem).moduleIdPath), moduleItem); + String moduleJarFilePath = FileUtility.combine(modulePath, "target", moduleId + "-" + version + ".jar"); + if (!new File(moduleJarFilePath).exists()) { + WebLogger.Instance.error("目标文件不存在," + moduleJarFilePath); + } else { + String targetJarPath = FileUtility.combine(baseTargetJarPath, moduleMap.get(moduleItem).getRelativePath()); + String targetJarFilePath = FileUtility.combine(targetJarPath, moduleId + ".jar"); + FileUtility.copyFile(moduleJarFilePath, targetJarFilePath, true); + WebLogger.Instance.info("copy file " + moduleJarFilePath + " to " + targetJarFilePath); + } + } + } } private Map getModulePath() { @@ -87,29 +130,29 @@ public class CopyJarFile { moduleMap.put("web-common", ModulePath.init("web-jitengine-common")); moduleMap.put("web-form-metadata-api", ModulePath.init("web-jitengine-formmetadata-api")); moduleMap.put("web-form-metadata", ModulePath.init("web-jitengine-formmetadata")); - moduleMap.put("web-sourcecode-metadata", ModulePath.init("web-sourcecode-metadata")); - moduleMap.put("web-pageflow-metadata", ModulePath.init("web-pageflow-metadata")); - moduleMap.put("web-appconfig-api", ModulePath.init("web-appconfig-api", "", "appconfig")); - moduleMap.put("web-appconfig-core", ModulePath.init("web-appconfig-core", "", "appconfig")); + moduleMap.put("web-sourcecode-metadata", ModulePath.init("web-sourcecode-metadata", "server/platform/common/libs", "metadata")); + moduleMap.put("web-pageflow-metadata", ModulePath.init("web-pageflow-metadata", "server/platform/common/libs", "metadata")); + moduleMap.put("web-appconfig-api", ModulePath.init("web-appconfig-api", "server/platform/common/libs", "appconfig")); + moduleMap.put("web-appconfig-core", ModulePath.init("web-appconfig-core", "server/platform/common/libs", "appconfig")); moduleMap.put("web-frontendproject", ModulePath.init("web-jitengine-frontendproject")); moduleMap.put("web-frontendproject-api", ModulePath.init("web-jitengine-frontendproject-api")); moduleMap.put("web-form-jitengine", ModulePath.init("web-jitengine")); moduleMap.put("web-designschema", ModulePath.init("web-designschema")); moduleMap.put("web-designschema-api", ModulePath.init("web-designschema-api")); - moduleMap.put("web-statemachine", ModulePath.init("web-statemachine-metadata", "", "metadata")); - moduleMap.put("web-tsfile-api", ModulePath.init("web-tsfile-api", "", "tsfile")); - moduleMap.put("web-tsfile-core", ModulePath.init("web-tsfile-core", "", "tsfile")); + moduleMap.put("web-statemachine", ModulePath.init("web-statemachine-metadata", "server/platform/common/libs", "metadata")); + moduleMap.put("web-tsfile-api", ModulePath.init("web-tsfile-api", "server/platform/common/libs", "tsfile")); + moduleMap.put("web-tsfile-core", ModulePath.init("web-tsfile-core", "server/platform/common/libs", "tsfile")); moduleMap.put("web-ide-api", ModulePath.init("web-ide-api")); moduleMap.put("web-ide-webapi", ModulePath.init("ide-config-webapi", "server/platform/dev/main/libs", "")); - moduleMap.put("runtime-api", ModulePath.init("web-jitengine-runtimebuild-api", "", "runtime")); - moduleMap.put("runtime-core", ModulePath.init("web-jitengine-runtimebuild-core", "", "runtime")); - moduleMap.put("runtime-scriptcache", ModulePath.init("web-jitengine-runtimebuild-scriptcache", "", "scriptcache")); - moduleMap.put("runtime-scriptcache-api", ModulePath.init("web-jitengine-runtimebuild-scriptcache-api", "", "scriptcache")); + moduleMap.put("runtime-api", ModulePath.init("web-jitengine-runtimebuild-api", "server/platform/common/libs", "runtime")); + moduleMap.put("runtime-core", ModulePath.init("web-jitengine-runtimebuild-core", "server/platform/common/libs", "runtime")); + moduleMap.put("runtime-scriptcache", ModulePath.init("web-jitengine-runtimebuild-scriptcache", "server/platform/common/libs", "scriptcache")); + moduleMap.put("runtime-scriptcache-api", ModulePath.init("web-jitengine-runtimebuild-scriptcache-api", "server/platform/common/libs", "scriptcache")); moduleMap.put("jitengine-web-api", ModulePath.init("web-jitengine-web-api")); moduleMap.put("jitengine-web-core", ModulePath.init("web-jitengine-web-core")); - moduleMap.put("web-npmpackage-core", ModulePath.init("web-npmpackage-core", "", "npmpackage")); - moduleMap.put("web-npmpackage-api", ModulePath.init("web-npmpackage-api", "", "npmpackage")); - moduleMap.put("web-npmpackage-patch", ModulePath.init("web-npmpackage-patch", "", "npmpackage")); + moduleMap.put("web-npmpackage-core", ModulePath.init("web-npmpackage-core", "server/platform/common/libs", "npmpackage")); + moduleMap.put("web-npmpackage-api", ModulePath.init("web-npmpackage-api", "server/platform/common/libs", "npmpackage")); + moduleMap.put("web-npmpackage-patch", ModulePath.init("web-npmpackage-patch", "server/platform/common/libs", "npmpackage")); moduleMap.put("web-dynamic-form-api", ModulePath.init("web-dynamicform-api")); moduleMap.put("web-dynamic-form-core", ModulePath.init("web-dynamicform-core")); moduleMap.put("web-formconfig-api", ModulePath.init("web-formconfig-api")); -- Gitee From da79451d1aa19e2772e7943228b24ae57192379a Mon Sep 17 00:00:00 2001 From: guozhiqi Date: Thu, 20 Jul 2023 14:12:58 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0html=20=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=BC=96=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/inspur/edp/web/jitengine/JITEngineManager.java | 3 +++ 1 file changed, 3 insertions(+) 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 1deb4bc6..4b4c5a03 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 @@ -42,6 +42,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.dynamicform.htmltemplate.HtmlTemplateEntity; +import com.inspur.edp.web.jitengine.dynamicform.htmltemplate.HtmlTemplateManager; import com.inspur.edp.web.jitengine.expressions.ExpressionFormGenerator; import com.inspur.edp.web.jitengine.expressions.ExpressionManifest; import com.inspur.edp.web.jitengine.expressions.ModuleFormExpressions; @@ -310,6 +312,7 @@ public class JITEngineManager { WebLogger.Instance.info("delete html template folder failed, the path is " + htmlTemplatePath + ", the trace is " + ex.getMessage() + Arrays.toString(ex.getStackTrace())); } + List htmlTemplateEntityList = HtmlTemplateManager.generate(htmlTemplatePath, json); // 如果包含模板文件 那么执行编译 NodeJsCommandResult tscCommandResult = NodejsFunctionUtility.getTscCommandInServer(false); -- Gitee From 411835c0924e8c86643c5a5f9b27a0e9c04b7044 Mon Sep 17 00:00:00 2001 From: guozhiqi Date: Thu, 20 Jul 2023 16:01:46 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0html=20=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=BC=96=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rpc/LocalServerVersionRpcServiceImpl.java | 14 +++++++----- .../web/common/loadclass/CustomLoadClass.java | 20 +++++++++++++++++ .../web/common/loadclass/LoadClassTest.java | 22 +++++++++++++++++++ 3 files changed, 50 insertions(+), 6 deletions(-) create mode 100644 web-common/src/test/java/com/inspur/edp/web/common/loadclass/CustomLoadClass.java create mode 100644 web-common/src/test/java/com/inspur/edp/web/common/loadclass/LoadClassTest.java diff --git a/scriptcache/runtime-scriptcache/src/main/java/com/inspur/edp/web/jitruntimebuild/scriptcache/localserver/rpc/LocalServerVersionRpcServiceImpl.java b/scriptcache/runtime-scriptcache/src/main/java/com/inspur/edp/web/jitruntimebuild/scriptcache/localserver/rpc/LocalServerVersionRpcServiceImpl.java index d250c23f..e6a888c2 100644 --- a/scriptcache/runtime-scriptcache/src/main/java/com/inspur/edp/web/jitruntimebuild/scriptcache/localserver/rpc/LocalServerVersionRpcServiceImpl.java +++ b/scriptcache/runtime-scriptcache/src/main/java/com/inspur/edp/web/jitruntimebuild/scriptcache/localserver/rpc/LocalServerVersionRpcServiceImpl.java @@ -21,11 +21,13 @@ import com.inspur.edp.web.jitruntimebuild.scriptcache.api.entity.FormScriptCache import com.inspur.edp.web.jitruntimebuild.scriptcache.api.entity.FormScriptCacheContent; import com.inspur.edp.web.jitruntimebuild.scriptcache.manager.ScriptCacheVersionManager; +import javax.annotation.Resource; import java.util.List; public class LocalServerVersionRpcServiceImpl implements LocalServerVersionRpcService { - private final ScriptCacheVersionManager scriptCacheVersionManagerInstance = new ScriptCacheVersionManager(); + @Resource + private ScriptCacheVersionManager scriptCacheVersionManager; public LocalServerVersionRpcServiceImpl() { @@ -40,7 +42,7 @@ public class LocalServerVersionRpcServiceImpl implements LocalServerVersionRpcSe */ @Override public List getFormScriptCacheByMetadataId(String formMetadataId) { - return this.scriptCacheVersionManagerInstance.getFormScriptCacheByMetadataId(formMetadataId); + return this.scriptCacheVersionManager.getFormScriptCacheByMetadataId(formMetadataId); } /** @@ -51,7 +53,7 @@ public class LocalServerVersionRpcServiceImpl implements LocalServerVersionRpcSe */ @Override public FormProjectCache getFormProjectCacheById(String projectVersionId) { - return this.scriptCacheVersionManagerInstance.getFormProjectCacheById(projectVersionId); + return this.scriptCacheVersionManager.getFormProjectCacheById(projectVersionId); } /** @@ -62,7 +64,7 @@ public class LocalServerVersionRpcServiceImpl implements LocalServerVersionRpcSe */ @Override public FormScriptCacheContent getFormScriptCacheContentById(String contentId) { - return this.scriptCacheVersionManagerInstance.getFormScriptCacheContentById(contentId); + return this.scriptCacheVersionManager.getFormScriptCacheContentById(contentId); } /** @@ -74,7 +76,7 @@ public class LocalServerVersionRpcServiceImpl implements LocalServerVersionRpcSe */ @Override public FormProjectCache getByProjectNameAndProjectRelativePath(String projectName, String strProjectRelativePath) { - return this.scriptCacheVersionManagerInstance.getByProjectNameAndProjectRelativePath(projectName, strProjectRelativePath); + return this.scriptCacheVersionManager.getByProjectNameAndProjectRelativePath(projectName, strProjectRelativePath); } /** @@ -84,7 +86,7 @@ public class LocalServerVersionRpcServiceImpl implements LocalServerVersionRpcSe */ @Override public List getFormScriptCacheByProjectVersionId(String formProjectVersionId) { - return this.scriptCacheVersionManagerInstance.getFormScriptCacheByProjectVersionId(formProjectVersionId); + return this.scriptCacheVersionManager.getFormScriptCacheByProjectVersionId(formProjectVersionId); } diff --git a/web-common/src/test/java/com/inspur/edp/web/common/loadclass/CustomLoadClass.java b/web-common/src/test/java/com/inspur/edp/web/common/loadclass/CustomLoadClass.java new file mode 100644 index 00000000..272b6ddb --- /dev/null +++ b/web-common/src/test/java/com/inspur/edp/web/common/loadclass/CustomLoadClass.java @@ -0,0 +1,20 @@ +package com.inspur.edp.web.common.loadclass; + +/** + * @author noah + * 2023/7/20 14:16 + */ +public class CustomLoadClass { + static { + System.out.println("static method "); + } + + { + System.out.println("method specific "); + } + + public CustomLoadClass() { + System.out.println("custom load class constructor"); + } + +} diff --git a/web-common/src/test/java/com/inspur/edp/web/common/loadclass/LoadClassTest.java b/web-common/src/test/java/com/inspur/edp/web/common/loadclass/LoadClassTest.java new file mode 100644 index 00000000..9513f7c0 --- /dev/null +++ b/web-common/src/test/java/com/inspur/edp/web/common/loadclass/LoadClassTest.java @@ -0,0 +1,22 @@ +package com.inspur.edp.web.common.loadclass; + +import org.junit.jupiter.api.Test; + +/** + * @author noah + * 2023/7/20 14:16 + */ +public class LoadClassTest { + + @Test + public void load() throws ClassNotFoundException { +// Class classInfo = Class.forName("com.inspur.edp.web.common.loadclass.CustomLoadClass"); +// System.out.println(classInfo.getName()); + +// Class classInfo1 = Class.forName("com.inspur.edp.web.common.loadclass.CustomLoadClass", false, this.getClass().getClassLoader()); +// System.out.println(classInfo1.getName()); + + Class classInfo2 = ClassLoader.getSystemClassLoader().loadClass("com.inspur.edp.web.common.loadclass.CustomLoadClass"); + System.out.println(classInfo2.getName()); + } +} -- Gitee From b1a70fd4f3443ac83d3c8ff09a47ec4ecaa7074f Mon Sep 17 00:00:00 2001 From: guozhiqi Date: Thu, 20 Jul 2023 17:32:04 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0html=20=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=BC=96=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/test/java/com/inspur/edp/web/common/CopyJarFile.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/web-common/src/test/java/com/inspur/edp/web/common/CopyJarFile.java b/web-common/src/test/java/com/inspur/edp/web/common/CopyJarFile.java index b4fea7cb..cd9eda44 100644 --- a/web-common/src/test/java/com/inspur/edp/web/common/CopyJarFile.java +++ b/web-common/src/test/java/com/inspur/edp/web/common/CopyJarFile.java @@ -127,6 +127,11 @@ public class CopyJarFile { private Map getModulePath() { Map moduleMap = new HashMap<>(); + + moduleMap.put("web-approval-format-api", ModulePath.init("web-approval-format-api", "server/platform/runtime/bcc/libs", "approval-format")); + moduleMap.put("web-approval-format-core", ModulePath.init("web-approval-format-core", "server/platform/runtime/bcc/libs", "approval-format")); + moduleMap.put("web-approval-format-rpc", ModulePath.init("web-approval-format-rpc", "server/platform/common/libs", "approval-format")); + moduleMap.put("web-common", ModulePath.init("web-jitengine-common")); moduleMap.put("web-form-metadata-api", ModulePath.init("web-jitengine-formmetadata-api")); moduleMap.put("web-form-metadata", ModulePath.init("web-jitengine-formmetadata")); -- Gitee