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

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

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