From 8a3b2ed3d7a9ad181e6b98a39e7567587d79d2cc Mon Sep 17 00:00:00 2001 From: xiaohuo <14141624+dsgfhrh@user.noreply.gitee.com> Date: Sun, 5 Oct 2025 20:49:29 +0800 Subject: [PATCH] =?UTF-8?q?10.5=E7=9B=B8=E5=90=8C=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../equManagement/EquBaseController.java | 98 +++++++++---------- .../AlertMessageController.java | 14 +-- .../AlertRuleController.java | 2 +- .../java/com/alops/system/domain/EquBase.java | 6 +- .../system/domain/dto/MonitorLastDto.java | 2 +- .../system/domain/vo/queryEquBaseVO.java | 4 + .../resources/mapper/system/EquBaseMapper.xml | 6 +- 7 files changed, 65 insertions(+), 67 deletions(-) diff --git a/ALOps_sys_backend/alops-admin/src/main/java/com/alops/web/controller/equManagement/EquBaseController.java b/ALOps_sys_backend/alops-admin/src/main/java/com/alops/web/controller/equManagement/EquBaseController.java index aced313e..eb41800b 100644 --- a/ALOps_sys_backend/alops-admin/src/main/java/com/alops/web/controller/equManagement/EquBaseController.java +++ b/ALOps_sys_backend/alops-admin/src/main/java/com/alops/web/controller/equManagement/EquBaseController.java @@ -84,6 +84,7 @@ public class EquBaseController extends BaseController // 调用职责单一的 Service 方法 return success(equBaseService.selectLatestEquMonitorInfo(id)); } + /** * 获取设备指定时间段内的历史监控信息 * @param equBaseQueryDto 查询对象,包含设备ID、开始时间和结束时间 @@ -120,34 +121,35 @@ public class EquBaseController extends BaseController } - /** - * 根据设备ID返回图片流 - * 前端直接 - */ - - @PreAuthorize("@ss.hasPermi('device:files:queryimage')") - @GetMapping(value = "/queryimage/{id}") - @ApiOperation("查询单个设备图片") - public void getImage(@PathVariable String id, HttpServletResponse response) throws IOException { +// /** +// * 根据设备ID返回图片流 +// * 前端直接 +// */ +// +// @PreAuthorize("@ss.hasPermi('device:files:queryimage')") +// @GetMapping(value = "/queryimage/{id}") +// @ApiOperation("查询单个设备图片") +// public void getImage(@PathVariable String id, HttpServletResponse response) throws IOException { +// +// byte[] imgBytes = equBaseService.selectEquBaseImageById(id).getEquImage(); +// +// +// if (imgBytes != null && imgBytes.length > 0) { +// // 设置响应类型,可根据实际图片类型动态修改 +// response.setContentType("image/png"); +// // 可选:缓存图片 +// response.setHeader("Cache-Control", "max-age=3600"); +// // 输出流写入响应 +// ServletOutputStream os = response.getOutputStream(); +// os.write(imgBytes); +// os.flush(); +// os.close(); +// } else { +// // 图片不存在 +// response.sendError(HttpServletResponse.SC_NOT_FOUND); +// } +// } - byte[] imgBytes = equBaseService.selectEquBaseImageById(id).getEquImage(); - - - if (imgBytes != null && imgBytes.length > 0) { - // 设置响应类型,可根据实际图片类型动态修改 - response.setContentType("image/png"); - // 可选:缓存图片 - response.setHeader("Cache-Control", "max-age=3600"); - // 输出流写入响应 - ServletOutputStream os = response.getOutputStream(); - os.write(imgBytes); - os.flush(); - os.close(); - } else { - // 图片不存在 - response.sendError(HttpServletResponse.SC_NOT_FOUND); - } - } //厂商下拉表 @PreAuthorize("@ss.hasPermi('device:files:queryManufacture')") @GetMapping( "/manufacture") @@ -181,46 +183,44 @@ public class EquBaseController extends BaseController /** * 新增设备基本信息 + * @ModelAttribute equBase, + * @RequestPart(value = "file", required = false) // 使用 @RequestPart + * @ApiParam(value = "设备图片文件", type = "file") + * MultipartFile file */ @PreAuthorize("@ss.hasPermi('device:files:add')") @Log(title = "设备基本信息", businessType = BusinessType.INSERT) @PostMapping(value = "/add") @ApiOperation("增加设备档案信息") - public AjaxResult add( - @ModelAttribute EquBase equBase, - @RequestPart(value = "file", required = false) // 使用 @RequestPart - @ApiParam(value = "设备图片文件", type = "file") - MultipartFile file - - ) throws IOException { + public AjaxResult add( @RequestBody EquBase equBase + ) { - // 处理图片 - if (file != null && !file.isEmpty()) { - equBase.setEquImage(file.getBytes()); - } +// // 处理图片 +// if (file != null && !file.isEmpty()) { +// equBase.setEquImage(file.getBytes()); +// } // 调用 Service 插入数据库 return toAjax(equBaseService.insertEquBase(equBase)); } /** + * @ModelAttribute EquBase equBase, // 自动绑定表单字段 + * @RequestPart(value = "file", required = false) // 使用 @RequestPart + * @ApiParam(value = "设备图片文件", type = "file") + * MultipartFile file * 修改设备基本信息 */ @PreAuthorize("@ss.hasPermi('device:files:edit')") @Log(title = "设备基本信息", businessType = BusinessType.UPDATE) @PutMapping("/modify") @ApiOperation("修改设备档案信息") - public AjaxResult edit( - @ModelAttribute EquBase equBase, // 自动绑定表单字段 - @RequestPart(value = "file", required = false) // 使用 @RequestPart - @ApiParam(value = "设备图片文件", type = "file") - MultipartFile file - ) throws IOException { - - // 处理图片 - if (file != null && !file.isEmpty()) { - equBase.setEquImage(file.getBytes()); // 存数据库 Blob - } + public AjaxResult edit(@RequestBody EquBase equBase){ + +// // 处理图片 +// if (file != null && !file.isEmpty()) { +// equBase.setEquImage(file.getBytes()); // 存数据库 Blob +// } // 调用 Service 插入数据库 return toAjax(equBaseService.updateEquBase(equBase)); diff --git a/ALOps_sys_backend/alops-admin/src/main/java/com/alops/web/controller/exceptionController/AlertMessageController.java b/ALOps_sys_backend/alops-admin/src/main/java/com/alops/web/controller/exceptionController/AlertMessageController.java index 51756ee8..340f7196 100644 --- a/ALOps_sys_backend/alops-admin/src/main/java/com/alops/web/controller/exceptionController/AlertMessageController.java +++ b/ALOps_sys_backend/alops-admin/src/main/java/com/alops/web/controller/exceptionController/AlertMessageController.java @@ -21,14 +21,7 @@ import com.alops.system.service.IAlertMessageService; import io.swagger.annotations.ApiOperation; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; /** * 故障统计Controller @@ -92,11 +85,10 @@ public class AlertMessageController extends BaseController * 查询预警信息统计列表 */ @PreAuthorize("@ss.hasPermi('inMonitoring:alertMessage:list')") - @PostMapping ("/list") + @GetMapping ("/list") @ApiOperation("查询预警信息") @Log(title = "查询预警信息", businessType = BusinessType.UPDATE) - - public TableDataInfo list( @RequestBody AlertDto alertMessage) + public TableDataInfo list( AlertDto alertMessage) { startPage(); List list = alertMessageService.selectAlertMessageList(alertMessage); diff --git a/ALOps_sys_backend/alops-admin/src/main/java/com/alops/web/controller/exceptionController/AlertRuleController.java b/ALOps_sys_backend/alops-admin/src/main/java/com/alops/web/controller/exceptionController/AlertRuleController.java index 9aaa44de..8a7dfce0 100644 --- a/ALOps_sys_backend/alops-admin/src/main/java/com/alops/web/controller/exceptionController/AlertRuleController.java +++ b/ALOps_sys_backend/alops-admin/src/main/java/com/alops/web/controller/exceptionController/AlertRuleController.java @@ -69,7 +69,7 @@ public class AlertRuleController extends BaseController { @PreAuthorize("@ss.hasPermi('inMonitoring:alertRule:edit')") @ApiOperation("修改预警规则") @Log(title = "【修改预警规则】", businessType = BusinessType.DELETE) - @PostMapping("/editRule") + @PutMapping("/editRule") public AjaxResult editRule(@RequestBody AlertRuleAddDto dto) { try { AlertRule alertRule = alertRuleService.updateRule(dto); diff --git a/ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/EquBase.java b/ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/EquBase.java index 1c4c3eb0..52ce8d3f 100644 --- a/ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/EquBase.java +++ b/ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/EquBase.java @@ -55,6 +55,8 @@ public class EquBase @Excel(name = "设备类型 id") private String equType; + + public EquType getEquTypeVO() { return equTypeVO; } @@ -114,8 +116,8 @@ public class EquBase @Excel(name = "采集次数") private Long createBy ; - @Excel(name = "设备图片") - private byte[] equImage ; + @Excel(name = "设备图片地址") + private String equImage ; public void setId(String id) diff --git a/ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/dto/MonitorLastDto.java b/ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/dto/MonitorLastDto.java index 3a29e035..10d15e95 100644 --- a/ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/dto/MonitorLastDto.java +++ b/ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/dto/MonitorLastDto.java @@ -28,7 +28,7 @@ public class MonitorLastDto { private String inCharge; private int failureFrequency; private int warranty; - private Blob equImage; + private String equImage; // equ_type private String equType; diff --git a/ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/vo/queryEquBaseVO.java b/ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/vo/queryEquBaseVO.java index 63602ba3..4c30a6ef 100644 --- a/ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/vo/queryEquBaseVO.java +++ b/ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/vo/queryEquBaseVO.java @@ -88,6 +88,10 @@ public class queryEquBaseVO { @Excel(name = "累积故障次数") private String deviceLevel; + @Excel(name = "设备图片") + private String equImage; + + public void setId(String id) { diff --git a/ALOps_sys_backend/alops-system/src/main/resources/mapper/system/EquBaseMapper.xml b/ALOps_sys_backend/alops-system/src/main/resources/mapper/system/EquBaseMapper.xml index 8834d9c0..a3860a73 100644 --- a/ALOps_sys_backend/alops-system/src/main/resources/mapper/system/EquBaseMapper.xml +++ b/ALOps_sys_backend/alops-system/src/main/resources/mapper/system/EquBaseMapper.xml @@ -111,8 +111,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" b.create_date AS createDate, b.status AS status, b.device_level AS deviceLevel, - g.health AS health - + g.health AS health, + b.equ_image AS equImage