From 1ea84a23004ebcfaf86cb436d84164602ca9091d Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期五, 08 八月 2025 17:03:36 +0800
Subject: [PATCH] Merge branch 'devlop' of http://47.97.1.152:5880/r/wms-master into devlop
---
rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/TaskController.java | 102 +++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 95 insertions(+), 7 deletions(-)
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/TaskController.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/TaskController.java
index 0e9be0e..9c47abf 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/TaskController.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/TaskController.java
@@ -1,19 +1,30 @@
package com.vincent.rsf.server.manager.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.vincent.rsf.framework.common.Cools;
import com.vincent.rsf.framework.common.R;
+import com.vincent.rsf.framework.exception.CoolException;
+import com.vincent.rsf.server.common.constant.Constants;
+import com.vincent.rsf.server.manager.entity.*;
+import com.vincent.rsf.server.manager.enums.*;
import com.vincent.rsf.server.common.utils.ExcelUtil;
import com.vincent.rsf.server.common.annotation.OperationLog;
import com.vincent.rsf.server.common.domain.BaseParam;
import com.vincent.rsf.server.common.domain.KeyValVo;
import com.vincent.rsf.server.common.domain.PageParam;
-import com.vincent.rsf.server.manager.entity.Task;
-import com.vincent.rsf.server.manager.service.TaskService;
+import com.vincent.rsf.server.manager.service.*;
import com.vincent.rsf.server.system.controller.BaseController;
+import com.vincent.rsf.server.system.service.impl.ConfigServiceImpl;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
@@ -21,6 +32,8 @@
@RestController
public class TaskController extends BaseController {
+
+ public static final Logger logger = LoggerFactory.getLogger(TaskController.class);
@Autowired
private TaskService taskService;
@@ -30,7 +43,8 @@
public R page(@RequestBody Map<String, Object> map) {
BaseParam baseParam = buildParam(map, BaseParam.class);
PageParam<Task, BaseParam> pageParam = new PageParam<>(baseParam, Task.class);
- return R.ok().add(taskService.page(pageParam, pageParam.buildWrapper(true)));
+ QueryWrapper<Task> queryWrapper = pageParam.buildWrapper(true);
+ return R.ok().add(taskService.page(pageParam, queryWrapper));
}
@PreAuthorize("hasAuthority('manager:task:list')")
@@ -78,13 +92,13 @@
}
@PreAuthorize("hasAuthority('manager:task:remove')")
- @OperationLog("Delete 浠诲姟宸ヤ綔妗�")
+ @ApiOperation("鍙栨秷/鍒犻櫎宸ヤ綔鏋佹。")
@PostMapping("/task/remove/{ids}")
public R remove(@PathVariable Long[] ids) {
- if (!taskService.removeByIds(Arrays.asList(ids))) {
- return R.error("Delete Fail");
+ if (Objects.isNull(ids) || ids.length < 1) {
+ return R.error("鍙傛暟涓嶈兘涓虹┖锛侊紒");
}
- return R.ok("Delete Success").add(ids);
+ return taskService.removeTask(ids, getLoginUserId());
}
@PreAuthorize("hasAuthority('manager:task:list')")
@@ -107,4 +121,78 @@
ExcelUtil.build(ExcelUtil.create(taskService.list(), Task.class), response);
}
+ @PreAuthorize("hasAuthority('manager:task:update')")
+ @ApiOperation("瀹屾垚浠诲姟")
+ @PostMapping("/task/complete/{id}")
+ public R completeTask(@PathVariable Long id) throws Exception {
+ if (Cools.isEmpty(id)) {
+ throw new CoolException("鍙傛暟涓嶈兘涓虹┖锛侊紒");
+ }
+ return R.ok("瀹屾垚浠诲姟鎴愬姛").add(taskService.operateComplete(id, getLoginUserId()));
+ }
+
+ /**
+ * 鎷f枡鍑哄簱锛堢敤浜庢祴璇曟嫞鏂欏嚭搴擄級
+ * @return
+ */
+ @PreAuthorize("hasAuthority('manager:task:update')")
+ @ApiOperation("鎷f枡鍑哄簱")
+ @PostMapping("/task/pick/{id}")
+ public R pickTask(@PathVariable Long id) {
+ if (Objects.isNull(id)) {
+ throw new CoolException("鑳芥暟涓嶈兘涓虹┖锛侊紒");
+ }
+ try {
+ return R.ok("鍑哄簱瀹屾垚").add(taskService.pickOrCheckTask(id, Constants.TASK_TYPE_OUT_PICK));
+ } catch (Exception e) {
+ throw new CoolException(e.getMessage());
+ }
+ }
+
+ /**
+ * 鐩樼偣鍑哄簱锛堢敤浜庢祴璇曠洏鐐瑰嚭搴擄級
+ *
+ * @return
+ */
+ @PreAuthorize("hasAuthority('manager:task:update')")
+ @ApiOperation("鐩樼偣鍑哄簱")
+ @PostMapping("/task/check/{id}")
+ public R checkTask(@PathVariable Long id) {
+ if (Objects.isNull(id)) {
+ throw new CoolException("鑳芥暟涓嶈兘涓虹┖锛侊紒");
+ }
+ try {
+ return R.ok(taskService.pickOrCheckTask(id, Constants.TASK_TYPE_OUT_CHECK));
+ } catch (Exception e) {
+ throw new CoolException(e.getMessage());
+ }
+ }
+
+// @PreAuthorize("hasAuthority('manager:task:update')")
+// @ApiOperation("鍙栨秷浠诲姟")
+// @PostMapping("/task/cancel/{id}")
+// public R cancelTask(@PathVariable String id) {
+// if (Objects.isNull(id)) {
+// throw new CoolException("鍙傛暟涓嶈兘涓虹┖锛侊紒");
+// }
+// return R.ok();
+// }
+
+ @PreAuthorize("hasAuthority('manager:task:update')")
+ @ApiOperation("浠诲姟鍑哄簱缃《")
+ @PostMapping("/task/top/{id}")
+ public R setTop(@PathVariable Long id) {
+ if (Objects.isNull(id)) {
+ throw new CoolException("鍙傛暟涓嶈兘涓虹┖锛侊紒");
+ }
+ try {
+ taskService.taskToTop(id, getLoginUserId());
+ } catch (Exception e) {
+ logger.error("UNK", e);
+ throw new CoolException(e.getMessage());
+ }
+ return R.ok();
+ }
+
+
}
--
Gitblit v1.9.1