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 方法
return success(equBaseService.selectLatestEquMonitorInfo(id));
}
/**
* 获取设备指定时间段内的历史监控信息
* @param equBaseQueryDto 查询对象包含设备ID开始时间和结束时间
@ -120,34 +121,35 @@ public class EquBaseController extends BaseController
}
/**
* 根据设备ID返回图片流
* 前端直接 <img src="/equBase/image/{id}">
*/
@PreAuthorize("@ss.hasPermi('device:files:queryimage')")
@GetMapping(value = "/queryimage/{id}")
@ApiOperation("查询单个设备图片")
public void getImage(@PathVariable String id, HttpServletResponse response) throws IOException {
// /**
// * 根据设备ID返回图片流
// * 前端直接 <img src="/equBase/image/{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));

@ -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<AlertMessage> list = alertMessageService.selectAlertMessageList(alertMessage);

@ -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);

@ -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)

@ -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;

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

@ -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
</sql>
<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="equNumber != null">#{equNumber},</if>
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(#{gatherFrequency,jdbcType=BIGINT}, 0),
<if test="deviceLevel != null">#{deviceLevel},</if>

Loading…
Cancel
Save