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

去除冗余代码,去除无用引用包

上级 6ba3a24f
...@@ -22,9 +22,7 @@ import ${pub.getPKGCodeName()}.util.domain.EntityBase; ...@@ -22,9 +22,7 @@ import ${pub.getPKGCodeName()}.util.domain.EntityBase;
import ${pub.getPKGCodeName()}.util.errors.BadRequestAlertException; import ${pub.getPKGCodeName()}.util.errors.BadRequestAlertException;
import ${pub.getPKGCodeName()}.util.helper.DEFieldCacheMap; import ${pub.getPKGCodeName()}.util.helper.DEFieldCacheMap;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Aspect;
import org.flowable.bpmn.converter.BpmnXMLConverter; import org.flowable.bpmn.converter.BpmnXMLConverter;
...@@ -38,7 +36,6 @@ import org.kie.api.builder.Results; ...@@ -38,7 +36,6 @@ import org.kie.api.builder.Results;
import org.kie.api.runtime.KieContainer; import org.kie.api.runtime.KieContainer;
import org.kie.api.runtime.KieSession; import org.kie.api.runtime.KieSession;
import org.kie.internal.io.ResourceFactory; import org.kie.internal.io.ResourceFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.expression.EvaluationContext; import org.springframework.expression.EvaluationContext;
import org.springframework.expression.Expression; import org.springframework.expression.Expression;
import org.springframework.expression.ExpressionParser; import org.springframework.expression.ExpressionParser;
...@@ -122,7 +119,7 @@ public class DELogicAspect { ...@@ -122,7 +119,7 @@ public class DELogicAspect {
private void executeBeforeLogic(EntityBase entity, String action) { private void executeBeforeLogic(EntityBase entity, String action) {
File bpmnFile = getLocalModel(entity.getClass().getSimpleName(), action, LogicExecMode.BEFORE); File bpmnFile = getLocalModel(entity.getClass().getSimpleName(), action, LogicExecMode.BEFORE);
if (bpmnFile != null && bpmnFile.exists() && isValid(bpmnFile, entity, action)) { if (bpmnFile != null && bpmnFile.exists() && isValid(bpmnFile, entity, action)) {
executeLogic(bpmnFile, entity, action, LogicMode.LOCAL); executeLogic(bpmnFile, entity, action);
} }
} }
...@@ -135,7 +132,7 @@ public class DELogicAspect { ...@@ -135,7 +132,7 @@ public class DELogicAspect {
private void executeAfterLogic(EntityBase entity, String action) { private void executeAfterLogic(EntityBase entity, String action) {
File bpmnFile = getLocalModel(entity.getClass().getSimpleName(), action, LogicExecMode.AFTER); File bpmnFile = getLocalModel(entity.getClass().getSimpleName(), action, LogicExecMode.AFTER);
if (bpmnFile != null && bpmnFile.exists() && isValid(bpmnFile, entity, action)) { if (bpmnFile != null && bpmnFile.exists() && isValid(bpmnFile, entity, action)) {
executeLogic(bpmnFile, entity, action, LogicMode.LOCAL); executeLogic(bpmnFile, entity, action);
} }
} }
...@@ -148,7 +145,7 @@ public class DELogicAspect { ...@@ -148,7 +145,7 @@ public class DELogicAspect {
private void executeLogic(EntityBase entity, String action) { private void executeLogic(EntityBase entity, String action) {
File bpmnFile = getLocalModel(entity.getClass().getSimpleName(), action, LogicExecMode.EXEC); File bpmnFile = getLocalModel(entity.getClass().getSimpleName(), action, LogicExecMode.EXEC);
if (bpmnFile != null && bpmnFile.exists() && isValid(bpmnFile, entity, action)) { if (bpmnFile != null && bpmnFile.exists() && isValid(bpmnFile, entity, action)) {
executeLogic(bpmnFile, entity, action, LogicMode.LOCAL); executeLogic(bpmnFile, entity, action);
} }
} }
...@@ -158,10 +155,10 @@ public class DELogicAspect { ...@@ -158,10 +155,10 @@ public class DELogicAspect {
* @param bpmnFile * @param bpmnFile
* @param entity * @param entity
*/ */
private void executeLogic(File bpmnFile, Object entity, String action, LogicMode logicMode) { private void executeLogic(File bpmnFile, Object entity, String action) {
log.debug("开始执行实体处理逻辑[{}:{}:{}:{}]", entity.getClass().getSimpleName(), action, bpmnFile.getName(), logicMode.text); log.debug("开始执行实体处理逻辑[{}:{}:{}:{}]", entity.getClass().getSimpleName(), action, bpmnFile.getName(),"本地模式");
String bpmnId = DigestUtils.md5DigestAsHex(bpmnFile.getPath().getBytes()); String bpmnId = DigestUtils.md5DigestAsHex(bpmnFile.getPath().getBytes());
DELogic logic = getDELogic(bpmnFile, entity, logicMode); DELogic logic = getDELogic(bpmnFile, entity);
if (logic == null) { if (logic == null) {
return; return;
} }
...@@ -183,7 +180,7 @@ public class DELogicAspect { ...@@ -183,7 +180,7 @@ public class DELogicAspect {
} }
} }
kieSession.startProcess(mainProcess.getId()); kieSession.startProcess(mainProcess.getId());
log.debug("实体处理逻辑[{}:{}:{}:{}]执行结束", entity.getClass().getSimpleName(), action, bpmnFile.getName(), logicMode.text); log.debug("实体处理逻辑[{}:{}:{}:{}]执行结束", entity.getClass().getSimpleName(), action, bpmnFile.getName(),"本地模式");
} }
/** /**
...@@ -250,7 +247,7 @@ public class DELogicAspect { ...@@ -250,7 +247,7 @@ public class DELogicAspect {
* @return * @return
*/ */
@SneakyThrows @SneakyThrows
private DELogic getDELogic(File bpmnFile, Object entity, LogicMode logicMode) { private DELogic getDELogic(File bpmnFile, Object entity) {
DELogic logic = null; DELogic logic = null;
XMLStreamReader reader = null; XMLStreamReader reader = null;
InputStream bpmn = null; InputStream bpmn = null;
...@@ -279,11 +276,11 @@ public class DELogicAspect { ...@@ -279,11 +276,11 @@ public class DELogicAspect {
CallActivity subBpmn = (CallActivity) item; CallActivity subBpmn = (CallActivity) item;
String bpmnFileName = subBpmn.getName(); String bpmnFileName = subBpmn.getName();
log.debug("正在加载 BPMN{}", bpmnFileName); log.debug("正在加载 BPMN{}", bpmnFileName);
File subBpmnFile = getSubBpmn(getDEModule(entity), entity.getClass().getSimpleName(), bpmnFileName, logicMode); File subBpmnFile = getSubBpmn(getDEModule(entity), entity.getClass().getSimpleName(), bpmnFileName);
if (ObjectUtils.isEmpty(subBpmnFile)) { if (ObjectUtils.isEmpty(subBpmnFile)) {
log.debug("BPMN:{},缺少文件:{} ", bpmnFileName, subBpmnFile); log.debug("BPMN:{},缺少文件:{} ", bpmnFileName, subBpmnFile);
} }
DELogic refLogic = getDELogic(subBpmnFile, entity, logicMode); DELogic refLogic = getDELogic(subBpmnFile, entity);
if (refLogic != null) { if (refLogic != null) {
refLogics.add(refLogic); refLogics.add(refLogic);
if (!ObjectUtils.isEmpty(refLogic.getRefRuleFiles())) { if (!ObjectUtils.isEmpty(refLogic.getRefRuleFiles())) {
...@@ -396,7 +393,7 @@ public class DELogicAspect { ...@@ -396,7 +393,7 @@ public class DELogicAspect {
* @param logicName * @param logicName
* @return * @return
*/ */
private File getSubBpmn(String module, String entity, String logicName, LogicMode logicMode) { private File getSubBpmn(String module, String entity, String logicName) {
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 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册