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

动态实例标记

上级 3db5640e
......@@ -172,33 +172,12 @@ 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("获取动态模型标识失败","","");
}
String dynaModelId = getDynaModelId(null,null);
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) {
private String getDynaModelId(String instTag , String instTag2){
String orgId = null;
String systemId = null;
if(RequestContextHolder.getRequestAttributes()==null && !(RequestContextHolder.getRequestAttributes() instanceof ServletRequestAttributes)){
......@@ -217,10 +196,22 @@ public class WFCoreService
if(StringUtils.isEmpty(orgId) || StringUtils.isEmpty(systemId)){
throw new BadRequestAlertException("无法获取当前用户组织及系统信息","","");
}
String dynaModelId = rtProxy.getDynaModelId(module, moduletag, orgId, systemId);
String dynaModelId = null;
if(StringUtils.isEmpty(instTag) && StringUtils.isEmpty(instTag2)){
dynaModelId = rtProxy.getDynaModelId(orgId, systemId);
}
else{
dynaModelId = rtProxy.getDynaModelId(instTag, instTag2, orgId, systemId);
}
if(StringUtils.isEmpty(dynaModelId)){
throw new BadRequestAlertException("获取动态模型标识失败","","");
}
return dynaModelId;
}
public List<WFProcessDefinition> getDynamicWorkflow(String instTag,String instTag2, String system,String appname,String entity) {
String dynaModelId = getDynaModelId(instTag, instTag2);
return StringUtils.isEmpty(dynaModelId)? new ArrayList<>() : wfModelService.getDynamicWorkflow(dynaModelId,system,entity);
}
......@@ -464,16 +455,18 @@ public class WFCoreService
return "";
}
public Map<String, Map<String,Object>> getDynaBusinessKeys(String system, String appname, String entity, String dynainstid, String userId , TaskType type) {
public Map<String, Map<String,Object>> getDynaBusinessKeys(String system, String appname, String entity, String instTag , String instTag2, String userId , TaskType type) {
Map<String, Map<String,Object>> businessKeys = new HashMap<>();
Page<WFTask> tasks;
if(StringUtils.isEmpty(userId))
userId=AuthenticationUser.getAuthenticationUser().getUserid();
if(StringUtils.isEmpty(userId) && StringUtils.isEmpty(dynainstid))
String dynaModelId = getDynaModelId(instTag,instTag2);
if(StringUtils.isEmpty(userId) && StringUtils.isEmpty(dynaModelId))
return businessKeys;
WFTaskSearchContext context =new WFTaskSearchContext();
List<String> keys = this.getDynaWorkflowKey(dynainstid,system,appname,entity);
List<String> keys = this.getDynaWorkflowKey(dynaModelId,system,appname,entity);
if(ObjectUtils.isEmpty(keys)){
return businessKeys;
}
......
......@@ -55,10 +55,10 @@ public class WFCoreResource
}
@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,
@RequestMapping(method = RequestMethod.GET, value = "/{system}-app-{appname}/{insttag}/{insttag2}/{entity}/process-definitions")
public ResponseEntity<List<WFProcessDefinition>> getDynaWorkflow2(@PathVariable("system") String system ,@PathVariable("appname") String appname,@PathVariable("insttag") String instTag, @PathVariable("insttag2") String instTag2,
@PathVariable("entity") String entity) {
return ResponseEntity.status(HttpStatus.OK).body(wfCoreService.getDynamicWorkflow(module,moduletag,system,appname,entity));
return ResponseEntity.status(HttpStatus.OK).body(wfCoreService.getDynamicWorkflow(instTag,instTag2,system,appname,entity));
}
......@@ -71,31 +71,31 @@ public class WFCoreResource
}
@ApiOperation(value = "getBusinessKeys", tags = {"String" }, notes = "根据动态实例查询我的待办主键清单")
@RequestMapping(method = RequestMethod.POST, value = "/{system}-user-{userId}/{dynainstid}/{entity}/tasks")
@RequestMapping(method = RequestMethod.POST, value = "/{system}-user-{userId}/{insttag}/{insttag2}/{entity}/tasks")
public ResponseEntity<Map<String,Map<String,Object>>> getTaskByUserId(@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, TaskType.WORK));
@PathVariable("entity") String entity, @PathVariable("insttag") String instTag , @PathVariable("insttag2") String instTag2) {
return ResponseEntity.status(HttpStatus.OK).body(wfCoreService.getDynaBusinessKeys(system,"",entity,instTag,instTag2,userId, TaskType.WORK));
}
@ApiOperation(value = "getBusinessKeys", tags = {"String" }, notes = "根据流程步骤查询我的待阅主键清单")
@RequestMapping(method = RequestMethod.POST, value = "/{system}-user-{userId}/{dynainstid}/{entity}/tasks/unread")
@RequestMapping(method = RequestMethod.POST, value = "/{system}-user-{userId}/{insttag}/{insttag2}/{entity}/tasks/unread")
public ResponseEntity<Map<String,Map<String,Object>>> getUnReadTaskByUserId(@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, TaskType.READ));
@PathVariable("entity") String entity, @PathVariable("insttag") String instTag , @PathVariable("insttag2") String instTag2) {
return ResponseEntity.status(HttpStatus.OK).body(wfCoreService.getDynaBusinessKeys(system,"",entity,instTag,instTag2,userId, TaskType.READ));
}
@ApiOperation(value = "getBusinessKeys", tags = {"String" }, notes = "根据流程步骤查询我的已办主键清单")
@RequestMapping(method = RequestMethod.POST, value = "/{system}-user-{userId}/{dynainstid}/{entity}/tasks/done")
@RequestMapping(method = RequestMethod.POST, value = "/{system}-user-{userId}/{insttag}/{insttag2}/{entity}/tasks/done")
public ResponseEntity<Map<String,Map<String,Object>>> getDoneByUserId(@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, TaskType.DONE));
@PathVariable("entity") String entity, @PathVariable("insttag") String instTag , @PathVariable("insttag2") String instTag2) {
return ResponseEntity.status(HttpStatus.OK).body(wfCoreService.getDynaBusinessKeys(system,"",entity,instTag,instTag2,userId, TaskType.DONE));
}
@ApiOperation(value = "getBusinessKeys", tags = {"String" }, notes = "根据流程步骤查询我的办结主键清单")
@RequestMapping(method = RequestMethod.POST, value = "/{system}-user-{userId}/{dynainstid}/{entity}/tasks/finish")
@RequestMapping(method = RequestMethod.POST, value = "/{system}-user-{userId}/{insttag}/{insttag2}/{entity}/tasks/finish")
public ResponseEntity<Map<String,Map<String,Object>>> getFinishByUserId(@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, TaskType.FINISH));
@PathVariable("entity") String entity, @PathVariable("insttag") String instTag , @PathVariable("insttag2") String instTag2) {
return ResponseEntity.status(HttpStatus.OK).body(wfCoreService.getDynaBusinessKeys(system,"",entity,instTag,instTag2,userId, TaskType.FINISH));
}
@ApiOperation(value = "标记任务已读", tags = {"工作流标记任务已读" }, notes = "标记任务已读")
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册