From 706319efad928f4df75507956a30ad95f50befee Mon Sep 17 00:00:00 2001
From: skyouc <creaycat@gmail.com>
Date: 星期三, 26 十一月 2025 13:12:07 +0800
Subject: [PATCH] 库存信息添加动态字段查询功能

---
 rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/LocItemController.java |   44 +++++++++++++++++++++++++++++++++++---------
 1 files changed, 35 insertions(+), 9 deletions(-)

diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/LocItemController.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/LocItemController.java
index 5390de7..fc8bddd 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/LocItemController.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/LocItemController.java
@@ -5,14 +5,19 @@
 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.server.common.constant.Constants;
 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.common.utils.FieldsUtils;
+import com.vincent.rsf.server.manager.controller.params.LocToTaskParams;
 import com.vincent.rsf.server.manager.entity.LocItem;
+import com.vincent.rsf.server.manager.entity.ViewStockManage;
+import com.vincent.rsf.server.manager.enums.TaskResouceType;
 import com.vincent.rsf.server.manager.service.LocItemService;
+import com.vincent.rsf.server.manager.service.LocService;
 import com.vincent.rsf.server.system.controller.BaseController;
 import com.vincent.rsf.server.manager.enums.LocStsType;
 import io.swagger.annotations.ApiOperation;
@@ -28,6 +33,8 @@
 
     @Autowired
     private LocItemService locItemService;
+    @Autowired
+    private LocService locService;
 
     @PreAuthorize("hasAuthority('manager:locItem:list')")
     @PostMapping("/locItem/page")
@@ -35,8 +42,11 @@
         BaseParam baseParam = buildParam(map, BaseParam.class);
         PageParam<LocItem, BaseParam> pageParam = new PageParam<>(baseParam, LocItem.class);
 
+        QueryWrapper<LocItem> wrapper = pageParam.buildWrapper(true);
+        FieldsUtils.setFieldsFilters(wrapper, pageParam, LocItem.class);
+
         /**鎷兼帴鎵╁睍瀛楁*/
-        PageParam<LocItem, BaseParam> page = locItemService.page(pageParam, pageParam.buildWrapper(true));
+        PageParam<LocItem, BaseParam> page = locItemService.page(pageParam, wrapper);
         List<LocItem> records = page.getRecords();
         for (LocItem record : records) {
             if (!Objects.isNull(record.getFieldsIndex())) {
@@ -79,17 +89,25 @@
 
     /**
      * 鐢熸垚搴撳瓨鍑哄簱浠诲姟
-     * @param map
+     * @param param
      * @return
      */
     @PreAuthorize("hasAuthority('manager:locItem:list')")
     @ApiOperation("鐢熸垚搴撳瓨鍑哄簱浠诲姟")
     @PostMapping("/locItem/generate/task")
-    public R generateTask(@RequestBody Map<String, Object> map) {
-        if (Objects.isNull(map)) {
+    public R generateTask(@RequestBody LocToTaskParams param) {
+        if (Objects.isNull(param)) {
             return R.error("鍙傛暟涓嶈兘涓虹┖锛侊紒");
         }
-        return locItemService.generateTask(map);
+        param.setType(Constants.TASK_TYPE_OUT_STOCK);
+
+        try {
+            locItemService.generateTask(TaskResouceType.TASK_RESOUCE_STOCK_TYPE.val, param, getLoginUserId());
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+
+        return R.ok();
     }
 
     /**
@@ -100,11 +118,11 @@
     @PreAuthorize("hasAuthority('manager:locItem:list')")
     @ApiOperation("鐢熸垚绉诲簱浠诲姟")
     @PostMapping("/locItem/move/task")
-    public R genMoveTask(@RequestBody Map<String, Object> map) {
+    public R genMoveTask(@RequestBody LocToTaskParams map) {
         if (Objects.isNull(map)) {
             return R.error("鍙傛暟涓嶈兘涓虹┖锛侊紒");
         }
-        return locItemService.genMoveTask(map);
+        return R.ok("浠诲姟鐢熸垚鎴愬姛").add(locItemService.genMoveTask(map, getLoginUserId()));
     }
 
     /**
@@ -115,11 +133,19 @@
     @PreAuthorize("hasAuthority('manager:locItem:list')")
     @ApiOperation("鐢熸垚鐩樼偣鍑哄簱浠诲姟")
     @PostMapping("/locItem/check/task")
-    public R genStatisticalTask(@RequestBody Map<String, Object> map) {
+    public R genStatisticalTask(@RequestBody LocToTaskParams map) {
         if (Objects.isNull(map)) {
             return R.error("鍙傛暟涓嶈兘涓虹┖锛侊紒");
         }
-        return locItemService.generateTask(map);
+        map.setType(Constants.TASK_TYPE_OUT_CHECK);
+
+        try {
+            locItemService.generateTask(TaskResouceType.TASK_RESOUCE_CHECK_TYPE.val, map, getLoginUserId());
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+
+        return R.ok("浠诲姟鐢熸垚鎴愬姛");
     }
 
 

--
Gitblit v1.9.1