Commit 8aa0bdf539582b9d710503121d911bb166ca7c8e

Authored by 648540858
1 parent 10cb5839

数据库优化

Showing 29 changed files with 246 additions and 69 deletions
sql/mysql.sql
... ... @@ -50,7 +50,7 @@ CREATE TABLE `device` (
50 50 `treeType` varchar(50) COLLATE utf8mb4_general_ci NOT NULL,
51 51 PRIMARY KEY (`id`) USING BTREE,
52 52 UNIQUE KEY `device_deviceId_uindex` (`deviceId`) USING BTREE
53   -) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
  53 +) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
54 54 /*!40101 SET character_set_client = @saved_cs_client */;
55 55  
56 56 --
... ... @@ -80,6 +80,7 @@ CREATE TABLE `device_alarm` (
80 80 `longitude` double DEFAULT NULL,
81 81 `latitude` double DEFAULT NULL,
82 82 `alarmType` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  83 + `createTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
83 84 PRIMARY KEY (`id`) USING BTREE
84 85 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
85 86 /*!40101 SET character_set_client = @saved_cs_client */;
... ... @@ -137,10 +138,11 @@ CREATE TABLE `device_channel` (
137 138 `longitudeWgs84` double DEFAULT NULL,
138 139 `latitudeWgs84` double DEFAULT NULL,
139 140 `businessGroupId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  141 + `gpsTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
140 142 PRIMARY KEY (`id`) USING BTREE,
141 143 UNIQUE KEY `device_channel_id_uindex` (`id`) USING BTREE,
142 144 UNIQUE KEY `device_channel_pk` (`channelId`,`deviceId`) USING BTREE
143   -) ENGINE=InnoDB AUTO_INCREMENT=19317 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
  145 +) ENGINE=InnoDB AUTO_INCREMENT=19324 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
144 146 /*!40101 SET character_set_client = @saved_cs_client */;
145 147  
146 148 --
... ... @@ -175,8 +177,9 @@ CREATE TABLE `device_mobile_position` (
175 177 `latitudeGcj02` double DEFAULT NULL,
176 178 `longitudeWgs84` double DEFAULT NULL,
177 179 `latitudeWgs84` double DEFAULT NULL,
  180 + `createTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
178 181 PRIMARY KEY (`id`) USING BTREE
179   -) ENGINE=InnoDB AUTO_INCREMENT=1508 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
  182 +) ENGINE=InnoDB AUTO_INCREMENT=5649 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
180 183 /*!40101 SET character_set_client = @saved_cs_client */;
181 184  
182 185 --
... ... @@ -206,11 +209,12 @@ CREATE TABLE `gb_stream` (
206 209 `streamType` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
207 210 `mediaServerId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
208 211 `status` int DEFAULT NULL,
209   - `createStamp` bigint DEFAULT NULL,
  212 + `createTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
  213 + `gpsTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
210 214 PRIMARY KEY (`gbStreamId`) USING BTREE,
211 215 UNIQUE KEY `app` (`app`,`stream`) USING BTREE,
212 216 UNIQUE KEY `gbId` (`gbId`) USING BTREE
213   -) ENGINE=InnoDB AUTO_INCREMENT=301679 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
  217 +) ENGINE=InnoDB AUTO_INCREMENT=301681 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
214 218 /*!40101 SET character_set_client = @saved_cs_client */;
215 219  
216 220 --
... ... @@ -240,7 +244,7 @@ CREATE TABLE `log` (
240 244 `username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
241 245 `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
242 246 PRIMARY KEY (`id`) USING BTREE
243   -) ENGINE=InnoDB AUTO_INCREMENT=22051 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
  247 +) ENGINE=InnoDB AUTO_INCREMENT=29943 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
244 248 /*!40101 SET character_set_client = @saved_cs_client */;
245 249  
246 250 --
... ... @@ -329,10 +333,12 @@ CREATE TABLE `parent_platform` (
329 333 `startOfflinePush` int DEFAULT '0',
330 334 `administrativeDivision` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
331 335 `catalogGroup` int DEFAULT '1',
  336 + `createTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
  337 + `updateTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
332 338 PRIMARY KEY (`id`) USING BTREE,
333 339 UNIQUE KEY `parent_platform_id_uindex` (`id`) USING BTREE,
334 340 UNIQUE KEY `parent_platform_pk` (`serverGBId`) USING BTREE
335   -) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
  341 +) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
336 342 /*!40101 SET character_set_client = @saved_cs_client */;
337 343  
338 344 --
... ... @@ -446,9 +452,10 @@ CREATE TABLE `stream_proxy` (
446 452 `enable_remove_none_reader` bit(1) NOT NULL,
447 453 `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
448 454 `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  455 + `updateTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
449 456 PRIMARY KEY (`id`) USING BTREE,
450 457 UNIQUE KEY `stream_proxy_pk` (`app`,`stream`) USING BTREE
451   -) ENGINE=InnoDB AUTO_INCREMENT=61 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
  458 +) ENGINE=InnoDB AUTO_INCREMENT=65 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
452 459 /*!40101 SET character_set_client = @saved_cs_client */;
453 460  
454 461 --
... ... @@ -474,10 +481,12 @@ CREATE TABLE `stream_push` (
474 481 `totalReaderCount` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
475 482 `originType` int DEFAULT NULL,
476 483 `originTypeStr` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
477   - `createStamp` bigint DEFAULT NULL,
  484 + `createTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
478 485 `aliveSecond` int DEFAULT NULL,
479 486 `mediaServerId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
480 487 `serverId` varchar(50) COLLATE utf8mb4_general_ci NOT NULL,
  488 + `pushTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
  489 + `updateTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
481 490 PRIMARY KEY (`id`) USING BTREE,
482 491 UNIQUE KEY `stream_push_pk` (`app`,`stream`) USING BTREE
483 492 ) ENGINE=InnoDB AUTO_INCREMENT=305304 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
... ... @@ -557,4 +566,4 @@ UNLOCK TABLES;
557 566 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
558 567 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
559 568  
560   --- Dump completed on 2022-07-04 1:07:19
  569 +-- Dump completed on 2022-07-06 9:43:54
... ...
sql/update.sql
1 1 alter table stream_push
2 2 add serverId varchar(50) not null;
  3 +
3 4 alter table device
4 5 add geoCoordSys varchar(50) not null;
5 6 alter table device
6 7 add treeType varchar(50) not null;
7 8 update device set device.geoCoordSys='WGS84';
8 9 update device set device.treeType='CivilCode';
  10 +
9 11 alter table device_channel
10 12 add longitudeGcj02 double default null;
11 13 alter table device_channel
... ... @@ -16,15 +18,43 @@ alter table device_channel
16 18 add latitudeWgs84 double default null;
17 19 alter table device_channel
18 20 add businessGroupId varchar(50) default null;
  21 +alter table device_channel
  22 + add gpsTime varchar(50) default null;
19 23  
20 24  
21   -alter table device_mobile_position change cnLng longitudeGcj02 double default null;
22   -alter table device_mobile_position change cnLat latitudeGcj02 double default null;
  25 +alter table device_mobile_position
  26 + change cnLng longitudeGcj02 double default null;
  27 +alter table device_mobile_position
  28 + change cnLat latitudeGcj02 double default null;
23 29 alter table device_mobile_position
24 30 add longitudeWgs84 double default null;
25 31 alter table device_mobile_position
26 32 add latitudeWgs84 double default null;
27   -alter table device_mobile_position drop geodeticSystem;
  33 +alter table device_mobile_position
  34 + drop geodeticSystem;
  35 +alter table device_mobile_position
  36 + add createTime varchar(50) default null;
  37 +
  38 +alter table device_alarm
  39 + add createTime varchar(50) default null;
  40 +
  41 +alter table gb_stream
  42 + change createStamp createTime varchar(50) default null;
  43 +
  44 +alter table parent_platform
  45 + add createTime varchar(50) default null;
  46 +alter table parent_platform
  47 + add updateTime varchar(50) default null;
  48 +
  49 +alter table stream_proxy
  50 + add updateTime varchar(50) default null;
  51 +
  52 +alter table stream_push
  53 + add pushTime varchar(50) default null;
  54 +alter table stream_push
  55 + add updateTime varchar(50) default null;
  56 +alter table stream_push
  57 + change createStamp createTime varchar(50) default null;
28 58  
29 59  
30 60  
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceAlarm.java
... ... @@ -77,6 +77,8 @@ public class DeviceAlarm {
77 77 */
78 78 private String alarmType;
79 79  
  80 + private String createTime;
  81 +
80 82  
81 83 public String getId() {
82 84 return id;
... ... @@ -157,4 +159,12 @@ public class DeviceAlarm {
157 159 public void setChannelId(String channelId) {
158 160 this.channelId = channelId;
159 161 }
  162 +
  163 + public String getCreateTime() {
  164 + return createTime;
  165 + }
  166 +
  167 + public void setCreateTime(String createTime) {
  168 + this.createTime = createTime;
  169 + }
160 170 }
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java
... ... @@ -199,6 +199,11 @@ public class DeviceChannel {
199 199 */
200 200 private String businessGroupId;
201 201  
  202 + /**
  203 + * GPS的更新时间
  204 + */
  205 + private String gpsTime;
  206 +
202 207 public int getId() {
203 208 return id;
204 209 }
... ... @@ -519,4 +524,12 @@ public class DeviceChannel {
519 524 public void setBusinessGroupId(String businessGroupId) {
520 525 this.businessGroupId = businessGroupId;
521 526 }
  527 +
  528 + public String getGpsTime() {
  529 + return gpsTime;
  530 + }
  531 +
  532 + public void setGpsTime(String gpsTime) {
  533 + this.gpsTime = gpsTime;
  534 + }
522 535 }
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/bean/GbStream.java
... ... @@ -15,10 +15,8 @@ public class GbStream extends PlatformGbStream{
15 15 private double latitude;
16 16 private String streamType;
17 17 private boolean status;
18   - /**
19   - * GMT unix系统时间戳,单位秒
20   - */
21   - public Long createStamp;
  18 +
  19 + public String createTime;
22 20  
23 21 @Override
24 22 public Integer getGbStreamId() {
... ... @@ -102,12 +100,11 @@ public class GbStream extends PlatformGbStream{
102 100 this.mediaServerId = mediaServerId;
103 101 }
104 102  
105   -
106   - public Long getCreateStamp() {
107   - return createStamp;
  103 + public String getCreateTime() {
  104 + return createTime;
108 105 }
109 106  
110   - public void setCreateStamp(Long createStamp) {
111   - this.createStamp = createStamp;
  107 + public void setCreateTime(String createTime) {
  108 + this.createTime = createTime;
112 109 }
113 110 }
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/bean/MobilePosition.java
... ... @@ -77,6 +77,11 @@ public class MobilePosition {
77 77 */
78 78 private double latitudeWgs84;
79 79  
  80 + /**
  81 + * 创建时间
  82 + */
  83 + private String createTime;
  84 +
80 85  
81 86 public String getDeviceId() {
82 87 return deviceId;
... ... @@ -189,4 +194,12 @@ public class MobilePosition {
189 194 public void setLatitudeWgs84(double latitudeWgs84) {
190 195 this.latitudeWgs84 = latitudeWgs84;
191 196 }
  197 +
  198 + public String getCreateTime() {
  199 + return createTime;
  200 + }
  201 +
  202 + public void setCreateTime(String createTime) {
  203 + this.createTime = createTime;
  204 + }
192 205 }
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java
... ... @@ -144,6 +144,16 @@ public class ParentPlatform {
144 144 */
145 145 private String administrativeDivision;
146 146  
  147 + /**
  148 + * 更新时间
  149 + */
  150 + private String updateTime;
  151 +
  152 + /**
  153 + * 创建时间
  154 + */
  155 + private String createTime;
  156 +
147 157 public Integer getId() {
148 158 return id;
149 159 }
... ... @@ -368,4 +378,20 @@ public class ParentPlatform {
368 378 public void setAdministrativeDivision(String administrativeDivision) {
369 379 this.administrativeDivision = administrativeDivision;
370 380 }
  381 +
  382 + public String getUpdateTime() {
  383 + return updateTime;
  384 + }
  385 +
  386 + public void setUpdateTime(String updateTime) {
  387 + this.updateTime = updateTime;
  388 + }
  389 +
  390 + public String getCreateTime() {
  391 + return createTime;
  392 + }
  393 +
  394 + public void setCreateTime(String createTime) {
  395 + this.createTime = createTime;
  396 + }
371 397 }
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java
... ... @@ -140,6 +140,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
140 140 Element rootElement = getRootElement(evt);
141 141  
142 142 MobilePosition mobilePosition = new MobilePosition();
  143 + mobilePosition.setCreateTime(DateUtil.getNow());
143 144 Element deviceIdElement = rootElement.element("DeviceID");
144 145 String channelId = deviceIdElement.getTextTrim().toString();
145 146 Device device = redisCatchStorage.getDevice(deviceId);
... ... @@ -205,6 +206,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
205 206 deviceChannel.setLatitudeWgs84(mobilePosition.getLatitudeWgs84());
206 207 deviceChannel.setLongitudeGcj02(mobilePosition.getLongitudeGcj02());
207 208 deviceChannel.setLatitudeGcj02(mobilePosition.getLatitudeGcj02());
  209 + deviceChannel.setGpsTime(mobilePosition.getTime());
208 210 storager.updateChannelPosition(deviceChannel);
209 211 // 发送redis消息。 通知位置信息的变化
210 212 JSONObject jsonObject = new JSONObject();
... ... @@ -273,6 +275,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
273 275 logger.info("[收到Notify-Alarm]:{}/{}", device.getDeviceId(), deviceAlarm.getChannelId());
274 276 if ("4".equals(deviceAlarm.getAlarmMethod())) {
275 277 MobilePosition mobilePosition = new MobilePosition();
  278 + mobilePosition.setCreateTime(DateUtil.getNow());
276 279 mobilePosition.setDeviceId(deviceAlarm.getDeviceId());
277 280 mobilePosition.setTime(deviceAlarm.getAlarmTime());
278 281 mobilePosition.setLongitude(deviceAlarm.getLongitude());
... ... @@ -309,6 +312,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
309 312 deviceChannel.setLatitudeWgs84(mobilePosition.getLatitudeWgs84());
310 313 deviceChannel.setLongitudeGcj02(mobilePosition.getLongitudeGcj02());
311 314 deviceChannel.setLatitudeGcj02(mobilePosition.getLatitudeGcj02());
  315 + deviceChannel.setGpsTime(mobilePosition.getTime());
312 316 storager.updateChannelPosition(deviceChannel);
313 317 }
314 318 // TODO: 需要实现存储报警信息、报警分类
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/AlarmNotifyMessageHandler.java
... ... @@ -81,6 +81,7 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme
81 81 String channelId = deviceIdElement.getText().toString();
82 82  
83 83 DeviceAlarm deviceAlarm = new DeviceAlarm();
  84 + deviceAlarm.setCreateTime(DateUtil.getNow());
84 85 deviceAlarm.setDeviceId(device.getDeviceId());
85 86 deviceAlarm.setChannelId(channelId);
86 87 deviceAlarm.setAlarmPriority(getText(rootElement, "AlarmPriority"));
... ... @@ -112,6 +113,7 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme
112 113 if (!StringUtils.isEmpty(deviceAlarm.getAlarmMethod())) {
113 114 if ( deviceAlarm.getAlarmMethod().contains(DeviceAlarmMethod.GPS.getVal() + "")) {
114 115 MobilePosition mobilePosition = new MobilePosition();
  116 + mobilePosition.setCreateTime(DateUtil.getNow());
115 117 mobilePosition.setDeviceId(deviceAlarm.getDeviceId());
116 118 mobilePosition.setTime(deviceAlarm.getAlarmTime());
117 119 mobilePosition.setLongitude(deviceAlarm.getLongitude());
... ... @@ -148,6 +150,7 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme
148 150 deviceChannel.setLatitudeWgs84(mobilePosition.getLatitudeWgs84());
149 151 deviceChannel.setLongitudeGcj02(mobilePosition.getLongitudeGcj02());
150 152 deviceChannel.setLatitudeGcj02(mobilePosition.getLatitudeGcj02());
  153 + deviceChannel.setGpsTime(mobilePosition.getTime());
151 154 storager.updateChannelPosition(deviceChannel);
152 155 }
153 156 }
... ... @@ -198,6 +201,7 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme
198 201  
199 202  
200 203 DeviceAlarm deviceAlarm = new DeviceAlarm();
  204 + deviceAlarm.setCreateTime(DateUtil.getNow());
201 205 deviceAlarm.setDeviceId(parentPlatform.getServerGBId());
202 206 deviceAlarm.setChannelId(channelId);
203 207 deviceAlarm.setAlarmPriority(getText(rootElement, "AlarmPriority"));
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/MobilePositionNotifyMessageHandler.java
... ... @@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.
8 8 import com.genersoft.iot.vmp.gb28181.utils.Coordtransform;
9 9 import com.genersoft.iot.vmp.gb28181.utils.NumericUtil;
10 10 import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
  11 +import com.genersoft.iot.vmp.utils.DateUtil;
11 12 import com.genersoft.iot.vmp.utils.GpsUtil;
12 13 import org.dom4j.DocumentException;
13 14 import org.dom4j.Element;
... ... @@ -53,6 +54,7 @@ public class MobilePositionNotifyMessageHandler extends SIPRequestProcessorParen
53 54 rootElement = getRootElement(evt, device.getCharset());
54 55  
55 56 MobilePosition mobilePosition = new MobilePosition();
  57 + mobilePosition.setCreateTime(DateUtil.getNow());
56 58 if (!StringUtils.isEmpty(device.getName())) {
57 59 mobilePosition.setDeviceName(device.getName());
58 60 }
... ... @@ -108,6 +110,7 @@ public class MobilePositionNotifyMessageHandler extends SIPRequestProcessorParen
108 110 deviceChannel.setLatitudeWgs84(mobilePosition.getLatitudeWgs84());
109 111 deviceChannel.setLongitudeGcj02(mobilePosition.getLongitudeGcj02());
110 112 deviceChannel.setLatitudeGcj02(mobilePosition.getLatitudeGcj02());
  113 + deviceChannel.setGpsTime(mobilePosition.getTime());
111 114 storager.updateChannelPosition(deviceChannel);
112 115 //回复 200 OK
113 116 responseAck(evt, Response.OK);
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/MobilePositionResponseMessageHandler.java
... ... @@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.respons
8 8 import com.genersoft.iot.vmp.gb28181.utils.Coordtransform;
9 9 import com.genersoft.iot.vmp.gb28181.utils.NumericUtil;
10 10 import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
  11 +import com.genersoft.iot.vmp.utils.DateUtil;
11 12 import com.genersoft.iot.vmp.utils.GpsUtil;
12 13 import org.dom4j.DocumentException;
13 14 import org.dom4j.Element;
... ... @@ -53,6 +54,7 @@ public class MobilePositionResponseMessageHandler extends SIPRequestProcessorPar
53 54 rootElement = getRootElement(evt, device.getCharset());
54 55  
55 56 MobilePosition mobilePosition = new MobilePosition();
  57 + mobilePosition.setCreateTime(DateUtil.getNow());
56 58 if (!StringUtils.isEmpty(device.getName())) {
57 59 mobilePosition.setDeviceName(device.getName());
58 60 }
... ... @@ -108,6 +110,7 @@ public class MobilePositionResponseMessageHandler extends SIPRequestProcessorPar
108 110 deviceChannel.setLatitudeWgs84(mobilePosition.getLatitudeWgs84());
109 111 deviceChannel.setLongitudeGcj02(mobilePosition.getLongitudeGcj02());
110 112 deviceChannel.setLatitudeGcj02(mobilePosition.getLatitudeGcj02());
  113 + deviceChannel.setGpsTime(mobilePosition.getTime());
111 114 storager.updateChannelPosition(deviceChannel);
112 115 //回复 200 OK
113 116 responseAck(evt, Response.OK);
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java
... ... @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
4 4 import com.alibaba.fastjson.JSONObject;
5 5 import com.genersoft.iot.vmp.gb28181.bean.Device;
6 6 import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
  7 +import com.genersoft.iot.vmp.utils.DateUtil;
7 8 import org.dom4j.Attribute;
8 9 import org.dom4j.Document;
9 10 import org.dom4j.DocumentException;
... ... @@ -314,6 +315,7 @@ public class XmlUtil {
314 315 } else {
315 316 deviceChannel.setLatitude(0.00);
316 317 }
  318 + deviceChannel.setGpsTime(DateUtil.getNow());
317 319 if (deviceChannel.getLongitude()*deviceChannel.getLatitude() > 0) {
318 320 if ("WGS84".equals(device.getGeoCoordSys())) {
319 321 deviceChannel.setLongitudeWgs84(deviceChannel.getLongitude());
... ...
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
... ... @@ -339,9 +339,7 @@ public class ZLMHttpHookListener {
339 339 @PostMapping(value = "/on_stream_changed", produces = "application/json;charset=UTF-8")
340 340 public ResponseEntity<String> onStreamChanged(@RequestBody MediaItem item){
341 341  
342   - if (logger.isDebugEnabled()) {
343   - logger.debug("[ ZLM HOOK ]on_stream_changed API调用,参数:" + JSONObject.toJSONString(item));
344   - }
  342 + logger.info("[ ZLM HOOK ]on_stream_changed API调用,参数:" + JSONObject.toJSONString(item));
345 343 String mediaServerId = item.getMediaServerId();
346 344 JSONObject json = (JSONObject) JSON.toJSON(item);
347 345 ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_stream_changed, json);
... ... @@ -389,7 +387,6 @@ public class ZLMHttpHookListener {
389 387  
390 388 if (mediaServerItem != null){
391 389 if (regist) {
392   - StreamPushItem streamPushItem = null;
393 390 StreamInfo streamInfoByAppAndStream = mediaService.getStreamInfoByAppAndStream(mediaServerItem, app, streamId, tracks);
394 391 item.setStreamInfo(streamInfoByAppAndStream);
395 392  
... ... @@ -455,10 +452,8 @@ public class ZLMHttpHookListener {
455 452 @ResponseBody
456 453 @PostMapping(value = "/on_stream_none_reader", produces = "application/json;charset=UTF-8")
457 454 public ResponseEntity<String> onStreamNoneReader(@RequestBody JSONObject json){
458   -
459   - if (logger.isDebugEnabled()) {
460   - logger.debug("[ ZLM HOOK ]on_stream_none_reader API调用,参数:" + json.toString());
461   - }
  455 +
  456 + logger.info("[ ZLM HOOK ]on_stream_none_reader API调用,参数:" + json.toString());
462 457 String mediaServerId = json.getString("mediaServerId");
463 458 String streamId = json.getString("stream");
464 459 String app = json.getString("app");
... ...
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java
... ... @@ -12,6 +12,7 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
12 12 import com.genersoft.iot.vmp.storager.dao.GbStreamMapper;
13 13 import com.genersoft.iot.vmp.storager.dao.PlatformGbStreamMapper;
14 14 import com.genersoft.iot.vmp.storager.dao.StreamPushMapper;
  15 +import com.genersoft.iot.vmp.utils.DateUtil;
15 16 import org.checkerframework.checker.units.qual.C;
16 17 import org.slf4j.Logger;
17 18 import org.slf4j.LoggerFactory;
... ... @@ -159,7 +160,8 @@ public class ZLMMediaListManager {
159 160 gbStreamMapper.update(transform);
160 161 streamPushMapper.del(gbStreamList.get(0).getApp(), gbStreamList.get(0).getStream());
161 162 }else {
162   - transform.setCreateStamp(System.currentTimeMillis());
  163 + transform.setCreateTime(DateUtil.getNow());
  164 + transform.setUpdateTime(DateUtil.getNow());
163 165 gbStreamMapper.add(transform);
164 166 }
165 167 if (transform != null) {
... ...
src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamPushItem.java
1 1 package com.genersoft.iot.vmp.media.zlm.dto;
2 2  
3 3 import com.genersoft.iot.vmp.gb28181.bean.GbStream;
  4 +import com.genersoft.iot.vmp.utils.DateUtil;
4 5 import org.jetbrains.annotations.NotNull;
  6 +import org.springframework.util.unit.DataUnit;
5 7  
6 8 import java.util.List;
7 9  
... ... @@ -86,6 +88,21 @@ public class StreamPushItem extends GbStream implements Comparable&lt;StreamPushIte
86 88 */
87 89 private String serverId;
88 90  
  91 + /**
  92 + * 推流时间
  93 + */
  94 + private String pushTime;
  95 +
  96 + /**
  97 + * 更新时间
  98 + */
  99 + private String updateTime;
  100 +
  101 + /**
  102 + * 创建时间
  103 + */
  104 + private String createTime;
  105 +
89 106 public String getVhost() {
90 107 return vhost;
91 108 }
... ... @@ -97,7 +114,8 @@ public class StreamPushItem extends GbStream implements Comparable&lt;StreamPushIte
97 114  
98 115 @Override
99 116 public int compareTo(@NotNull StreamPushItem streamPushItem) {
100   - return Long.valueOf(super.createStamp - streamPushItem.getCreateStamp().intValue()).intValue();
  117 + return Long.valueOf(DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(super.createTime)
  118 + - DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(streamPushItem.getCreateTime())).intValue();
101 119 }
102 120  
103 121 public static class MediaSchema {
... ... @@ -232,5 +250,32 @@ public class StreamPushItem extends GbStream implements Comparable&lt;StreamPushIte
232 250 public void setServerId(String serverId) {
233 251 this.serverId = serverId;
234 252 }
  253 +
  254 +
  255 + public String getPushTime() {
  256 + return pushTime;
  257 + }
  258 +
  259 + public void setPushTime(String pushTime) {
  260 + this.pushTime = pushTime;
  261 + }
  262 +
  263 + public String getUpdateTime() {
  264 + return updateTime;
  265 + }
  266 +
  267 + public void setUpdateTime(String updateTime) {
  268 + this.updateTime = updateTime;
  269 + }
  270 +
  271 + @Override
  272 + public String getCreateTime() {
  273 + return createTime;
  274 + }
  275 +
  276 + @Override
  277 + public void setCreateTime(String createTime) {
  278 + this.createTime = createTime;
  279 + }
235 280 }
236 281  
... ...
src/main/java/com/genersoft/iot/vmp/service/impl/RedisAlarmMsgListener.java
... ... @@ -41,6 +41,7 @@ public class RedisAlarmMsgListener implements MessageListener {
41 41 ParentPlatform platform = storage.queryParentPlatByServerGBId(gbId);
42 42  
43 43 DeviceAlarm deviceAlarm = new DeviceAlarm();
  44 + deviceAlarm.setCreateTime(DateUtil.getNow());
44 45 deviceAlarm.setChannelId(gbId);
45 46 deviceAlarm.setAlarmDescription(alarmChannelMessage.getAlarmDescription());
46 47 deviceAlarm.setAlarmMethod("" + alarmChannelMessage.getAlarmSn());
... ...
src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java
... ... @@ -230,11 +230,12 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
230 230 public boolean start(String app, String stream) {
231 231 boolean result = false;
232 232 StreamProxyItem streamProxy = videoManagerStorager.queryStreamProxy(app, stream);
233   - if (!streamProxy.isEnable() && streamProxy != null) {
  233 + if (!streamProxy.isEnable() ) {
234 234 JSONObject jsonObject = addStreamProxyToZlm(streamProxy);
235 235 if (jsonObject == null) {
236 236 return false;
237 237 }
  238 + System.out.println(jsonObject);
238 239 if (jsonObject.getInteger("code") == 0) {
239 240 result = true;
240 241 streamProxy.setEnable(true);
... ... @@ -250,7 +251,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
250 251 StreamProxyItem streamProxyDto = videoManagerStorager.queryStreamProxy(app, stream);
251 252 if (streamProxyDto != null && streamProxyDto.isEnable()) {
252 253 JSONObject jsonObject = removeStreamProxyFromZlm(streamProxyDto);
253   - if (jsonObject.getInteger("code") == 0) {
  254 + if (jsonObject != null && jsonObject.getInteger("code") == 0) {
254 255 streamProxyDto.setEnable(false);
255 256 result = videoManagerStorager.updateStreamProxy(streamProxyDto);
256 257 }
... ...
src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java
... ... @@ -15,6 +15,7 @@ import com.genersoft.iot.vmp.service.IMediaServerService;
15 15 import com.genersoft.iot.vmp.service.IStreamPushService;
16 16 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
17 17 import com.genersoft.iot.vmp.storager.dao.*;
  18 +import com.genersoft.iot.vmp.utils.DateUtil;
18 19 import com.github.pagehelper.PageHelper;
19 20 import com.github.pagehelper.PageInfo;
20 21 import org.slf4j.Logger;
... ... @@ -102,7 +103,7 @@ public class StreamPushServiceImpl implements IStreamPushService {
102 103 streamPushItem.setOriginType(item.getOriginType());
103 104 streamPushItem.setOriginTypeStr(item.getOriginTypeStr());
104 105 streamPushItem.setOriginUrl(item.getOriginUrl());
105   - streamPushItem.setCreateStamp(item.getCreateStamp() * 1000);
  106 + streamPushItem.setCreateTime(DateUtil.getNow());
106 107 streamPushItem.setAliveSecond(item.getAliveSecond());
107 108 streamPushItem.setStatus(true);
108 109 streamPushItem.setStreamType("push");
... ... @@ -127,7 +128,7 @@ public class StreamPushServiceImpl implements IStreamPushService {
127 128 public boolean saveToGB(GbStream stream) {
128 129 stream.setStreamType("push");
129 130 stream.setStatus(true);
130   - stream.setCreateStamp(System.currentTimeMillis());
  131 + stream.setCreateTime(DateUtil.getNow());
131 132 int add = gbStreamMapper.add(stream);
132 133  
133 134 // 查找开启了全部直播流共享的上级平台
... ... @@ -317,7 +318,7 @@ public class StreamPushServiceImpl implements IStreamPushService {
317 318 streamPushItem.setStreamType("push");
318 319 streamPushItem.setStatus(true);
319 320 streamPushItem.setGbId("34020000004111" + gbId);
320   - streamPushItem.setCreateStamp(System.currentTimeMillis());
  321 + streamPushItem.setCreateTime(DateUtil.getNow());
321 322 gbId ++;
322 323 }
323 324 int limitCount = 30;
... ...
src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushUploadFileHandler.java
... ... @@ -4,6 +4,7 @@ import com.alibaba.excel.context.AnalysisContext;
4 4 import com.alibaba.excel.event.AnalysisEventListener;
5 5 import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
6 6 import com.genersoft.iot.vmp.service.IStreamPushService;
  7 +import com.genersoft.iot.vmp.utils.DateUtil;
7 8 import com.genersoft.iot.vmp.vmanager.bean.StreamPushExcelDto;
8 9 import com.google.common.collect.BiMap;
9 10 import com.google.common.collect.HashBiMap;
... ... @@ -94,7 +95,7 @@ public class StreamPushUploadFileHandler extends AnalysisEventListener&lt;StreamPus
94 95 streamPushItem.setGbId(streamPushExcelDto.getGbId());
95 96 streamPushItem.setStatus(false);
96 97 streamPushItem.setStreamType("push");
97   - streamPushItem.setCreateStamp(System.currentTimeMillis());
  98 + streamPushItem.setCreateTime(DateUtil.getNow());
98 99 streamPushItem.setMediaServerId(defaultMediaServerId);
99 100 streamPushItem.setName(streamPushExcelDto.getName());
100 101 streamPushItem.setOriginType(2);
... ...
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceAlarmMapper.java
... ... @@ -15,8 +15,8 @@ import java.util.List;
15 15 @Repository
16 16 public interface DeviceAlarmMapper {
17 17  
18   - @Insert("INSERT INTO device_alarm (deviceId, channelId, alarmPriority, alarmMethod, alarmTime, alarmDescription, longitude, latitude, alarmType ) " +
19   - "VALUES ('${deviceId}', '${channelId}', '${alarmPriority}', '${alarmMethod}', '${alarmTime}', '${alarmDescription}', ${longitude}, ${latitude}, '${alarmType}')")
  18 + @Insert("INSERT INTO device_alarm (deviceId, channelId, alarmPriority, alarmMethod, alarmTime, alarmDescription, longitude, latitude, alarmType , createTime ) " +
  19 + "VALUES ('${deviceId}', '${channelId}', '${alarmPriority}', '${alarmMethod}', '${alarmTime}', '${alarmDescription}', ${longitude}, ${latitude}, '${alarmType}', '${createTime}')")
20 20 int add(DeviceAlarm alarm);
21 21  
22 22  
... ...
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
... ... @@ -19,11 +19,11 @@ public interface DeviceChannelMapper {
19 19 @Insert("INSERT INTO device_channel (channelId, deviceId, name, manufacture, model, owner, civilCode, block, " +
20 20 "address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " +
21 21 "ipAddress, port, password, PTZType, status, streamId, longitude, latitude, longitudeGcj02, latitudeGcj02, " +
22   - "longitudeWgs84, latitudeWgs84, createTime, updateTime, businessGroupId) " +
  22 + "longitudeWgs84, latitudeWgs84, createTime, updateTime, businessGroupId, gpsTime) " +
23 23 "VALUES ('${channelId}', '${deviceId}', '${name}', '${manufacture}', '${model}', '${owner}', '${civilCode}', '${block}'," +
24 24 "'${address}', ${parental}, '${parentId}', ${safetyWay}, ${registerWay}, '${certNum}', ${certifiable}, ${errCode}, '${secrecy}', " +
25 25 "'${ipAddress}', ${port}, '${password}', ${PTZType}, ${status}, '${streamId}', ${longitude}, ${latitude}, ${longitudeGcj02}, " +
26   - "${latitudeGcj02}, ${longitudeWgs84}, ${latitudeWgs84},'${createTime}', '${updateTime}', '${businessGroupId}')")
  26 + "${latitudeGcj02}, ${longitudeWgs84}, ${latitudeWgs84},'${createTime}', '${updateTime}', '${businessGroupId}', '${gpsTime}')")
27 27 int add(DeviceChannel channel);
28 28  
29 29 @Update(value = {" <script>" +
... ... @@ -58,6 +58,7 @@ public interface DeviceChannelMapper {
58 58 "<if test='longitudeWgs84 != null'>, longitudeWgs84=${longitudeWgs84}</if>" +
59 59 "<if test='latitudeWgs84 != null'>, latitudeWgs84=${latitudeWgs84}</if>" +
60 60 "<if test='businessGroupId != null'>, businessGroupId=#{businessGroupId}</if>" +
  61 + "<if test='gpsTime != null'>, gpsTime=#{gpsTime}</if>" +
61 62 "WHERE deviceId='${deviceId}' AND channelId='${channelId}'"+
62 63 " </script>"})
63 64 int update(DeviceChannel channel);
... ... @@ -147,7 +148,7 @@ public interface DeviceChannelMapper {
147 148 "(channelId, deviceId, name, manufacture, model, owner, civilCode, block, subCount, " +
148 149 " address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " +
149 150 " ipAddress, port, password, PTZType, status, streamId, longitude, latitude, longitudeGcj02, latitudeGcj02, " +
150   - " longitudeWgs84, latitudeWgs84, createTime, updateTime, businessGroupId) " +
  151 + " longitudeWgs84, latitudeWgs84, createTime, updateTime, businessGroupId, gpsTime) " +
151 152 "values " +
152 153 "<foreach collection='addChannels' index='index' item='item' separator=','> " +
153 154 "('${item.channelId}', '${item.deviceId}', '${item.name}', '${item.manufacture}', '${item.model}', " +
... ... @@ -157,7 +158,7 @@ public interface DeviceChannelMapper {
157 158 "'${item.ipAddress}', ${item.port}, '${item.password}', ${item.PTZType}, ${item.status}, " +
158 159 "'${item.streamId}', ${item.longitude}, ${item.latitude},${item.longitudeGcj02}, " +
159 160 "${item.latitudeGcj02},${item.longitudeWgs84}, ${item.latitudeWgs84},'${item.createTime}', '${item.updateTime}', " +
160   - "'${item.businessGroupId}') " +
  161 + "'${item.businessGroupId}', '${item.gpsTime}') " +
161 162 "</foreach> " +
162 163 "ON DUPLICATE KEY UPDATE " +
163 164 "updateTime=VALUES(updateTime), " +
... ... @@ -189,7 +190,8 @@ public interface DeviceChannelMapper {
189 190 "latitudeGcj02=VALUES(latitudeGcj02), " +
190 191 "longitudeWgs84=VALUES(longitudeWgs84), " +
191 192 "latitudeWgs84=VALUES(latitudeWgs84), " +
192   - "businessGroupId=VALUES(businessGroupId) " +
  193 + "businessGroupId=VALUES(businessGroupId), " +
  194 + "gpsTime=VALUES(gpsTime)" +
193 195 "</script>")
194 196 int batchAdd(List<DeviceChannel> addChannels);
195 197  
... ... @@ -228,6 +230,7 @@ public interface DeviceChannelMapper {
228 230 "<if test='item.longitudeWgs84 != null'>, longitudeWgs84=${item.longitudeWgs84}</if>" +
229 231 "<if test='item.latitudeWgs84 != null'>, latitudeWgs84=${item.latitudeWgs84}</if>" +
230 232 "<if test='item.businessGroupId != null'>, businessGroupId=#{item.businessGroupId}</if>" +
  233 + "<if test='item.gpsTime != null'>, gpsTime=#{item.gpsTime}</if>" +
231 234 "WHERE deviceId='${item.deviceId}' AND channelId='${item.channelId}'"+
232 235 "</foreach>" +
233 236 "</script>"})
... ... @@ -281,10 +284,11 @@ public interface DeviceChannelMapper {
281 284 "SET " +
282 285 "latitude=${latitude}, " +
283 286 "longitude=${longitude}, " +
284   - "longitudeGcj02=${longitudeGcj02}," +
285   - "latitudeGcj02=${latitudeGcj02}," +
286   - "longitudeWgs84=${longitudeWgs84}," +
287   - "latitudeWgs84=${latitudeWgs84} " +
  287 + "longitudeGcj02=${longitudeGcj02}, " +
  288 + "latitudeGcj02=${latitudeGcj02}, " +
  289 + "longitudeWgs84=${longitudeWgs84}, " +
  290 + "latitudeWgs84=${latitudeWgs84}, " +
  291 + "gpsTime='${gpsTime}' " +
288 292 "WHERE deviceId=#{deviceId} " +
289 293 " <if test='channelId != null' > AND channelId=#{channelId}</if>" +
290 294 " </script>"})
... ...
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMobilePositionMapper.java
... ... @@ -8,8 +8,8 @@ import org.apache.ibatis.annotations.*;
8 8 @Mapper
9 9 public interface DeviceMobilePositionMapper {
10 10  
11   - @Insert("INSERT INTO device_mobile_position (deviceId,channelId, deviceName, time, longitude, latitude, altitude, speed, direction, reportSource, longitudeGcj02, latitudeGcj02, longitudeWgs84, latitudeWgs84) " +
12   - "VALUES ('${deviceId}','${channelId}', '${deviceName}', '${time}', ${longitude}, ${latitude}, ${altitude}, ${speed}, ${direction}, '${reportSource}', ${longitudeGcj02}, ${latitudeGcj02}, ${longitudeWgs84}, ${latitudeWgs84})")
  11 + @Insert("INSERT INTO device_mobile_position (deviceId,channelId, deviceName, time, longitude, latitude, altitude, speed, direction, reportSource, longitudeGcj02, latitudeGcj02, longitudeWgs84, latitudeWgs84, createTime) " +
  12 + "VALUES ('${deviceId}','${channelId}', '${deviceName}', '${time}', ${longitude}, ${latitude}, ${altitude}, ${speed}, ${direction}, '${reportSource}', ${longitudeGcj02}, ${latitudeGcj02}, ${longitudeWgs84}, ${latitudeWgs84}, '${createTime}')")
13 13 int insertNewPosition(MobilePosition mobilePosition);
14 14  
15 15 @Select(value = {" <script>" +
... ...
src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java
... ... @@ -15,10 +15,10 @@ import java.util.List;
15 15 public interface GbStreamMapper {
16 16  
17 17 @Insert("REPLACE INTO gb_stream (app, stream, gbId, name, " +
18   - "longitude, latitude, streamType, mediaServerId, status, createStamp) VALUES" +
  18 + "longitude, latitude, streamType, mediaServerId, status, createTime) VALUES" +
19 19 "('${app}', '${stream}', '${gbId}', '${name}', " +
20 20 "'${longitude}', '${latitude}', '${streamType}', " +
21   - "'${mediaServerId}', ${status}, ${createStamp})")
  21 + "'${mediaServerId}', ${status}, '${createTime}')")
22 22 @Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gbStreamId")
23 23 int add(GbStream gbStream);
24 24  
... ... @@ -120,12 +120,12 @@ public interface GbStreamMapper {
120 120 @Insert("<script> " +
121 121 "INSERT IGNORE into gb_stream " +
122 122 "(app, stream, gbId, name, " +
123   - "longitude, latitude, streamType, mediaServerId, status, createStamp)" +
  123 + "longitude, latitude, streamType, mediaServerId, status, createTime)" +
124 124 "values " +
125 125 "<foreach collection='subList' index='index' item='item' separator=','> " +
126 126 "('${item.app}', '${item.stream}', '${item.gbId}', '${item.name}', " +
127 127 "'${item.longitude}', '${item.latitude}', '${item.streamType}', " +
128   - "'${item.mediaServerId}', ${item.status}, ${item.createStamp}) "+
  128 + "'${item.mediaServerId}', ${item.status}, '${item.createTime}') "+
129 129 "</foreach> " +
130 130 "</script>")
131 131 @Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gbStreamId")
... ...
src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java
... ... @@ -16,10 +16,10 @@ public interface ParentPlatformMapper {
16 16  
17 17 @Insert("INSERT INTO parent_platform (enable, name, serverGBId, serverGBDomain, serverIP, serverPort, deviceGBId, deviceIp, " +
18 18 " devicePort, username, password, expires, keepTimeout, transport, characterSet, ptz, rtcp, " +
19   - " status, shareAllLiveStream, startOfflinePush, catalogId, administrativeDivision, catalogGroup) " +
  19 + " status, shareAllLiveStream, startOfflinePush, catalogId, administrativeDivision, catalogGroup, createTime, updateTime) " +
20 20 " VALUES (${enable}, '${name}', '${serverGBId}', '${serverGBDomain}', '${serverIP}', ${serverPort}, '${deviceGBId}', '${deviceIp}', " +
21 21 " '${devicePort}', '${username}', '${password}', '${expires}', '${keepTimeout}', '${transport}', '${characterSet}', ${ptz}, ${rtcp}, " +
22   - " ${status}, ${shareAllLiveStream}, ${startOfflinePush}, #{catalogId}, #{administrativeDivision}, #{catalogGroup})")
  22 + " ${status}, ${shareAllLiveStream}, ${startOfflinePush}, #{catalogId}, #{administrativeDivision}, #{catalogGroup}, #{createTime}, #{updateTime})")
23 23 int addParentPlatform(ParentPlatform parentPlatform);
24 24  
25 25 @Update("UPDATE parent_platform " +
... ... @@ -45,6 +45,8 @@ public interface ParentPlatformMapper {
45 45 "startOfflinePush=${startOfflinePush}, " +
46 46 "catalogGroup=#{catalogGroup}, " +
47 47 "administrativeDivision=#{administrativeDivision}, " +
  48 + "createTime=#{createTime}, " +
  49 + "updateTime=#{updateTime}, " +
48 50 "catalogId=#{catalogId} " +
49 51 "WHERE id=#{id}")
50 52 int updateParentPlatform(ParentPlatform parentPlatform);
... ... @@ -86,10 +88,10 @@ public interface ParentPlatformMapper {
86 88  
87 89 @Update(value = {" <script>" +
88 90 "UPDATE parent_platform " +
89   - "SET catalogId=#{catalogId}" +
  91 + "SET catalogId=#{catalogId}, updateTime=#{updateTime}" +
90 92 "WHERE serverGBId=#{platformId}"+
91 93 "</script>"})
92   - int setDefaultCatalog(String platformId, String catalogId);
  94 + int setDefaultCatalog(String platformId, String catalogId, String updateTime);
93 95  
94 96 @Select("select 'channel' as name, count(pgc.platformId) count from platform_gb_channel pgc left join device_channel dc on dc.id = pgc.deviceChannelId where pgc.platformId=#{platformId} and dc.channelId =#{gbId} " +
95 97 "union " +
... ...
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java
... ... @@ -714,7 +714,6 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
714 714 streamProxyItem.setStatus(true);
715 715 String now = DateUtil.getNow();
716 716 streamProxyItem.setCreateTime(now);
717   - streamProxyItem.setCreateStamp(System.currentTimeMillis());
718 717 try {
719 718 if (streamProxyMapper.add(streamProxyItem) > 0) {
720 719 if (!StringUtils.isEmpty(streamProxyItem.getGbId())) {
... ... @@ -1009,7 +1008,7 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
1009 1008  
1010 1009 @Override
1011 1010 public int setDefaultCatalog(String platformId, String catalogId) {
1012   - return platformMapper.setDefaultCatalog(platformId, catalogId);
  1011 + return platformMapper.setDefaultCatalog(platformId, catalogId, DateUtil.getNow());
1013 1012 }
1014 1013  
1015 1014 @Override
... ... @@ -1126,6 +1125,10 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
1126 1125 if (deviceChannel.getChannelId().equals(deviceChannel.getDeviceId())) {
1127 1126 deviceChannel.setChannelId(null);
1128 1127 }
  1128 + if (deviceChannel.getGpsTime() == null) {
  1129 + deviceChannel.setGpsTime(DateUtil.getNow());
  1130 + }
  1131 +
1129 1132 deviceChannelMapper.updatePosition(deviceChannel);
1130 1133 }
1131 1134 }
... ...
src/main/java/com/genersoft/iot/vmp/utils/SystemInfoUtils.java
... ... @@ -8,7 +8,6 @@ import oshi.hardware.NetworkIF;
8 8 import oshi.software.os.OperatingSystem;
9 9 import oshi.util.FormatUtil;
10 10  
11   -import java.text.DecimalFormat;
12 11 import java.util.HashMap;
13 12 import java.util.List;
14 13 import java.util.Map;
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java
... ... @@ -11,6 +11,7 @@ import com.genersoft.iot.vmp.gb28181.bean.SubscribeHolder;
11 11 import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
12 12 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
13 13 import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
  14 +import com.genersoft.iot.vmp.utils.DateUtil;
14 15 import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
15 16 import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
16 17 import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.UpdateChannelParam;
... ... @@ -169,6 +170,8 @@ public class PlatformController {
169 170 wvpResult.setMsg("平台 " + parentPlatform.getServerGBId() + " 已存在");
170 171 return new ResponseEntity<>(wvpResult, HttpStatus.OK);
171 172 }
  173 + parentPlatform.setCreateTime(DateUtil.getNow());
  174 + parentPlatform.setUpdateTime(DateUtil.getNow());
172 175 boolean updateResult = storager.updateParentPlatform(parentPlatform);
173 176  
174 177 if (updateResult) {
... ... @@ -232,7 +235,7 @@ public class PlatformController {
232 235 }
233 236 parentPlatform.setCharacterSet(parentPlatform.getCharacterSet().toUpperCase());
234 237 ParentPlatform parentPlatformOld = storager.queryParentPlatByServerGBId(parentPlatform.getServerGBId());
235   -
  238 + parentPlatform.setUpdateTime(DateUtil.getNow());
236 239 boolean updateResult = storager.updateParentPlatform(parentPlatform);
237 240  
238 241 if (updateResult) {
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/streamProxy/StreamProxyController.java
... ... @@ -131,6 +131,9 @@ public class StreamProxyController {
131 131 public Object start(String app, String stream){
132 132 logger.info("启用代理: " + app + "/" + stream);
133 133 boolean result = streamProxyService.start(app, stream);
  134 + if (!result) {
  135 + logger.info("启用代理失败: " + app + "/" + stream);
  136 + }
134 137 return result?"success":"fail";
135 138 }
136 139  
... ...
web_src/src/components/StreamProxyList.vue
... ... @@ -87,7 +87,7 @@
87 87 <el-divider direction="vertical"></el-divider>
88 88 <el-button size="medium" icon="el-icon-switch-button" type="text" v-if="scope.row.enable" @click="stop(scope.row)">停用</el-button>
89 89 <el-divider direction="vertical"></el-divider>
90   - <el-button size="medium" icon="el-icon-check" type="text" :loading="startBtnLaoding" v-if="!scope.row.enable" @click="start(scope.row)">启用</el-button>
  90 + <el-button size="medium" icon="el-icon-check" type="text" :loading="scope.row.startBtnLoading" v-if="!scope.row.enable" @click="start(scope.row)">启用</el-button>
91 91 <el-divider v-if="!scope.row.enable" direction="vertical"></el-divider>
92 92 <el-button size="medium" icon="el-icon-delete" type="text" style="color: #f56c6c" @click="deleteStreamProxy(scope.row)">删除</el-button>
93 93 </template>
... ... @@ -132,7 +132,7 @@
132 132 count:15,
133 133 total:0,
134 134 getListLoading: false,
135   - startBtnLaoding: false
  135 + startBtnLoading: false
136 136 };
137 137 },
138 138 computed: {
... ... @@ -169,7 +169,10 @@
169 169 }
170 170 }).then(function (res) {
171 171 that.total = res.data.total;
172   - that.streamProxyList = res.data.list;
  172 + for (let i = 0; i < res.data.list.length; i++) {
  173 + res.data.list[i]["startBtnLoading"] = false;
  174 + }
  175 + that.streamProxyList = res.data.list;
173 176 that.getListLoading = false;
174 177 }).catch(function (error) {
175 178 console.log(error);
... ... @@ -263,7 +266,7 @@
263 266 start: function(row){
264 267 let that = this;
265 268 this.getListLoading = true;
266   - this.startBtnLaoding = true;
  269 + this.$set(row, 'startBtnLoading', true)
267 270 this.$axios({
268 271 method: 'get',
269 272 url:`/api/proxy/start`,
... ... @@ -273,7 +276,7 @@
273 276 }
274 277 }).then(function (res) {
275 278 that.getListLoading = false;
276   - that.startBtnLaoding = false;
  279 + that.$set(row, 'startBtnLoading', false)
277 280 if (res.data == "success"){
278 281 that.initData()
279 282 }else {
... ... @@ -287,7 +290,7 @@
287 290 }).catch(function (error) {
288 291 console.log(error);
289 292 that.getListLoading = false;
290   - that.startBtnLaoding = false;
  293 + that.$set(row, 'startBtnLoading', false)
291 294 });
292 295 },
293 296 stop: function(row){
... ...