From 8ad863082097ffdcab4a8e7f426d344a1fe6f892 Mon Sep 17 00:00:00 2001
From: 吴羡 <16976746+Xian-TT3@user.noreply.gitee.com>
Date: 星期六, 07 十一月 2026 00:27:02 +0800
Subject: [PATCH] 修复人员管理接口校验与导出,完善设备保养计划与文件受控功能

---
 cnas-device/src/main/java/com/ruoyi/device/controller/DeviceMaintenancePlanController.java |   81 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 80 insertions(+), 1 deletions(-)

diff --git a/cnas-device/src/main/java/com/ruoyi/device/controller/DeviceMaintenancePlanController.java b/cnas-device/src/main/java/com/ruoyi/device/controller/DeviceMaintenancePlanController.java
index 81be805..bed07d2 100644
--- a/cnas-device/src/main/java/com/ruoyi/device/controller/DeviceMaintenancePlanController.java
+++ b/cnas-device/src/main/java/com/ruoyi/device/controller/DeviceMaintenancePlanController.java
@@ -3,16 +3,21 @@
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.common.core.domain.Result;
+import com.ruoyi.device.dto.DeviceMaintenancePlanDetailsDto;
 import com.ruoyi.device.dto.DeviceMaintenancePlanDto;
+import com.ruoyi.device.pojo.DeviceMaintenanceAttachment;
 import com.ruoyi.device.pojo.DeviceMaintenancePlan;
+import com.ruoyi.device.pojo.DeviceMaintenancePlanDetails;
 import com.ruoyi.device.service.DeviceMaintenancePlanService;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import io.swagger.v3.oas.annotations.Operation;
 import lombok.SneakyThrows;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 
 import jakarta.annotation.Resource;
 import jakarta.servlet.http.HttpServletResponse;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -80,11 +85,57 @@
     }
 
     /**
+     * 鎸夊勾浠芥煡璇㈣澶囦繚鍏昏鍒掞紙涓嶅瓨鍦ㄥ垯鑷姩鍒涘缓锛夛紝骞惰嚜鍔ㄨˉ鍏ㄥ凡鍒扮偣鐨勮澶囨槑缁�
+     */
+    @Operation(summary = "鎸夊勾浠芥煡璇㈣澶囦繚鍏昏鍒掞紙鑷姩鍒涘缓骞惰ˉ鍏ㄥ埌鐐规槑缁嗭級")
+    @GetMapping("/getPlanByYear")
+    public Result<DeviceMaintenancePlanDto> getPlanByYear(String planYear) {
+        return Result.success(deviceMaintenancePlanService.getOrCreatePlanByYear(planYear));
+    }
+
+    /**
+     * 淇濆吇璁″垝骞翠唤鍒楄〃锛堣嚜鍔ㄥ垹闄ゆ病鏈夋槑缁嗙殑绌哄勾浠借鍒掞級
+     */
+    @Operation(summary = "淇濆吇璁″垝骞翠唤鍒楄〃")
+    @GetMapping("/getPlanYears")
+    public Result<List<String>> getPlanYears() {
+        return Result.success(deviceMaintenancePlanService.getMaintenancePlanYears());
+    }
+
+    /**
+     * 璁惧淇濆吇璁″垝璇︽儏鍒楄〃锛堝惈鍒扮偣鏍囩孩锛�
+     */
+    @Operation(summary = "璁惧淇濆吇璁″垝璇︽儏鍒楄〃")
+    @GetMapping("/pageMaintenancePlanDetail")
+    public Result<IPage<DeviceMaintenancePlanDetailsDto>> pageMaintenancePlanDetail(Page page, Integer planId, String deviceName, String deviceNumber) {
+        return Result.success(deviceMaintenancePlanService.pageMaintenancePlanDetail(page, planId, deviceName, deviceNumber));
+    }
+
+    /**
+     * 淇敼璁惧淇濆吇璁″垝璇︽儏
+     */
+    @Operation(summary = "淇敼璁惧淇濆吇璁″垝璇︽儏")
+    @PostMapping("/updateMaintenancePlanDetail")
+    public Result updateMaintenancePlanDetail(@RequestBody DeviceMaintenancePlanDetails deviceMaintenancePlanDetails) {
+        return Result.success(deviceMaintenancePlanService.updateMaintenancePlanDetail(deviceMaintenancePlanDetails));
+    }
+
+    /**
+     * 鍒犻櫎璁惧淇濆吇璁″垝璇︽儏
+     */
+    @Operation(summary = "鍒犻櫎璁惧淇濆吇璁″垝璇︽儏")
+    @DeleteMapping("/delMaintenancePlanDetail")
+    public Result delMaintenancePlanDetail(Integer maintenancePlanDetailId) {
+        return Result.success(deviceMaintenancePlanService.removeMaintenancePlanDetail(maintenancePlanDetailId));
+    }
+
+    /**
      * 瀵煎嚭璁惧淇濆吇璁″垝
      */
     @Operation(summary = "瀵煎嚭璁惧淇濆吇璁″垝")
     @GetMapping("/exportDeviceMaintenancePlan")
-    public Result exportDeviceMaintenancePlan(@RequestParam("maintenancePlanId") Integer maintenancePlanId, HttpServletResponse response) {
+    public Result exportDeviceMaintenancePlan(@RequestParam("maintenancePlanId") Integer maintenancePlanId,
+                                              HttpServletResponse response) {
         return deviceMaintenancePlanService.exportDeviceMaintenancePlanDto(maintenancePlanId, response);
     }
 
@@ -105,4 +156,32 @@
     public Result reviewMaintenancePlanStatus(@RequestBody DeviceMaintenancePlanDto deviceMaintenancePlanDto) {
         return deviceMaintenancePlanService.reviewMaintenancePlanStatus(deviceMaintenancePlanDto);
     }
+
+    /**
+     * 鏌ヨ淇濆吇璁″垝鏄庣粏闄勪欢
+     */
+    @Operation(summary = "鏌ヨ淇濆吇璁″垝鏄庣粏闄勪欢")
+    @GetMapping("/selectAttachments")
+    public Result<List<DeviceMaintenanceAttachment>> selectAttachments(Integer maintenancePlanDetailId) {
+        return Result.success(deviceMaintenancePlanService.selectAttachments(maintenancePlanDetailId));
+    }
+
+    /**
+     * 涓婁紶淇濆吇璁″垝鏄庣粏闄勪欢
+     */
+    @Operation(summary = "涓婁紶淇濆吇璁″垝鏄庣粏闄勪欢")
+    @PostMapping("/uploadAttachment")
+    public Result uploadAttachment(@RequestParam("maintenancePlanDetailId") Integer maintenancePlanDetailId,
+                                   @RequestParam("file") MultipartFile file) {
+        return Result.success(deviceMaintenancePlanService.uploadAttachment(maintenancePlanDetailId, file));
+    }
+
+    /**
+     * 鍒犻櫎淇濆吇璁″垝鏄庣粏闄勪欢
+     */
+    @Operation(summary = "鍒犻櫎淇濆吇璁″垝鏄庣粏闄勪欢")
+    @DeleteMapping("/deleteAttachment")
+    public Result deleteAttachment(Long id) {
+        return Result.success(deviceMaintenancePlanService.deleteAttachment(id));
+    }
 }

--
Gitblit v1.9.3