From 99755eea33cf009c36507df468c244f3be5b34c9 Mon Sep 17 00:00:00 2001 From: chenrui <1187576398@qq.com> Date: 星期五, 28 二月 2025 17:27:31 +0800 Subject: [PATCH] Merge branch 'dev' of http://114.132.189.42:9002/r/lims-ruoyi-after into dev_cr --- 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