|
@@ -27,7 +27,9 @@ import com.ozs.system.service.DataScoreUtil;
|
|
|
import com.ozs.system.service.ISysDeptService;
|
|
|
import com.ozs.utils.CameraUtil;
|
|
|
import com.ozs.utils.CaneraConfig;
|
|
|
+import com.ozs.utils.RtspToMP4;
|
|
|
import com.ozs.web.core.config.GetCameraPreviewURL;
|
|
|
+import io.minio.Result;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
@@ -75,9 +77,7 @@ public class BaseCameraManagementController extends BaseController {
|
|
|
@Autowired
|
|
|
private BaseRailwayManagementService baseRailwayManagementService;
|
|
|
@Autowired
|
|
|
- private ServerConfig serverConfig;
|
|
|
- @Autowired
|
|
|
- private CaneraConfig caneraConfig;
|
|
|
+ private RtspToMP4 rtspToMP4;
|
|
|
@Autowired
|
|
|
private IdempotenceUtils idempotenceUtils;
|
|
|
@Autowired
|
|
@@ -88,6 +88,8 @@ public class BaseCameraManagementController extends BaseController {
|
|
|
@Autowired
|
|
|
private CameraUtil cameraUtil;
|
|
|
|
|
|
+ private Map<String, Process> map = new HashMap<>();
|
|
|
+
|
|
|
/**
|
|
|
* 所有相机列表+权限
|
|
|
*/
|
|
@@ -1034,12 +1036,29 @@ public class BaseCameraManagementController extends BaseController {
|
|
|
@GetMapping(value = "/getAlarmRecord")
|
|
|
@ApiOperation("报警回放本地测试")
|
|
|
@Log(title = "相机台账管理", businessType = BusinessType.MESSAGE)
|
|
|
- public AjaxResult getAlarmRecord() {
|
|
|
- List<BaseCameraManagement> list = baseCameraManagementService.list(new QueryWrapper<BaseCameraManagement>().eq("line_dir",2));
|
|
|
- List<String> collect = list.stream().map(BaseCameraManagement::getCameraCode).collect(Collectors.toList());
|
|
|
- CompletableFuture.runAsync(() -> cameraUtil.playbackURLs(collect));
|
|
|
- return AjaxResult.success("ok");
|
|
|
+ public AjaxResult getAlarmRecord(){
|
|
|
+ String ffmpegPath = "/usr/bin/ffmpeg";
|
|
|
+ String streamUrl = "rtsp://124.70.58.209:8554/42010001541320000024/42010001541320000024";
|
|
|
+ String FilePath = "/opt/streams/map/42010001541320000024.mp4";
|
|
|
+ Process process = rtspToMP4.StartRecord(ffmpegPath, streamUrl, FilePath);
|
|
|
+ if (null != process) {
|
|
|
+ map.put("42010001541320000024", process);
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+ return AjaxResult.error();
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "结束录制")
|
|
|
+ @GetMapping(value = "/stop")
|
|
|
+ public AjaxResult stop(String id) {
|
|
|
+ if (map.containsKey(id)) {
|
|
|
+ Process process = map.get(id);
|
|
|
+ if (null != process) {
|
|
|
+ rtspToMP4.stopRecord(process);
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return AjaxResult.error();
|
|
|
+ }
|
|
|
}
|
|
|
|