From b4adff68a07b783fc90da1c9370d8be5f383e700 Mon Sep 17 00:00:00 2001
From: 黎星凯 <13949086503@163.com>
Date: 星期三, 08 五月 2024 13:46:34 +0800
Subject: [PATCH] 20240528修改: bug41、42、43修改 领用单(分发单),调拨单,流程优化

---
 consum-base/src/main/java/com/consum/base/controller/BaseCategoryController.java |  111 +++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 70 insertions(+), 41 deletions(-)

diff --git a/consum-base/src/main/java/com/consum/base/controller/BaseCategoryController.java b/consum-base/src/main/java/com/consum/base/controller/BaseCategoryController.java
index ca157b1..f827446 100644
--- a/consum-base/src/main/java/com/consum/base/controller/BaseCategoryController.java
+++ b/consum-base/src/main/java/com/consum/base/controller/BaseCategoryController.java
@@ -1,54 +1,53 @@
 package com.consum.base.controller;
 
-import com.consum.base.BaseController;
-import com.consum.base.pojo.BaseCategoryParam;
-import com.consum.base.pojo.ProjectTreeResult;
-import com.consum.base.service.BaseCategoryServiceImpl;
-import com.consum.base.service.BaseGoodsTemplateServiceImpl;
-import com.consum.base.util.FinSysTenantUtils;
-import com.consum.model.po.BaseCategory;
-import com.consum.model.po.FinSysTenant;
-import com.consum.model.po.FinSysTenantUser;
-import com.iplatform.model.po.S_user_core;
-import com.walker.db.page.GenericPager;
-import com.walker.infrastructure.tree.TreeNode;
-import com.walker.infrastructure.utils.StringUtils;
-import com.walker.web.ResponseValue;
+import java.util.List;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.util.CollectionUtils;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
-import java.util.*;
+import com.consum.base.BaseController;
+import com.consum.base.core.utils.CommonUtil;
+import com.consum.base.pojo.BaseCategoryParam;
+import com.consum.base.pojo.ProjectTreeResult;
+import com.consum.base.service.BaseCategoryService;
+import com.consum.base.service.BaseGoodsTemplateService;
+import com.consum.model.po.BaseCategory;
+import com.iplatform.model.po.S_user_core;
+import com.walker.db.page.GenericPager;
+import com.walker.infrastructure.utils.StringUtils;
+import com.walker.web.ResponseValue;
+
+import io.swagger.annotations.Api;
 
 /**
  * @Description 鐗╁搧鍒嗙被
  * @Author 鍗㈠簡闃�
  * @Date 2023/10/23
  */
+@Api(value = "鐗╁搧鍒嗙被", tags = "鐗╁搧鍒嗙被")
 @RestController
 @RequestMapping("/pc/base/category")
 public class BaseCategoryController extends BaseController {
 
     @Autowired
-    private BaseCategoryServiceImpl baseCategoryService;
+    private BaseCategoryService baseCategoryService;
 
     @Autowired
-    private BaseGoodsTemplateServiceImpl baseGoodsTemplateService;
-
-    private boolean multiRoot = true;
-    private TreeNode dummyRoot = null;
-    private Map<Long, TreeNode> rootMap = new TreeMap();
-    private Map<Long, TreeNode> childMap = new TreeMap();
-    private long defaultParentId = 0L;
+    private BaseGoodsTemplateService baseGoodsTemplateService;
 
     /**
-     * @Description  鑾峰彇鍒嗙被鏍�
+     * @Description 鑾峰彇鍒嗙被鏍�
      * @Author 鍗㈠簡闃�
      * @Date 2023/10/30
      */
     @GetMapping("/select/tree")
-    public ResponseValue tree(String categoryName) {
-        List<ProjectTreeResult> tree = this.baseCategoryService.tree(categoryName);
+    public ResponseValue trees() {
+        List<ProjectTreeResult> tree = this.baseCategoryService.tree();
         return ResponseValue.success(tree);
     }
 
@@ -58,21 +57,28 @@
      * @Date 2023/10/23
      */
     @PostMapping("/add")
-    public ResponseValue add(@RequestBody BaseCategoryParam param) {
+    public ResponseValue add() {
+        BaseCategoryParam param = CommonUtil.getObjFromReqBody(BaseCategoryParam.class);
+        BaseCategoryParam param2 = new BaseCategoryParam();
+        CommonUtil.copyProperties(param, param2);
+        param = param2;
         if (StringUtils.isEmpty(param.getCategoryName())) {
             return ResponseValue.error("鍒嗙被鍚嶇О涓虹┖");
         }
         if (param.getOrderNumber() == null) {
             return ResponseValue.error("椤哄簭鍙蜂负绌�");
         }
-        //鍒ゆ柇鍚屼竴鐖剁被id涓嬪垎绫诲悕绉版槸鍚﹂噸澶�
-        BaseCategory category = this.baseCategoryService.getByCategoryNameAndFatherCategoryId(param.getCategoryName(), param.getFatherCategoryId());
+        // 鍒ゆ柇鍚屼竴鐖剁被id涓嬪垎绫诲悕绉版槸鍚﹂噸澶�
+        BaseCategory category = this.baseCategoryService.getByCategoryNameAndFatherCategoryId(param.getCategoryName(),
+            param.getFatherCategoryId());
         if (category != null) {
             return ResponseValue.error("鍒嗙被鍚嶇О宸插瓨鍦�");
         }
 
         int result = this.baseCategoryService.add(param, this.getCurrentUser());
-        if (result > 0) return ResponseValue.success(1);
+        if (result > 0) {
+            return ResponseValue.success(1);
+        }
         return ResponseValue.error("鏂板澶辫触锛�");
     }
 
@@ -82,7 +88,12 @@
      * @Date 2023/10/23
      */
     @GetMapping("/list")
-    public ResponseValue queryBaseCategoryList(BaseCategoryParam param) {
+    public ResponseValue queryBaseCategoryList() {
+        BaseCategoryParam param = CommonUtil.getObjFromReq(BaseCategoryParam.class);
+        BaseCategoryParam param2 = new BaseCategoryParam();
+        CommonUtil.copyProperties(param, param2);
+        param = param2;
+
         S_user_core currentUser = this.getCurrentUser();
         if (currentUser == null) {
             return ResponseValue.error("鐧诲綍鐢ㄦ埛淇℃伅涓嶅瓨鍦�");
@@ -97,7 +108,12 @@
      * @Date 2023/10/23
      */
     @PostMapping("/edit")
-    public ResponseValue edit(@RequestBody BaseCategory baseCategory) {
+    public ResponseValue edit() {
+        BaseCategory baseCategory = CommonUtil.getObjFromReqBody(BaseCategory.class);
+        BaseCategory param2 = new BaseCategory();
+        CommonUtil.copyProperties(baseCategory, param2);
+        baseCategory = param2;
+
         Long id = baseCategory.getId();
         if (id == null || id.longValue() <= 0) {
             return ResponseValue.error("缂栬緫鐨勭墿鍝佸垎绫讳笉瀛樺湪");
@@ -119,16 +135,22 @@
 
     /**
      * 淇敼鐘舵��
+     *
      * @author 鍗㈠簡闃�
      * @date 2023/10/23
      */
-    //鍒嗙被涓嬫湁姝e父鐘舵�佺殑鐗╁搧鏃讹紝涓嶅厑璁哥鐢�
+    // 鍒嗙被涓嬫湁姝e父鐘舵�佺殑鐗╁搧鏃讹紝涓嶅厑璁哥鐢�
     @PostMapping("/updStatus")
-    public ResponseValue updateStatus(@RequestBody BaseCategory baseCategory) {
-        if (baseCategory == null || baseCategory.getId() == null || baseCategory.getStates() == null) {
+    public ResponseValue updateStatus() {
+        BaseCategory baseCategory = CommonUtil.getObjFromReqBody(BaseCategory.class);
+        BaseCategory param2 = new BaseCategory();
+        CommonUtil.copyProperties(baseCategory, param2);
+        baseCategory = param2;
+
+        if (baseCategory.getId() == null || baseCategory.getStates() == null) {
             return ResponseValue.error("鍙傛暟閿欒");
         }
-        //鏍规嵁鍒嗙被id鍜岀姸鎬佹煡璇㈢墿鍝佹ā鐗�
+        // 鏍规嵁鍒嗙被id鍜岀姸鎬佹煡璇㈢墿鍝佹ā鐗�
         List<BaseCategory> list = this.baseGoodsTemplateService.getByCategoryId(baseCategory.getId());
         if (baseCategory.getStates() == 2 && !CollectionUtils.isEmpty(list)) {
             return ResponseValue.error("鍒嗙被涓嬫湁姝e父鐘舵�佺殑鐗╁搧锛屼笉鍏佽绂佺敤");
@@ -144,17 +166,23 @@
      * @Date 2023/10/23
      */
     @DeleteMapping("/del")
-    public ResponseValue updateById(@RequestBody BaseCategory baseCategory) {
+    public ResponseValue updateById() {
+        BaseCategory baseCategory = CommonUtil.getObjFromReqBody(BaseCategory.class);
+        BaseCategory param2 = new BaseCategory();
+        CommonUtil.copyProperties(baseCategory, param2);
+        baseCategory = param2;
+
         if (baseCategory.getId() == null) {
             return ResponseValue.error("鍒嗙被id涓虹┖");
         }
-        int num = this.baseCategoryService.updateById(baseCategory,this.getCurrentUser());
+        int num = this.baseCategoryService.updateById(baseCategory, this.getCurrentUser());
 
         return num > 0 ? ResponseValue.success(1) : ResponseValue.error("鍒犻櫎澶辫触锛�");
     }
 
     /**
      * 鏍规嵁鐗╁搧id鏌ヨ鑺傜偣璇︽儏
+     *
      * @author 鍗㈠簡闃�
      * @Date 2023/10/23
      */
@@ -164,7 +192,9 @@
             return ResponseValue.error("鍒嗙被id涓虹┖");
         }
         BaseCategory baseCategory = this.baseCategoryService.getById(id);
-        if (baseCategory == null) return ResponseValue.error("鏌ヨ澶辫触锛�");
+        if (baseCategory == null) {
+            return ResponseValue.error("鏌ヨ澶辫触锛�");
+        }
         return ResponseValue.success("鏌ヨ鎴愬姛!", baseCategory);
     }
 
@@ -185,4 +215,3 @@
     }
 
 }
-

--
Gitblit v1.9.1