change(module): 添加获取巡检录像功能

- 在 RecordInspectionCabinetController 中添加 getVisibleVideo 方法
- 通过路径参数获取视频文件并返回
- 支持动态检测文件 MIME 类型
- 在 RuoYiConfig 中添加 myPath 配置项用于指定文件路径
IOT
zch 1 year ago
parent ea6051582b
commit 129a9ce996

@ -30,6 +30,8 @@ public class RuoYiConfig
/** 验证码类型 */ /** 验证码类型 */
private static String captchaType; private static String captchaType;
// 自定义路径,用于获取日志信息里的文件
private static String myPath; private static String myPath;
public static String getMyPath() public static String getMyPath()
@ -43,6 +45,7 @@ public class RuoYiConfig
} }
public String getName() public String getName()
{ {
return name; return name;

@ -164,13 +164,13 @@ public class RecordInspectionCabinetController extends BaseController
} }
} }
/** /**
* GET * GET
* @param filePath * @param filePath
* @return ResponseEntity<FileSystemResource> * @return ResponseEntity<FileSystemResource>
*/ */
@GetMapping("/getVisibleVideo/{filePath}") @GetMapping("/getVisibleVideo/{filePath}")
public ResponseEntity<FileSystemResource> getVisibleVideo(@PathVariable String filePath) { public ResponseEntity<FileSystemResource> getVisibleVideo(@PathVariable String filePath) {
// 获取配置文件中的路径application.yml的profile // 获取配置文件中的路径application.yml的profile
String myPath = RuoYiConfig.getMyPath(); String myPath = RuoYiConfig.getMyPath();
// 构建完整的文件路径 // 构建完整的文件路径
@ -204,6 +204,6 @@ public ResponseEntity<FileSystemResource> getVisibleVideo(@PathVariable String f
// 如果文件不存在返回404状态 // 如果文件不存在返回404状态
return ResponseEntity.notFound().build(); return ResponseEntity.notFound().build();
} }
} }
} }

Loading…
Cancel
Save