提交 9dd596db 编写于 作者: tangyaolong's avatar tangyaolong

多实例动态模型切面开发

上级 2f940295
...@@ -91,6 +91,8 @@ public class DELogicAspect { ...@@ -91,6 +91,8 @@ public class DELogicAspect {
private String dynamicPath; private String dynamicPath;
@Value("${r'$'}{ibiz.systemid:${sys.getCodeName()}}") @Value("${r'$'}{ibiz.systemid:${sys.getCodeName()}}")
private String systemId; private String systemId;
@Value("${r'$'}{ibiz.dynainstid:${sys.getCodeName()?lower_case}}")
private String dynamicId;
private static Map<String, Object> validLogic = new HashMap<>(); private static Map<String, Object> validLogic = new HashMap<>();
/** /**
...@@ -249,7 +251,7 @@ public class DELogicAspect { ...@@ -249,7 +251,7 @@ public class DELogicAspect {
*/ */
private void executeLogic(File bpmnFile, Object entity, String action, LogicMode logicMode) { private void executeLogic(File bpmnFile, Object entity, String action, LogicMode logicMode) {
log.debug("开始执行实体处理逻辑[{}:{}:{}:{}]", entity.getClass().getSimpleName(), action, bpmnFile.getName(), logicMode.text); log.debug("开始执行实体处理逻辑[{}:{}:{}:{}]", entity.getClass().getSimpleName(), action, bpmnFile.getName(), logicMode.text);
String bpmnId = DigestUtils.md5DigestAsHex(bpmnFile.getName().getBytes()); String bpmnId = DigestUtils.md5DigestAsHex(bpmnFile.getPath().getBytes());
DELogic logic = getDELogic(bpmnFile, entity, logicMode); DELogic logic = getDELogic(bpmnFile, entity, logicMode);
if (logic == null) { if (logic == null) {
return; return;
...@@ -436,7 +438,7 @@ public class DELogicAspect { ...@@ -436,7 +438,7 @@ public class DELogicAspect {
} }
/** /**
* 远程逻辑 * 本地逻辑
* *
* @param entity * @param entity
* @param action * @param action
...@@ -451,7 +453,7 @@ public class DELogicAspect { ...@@ -451,7 +453,7 @@ public class DELogicAspect {
} }
/** /**
* 本地逻辑 * 远程逻辑
* *
* @param module * @param module
* @param entity * @param entity
...@@ -461,7 +463,7 @@ public class DELogicAspect { ...@@ -461,7 +463,7 @@ public class DELogicAspect {
*/ */
private File getRemoteModel(String module, String entity, String action, String actionLogic) { private File getRemoteModel(String module, String entity, String action, String actionLogic) {
String logicName = String.format("psdeaction.json.%s.bpmn", actionLogic); String logicName = String.format("psdeaction.json.%s.bpmn", actionLogic);
return new File(dynamicPath + File.separator + (systemId + File.separator + "psmodules" + File.separator + module + File.separator + "psdataentities" + File.separator + entity + File.separator + "psdeactions" + File.separator + action + File.separator + logicName).toLowerCase()); return new File(dynamicPath + File.separator + (systemId + File.separator + dynamicId + File.separator + "psmodules" + File.separator + module + File.separator + "psdataentities" + File.separator + entity + File.separator + "psdeactions" + File.separator + action + File.separator + logicName).toLowerCase());
} }
/** /**
...@@ -474,7 +476,7 @@ public class DELogicAspect { ...@@ -474,7 +476,7 @@ public class DELogicAspect {
*/ */
private File getSubBpmn(String module, String entity, String logicName, LogicMode logicMode) { private File getSubBpmn(String module, String entity, String logicName, LogicMode logicMode) {
if (LogicMode.REMOTE.equals(logicMode)) { if (LogicMode.REMOTE.equals(logicMode)) {
return new File(dynamicPath + File.separator + (systemId + File.separator + "psmodules" + File.separator + module + File.separator + "psdataentities" + File.separator + entity + File.separator + "psdelogics" + File.separator + logicName + File.separator + "psdelogic.json.bpmn").toLowerCase()); return new File(dynamicPath + File.separator + (systemId + File.separator + dynamicId + File.separator + "psmodules" + File.separator + module + File.separator + "psdataentities" + File.separator + entity + File.separator + "psdelogics" + File.separator + logicName + File.separator + "psdelogic.json.bpmn").toLowerCase());
} else { } else {
String filePath = String.format("/rules/%s", logicName); String filePath = String.format("/rules/%s", logicName);
return ObjectUtils.isEmpty(this.getClass().getResource(filePath)) ? null : new File(this.getClass().getResource(filePath).getPath()); return ObjectUtils.isEmpty(this.getClass().getResource(filePath)) ? null : new File(this.getClass().getResource(filePath).getPath());
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册