浏览代码

修改工具

hexiao 1 年之前
父节点
当前提交
16084904a5

+ 15 - 0
hazard-admin/src/main/java/com/ozs/web/controller/accountmanagment/BaseCameraManagementController.java

@@ -579,6 +579,21 @@ public class BaseCameraManagementController extends BaseController {
         return new AjaxResult(200, "ok", CameraUtil.getPlayFlv(cameraCode, one.getChannel(), flay));
     }
 
+    @ApiOperation("查询录像")
+    @GetMapping("/api/records/{cameraCode}/{flay}/{format}")
+    @Log(title = "相机台账管理", businessType = BusinessType.OTHER)
+    public AjaxResult apiRecords(@PathVariable @NotNull(message = "相机编码不能为空") String cameraCode,
+                                 @PathVariable @NotNull(message = "条件不能为空") boolean flay,
+                                 @PathVariable @NotNull(message = "格式不能为空") String format) {
+        LambdaQueryWrapper<BaseCameraManagement> lw = new LambdaQueryWrapper<BaseCameraManagement>();
+        lw.eq(BaseCameraManagement::getCameraCode, cameraCode);
+        BaseCameraManagement one = baseCameraManagementService.getOne(lw);
+        if (ObjectUtils.isEmpty(one)) {
+            throw new BaseException("相机编号【" + cameraCode + "】不存在");
+        }
+        return new AjaxResult(200, "ok", CameraUtil.getPlayFlv(cameraCode, one.getChannel(), flay, format));
+    }
+
     @ApiOperation("批量查询录像")
     @GetMapping("/api/recordsList")
     @Log(title = "相机台账管理", businessType = BusinessType.OTHER)

+ 6 - 7
hazard-admin/src/main/java/com/ozs/web/core/util/CameraUtil.java

@@ -139,14 +139,13 @@ public class CameraUtil {
      * @return
      */
     public static String getPlayFlv(String cameraCode, String channel, boolean flay, String format) {
-
-        if (!ObjectUtils.isEmpty(format) && "HTTP-FLV".equals(format)) {
-            if (!flay) {
-                return bakUrl + "/hdl/" + channel + "/" + cameraCode + ".flv";
-            }
-            return webUrl + "/hdl/" + channel + "/" + cameraCode + ".flv";
+        if (!ObjectUtils.isEmpty(format) && "WS-FLV".equals(format)) {
+            return bakUrl + "/ws/" + channel + "/" + cameraCode + ".flv";
+        }
+        if (!flay) {
+            return bakUrl + "/hdl/" + channel + "/" + cameraCode + ".flv";
         }
-        return bakUrl + "/ws/" + channel + "/" + cameraCode + ".flv";
+        return webUrl + "/hdl/" + channel + "/" + cameraCode + ".flv";
     }
 
     public static String getPlayFlv(String cameraCode, String channel, String format) {