From b9ff0ede78518a3c7c160f12942acd9410c33ce5 Mon Sep 17 00:00:00 2001
From: zhuo <2089219845@qq.com>
Date: 星期五, 28 二月 2025 14:41:01 +0800
Subject: [PATCH] 清除不符合品管理, 调整设备档案和维护保养

---
 cnas-device/src/main/java/com/ruoyi/device/controller/DeviceMaintenanceController.java |   67 +++++++++++++--------------------
 1 files changed, 27 insertions(+), 40 deletions(-)

diff --git a/cnas-device/src/main/java/com/ruoyi/device/controller/DeviceMaintenanceController.java b/cnas-device/src/main/java/com/ruoyi/device/controller/DeviceMaintenanceController.java
index 9420f41..a7bf0df 100644
--- a/cnas-device/src/main/java/com/ruoyi/device/controller/DeviceMaintenanceController.java
+++ b/cnas-device/src/main/java/com/ruoyi/device/controller/DeviceMaintenanceController.java
@@ -9,6 +9,7 @@
 import com.ruoyi.device.excel.DeviceMaintenanceExport;
 import com.ruoyi.device.pojo.DeviceMaintenance;
 import com.ruoyi.device.service.DeviceMaintenanceService;
+import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.apache.poi.ss.usermodel.HorizontalAlignment;
 import org.apache.poi.ss.usermodel.VerticalAlignment;
@@ -26,7 +27,8 @@
  * todo: 瀛欐渤婊�
  */
 @RestController
-@RequestMapping("/device-maintain")
+@Api(tags = "璁惧缁存姢淇濆吇")
+@RequestMapping("/deviceMaintain")
 public class DeviceMaintenanceController {
 
     @Autowired
@@ -34,9 +36,15 @@
 
     @Autowired
     private NumberGenerator<DeviceMaintenance> numberGenerator;
-    //澧�
-    @PostMapping()
-    public Result create(@RequestBody DeviceMaintenance deviceMaintenance){
+
+    /**
+     * 鏂板璁惧缁存姢淇濆吇
+     * @param deviceMaintenance
+     * @return
+     */
+    @ApiOperation(value = "鏂板璁惧缁存姢淇濆吇")
+    @PostMapping("/addDeviceMaintenance")
+    public Result addDeviceMaintenance(@RequestBody DeviceMaintenance deviceMaintenance){
         String year = new SimpleDateFormat("yy", Locale.CHINESE).format(new Date());
         String month = new SimpleDateFormat("MM", Locale.CHINESE).format(new Date());
         String processNumber = numberGenerator.generateNumberWithPrefix(3, "DG-TC-23FM " + month + "-" + year + month, DeviceMaintenance::getDeviceNumber);
@@ -44,32 +52,29 @@
         return Result.success(deviceMaintenanceService.save(deviceMaintenance));
     }
 
-    //閫氳繃deviceId鏌ヨ缁存姢鏁版嵁
+    /**
+     * 閫氳繃璁惧id鏌ヨ璁惧缁存姢淇濆吇淇℃伅
+     * @param deviceId
+     * @param page
+     * @param deviceNumber
+     * @return
+     */
+    @ApiOperation(value = "閫氳繃璁惧id鏌ヨ璁惧缁存姢淇濆吇淇℃伅")
     @GetMapping("/getDeviceMaintenancePage")
     public Result getDeviceMaintenancePage(@RequestParam("deviceId") Integer deviceId, Page page, String deviceNumber){
         return Result.success(deviceMaintenanceService.getDeviceMaintenancePage(page, deviceId, deviceNumber));
     }
 
-    //鍒�
-    @DeleteMapping("/delete/{id}")
-    public void deleteDeviceFault(@PathVariable Integer id) {
+    /**
+     * 鍒犻櫎璁惧缁存姢淇濆吇
+     * @param id
+     */
+    @ApiOperation(value = "鏂板璁惧缁存姢淇濆吇")
+    @DeleteMapping("/deleteDeviceMaintenance")
+    public void deleteDeviceMaintenance(@PathVariable Integer id) {
         deviceMaintenanceService.removeById(id);
     }
 
-    @GetMapping("/deviceMaintenanceExport")
-    public Result deviceMaintenanceExport(@RequestParam("deviceId") Integer deviceId, HttpServletResponse response) throws IOException {
-        List<DeviceMaintenanceExport> list = deviceMaintenanceService.deviceMaintenanceExport(deviceId);
-        response.setHeader("requestType","excel");
-        response.setHeader("Access-Control-Expose-Headers", "requestType");
-        // 璁剧疆鍗曞厓鏍兼牱寮�
-        // 淇濆瓨鍒扮涓�涓猻heet涓�
-        EasyExcel.write(response.getOutputStream())
-                .head(DeviceMaintenanceExport.class)
-                .registerWriteHandler(getHorizontalCellStyleStrategy((short) 12))
-                .sheet()
-                .doWrite(list);
-        return Result.success();
-    }
 
     @ApiOperation(value = "璁惧缁存姢璁板綍瀵煎嚭")
     @GetMapping("/exportMaintenanceRecord")
@@ -77,22 +82,4 @@
         deviceMaintenanceService.exportMaintenanceRecord(deviceId, response);
     }
 
-    /**
-     * 鍗曞厓鏍兼牱寮忕瓥鐣�
-     */
-    public static HorizontalCellStyleStrategy getHorizontalCellStyleStrategy(Short fontHeightInPoints) {
-        // 鍐呭鐨勭瓥鐣�
-        WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
-
-        // 銆愭按骞冲眳涓渶瑕佷娇鐢ㄤ互涓嬩袱琛屻��
-        // 璁剧疆鏂囧瓧宸﹀彸灞呬腑
-        contentWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);
-        // 璁剧疆鏂囧瓧涓婁笅灞呬腑
-        contentWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
-        // 璁剧疆 鑷姩鎹㈣
-        contentWriteCellStyle.setWrapped(true);
-
-        // 鏍峰紡绛栫暐
-        return new HorizontalCellStyleStrategy(null, contentWriteCellStyle);
-    }
 }

--
Gitblit v1.9.3