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

工作流待阅

上级 8dc95b3b
......@@ -8,6 +8,7 @@ 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.IBZUAAFeignClient;
import cn.ibizlab.util.enums.TaskType;
import cn.ibizlab.util.errors.BadRequestAlertException;
import cn.ibizlab.util.helper.RuleUtils;
import cn.ibizlab.util.security.AuthTokenUtil;
......@@ -399,8 +400,9 @@ public class WFCoreService
return "";
}
public Map<String, Map<String,Object>> getDynaBusinessKeys(String system, String appname, String entity, String dynainstid, String userId) {
public Map<String, Map<String,Object>> getDynaBusinessKeys(String system, String appname, String entity, String dynainstid, 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))
......@@ -412,7 +414,10 @@ public class WFCoreService
return businessKeys;
}
context.getSearchCond().in("DefinitionKey",keys);
Page<WFTask> tasks = searchMyTask(context);
if(TaskType.READ == type)
tasks = searchMyTask(context);
else
tasks = searchMyUnreadTask(context);
if(!ObjectUtils.isEmpty(tasks)){
for(WFTask task:tasks.getContent()) {
Object key=task.getProcessinstancebusinesskey();
......@@ -430,6 +435,12 @@ public class WFCoreService
return businessKeys;
}
private Page<WFTask> searchMyUnreadTask(WFTaskSearchContext context) {
context.setSort("createtime,desc");
com.baomidou.mybatisplus.extension.plugins.pagination.Page<WFTask> pages=wfCoreMapper.searchUnReadTask(context.getPages(),context,context.getSelectCond());
return new PageImpl<WFTask>(pages.getRecords(), context.getPageable(), pages.getTotal());
}
public List<String> getBusinessKeys(String system,String appname, String entity,String processDefinitionKey,String taskDefinitionKey,String userId)
{
List<String> businessKeys = new ArrayList<>();
......@@ -1794,4 +1805,36 @@ public class WFCoreService
return signTask;
}
/**
* 标记任务为已读
* @param system
* @param appname
* @param entity
* @param businessKey
* @param taskId
* @param taskWay
*/
public boolean readTask(String system, String appname, String entity, String businessKey, String taskId, WFTaskWay taskWay) {
String userId="450000-0002";
if(StringUtils.isEmpty(userId))
throw new BadRequestAlertException("未传入当前用户",entity,businessKey);
if(StringUtils.isEmpty(taskId)){
taskId=taskWay.getTaskid();
}
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
if(ObjectUtils.isEmpty(task)){
throw new BadRequestAlertException("未找到运行时任务","","");
}
List<IdentityLink> identityLinks = taskService.getIdentityLinksForTask(taskId);
identityLinks.forEach(idl->{
if(userId.equals(idl.getUserId())){
Map map =new HashMap();
map.put("taskid",task.getId());
map.put("userid",userId);
wfCoreMapper.readTask(map);
return ;
}
});
return true;
}
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册