视频流多服务器配置

merge-requests/5/merge
yiming 4 years ago
parent af47882be1
commit 082c2aaee8

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

@ -7,7 +7,6 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Data
@ -29,6 +28,9 @@ public class Camera {
private String rtsp;
private String rtcServer;
private Integer rtcServerPort;
@ApiModelProperty(value = "预置点 增长值",hidden = true)
private Integer ptzId;

@ -21,6 +21,7 @@ import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
@ -56,6 +57,10 @@ public class CameraService {
camera.setPort(configProperties.getCameraConfig().getCameraPort());
camera.setUpdateTime(LocalDateTime.now());
camera.setRtsp("rtsp://"+configProperties.getCameraConfig().getCameraUser()+":"+configProperties.getCameraConfig().getCameraPassword()+"@"+camera.getIp()+":554/cam/realmonitor?channel=1&subtype=0");
if(StringUtils.isEmpty(camera.getRtcServer())){
camera.setRtcServer("127.0.0.1");
}
camera.setRtcServerPort(8083);
try {
cameraMapper.insert(camera);
} catch (DuplicateKeyException e) {
@ -68,6 +73,9 @@ public class CameraService {
public void edit(Camera camera) {
camera.setUpdateTime(LocalDateTime.now());
camera.setPtzId(null);
if(StringUtils.isEmpty(camera.getRtcServer())){
camera.setRtcServer("127.0.0.1");
}
try {
cameraMapper.updateById(camera);
} catch (DuplicateKeyException e) {

@ -418,10 +418,7 @@ public class PlcService {
update.setPicPaths(order.getPicPaths());
log.debug(" update order set pics:{},orderNum:{}", update.getPicPaths(), orderInfo.getOrderNum());
orderMapper.updateById(update);
// 盘点历史纪录
}
}
}

@ -60,8 +60,10 @@ public class StreetService {
if(street.getCamera2Id() != null && street.getCamera2Id() != 0 && street.getCamera1Id() != null && street.getCamera1Id() != 0){
//如果两个球机 就显示2列
street.setVideoStyleColumn(2);
street.setVideoStyleRow(1);
}else {
street.setVideoStyleColumn(1);
street.setVideoStyleRow(1);
}
try {
@ -158,8 +160,10 @@ public class StreetService {
if(street.getCamera2Id() != null && street.getCamera2Id() != 0 && street.getCamera1Id() != null && street.getCamera1Id() != 0){
//如果两个球机 就显示2列
street.setVideoStyleColumn(2);
street.setVideoStyleRow(1);
}else {
street.setVideoStyleColumn(1);
street.setVideoStyleRow(1);
}
try {
streetMapper.updateById(street);

@ -50,8 +50,8 @@ ksec:
port: 9000
# ------------ 实时视频流 全部页面的格式 行列数量
videoStyleConfig:
videoStyleRow: 2
videoStyleColumn: 2
videoStyleRow: 3
videoStyleColumn: 3
# ------------光源---
# -------------type 0:没有光源 1JYDam
# -----------1:JYDam 配置num和index

Loading…
Cancel
Save