From 6be893ccb873b171c3e6cf3c9dd83955dcaaf368 Mon Sep 17 00:00:00 2001
From: zhangherong <571457620@qq.com>
Date: 星期三, 23 四月 2025 09:35:48 +0800
Subject: [PATCH] art: 设备管理-周保工单-批量领取接口添加

---
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamWeekMaintenanceOrderController.java |   38 +++++++++++++++++++++++++++++++++-----
 1 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamWeekMaintenanceOrderController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamWeekMaintenanceOrderController.java
index 6050f33..30b42ec 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamWeekMaintenanceOrderController.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamWeekMaintenanceOrderController.java
@@ -29,6 +29,7 @@
 import javax.servlet.http.HttpServletRequest;
 import java.util.Arrays;
 import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
 
 /**
  * @Description: 鍛ㄤ繚宸ュ崟
@@ -145,10 +146,10 @@
     @DeleteMapping(value = "/abolish")
     public Result<?> abolish(@RequestParam(name = "id", required = true) String id) {
         EamWeekMaintenanceOrder entity = eamWeekMaintenanceOrderService.getById(id);
-        if(entity == null) {
+        if (entity == null) {
             return Result.error("瑕佷綔搴熺殑鏁版嵁涓嶅瓨鍦紝璇峰埛鏂伴噸璇曪紒");
         }
-        if(!WeekMaintenanceStatusEnum.WAIT_MAINTENANCE.name().equals(entity.getMaintenanceStatus())) {
+        if (!WeekMaintenanceStatusEnum.WAIT_MAINTENANCE.name().equals(entity.getMaintenanceStatus())) {
             return Result.error("璇ョ姸鎬佺殑鏁版嵁涓嶅厑璁歌繘琛屼綔搴燂紒");
         }
         entity.setMaintenanceStatus(WeekMaintenanceStatusEnum.ABOLISH.name());
@@ -167,7 +168,7 @@
     @GetMapping(value = "/collect")
     public Result<?> collect(@RequestParam(name = "id", required = true) String id) {
         boolean b = eamWeekMaintenanceOrderService.collect(id);
-        if(!b) {
+        if (!b) {
             Result.OK("棰嗗彇澶辫触!");
         }
         return Result.OK("棰嗗彇鎴愬姛!");
@@ -198,14 +199,40 @@
     @DeleteMapping(value = "/abolishBatch")
     public Result<?> abolishBatch(@RequestParam(name = "ids", required = true) String ids) {
         List<String> list = Arrays.asList(ids.split(","));
+        AtomicInteger i = new AtomicInteger();
         list.forEach(id -> {
             EamWeekMaintenanceOrder entity = eamWeekMaintenanceOrderService.getById(id);
             if (entity != null && WeekMaintenanceStatusEnum.WAIT_MAINTENANCE.name().equals(entity.getMaintenanceStatus())) {
                 entity.setMaintenanceStatus(WeekMaintenanceStatusEnum.ABOLISH.name());
                 eamWeekMaintenanceOrderService.updateById(entity);
+                i.getAndIncrement();
             }
         });
-        return Result.OK("鎵归噺浣滃簾鎴愬姛锛�");
+        return Result.OK("鎵归噺浣滃簾鎴愬姛 " + i.get() + " 鏉″伐鍗曪紒");
+    }
+
+    /**
+     * 閫氳繃id鎵归噺棰嗗彇
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "鍛ㄤ繚宸ュ崟-鎵归噺棰嗗彇")
+    @ApiOperation(value = "鍛ㄤ繚宸ュ崟-鎵归噺棰嗗彇", notes = "鍛ㄤ繚宸ュ崟-鎵归噺棰嗗彇")
+    @DeleteMapping(value = "/collectBatch")
+    public Result<?> collectBatch(@RequestParam(name = "ids", required = true) String ids) {
+        List<String> list = Arrays.asList(ids.split(","));
+        AtomicInteger i = new AtomicInteger();
+        list.forEach(id -> {
+            EamWeekMaintenanceOrder entity = eamWeekMaintenanceOrderService.getById(id);
+            if (entity != null && WeekMaintenanceStatusEnum.WAIT_MAINTENANCE.name().equals(entity.getMaintenanceStatus())) {
+                boolean b = eamWeekMaintenanceOrderService.collect(id);
+                if (b) {
+                    i.getAndIncrement();
+                }
+            }
+        });
+        return Result.OK("鎵归噺棰嗗彇鎴愬姛 " + i.get() + " 鏉″伐鍗曪紒");
     }
 
     /**
@@ -241,6 +268,7 @@
 
     /**
      * 鎴戠殑寰呭姙锛屽鎵瑰姩浣�
+     *
      * @param request
      * @return
      */
@@ -258,7 +286,7 @@
             return Result.error("瀹℃壒浠诲姟閿欒鎴栦笉瀛樺湪锛�");
         }
         EamWeekMaintenanceOrder b = eamWeekMaintenanceOrderService.approval(request);
-        if(b == null) {
+        if (b == null) {
             return Result.error("鎿嶄綔澶辫触锛�");
         }
         return Result.ok("鎿嶄綔鎴愬姛锛�");

--
Gitblit v1.9.3