提交 a0478b5a 编写于 作者: zhouweidong's avatar zhouweidong

启用新模式附加逻辑

上级 e457df05
...@@ -215,7 +215,7 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa ...@@ -215,7 +215,7 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa
<@outputTestAction deaction "delogic"/> <@outputTestAction deaction "delogic"/>
<#comment>附加数据逻辑-操作前</#comment> <#comment>附加数据逻辑-操作前</#comment>
<@addBoforeLogic deaction/> <@addBoforeLogic deaction/>
${deaction.getPSDELogic().getCodeName()?lower_case}Logic.execute(et); <#--${deaction.getPSDELogic().getCodeName()?lower_case}Logic.execute(et);-->
<#comment>附加数据逻辑-操作后</#comment> <#comment>附加数据逻辑-操作后</#comment>
<@addAfterLogic deaction/> <@addAfterLogic deaction/>
return et ; return et ;
...@@ -2329,50 +2329,50 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser ...@@ -2329,50 +2329,50 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
</#if> </#if>
<#macro buildEntityParam deaction> <#macro buildEntityParam deaction>
<#comment>由于getremove参数为key,构造entity以便传入逻辑中</#comment> <#--<#comment>由于getremove参数为key,构造entity以便传入逻辑中</#comment>-->
<#assign tempEntityName="et"> <#--<#assign tempEntityName="et">-->
<#if deaction.getPSDEActionLogics()??> <#--<#if deaction.getPSDEActionLogics()??>-->
<#list deaction.getPSDEActionLogics() as actionlogic> <#--<#list deaction.getPSDEActionLogics() as actionlogic>-->
<#if actionlogic.isValid()==true && actionlogic.isInternalLogic() && actionlogic.getPSDELogic().isEnableBackend()> <#--<#if actionlogic.isValid()==true && actionlogic.isInternalLogic() && actionlogic.getPSDELogic().isEnableBackend()>-->
<#if deaction.getCodeName()?lower_case == "get"> <#--<#if deaction.getCodeName()?lower_case == "get">-->
<#assign tempEntityName="tempET"> <#--<#assign tempEntityName="tempET">-->
</#if> <#--</#if>-->
${de.codeName} ${tempEntityName}=new ${de.codeName}(); <#--${de.codeName} ${tempEntityName}=new ${de.codeName}();-->
<#if keyfield??> <#--<#if keyfield??>-->
${tempEntityName}.set("${keyfield.codeName?lower_case}",key); <#--${tempEntityName}.set("${keyfield.codeName?lower_case}",key);-->
</#if> <#--</#if>-->
<#break> <#--<#break>-->
</#if> <#--</#if>-->
</#list> <#--</#list>-->
</#if> <#--</#if>-->
</#macro> </#macro>
<#comment>Get行为附加逻辑-操作前</#comment> <#comment>Get行为附加逻辑-操作前</#comment>
<#macro addGetActionBoforeLogic deaction> <#macro addGetActionBoforeLogic deaction>
<#if deaction.getPSDEActionLogics()??> <#--<#if deaction.getPSDEActionLogics()??>-->
<#list deaction.getPSDEActionLogics() as actionlogic> <#--<#list deaction.getPSDEActionLogics() as actionlogic>-->
<#if actionlogic.getAttachMode()=='BEFORE' && actionlogic.isValid()==true> <#--<#if actionlogic.getAttachMode()=='BEFORE' && actionlogic.isValid()==true>-->
<#if actionlogic.isInternalLogic() && actionlogic.getPSDELogic().isEnableBackend()> <#--<#if actionlogic.isInternalLogic() && actionlogic.getPSDELogic().isEnableBackend()>-->
${actionlogic.getPSDELogic().getCodeName()?lower_case}Logic.execute(tempET); <#--${actionlogic.getPSDELogic().getCodeName()?lower_case}Logic.execute(tempET);-->
</#if> <#--</#if>-->
</#if> <#--</#if>-->
</#list> <#--</#list>-->
</#if> <#--</#if>-->
</#macro> </#macro>
<#comment>附加逻辑-操作前</#comment> <#comment>附加逻辑-操作前</#comment>
<#macro addBoforeLogic deaction> <#macro addBoforeLogic deaction>
<#if deaction.getBeforePSDEActionLogics()??> <#--<#if deaction.getBeforePSDEActionLogics()??>-->
<#list deaction.getBeforePSDEActionLogics() as actionlogic> <#--<#list deaction.getBeforePSDEActionLogics() as actionlogic>-->
<#if actionlogic.isValid()==true> <#--<#if actionlogic.isValid()==true>-->
<#if actionlogic.isInternalLogic() && actionlogic.getPSDELogic().isEnableBackend()> <#--<#if actionlogic.isInternalLogic() && actionlogic.getPSDELogic().isEnableBackend()>-->
${actionlogic.getPSDELogic().getCodeName()?lower_case}Logic.execute(et); <#--${actionlogic.getPSDELogic().getCodeName()?lower_case}Logic.execute(et);-->
<#elseif (actionlogic.getDstPSDE()!'')!='' && (actionlogic.getDstPSDEAction()!'')!='' && actionlogic.getDstPSDEAction().isEnableBackend()> <#--<#elseif (actionlogic.getDstPSDE()!'')!='' && (actionlogic.getDstPSDEAction()!'')!='' && actionlogic.getDstPSDEAction().isEnableBackend()>-->
<@addActionLogic deaction actionlogic/> <#--<@addActionLogic deaction actionlogic/>-->
</#if> <#--</#if>-->
</#if> <#--</#if>-->
</#list> <#--</#list>-->
</#if> <#--</#if>-->
</#macro> </#macro>
<#comment>附加实体行为</#comment> <#comment>附加实体行为</#comment>
...@@ -2429,17 +2429,17 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser ...@@ -2429,17 +2429,17 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
<#comment>附加逻辑-操作后</#comment> <#comment>附加逻辑-操作后</#comment>
<#macro addAfterLogic deaction> <#macro addAfterLogic deaction>
<#if deaction.getAfterPSDEActionLogics()??> <#--<#if deaction.getAfterPSDEActionLogics()??>-->
<#list deaction.getAfterPSDEActionLogics() as actionlogic> <#--<#list deaction.getAfterPSDEActionLogics() as actionlogic>-->
<#if actionlogic.isValid()==true> <#--<#if actionlogic.isValid()==true>-->
<#if actionlogic.isInternalLogic() && actionlogic.getPSDELogic().isEnableBackend()> <#--<#if actionlogic.isInternalLogic() && actionlogic.getPSDELogic().isEnableBackend()>-->
${actionlogic.getPSDELogic().getCodeName()?lower_case}Logic.execute(et); <#--${actionlogic.getPSDELogic().getCodeName()?lower_case}Logic.execute(et);-->
<#elseif (actionlogic.getDstPSDE()!'')!='' && (actionlogic.getDstPSDEAction()!'')!='' && actionlogic.getDstPSDEAction().isEnableBackend()> <#--<#elseif (actionlogic.getDstPSDE()!'')!='' && (actionlogic.getDstPSDEAction()!'')!='' && actionlogic.getDstPSDEAction().isEnableBackend()>-->
<@addActionLogic deaction actionlogic/> <#--<@addActionLogic deaction actionlogic/>-->
</#if> <#--</#if>-->
</#if> <#--</#if>-->
</#list> <#--</#list>-->
</#if> <#--</#if>-->
</#macro> </#macro>
<#macro importDELogic deLogic> <#macro importDELogic deLogic>
<#if deLogic.isEnableBackend()> <#if deLogic.isEnableBackend()>
......
...@@ -4,20 +4,20 @@ TARGET=PSDELOGIC ...@@ -4,20 +4,20 @@ TARGET=PSDELOGIC
<#if item.isEnableBackend()> <#if item.isEnableBackend()>
package ${pub.getPKGCodeName()}.core.${item.getPSDataEntity().getPSSystemModule().getCodeName()?lower_case}.service.logic; package ${pub.getPKGCodeName()}.core.${item.getPSDataEntity().getPSSystemModule().getCodeName()?lower_case}.service.logic;
import java.sql.Timestamp; <#--import java.sql.Timestamp;-->
import java.util.ArrayList; <#--import java.util.ArrayList;-->
import java.util.List; <#--import java.util.List;-->
import java.util.Map; <#--import java.util.Map;-->
import java.util.HashMap; <#--import java.util.HashMap;-->
import ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().getCodeName()?lower_case}.domain.${de.getCodeName()}; <#--import ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().getCodeName()?lower_case}.domain.${de.getCodeName()};-->
/** <#--/**-->
* 关系型数据实体[${item.codeName}] 对象 <#--* 关系型数据实体[${item.codeName}] 对象-->
*/ <#--*/-->
public interface I${de.codeName}${item.codeName}Logic { public interface I${de.codeName}${item.codeName}Logic {
void execute(${de.codeName} et) ; <#--void execute(${de.codeName} et) ;-->
} }
</#if> </#if>
\ No newline at end of file
...@@ -5,111 +5,111 @@ TARGET=PSDELOGIC ...@@ -5,111 +5,111 @@ TARGET=PSDELOGIC
<#assign startWF=false> <#assign startWF=false>
package ${pub.getPKGCodeName()}.core.${item.getPSDataEntity().getPSSystemModule().getCodeName()?lower_case}.service.logic.impl; package ${pub.getPKGCodeName()}.core.${item.getPSDataEntity().getPSSystemModule().getCodeName()?lower_case}.service.logic.impl;
import java.util.Map; <#--import java.util.Map;-->
import java.util.HashMap; <#--import java.util.HashMap;-->
import lombok.extern.slf4j.Slf4j; <#--import lombok.extern.slf4j.Slf4j;-->
import org.springframework.beans.factory.annotation.Autowired; <#--import org.springframework.beans.factory.annotation.Autowired;-->
import org.springframework.stereotype.Service; <#--import org.springframework.stereotype.Service;-->
import org.kie.api.runtime.KieSession; <#--import org.kie.api.runtime.KieSession;-->
import org.kie.api.runtime.KieContainer; <#--import org.kie.api.runtime.KieContainer;-->
import ${pub.getPKGCodeName()}.core.${item.getPSDataEntity().getPSSystemModule().getCodeName()?lower_case}.service.logic.I${de.codeName}${item.codeName}Logic; <#--import ${pub.getPKGCodeName()}.core.${item.getPSDataEntity().getPSSystemModule().getCodeName()?lower_case}.service.logic.I${de.codeName}${item.codeName}Logic;-->
import ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().getCodeName()?lower_case}.domain.${de.getCodeName()}; <#--import ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().getCodeName()?lower_case}.domain.${de.getCodeName()};-->
/** <#--/**-->
* 关系型数据实体[${item.codeName}] 对象 <#--* 关系型数据实体[${item.codeName}] 对象-->
*/ <#--*/-->
@Slf4j <#--@Slf4j-->
@Service <#--@Service-->
public class ${de.codeName}${item.codeName}LogicImpl implements I${de.codeName}${item.codeName}Logic { public class ${de.codeName}${item.codeName}LogicImpl{
@Autowired <#--@Autowired-->
private KieContainer kieContainer; <#--private KieContainer kieContainer;-->
<#comment>注入处理逻辑中所用到的service对象</#comment> <#--<#comment>注入处理逻辑中所用到的service对象</#comment>-->
<#if item.getPSDELogicNodes?? && item.getPSDELogicNodes()??> <#--<#if item.getPSDELogicNodes?? && item.getPSDELogicNodes()??>-->
<#list item.getPSDELogicNodes() as deLogicNode> <#--<#list item.getPSDELogicNodes() as deLogicNode>-->
<#if deLogicNode.getDstPSDataEntity?? && deLogicNode.getDstPSDataEntity()??> <#--<#if deLogicNode.getDstPSDataEntity?? && deLogicNode.getDstPSDataEntity()??>-->
<#assign nodePSDataEntity=deLogicNode.getDstPSDataEntity()> <#--<#assign nodePSDataEntity=deLogicNode.getDstPSDataEntity()>-->
<#if !P.exists("Autowired",nodePSDataEntity.getCodeName(),"service")> <#--<#if !P.exists("Autowired",nodePSDataEntity.getCodeName(),"service")>-->
@Autowired <#--@Autowired-->
private ${pub.getPKGCodeName()}.core.${nodePSDataEntity.getPSSystemModule().codeName?lower_case}.service.I${nodePSDataEntity.codeName}Service ${deLogicNode.getDstPSDataEntity().getCodeName()?lower_case}service; <#--private ${pub.getPKGCodeName()}.core.${nodePSDataEntity.getPSSystemModule().codeName?lower_case}.service.I${nodePSDataEntity.codeName}Service ${deLogicNode.getDstPSDataEntity().getCodeName()?lower_case}service;-->
public ${pub.getPKGCodeName()}.core.${nodePSDataEntity.getPSSystemModule().codeName?lower_case}.service.I${nodePSDataEntity.codeName}Service get${deLogicNode.getDstPSDataEntity().getCodeName()?lower_case?cap_first}Service() { <#--public ${pub.getPKGCodeName()}.core.${nodePSDataEntity.getPSSystemModule().codeName?lower_case}.service.I${nodePSDataEntity.codeName}Service get${deLogicNode.getDstPSDataEntity().getCodeName()?lower_case?cap_first}Service() {-->
return this.${deLogicNode.getDstPSDataEntity().getCodeName()?lower_case}service; <#--return this.${deLogicNode.getDstPSDataEntity().getCodeName()?lower_case}service;-->
} <#--}-->
</#if> <#--</#if>-->
</#if> <#--</#if>-->
<#comment>启动工作流</#comment> <#--<#comment>启动工作流</#comment>-->
<#if deLogicNode.getLogicNodeType()=='STARTWF'> <#--<#if deLogicNode.getLogicNodeType()=='STARTWF'>-->
<#assign startWF=true> <#--<#assign startWF=true>-->
<#if !P.exists("delogic","wfclient")> <#--<#if !P.exists("delogic","wfclient")>-->
@Autowired <#--@Autowired-->
${pub.getPKGCodeName()}.util.client.IBZWFFeignClient wfClient; <#--${pub.getPKGCodeName()}.util.client.IBZWFFeignClient wfClient;-->
</#if> <#--</#if>-->
</#if> <#--</#if>-->
</#list> <#--</#list>-->
</#if> <#--</#if>-->
<#comment>注入当前实体的service对象,供自定义查询使用</#comment> <#--<#comment>注入当前实体的service对象,供自定义查询使用</#comment>-->
@Autowired <#--@Autowired-->
private ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().codeName?lower_case}.service.I${de.codeName}Service iBzSysDefaultService; <#--private ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().codeName?lower_case}.service.I${de.codeName}Service iBzSysDefaultService;-->
public ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().codeName?lower_case}.service.I${de.codeName}Service getIBzSysDefaultService() { <#--public ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().codeName?lower_case}.service.I${de.codeName}Service getIBzSysDefaultService() {-->
return this.iBzSysDefaultService; <#--return this.iBzSysDefaultService;-->
} <#--}-->
@Override <#--@Override-->
public void execute(${de.codeName} et) { <#--public void execute(${de.codeName} et) {-->
KieSession kieSession = null; <#--KieSession kieSession = null;-->
try { <#--try {-->
kieSession = kieContainer.newKieSession(); <#--kieSession = kieContainer.newKieSession();-->
<#comment>插入逻辑参数</#comment> <#--<#comment>插入逻辑参数</#comment>-->
<#if item.getPSDELogicParams?? && item.getPSDELogicParams()??> <#--<#if item.getPSDELogicParams?? && item.getPSDELogicParams()??>-->
<#assign logicName=(de.codeName+item.codeName)?lower_case> <#--<#assign logicName=(de.codeName+item.codeName)?lower_case>-->
<#list item.getPSDELogicParams() as logicParam> <#--<#list item.getPSDELogicParams() as logicParam>-->
<#assign paramObj=(logicName+logicParam.codeName)?lower_case> <#--<#assign paramObj=(logicName+logicParam.codeName)?lower_case>-->
<#assign paramObjValue=(logicName+logicParam.codeName)?lower_case> <#--<#assign paramObjValue=(logicName+logicParam.codeName)?lower_case>-->
<#if logicParam.isDefault()==true><#comment>默认变量</#comment> <#--<#if logicParam.isDefault()==true><#comment>默认变量</#comment>-->
<#assign paramObjValue="et"> <#--<#assign paramObjValue="et">-->
<#elseif logicParam.getParamPSDataEntity?? && logicParam.getParamPSDataEntity()??> <#--<#elseif logicParam.getParamPSDataEntity?? && logicParam.getParamPSDataEntity()??>-->
<#assign ParamPSDataEntity=logicParam.getParamPSDataEntity()> <#--<#assign ParamPSDataEntity=logicParam.getParamPSDataEntity()>-->
${pub.getPKGCodeName()}.core.${ParamPSDataEntity.getPSSystemModule().codeName?lower_case}.domain.${ParamPSDataEntity.codeName} ${(logicName+logicParam.codeName)?lower_case} = new ${pub.getPKGCodeName()}.core.${ParamPSDataEntity.getPSSystemModule().codeName?lower_case}.domain.${ParamPSDataEntity.codeName}(); <#--${pub.getPKGCodeName()}.core.${ParamPSDataEntity.getPSSystemModule().codeName?lower_case}.domain.${ParamPSDataEntity.codeName} ${(logicName+logicParam.codeName)?lower_case} = new ${pub.getPKGCodeName()}.core.${ParamPSDataEntity.getPSSystemModule().codeName?lower_case}.domain.${ParamPSDataEntity.codeName}();-->
<#else> <#--<#else>-->
Map ${(logicName+logicParam.codeName)?lower_case} = new HashMap(); <#--Map ${(logicName+logicParam.codeName)?lower_case} = new HashMap();-->
</#if> <#--</#if>-->
kieSession.insert(${paramObjValue}); <#comment>将逻辑参数存储到fact</#comment> <#--kieSession.insert(${paramObjValue}); <#comment>将逻辑参数存储到fact</#comment>-->
kieSession.setGlobal("${paramObj}", ${paramObjValue});<#comment>将逻辑参数存储到global</#comment> <#--kieSession.setGlobal("${paramObj}", ${paramObjValue});<#comment>将逻辑参数存储到global</#comment>-->
</#list> <#--</#list>-->
</#if> <#--</#if>-->
<#comment>插入处理逻辑中所用到的service对象</#comment> <#--<#comment>插入处理逻辑中所用到的service对象</#comment>-->
<#if item.getPSDELogicNodes?? && item.getPSDELogicNodes()??> <#--<#if item.getPSDELogicNodes?? && item.getPSDELogicNodes()??>-->
<#list item.getPSDELogicNodes() as deLogicNode> <#--<#list item.getPSDELogicNodes() as deLogicNode>-->
<#if deLogicNode.getDstPSDataEntity?? && deLogicNode.getDstPSDataEntity()??> <#--<#if deLogicNode.getDstPSDataEntity?? && deLogicNode.getDstPSDataEntity()??>-->
<#if !P.exists(item.codeName,"kieSessionGlobalService",deLogicNode.getDstPSDataEntity().getCodeName()?lower_case)> <#--<#if !P.exists(item.codeName,"kieSessionGlobalService",deLogicNode.getDstPSDataEntity().getCodeName()?lower_case)>-->
kieSession.setGlobal("${deLogicNode.getDstPSDataEntity().getCodeName()?lower_case}service", ${deLogicNode.getDstPSDataEntity().getCodeName()?lower_case}service);<#comment>将逻辑中引用到的service存储到global</#comment> <#--kieSession.setGlobal("${deLogicNode.getDstPSDataEntity().getCodeName()?lower_case}service", ${deLogicNode.getDstPSDataEntity().getCodeName()?lower_case}service);<#comment>将逻辑中引用到的service存储到global</#comment>-->
</#if> <#--</#if>-->
</#if> <#--</#if>-->
</#list> <#--</#list>-->
</#if> <#--</#if>-->
<#comment>插入当前实体的defaultService对象,供自定义查询使用</#comment> <#--<#comment>插入当前实体的defaultService对象,供自定义查询使用</#comment>-->
kieSession.setGlobal("iBzSys${de.codeName?lower_case?cap_first}DefaultService", iBzSysDefaultService);<#comment>将逻辑中引用到的service存储到global</#comment> <#--kieSession.setGlobal("iBzSys${de.codeName?lower_case?cap_first}DefaultService", iBzSysDefaultService);<#comment>将逻辑中引用到的service存储到global</#comment>-->
kieSession.setGlobal("curuser", ${pub.getPKGCodeName()}.util.security.AuthenticationUser.getAuthenticationUser()); <#--kieSession.setGlobal("curuser", ${pub.getPKGCodeName()}.util.security.AuthenticationUser.getAuthenticationUser());-->
<#comment>插入wfclient</#comment> <#--<#comment>插入wfclient</#comment>-->
<#if startWF> <#--<#if startWF>-->
kieSession.setGlobal("wfClient", wfClient); <#--kieSession.setGlobal("wfClient", wfClient);-->
</#if> <#--</#if>-->
kieSession.startProcess("${pub.getPKGCodeName()}.core.${de.getPSSystemModule().codeName?lower_case}.service.logic.${de.codeName?lower_case}${item.getCodeName()?lower_case}");<#comment>执行所要执行的流程</#comment> <#--kieSession.startProcess("${pub.getPKGCodeName()}.core.${de.getPSSystemModule().codeName?lower_case}.service.logic.${de.codeName?lower_case}${item.getCodeName()?lower_case}");<#comment>执行所要执行的流程</#comment>-->
} catch (Exception e) { <#--} catch (Exception e) {-->
throw new RuntimeException("执行[${item.getName()}]处理逻辑发生异常" + e); <#--throw new RuntimeException("执行[${item.getName()}]处理逻辑发生异常" + e);-->
<#--throw new BadRequestAlertException(""+e,"","");--> <#--&lt;#&ndash;throw new BadRequestAlertException(""+e,"","");&ndash;&gt;-->
} finally { <#--} finally {-->
if(kieSession != null) { <#--if(kieSession != null) {-->
kieSession.destroy(); <#--kieSession.destroy();-->
} <#--}-->
} <#--}-->
} <#--}-->
} }
</#if> </#if>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册