10.5相同格式提交

dev
xiaohuo 9 months ago
parent 4c2b9bdb58
commit 8a3b2ed3d7
  1. 98
      ALOps_sys_backend/alops-admin/src/main/java/com/alops/web/controller/equManagement/EquBaseController.java
  2. 14
      ALOps_sys_backend/alops-admin/src/main/java/com/alops/web/controller/exceptionController/AlertMessageController.java
  3. 2
      ALOps_sys_backend/alops-admin/src/main/java/com/alops/web/controller/exceptionController/AlertRuleController.java
  4. 6
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/EquBase.java
  5. 2
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/dto/MonitorLastDto.java
  6. 4
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/vo/queryEquBaseVO.java
  7. 6
      ALOps_sys_backend/alops-system/src/main/resources/mapper/system/EquBaseMapper.xml

@ -84,6 +84,7 @@ public class EquBaseController extends BaseController
// 调用职责单一的 Service 方法 // 调用职责单一的 Service 方法
return success(equBaseService.selectLatestEquMonitorInfo(id)); return success(equBaseService.selectLatestEquMonitorInfo(id));
} }
/** /**
* 获取设备指定时间段内的历史监控信息 * 获取设备指定时间段内的历史监控信息
* @param equBaseQueryDto 查询对象包含设备ID开始时间和结束时间 * @param equBaseQueryDto 查询对象包含设备ID开始时间和结束时间
@ -120,34 +121,35 @@ public class EquBaseController extends BaseController
} }
/** // /**
* 根据设备ID返回图片流 // * 根据设备ID返回图片流
* 前端直接 <img src="/equBase/image/{id}"> // * 前端直接 <img src="/equBase/image/{id}">
*/ // */
//
@PreAuthorize("@ss.hasPermi('device:files:queryimage')") // @PreAuthorize("@ss.hasPermi('device:files:queryimage')")
@GetMapping(value = "/queryimage/{id}") // @GetMapping(value = "/queryimage/{id}")
@ApiOperation("查询单个设备图片") // @ApiOperation("查询单个设备图片")
public void getImage(@PathVariable String id, HttpServletResponse response) throws IOException { // 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')") @PreAuthorize("@ss.hasPermi('device:files:queryManufacture')")
@GetMapping( "/manufacture") @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')") @PreAuthorize("@ss.hasPermi('device:files:add')")
@Log(title = "设备基本信息", businessType = BusinessType.INSERT) @Log(title = "设备基本信息", businessType = BusinessType.INSERT)
@PostMapping(value = "/add") @PostMapping(value = "/add")
@ApiOperation("增加设备档案信息") @ApiOperation("增加设备档案信息")
public AjaxResult add( public AjaxResult add( @RequestBody EquBase equBase
@ModelAttribute EquBase equBase, ) {
@RequestPart(value = "file", required = false) // 使用 @RequestPart
@ApiParam(value = "设备图片文件", type = "file")
MultipartFile file
) throws IOException {
// 处理图片 // // 处理图片
if (file != null && !file.isEmpty()) { // if (file != null && !file.isEmpty()) {
equBase.setEquImage(file.getBytes()); // equBase.setEquImage(file.getBytes());
} // }
// 调用 Service 插入数据库 // 调用 Service 插入数据库
return toAjax(equBaseService.insertEquBase(equBase)); 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')") @PreAuthorize("@ss.hasPermi('device:files:edit')")
@Log(title = "设备基本信息", businessType = BusinessType.UPDATE) @Log(title = "设备基本信息", businessType = BusinessType.UPDATE)
@PutMapping("/modify") @PutMapping("/modify")
@ApiOperation("修改设备档案信息") @ApiOperation("修改设备档案信息")
public AjaxResult edit( public AjaxResult edit(@RequestBody EquBase equBase){
@ModelAttribute EquBase equBase, // 自动绑定表单字段
@RequestPart(value = "file", required = false) // 使用 @RequestPart // // 处理图片
@ApiParam(value = "设备图片文件", type = "file") // if (file != null && !file.isEmpty()) {
MultipartFile file // equBase.setEquImage(file.getBytes()); // 存数据库 Blob
) throws IOException { // }
// 处理图片
if (file != null && !file.isEmpty()) {
equBase.setEquImage(file.getBytes()); // 存数据库 Blob
}
// 调用 Service 插入数据库 // 调用 Service 插入数据库
return toAjax(equBaseService.updateEquBase(equBase)); return toAjax(equBaseService.updateEquBase(equBase));

@ -21,14 +21,7 @@ import com.alops.system.service.IAlertMessageService;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
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;
/** /**
* 故障统计Controller * 故障统计Controller
@ -92,11 +85,10 @@ public class AlertMessageController extends BaseController
* 查询预警信息统计列表 * 查询预警信息统计列表
*/ */
@PreAuthorize("@ss.hasPermi('inMonitoring:alertMessage:list')") @PreAuthorize("@ss.hasPermi('inMonitoring:alertMessage:list')")
@PostMapping ("/list") @GetMapping ("/list")
@ApiOperation("查询预警信息") @ApiOperation("查询预警信息")
@Log(title = "查询预警信息", businessType = BusinessType.UPDATE) @Log(title = "查询预警信息", businessType = BusinessType.UPDATE)
public TableDataInfo list( AlertDto alertMessage)
public TableDataInfo list( @RequestBody AlertDto alertMessage)
{ {
startPage(); startPage();
List<AlertMessage> list = alertMessageService.selectAlertMessageList(alertMessage); List<AlertMessage> list = alertMessageService.selectAlertMessageList(alertMessage);

@ -69,7 +69,7 @@ public class AlertRuleController extends BaseController {
@PreAuthorize("@ss.hasPermi('inMonitoring:alertRule:edit')") @PreAuthorize("@ss.hasPermi('inMonitoring:alertRule:edit')")
@ApiOperation("修改预警规则") @ApiOperation("修改预警规则")
@Log(title = "【修改预警规则】", businessType = BusinessType.DELETE) @Log(title = "【修改预警规则】", businessType = BusinessType.DELETE)
@PostMapping("/editRule") @PutMapping("/editRule")
public AjaxResult editRule(@RequestBody AlertRuleAddDto dto) { public AjaxResult editRule(@RequestBody AlertRuleAddDto dto) {
try { try {
AlertRule alertRule = alertRuleService.updateRule(dto); AlertRule alertRule = alertRuleService.updateRule(dto);

@ -55,6 +55,8 @@ public class EquBase
@Excel(name = "设备类型 id") @Excel(name = "设备类型 id")
private String equType; private String equType;
public EquType getEquTypeVO() { public EquType getEquTypeVO() {
return equTypeVO; return equTypeVO;
} }
@ -114,8 +116,8 @@ public class EquBase
@Excel(name = "采集次数") @Excel(name = "采集次数")
private Long createBy ; private Long createBy ;
@Excel(name = "设备图片") @Excel(name = "设备图片地址")
private byte[] equImage ; private String equImage ;
public void setId(String id) public void setId(String id)

@ -28,7 +28,7 @@ public class MonitorLastDto {
private String inCharge; private String inCharge;
private int failureFrequency; private int failureFrequency;
private int warranty; private int warranty;
private Blob equImage; private String equImage;
// equ_type // equ_type
private String equType; private String equType;

@ -88,6 +88,10 @@ public class queryEquBaseVO {
@Excel(name = "累积故障次数") @Excel(name = "累积故障次数")
private String deviceLevel; private String deviceLevel;
@Excel(name = "设备图片")
private String equImage;
public void setId(String id) public void setId(String id)
{ {

@ -111,8 +111,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
b.create_date AS createDate, b.create_date AS createDate,
b.status AS status, b.status AS status,
b.device_level AS deviceLevel, b.device_level AS deviceLevel,
g.health AS health g.health AS health,
b.equ_image AS equImage
</sql> </sql>
<select id="selectEquBaseList" parameterType="equBaseQueryDto" resultType="com.alops.system.domain.vo.queryEquBaseVO"> <select id="selectEquBaseList" parameterType="equBaseQueryDto" resultType="com.alops.system.domain.vo.queryEquBaseVO">
@ -358,7 +358,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createDate != null">#{createDate},</if> <if test="createDate != null">#{createDate},</if>
<if test="equNumber != null">#{equNumber},</if> <if test="equNumber != null">#{equNumber},</if>
COALESCE(#{status,jdbcType=INTEGER}, 0), COALESCE(#{status,jdbcType=INTEGER}, 0),
<if test="equImage != null">#{equImage,jdbcType=BLOB},</if> <if test="equImage != null">#{equImage},</if>
COALESCE(#{failureFrequency,jdbcType=BIGINT}, 0), COALESCE(#{failureFrequency,jdbcType=BIGINT}, 0),
COALESCE(#{gatherFrequency,jdbcType=BIGINT}, 0), COALESCE(#{gatherFrequency,jdbcType=BIGINT}, 0),
<if test="deviceLevel != null">#{deviceLevel},</if> <if test="deviceLevel != null">#{deviceLevel},</if>

Loading…
Cancel
Save