|
@@ -142,6 +142,78 @@ public class ActTaskController {
|
|
|
return Result.ok(list);
|
|
|
}
|
|
|
|
|
|
+ public void show2(String taskId,String userId,String name,String categoryId, Integer priority, HttpServletRequest request,List<Task> taskList){
|
|
|
+ TaskQuery query = taskService.createTaskQuery().taskCandidateOrAssigned(userId);
|
|
|
+ query.taskId(taskId);
|
|
|
+ // 多条件搜索
|
|
|
+ query.orderByTaskPriority().desc();
|
|
|
+ query.orderByTaskCreateTime().desc();
|
|
|
+ if(StrUtil.isNotBlank(name)){
|
|
|
+ query.taskNameLike("%"+name+"%");
|
|
|
+ }
|
|
|
+ if(StrUtil.isNotBlank(categoryId)){
|
|
|
+ query.taskCategory(categoryId);
|
|
|
+ }
|
|
|
+ if(priority!=null){
|
|
|
+ query.taskPriority(priority);
|
|
|
+ }
|
|
|
+ String createTime_begin = request.getParameter("createTime_begin");
|
|
|
+ String createTime_end = request.getParameter("createTime_end");
|
|
|
+ if(StrUtil.isNotBlank(createTime_begin)&&StrUtil.isNotBlank(createTime_end)){
|
|
|
+ Date start = DateUtil.parse(createTime_begin);
|
|
|
+ Date end = DateUtil.parse(createTime_end);
|
|
|
+ query.taskCreatedAfter(start);
|
|
|
+ query.taskCreatedBefore(DateUtil.endOfDay(end));
|
|
|
+ }
|
|
|
+ taskList.addAll(query.list());
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping(value = "/todoGetByTaskId" )
|
|
|
+ public Result<Object> todoGetByTaskId(String taskId,String name, String categoryId, Integer priority, HttpServletRequest request){
|
|
|
+ List<TaskVo> list = new ArrayList<>();
|
|
|
+ LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
+ String userId = sysUser.getUsername();
|
|
|
+
|
|
|
+ List<Task> taskList = new ArrayList<>();
|
|
|
+ show2(taskId,sysUser.getUsername(),name,categoryId,priority,request,taskList);
|
|
|
+ show2(taskId,sysUser.getId(),name,categoryId,priority,request,taskList);
|
|
|
+ ListSort(taskList);
|
|
|
+ // 转换vo
|
|
|
+ taskList.forEach(e -> {
|
|
|
+ TaskVo tv = new TaskVo(e);
|
|
|
+
|
|
|
+ // 关联委托人
|
|
|
+ if(StrUtil.isNotBlank(tv.getOwner())){
|
|
|
+ String realname = sysBaseAPI.getUserByName(tv.getOwner()).getRealname();
|
|
|
+ tv.setOwner(realname);
|
|
|
+ }
|
|
|
+ List<IdentityLink> identityLinks = runtimeService.getIdentityLinksForProcessInstance(tv.getProcInstId());
|
|
|
+ for(IdentityLink ik : identityLinks){
|
|
|
+ // 关联发起人
|
|
|
+ if("starter".equals(ik.getType())&&StrUtil.isNotBlank(ik.getUserId())){
|
|
|
+ tv.setApplyer(sysBaseAPI.getUserByName(ik.getUserId()).getRealname());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 关联流程信息
|
|
|
+ ActZprocess actProcess = actZprocessService.getById(tv.getProcDefId());
|
|
|
+ if(actProcess!=null){
|
|
|
+ tv.setProcessName(actProcess.getName());
|
|
|
+ tv.setRouteName(actProcess.getRouteName());
|
|
|
+ }
|
|
|
+ // 关联业务key
|
|
|
+ ProcessInstance pi = runtimeService.createProcessInstanceQuery().processInstanceId(tv.getProcInstId()).singleResult();
|
|
|
+ tv.setBusinessKey(pi.getBusinessKey());
|
|
|
+ ActBusiness actBusiness = actBusinessService.getById(pi.getBusinessKey());
|
|
|
+ if(actBusiness!=null){
|
|
|
+ tv.setTableId(actBusiness.getTableId());
|
|
|
+ tv.setTableName(actBusiness.getTableName());
|
|
|
+ }
|
|
|
+
|
|
|
+ list.add(tv);
|
|
|
+ });
|
|
|
+ return Result.ok(list);
|
|
|
+ }
|
|
|
+
|
|
|
private static void ListSort(List<Task> list) {
|
|
|
Iterator<Task> iterator = list.iterator();
|
|
|
if(iterator.hasNext()){
|
|
@@ -221,8 +293,13 @@ public class ActTaskController {
|
|
|
actBusinessService.updateById(actBusiness);
|
|
|
// 异步发消息
|
|
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
+ //我的消息跳转地址
|
|
|
+ Map<String,Object> map =new HashMap<>();
|
|
|
+ map.put("isUrl","1");
|
|
|
+ map.put("url","/activiti/applyList");
|
|
|
+ map.put("taskId",id);
|
|
|
actZprocessService.sendMessage(sysUser,sysBaseAPI.getUserByName(actBusiness.getUserId()),ActivitiConstant.MESSAGE_BACK_CONTENT,
|
|
|
- String.format("您的 【%s】 申请已被驳回!",actBusiness.getTitle()),sendMessage, sendSms, sendEmail);
|
|
|
+ String.format("您的 【%s】 申请已被驳回!",actBusiness.getTitle()),sendMessage, sendSms, sendEmail,map);
|
|
|
// 记录实际审批人员
|
|
|
actBusinessService.insertHI_IDENTITYLINK(IdUtil.simpleUUID(),
|
|
|
ActivitiConstant.EXECUTOR_TYPE, sysUser.getUsername(), id, procInstId);
|
|
@@ -321,8 +398,12 @@ public class ActTaskController {
|
|
|
// 分配了节点负责人分发给全部
|
|
|
for (LoginUser user : users) {
|
|
|
taskService.addCandidateUser(t.getId(), user.getId());
|
|
|
+ Map<String,Object> map =new HashMap<>();
|
|
|
+ map.put("isUrl","1");
|
|
|
+ map.put("url","/activiti/applyList");
|
|
|
+ map.put("taskId",t.getId());
|
|
|
// 异步发消息
|
|
|
- actZprocessService.sendActMessage(loginUser,user,actBusiness,task.getName(), sendMessage, sendSms, sendEmail);
|
|
|
+ actZprocessService.sendActMessage(loginUser,user,actBusiness,task.getName(), sendMessage, sendSms, sendEmail,map);
|
|
|
}
|
|
|
taskService.setPriority(t.getId(), task.getPriority());
|
|
|
}
|
|
@@ -336,7 +417,11 @@ public class ActTaskController {
|
|
|
taskService.addCandidateUser(t.getId(), assignee);
|
|
|
// 异步发消息
|
|
|
LoginUser user = sysBaseAPI.getUserByName(assignee);
|
|
|
- actZprocessService.sendActMessage(loginUser,user,actBusiness,task.getName(), sendMessage, sendSms, sendEmail);
|
|
|
+ Map<String,Object> map =new HashMap<>();
|
|
|
+ map.put("isUrl","1");
|
|
|
+ map.put("url","/activiti/applyList");
|
|
|
+ map.put("taskId",t.getId());
|
|
|
+ actZprocessService.sendActMessage(loginUser,user,actBusiness,task.getName(), sendMessage, sendSms, sendEmail,map);
|
|
|
taskService.setPriority(t.getId(), priority);
|
|
|
}
|
|
|
}
|
|
@@ -349,8 +434,13 @@ public class ActTaskController {
|
|
|
actBusinessService.updateById(actBusiness);
|
|
|
// 异步发消息
|
|
|
LoginUser user = sysBaseAPI.getUserByName(actBusiness.getUserId());
|
|
|
+ //我的消息跳转地址
|
|
|
+ Map<String,Object> map =new HashMap<>();
|
|
|
+ map.put("isUrl","1");
|
|
|
+ map.put("url","/activiti/applyList");
|
|
|
+ map.put("taskId",task.getId());
|
|
|
actZprocessService.sendMessage(loginUser,user,ActivitiConstant.MESSAGE_PASS_CONTENT,
|
|
|
- String.format("您的 【%s】 申请已通过!",actBusiness.getTitle()),sendMessage, sendSms, sendEmail);
|
|
|
+ String.format("您的 【%s】 申请已通过!",actBusiness.getTitle()),sendMessage, sendSms, sendEmail,map);
|
|
|
}
|
|
|
// 记录实际审批人员
|
|
|
actBusinessService.insertHI_IDENTITYLINK(IdUtil.simpleUUID(),
|
|
@@ -375,8 +465,13 @@ public class ActTaskController {
|
|
|
taskService.delegateTask(id, userId);
|
|
|
taskService.setOwner(id, sysUser.getUsername());
|
|
|
// 异步发消息
|
|
|
+ //我的消息跳转地址
|
|
|
+ Map<String,Object> map =new HashMap<>();
|
|
|
+ map.put("isUrl","1");
|
|
|
+ map.put("url","/activiti/applyList");
|
|
|
+ map.put("taskId",id);
|
|
|
actZprocessService.sendMessage(sysUser,sysBaseAPI.getUserByName(userId),ActivitiConstant.MESSAGE_DELEGATE_CONTENT,
|
|
|
- String.format("您有一个来自 %s 的委托需要处理!",sysUser.getRealname()),sendMessage, sendSms, sendEmail);
|
|
|
+ String.format("您有一个来自 %s 的委托需要处理!",sysUser.getRealname()),sendMessage, sendSms, sendEmail,map);
|
|
|
return Result.ok("操作成功");
|
|
|
}
|
|
|
@RequestMapping(value = "/backToTask", method = RequestMethod.POST)
|
|
@@ -411,8 +506,13 @@ public class ActTaskController {
|
|
|
for(String assignee:assignees.split(",")){
|
|
|
taskService.addCandidateUser(e.getId(), assignee);
|
|
|
// 异步发消息
|
|
|
+ //我的消息跳转地址
|
|
|
+ Map<String,Object> map =new HashMap<>();
|
|
|
+ map.put("isUrl","1");
|
|
|
+ map.put("url","/activiti/applyList");
|
|
|
+ map.put("taskId",id);
|
|
|
actZprocessService.sendMessage(loginUser,sysBaseAPI.getUserByName(assignee),ActivitiConstant.MESSAGE_TODO_CONTENT
|
|
|
- ,"您有一个任务待审批,请尽快处理!",sendMessage, sendSms, sendEmail);
|
|
|
+ ,"您有一个任务待审批,请尽快处理!",sendMessage, sendSms, sendEmail,map);
|
|
|
}
|
|
|
if(priority!=null){
|
|
|
taskService.setPriority(e.getId(), priority);
|