From 0673f6fde8fd884332c404031a2ee523ec45d190 Mon Sep 17 00:00:00 2001
From: renkang <8417338+k94314517@user.noreply.gitee.com>
Date: 星期二, 07 一月 2025 18:22:38 +0800
Subject: [PATCH] 客户资料 巡检任务业务

---
 server/system_service/src/main/java/com/doumee/core/utils/Constants.java                                         |    3 
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwProblemServiceImpl.java           |   48 ++
 server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwStocktaking.java                     |   43 ++
 server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwOutinboundController.java                     |   16 
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/YwMaterialService.java                   |    4 
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwMaterialServiceImpl.java          |  215 +++++++----
 server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwStocktakingRecord.java               |   49 ++
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwOutinboundServiceImpl.java        |    5 
 server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwProblemController.java                        |    5 
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/YwStocktakingService.java                |    9 
 server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwStocktakingRecordController.java              |   27 +
 server/system_service/src/main/java/com/doumee/dao/system/model/Multifile.java                                   |    4 
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwStocktakingServiceImpl.java       |  361 ++++++++++++++-----
 server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/YwStocktakingRecordMapper.java               |    3 
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/YwStocktakingRecordService.java          |    3 
 server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwStocktakingController.java                    |   49 ++
 server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwMaterial.java                        |   21 +
 server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwProblem.java                         |    9 
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwStocktakingRecordServiceImpl.java |  169 ++++++---
 server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwMaterialController.java                       |   26 +
 20 files changed, 780 insertions(+), 289 deletions(-)

diff --git a/server/system_service/src/main/java/com/doumee/core/utils/Constants.java b/server/system_service/src/main/java/com/doumee/core/utils/Constants.java
index e6d936f..f5ac3a4 100644
--- a/server/system_service/src/main/java/com/doumee/core/utils/Constants.java
+++ b/server/system_service/src/main/java/com/doumee/core/utils/Constants.java
@@ -52,6 +52,7 @@
     public static final String YW_DEVICE ="YW_DEVICE" ;
     public static final String YW_PATROL ="YW_PATROL" ;
     public static final String YW_CONTRACT_BILL ="YW_CONTRACT_BILL" ;
+    public static final String YW_MATERIAL ="YW_MATERIAL" ;
 
     public static final String RESERVATION_TOTAL_NUM ="RESERVATION_TOTAL_NUM" ;
     public static final String SIGN_IN_PLACE_LAT ="SIGN_IN_PLACE_LAT" ;
@@ -1385,6 +1386,8 @@
         YW_CONTRACT_FILE(9, "鍚堝悓闄勪欢 ", "鍚堝悓闄勪欢 "),
         FN_CONTRACT_REVENUE_FILE(10, "鏀舵敮娴佹按闄勪欢 ", "鍚堝悓璐﹀崟闄勪欢 "),
         FN_PATROL_TASK_RECORD_FILE(11, "宸℃浠诲姟鐐瑰鐞嗛檮浠� ", "宸℃浠诲姟鐐瑰鐞嗛檮浠� "),
+        MATERIAL_FILE(12, "璧勪骇闄勪欢 ", "璧勪骇闄勪欢 "),
+        PROBLEM_FILE(13, "闂闄勪欢 ", "闂闄勪欢 "),
 
         ;
         // 鎴愬憳鍙橀噺
diff --git a/server/system_service/src/main/java/com/doumee/dao/system/model/Multifile.java b/server/system_service/src/main/java/com/doumee/dao/system/model/Multifile.java
index b0a6fb3..6ed4ba1 100644
--- a/server/system_service/src/main/java/com/doumee/dao/system/model/Multifile.java
+++ b/server/system_service/src/main/java/com/doumee/dao/system/model/Multifile.java
@@ -63,8 +63,8 @@
     @ExcelColumn(name="绫诲瀷0鍥剧墖 1瑙嗛 2鍏朵粬")
     private Integer type;
 
-    @ApiModelProperty(value = "鍏宠仈瀵硅薄绫诲瀷 0闅愭偅鐜板満鎯呭喌 1闅愭偅澶勭悊鍓嶆儏鍐� 2闅愭偅澶勭悊鍚庢儏鍐� 3闅愭偅閫�鍥炶鏄� 4浼氳瀹ゆ枃浠� 5闃滃畞璁惧鍥剧墖 6闃滃畞璁惧杩愮淮鍥剧墖", example = "1")
-    @ExcelColumn(name="鍏宠仈瀵硅薄绫诲瀷 0闅愭偅鐜板満鎯呭喌 1闅愭偅澶勭悊鍓嶆儏鍐� 2闅愭偅澶勭悊鍚庢儏鍐� 3闅愭偅閫�鍥炶鏄� 4浼氳瀹ゆ枃浠�  5闃滃畞璁惧鍥剧墖 6闃滃畞璁惧杩愮淮鍥剧墖")
+    @ApiModelProperty(value = "鍏宠仈瀵硅薄绫诲瀷 0闅愭偅鐜板満鎯呭喌 1闅愭偅澶勭悊鍓嶆儏鍐� 2闅愭偅澶勭悊鍚庢儏鍐� 3闅愭偅閫�鍥炶鏄� 4浼氳瀹ゆ枃浠� 5闃滃畞璁惧鍥剧墖 6闃滃畞璁惧杩愮淮鍥剧墖 7璧勪骇闄勪欢", example = "1")
+    @ExcelColumn(name="鍏宠仈瀵硅薄绫诲瀷 0闅愭偅鐜板満鎯呭喌 1闅愭偅澶勭悊鍓嶆儏鍐� 2闅愭偅澶勭悊鍚庢儏鍐� 3闅愭偅閫�鍥炶鏄� 4浼氳瀹ゆ枃浠�  5闃滃畞璁惧鍥剧墖 6闃滃畞璁惧杩愮淮鍥剧墖 7璧勪骇闄勪欢")
     private Integer objType;
 
     @ApiModelProperty(value = "鏂囦欢鍦板潃")
diff --git a/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwMaterialController.java b/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwMaterialController.java
index f8ba265..e9d3cf6 100644
--- a/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwMaterialController.java
+++ b/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwMaterialController.java
@@ -36,14 +36,15 @@
     @ApiOperation("鏂板缓")
     @PostMapping("/create")
     @CloudRequiredPermission("business:ywmaterial:create")
-    public ApiResponse create(@RequestBody YwMaterial ywMaterial) {
+    public ApiResponse create(@RequestBody YwMaterial ywMaterial,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
+        ywMaterial.setLoginUserInfo(this.getLoginUser(token));
         return ApiResponse.success(ywMaterialService.create(ywMaterial));
     }
 
     @ApiOperation("鏍规嵁ID鍒犻櫎")
     @GetMapping("/delete/{id}")
     @CloudRequiredPermission("business:ywmaterial:delete")
-    public ApiResponse deleteById(@PathVariable Integer id) {
+    public ApiResponse deleteById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
         ywMaterialService.deleteById(id);
         return ApiResponse.success(null);
     }
@@ -51,7 +52,7 @@
     @ApiOperation("鎵归噺鍒犻櫎")
     @GetMapping("/delete/batch")
     @CloudRequiredPermission("business:ywmaterial:delete")
-    public ApiResponse deleteByIdInBatch(@RequestParam String ids) {
+    public ApiResponse deleteByIdInBatch(@RequestParam String ids,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
         String [] idArray = ids.split(",");
         List<Integer> idList = new ArrayList<>();
         for (String id : idArray) {
@@ -64,29 +65,38 @@
     @ApiOperation("鏍规嵁ID淇敼")
     @PostMapping("/updateById")
     @CloudRequiredPermission("business:ywmaterial:update")
-    public ApiResponse updateById(@RequestBody YwMaterial ywMaterial) {
+    public ApiResponse updateById(@RequestBody YwMaterial ywMaterial,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
         ywMaterialService.updateById(ywMaterial);
         return ApiResponse.success(null);
     }
 
+    @ApiOperation("鏍规嵁ID淇敼鐘舵��")
+    @PostMapping("/updateStatus")
+    @CloudRequiredPermission("business:ywmaterial:update")
+    public ApiResponse updateStatus(@RequestBody YwMaterial ywMaterial,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
+        ywMaterialService.updateStatus(ywMaterial);
+        return ApiResponse.success(null);
+    }
+
+
     @ApiOperation("鍒嗛〉鏌ヨ")
     @PostMapping("/page")
     @CloudRequiredPermission("business:ywmaterial:query")
-    public ApiResponse<PageData<YwMaterial>> findPage (@RequestBody PageWrap<YwMaterial> pageWrap) {
+    public ApiResponse<PageData<YwMaterial>> findPage (@RequestBody PageWrap<YwMaterial> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
         return ApiResponse.success(ywMaterialService.findPage(pageWrap));
     }
 
     @ApiOperation("瀵煎嚭Excel")
     @PostMapping("/exportExcel")
     @CloudRequiredPermission("business:ywmaterial:exportExcel")
-    public void exportExcel (@RequestBody PageWrap<YwMaterial> pageWrap, HttpServletResponse response) {
+    public void exportExcel (@RequestBody PageWrap<YwMaterial> pageWrap, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
         ExcelExporter.build(YwMaterial.class).export(ywMaterialService.findPage(pageWrap).getRecords(), "杩愮淮璧勪骇淇℃伅琛�", response);
     }
 
     @ApiOperation("鏍规嵁ID鏌ヨ")
     @GetMapping("/{id}")
     @CloudRequiredPermission("business:ywmaterial:query")
-    public ApiResponse findById(@PathVariable Integer id) {
-        return ApiResponse.success(ywMaterialService.findById(id));
+    public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
+        return ApiResponse.success(ywMaterialService.getDetail(id));
     }
 }
diff --git a/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwOutinboundController.java b/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwOutinboundController.java
index 5600123..07544f7 100644
--- a/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwOutinboundController.java
+++ b/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwOutinboundController.java
@@ -36,14 +36,15 @@
     @ApiOperation("鏂板缓")
     @PostMapping("/create")
     @CloudRequiredPermission("business:ywoutinbound:create")
-    public ApiResponse create(@RequestBody YwOutinbound ywOutinbound) {
+    public ApiResponse create(@RequestBody YwOutinbound ywOutinbound,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
+        ywOutinbound.setLoginUserInfo(this.getLoginUser(token));
         return ApiResponse.success(ywOutinboundService.create(ywOutinbound));
     }
 
     @ApiOperation("鏍规嵁ID鍒犻櫎")
     @GetMapping("/delete/{id}")
     @CloudRequiredPermission("business:ywoutinbound:delete")
-    public ApiResponse deleteById(@PathVariable Integer id) {
+    public ApiResponse deleteById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
         ywOutinboundService.deleteById(id);
         return ApiResponse.success(null);
     }
@@ -51,7 +52,7 @@
     @ApiOperation("鎵归噺鍒犻櫎")
     @GetMapping("/delete/batch")
     @CloudRequiredPermission("business:ywoutinbound:delete")
-    public ApiResponse deleteByIdInBatch(@RequestParam String ids) {
+    public ApiResponse deleteByIdInBatch(@RequestParam String ids,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
         String [] idArray = ids.split(",");
         List<Integer> idList = new ArrayList<>();
         for (String id : idArray) {
@@ -64,7 +65,8 @@
     @ApiOperation("鏍规嵁ID淇敼")
     @PostMapping("/updateById")
     @CloudRequiredPermission("business:ywoutinbound:update")
-    public ApiResponse updateById(@RequestBody YwOutinbound ywOutinbound) {
+    public ApiResponse updateById(@RequestBody YwOutinbound ywOutinbound,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
+        ywOutinbound.setLoginUserInfo(this.getLoginUser(token));
         ywOutinboundService.updateById(ywOutinbound);
         return ApiResponse.success(null);
     }
@@ -72,21 +74,21 @@
     @ApiOperation("鍒嗛〉鏌ヨ")
     @PostMapping("/page")
     @CloudRequiredPermission("business:ywoutinbound:query")
-    public ApiResponse<PageData<YwOutinbound>> findPage (@RequestBody PageWrap<YwOutinbound> pageWrap) {
+    public ApiResponse<PageData<YwOutinbound>> findPage (@RequestBody PageWrap<YwOutinbound> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
         return ApiResponse.success(ywOutinboundService.findPage(pageWrap));
     }
 
     @ApiOperation("瀵煎嚭Excel")
     @PostMapping("/exportExcel")
     @CloudRequiredPermission("business:ywoutinbound:exportExcel")
-    public void exportExcel (@RequestBody PageWrap<YwOutinbound> pageWrap, HttpServletResponse response) {
+    public void exportExcel (@RequestBody PageWrap<YwOutinbound> pageWrap, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
         ExcelExporter.build(YwOutinbound.class).export(ywOutinboundService.findPage(pageWrap).getRecords(), "杩愮淮鍑哄叆搴撲俊鎭〃", response);
     }
 
     @ApiOperation("鏍规嵁ID鏌ヨ")
     @GetMapping("/{id}")
     @CloudRequiredPermission("business:ywoutinbound:query")
-    public ApiResponse findById(@PathVariable Integer id) {
+    public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
         return ApiResponse.success(ywOutinboundService.getDetail(id));
     }
 }
diff --git a/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwProblemController.java b/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwProblemController.java
index 2cacef4..310349f 100644
--- a/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwProblemController.java
+++ b/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwProblemController.java
@@ -2,6 +2,7 @@
 
 import com.doumee.api.BaseController;
 import com.doumee.config.annotation.CloudRequiredPermission;
+import com.doumee.config.annotation.LoginNoRequired;
 import com.doumee.core.annotation.excel.ExcelExporter;
 import com.doumee.core.annotation.pr.PreventRepeat;
 import com.doumee.core.model.ApiResponse;
@@ -32,10 +33,10 @@
     @Autowired
     private YwProblemService ywProblemService;
 
+    @LoginNoRequired
     @PreventRepeat
-    @ApiOperation("鏂板缓")
+    @ApiOperation("闂鎻愭姤")
     @PostMapping("/create")
-    @CloudRequiredPermission("business:ywproblem:create")
     public ApiResponse create(@RequestBody YwProblem ywProblem) {
         return ApiResponse.success(ywProblemService.create(ywProblem));
     }
diff --git a/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwStocktakingController.java b/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwStocktakingController.java
index 20745cf..97e1230 100644
--- a/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwStocktakingController.java
+++ b/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwStocktakingController.java
@@ -36,22 +36,23 @@
     @ApiOperation("鏂板缓")
     @PostMapping("/create")
     @CloudRequiredPermission("business:ywstocktaking:create")
-    public ApiResponse create(@RequestBody YwStocktaking ywStocktaking) {
+    public ApiResponse create(@RequestBody YwStocktaking ywStocktaking,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
+        ywStocktaking.setLoginUserInfo(this.getLoginUser(token));
         return ApiResponse.success(ywStocktakingService.create(ywStocktaking));
     }
 
     @ApiOperation("鏍规嵁ID鍒犻櫎")
     @GetMapping("/delete/{id}")
     @CloudRequiredPermission("business:ywstocktaking:delete")
-    public ApiResponse deleteById(@PathVariable Integer id) {
-        ywStocktakingService.deleteById(id);
+    public ApiResponse deleteById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
+        ywStocktakingService.deleteById(id,getLoginUser(token));
         return ApiResponse.success(null);
     }
 
     @ApiOperation("鎵归噺鍒犻櫎")
     @GetMapping("/delete/batch")
     @CloudRequiredPermission("business:ywstocktaking:delete")
-    public ApiResponse deleteByIdInBatch(@RequestParam String ids) {
+    public ApiResponse deleteByIdInBatch(@RequestParam String ids,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
         String [] idArray = ids.split(",");
         List<Integer> idList = new ArrayList<>();
         for (String id : idArray) {
@@ -64,7 +65,7 @@
     @ApiOperation("鏍规嵁ID淇敼")
     @PostMapping("/updateById")
     @CloudRequiredPermission("business:ywstocktaking:update")
-    public ApiResponse updateById(@RequestBody YwStocktaking ywStocktaking) {
+    public ApiResponse updateById(@RequestBody YwStocktaking ywStocktaking,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
         ywStocktakingService.updateById(ywStocktaking);
         return ApiResponse.success(null);
     }
@@ -72,21 +73,51 @@
     @ApiOperation("鍒嗛〉鏌ヨ")
     @PostMapping("/page")
     @CloudRequiredPermission("business:ywstocktaking:query")
-    public ApiResponse<PageData<YwStocktaking>> findPage (@RequestBody PageWrap<YwStocktaking> pageWrap) {
+    public ApiResponse<PageData<YwStocktaking>> findPage (@RequestBody PageWrap<YwStocktaking> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
         return ApiResponse.success(ywStocktakingService.findPage(pageWrap));
     }
 
     @ApiOperation("瀵煎嚭Excel")
     @PostMapping("/exportExcel")
     @CloudRequiredPermission("business:ywstocktaking:exportExcel")
-    public void exportExcel (@RequestBody PageWrap<YwStocktaking> pageWrap, HttpServletResponse response) {
+    public void exportExcel (@RequestBody PageWrap<YwStocktaking> pageWrap, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
         ExcelExporter.build(YwStocktaking.class).export(ywStocktakingService.findPage(pageWrap).getRecords(), "杩愮淮鐩樼偣淇℃伅琛�", response);
     }
 
     @ApiOperation("鏍规嵁ID鏌ヨ")
     @GetMapping("/{id}")
     @CloudRequiredPermission("business:ywstocktaking:query")
-    public ApiResponse findById(@PathVariable Integer id) {
-        return ApiResponse.success(ywStocktakingService.findById(id));
+    public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
+        return ApiResponse.success(ywStocktakingService.getDetail(id));
     }
+
+
+
+    @ApiOperation("鍙栨秷鐩樼偣鍗�")
+    @GetMapping("/cancelById")
+    @CloudRequiredPermission("business:ywstocktaking:delete")
+    public ApiResponse cancelById(@RequestParam Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
+        ywStocktakingService.cancelById(id,getLoginUser(token));
+        return ApiResponse.success(null);
+    }
+
+
+    @ApiOperation("寮�濮嬬洏鐐瑰崟")
+    @GetMapping("/beginById")
+    @CloudRequiredPermission("business:ywstocktaking:delete")
+    public ApiResponse beginById(@RequestParam Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
+        ywStocktakingService.beginById(id,getLoginUser(token));
+        return ApiResponse.success(null);
+    }
+
+
+    @ApiOperation("瀹屾垚鐩樼偣鍗�")
+    @GetMapping("/finishById")
+    @CloudRequiredPermission("business:ywstocktaking:delete")
+    public ApiResponse finishById(@RequestParam Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
+        ywStocktakingService.finishById(id,getLoginUser(token));
+        return ApiResponse.success(null);
+    }
+
+
 }
diff --git a/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwStocktakingRecordController.java b/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwStocktakingRecordController.java
index 295baa6..71a6469 100644
--- a/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwStocktakingRecordController.java
+++ b/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwStocktakingRecordController.java
@@ -36,14 +36,14 @@
     @ApiOperation("鏂板缓")
     @PostMapping("/create")
     @CloudRequiredPermission("business:ywstocktakingrecord:create")
-    public ApiResponse create(@RequestBody YwStocktakingRecord ywStocktakingRecord) {
+    public ApiResponse create(@RequestBody YwStocktakingRecord ywStocktakingRecord,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
         return ApiResponse.success(ywStocktakingRecordService.create(ywStocktakingRecord));
     }
 
     @ApiOperation("鏍规嵁ID鍒犻櫎")
     @GetMapping("/delete/{id}")
     @CloudRequiredPermission("business:ywstocktakingrecord:delete")
-    public ApiResponse deleteById(@PathVariable Integer id) {
+    public ApiResponse deleteById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
         ywStocktakingRecordService.deleteById(id);
         return ApiResponse.success(null);
     }
@@ -51,7 +51,7 @@
     @ApiOperation("鎵归噺鍒犻櫎")
     @GetMapping("/delete/batch")
     @CloudRequiredPermission("business:ywstocktakingrecord:delete")
-    public ApiResponse deleteByIdInBatch(@RequestParam String ids) {
+    public ApiResponse deleteByIdInBatch(@RequestParam String ids,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
         String [] idArray = ids.split(",");
         List<Integer> idList = new ArrayList<>();
         for (String id : idArray) {
@@ -64,7 +64,7 @@
     @ApiOperation("鏍规嵁ID淇敼")
     @PostMapping("/updateById")
     @CloudRequiredPermission("business:ywstocktakingrecord:update")
-    public ApiResponse updateById(@RequestBody YwStocktakingRecord ywStocktakingRecord) {
+    public ApiResponse updateById(@RequestBody YwStocktakingRecord ywStocktakingRecord,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
         ywStocktakingRecordService.updateById(ywStocktakingRecord);
         return ApiResponse.success(null);
     }
@@ -72,21 +72,32 @@
     @ApiOperation("鍒嗛〉鏌ヨ")
     @PostMapping("/page")
     @CloudRequiredPermission("business:ywstocktakingrecord:query")
-    public ApiResponse<PageData<YwStocktakingRecord>> findPage (@RequestBody PageWrap<YwStocktakingRecord> pageWrap) {
+    public ApiResponse<PageData<YwStocktakingRecord>> findPage (@RequestBody PageWrap<YwStocktakingRecord> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
         return ApiResponse.success(ywStocktakingRecordService.findPage(pageWrap));
     }
 
     @ApiOperation("瀵煎嚭Excel")
     @PostMapping("/exportExcel")
     @CloudRequiredPermission("business:ywstocktakingrecord:exportExcel")
-    public void exportExcel (@RequestBody PageWrap<YwStocktakingRecord> pageWrap, HttpServletResponse response) {
+    public void exportExcel (@RequestBody PageWrap<YwStocktakingRecord> pageWrap, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
         ExcelExporter.build(YwStocktakingRecord.class).export(ywStocktakingRecordService.findPage(pageWrap).getRecords(), "杩愮淮鐩樼偣鏄庣粏璁板綍琛�", response);
     }
 
     @ApiOperation("鏍规嵁ID鏌ヨ")
     @GetMapping("/{id}")
     @CloudRequiredPermission("business:ywstocktakingrecord:query")
-    public ApiResponse findById(@PathVariable Integer id) {
-        return ApiResponse.success(ywStocktakingRecordService.findById(id));
+    public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
+        return ApiResponse.success(ywStocktakingRecordService.getDetail(id));
     }
+
+
+    @ApiOperation("鐩樼偣鎻愪氦")
+    @PostMapping("/takingData")
+    @CloudRequiredPermission("business:ywstocktakingrecord:update")
+    public ApiResponse takingData(@RequestBody YwStocktakingRecord ywStocktakingRecord,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
+        ywStocktakingRecord.setLoginUserInfo(getLoginUser(token));
+        ywStocktakingRecordService.takingData(ywStocktakingRecord);
+        return ApiResponse.success(null);
+    }
+
 }
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/YwStocktakingRecordMapper.java b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/YwStocktakingRecordMapper.java
index 53fe3b7..c360f7f 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/YwStocktakingRecordMapper.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/YwStocktakingRecordMapper.java
@@ -2,11 +2,12 @@
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.doumee.dao.business.model.YwStocktakingRecord;
+import com.github.yulichang.base.MPJBaseMapper;
 
 /**
  * @author 姹熻箘韫�
  * @date 2025/01/06 11:05
  */
-public interface YwStocktakingRecordMapper extends BaseMapper<YwStocktakingRecord> {
+public interface YwStocktakingRecordMapper extends MPJBaseMapper<YwStocktakingRecord> {
 
 }
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwMaterial.java b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwMaterial.java
index 4fb5b81..5f23ec8 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwMaterial.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwMaterial.java
@@ -1,6 +1,9 @@
 package com.doumee.dao.business.model;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.doumee.core.annotation.excel.ExcelColumn;
+import com.doumee.core.model.LoginUserModel;
+import com.doumee.dao.system.model.Multifile;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import com.baomidou.mybatisplus.annotation.IdType;
@@ -19,7 +22,7 @@
 @Data
 @ApiModel("杩愮淮璧勪骇淇℃伅琛�")
 @TableName("`yw_material`")
-public class YwMaterial {
+public class YwMaterial extends LoginUserModel {
 
     @TableId(type = IdType.AUTO)
     @ApiModelProperty(value = "涓婚敭", example = "1")
@@ -54,8 +57,7 @@
 
     @ApiModelProperty(value = "鍚嶇О")
     @ExcelColumn(name="鍚嶇О")
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    private Date name;
+    private String name;
 
     @ApiModelProperty(value = "鐘舵�� 0鍚敤 1绂佺敤", example = "1")
     @ExcelColumn(name="鐘舵�� 0鍚敤 1绂佺敤")
@@ -105,4 +107,17 @@
     @ExcelColumn(name="鎵�灞炴埧婧愮紪鐮�(鍏宠仈yw_room)")
     private Integer roomId;
 
+    @ApiModelProperty(value = "鏄惁鑷姩缂栫爜锛�0=鍚︼紱1=鏄紱", example = "1")
+    @ExcelColumn(name="鏄惁鑷姩缂栫爜锛�0=鍚︼紱1=鏄紱")
+    private Integer autoCode;
+
+    @ApiModelProperty(value = "闄勪欢淇℃伅", example = "1")
+    @TableField(exist = false)
+    private Multifile multifile;
+
+    @ApiModelProperty(value = "鎵�灞為」鐩富閿�", example = "1")
+    @TableField(exist = false)
+    private Integer projectId;
+
+
 }
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwProblem.java b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwProblem.java
index 4d1cc4f..d6ab8c4 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwProblem.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwProblem.java
@@ -1,6 +1,8 @@
 package com.doumee.dao.business.model;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.doumee.core.annotation.excel.ExcelColumn;
+import com.doumee.dao.system.model.Multifile;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import com.baomidou.mybatisplus.annotation.IdType;
@@ -9,6 +11,7 @@
 import lombok.Data;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import java.util.Date;
+import java.util.List;
 
 /**
  * 杩愮淮闂涓婃姤淇℃伅琛�
@@ -65,8 +68,7 @@
 
     @ApiModelProperty(value = "涓婃姤浜哄鍚�")
     @ExcelColumn(name="涓婃姤浜哄鍚�")
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    private Date name;
+    private String name;
 
     @ApiModelProperty(value = "鑱旂郴鐢佃瘽")
     @ExcelColumn(name="鑱旂郴鐢佃瘽")
@@ -106,4 +108,7 @@
     @ExcelColumn(name="鍏宠仈宸ュ崟缂栫爜锛堝叧鑱攜w_workorder)")
     private Integer workorderId;
 
+    @ApiModelProperty(value = "闄勪欢淇℃伅")
+    @TableField(exist = false)
+    private List<Multifile> fileList;
 }
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwStocktaking.java b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwStocktaking.java
index ff2d0c3..3addc97 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwStocktaking.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwStocktaking.java
@@ -1,6 +1,8 @@
 package com.doumee.dao.business.model;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.doumee.core.annotation.excel.ExcelColumn;
+import com.doumee.core.model.LoginUserModel;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import com.baomidou.mybatisplus.annotation.IdType;
@@ -8,6 +10,8 @@
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.math.BigDecimal;
 import java.util.Date;
 
 /**
@@ -18,7 +22,7 @@
 @Data
 @ApiModel("杩愮淮鐩樼偣淇℃伅琛�")
 @TableName("`yw_stocktaking`")
-public class YwStocktaking {
+public class YwStocktaking extends LoginUserModel {
 
     @TableId(type = IdType.AUTO)
     @ApiModelProperty(value = "涓婚敭", example = "1")
@@ -61,7 +65,11 @@
 
     @ApiModelProperty(value = "鐩樼偣鍛樼紪鐮�(鍏宠仈system_user)")
     @ExcelColumn(name="鐩樼偣鍛樼紪鐮�(鍏宠仈system_user)")
-    private String userId;
+    private Integer userId;
+
+    @ApiModelProperty(value = "鍚嶇О")
+    @ExcelColumn(name="鍚嶇О")
+    private String name;
 
     @ApiModelProperty(value = "鐩樼偣鏃堕棿")
     @ExcelColumn(name="鐩樼偣鏃堕棿")
@@ -139,4 +147,35 @@
     @ExcelColumn(name="鍙栨秷澶囨敞")
     private String cancelInfo;
 
+    @ApiModelProperty(value = "浠撳簱鍚嶇О")
+    @TableField(exist = false)
+    private String warehouseName;
+
+    @ApiModelProperty(value = "鍒涘缓浜哄悕绉�")
+    @TableField(exist = false)
+    private String createName;
+
+    @ApiModelProperty(value = "鐩樼偣鍛樺悕绉�")
+    @TableField(exist = false)
+    private String userName;
+
+    @ApiModelProperty(value = "宸茬洏璁板綍鏁�")
+    @TableField(exist = false)
+    private Integer finishAmount;
+
+    @ApiModelProperty(value = "鏈洏璁板綍鏁�")
+    @TableField(exist = false)
+    private Integer unFinishAmount;
+
+    @ApiModelProperty(value = "鐩樼泩璁板綍鏁�")
+    @TableField(exist = false)
+    private Integer profitAmount;
+
+    @ApiModelProperty(value = "鐩樹簭璁板綍鏁�")
+    @TableField(exist = false)
+    private Integer lossAmount;
+
+    @ApiModelProperty(value = "鐩哥璁板綍鏁�")
+    @TableField(exist = false)
+    private Integer equalAmount;
 }
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwStocktakingRecord.java b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwStocktakingRecord.java
index 24f9096..6672876 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwStocktakingRecord.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwStocktakingRecord.java
@@ -1,6 +1,8 @@
 package com.doumee.dao.business.model;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.doumee.core.annotation.excel.ExcelColumn;
+import com.doumee.core.model.LoginUserModel;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import com.baomidou.mybatisplus.annotation.IdType;
@@ -19,7 +21,7 @@
 @Data
 @ApiModel("杩愮淮鐩樼偣鏄庣粏璁板綍琛�")
 @TableName("`yw_stocktaking_record`")
-public class YwStocktakingRecord {
+public class YwStocktakingRecord extends LoginUserModel {
 
     @TableId(type = IdType.AUTO)
     @ApiModelProperty(value = "涓婚敭", example = "1")
@@ -89,4 +91,49 @@
     @ExcelColumn(name="鐩樼偣璁″垝缂栫爜(鍏宠仈yw_stocktaking)")
     private Integer stocktakingId;
 
+    @ApiModelProperty(value = "璧勪骇缂栫爜")
+    @TableField(exist = false)
+    private String materialCode;
+
+    @ApiModelProperty(value = "璧勪骇鍚嶇О")
+    @TableField(exist = false)
+    private String materialName;
+
+    @ApiModelProperty(value = "璧勪骇鏉″舰鐮�")
+    @TableField(exist = false)
+    private String materialQrcode;
+
+    @ApiModelProperty(value = "璧勪骇鍝佺墝")
+    @TableField(exist = false)
+    private String materialBrand;
+
+    @ApiModelProperty(value = "璧勪骇瑙勬牸鍨嬪彿")
+    @TableField(exist = false)
+    private String materialAttr;
+
+    @ApiModelProperty(value = "璧勪骇鍗曚綅")
+    @TableField(exist = false)
+    private String materialUnitName;
+
+    @ApiModelProperty(value = "浠撳簱鍚嶇О")
+    @TableField(exist = false)
+    private String warehouseName;
+
+    @ApiModelProperty(value = "鐩樼偣浜哄悕绉�")
+    @TableField(exist = false)
+    private String userName;
+
+    @ApiModelProperty(value = "鐩樼偣浜虹粍缁囧悕绉�")
+    @TableField(exist = false)
+    private String companyName;
+
+
+
+
+
+
+
+
+
+
 }
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/YwMaterialService.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/YwMaterialService.java
index 7a38321..6da3431 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/YwMaterialService.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/YwMaterialService.java
@@ -55,6 +55,8 @@
      */
     void updateByIdInBatch(List<YwMaterial> ywMaterials);
 
+    void updateStatus(YwMaterial ywMaterials);
+
     /**
      * 涓婚敭鏌ヨ
      *
@@ -94,4 +96,6 @@
      * @return long
      */
     long count(YwMaterial ywMaterial);
+
+    YwMaterial getDetail(Integer id);
 }
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/YwStocktakingRecordService.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/YwStocktakingRecordService.java
index a38adba..0c2f5db 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/YwStocktakingRecordService.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/YwStocktakingRecordService.java
@@ -63,6 +63,7 @@
      */
     YwStocktakingRecord findById(Integer id);
 
+    YwStocktakingRecord getDetail(Integer id);
     /**
      * 鏉′欢鏌ヨ鍗曟潯璁板綍
      *
@@ -94,4 +95,6 @@
      * @return long
      */
     long count(YwStocktakingRecord ywStocktakingRecord);
+
+    void takingData(YwStocktakingRecord ywStocktakingRecord);
 }
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/YwStocktakingService.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/YwStocktakingService.java
index 268420f..0df5bf2 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/YwStocktakingService.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/YwStocktakingService.java
@@ -1,5 +1,6 @@
 package com.doumee.service.business;
 
+import com.doumee.core.model.LoginUserInfo;
 import com.doumee.core.model.PageData;
 import com.doumee.core.model.PageWrap;
 import com.doumee.dao.business.model.YwStocktaking;
@@ -25,8 +26,13 @@
      *
      * @param id 涓婚敭
      */
-    void deleteById(Integer id);
+    void deleteById(Integer id, LoginUserInfo loginUserInfo);
 
+    void cancelById(Integer id, LoginUserInfo loginUserInfo);
+
+    void beginById(Integer id, LoginUserInfo loginUserInfo);
+
+    void finishById(Integer id, LoginUserInfo loginUserInfo);
     /**
      * 鍒犻櫎
      *
@@ -63,6 +69,7 @@
      */
     YwStocktaking findById(Integer id);
 
+    YwStocktaking getDetail(Integer id);
     /**
      * 鏉′欢鏌ヨ鍗曟潯璁板綍
      *
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwMaterialServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwMaterialServiceImpl.java
index 27e1c16..90dde7f 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwMaterialServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwMaterialServiceImpl.java
@@ -1,20 +1,37 @@
 package com.doumee.service.business.impl;
 
+import com.doumee.biz.system.SystemDictDataBiz;
+import com.doumee.core.constants.ResponseStatus;
+import com.doumee.core.exception.BusinessException;
+import com.doumee.core.model.LoginUserInfo;
+import com.doumee.core.model.LoginUserModel;
 import com.doumee.core.model.PageData;
 import com.doumee.core.model.PageWrap;
+import com.doumee.core.utils.Constants;
 import com.doumee.core.utils.Utils;
 import com.doumee.dao.business.YwMaterialMapper;
-import com.doumee.dao.business.model.YwMaterial;
+import com.doumee.dao.business.YwOutinboundMapper;
+import com.doumee.dao.business.YwOutinboundRecordMapper;
+import com.doumee.dao.business.model.*;
+import com.doumee.dao.system.MultifileMapper;
+import com.doumee.dao.system.model.Multifile;
 import com.doumee.service.business.YwMaterialService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.github.yulichang.base.MPJBaseMapper;
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import org.apache.commons.lang.StringUtils;
+import org.checkerframework.checker.units.qual.A;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
+import java.util.Date;
 import java.util.List;
+import java.util.Objects;
 
 /**
  * 杩愮淮璧勪骇淇℃伅琛⊿ervice瀹炵幇
@@ -27,15 +44,69 @@
     @Autowired
     private YwMaterialMapper ywMaterialMapper;
 
+    @Autowired
+    private MultifileMapper multifileMapper;
+
+    @Autowired
+    private YwOutinboundRecordMapper ywOutinboundRecordMapper;
+
+    @Autowired
+    private SystemDictDataBiz systemDictDataBiz;
+
     @Override
+    @Transactional(rollbackFor = {Exception.class,BusinessException.class})
     public Integer create(YwMaterial ywMaterial) {
+        //TODO rk 鎵�灞為」鐩�/鎴块棿闇�姹傞棶棰�
+        if(Objects.isNull(ywMaterial)
+            || StringUtils.isBlank(ywMaterial.getName())
+                || StringUtils.isBlank(ywMaterial.getCode())
+                || StringUtils.isBlank(ywMaterial.getQrcode())
+                || Objects.isNull(ywMaterial.getCateId())
+        ){
+            throw new BusinessException(ResponseStatus.BAD_REQUEST);
+        }
+        ywMaterial.setId(null);
+        if(StringUtils.isBlank(ywMaterial.getCode())){
+            //鑷姩鐢熸垚 TODO 瀛樺湪闂
+            Long countCode = ywMaterialMapper.selectCount(new QueryWrapper<YwMaterial>().lambda().eq(YwMaterial::getAutoCode, Constants.ONE));
+            String nextCode = StringUtils.leftPad(Long.toString(countCode + 1),4,"0");
+            ywMaterial.setCode("P"+nextCode);
+            ywMaterial.setAutoCode(Constants.ONE);
+        }else{
+            //楠岃瘉code鏄惁瀛樺湪
+            if(ywMaterialMapper.selectCount(new QueryWrapper<YwMaterial>().lambda().eq(YwMaterial::getCode, ywMaterial.getCode()))>0){
+                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"褰撳墠缂栫爜宸插瓨鍦�");
+            };
+            ywMaterial.setAutoCode(Constants.ZERO);
+        }
+        LoginUserInfo loginUserInfo = ywMaterial.getLoginUserInfo();
+        ywMaterial.setCreator(loginUserInfo.getId());
+        ywMaterial.setCreateDate(new Date());
+        ywMaterial.setIsdeleted(Constants.ZERO);
+        ywMaterial.setStatus(Constants.ZERO);
         ywMaterialMapper.insert(ywMaterial);
+
+        if(Objects.nonNull(ywMaterial.getMultifile())){
+            if(org.apache.commons.lang3.StringUtils.isBlank(ywMaterial.getMultifile().getFileurl())
+                    || org.apache.commons.lang3.StringUtils.isBlank(ywMaterial.getMultifile().getName())){
+                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"闄勪欢淇℃伅閿欒");
+            }
+            ywMaterial.getMultifile().setCreator(loginUserInfo.getId());
+            ywMaterial.getMultifile().setCreateDate(new Date());
+            ywMaterial.getMultifile().setIsdeleted(Constants.ZERO);
+            ywMaterial.getMultifile().setObjType(Constants.MultiFile.MATERIAL_FILE.getKey());
+            ywMaterial.getMultifile().setObjId(ywMaterial.getId());
+            multifileMapper.insert(ywMaterial.getMultifile());
+        }
         return ywMaterial.getId();
     }
 
     @Override
     public void deleteById(Integer id) {
-        ywMaterialMapper.deleteById(id);
+        if(ywOutinboundRecordMapper.selectCount(new QueryWrapper<YwOutinboundRecord>().lambda().eq(YwOutinboundRecord::getMaterialId,id))>Constants.ZERO){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"褰撳墠璧勪骇宸叉湁鍑哄叆搴撹褰曪紝涓嶅彲鍒犻櫎");
+        }
+        ywMaterialMapper.update(new UpdateWrapper<YwMaterial>().lambda().set(YwMaterial::getIsdeleted,Constants.ONE).eq(YwMaterial::getId,id));
     }
 
     @Override
@@ -53,8 +124,36 @@
     }
 
     @Override
+    @Transactional(rollbackFor = {Exception.class,BusinessException.class})
     public void updateById(YwMaterial ywMaterial) {
+        //TODO rk 鎵�灞為」鐩�/鎴块棿闇�姹傞棶棰�
+        if(Objects.isNull(ywMaterial)
+                || StringUtils.isBlank(ywMaterial.getName())
+                || StringUtils.isBlank(ywMaterial.getCode())
+                || StringUtils.isBlank(ywMaterial.getQrcode())
+                || Objects.isNull(ywMaterial.getCateId())
+                || Objects.isNull(ywMaterial.getId())
+        ){
+            throw new BusinessException(ResponseStatus.BAD_REQUEST);
+        }
+        ywMaterial.setCode(null);
+        LoginUserInfo loginUserInfo = ywMaterial.getLoginUserInfo();
+        ywMaterial.setEditor(loginUserInfo.getId());
+        ywMaterial.setEditDate(new Date());
         ywMaterialMapper.updateById(ywMaterial);
+        multifileMapper.delete(new QueryWrapper<Multifile>().lambda().eq(Multifile::getObjType,Constants.MultiFile.MATERIAL_FILE.getKey()).eq(Multifile::getObjId,ywMaterial.getId()));
+        if(Objects.nonNull(ywMaterial.getMultifile())){
+            if(org.apache.commons.lang3.StringUtils.isBlank(ywMaterial.getMultifile().getFileurl())
+                    || org.apache.commons.lang3.StringUtils.isBlank(ywMaterial.getMultifile().getName())){
+                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"闄勪欢淇℃伅閿欒");
+            }
+            ywMaterial.getMultifile().setCreator(loginUserInfo.getId());
+            ywMaterial.getMultifile().setCreateDate(new Date());
+            ywMaterial.getMultifile().setIsdeleted(Constants.ZERO);
+            ywMaterial.getMultifile().setObjType(Constants.MultiFile.MATERIAL_FILE.getKey());
+            ywMaterial.getMultifile().setObjId(ywMaterial.getId());
+            multifileMapper.insert(ywMaterial.getMultifile());
+        }
     }
 
     @Override
@@ -68,8 +167,34 @@
     }
 
     @Override
+    public void updateStatus(YwMaterial ywMaterials) {
+       if(Objects.isNull(ywMaterials)
+           || Objects.isNull(ywMaterials.getId())
+           || Objects.isNull(ywMaterials.getStatus())){
+           throw new BusinessException(ResponseStatus.BAD_REQUEST);
+       }
+        ywMaterialMapper.update(new UpdateWrapper<YwMaterial>().lambda().eq(YwMaterial::getId,ywMaterials.getId()).set(YwMaterial::getStatus,ywMaterials.getStatus()));
+    }
+
+    @Override
     public YwMaterial findById(Integer id) {
         return ywMaterialMapper.selectById(id);
+    }
+
+    @Override
+    public YwMaterial getDetail(Integer id) {
+        YwMaterial ywMaterial = ywMaterialMapper.selectById(id);
+        if(Objects.isNull(ywMaterial)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY);
+        }
+        Multifile multifile = multifileMapper.selectOne(new QueryWrapper<Multifile>().lambda().eq(Multifile::getObjId,id).eq(Multifile::getObjType,Constants.MultiFile.MATERIAL_FILE.getKey()));
+        if(Objects.nonNull(multifile)){
+            String path = systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_RESOURCE_PATH).getCode()
+                    +systemDictDataBiz.queryByCode(Constants.FTP,Constants.YW_CONTRACT_BILL).getCode();
+            multifile.setFileurlFull(path + multifile.getFileurl());
+            ywMaterial.setMultifile(multifile);
+        }
+        return ywMaterial;
     }
 
     @Override
@@ -87,79 +212,21 @@
     @Override
     public PageData<YwMaterial> findPage(PageWrap<YwMaterial> pageWrap) {
         IPage<YwMaterial> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
-        QueryWrapper<YwMaterial> queryWrapper = new QueryWrapper<>();
+        MPJLambdaWrapper<YwMaterial> queryWrapper = new MPJLambdaWrapper<>();
         Utils.MP.blankToNull(pageWrap.getModel());
-        if (pageWrap.getModel().getId() != null) {
-            queryWrapper.lambda().eq(YwMaterial::getId, pageWrap.getModel().getId());
-        }
-        if (pageWrap.getModel().getCreator() != null) {
-            queryWrapper.lambda().eq(YwMaterial::getCreator, pageWrap.getModel().getCreator());
-        }
-        if (pageWrap.getModel().getCreateDate() != null) {
-            queryWrapper.lambda().ge(YwMaterial::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate()));
-            queryWrapper.lambda().le(YwMaterial::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate()));
-        }
-        if (pageWrap.getModel().getEditor() != null) {
-            queryWrapper.lambda().eq(YwMaterial::getEditor, pageWrap.getModel().getEditor());
-        }
-        if (pageWrap.getModel().getEditDate() != null) {
-            queryWrapper.lambda().ge(YwMaterial::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate()));
-            queryWrapper.lambda().le(YwMaterial::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate()));
-        }
-        if (pageWrap.getModel().getIsdeleted() != null) {
-            queryWrapper.lambda().eq(YwMaterial::getIsdeleted, pageWrap.getModel().getIsdeleted());
-        }
-        if (pageWrap.getModel().getRemark() != null) {
-            queryWrapper.lambda().eq(YwMaterial::getRemark, pageWrap.getModel().getRemark());
-        }
-        if (pageWrap.getModel().getName() != null) {
-            queryWrapper.lambda().ge(YwMaterial::getName, Utils.Date.getStart(pageWrap.getModel().getName()));
-            queryWrapper.lambda().le(YwMaterial::getName, Utils.Date.getEnd(pageWrap.getModel().getName()));
-        }
-        if (pageWrap.getModel().getStatus() != null) {
-            queryWrapper.lambda().eq(YwMaterial::getStatus, pageWrap.getModel().getStatus());
-        }
-        if (pageWrap.getModel().getCode() != null) {
-            queryWrapper.lambda().eq(YwMaterial::getCode, pageWrap.getModel().getCode());
-        }
-        if (pageWrap.getModel().getParentCateId() != null) {
-            queryWrapper.lambda().eq(YwMaterial::getParentCateId, pageWrap.getModel().getParentCateId());
-        }
-        if (pageWrap.getModel().getCateId() != null) {
-            queryWrapper.lambda().eq(YwMaterial::getCateId, pageWrap.getModel().getCateId());
-        }
-        if (pageWrap.getModel().getQrcode() != null) {
-            queryWrapper.lambda().eq(YwMaterial::getQrcode, pageWrap.getModel().getQrcode());
-        }
-        if (pageWrap.getModel().getSortnum() != null) {
-            queryWrapper.lambda().eq(YwMaterial::getSortnum, pageWrap.getModel().getSortnum());
-        }
-        if (pageWrap.getModel().getBrand() != null) {
-            queryWrapper.lambda().eq(YwMaterial::getBrand, pageWrap.getModel().getBrand());
-        }
-        if (pageWrap.getModel().getAttr() != null) {
-            queryWrapper.lambda().eq(YwMaterial::getAttr, pageWrap.getModel().getAttr());
-        }
-        if (pageWrap.getModel().getMinStock() != null) {
-            queryWrapper.lambda().eq(YwMaterial::getMinStock, pageWrap.getModel().getMinStock());
-        }
-        if (pageWrap.getModel().getMaxStock() != null) {
-            queryWrapper.lambda().eq(YwMaterial::getMaxStock, pageWrap.getModel().getMaxStock());
-        }
-        if (pageWrap.getModel().getUnitName() != null) {
-            queryWrapper.lambda().eq(YwMaterial::getUnitName, pageWrap.getModel().getUnitName());
-        }
-        if (pageWrap.getModel().getRoomId() != null) {
-            queryWrapper.lambda().eq(YwMaterial::getRoomId, pageWrap.getModel().getRoomId());
-        }
-        for(PageWrap.SortData sortData: pageWrap.getSorts()) {
-            if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) {
-                queryWrapper.orderByDesc(sortData.getProperty());
-            } else {
-                queryWrapper.orderByAsc(sortData.getProperty());
-            }
-        }
-        return PageData.from(ywMaterialMapper.selectPage(page, queryWrapper));
+        YwMaterial model = pageWrap.getModel();
+        queryWrapper.selectAll(YwMaterial.class)
+                .leftJoin(YwRoom.class,YwRoom::getId,YwMaterial::getRoomId)
+                .and(StringUtils.isNotBlank(model.getCode()),i->i.like(YwMaterial::getCode,model.getCode()).or().like(YwMaterial::getName,model.getCode()))
+                .like(StringUtils.isNotBlank(model.getAttr()),YwMaterial::getAttr,model.getAttr())
+                .eq(Objects.nonNull(model.getProjectId()),YwRoom::getProjectId,model.getProjectId())
+                .eq(Objects.nonNull(model.getRoomId()),YwMaterial::getRoomId,model.getRoomId())
+                .eq(YwMaterial::getIsdeleted,Constants.ZERO)
+                .orderByAsc(YwMaterial::getCode)
+        ;
+
+        IPage iPage = ywMaterialMapper.selectJoinPage(page,YwMaterial.class,queryWrapper);
+        return PageData.from(iPage);
     }
 
     @Override
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwOutinboundServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwOutinboundServiceImpl.java
index 37a7c72..21d53b2 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwOutinboundServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwOutinboundServiceImpl.java
@@ -126,8 +126,6 @@
             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"璧勪骇淇℃伅瀛樺湪寮傚父锛岃妫�鏌ユ暟鎹紒");
         }
         return recordList;
-
-
     }
 
     public void dealStockData(YwOutinbound ywOutinbound,List<YwOutinboundRecord> recordList,Integer inOut){
@@ -168,9 +166,6 @@
             }
         }
     }
-
-
-
 
     @Override
     public void deleteById(Integer id) {
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwProblemServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwProblemServiceImpl.java
index 60ba960..5ee8050 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwProblemServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwProblemServiceImpl.java
@@ -1,20 +1,29 @@
 package com.doumee.service.business.impl;
 
+import com.doumee.core.constants.ResponseStatus;
+import com.doumee.core.exception.BusinessException;
 import com.doumee.core.model.PageData;
 import com.doumee.core.model.PageWrap;
+import com.doumee.core.utils.Constants;
 import com.doumee.core.utils.Utils;
 import com.doumee.dao.business.YwProblemMapper;
 import com.doumee.dao.business.model.YwProblem;
+import com.doumee.dao.system.MultifileMapper;
+import com.doumee.dao.system.model.Multifile;
 import com.doumee.service.business.YwProblemService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
+import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
+import java.util.Objects;
 
 /**
  * 杩愮淮闂涓婃姤淇℃伅琛⊿ervice瀹炵幇
@@ -27,9 +36,44 @@
     @Autowired
     private YwProblemMapper ywProblemMapper;
 
+    @Autowired
+    private MultifileMapper multifileMapper;
+
     @Override
     public Integer create(YwProblem ywProblem) {
+        if(Objects.isNull(ywProblem)
+            || Objects.isNull(ywProblem.getSubmitDate())
+            || StringUtils.isBlank(ywProblem.getContent())
+            || StringUtils.isBlank(ywProblem.getPhone())
+            || StringUtils.isBlank(ywProblem.getName())
+        ){
+            throw new BusinessException(ResponseStatus.BAD_REQUEST);
+        }
+        ywProblem.setCreateDate(new Date());
+        ywProblem.setIsdeleted(Constants.ZERO);
+        ywProblem.setStatus(Constants.ZERO);
+        ywProblem.setDealStatus(Constants.ZERO);
         ywProblemMapper.insert(ywProblem);
+
+        List<Multifile> fileList = new ArrayList<>();
+        if(ywProblem.getFileList()!=null && ywProblem.getFileList().size()>0){
+            for (int i = 0; i <  ywProblem.getFileList().size(); i++) {
+                Multifile multifile =  ywProblem.getFileList().get(i);
+                if(StringUtils.isBlank(multifile.getFileurl())){
+                    continue;
+                }
+                multifile.setCreateDate(ywProblem.getCreateDate());
+                multifile.setIsdeleted(Constants.ZERO);
+                multifile.setObjId(ywProblem.getId());
+                multifile.setObjType(Constants.MultiFile.PROBLEM_FILE.getKey());
+                multifile.setSortnum(i+1);
+                fileList.add(multifile);
+            }
+        }
+        if(fileList.size()>0){
+            multifileMapper.insert(fileList);
+        }
+
         return ywProblem.getId();
     }
 
@@ -120,10 +164,6 @@
         }
         if (pageWrap.getModel().getContent() != null) {
             queryWrapper.lambda().eq(YwProblem::getContent, pageWrap.getModel().getContent());
-        }
-        if (pageWrap.getModel().getName() != null) {
-            queryWrapper.lambda().ge(YwProblem::getName, Utils.Date.getStart(pageWrap.getModel().getName()));
-            queryWrapper.lambda().le(YwProblem::getName, Utils.Date.getEnd(pageWrap.getModel().getName()));
         }
         if (pageWrap.getModel().getPhone() != null) {
             queryWrapper.lambda().eq(YwProblem::getPhone, pageWrap.getModel().getPhone());
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwStocktakingRecordServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwStocktakingRecordServiceImpl.java
index 70631e9..a03a028 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwStocktakingRecordServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwStocktakingRecordServiceImpl.java
@@ -1,20 +1,32 @@
 package com.doumee.service.business.impl;
 
+import com.doumee.core.constants.ResponseStatus;
+import com.doumee.core.exception.BusinessException;
+import com.doumee.core.model.LoginUserInfo;
 import com.doumee.core.model.PageData;
 import com.doumee.core.model.PageWrap;
+import com.doumee.core.utils.Constants;
+import com.doumee.core.utils.DateUtil;
 import com.doumee.core.utils.Utils;
+import com.doumee.dao.business.YwStocktakingMapper;
 import com.doumee.dao.business.YwStocktakingRecordMapper;
-import com.doumee.dao.business.model.YwStocktakingRecord;
+import com.doumee.dao.business.model.*;
+import com.doumee.dao.system.model.SystemUser;
 import com.doumee.service.business.YwStocktakingRecordService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
+import java.math.BigDecimal;
 import java.util.List;
+import java.util.Objects;
 
 /**
  * 杩愮淮鐩樼偣鏄庣粏璁板綍琛⊿ervice瀹炵幇
@@ -26,6 +38,10 @@
 
     @Autowired
     private YwStocktakingRecordMapper ywStocktakingRecordMapper;
+
+    @Autowired
+    private YwStocktakingMapper ywStocktakingMapper;
+
 
     @Override
     public Integer create(YwStocktakingRecord ywStocktakingRecord) {
@@ -72,6 +88,31 @@
         return ywStocktakingRecordMapper.selectById(id);
     }
 
+
+    @Override
+    public YwStocktakingRecord getDetail(Integer id) {
+        MPJLambdaWrapper<YwStocktakingRecord> queryWrapper = new MPJLambdaWrapper<>();
+        queryWrapper.selectAll(YwStocktakingRecord.class)
+                .selectAs(YwWarehouse::getName, YwStocktakingRecord::getWarehouseName)
+                .selectAs(YwMaterial::getCode,YwStocktakingRecord::getMaterialCode)
+                .selectAs(YwMaterial::getName,YwStocktakingRecord::getMaterialName)
+                .selectAs(YwMaterial::getQrcode,YwStocktakingRecord::getMaterialQrcode)
+                .selectAs(YwMaterial::getBrand,YwStocktakingRecord::getMaterialBrand)
+                .selectAs(YwMaterial::getUnitName,YwStocktakingRecord::getMaterialUnitName)
+                .selectAs(YwMaterial::getAttr,YwStocktakingRecord::getMaterialAttr)
+                .selectAs(Company::getName,YwStocktakingRecord::getCompanyName)
+                .selectAs(SystemUser::getRealname,YwStocktakingRecord::getUserName)
+                .leftJoin(YwStocktaking.class,YwStocktaking::getId,YwStocktakingRecord::getStocktakingId)
+                .leftJoin(YwWarehouse.class,YwWarehouse::getId,YwStocktaking::getWarehouseId)
+                .leftJoin(YwMaterial.class,YwMaterial::getId,YwStocktakingRecord::getMaterialId)
+                .leftJoin(SystemUser.class,SystemUser::getId,YwStocktakingRecord::getUserId)
+                .leftJoin(Company.class,Company::getId,SystemUser::getCompanyId)
+                .eq(YwStocktakingRecord::getId,id)
+                .last(" limit 1 ");
+        ;
+        return ywStocktakingRecordMapper.selectOne(queryWrapper);
+    }
+
     @Override
     public YwStocktakingRecord findOne(YwStocktakingRecord ywStocktakingRecord) {
         QueryWrapper<YwStocktakingRecord> wrapper = new QueryWrapper<>(ywStocktakingRecord);
@@ -87,67 +128,26 @@
     @Override
     public PageData<YwStocktakingRecord> findPage(PageWrap<YwStocktakingRecord> pageWrap) {
         IPage<YwStocktakingRecord> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
-        QueryWrapper<YwStocktakingRecord> queryWrapper = new QueryWrapper<>();
+        MPJLambdaWrapper<YwStocktakingRecord> queryWrapper = new MPJLambdaWrapper<>();
         Utils.MP.blankToNull(pageWrap.getModel());
-        if (pageWrap.getModel().getId() != null) {
-            queryWrapper.lambda().eq(YwStocktakingRecord::getId, pageWrap.getModel().getId());
-        }
-        if (pageWrap.getModel().getCreator() != null) {
-            queryWrapper.lambda().eq(YwStocktakingRecord::getCreator, pageWrap.getModel().getCreator());
-        }
-        if (pageWrap.getModel().getCreateDate() != null) {
-            queryWrapper.lambda().ge(YwStocktakingRecord::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate()));
-            queryWrapper.lambda().le(YwStocktakingRecord::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate()));
-        }
-        if (pageWrap.getModel().getEditor() != null) {
-            queryWrapper.lambda().eq(YwStocktakingRecord::getEditor, pageWrap.getModel().getEditor());
-        }
-        if (pageWrap.getModel().getEditDate() != null) {
-            queryWrapper.lambda().ge(YwStocktakingRecord::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate()));
-            queryWrapper.lambda().le(YwStocktakingRecord::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate()));
-        }
-        if (pageWrap.getModel().getIsdeleted() != null) {
-            queryWrapper.lambda().eq(YwStocktakingRecord::getIsdeleted, pageWrap.getModel().getIsdeleted());
-        }
-        if (pageWrap.getModel().getRemark() != null) {
-            queryWrapper.lambda().eq(YwStocktakingRecord::getRemark, pageWrap.getModel().getRemark());
-        }
-        if (pageWrap.getModel().getStatus() != null) {
-            queryWrapper.lambda().eq(YwStocktakingRecord::getStatus, pageWrap.getModel().getStatus());
-        }
-        if (pageWrap.getModel().getUserId() != null) {
-            queryWrapper.lambda().eq(YwStocktakingRecord::getUserId, pageWrap.getModel().getUserId());
-        }
-        if (pageWrap.getModel().getPlanDate() != null) {
-            queryWrapper.lambda().ge(YwStocktakingRecord::getPlanDate, Utils.Date.getStart(pageWrap.getModel().getPlanDate()));
-            queryWrapper.lambda().le(YwStocktakingRecord::getPlanDate, Utils.Date.getEnd(pageWrap.getModel().getPlanDate()));
-        }
-        if (pageWrap.getModel().getCode() != null) {
-            queryWrapper.lambda().eq(YwStocktakingRecord::getCode, pageWrap.getModel().getCode());
-        }
-        if (pageWrap.getModel().getMaterialId() != null) {
-            queryWrapper.lambda().eq(YwStocktakingRecord::getMaterialId, pageWrap.getModel().getMaterialId());
-        }
-        if (pageWrap.getModel().getStock() != null) {
-            queryWrapper.lambda().eq(YwStocktakingRecord::getStock, pageWrap.getModel().getStock());
-        }
-        if (pageWrap.getModel().getActStock() != null) {
-            queryWrapper.lambda().eq(YwStocktakingRecord::getActStock, pageWrap.getModel().getActStock());
-        }
-        if (pageWrap.getModel().getType() != null) {
-            queryWrapper.lambda().eq(YwStocktakingRecord::getType, pageWrap.getModel().getType());
-        }
-        if (pageWrap.getModel().getStocktakingId() != null) {
-            queryWrapper.lambda().eq(YwStocktakingRecord::getStocktakingId, pageWrap.getModel().getStocktakingId());
-        }
-        for(PageWrap.SortData sortData: pageWrap.getSorts()) {
-            if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) {
-                queryWrapper.orderByDesc(sortData.getProperty());
-            } else {
-                queryWrapper.orderByAsc(sortData.getProperty());
-            }
-        }
-        return PageData.from(ywStocktakingRecordMapper.selectPage(page, queryWrapper));
+        YwStocktakingRecord model = pageWrap.getModel() ;
+        queryWrapper.selectAll(YwStocktakingRecord.class)
+                .selectAs(YwWarehouse::getName, YwStocktakingRecord::getWarehouseName)
+                .selectAs(YwMaterial::getCode,YwStocktakingRecord::getMaterialCode)
+                .selectAs(YwMaterial::getName,YwStocktakingRecord::getMaterialName)
+                .selectAs(YwMaterial::getQrcode,YwStocktakingRecord::getMaterialQrcode)
+                .selectAs(YwMaterial::getBrand,YwStocktakingRecord::getMaterialBrand)
+                .selectAs(YwMaterial::getUnitName,YwStocktakingRecord::getMaterialUnitName)
+                .selectAs(YwMaterial::getAttr,YwStocktakingRecord::getMaterialAttr)
+                .leftJoin(YwStocktaking.class,YwStocktaking::getId,YwStocktakingRecord::getStocktakingId)
+                .leftJoin(YwWarehouse.class,YwWarehouse::getId,YwStocktaking::getWarehouseId)
+                .leftJoin(YwMaterial.class,YwMaterial::getId,YwStocktakingRecord::getMaterialId)
+                .eq(Objects.nonNull(model.getStocktakingId()),YwStocktakingRecord::getStocktakingId,model.getStocktakingId())
+                .and(StringUtils.isNotBlank(model.getMaterialCode()),i->i.like(YwMaterial::getCode,model.getMaterialCode()).or().like(YwMaterial::getName,model.getMaterialCode()))
+                .eq(Objects.nonNull(model.getType()),YwStocktakingRecord::getType,model.getType())
+                .eq(Objects.nonNull(model.getStatus()),YwStocktakingRecord::getStatus,model.getStatus());
+        IPage iPage = ywStocktakingRecordMapper.selectJoinPage(page, YwStocktakingRecord.class,queryWrapper);
+        return PageData.from(iPage);
     }
 
     @Override
@@ -155,4 +155,51 @@
         QueryWrapper<YwStocktakingRecord> wrapper = new QueryWrapper<>(ywStocktakingRecord);
         return ywStocktakingRecordMapper.selectCount(wrapper);
     }
+
+    @Override
+    @Transactional(rollbackFor = {Exception.class,BusinessException.class})
+    public void takingData(YwStocktakingRecord ywStocktakingRecord) {
+        if(Objects.isNull(ywStocktakingRecord)
+            || Objects.isNull(ywStocktakingRecord.getId())
+            || Objects.isNull(ywStocktakingRecord.getActStock())
+            || ywStocktakingRecord.getActStock().compareTo(BigDecimal.ZERO) < 0
+        ){
+            throw new BusinessException(ResponseStatus.BAD_REQUEST);
+        }
+        LoginUserInfo loginUserInfo = ywStocktakingRecord.getLoginUserInfo();
+        YwStocktakingRecord model = ywStocktakingRecordMapper.selectById(ywStocktakingRecord.getId());
+        if(Objects.nonNull(model)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY);
+        }
+        YwStocktaking ywStocktaking = ywStocktakingMapper.selectById(ywStocktakingRecord.getStocktakingId());
+        if(Objects.isNull(ywStocktaking)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY);
+        }
+        if(!Constants.equalsInteger(loginUserInfo.getId(),ywStocktaking.getUserId())){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炴偍鐨勭洏鐐瑰崟鏃犳硶杩涜鎿嶄綔");
+        }
+        if(!Constants.equalsInteger(ywStocktaking.getStatus(),Constants.ONE)){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鐩樼偣璁㈢姸鎬佸凡娴佽浆锛屾棤娉曡繘琛岃鎿嶄綔");
+        }
+        if(ywStocktakingRecord.getActStock().compareTo(model.getStock())==Constants.ZERO){
+            ywStocktakingRecord.setType(Constants.ZERO);
+        }else if(ywStocktakingRecord.getActStock().compareTo(model.getStock())>Constants.ZERO){
+            ywStocktakingRecord.setType(Constants.TWO);
+        }else{
+            ywStocktakingRecord.setType(Constants.ONE);
+        }
+        ywStocktakingRecordMapper.update(new UpdateWrapper<YwStocktakingRecord>().lambda()
+                .set(YwStocktakingRecord::getStatus,Constants.ONE)
+                .set(YwStocktakingRecord::getType,ywStocktakingRecord.getType())
+                .set(YwStocktakingRecord::getActStock,ywStocktakingRecord.getActStock())
+                .set(YwStocktakingRecord::getUserId,loginUserInfo.getId())
+                .set(YwStocktakingRecord::getPlanDate, DateUtil.getCurrDateTime())
+                .eq(YwStocktakingRecord::getId,ywStocktakingRecord.getId())
+        );
+
+
+
+    }
+
+
 }
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwStocktakingServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwStocktakingServiceImpl.java
index 4901208..cd0e102 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwStocktakingServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwStocktakingServiceImpl.java
@@ -1,20 +1,38 @@
 package com.doumee.service.business.impl;
 
+import com.doumee.core.constants.ResponseStatus;
+import com.doumee.core.exception.BusinessException;
+import com.doumee.core.model.LoginUserInfo;
 import com.doumee.core.model.PageData;
 import com.doumee.core.model.PageWrap;
+import com.doumee.core.utils.Constants;
+import com.doumee.core.utils.DateUtil;
 import com.doumee.core.utils.Utils;
+import com.doumee.core.utils.redis.RedisUtil;
+import com.doumee.dao.business.YwStockMapper;
 import com.doumee.dao.business.YwStocktakingMapper;
-import com.doumee.dao.business.model.YwStocktaking;
+import com.doumee.dao.business.YwStocktakingRecordMapper;
+import com.doumee.dao.business.YwWarehouseMapper;
+import com.doumee.dao.business.model.*;
 import com.doumee.service.business.YwStocktakingService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
 
 /**
  * 杩愮淮鐩樼偣淇℃伅琛⊿ervice瀹炵幇
@@ -27,15 +45,172 @@
     @Autowired
     private YwStocktakingMapper ywStocktakingMapper;
 
+    @Autowired
+    private YwStockMapper ywStockMapper;
+
+
+    @Autowired
+    private YwStocktakingRecordMapper ywStocktakingRecordMapper;
+    
+    @Autowired
+    private YwWarehouseMapper ywWarehouseMapper;
+
+    @Autowired
+    private RedisTemplate<String, Object> redisTemplate;
+    
     @Override
+    @Transactional(rollbackFor = {Exception.class,BusinessException.class})
     public Integer create(YwStocktaking ywStocktaking) {
+        if(Objects.isNull(ywStocktaking)
+                || StringUtils.isBlank(ywStocktaking.getName())
+                || Objects.isNull(ywStocktaking.getPlanDate())
+                || Objects.isNull(ywStocktaking.getWarehouseId())
+                || Objects.isNull(ywStocktaking.getUserId())
+        ){
+            throw new BusinessException(ResponseStatus.BAD_REQUEST);
+        }
+        YwWarehouse ywWarehouse = ywWarehouseMapper.selectById(ywStocktaking.getWarehouseId());
+        if(Objects.isNull(ywWarehouse)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌浠撳簱鏁版嵁");
+        }
+        //鍒ゆ柇褰撳墠浠撳簱褰撳墠鏃ユ湡鏄惁瀛樺湪鐩樼偣鍗�
+        if(ywStocktakingMapper.selectCount(new QueryWrapper<YwStocktaking>().lambda().eq(YwStocktaking::getIsdeleted,Constants.ZERO).eq(YwStocktaking::getStatus,Constants.ZERO)
+                .eq(YwStocktaking::getWarehouseId,ywStocktaking.getWarehouseId()).apply(" DATE(PLAN_DATE) = '" + DateUtil.formatDate(ywStocktaking.getPlanDate(),"yyyy-MM-dd") +"'" ))>0){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"["+DateUtil.formatDate(ywStocktaking.getPlanDate(),"yyyy-MM-dd")+"]["+ywWarehouse.getName()+"]宸叉湁鐩樼偣鍗曪紝涓嶅彲閲嶅鍙戣捣鐩樼偣");
+        }
+        LoginUserInfo loginUserInfo = ywStocktaking.getLoginUserInfo();
+        ywStocktaking.setCreator(loginUserInfo.getId());
+        ywStocktaking.setCreateDate(new Date());
+        ywStocktaking.setIsdeleted(Constants.ZERO);
+        ywStocktaking.setStatus(Constants.ZERO);
+        ywStocktaking.setCode(getNextCode());
         ywStocktakingMapper.insert(ywStocktaking);
         return ywStocktaking.getId();
     }
 
     @Override
-    public void deleteById(Integer id) {
-        ywStocktakingMapper.deleteById(id);
+    @Transactional(rollbackFor = {Exception.class,BusinessException.class})
+    public void deleteById(Integer id, LoginUserInfo loginUserInfo) {
+        YwStocktaking model = ywStocktakingMapper.selectById(id);
+        if(Objects.isNull(model)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌鐩樼偣鍗曟暟鎹�");
+        }
+        if(Constants.equalsInteger(model.getStatus(),Constants.ZERO)||Constants.equalsInteger(model.getStatus(),Constants.THREE)){
+            ywStocktakingMapper.update(new UpdateWrapper<YwStocktaking>().lambda()
+                    .set(YwStocktaking::getIsdeleted,Constants.ONE)
+                    .set(YwStocktaking::getEditDate,DateUtil.getCurrDateTime())
+                    .set(YwStocktaking::getEditor,loginUserInfo.getId())
+                    .eq(YwStocktaking::getId,id)
+            );
+        }else{
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鐩樼偣鍗曠姸鎬佸凡娴佽浆锛屾棤娉曡繘琛岃鎿嶄綔");
+        }
+    }
+
+    @Override
+    @Transactional(rollbackFor = {Exception.class,BusinessException.class})
+    public void cancelById(Integer id, LoginUserInfo loginUserInfo) {
+        YwStocktaking model = ywStocktakingMapper.selectById(id);
+        if(Objects.isNull(model)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌鐩樼偣鍗曟暟鎹�");
+        }
+        if(Constants.equalsInteger(model.getStatus(),Constants.ZERO)||Constants.equalsInteger(model.getStatus(),Constants.ONE)){
+            ywStocktakingMapper.update(new UpdateWrapper<YwStocktaking>().lambda()
+                    .set(YwStocktaking::getEditDate,DateUtil.getCurrDateTime())
+                    .set(YwStocktaking::getCancelDate,DateUtil.getCurrDateTime())
+                    .set(YwStocktaking::getCancelUserId,loginUserInfo.getId())
+                    .set(YwStocktaking::getEditor,loginUserInfo.getId())
+                    .set(YwStocktaking::getStatus,Constants.THREE).eq(YwStocktaking::getId,id));
+        }else{
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鐩樼偣鍗曠姸鎬佸凡娴佽浆锛屾棤娉曡繘琛岃鎿嶄綔");
+        }
+    }
+
+    @Override
+    @Transactional(rollbackFor = {Exception.class,BusinessException.class})
+    public void beginById(Integer id, LoginUserInfo loginUserInfo) {
+        YwStocktaking model = ywStocktakingMapper.selectById(id);
+        if(Objects.isNull(model)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌鐩樼偣鍗曟暟鎹�");
+        }
+        if(model.getPlanDate().getTime()<System.currentTimeMillis()){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏈埌寮�濮嬫椂闂达紝鏃犳硶杩涜璇ユ搷浣�");
+        }
+        if(Constants.equalsInteger(model.getStatus(),Constants.ZERO)&&Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){
+            ywStocktakingMapper.update(new UpdateWrapper<YwStocktaking>().lambda()
+                    .set(YwStocktaking::getEditDate,DateUtil.getCurrDateTime())
+                    .set(YwStocktaking::getDealDate,DateUtil.getCurrDateTime())
+                    .set(YwStocktaking::getDealUserId,loginUserInfo.getId())
+                    .set(YwStocktaking::getEditor,loginUserInfo.getId())
+                    .set(YwStocktaking::getStatus,Constants.ONE)
+                    .eq(YwStocktaking::getId,model.getId()));
+            //鐢熸垚褰撳墠浠撳簱涓嬫墍鏈夌殑璧勪骇淇℃伅
+            List<YwStock> stockList = ywStockMapper.selectList(new QueryWrapper<YwStock>().lambda().eq(YwStock::getIsdeleted,Constants.ZERO).eq(YwStock::getWarehouseId,model.getWarehouseId()));
+            if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(stockList)){
+                List<YwStocktakingRecord> ywStocktakingRecordList = new ArrayList<>();
+                for (YwStock ywStock:stockList) {
+                    YwStocktakingRecord ywStocktakingRecord = new YwStocktakingRecord();
+                    ywStocktakingRecord.setCreator(loginUserInfo.getId());
+                    ywStocktakingRecord.setCreateDate(new Date());
+                    ywStocktakingRecord.setIsdeleted(Constants.ZERO);
+                    ywStocktakingRecord.setStatus(Constants.ZERO);
+                    ywStocktakingRecord.setMaterialId(ywStock.getMaterialId());
+                    ywStocktakingRecord.setStock(ywStock.getStock());
+                    ywStocktakingRecord.setStocktakingId(model.getId());
+                    ywStocktakingRecordList.add(ywStocktakingRecord);
+                }
+                ywStocktakingRecordMapper.insert(ywStocktakingRecordList);
+            }
+        }else{
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鐩樼偣鍗曠姸鎬佸凡娴佽浆锛屾棤娉曡繘琛岃鎿嶄綔");
+        }
+    }
+
+
+    @Override
+    @Transactional(rollbackFor = {Exception.class,BusinessException.class})
+    public void finishById(Integer id, LoginUserInfo loginUserInfo) {
+        YwStocktaking model = ywStocktakingMapper.selectById(id);
+        if(Objects.isNull(model)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌鐩樼偣鍗曟暟鎹�");
+        }
+        if(!Constants.equalsInteger(model.getStatus(),Constants.ONE)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鐩樼偣鍗曠姸鎬佸凡娴佽浆锛屾棤娉曡繘琛岃鎿嶄綔锛�");
+        }
+        if(!Constants.equalsInteger(loginUserInfo.getId(),model.getUserId())){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炴偍鐨勭洏鐐瑰崟鏃犳硶杩涜鎿嶄綔");
+        }
+        List<YwStocktakingRecord> recordList = ywStocktakingRecordMapper.selectList(new QueryWrapper<YwStocktakingRecord>().lambda()
+                .eq(YwStocktakingRecord::getStocktakingId,id).eq(YwStocktakingRecord::getIsdeleted,Constants.ZERO));
+        for (YwStocktakingRecord ywStocktakingRecord:recordList) {
+            //鎻愪氦鏃� 鏈繘琛岀洏鐐圭殑鏄庣粏鏁版嵁
+            if(Constants.equalsInteger(ywStocktakingRecord.getStatus(),Constants.ZERO)){
+                ywStocktakingRecordMapper.update(new UpdateWrapper<YwStocktakingRecord>().lambda()
+                        .set(YwStocktakingRecord::getStatus,Constants.TWO)
+                        .set(YwStocktakingRecord::getUserId,loginUserInfo.getId())
+                        .eq(YwStocktakingRecord::getId,ywStocktakingRecord.getId())
+                );
+            }
+            //鏌ヨ搴撳瓨淇℃伅 杩涜搴撳瓨鏇存柊
+            YwStock ywStock = ywStockMapper.selectOne(new QueryWrapper<YwStock>().lambda().eq(YwStock::getMaterialId,ywStocktakingRecord.getMaterialId())
+                    .eq(YwStock::getWarehouseId,model.getWarehouseId()).eq(YwStock::getStock,ywStocktakingRecord.getStock()));
+            if(Objects.isNull(ywStock)){
+                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"搴撳瓨淇℃伅寮傚父锛岃鑱旂郴绠$悊鍛�");
+            }
+            if(ywStocktakingRecord.getActStock().compareTo(BigDecimal.ZERO)==Constants.ZERO){
+                ywStockMapper.deleteById(ywStock.getId());
+            }else {
+                ywStockMapper.update(new UpdateWrapper<YwStock>().lambda().set(YwStock::getStock,ywStocktakingRecord.getActStock()).eq(YwStock::getId,ywStock.getId()));
+            }
+        }
+        ywStocktakingMapper.update(new UpdateWrapper<YwStocktaking>().lambda()
+                .set(YwStocktaking::getEditDate,DateUtil.getCurrDateTime())
+                .set(YwStocktaking::getDoneDate,DateUtil.getCurrDateTime())
+                .set(YwStocktaking::getDoneUserId,loginUserInfo.getId())
+                .set(YwStocktaking::getEditor,loginUserInfo.getId())
+                .set(YwStocktaking::getStatus,Constants.TWO)
+                .eq(YwStocktaking::getId,model.getId()));
+
     }
 
     @Override
@@ -54,6 +229,32 @@
 
     @Override
     public void updateById(YwStocktaking ywStocktaking) {
+        if(Objects.isNull(ywStocktaking)
+                || StringUtils.isBlank(ywStocktaking.getName())
+                || Objects.isNull(ywStocktaking.getId())
+                || Objects.isNull(ywStocktaking.getPlanDate())
+                || Objects.isNull(ywStocktaking.getWarehouseId())
+                || Objects.isNull(ywStocktaking.getUserId())
+        ){
+            throw new BusinessException(ResponseStatus.BAD_REQUEST);
+        }
+        YwStocktaking model = ywStocktakingMapper.selectById(ywStocktaking.getId());
+        if(Objects.isNull(model)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌鐩樼偣鍗曟暟鎹�");
+        }
+        YwWarehouse ywWarehouse = ywWarehouseMapper.selectById(ywStocktaking.getWarehouseId());
+        if(Objects.isNull(ywWarehouse)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌浠撳簱鏁版嵁");
+        }
+        //鍒ゆ柇褰撳墠浠撳簱褰撳墠鏃ユ湡鏄惁瀛樺湪鐩樼偣鍗�
+        if(ywStocktakingMapper.selectCount(new QueryWrapper<YwStocktaking>().lambda().ne(YwStocktaking::getId,ywStocktaking.getId()).eq(YwStocktaking::getIsdeleted,Constants.ZERO).eq(YwStocktaking::getStatus,Constants.ZERO)
+                .eq(YwStocktaking::getWarehouseId,ywStocktaking.getWarehouseId()).apply(" DATE(PLAN_DATE) = '" + DateUtil.formatDate(ywStocktaking.getPlanDate(),"yyyy-MM-dd") +"'" ))>0){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"["+DateUtil.formatDate(ywStocktaking.getPlanDate(),"yyyy-MM-dd")+"]["+ywWarehouse.getName()+"]宸叉湁鐩樼偣鍗曪紝涓嶅彲閲嶅鍙戣捣鐩樼偣");
+        }
+        LoginUserInfo loginUserInfo = ywStocktaking.getLoginUserInfo();
+        ywStocktaking.setEditor(loginUserInfo.getId());
+        ywStocktaking.setEditDate(new Date());
+        ywStocktaking.setCode(null);
         ywStocktakingMapper.updateById(ywStocktaking);
     }
 
@@ -73,6 +274,31 @@
     }
 
     @Override
+    public YwStocktaking getDetail(Integer id) {
+        MPJLambdaWrapper<YwStocktaking> queryWrapper = new MPJLambdaWrapper<>();
+        queryWrapper.selectAll(YwStocktaking.class)
+                .select(" s.name ", YwStocktaking::getUserName)
+                .select(" s1.name ",YwStocktaking::getCreateName)
+                .selectAs(YwWarehouse::getName,YwStocktaking::getWarehouseName)
+                .leftJoin(YwWarehouse.class,YwWarehouse::getId,YwStocktaking::getWarehouseId)
+                .leftJoin("system_user s on t.user_id = s.id")
+                .leftJoin("system_user s1 on t.creator = s1.id")
+                .eq(YwStocktaking::getId,id)
+                .last("limit 1");
+        YwStocktaking ywStocktaking = ywStocktakingMapper.selectOne(queryWrapper);
+        List<YwStocktakingRecord> recordList = ywStocktakingRecordMapper.selectList(new QueryWrapper<YwStocktakingRecord>().lambda().eq(YwStocktakingRecord::getStocktakingId,id).eq(YwStocktakingRecord::getIsdeleted,Constants.ZERO));
+        if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(recordList)){
+            //鍚堣鐩樼偣鏁版嵁
+            ywStocktaking.setFinishAmount(recordList.stream().filter(i->Constants.equalsInteger(i.getStatus(),Constants.ONE)).collect(Collectors.toList()).size());
+            ywStocktaking.setUnFinishAmount(recordList.stream().filter(i->Constants.equalsInteger(i.getStatus(),Constants.ZERO)).collect(Collectors.toList()).size());
+            ywStocktaking.setEqualAmount(recordList.stream().filter(i->Constants.equalsInteger(i.getStatus(),Constants.ONE)&&Constants.equalsInteger(i.getType(),Constants.ZERO)).collect(Collectors.toList()).size());
+            ywStocktaking.setLossAmount(recordList.stream().filter(i->Constants.equalsInteger(i.getStatus(),Constants.ONE)&&Constants.equalsInteger(i.getType(),Constants.ONE)).collect(Collectors.toList()).size());
+            ywStocktaking.setProfitAmount(recordList.stream().filter(i->Constants.equalsInteger(i.getStatus(),Constants.ONE)&&Constants.equalsInteger(i.getType(),Constants.TWO)).collect(Collectors.toList()).size());
+        }
+        return ywStocktaking;
+    }
+
+    @Override
     public YwStocktaking findOne(YwStocktaking ywStocktaking) {
         QueryWrapper<YwStocktaking> wrapper = new QueryWrapper<>(ywStocktaking);
         return ywStocktakingMapper.selectOne(wrapper);
@@ -87,103 +313,25 @@
     @Override
     public PageData<YwStocktaking> findPage(PageWrap<YwStocktaking> pageWrap) {
         IPage<YwStocktaking> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
-        QueryWrapper<YwStocktaking> queryWrapper = new QueryWrapper<>();
+        MPJLambdaWrapper<YwStocktaking> queryWrapper = new MPJLambdaWrapper<>();
         Utils.MP.blankToNull(pageWrap.getModel());
-        if (pageWrap.getModel().getId() != null) {
-            queryWrapper.lambda().eq(YwStocktaking::getId, pageWrap.getModel().getId());
-        }
-        if (pageWrap.getModel().getCreator() != null) {
-            queryWrapper.lambda().eq(YwStocktaking::getCreator, pageWrap.getModel().getCreator());
-        }
-        if (pageWrap.getModel().getCreateDate() != null) {
-            queryWrapper.lambda().ge(YwStocktaking::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate()));
-            queryWrapper.lambda().le(YwStocktaking::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate()));
-        }
-        if (pageWrap.getModel().getEditor() != null) {
-            queryWrapper.lambda().eq(YwStocktaking::getEditor, pageWrap.getModel().getEditor());
-        }
-        if (pageWrap.getModel().getEditDate() != null) {
-            queryWrapper.lambda().ge(YwStocktaking::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate()));
-            queryWrapper.lambda().le(YwStocktaking::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate()));
-        }
-        if (pageWrap.getModel().getIsdeleted() != null) {
-            queryWrapper.lambda().eq(YwStocktaking::getIsdeleted, pageWrap.getModel().getIsdeleted());
-        }
-        if (pageWrap.getModel().getPosition() != null) {
-            queryWrapper.lambda().eq(YwStocktaking::getPosition, pageWrap.getModel().getPosition());
-        }
-        if (pageWrap.getModel().getRemark() != null) {
-            queryWrapper.lambda().eq(YwStocktaking::getRemark, pageWrap.getModel().getRemark());
-        }
-        if (pageWrap.getModel().getStatus() != null) {
-            queryWrapper.lambda().eq(YwStocktaking::getStatus, pageWrap.getModel().getStatus());
-        }
-        if (pageWrap.getModel().getUserId() != null) {
-            queryWrapper.lambda().eq(YwStocktaking::getUserId, pageWrap.getModel().getUserId());
-        }
-        if (pageWrap.getModel().getPlanDate() != null) {
-            queryWrapper.lambda().ge(YwStocktaking::getPlanDate, Utils.Date.getStart(pageWrap.getModel().getPlanDate()));
-            queryWrapper.lambda().le(YwStocktaking::getPlanDate, Utils.Date.getEnd(pageWrap.getModel().getPlanDate()));
-        }
-        if (pageWrap.getModel().getCode() != null) {
-            queryWrapper.lambda().eq(YwStocktaking::getCode, pageWrap.getModel().getCode());
-        }
-        if (pageWrap.getModel().getDealUserId() != null) {
-            queryWrapper.lambda().eq(YwStocktaking::getDealUserId, pageWrap.getModel().getDealUserId());
-        }
-        if (pageWrap.getModel().getDealDate() != null) {
-            queryWrapper.lambda().ge(YwStocktaking::getDealDate, Utils.Date.getStart(pageWrap.getModel().getDealDate()));
-            queryWrapper.lambda().le(YwStocktaking::getDealDate, Utils.Date.getEnd(pageWrap.getModel().getDealDate()));
-        }
-        if (pageWrap.getModel().getDealInfo() != null) {
-            queryWrapper.lambda().eq(YwStocktaking::getDealInfo, pageWrap.getModel().getDealInfo());
-        }
-        if (pageWrap.getModel().getDoneNum() != null) {
-            queryWrapper.lambda().eq(YwStocktaking::getDoneNum, pageWrap.getModel().getDoneNum());
-        }
-        if (pageWrap.getModel().getWaitNum() != null) {
-            queryWrapper.lambda().eq(YwStocktaking::getWaitNum, pageWrap.getModel().getWaitNum());
-        }
-        if (pageWrap.getModel().getTotalNum() != null) {
-            queryWrapper.lambda().eq(YwStocktaking::getTotalNum, pageWrap.getModel().getTotalNum());
-        }
-        if (pageWrap.getModel().getProfitNum() != null) {
-            queryWrapper.lambda().eq(YwStocktaking::getProfitNum, pageWrap.getModel().getProfitNum());
-        }
-        if (pageWrap.getModel().getLossNum() != null) {
-            queryWrapper.lambda().eq(YwStocktaking::getLossNum, pageWrap.getModel().getLossNum());
-        }
-        if (pageWrap.getModel().getEqualNum() != null) {
-            queryWrapper.lambda().eq(YwStocktaking::getEqualNum, pageWrap.getModel().getEqualNum());
-        }
-        if (pageWrap.getModel().getDoneUserId() != null) {
-            queryWrapper.lambda().eq(YwStocktaking::getDoneUserId, pageWrap.getModel().getDoneUserId());
-        }
-        if (pageWrap.getModel().getDoneDate() != null) {
-            queryWrapper.lambda().ge(YwStocktaking::getDoneDate, Utils.Date.getStart(pageWrap.getModel().getDoneDate()));
-            queryWrapper.lambda().le(YwStocktaking::getDoneDate, Utils.Date.getEnd(pageWrap.getModel().getDoneDate()));
-        }
-        if (pageWrap.getModel().getDoneInfo() != null) {
-            queryWrapper.lambda().eq(YwStocktaking::getDoneInfo, pageWrap.getModel().getDoneInfo());
-        }
-        if (pageWrap.getModel().getCancelUserId() != null) {
-            queryWrapper.lambda().eq(YwStocktaking::getCancelUserId, pageWrap.getModel().getCancelUserId());
-        }
-        if (pageWrap.getModel().getCancelDate() != null) {
-            queryWrapper.lambda().ge(YwStocktaking::getCancelDate, Utils.Date.getStart(pageWrap.getModel().getCancelDate()));
-            queryWrapper.lambda().le(YwStocktaking::getCancelDate, Utils.Date.getEnd(pageWrap.getModel().getCancelDate()));
-        }
-        if (pageWrap.getModel().getCancelInfo() != null) {
-            queryWrapper.lambda().eq(YwStocktaking::getCancelInfo, pageWrap.getModel().getCancelInfo());
-        }
-        for(PageWrap.SortData sortData: pageWrap.getSorts()) {
-            if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) {
-                queryWrapper.orderByDesc(sortData.getProperty());
-            } else {
-                queryWrapper.orderByAsc(sortData.getProperty());
-            }
-        }
-        return PageData.from(ywStocktakingMapper.selectPage(page, queryWrapper));
+        YwStocktaking model = pageWrap.getModel();
+        queryWrapper.selectAll(YwStocktaking.class)
+                .select(" s.name ", YwStocktaking::getUserName)
+                .select(" s1.name ",YwStocktaking::getCreateName)
+                .selectAs(YwWarehouse::getName,YwStocktaking::getWarehouseName)
+                .leftJoin(YwWarehouse.class,YwWarehouse::getId,YwStocktaking::getWarehouseId)
+                .leftJoin("system_user s on t.user_id = s.id")
+                .leftJoin("system_user s1 on t.creator = s1.id")
+                .eq(YwStocktaking::getIsdeleted,Constants.ZERO)
+                .like(StringUtils.isNotBlank(model.getName()),YwStocktaking::getName,model.getName())
+                .eq(Objects.nonNull(model.getStatus()),YwStocktaking::getStatus,model.getStatus())
+                .orderByAsc(YwStocktaking::getStatus)
+                .orderByDesc(YwStocktaking::getPlanDate)
+        ;
+
+        IPage iPage = ywStocktakingMapper.selectJoinPage(page, YwStocktaking.class,queryWrapper);
+        return PageData.from(iPage);
     }
 
     @Override
@@ -191,4 +339,19 @@
         QueryWrapper<YwStocktaking> wrapper = new QueryWrapper<>(ywStocktaking);
         return ywStocktakingMapper.selectCount(wrapper);
     }
+
+
+    public synchronized String  getNextCode(){
+        String prefix =  "PD-" + DateUtil.getDate(new Date(),"yyyyMMdd") +"-";
+        Integer countNum  = RedisUtil.getObject(redisTemplate,
+                Constants.RedisKeys.COM_OUTBOUND_TAKING_KEY,
+                Integer.class);
+        countNum = Constants.formatIntegerNum(countNum)+1;
+        //鏇存柊缂撳瓨
+        RedisUtil.addObject(redisTemplate, Constants.RedisKeys.COM_OUTBOUND_TAKING_KEY,countNum);
+        String nextIndex =Integer.toString( countNum );
+        return prefix + org.apache.commons.lang3.StringUtils.leftPad(nextIndex,4,"0");
+    }
+
+
 }

--
Gitblit v1.9.3