feat(video): 实现报警记录详情查看与处理功能

- 新增查询报警记录详细接口- 修改处理报警记录接口为 PUT 方法- 新增导出报警记录接口
- 前端页面增加报警视频播放功能
-优化报警记录处理状态显示逻辑- 完善报警详情展示内容,支持图片和视频预览
- 后端实现会话聚合逻辑,支持截图和视频证据保存
- 新增模型修改接口
- 调整权限注解配置
- 完善 MinIO 文件上传和回填逻辑
This commit is contained in:
2025-09-29 13:25:54 +08:00
parent bb325bcfbf
commit 9a682f4ff2
11 changed files with 609 additions and 53 deletions

View File

@@ -28,7 +28,6 @@ public class ModelController extends BaseController {
}
/** 新增模型JSON */
@PreAuthorize("@ss.hasPermi('video:model:add')")
@PostMapping
public AjaxResult create(@RequestBody VModel model) {
if (StringUtils.isEmpty(model.getModelName())) {
@@ -44,8 +43,23 @@ public class ModelController extends BaseController {
return rows > 0 ? AjaxResult.success(model) : AjaxResult.error("新增失败");
}
/** 修改模型 */
@PutMapping
public AjaxResult update(@RequestBody VModel model) {
if (model.getModelId() == null) {
return AjaxResult.error("模型ID不能为空");
}
if (StringUtils.isEmpty(model.getModelName())) {
return AjaxResult.error("模型名称不能为空");
}
if (StringUtils.isEmpty(model.getFramework())) {
model.setFramework("onnx");
}
int rows = modelService.update(model);
return rows > 0 ? AjaxResult.success("修改成功") : AjaxResult.error("修改失败");
}
/** 根据ID查询 */
@PreAuthorize("@ss.hasPermi('video:model:query')")
@GetMapping("/{id}")
public AjaxResult get(@PathVariable("id") Long id) {
VModel model = modelService.selectById(id);
@@ -53,7 +67,6 @@ public class ModelController extends BaseController {
}
/** 列表查询(可选条件) */
@PreAuthorize("@ss.hasPermi('video:model:list')")
@GetMapping("/list")
public TableDataInfo list(@RequestParam(value = "modelName", required = false) String modelName,
@RequestParam(value = "framework", required = false) String framework,
@@ -70,7 +83,6 @@ public class ModelController extends BaseController {
}
/** 删除 */
@PreAuthorize("@ss.hasPermi('video:model:remove')")
@DeleteMapping("/{id}")
public AjaxResult delete(@PathVariable("id") Long id) {
int rows = modelService.deleteById(id);
@@ -78,7 +90,6 @@ public class ModelController extends BaseController {
}
/** 启用/禁用 */
@PreAuthorize("@ss.hasPermi('video:model:edit')")
@PutMapping("/{id}/enable")
public AjaxResult enable(@PathVariable("id") Long id,
@RequestParam("enabled") Integer enabled) {
@@ -90,7 +101,6 @@ public class ModelController extends BaseController {
}
/** 下载:直接 302 重定向到模型URL确保可点击下载 */
@PreAuthorize("@ss.hasPermi('video:model:download')")
@GetMapping("/download/{id}")
public void download(@PathVariable("id") Long id, HttpServletResponse response) throws IOException {
VModel model = modelService.selectById(id);

View File

@@ -0,0 +1,88 @@
package com.ruoyi.video.controller;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.service.MinioService;
import com.ruoyi.video.domain.VMinioObject;
import com.ruoyi.video.service.IVMinioObjectService;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/system/minio-object")
public class VMinioObjectController {
private final IVMinioObjectService vMinioObjectService;
private final MinioService minioService;
public VMinioObjectController(IVMinioObjectService vMinioObjectService,
MinioService minioService) {
this.vMinioObjectService = vMinioObjectService;
this.minioService = minioService;
}
/**
* 查询根据主键ID查询一条记录
*/
@GetMapping("/{id}")
public AjaxResult getById(@PathVariable("id") Long id) {
VMinioObject obj = vMinioObjectService.selectById(id);
if (obj == null) {
return AjaxResult.error("记录不存在");
}
return AjaxResult.success(obj);
}
/**
* 查询:根据唯一对象名查询
*/
@GetMapping("/name/{objectName}")
public AjaxResult getByObjectName(@PathVariable("objectName") String objectName) {
VMinioObject obj = vMinioObjectService.selectByObjectName(objectName);
if (obj == null) {
return AjaxResult.error("记录不存在");
}
return AjaxResult.success(obj);
}
/**
* 删除根据主键ID删除先删 MinIO后删数据库
*/
@DeleteMapping("/{id}")
public AjaxResult deleteById(@PathVariable("id") Long id) {
VMinioObject obj = vMinioObjectService.selectById(id);
if (obj == null) {
return AjaxResult.error("记录不存在或已删除");
}
String objectName = obj.getObjectName();
if (StringUtils.isEmpty(objectName)) {
return AjaxResult.error("对象名为空,无法删除 MinIO 对象");
}
try {
// 先删除 MinIO 中的对象,确保不留悬挂数据
minioService.deleteObject(objectName);
} catch (Exception e) {
return AjaxResult.error("删除 MinIO 对象失败: " + e.getMessage());
}
// 再删除数据库记录
int rows = vMinioObjectService.deleteById(id);
return rows > 0 ? AjaxResult.success() : AjaxResult.error("删除数据库记录失败");
}
/**
* 删除:根据唯一对象名删除(先 MinIO再 DB
*/
@DeleteMapping("/name/{objectName}")
public AjaxResult deleteByObjectName(@PathVariable("objectName") String objectName) {
VMinioObject obj = vMinioObjectService.selectByObjectName(objectName);
if (obj == null) {
return AjaxResult.error("记录不存在或已删除");
}
try {
minioService.deleteObject(objectName);
} catch (Exception e) {
return AjaxResult.error("删除 MinIO 对象失败: " + e.getMessage());
}
int rows = vMinioObjectService.deleteByObjectName(objectName);
return rows > 0 ? AjaxResult.success() : AjaxResult.error("删除数据库记录失败");
}
}