视频流多服务器配置

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 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();
} }

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

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

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

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

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

Loading…
Cancel
Save