Merge remote-tracking branch 'origin/wvp-28181-2.0' into commercial

# Conflicts:
#	sql/update.sql
#	src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java
#	src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/AckRequestProcessor.java
#	src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
#	src/main/java/com/genersoft/iot/vmp/service/IPlayService.java
#	src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
#	web_src/src/components/dialog/deviceEdit.vue
#	web_src/src/components/dialog/devicePlayer.vue
This commit is contained in:
648540858
2022-06-27 10:16:21 +08:00
106 changed files with 3638 additions and 1447 deletions

View File

@@ -24,6 +24,7 @@ import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import java.text.ParseException;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
@@ -68,8 +69,8 @@ public class AlarmController {
@ApiImplicitParam(name="alarmMethod", value = "查询内容" ,dataTypeClass = String.class),
@ApiImplicitParam(name="alarmMethod", value = "查询内容" ,dataTypeClass = String.class),
@ApiImplicitParam(name="alarmType", value = "查询内容" ,dataTypeClass = String.class),
@ApiImplicitParam(name="startTime", value = "查询内容" ,dataTypeClass = String.class),
@ApiImplicitParam(name="endTime", value = "查询内容" ,dataTypeClass = String.class),
@ApiImplicitParam(name="startTime", value = "开始时间" ,dataTypeClass = String.class),
@ApiImplicitParam(name="endTime", value = "结束时间" ,dataTypeClass = String.class),
})
public ResponseEntity<PageInfo<DeviceAlarm>> getAll(
@RequestParam int page,
@@ -98,14 +99,7 @@ public class AlarmController {
}
try {
if (startTime != null) {
DateUtil.format.parse(startTime);
}
if (endTime != null) {
DateUtil.format.parse(endTime);
}
} catch (ParseException e) {
if (!DateUtil.verification(startTime, DateUtil.formatter) || !DateUtil.verification(endTime, DateUtil.formatter)){
return new ResponseEntity<>(null, HttpStatus.BAD_REQUEST);
}
@@ -144,11 +138,7 @@ public class AlarmController {
if (StringUtils.isEmpty(time)) {
time = null;
}
try {
if (time != null) {
DateUtil.format.parse(time);
}
} catch (ParseException e) {
if (!DateUtil.verification(time, DateUtil.formatter) ){
return new ResponseEntity<>(null, HttpStatus.BAD_REQUEST);
}
List<String> deviceIdList = null;
@@ -189,7 +179,7 @@ public class AlarmController {
deviceAlarm.setAlarmDescription("test");
deviceAlarm.setAlarmMethod("1");
deviceAlarm.setAlarmPriority("1");
deviceAlarm.setAlarmTime(DateUtil.formatISO8601.format(System.currentTimeMillis()));
deviceAlarm.setAlarmTime(DateUtil.formatterISO8601.format(LocalDateTime.now()));
deviceAlarm.setAlarmType("1");
deviceAlarm.setLongitude(115.33333);
deviceAlarm.setLatitude(39.33333);

View File

@@ -21,16 +21,22 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.compress.utils.IOUtils;
import org.apache.http.HttpResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.async.DeferredResult;
import javax.servlet.http.HttpServletResponse;
import javax.sip.DialogState;
import java.io.*;
import java.nio.file.Files;
import java.util.*;
@Api(tags = "国标设备查询", value = "国标设备查询")
@@ -200,6 +206,11 @@ public class DeviceQuery {
Set<String> allKeys = dynamicTask.getAllKeys();
for (String key : allKeys) {
if (key.startsWith(deviceId)) {
Runnable runnable = dynamicTask.get(key);
if (runnable instanceof ISubscribeTask) {
ISubscribeTask subscribeTask = (ISubscribeTask) runnable;
subscribeTask.stop();
}
dynamicTask.stop(key);
}
}
@@ -306,12 +317,7 @@ public class DeviceQuery {
public ResponseEntity<WVPResult<String>> updateDevice(Device device){
if (device != null && device.getDeviceId() != null) {
// TODO 报警订阅相关的信息
deviceService.updateDevice(device);
// cmder.deviceInfoQuery(device);
}
WVPResult<String> result = new WVPResult<>();
result.setCode(0);
@@ -336,6 +342,11 @@ public class DeviceQuery {
Device device = storager.queryVideoDevice(deviceId);
String uuid = UUID.randomUUID().toString();
String key = DeferredResultHolder.CALLBACK_CMD_DEVICESTATUS + deviceId;
DeferredResult<ResponseEntity<String>> result = new DeferredResult<ResponseEntity<String>>(2*1000L);
if(device == null) {
result.setResult(new ResponseEntity(String.format("设备%s不存在", deviceId),HttpStatus.OK));
return result;
}
cmder.deviceStatusQuery(device, event -> {
RequestMessage msg = new RequestMessage();
msg.setId(uuid);
@@ -343,7 +354,6 @@ public class DeviceQuery {
msg.setData(String.format("获取设备状态失败,错误码: %s, %s", event.statusCode, event.msg));
resultHolder.invokeResult(msg);
});
DeferredResult<ResponseEntity<String>> result = new DeferredResult<ResponseEntity<String>>(2*1000L);
result.onTimeout(()->{
logger.warn(String.format("获取设备状态超时"));
// 释放rtpserver
@@ -456,4 +466,17 @@ public class DeviceQuery {
wvpResult.setData(dialogStateMap);
return wvpResult;
}
@GetMapping("/snap/{deviceId}/{channelId}")
@ApiOperation(value = "请求截图", notes = "请求截图")
public void getSnap(HttpServletResponse resp, @PathVariable String deviceId, @PathVariable String channelId) {
try {
final InputStream in = Files.newInputStream(new File("snap" + File.separator + deviceId + "_" + channelId + ".jpg").toPath());
resp.setContentType(MediaType.IMAGE_PNG_VALUE);
IOUtils.copy(in, resp.getOutputStream());
} catch (IOException e) {
resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
}
}
}

View File

@@ -72,7 +72,7 @@ public class GBRecordController {
if (!DateUtil.verification(startTime, DateUtil.formatter)){
WVPResult<RecordInfo> wvpResult = new WVPResult<>();
wvpResult.setCode(-1);
wvpResult.setMsg("startTime error, format is " + DateUtil.yyyy_MM_dd_HH_mm_ss);
wvpResult.setMsg("startTime error, format is " + DateUtil.PATTERN);
ResponseEntity<WVPResult<RecordInfo>> resultResponseEntity = new ResponseEntity<>(wvpResult, HttpStatus.OK);
result.setResult(resultResponseEntity);
@@ -81,7 +81,7 @@ public class GBRecordController {
if (!DateUtil.verification(endTime, DateUtil.formatter)){
WVPResult<RecordInfo> wvpResult = new WVPResult<>();
wvpResult.setCode(-1);
wvpResult.setMsg("endTime error, format is " + DateUtil.yyyy_MM_dd_HH_mm_ss);
wvpResult.setMsg("endTime error, format is " + DateUtil.PATTERN);
ResponseEntity<WVPResult<RecordInfo>> resultResponseEntity = new ResponseEntity<>(wvpResult, HttpStatus.OK);
result.setResult(resultResponseEntity);
return result;

View File

@@ -76,14 +76,7 @@ public class LogController {
logger.warn("自动记录日志功能已关闭,查询结果可能不完整。");
}
try {
if (startTime != null) {
DateUtil.format.parse(startTime);
}
if (endTime != null) {
DateUtil.format.parse(endTime);
}
} catch (ParseException e) {
if (!DateUtil.verification(startTime, DateUtil.formatter) || !DateUtil.verification(endTime, DateUtil.formatter)){
return new ResponseEntity<>(null, HttpStatus.BAD_REQUEST);
}