支持手动添加,为设备设置单独的密码

This commit is contained in:
648540858
2022-10-18 17:02:05 +08:00
parent e33e6a942c
commit 55b53caef1
19 changed files with 279 additions and 265 deletions

View File

@@ -76,9 +76,6 @@ public class DeviceQuery {
@Autowired
private DynamicTask dynamicTask;
@Autowired
private SubscribeHolder subscribeHolder;
/**
* 使用ID查询国标设备
* @param deviceId 国标ID
@@ -184,7 +181,7 @@ public class DeviceQuery {
}
// 清除redis记录
boolean isSuccess = storager.delete(deviceId);
boolean isSuccess = deviceService.delete(deviceId);
if (isSuccess) {
redisCatchStorage.clearCatchByDeviceId(deviceId);
// 停止此设备的订阅更新
@@ -228,7 +225,7 @@ public class DeviceQuery {
@Parameter(name = "online", description = "是否在线")
@Parameter(name = "channelType", description = "设备/子目录-> false/true")
@GetMapping("/sub_channels/{deviceId}/{channelId}/channels")
public ResponseEntity<PageInfo> subChannels(@PathVariable String deviceId,
public PageInfo subChannels(@PathVariable String deviceId,
@PathVariable String channelId,
int page,
int count,
@@ -239,11 +236,11 @@ public class DeviceQuery {
DeviceChannel deviceChannel = storager.queryChannel(deviceId,channelId);
if (deviceChannel == null) {
PageInfo<DeviceChannel> deviceChannelPageResult = new PageInfo<>();
return new ResponseEntity<>(deviceChannelPageResult,HttpStatus.OK);
return deviceChannelPageResult;
}
PageInfo pageResult = storager.querySubChannels(deviceId, channelId, query, channelType, online, page, count);
return new ResponseEntity<>(pageResult,HttpStatus.OK);
return pageResult;
}
/**
@@ -256,9 +253,8 @@ public class DeviceQuery {
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "channel", description = "通道信息", required = true)
@PostMapping("/channel/update/{deviceId}")
public ResponseEntity updateChannel(@PathVariable String deviceId,DeviceChannel channel){
public void updateChannel(@PathVariable String deviceId,DeviceChannel channel){
deviceChannelService.updateChannel(deviceId, channel);
return new ResponseEntity<>(null,HttpStatus.OK);
}
/**
@@ -272,11 +268,32 @@ public class DeviceQuery {
@Parameter(name = "streamMode", description = "数据流传输模式, 取值:" +
"UDPudp传输TCP-ACTIVEtcp主动模式,暂不支持TCP-PASSIVEtcp被动模式", required = true)
@PostMapping("/transport/{deviceId}/{streamMode}")
public ResponseEntity updateTransport(@PathVariable String deviceId, @PathVariable String streamMode){
Device device = storager.queryVideoDevice(deviceId);
public void updateTransport(@PathVariable String deviceId, @PathVariable String streamMode){
Device device = deviceService.getDevice(deviceId);
device.setStreamMode(streamMode);
deviceService.updateDevice(device);
return new ResponseEntity<>(null,HttpStatus.OK);
deviceService.updateCustomDevice(device);
}
/**
* 添加设备信息
* @param device 设备信息
* @return
*/
@Operation(summary = "添加设备信息")
@Parameter(name = "device", description = "设备", required = true)
@PostMapping("/device/add/")
public void addDevice(Device device){
if (device == null || device.getDeviceId() == null) {
throw new ControllerException(ErrorCode.ERROR400);
}
// 查看deviceId是否存在
boolean exist = deviceService.isExist(device.getDeviceId());
if (exist) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "设备编号已存在");
}
deviceService.addDevice(device);
}
/**
@@ -287,15 +304,11 @@ public class DeviceQuery {
@Operation(summary = "更新设备信息")
@Parameter(name = "device", description = "设备", required = true)
@PostMapping("/device/update/")
public ResponseEntity<WVPResult<String>> updateDevice(Device device){
public void updateDevice(Device device){
if (device != null && device.getDeviceId() != null) {
deviceService.updateDevice(device);
deviceService.updateCustomDevice(device);
}
WVPResult<String> result = new WVPResult<>();
result.setCode(0);
result.setMsg("success");
return new ResponseEntity<>(result,HttpStatus.OK);
}
/**

View File

@@ -1,12 +1,10 @@
package com.genersoft.iot.vmp.vmanager.gb28181.record;
import com.alibaba.fastjson.JSONObject;
import com.genersoft.iot.vmp.common.StreamInfo;
import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException;
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
import com.genersoft.iot.vmp.service.IDeviceService;
import com.genersoft.iot.vmp.service.IMediaServerService;
import com.genersoft.iot.vmp.service.IPlayService;
import com.genersoft.iot.vmp.utils.DateUtil;
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
@@ -18,8 +16,6 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@@ -36,7 +32,6 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
import javax.sip.InvalidArgumentException;
import javax.sip.SipException;
import java.text.ParseException;
import java.time.LocalDate;
import java.util.UUID;
@Tag(name = "国标录像")
@@ -155,7 +150,7 @@ public class GBRecordController {
throw new ControllerException(ErrorCode.ERROR400);
}
Device device = deviceService.queryDevice(deviceId);
Device device = deviceService.getDevice(deviceId);
if (device == null) {
throw new ControllerException(ErrorCode.ERROR400.getCode(), "设备:" + deviceId + "未找到");
}