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

动态工作流

上级 b6669324
......@@ -66,6 +66,10 @@ TARGET=PSDATAENTITY
<#break>
</#list>
</#if>
<#assign isDynaSys =false>
<#if item.getDynaInstMode()?? && (item.getDynaInstMode()?c=='1' || item.getDynaInstMode()?c=='2' )>
<#assign isDynaSys =true>
</#if>
<#assign isDupCheck=isDupCheckEntity(de)>
<#assign keyfield=de.getKeyPSDEField()>
<#assign keyfieldPrivateCodeName = srfcaseformat(keyfield.getCodeName(),'l_u2lC') >
......@@ -673,17 +677,24 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa
*/
@Override
public Page<<#if dedataset.isEnableGroup()>Map<#else>${item.getCodeName()}</#if>> search${dedataset.getCodeName()}(${item.getCodeName()}SearchContext context) {
<#if item.isEnableSQLStorage() && item.getAllPSDEDBTables()??>
<#--<#list item.getAllPSDEDBTables() as detable>-->
<#if de.hasPSDEWF()==true>
<#if item.isEnableSQLStorage() && item.getAllPSDEDBTables()??>
<#--<#list item.getAllPSDEDBTables() as detable>-->
<#if de.hasPSDEWF()==true>
<#if isDynaSys>
Map<String,Map<String,Object>> businesskeys = fillWFTaskContext(context);
<#else>
fillWFTaskContext(context);
</#if>
</#if>
</#if>
com.baomidou.mybatisplus.extension.plugins.pagination.Page<<#if dedataset.isEnableGroup()>Map<#else>${item.getCodeName()}</#if>> pages=baseMapper.search${dedataset.getCodeName()}(context.getPages(),context,context.getSelectCond());
<#if de.hasPSDEWF()==true && isDynaSys>
fillWFParam(pages,businesskeys);
</#if>
return new PageImpl<<#if dedataset.isEnableGroup()>Map<#else>${item.getCodeName()}</#if>>(pages.getRecords(), context.getPageable(), pages.getTotal());
<#--</#list>-->
<#else>
<#--</#list>-->
<#else>
return null ;
</#if>
</#if>
}
</#if>
......@@ -700,8 +711,41 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa
* 查询工作流待办
* @param context
*/
private void fillWFTaskContext(${item.getCodeName()}SearchContext context){
<#if isDynaSys>
private Map<String,Map<String,Object>> fillWFTaskContext(${item.getCodeName()}SearchContext context){
Map<String, Map<String, Object>> businessKeys = null;
if (!StringUtils.isEmpty(context.getSrfDynaInstId())) {
businessKeys= ibzwfFeignClient.getDynaBusinesskeysByUserId("${sys.getCodeName()?lower_case}", ${pub.getPKGCodeName()}.util.security.AuthenticationUser.getAuthenticationUser().getUserid(),"${entityName}", context.getSrfDynaInstId());
if(!ObjectUtils.isEmpty(businessKeys)){
context.getSelectCond().in("${keyfield.name?lower_case}",businessKeys.keySet());
}
else{
context.getSelectCond().apply("1<>1");
}
}
return businessKeys;
}
/**
* 填充工作流参数
* @param pages
* @param businesskeys
*/
private void fillWFParam(com.baomidou.mybatisplus.extension.plugins.pagination.Page<${item.getCodeName()}> pages, Map<String, Map<String, Object>> businesskeys) {
if (!ObjectUtils.isEmpty(businesskeys)) {
for (${item.getCodeName()} entity : pages.getRecords()) {
Object id = entity.get${srfcaseformat(keyfield.getCodeName(),'l_u2lC')?cap_first}();
if (!ObjectUtils.isEmpty(id) && businesskeys.containsKey(id)) {
Map<String, Object> params = businesskeys.get(id);
for (Map.Entry<String, Object> entry : params.entrySet()) {
entity.set(entry.getKey(), entry.getValue());
}
}
}
}
}
<#else>
private void fillWFTaskContext(${item.getCodeName()}SearchContext context){
if(!StringUtils.isEmpty(context.getUserTaskId()) && !StringUtils.isEmpty(context.getProcessDefinitionKey())){
List<String> businessKeys= ibzwfFeignClient.getbusinesskeysByUserId("${sys.getCodeName()?lower_case}", ${pub.getPKGCodeName()}.util.security.AuthenticationUser.getAuthenticationUser().getUserid(),"${entityName}",context.getProcessDefinitionKey(),context.getUserTaskId());
if(businessKeys.size()>0){
......@@ -713,6 +757,7 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa
}
}
</#if>
</#if>
<#comment>为当前实体填充父数据(外键值文本、外键值附加数据)</#comment>
<#if hasMinorPSDERs gt 0>
......
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
<#assign isDynaSys =false>
<#if sys.getAllPSSystemModules()??>
<#list sys.getAllPSSystemModules() as module>
<#if module.getDynaInstMode()?? && (module.getDynaInstMode()?c=='1' || module.getDynaInstMode()?c=='2' )>
<#assign isDynaSys =true>
<#break>
</#if>
</#list>
</#if>
package ${pub.getPKGCodeName()}.util.client;
import org.springframework.stereotype.Component;
......@@ -29,4 +38,11 @@ public class IBZWFFallback implements IBZWFFeignClient {
public JSONObject wfstart(String system, String appname, String entity, String businessKey, JSONObject instance) {
return null;
}
<#if isDynaSys>
@Override
public Map<String, Map<String, Object>> getDynaBusinesskeysByUserId(String system, String userId, String entity, String dynainstid) {
return null;
}
</#if>
}
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
<#assign isDynaSys =false>
<#if sys.getAllPSSystemModules()??>
<#list sys.getAllPSSystemModules() as module>
<#if module.getDynaInstMode()?? && (module.getDynaInstMode()?c=='1' || module.getDynaInstMode()?c=='2' )>
<#assign isDynaSys =true>
<#break>
</#if>
</#list>
</#if>
package ${pub.getPKGCodeName()}.util.client;
import org.springframework.cloud.openfeign.FeignClient;
......@@ -27,4 +36,9 @@ public interface IBZWFFeignClient
JSONObject wfstart(@PathVariable("system") String system, @PathVariable("appname") String appname,
@PathVariable("entity") String entity,
@PathVariable("businessKey") String businessKey, @RequestBody JSONObject instance);
<#if isDynaSys>
@RequestMapping(method = RequestMethod.POST, value = "/{system}-user-{userId}/{entity}/{dynainstid}/tasks")
Map<String,Map<String,Object>> getDynaBusinesskeysByUserId(@PathVariable("system") String system,@PathVariable("userId") String userId,
@PathVariable("entity") String entity,@PathVariable("dynainstid") String dynainstid);
</#if>
}
......@@ -8,6 +8,15 @@ TARGET=PSSYSTEM
<#break>
</#if>
</#list>
<#assign isDynaSys =false>
<#if sys.getAllPSSystemModules()??>
<#list sys.getAllPSSystemModules() as module>
<#if module.getDynaInstMode()?? && (module.getDynaInstMode()?c=='1' || module.getDynaInstMode()?c=='2' )>
<#assign isDynaSys =true>
<#break>
</#if>
</#list>
</#if>
package ${pub.getPKGCodeName()}.util.filter;
import ${pub.getPKGCodeName()}.util.security.AuthenticationUser;
......@@ -86,6 +95,23 @@ public class SearchContextBase implements ISearchContext{
*/
public BoolQueryBuilder esCond=new BoolQueryBuilder();
</#if>
<#if isDynaSys>
/**
* 动态实例标识
*/
@JsonProperty("srfdynainstid")
public String srfDynaInstId;
public String getSrfDynaInstId() {
if(StringUtils.isEmpty(srfDynaInstId)){
Object dynainstid=params.get("srfdynainstid");
return StringUtils.isEmpty(dynainstid)?null:String.valueOf(dynainstid);
}
else{
return srfDynaInstId;
}
}
</#if>
/**
* 获取工作流步骤标识
*/
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册