|
@@ -1,6 +1,7 @@
|
|
|
package com.ydtech.modules.task.controller;
|
|
package com.ydtech.modules.task.controller;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.ydtech.core.page.HttpResult;
|
|
import com.ydtech.core.page.HttpResult;
|
|
|
import com.ydtech.exception.SystemException;
|
|
import com.ydtech.exception.SystemException;
|
|
|
import com.ydtech.modules.admin.model.SysUser;
|
|
import com.ydtech.modules.admin.model.SysUser;
|
|
@@ -13,20 +14,19 @@ import com.ydtech.modules.base.controller.BaseController;
|
|
|
import com.ydtech.modules.task.entity.po.TaskPersonCharge;
|
|
import com.ydtech.modules.task.entity.po.TaskPersonCharge;
|
|
|
import com.ydtech.modules.task.entity.po.TaskProject;
|
|
import com.ydtech.modules.task.entity.po.TaskProject;
|
|
|
import com.ydtech.modules.task.entity.po.TaskTask;
|
|
import com.ydtech.modules.task.entity.po.TaskTask;
|
|
|
-import com.ydtech.modules.task.entity.vo.AddTaskVo;
|
|
|
|
|
-import com.ydtech.modules.task.entity.vo.AssignTaskVo;
|
|
|
|
|
-import com.ydtech.modules.task.entity.vo.BackLineUserVo;
|
|
|
|
|
-import com.ydtech.modules.task.entity.vo.TaskProjectVo;
|
|
|
|
|
|
|
+import com.ydtech.modules.task.entity.vo.*;
|
|
|
import com.ydtech.modules.task.service.TaskPersonChargeService;
|
|
import com.ydtech.modules.task.service.TaskPersonChargeService;
|
|
|
import com.ydtech.modules.task.service.TaskProjectService;
|
|
import com.ydtech.modules.task.service.TaskProjectService;
|
|
|
import com.ydtech.modules.task.service.TaskTaskService;
|
|
import com.ydtech.modules.task.service.TaskTaskService;
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
+import org.apache.poi.ss.formula.functions.T;
|
|
|
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.*;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
|
|
@Api(tags = "任务controller")
|
|
@Api(tags = "任务controller")
|
|
|
@RestController
|
|
@RestController
|
|
@@ -51,12 +51,14 @@ public class TaskController extends BaseController {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
SysUserLinkDeptInternalAgentService sysUserLinkDeptInternalAgentService;
|
|
SysUserLinkDeptInternalAgentService sysUserLinkDeptInternalAgentService;
|
|
|
|
|
|
|
|
-
|
|
|
|
|
@GetMapping("/getBackLineUser")
|
|
@GetMapping("/getBackLineUser")
|
|
|
@ApiOperation("获取后线用户")
|
|
@ApiOperation("获取后线用户")
|
|
|
public HttpResult<Object> getBackLineUser(){
|
|
public HttpResult<Object> getBackLineUser(){
|
|
|
//获取用户信息
|
|
//获取用户信息
|
|
|
SysUserLinkDeptInternalAgent sysUserLinkDeptInternalAgent = sysUserLinkDeptInternalAgentService.getByUserId(getUserId());
|
|
SysUserLinkDeptInternalAgent sysUserLinkDeptInternalAgent = sysUserLinkDeptInternalAgentService.getByUserId(getUserId());
|
|
|
|
|
+ if(Objects.isNull(sysUserLinkDeptInternalAgent)){
|
|
|
|
|
+ throw new SystemException("当前用户没有分配内部机构");
|
|
|
|
|
+ }
|
|
|
//获取部门
|
|
//获取部门
|
|
|
SysDeptInternalAgent sysDeptInternalAgent = sysDeptInternalAgentService.getById(sysUserLinkDeptInternalAgent.getSysDeptInternalAgentId());
|
|
SysDeptInternalAgent sysDeptInternalAgent = sysDeptInternalAgentService.getById(sysUserLinkDeptInternalAgent.getSysDeptInternalAgentId());
|
|
|
List<BackLineUserVo> backLineUser = taskTaskService.getBackLineUser(sysDeptInternalAgent.getId());
|
|
List<BackLineUserVo> backLineUser = taskTaskService.getBackLineUser(sysDeptInternalAgent.getId());
|
|
@@ -77,6 +79,14 @@ public class TaskController extends BaseController {
|
|
|
return HttpResult.ok(taskTree);
|
|
return HttpResult.ok(taskTree);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @PostMapping("/getTaskPage")
|
|
|
|
|
+ @ApiOperation("获取任务列表")
|
|
|
|
|
+ public HttpResult<Object> getTaskList(@RequestBody TaskListQueryVo taskListQueryVo){
|
|
|
|
|
+ Page<T> page = buildPageRequest(taskListQueryVo.getPageDto());
|
|
|
|
|
+ Page<TaskTask> taskList = taskTaskService.getTaskPage(page, getUserId());
|
|
|
|
|
+ return HttpResult.ok(taskList);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@PostMapping("/addTask")
|
|
@PostMapping("/addTask")
|
|
|
@ApiOperation("添加任务")
|
|
@ApiOperation("添加任务")
|
|
|
public HttpResult<Object> addTask(@RequestBody AddTaskVo addTaskVo){
|
|
public HttpResult<Object> addTask(@RequestBody AddTaskVo addTaskVo){
|
|
@@ -90,6 +100,25 @@ public class TaskController extends BaseController {
|
|
|
return taskTaskService.addTask(addTaskVo,getUserName()) ? HttpResult.ok("添加任务成功") : HttpResult.error("添加任务失败");
|
|
return taskTaskService.addTask(addTaskVo,getUserName()) ? HttpResult.ok("添加任务成功") : HttpResult.error("添加任务失败");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @PostMapping("/delTask")
|
|
|
|
|
+ @ApiOperation("删除任务")
|
|
|
|
|
+ public HttpResult<Object> delTask(String taskId){
|
|
|
|
|
+ if(taskId == null){
|
|
|
|
|
+ throw new SystemException("任务id错误");
|
|
|
|
|
+ }
|
|
|
|
|
+ TaskTask task = taskTaskService.getById(taskId);
|
|
|
|
|
+ if(task == null){
|
|
|
|
|
+ throw new SystemException("任务不存在");
|
|
|
|
|
+ }
|
|
|
|
|
+ return taskTaskService.removeById(taskId) ? HttpResult.ok("任务删除成功") : HttpResult.error("任务删除失败");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @PostMapping("/editTask")
|
|
|
|
|
+ @ApiOperation("修改任务")
|
|
|
|
|
+ public HttpResult<Object> editTask(@RequestBody TaskTask task){
|
|
|
|
|
+ return taskTaskService.updateById(task) ? HttpResult.ok("任务修改成功") : HttpResult.error("任务修改失败");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@PostMapping("/assignTask")
|
|
@PostMapping("/assignTask")
|
|
|
@ApiOperation("分配任务")
|
|
@ApiOperation("分配任务")
|
|
|
public HttpResult<Object> assignTask(@RequestBody AssignTaskVo assignTaskVo){
|
|
public HttpResult<Object> assignTask(@RequestBody AssignTaskVo assignTaskVo){
|