|
@@ -0,0 +1,347 @@
|
|
|
+package com.wtkj.controller;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
+import com.wtkj.dto.MyTaskPageDTO;
|
|
|
+import com.wtkj.dto.ProjectTaskPageDTO;
|
|
|
+import com.wtkj.entity.*;
|
|
|
+import com.wtkj.service.*;
|
|
|
+import com.wtkj.vo.*;
|
|
|
+import com.wtkj.wrapper.*;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+import org.springblade.core.mp.support.Condition;
|
|
|
+import org.springblade.core.mp.support.Query;
|
|
|
+import org.springblade.core.secure.utils.AuthUtil;
|
|
|
+import org.springblade.core.tool.api.R;
|
|
|
+import org.springblade.core.tool.utils.Func;
|
|
|
+import org.springblade.system.user.entity.User;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.validation.Valid;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author Blizzard
|
|
|
+ * @create at 2023-09-15 15:20
|
|
|
+ * @describe
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@AllArgsConstructor
|
|
|
+@RequestMapping("/task")
|
|
|
+@Api(value = "任务模块", tags = "任务模块")
|
|
|
+public class TaskController {
|
|
|
+
|
|
|
+ private final ITaskService taskService;
|
|
|
+
|
|
|
+ private final ITaskLogService taskLogService;
|
|
|
+
|
|
|
+ private final ITaskFileService taskFileService;
|
|
|
+
|
|
|
+ private final ITaskContractService taskContractService;
|
|
|
+
|
|
|
+ private final ITaskCostService taskCostService;
|
|
|
+
|
|
|
+ private final ITaskContractPayLogService payLogService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 我的任务分页
|
|
|
+ */
|
|
|
+
|
|
|
+ @PostMapping("/my-task-page")
|
|
|
+ @ApiOperationSupport(order = 1)
|
|
|
+ @ApiOperation(value = "我的任务列表", notes = "")
|
|
|
+ public R<IPage<TaskVO>> myTaskPage(@RequestBody @Valid MyTaskPageDTO dto) {
|
|
|
+ Query query = new Query();
|
|
|
+ query.setCurrent(dto.getCurrent());
|
|
|
+ query.setSize(dto.getSize());
|
|
|
+ IPage<Task> page = taskService.myTaskPage(dto, Condition.getPage(query));
|
|
|
+ return R.data(MyTaskWrapper.build().pageVO(page));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 我的任务统计
|
|
|
+ */
|
|
|
+ @GetMapping("/my-task-statistics")
|
|
|
+ @ApiOperationSupport(order = 2)
|
|
|
+ @ApiOperation(value = "我的任务统计", notes = "")
|
|
|
+ public R myTask(@RequestParam Integer year, @RequestParam Integer month) {
|
|
|
+ return R.data(taskService.taskStatistics(null, year, month));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 创建、修改任务
|
|
|
+ */
|
|
|
+ @PostMapping("/submit")
|
|
|
+ @ApiOperation(value = "创建、修改任务", notes = "")
|
|
|
+ @ApiOperationSupport(order = 3)
|
|
|
+ public R<Boolean> submitTask(@RequestBody @Valid Task task) {
|
|
|
+ return R.status(taskService.submit(task));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 项目任务列表
|
|
|
+ */
|
|
|
+ @PostMapping("/project-task-page")
|
|
|
+ @ApiOperationSupport(order = 4)
|
|
|
+ @ApiOperation(value = "项目任务列表", notes = "")
|
|
|
+ public R<IPage<TaskVO>> projectTask(@RequestBody @Valid ProjectTaskPageDTO dto) {
|
|
|
+ Query query = new Query();
|
|
|
+ query.setCurrent(dto.getCurrent());
|
|
|
+ query.setSize(dto.getSize());
|
|
|
+ IPage<Task> page = taskService.projectTaskPage(dto, Condition.getPage(query));
|
|
|
+ return R.data(TaskPageWrapper.build().pageVO(page));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除任务
|
|
|
+ */
|
|
|
+ @GetMapping("/delete-project-task")
|
|
|
+ @ApiOperationSupport(order = 5)
|
|
|
+ @ApiOperation(value = "删除项目任务", notes = "传入ids")
|
|
|
+ public R<Boolean> deleteTask(String ids) {
|
|
|
+ return R.status(taskService.delete(Func.toLongList(ids)));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 任务详情
|
|
|
+ */
|
|
|
+ @GetMapping("/detail")
|
|
|
+ @ApiOperationSupport(order = 6)
|
|
|
+ @ApiOperation(value = "任务详情", notes = "传入任务主键id")
|
|
|
+ public R<TaskVO> detail(@RequestParam Long id) {
|
|
|
+ Task detail = taskService.getById(id);
|
|
|
+ return R.data(TaskWrapper.build().entityVO(detail));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 任务成果文件
|
|
|
+ */
|
|
|
+ @GetMapping("/result-file")
|
|
|
+ @ApiOperationSupport(order = 7)
|
|
|
+ @ApiOperation(value = "任务成果文件", notes = "传入任务主键id")
|
|
|
+ public R<List<TaskFileVO>> files(@RequestParam Long id) {
|
|
|
+ List<TaskFile> files = taskFileService.fileList(id);
|
|
|
+ return R.data(TaskFileWrapper.build().listVO(files));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 上传成果文件
|
|
|
+ */
|
|
|
+ @GetMapping("/upload-file")
|
|
|
+ @ApiOperationSupport(order = 8)
|
|
|
+ @ApiOperation(value = "上传成果文件", notes = "传入任务主键id,文件ids")
|
|
|
+ public R saveFile(@RequestParam Long taskId, @RequestParam String ids) {
|
|
|
+ return R.status(taskService.uploadFile(taskId, ids));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除附件
|
|
|
+ */
|
|
|
+ @GetMapping("/delete-file")
|
|
|
+ @ApiOperationSupport(order = 9)
|
|
|
+ @ApiOperation(value = "删除附件", notes = "传入主键ids")
|
|
|
+ public R deleteFile(@RequestParam String ids) {
|
|
|
+ return R.status(taskService.deleteFile(ids));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 移动文件
|
|
|
+ */
|
|
|
+ @GetMapping("/move-file")
|
|
|
+ @ApiOperationSupport(order = 10)
|
|
|
+ @ApiOperation(value = "移动文件", notes = "")
|
|
|
+ public R moveFile(@RequestParam Long stageId, @RequestParam Long folderId, @RequestParam String fileIds) {
|
|
|
+ return R.status(taskService.moveFile(stageId, folderId, fileIds));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 任务相关动态
|
|
|
+ */
|
|
|
+ @GetMapping("/task-log")
|
|
|
+ @ApiOperationSupport(order = 11)
|
|
|
+ @ApiOperation(value = "任务相关动态", notes = "传入任务主键id")
|
|
|
+ public R<IPage<TaskLogVO>> taskLog(Long id, Query query) {
|
|
|
+ LambdaQueryWrapper<TaskLog> lqw = new LambdaQueryWrapper<>();
|
|
|
+ lqw.eq(TaskLog::getTaskId, id);
|
|
|
+ lqw.orderByDesc(TaskLog::getCreateTime);
|
|
|
+ IPage<TaskLog> page = taskLogService.page(Condition.getPage(query), lqw);
|
|
|
+ return R.data(TaskLogWrapper.build().pageVO(page));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 任务组成员
|
|
|
+ */
|
|
|
+ @GetMapping("/task-group-mem")
|
|
|
+ @ApiOperationSupport(order = 12)
|
|
|
+ @ApiOperation(value = "任务组成员", notes = "传入任务主键id")
|
|
|
+ public R<List<User>> taskGroup(@RequestParam Long id) {
|
|
|
+ //todo 任务组成员
|
|
|
+ return R.data(taskLogService.getTaskGroupMen(id));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加任务相关合同
|
|
|
+ */
|
|
|
+ @PostMapping("/submit-task-contract")
|
|
|
+ @ApiOperationSupport(order = 13)
|
|
|
+ @ApiOperation(value = "新增或者修改任务合同", notes = "")
|
|
|
+ public R<Boolean> submitContracts(@RequestBody @Valid TaskContract contract) {
|
|
|
+ return R.status(taskContractService.saveOrUpdate(contract));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除任务合同
|
|
|
+ */
|
|
|
+ @GetMapping("/delete-task-contract")
|
|
|
+ @ApiOperationSupport(order = 14)
|
|
|
+ @ApiOperation(value = "删除任务合同", notes = "传入主键ids")
|
|
|
+ public R<Boolean> deleteContracts(@RequestParam String ids) {
|
|
|
+ return R.status(taskContractService.removeByIds(Func.toLongList(ids)));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 任务合同分页
|
|
|
+ */
|
|
|
+ @GetMapping("/task-contract-page")
|
|
|
+ @ApiOperationSupport(order = 15)
|
|
|
+ @ApiOperation(value = "任务合同分页", notes = "传入主键taskId,分页参数")
|
|
|
+ public R<IPage<TaskContractVO>> contractPage(@RequestParam Long taskId, Query query) {
|
|
|
+ IPage<TaskContract> page = taskContractService.pageByTaskId(taskId, Condition.getPage(query));
|
|
|
+ return R.data(TaskContractWrapper.build().pageVO(page));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 任务成本核算
|
|
|
+ */
|
|
|
+ @PostMapping("/submit-task-cost")
|
|
|
+ @ApiOperationSupport(order = 16)
|
|
|
+ @ApiOperation(value = "新增或修改任务成本", notes = "")
|
|
|
+ public R<Boolean> submitCost(@RequestBody @Valid TaskCost cost) {
|
|
|
+ return R.data(taskCostService.saveOrUpdate(cost));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 任务成本详情
|
|
|
+ */
|
|
|
+ @GetMapping("/task-cost-detail")
|
|
|
+ @ApiOperationSupport(order = 17)
|
|
|
+ @ApiOperation(value = "成本详情", notes = "")
|
|
|
+ public R<TaskCostVO> costDetail(@RequestParam Long id) {
|
|
|
+ TaskCost detail = taskCostService.getById(id);
|
|
|
+ return R.data(TaskCostWrapper.build().entityVO(detail));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除成本记录
|
|
|
+ */
|
|
|
+ @GetMapping("/delete-task-cost")
|
|
|
+ @ApiOperationSupport(order = 18)
|
|
|
+ @ApiOperation(value = "删除成本记录", notes = "传入主键ids")
|
|
|
+ public R<Boolean> deleteCost(@RequestParam String ids) {
|
|
|
+ return R.status(taskCostService.removeByIds(Func.toLongList(ids)));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 成本分页
|
|
|
+ */
|
|
|
+ @GetMapping("/task-cost-page")
|
|
|
+ @ApiOperationSupport(order = 19)
|
|
|
+ @ApiOperation(value = "成本分页", notes = "传入taskId,分页参数")
|
|
|
+ public R<IPage<TaskCostVO>> costPage(@RequestParam Long taskId, Query query) {
|
|
|
+ IPage<TaskCost> page = taskCostService.pageByTaskId(taskId, Condition.getPage(query));
|
|
|
+ return R.data(TaskCostWrapper.build().pageVO(page));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 成本统计
|
|
|
+ */
|
|
|
+ @GetMapping("/task-cost-statistics")
|
|
|
+ @ApiOperationSupport(order = 20)
|
|
|
+ @ApiOperation(value = "任务成本统计", notes = "传入taskId")
|
|
|
+ public R<JSONObject> costStatistics(@RequestParam Long taskId) {
|
|
|
+ return R.data(taskCostService.costStatistics(taskId));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 今日待完成
|
|
|
+ */
|
|
|
+ @GetMapping("/today-todo-task")
|
|
|
+ @ApiOperationSupport(order = 21)
|
|
|
+ @ApiOperation(value = "登录用户指定日期待完成任务", notes = "")
|
|
|
+ public R<List<Task>> todayTodo(@RequestParam String date) {
|
|
|
+ return R.data(taskService.todayTodo(AuthUtil.getUserId(), date));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 今日逾期
|
|
|
+ */
|
|
|
+ @GetMapping("/today-expire-task")
|
|
|
+ @ApiOperationSupport(order = 22)
|
|
|
+ @ApiOperation(value = "登录用户指定日期逾期任务", notes = "")
|
|
|
+ public R<List<Task>> todayExpire(@RequestParam String date) {
|
|
|
+ return R.data(taskService.todayExpire(AuthUtil.getUserId(), date));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 任务协作单位
|
|
|
+ */
|
|
|
+ @GetMapping("/task-cops")
|
|
|
+ @ApiOperationSupport(order = 23)
|
|
|
+ @ApiOperation(value = "协作单位列表", notes = "")
|
|
|
+ public R cops(@RequestParam Long projectId) {
|
|
|
+ return R.data(taskService.taskCops(projectId));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改、添加合同付款记录
|
|
|
+ */
|
|
|
+ @PostMapping("/submit-pay-log")
|
|
|
+ @ApiOperationSupport(order = 24)
|
|
|
+ @ApiOperation(value = "添加付款记录", notes = "")
|
|
|
+ public R submitPayLog(@RequestBody @Valid TaskContractPayLog payLog) {
|
|
|
+ return R.status(payLogService.submit(payLog));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除付款记录
|
|
|
+ */
|
|
|
+ @GetMapping("/delete-pay-log")
|
|
|
+ @ApiOperationSupport(order = 25)
|
|
|
+ @ApiOperation(value = "删除付款记录", notes = "")
|
|
|
+ public R deletePayLog(@RequestParam String ids, @RequestParam Long contractId) {
|
|
|
+ return R.status(payLogService.delete(Func.toLongList(ids), contractId));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 付款记录详情
|
|
|
+ */
|
|
|
+ @GetMapping("/pay-log-page")
|
|
|
+ @ApiOperationSupport(order = 26)
|
|
|
+ @ApiOperation(value = "付款记录分页", notes = "")
|
|
|
+ public R payLogPage(@RequestParam Long contractId, Query query) {
|
|
|
+ IPage<TaskContractPayLog> page = payLogService.pageByContractId(contractId, Condition.getPage(query));
|
|
|
+ return R.data(TaskContractPayLogWrapper.build().pageVO(page));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 付款记录详情
|
|
|
+ */
|
|
|
+ @GetMapping("/pay-log-detail")
|
|
|
+ @ApiOperationSupport(order = 27)
|
|
|
+ @ApiOperation(value = "付款记录详情", notes = "")
|
|
|
+ public R payLogDetail(@RequestParam Long id) {
|
|
|
+ TaskContractPayLog byId = payLogService.getById(id);
|
|
|
+ return R.data(TaskContractPayLogWrapper.build().entityVO(byId));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|