From 5e4a673ecc95d6fb06aec6c5e2f3ec4ffb72584b Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期一, 01 八月 2022 14:33:51 +0800
Subject: [PATCH] 修复视频播放点击音量报错 #557,修复编解码信息获取失败
---
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/alarm/AlarmController.java | 28 +++++++---------------------
1 files changed, 7 insertions(+), 21 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/alarm/AlarmController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/alarm/AlarmController.java
index addc431..509c988 100644
--- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/alarm/AlarmController.java
+++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/alarm/AlarmController.java
@@ -9,6 +9,7 @@
import com.genersoft.iot.vmp.service.IDeviceAlarmService;
import com.genersoft.iot.vmp.service.IGbStreamService;
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
+import com.genersoft.iot.vmp.utils.DateUtil;
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
@@ -23,9 +24,8 @@
import org.springframework.web.bind.annotation.*;
import java.text.ParseException;
-import java.text.SimpleDateFormat;
+import java.time.LocalDateTime;
import java.util.Arrays;
-import java.util.Date;
import java.util.List;
@Api(tags = "鎶ヨ淇℃伅绠$悊")
@@ -45,9 +45,6 @@
@Autowired
private IVideoManagerStorage storage;
-
- private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- private SimpleDateFormat formatForGB = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
/**
* 鍒嗛〉鏌ヨ鎶ヨ
@@ -72,8 +69,8 @@
@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,
@@ -102,14 +99,7 @@
}
- try {
- if (startTime != null) {
- format.parse(startTime);
- }
- if (endTime != null) {
- format.parse(endTime);
- }
- } catch (ParseException e) {
+ if (!DateUtil.verification(startTime, DateUtil.formatter) || !DateUtil.verification(endTime, DateUtil.formatter)){
return new ResponseEntity<>(null, HttpStatus.BAD_REQUEST);
}
@@ -148,11 +138,7 @@
if (StringUtils.isEmpty(time)) {
time = null;
}
- try {
- if (time != null) {
- format.parse(time);
- }
- } catch (ParseException e) {
+ if (!DateUtil.verification(time, DateUtil.formatter) ){
return new ResponseEntity<>(null, HttpStatus.BAD_REQUEST);
}
List<String> deviceIdList = null;
@@ -193,7 +179,7 @@
deviceAlarm.setAlarmDescription("test");
deviceAlarm.setAlarmMethod("1");
deviceAlarm.setAlarmPriority("1");
- deviceAlarm.setAlarmTime(formatForGB.format(System.currentTimeMillis()));
+ deviceAlarm.setAlarmTime(DateUtil.formatterISO8601.format(LocalDateTime.now()));
deviceAlarm.setAlarmType("1");
deviceAlarm.setLongitude(115.33333);
deviceAlarm.setLatitude(39.33333);
--
Gitblit v1.8.0