提交 60ea175c authored 作者: zhoushaopan's avatar zhoushaopan

修改查询待办以及任务详情

上级 e94cfb10
...@@ -7,6 +7,7 @@ import com.tykj.workflowcore.workflow_editer.util.PageUtil; ...@@ -7,6 +7,7 @@ import com.tykj.workflowcore.workflow_editer.util.PageUtil;
import com.tykj.workflowcore.workflow_editer.vo.*; import com.tykj.workflowcore.workflow_editer.vo.*;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.flowable.task.api.Task;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -53,14 +54,15 @@ public class WorkFlowController { ...@@ -53,14 +54,15 @@ public class WorkFlowController {
@PostMapping("/findUserTask") @PostMapping("/findUserTask")
@ApiOperation("任务个人待办列表") @ApiOperation("任务个人待办列表")
public List<Map<String, Object>> findUserTask(@RequestBody NextTaskVo nextTaskVo){ public List<Task> findUserTask(@RequestBody NextTaskVo nextTaskVo){
List<Map<String, Object>> mapList = workFlowService.findTaskByUserId(nextTaskVo);
return mapList; return workFlowService.findTaskByUserId(nextTaskVo);
} }
@PostMapping("/findTaskDetail") @PostMapping("/findTaskDetail")
@ApiOperation("任务个人待办详情") @ApiOperation("任务个人待办详情")
public List<Map<String, Object>> findTaskDetail(Long userId,String taskId){ public Map<String, Object> findTaskDetail(Long userId,String taskId){
return workFlowService.findTaskDetail(userId, taskId); return workFlowService.findTaskDetail(userId, taskId);
} }
......
...@@ -2,6 +2,7 @@ package com.tykj.workflowcore.workflow_editer.service; ...@@ -2,6 +2,7 @@ package com.tykj.workflowcore.workflow_editer.service;
import com.tykj.workflowcore.workflow_editer.entity.FlowsInfo; import com.tykj.workflowcore.workflow_editer.entity.FlowsInfo;
import com.tykj.workflowcore.workflow_editer.vo.*; import com.tykj.workflowcore.workflow_editer.vo.*;
import org.flowable.task.api.Task;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
...@@ -68,7 +69,7 @@ public interface WorkFlowService { ...@@ -68,7 +69,7 @@ public interface WorkFlowService {
* @param nextTaskVo * @param nextTaskVo
* @return 任务列表 * @return 任务列表
*/ */
List<Map<String,Object>> findTaskByUserId(NextTaskVo nextTaskVo); List<Task> findTaskByUserId(NextTaskVo nextTaskVo);
/** /**
* 查看具体的任务详情 * 查看具体的任务详情
...@@ -76,7 +77,7 @@ public interface WorkFlowService { ...@@ -76,7 +77,7 @@ public interface WorkFlowService {
* @param taskId 任务Id * @param taskId 任务Id
* @return 任务列表 * @return 任务列表
*/ */
List<Map<String,Object>> findTaskDetail(Long userId, String taskId); Map<String,Object> findTaskDetail(Long userId, String taskId);
/** /**
......
...@@ -22,6 +22,7 @@ import org.flowable.engine.TaskService; ...@@ -22,6 +22,7 @@ import org.flowable.engine.TaskService;
import org.flowable.engine.repository.Deployment; import org.flowable.engine.repository.Deployment;
import org.flowable.engine.runtime.ProcessInstance; import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.task.api.Task; import org.flowable.task.api.Task;
import org.flowable.task.api.TaskQuery;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
...@@ -236,56 +237,26 @@ public class WorkFlowServiceImpl implements WorkFlowService { ...@@ -236,56 +237,26 @@ public class WorkFlowServiceImpl implements WorkFlowService {
@Override @Override
public List<Map<String, Object>> findTaskByUserId(NextTaskVo nextTaskVo) { public List<Task> findTaskByUserId(NextTaskVo nextTaskVo) {
ArrayList<Map<String, Object>> list = new ArrayList<>(); TaskQuery taskQuery = taskService.createTaskQuery().or();
List<Task> taskList = null; if (nextTaskVo.getUserId()!=null){
taskQuery.taskCandidateUser(nextTaskVo.getUserId()).orderByTaskCreateTime().desc();
Long userId = nextTaskVo.getUserId(); }
List<Long> roleIds = nextTaskVo.getRoleId(); if (nextTaskVo.getRoleId()!=null&&nextTaskVo.getRoleId().size()>0){
//全为空 taskQuery.taskCandidateGroupIn(nextTaskVo.getRoleId()).orderByTaskCreateTime().desc();
if (roleIds.size() == 0 && userId == null){ }
taskList = taskService.createTaskQuery().orderByTaskCreateTime().desc().list(); List<Task> listTask = taskQuery.endOr().list();
for (Task task : taskList) {
Map<String, Object> map = new HashMap<>();
map.put("taskId",task.getId());
map.put("taskName",task.getName());
map.put("taskCandidateUser",userId);
map.put("time",task.getCreateTime());
map.put("description",task.getDescription());
map.put("processInstanceId",task.getProcessInstanceId());
list.add(map);
}
}else {
for (Long roleId : roleIds) {
taskList = taskService.createTaskQuery().or().taskCandidateUser(Long.toString(userId)).taskCandidateGroup(Long.toString(roleId)).endOr().orderByTaskCreateTime().desc().list();
for (Task task : taskList) {
Map<String, Object> map = new HashMap<>();
map.put("taskId",task.getId());
map.put("taskName",task.getName());
map.put("taskCandidateUser",userId);
map.put("time",task.getCreateTime());
map.put("description",task.getDescription());
map.put("processInstanceId",task.getProcessInstanceId());
list.add(map);
}
} return listTask;
}
return list;
} }
@Override @Override
public List<Map<String, Object>> findTaskDetail(Long userId, String taskId) { public Map<String, Object> findTaskDetail(Long userId, String taskId) {
// List<Map<String, Object>> mapList = findTaskByUserId(userId);
List<Map<String, Object>> mapList = new ArrayList<>();
Map<String, Object> variables = taskService.getVariables(taskId); Map<String, Object> variables = taskService.getVariables(taskId);
mapList.add(variables); return variables;
return mapList;
} }
@Override @Override
......
...@@ -19,9 +19,9 @@ import java.util.List; ...@@ -19,9 +19,9 @@ import java.util.List;
@NoArgsConstructor @NoArgsConstructor
public class NextTaskVo { public class NextTaskVo {
private Long userId; private String userId;
private List<Long> roleId; private List<String> roleId;
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论