提交 8670b119 编写于 作者: lengyu's avatar lengyu

dynamic wf

上级 fd1f2ea1
......@@ -160,6 +160,13 @@ public class WFCoreService
return definitionKeys;
}
public List<String> getDynaWorkflowKey(String dynainstid,String system,String appname,String entity) {
List<String> definitionKeys=new ArrayList<>();
for(WFProcessDefinition wfdef:wfModelService.getDynamicWorkflow(dynainstid,system,entity))
definitionKeys.add(wfdef.getDefinitionkey());
return definitionKeys;
}
public List<WFProcessNode> getWFStep(String system,String appname, String entity) {
List<WFProcessNode> rt=new ArrayList<>();
for(WFProcessDefinition wfdef:wfModelService.getWorkflow(system,entity)) {
......@@ -383,6 +390,36 @@ public class WFCoreService
return "";
}
public Map<String, Map<String,Object>> getDynaBusinessKeys(String system, String appname, String entity, String dynainstid, String userId) {
Map<String, Map<String,Object>> businessKeys = new HashMap<>();
if(StringUtils.isEmpty(userId))
userId=AuthenticationUser.getAuthenticationUser().getUserid();
if(StringUtils.isEmpty(userId) && StringUtils.isEmpty(dynainstid))
return businessKeys;
WFTaskSearchContext context =new WFTaskSearchContext();
List<String> keys = this.getDynaWorkflowKey(dynainstid,system,appname,entity);
if(!ObjectUtils.isEmpty(keys)){
context.getSearchCond().in("DefinitionKey",keys);
}
Page<WFTask> tasks = searchMyTask(context);
if(!ObjectUtils.isEmpty(tasks)){
for(WFTask task:tasks.getContent()) {
Object key=task.getProcessinstancebusinesskey();
if(key!=null) {
String str=key.toString();
if(str.indexOf(":k-")>0)
str=str.split(":k-")[1];
Map<String,Object> params = new HashMap();
params.put("srfprocessdefinitionkey",task.getProcessdefinitionkey());
params.put("srftaskdefinitionkey",task.getTaskdefinitionkey());
businessKeys.put(str,params);
}
}
}
return businessKeys;
}
public List<String> getBusinessKeys(String system,String appname, String entity,String processDefinitionKey,String taskDefinitionKey,String userId)
{
List<String> businessKeys = new ArrayList<>();
......@@ -899,7 +936,6 @@ public class WFCoreService
for(String booking:bookings.split(","))
{
String processDefinitionKey;
if(!StringUtils.isEmpty(dynainstid))
processDefinitionKey="dyna-"+dynainstid+"-"+system+"-"+booking+"-"+params[1];
else
......@@ -1231,7 +1267,6 @@ public class WFCoreService
}
}
}
return strUsers;
}
......
package cn.ibizlab.api.rest.extensions;
import cn.ibizlab.api.dto.WFTaskDTO;
import cn.ibizlab.api.mapping.WFGroupMapping;
import cn.ibizlab.api.mapping.WFTaskMapping;
import cn.ibizlab.core.workflow.domain.*;
import cn.ibizlab.core.workflow.extensions.service.WFCoreService;
import cn.ibizlab.core.workflow.filter.WFTaskSearchContext;
import cn.ibizlab.core.workflow.service.IWFTaskService;
import cn.ibizlab.util.errors.BadRequestAlertException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -14,7 +11,6 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
......@@ -23,7 +19,6 @@ import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
......@@ -51,11 +46,18 @@ public class WFCoreResource
@Lazy
public WFTaskMapping wfTaskMapping;
@ApiOperation(value = "getWFProcessDefinition", tags = {"WFProcessDefinition" }, notes = "根据系统实体查找当前适配的工作流模型")
@ApiOperation(value = "getWFProcessDefinition", tags = {"WFProcessDefinition" }, notes = "根据动态实例查找当前适配的工作流模型")
@RequestMapping(method = RequestMethod.GET, value = "/{system}-app-{appname}/{dynainstid}/{entity}/process-definitions")
public ResponseEntity<List<WFProcessDefinition>> getDynaWorkflow(@PathVariable("system") String system ,@PathVariable("appname") String appname,@PathVariable("dynainstid") String dynamic,
public ResponseEntity<List<WFProcessDefinition>> getDynaWorkflow(@PathVariable("system") String system ,@PathVariable("appname") String appname,@PathVariable("dynainstid") String dynainstid,
@PathVariable("entity") String entity) {
return ResponseEntity.status(HttpStatus.OK).body(wfCoreService.getDynamicWorkflow(dynamic,system,appname,entity));
return ResponseEntity.status(HttpStatus.OK).body(wfCoreService.getDynamicWorkflow(dynainstid,system,appname,entity));
}
@ApiOperation(value = "getBusinessKeys", tags = {"String" }, notes = "根据动态实例查询我的待办主键清单")
@RequestMapping(method = RequestMethod.POST, value = "/{system}-user-{userId}/{dynainstid}/{entity}/tasks")
public ResponseEntity<Map<String,Map<String,Object>>> getDynaBusinesskeysByUserId(@PathVariable("system") String system, @PathVariable("userId") String userId,
@PathVariable("entity") String entity, @PathVariable("dynainstid") String dynainstid) {
return ResponseEntity.status(HttpStatus.OK).body(wfCoreService.getDynaBusinessKeys(system,"",entity,dynainstid,userId));
}
@ApiOperation(value = "getWFProcessDefinition", tags = {"WFProcessDefinition" }, notes = "根据系统实体查找当前适配的工作流模型")
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册