From 23855599412c4d61b38d78f0f3abd3430a48b5b1 Mon Sep 17 00:00:00 2001
From: zhangherong <571457620@qq.com>
Date: 星期三, 25 六月 2025 11:51:38 +0800
Subject: [PATCH] Merge branch 'mdc_hyjs_master'

---
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamSecondMaintenanceOrderController.java |  244 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 244 insertions(+), 0 deletions(-)

diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamSecondMaintenanceOrderController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamSecondMaintenanceOrderController.java
new file mode 100644
index 0000000..e12decb
--- /dev/null
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamSecondMaintenanceOrderController.java
@@ -0,0 +1,244 @@
+package org.jeecg.modules.eam.controller;
+
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.base.controller.JeecgController;
+import org.jeecg.modules.eam.constant.BusinessCodeConst;
+import org.jeecg.modules.eam.constant.OrderCreationMethodEnum;
+import org.jeecg.modules.eam.constant.SecondMaintenanceStatusEnum;
+import org.jeecg.modules.eam.entity.EamSecondMaintenanceOrder;
+import org.jeecg.modules.eam.entity.EamWeekMaintenanceOrder;
+import org.jeecg.modules.eam.request.EamSecondMaintenanceQuery;
+import org.jeecg.modules.eam.request.EamSecondMaintenanceRequest;
+import org.jeecg.modules.eam.request.EamWeekMaintenanceRequest;
+import org.jeecg.modules.eam.service.IEamSecondMaintenanceOrderService;
+import org.jeecg.modules.system.service.ISysBusinessCodeRuleService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * @Description: 璁惧浜岀骇淇濆吇
+ * @Author: jeecg-boot
+ * @Date: 2025-04-29
+ * @Version: V1.0
+ */
+@Slf4j
+@Api(tags = "璁惧浜岀骇淇濆吇")
+@RestController
+@RequestMapping("/eam/secondMaintenanceOrder")
+public class EamSecondMaintenanceOrderController extends JeecgController<EamSecondMaintenanceOrder, IEamSecondMaintenanceOrderService> {
+    @Autowired
+    private IEamSecondMaintenanceOrderService eamSecondMaintenanceOrderService;
+    @Autowired
+    private ISysBusinessCodeRuleService businessCodeRuleService;
+
+
+    /**
+     * 鍒嗛〉鍒楄〃鏌ヨ
+     *
+     * @param query
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "璁惧浜岀骇淇濆吇-鍒嗛〉鍒楄〃鏌ヨ")
+    @ApiOperation(value = "璁惧浜岀骇淇濆吇-鍒嗛〉鍒楄〃鏌ヨ", notes = "璁惧浜岀骇淇濆吇-鍒嗛〉鍒楄〃鏌ヨ")
+    @GetMapping(value = "/list")
+    public Result<?> queryPageList(EamSecondMaintenanceQuery query,
+                                   @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                   @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                   HttpServletRequest req) {
+//		QueryWrapper<EamSecondMaintenanceOrder> queryWrapper = QueryGenerator.initQueryWrapper(eamSecondMaintenanceOrder, req.getParameterMap());
+        Page<EamSecondMaintenanceOrder> page = new Page<EamSecondMaintenanceOrder>(pageNo, pageSize);
+        IPage<EamSecondMaintenanceOrder> pageList = eamSecondMaintenanceOrderService.queryPageList(page, query);
+        return Result.OK(pageList);
+    }
+
+    /**
+     * 娣诲姞
+     *
+     * @param request
+     * @return
+     */
+    @AutoLog(value = "璁惧浜岀骇淇濆吇-娣诲姞")
+    @ApiOperation(value = "璁惧浜岀骇淇濆吇-娣诲姞", notes = "璁惧浜岀骇淇濆吇-娣诲姞")
+    @PostMapping(value = "/add")
+    public Result<?> add(@RequestBody EamSecondMaintenanceRequest request) {
+        if (request == null) {
+            return Result.error("娣诲姞鐨勫璞′笉鑳戒负绌猴紒");
+        }
+        if (CollectionUtil.isEmpty(request.getTableDetailList())) {
+            return Result.error("淇濆吇椤逛笉鑳戒负绌猴紒");
+        }
+        String codeSeq = businessCodeRuleService.generateBusinessCodeSeq(BusinessCodeConst.SECOND_MAINTENANCE_CODE_RULE);
+        request.setOrderNum(codeSeq);
+        request.setCreationMethod(OrderCreationMethodEnum.MANUAL.name());
+        boolean b = eamSecondMaintenanceOrderService.addMaintenance(request);
+        if (!b) {
+            return Result.error("娣诲姞澶辫触锛�");
+        }
+        return Result.OK("娣诲姞鎴愬姛锛�");
+    }
+
+    /**
+     * 缂栬緫
+     *
+     * @param request
+     * @return
+     */
+    @AutoLog(value = "璁惧浜岀骇淇濆吇-缂栬緫")
+    @ApiOperation(value = "璁惧浜岀骇淇濆吇-缂栬緫", notes = "璁惧浜岀骇淇濆吇-缂栬緫")
+    @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
+    public Result<?> edit(@RequestBody EamSecondMaintenanceRequest request) {
+        if (request == null) {
+            return Result.error("娣诲姞鐨勫璞′笉鑳戒负绌猴紒");
+        }
+        if (CollectionUtil.isEmpty(request.getTableDetailList())) {
+            return Result.error("淇濆吇椤逛笉鑳戒负绌猴紒");
+        }
+        boolean b = eamSecondMaintenanceOrderService.editMaintenance(request);
+        if (!b) {
+            return Result.error("缂栬緫澶辫触锛�");
+        }
+        return Result.OK("缂栬緫鎴愬姛!");
+    }
+
+    /**
+     * 閫氳繃id鏌ヨ
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "璁惧浜岀骇淇濆吇-閫氳繃id鏌ヨ")
+    @ApiOperation(value = "璁惧浜岀骇淇濆吇-閫氳繃id鏌ヨ", notes = "璁惧浜岀骇淇濆吇-閫氳繃id鏌ヨ")
+    @GetMapping(value = "/queryById")
+    public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
+        EamSecondMaintenanceOrder eamSecondMaintenanceOrder = eamSecondMaintenanceOrderService.getById(id);
+        return Result.OK(eamSecondMaintenanceOrder);
+    }
+
+    /**
+     * 閫氳繃id浣滃簾
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "璁惧浜岀骇淇濆吇-浣滃簾")
+    @ApiOperation(value = "璁惧浜岀骇淇濆吇-浣滃簾", notes = "璁惧浜岀骇淇濆吇-浣滃簾")
+    @DeleteMapping(value = "/abolish")
+    public Result<?> abolish(@RequestParam(name = "id", required = true) String id) {
+        EamSecondMaintenanceOrder entity = eamSecondMaintenanceOrderService.getById(id);
+        if (entity == null) {
+            return Result.error("瑕佷綔搴熺殑鏁版嵁涓嶅瓨鍦紝璇峰埛鏂伴噸璇曪紒");
+        }
+        if (!SecondMaintenanceStatusEnum.WAIT_MAINTENANCE.name().equals(entity.getMaintenanceStatus())) {
+            return Result.error("璇ョ姸鎬佺殑鏁版嵁涓嶅厑璁歌繘琛屼綔搴燂紒");
+        }
+        entity.setMaintenanceStatus(SecondMaintenanceStatusEnum.ABOLISH.name());
+        eamSecondMaintenanceOrderService.updateById(entity);
+        return Result.OK("浣滃簾鎴愬姛!");
+    }
+
+    /**
+     * 閫氳繃id棰嗗彇
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "璁惧浜岀骇淇濆吇-棰嗗彇")
+    @ApiOperation(value = "璁惧浜岀骇淇濆吇-棰嗗彇", notes = "璁惧浜岀骇淇濆吇-棰嗗彇")
+    @GetMapping(value = "/collect")
+    public Result<?> collect(@RequestParam(name = "id", required = true) String id) {
+        boolean b = eamSecondMaintenanceOrderService.collect(id);
+        if (!b) {
+            Result.OK("棰嗗彇澶辫触!");
+        }
+        return Result.OK("棰嗗彇鎴愬姛!");
+    }
+
+    /**
+     * 閫氳繃id鎵归噺浣滃簾
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "鍛ㄤ繚宸ュ崟-鎵归噺浣滃簾")
+    @ApiOperation(value = "鍛ㄤ繚宸ュ崟-鎵归噺浣滃簾", notes = "鍛ㄤ繚宸ュ崟-鎵归噺浣滃簾")
+    @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 -> {
+            EamSecondMaintenanceOrder entity = eamSecondMaintenanceOrderService.getById(id);
+            if (entity != null && SecondMaintenanceStatusEnum.WAIT_MAINTENANCE.name().equals(entity.getMaintenanceStatus())) {
+                entity.setMaintenanceStatus(SecondMaintenanceStatusEnum.ABOLISH.name());
+                eamSecondMaintenanceOrderService.updateById(entity);
+                i.getAndIncrement();
+            }
+        });
+        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 -> {
+            EamSecondMaintenanceOrder entity = eamSecondMaintenanceOrderService.getById(id);
+            if (entity != null && SecondMaintenanceStatusEnum.WAIT_MAINTENANCE.name().equals(entity.getMaintenanceStatus())) {
+                boolean b = eamSecondMaintenanceOrderService.collect(id);
+                if (b) {
+                    i.getAndIncrement();
+                }
+            }
+        });
+        return Result.OK("鎵归噺棰嗗彇鎴愬姛 " + i.get() + " 鏉″伐鍗曪紒");
+    }
+
+    /**
+     * 鎴戠殑寰呭姙锛屽鎵瑰姩浣�
+     *
+     * @param request
+     * @return
+     */
+    @ApiOperation(value = "浜屼繚宸ュ崟-鎵ц鎿嶄綔", notes = "浜屼繚宸ュ崟-鎵ц鎿嶄綔")
+    @PutMapping(value = "/approval")
+    public Result<?> approval(@RequestBody EamSecondMaintenanceRequest request) {
+        if (request == null) {
+            return Result.error("瀹℃壒鐨勫璞′笉鑳戒负绌猴紒");
+        }
+        if (CollectionUtil.isEmpty(request.getTableDetailList())) {
+            return Result.error("淇濆吇椤逛笉鑳戒负绌猴紒");
+        }
+        // 妫�鏌ヨ姹傚弬鏁�
+        if (StrUtil.isBlank(request.getTaskId()) || StrUtil.isBlank(request.getDataId()) || StrUtil.isBlank(request.getInstanceId())) {
+            return Result.error("瀹℃壒浠诲姟閿欒鎴栦笉瀛樺湪锛�");
+        }
+        EamSecondMaintenanceOrder entity = eamSecondMaintenanceOrderService.approval(request);
+        if (entity == null) {
+            return Result.error("鎿嶄綔澶辫触锛�");
+        }
+        return Result.ok("鎿嶄綔鎴愬姛锛�");
+    }
+}

--
Gitblit v1.9.3