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

工作流启动

上级 a0fcf3c4
......@@ -7,6 +7,7 @@ import cn.ibizlab.core.workflow.mapper.WFCoreMapper;
import cn.ibizlab.core.workflow.service.IWFGroupService;
import cn.ibizlab.core.workflow.service.IWFProcessDefinitionService;
import cn.ibizlab.core.workflow.service.IWFUserService;
import cn.ibizlab.util.client.IBZRTProxyFeignClient;
import cn.ibizlab.util.client.IBZUAAFeignClient;
import cn.ibizlab.util.enums.ProcFunction;
import cn.ibizlab.util.enums.TaskType;
......@@ -134,6 +135,9 @@ public class WFCoreService
@Autowired
private IBZUAAFeignClient ibzuaaFeignClient;
@Autowired
private IBZRTProxyFeignClient rtProxy;
private Map<String,List<Map<String,Object>>> taskMap = new ConcurrentHashMap<>();
private final ExpressionParser parser = new SpelExpressionParser();
......@@ -167,6 +171,59 @@ public class WFCoreService
}
public List<WFProcessDefinition> getDynamicWorkflow(String system,String appname,String entity) {
String orgId = null;
String systemId = null;
if(RequestContextHolder.getRequestAttributes()==null && !(RequestContextHolder.getRequestAttributes() instanceof ServletRequestAttributes)){
return null;
}
ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
if(requestAttributes!=null) {
HttpServletRequest request = requestAttributes.getRequest();
if(request!=null && !StringUtils.isEmpty(request.getHeader("srforgid"))){
orgId= request.getHeader("srforgid");
}
if(request!=null && !StringUtils.isEmpty(request.getHeader("srfsystemid"))){
systemId= request.getHeader("srfsystemid");
}
}
if(StringUtils.isEmpty(orgId) || StringUtils.isEmpty(systemId)){
throw new BadRequestAlertException("无法获取当前用户组织及系统信息","","");
}
String dynaModelId = rtProxy.getDynaModelId(orgId, systemId);
if(StringUtils.isEmpty(dynaModelId)){
throw new BadRequestAlertException("获取动态模型标识失败","","");
}
return StringUtils.isEmpty(dynaModelId)? new ArrayList<>() : wfModelService.getDynamicWorkflow(dynaModelId,system,entity);
}
public List<WFProcessDefinition> getDynamicWorkflow(String module,String moduletag, String system,String appname,String entity) {
String orgId = null;
String systemId = null;
if(RequestContextHolder.getRequestAttributes()==null && !(RequestContextHolder.getRequestAttributes() instanceof ServletRequestAttributes)){
return null;
}
ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
if(requestAttributes!=null) {
HttpServletRequest request = requestAttributes.getRequest();
if(request!=null && !StringUtils.isEmpty(request.getHeader("srforgid"))){
orgId= request.getHeader("srforgid");
}
if(request!=null && !StringUtils.isEmpty(request.getHeader("srfsystemid"))){
systemId= request.getHeader("srfsystemid");
}
}
if(StringUtils.isEmpty(orgId) || StringUtils.isEmpty(systemId)){
throw new BadRequestAlertException("无法获取当前用户组织及系统信息","","");
}
String dynaModelId = rtProxy.getDynaModelId(module, moduletag, orgId, systemId);
if(StringUtils.isEmpty(dynaModelId)){
throw new BadRequestAlertException("获取动态模型标识失败","","");
}
return StringUtils.isEmpty(dynaModelId)? new ArrayList<>() : wfModelService.getDynamicWorkflow(dynaModelId,system,entity);
}
public List<WFProcessDefinition> getWorkflow(String system,String appname,String entity) {
return wfModelService.getWorkflow(system,entity);
}
......@@ -1086,6 +1143,8 @@ public class WFCoreService
String processDefinitionKey;
if(!StringUtils.isEmpty(dynainstid))
processDefinitionKey="dyna-"+dynainstid+"-"+system+"-"+booking+"-"+params[1];
else if (!StringUtils.isEmpty(bpmnFileName) && bpmnFileName.contains(":") && bpmnFileName.split(":").length==2)
processDefinitionKey="dyna-"+bpmnFileName.split(":")[1]+"-"+system+"-"+booking+"-"+params[1];
else
processDefinitionKey=system+"-"+booking+"-"+params[1];
......
......@@ -47,6 +47,22 @@ public class WFCoreResource
@Lazy
public WFTaskMapping wfTaskMapping;
@ApiOperation(value = "getWFProcessDefinition", tags = {"WFProcessDefinition" }, notes = "根据系统实体查找当前适配的工作流模型")
@RequestMapping(method = RequestMethod.GET, value = "/{system}-app-{appname}/{entity}/process-definitions2")
public ResponseEntity<List<WFProcessDefinition>> getDynaWorkflow(@PathVariable("system") String system,@PathVariable("appname") String appname,
@PathVariable("entity") String entity) {
return ResponseEntity.status(HttpStatus.OK).body(wfCoreService.getDynamicWorkflow(system,appname,entity));
}
@ApiOperation(value = "getWFProcessDefinition", tags = {"WFProcessDefinition" }, notes = "根据动态实例查找当前适配的工作流模型")
@RequestMapping(method = RequestMethod.GET, value = "/{system}-app-{appname}/{module}/{moduletag}/{entity}/process-definitions")
public ResponseEntity<List<WFProcessDefinition>> getDynaWorkflow2(@PathVariable("system") String system ,@PathVariable("appname") String appname,@PathVariable("module") String module, @PathVariable("moduletag") String moduletag,
@PathVariable("entity") String entity) {
return ResponseEntity.status(HttpStatus.OK).body(wfCoreService.getDynamicWorkflow(module,moduletag,system,appname,entity));
}
@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 dynainstid,
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册