提交 6671b17d 编写于 作者: sq3536's avatar sq3536

工作流批量执行

上级 1afd2d0c
......@@ -228,6 +228,27 @@ public class WFCoreService
return new PageImpl<WFTask>(pages.getRecords(), context.getPageable(), pages.getTotal());
}
public List<WFTaskWay> getWFLinkByStep(String system,String appname,
String entity, String processDefinitionKey,String taskDefinitionKey) {
List<WFTaskWay> taskWays=new ArrayList<>();
if((!StringUtils.isEmpty(processDefinitionKey))&&(!StringUtils.isEmpty(taskDefinitionKey))) {
UserTask userTask = wfModelService.getModelStepByKey(processDefinitionKey).get(taskDefinitionKey);
if(userTask!=null&&userTask.getOutgoingFlows()!=null) {
for(SequenceFlow sequenceFlow:userTask.getOutgoingFlows()) {
WFTaskWay way=new WFTaskWay();
way.setSequenceflowid(sequenceFlow.getId());
way.setSequenceflowname(sequenceFlow.getName());
way.setProcessdefinitionkey(processDefinitionKey);
way.setTaskdefinitionkey(taskDefinitionKey);
taskWays.add(way);
}
}
}
return taskWays;
}
public String getTaskUrl(String type,String processDefinitionKey,String processInstanceId,String businessKey,String taskDefinitionKey)
{
JSONObject app = ibzuaaFeignClient.getAppSwitcher("default",AuthenticationUser.getAuthenticationUser().getUserid());
......
......@@ -68,6 +68,14 @@ public class WFCoreResource
return ResponseEntity.status(HttpStatus.OK).body(wfCoreService.getWFLink(system,appname,entity,businessKey,taskDefinitionKey));
}
@ApiOperation(value = "getWayByProcessDefinitionKey", tags = {"WFStepWay" }, notes = "根据流程和当前步骤获取操作路径")
@RequestMapping(method = RequestMethod.GET, value = "/{system}-app-{appname}/{entity}/process-definitions/{processDefinitionKey}/usertasks/{taskDefinitionKey}/ways")
public ResponseEntity<List<WFTaskWay>> getWayByDefKey(@PathVariable("system") String system,@PathVariable("appname") String appname,
@PathVariable("entity") String entity,
@PathVariable("processDefinitionKey") String processDefinitionKey,@PathVariable("taskDefinitionKey") String taskDefinitionKey) {
return ResponseEntity.status(HttpStatus.OK).body(wfCoreService.getWFLinkByStep(system,appname,entity,processDefinitionKey,taskDefinitionKey));
}
@ApiOperation(value = "getWayByTaskId", tags = {"WFTaskWay" }, notes = "根据业务主键和当前步骤获取操作路径")
@RequestMapping(method = RequestMethod.GET, value = "/{system}-app-{appname}/{entity}/{businessKey}/tasks/{taskId}/ways")
public ResponseEntity<List<WFTaskWay>> gettasklink(@PathVariable("system") String system,@PathVariable("appname") String appname,
......@@ -87,7 +95,7 @@ public class WFCoreResource
}
//@PreAuthorize("hasPermission(#entity,'WFSTART',this.getEntity())")
@ApiOperation(value = "wfsubmit", tags = {"WFProcessInstance" }, notes = "工作流执行步骤")
@ApiOperation(value = "wfsubmit", tags = {"Submit" }, notes = "工作流执行步骤")
@RequestMapping(method = RequestMethod.POST, value = "/{system}-app-{appname}/{entity}/{businessKey}/tasks/{taskId}")
public ResponseEntity<WFProcessInstance> wfsubmit(@PathVariable("system") String system,@PathVariable("appname") String appname,
@PathVariable("entity") String entity,
......@@ -97,6 +105,31 @@ public class WFCoreResource
return ResponseEntity.ok(wfCoreService.wfsubmit(system,appname,entity,businessKey,taskId,taskWay));
}
//@PreAuthorize("hasPermission(#entity,'WFSTART',this.getEntity())")
@ApiOperation(value = "wfsubmitbatch", tags = {"SubmitBatch" }, notes = "批量工作流执行步骤")
@RequestMapping(method = RequestMethod.POST, value = "/{system}-app-{appname}/{entity}/process-definitions/{processDefinitionKey}/usertasks/{taskDefinitionKey}/ways/{sequenceFlowId}/submit")
public ResponseEntity<Boolean> wfsubmit(@PathVariable("system") String system,@PathVariable("appname") String appname,
@PathVariable("entity") String entity,
@PathVariable("processDefinitionKey") String processDefinitionKey,@PathVariable("taskDefinitionKey") String taskDefinitionKey,
@PathVariable("sequenceFlowId") String sequenceFlowId,
@RequestBody List<Map> businessList) {
WFProcessInstance instance = new WFProcessInstance();
businessList.forEach(business -> {
if(business.get("srfkey")==null)
return;
String businessKey = business.get("srfkey").toString();
wfCoreService.getWFLink(system,appname,entity,businessKey,taskDefinitionKey).forEach(way ->{
if(way.getSequenceflowid().equals(sequenceFlowId))
{
way.set("activedata",business);
wfCoreService.wfsubmit(system,appname,entity,businessKey,way.getTaskid(),way);
}
});
});
return ResponseEntity.ok(true);
}
@ApiOperation(value = "getBusinessKeys", tags = {"String" }, notes = "根据流程步骤查询我的待办主键清单")
@RequestMapping(method = RequestMethod.GET, value = "/{system}-app-{appname}/{entity}/process-definitions/{processDefinitionKey}/usertasks/{taskDefinitionKey}/tasks")
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册