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

处理逻辑启动工作流

上级 955f2a66
<#ibiztemplate>
TARGET=PSDELOGIC
</#ibiztemplate>
<#assign startWF=false>
package ${pub.getPKGCodeName()}.core.${item.getPSDataEntity().getPSSystemModule().getCodeName()?lower_case}.service.logic.impl;
import java.sql.Timestamp;
......@@ -42,6 +43,15 @@ public class ${de.codeName}${item.codeName}LogicImpl implements I${de.codeName}$
return this.${deLogicNode.getDstPSDataEntity().getCodeName()?lower_case}service;
}
</#if>
</#if>
<#comment>启动工作流</#comment>
<#if deLogicNode.getLogicNodeType()=='STARTWF'>
<#assign startWF=true>
<#if !P.exists("delogic","wfclient")>
@Autowired
${pub.getPKGCodeName()}.util.client.IBZWFFeignClient wfClient;
</#if>
</#if>
</#list>
......@@ -91,6 +101,10 @@ public class ${de.codeName}${item.codeName}LogicImpl implements I${de.codeName}$
<#comment>插入当前实体的defaultService对象,供自定义查询使用</#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());
<#comment>插入wfclient</#comment>
<#if startWF>
kieSession.setGlobal("wfclient",wfClient);
</#if>
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){
......
......@@ -161,7 +161,14 @@ ruleflow-group "${logicName+deLogicNode.getCodeName()?lower_case}"
}
</#if>
}
</#if>
<#elseif deLogicNode.getLogicNodeType()=='STARTWF'><#comment>启动工作流</#comment>
<#assign wfDE=deLogicNode.getPSDEWF().getPSDataEntity()>
<#assign wfDEKeyField=srfcaseformat(wfDE.getKeyPSDEField().codeName,'l_u2lC')>
<#assign wfParam=deLogicNode.getDstPSDELogicParam>
<#assign wfLogicParam=(logicName+wfParam.codeName)?lower_case>
JSONObject activeData=(JSONObject) JSONObject.toJSON(${wfLogicParam});
wfClient.wfstart("${sys.codeName}","","${wfDE.codeName}",${wfLogicParam}.get("${wfDEKeyField}"),activeData);
</#if>
<#if delogic.getPSDELogicParams?? && delogic.getPSDELogicParams()??>
<#list delogic.getPSDELogicParams() as logicParam>
update(${logicName+logicParam.codeName?lower_case});//更新fact中变量值
......
......@@ -4,6 +4,7 @@ TARGET=PSSYSTEM
package ${pub.getPKGCodeName()}.util.client;
import org.springframework.stereotype.Component;
import com.alibaba.fastjson.JSONObject;
import java.util.*;
@Component
......@@ -23,4 +24,9 @@ public class IBZWFFallback implements IBZWFFeignClient {
public Boolean deployBpmnFile(List<Map<String, Object>> bpmnfiles) {
return null;
}
@Override
public JSONObject wfstart(String system, String appname, String entity, String businessKey, JSONObject instance) {
return null;
}
}
......@@ -5,6 +5,7 @@ package ${pub.getPKGCodeName()}.util.client;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import com.alibaba.fastjson.JSONObject;
import java.util.*;
@FeignClient(value = "${r'${ibiz.ref.service.wf:ibzwf-api}'}",fallback = IBZWFFallback.class)
......@@ -21,4 +22,9 @@ public interface IBZWFFeignClient
@RequestMapping(method = RequestMethod.POST, value = "/deploybpmn")
Boolean deployBpmnFile(@RequestBody List<Map<String,Object>> bpmnfiles);
@RequestMapping(method = RequestMethod.POST, value = "/{system}-app-{appname}/{entity}/{businessKey}/process-instances")
JSONObject wfstart(@PathVariable("system") String system, @PathVariable("appname") String appname,
@PathVariable("entity") String entity,
@PathVariable("businessKey") String businessKey, @RequestBody JSONObject instance);
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册