|
|
|
@ -22,6 +22,9 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import java.io.*;
|
|
|
|
import java.io.*;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
import java.util.stream.Collector;
|
|
|
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
@Api(value = "camera",tags = "球机管理")
|
|
|
|
@Api(value = "camera",tags = "球机管理")
|
|
|
|
@RestController
|
|
|
|
@RestController
|
|
|
|
@ -119,8 +122,6 @@ public class CameraController {
|
|
|
|
@PostMapping("/io/toPtz")
|
|
|
|
@PostMapping("/io/toPtz")
|
|
|
|
@ApiOperation(value = "转至球机IO配置点")
|
|
|
|
@ApiOperation(value = "转至球机IO配置点")
|
|
|
|
public Result toPtz(@RequestBody CameraIOPtz req) {
|
|
|
|
public Result toPtz(@RequestBody CameraIOPtz req) {
|
|
|
|
//todo
|
|
|
|
|
|
|
|
//validatorUtil.validate(req);
|
|
|
|
|
|
|
|
Integer ptzId = cameraService.getPtzId(req.getCameraIOId());
|
|
|
|
Integer ptzId = cameraService.getPtzId(req.getCameraIOId());
|
|
|
|
cameraControlModule.toPtz(ptzId,req.getCameraId());
|
|
|
|
cameraControlModule.toPtz(ptzId,req.getCameraId());
|
|
|
|
return Result.success();
|
|
|
|
return Result.success();
|
|
|
|
@ -129,16 +130,15 @@ public class CameraController {
|
|
|
|
@GetMapping("/downloadConfig")
|
|
|
|
@GetMapping("/downloadConfig")
|
|
|
|
@ApiOperation(value = "视频直播配置")
|
|
|
|
@ApiOperation(value = "视频直播配置")
|
|
|
|
public Result downloadConfig() throws IOException {
|
|
|
|
public Result downloadConfig() throws IOException {
|
|
|
|
File directory = new File("D:\\hzleaper_auto_install/rtsp2webRTC");
|
|
|
|
List<Camera> cameraList = cameraService.allCameras();
|
|
|
|
if(!directory.exists()){
|
|
|
|
Map<String,List<Camera>> map = cameraList.stream().collect(Collectors.groupingBy(Camera::getRtcServer));
|
|
|
|
directory.mkdirs();
|
|
|
|
for(Map.Entry<String,List<Camera>> entry: map.entrySet()){
|
|
|
|
}
|
|
|
|
File file = new File(entry.getKey()+"-config.json");
|
|
|
|
File file = new File("D:\\hzleaper_auto_install/rtsp2webRTC/config.json");
|
|
|
|
|
|
|
|
if (file.exists()) { // 如果已存在,删除旧文件
|
|
|
|
if (file.exists()) { // 如果已存在,删除旧文件
|
|
|
|
file.delete();
|
|
|
|
file.delete();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
file.createNewFile();
|
|
|
|
file.createNewFile();
|
|
|
|
List<Camera> cameras = cameraService.allCameras();
|
|
|
|
List<Camera> cameras = entry.getValue();
|
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
|
JSONObject server = new JSONObject();
|
|
|
|
JSONObject server = new JSONObject();
|
|
|
|
server.put("http_port",":8083");
|
|
|
|
server.put("http_port",":8083");
|
|
|
|
@ -162,7 +162,9 @@ public class CameraController {
|
|
|
|
write.write(jsonObject.toJSONString());
|
|
|
|
write.write(jsonObject.toJSONString());
|
|
|
|
write.flush();
|
|
|
|
write.flush();
|
|
|
|
write.close();
|
|
|
|
write.close();
|
|
|
|
log.info("downloadConfig");
|
|
|
|
log.info("downloadConfig:{}",entry.getKey());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
return Result.success();
|
|
|
|
return Result.success();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|