Commit 943f95ba8ce02f8088f2dfcfd83a60391a8a65a6
1 parent
ec90519c
增加消息通道配置,可以通道redis在wvp上下级之间发送消息
Showing
18 changed files
with
151 additions
and
25 deletions
sql/2.6.6-2.6.7更新.sql
0 → 100755
src/main/resources/db/migration/V2.6.7_20230201__初始化.sql renamed to sql/初始化.sql
| @@ -47,6 +47,7 @@ CREATE TABLE `device` ( | @@ -47,6 +47,7 @@ CREATE TABLE `device` ( | ||
| 47 | `mobilePositionSubmissionInterval` int DEFAULT '5', | 47 | `mobilePositionSubmissionInterval` int DEFAULT '5', |
| 48 | `subscribeCycleForAlarm` int DEFAULT NULL, | 48 | `subscribeCycleForAlarm` int DEFAULT NULL, |
| 49 | `ssrcCheck` int DEFAULT '0', | 49 | `ssrcCheck` int DEFAULT '0', |
| 50 | + `asMessageChannel` int DEFAULT '0', | ||
| 50 | `geoCoordSys` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | 51 | `geoCoordSys` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| 51 | `treeType` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | 52 | `treeType` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| 52 | `custom_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | 53 | `custom_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| @@ -329,6 +330,7 @@ CREATE TABLE `parent_platform` ( | @@ -329,6 +330,7 @@ CREATE TABLE `parent_platform` ( | ||
| 329 | `catalogId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | 330 | `catalogId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| 330 | `ptz` int DEFAULT NULL, | 331 | `ptz` int DEFAULT NULL, |
| 331 | `rtcp` int DEFAULT NULL, | 332 | `rtcp` int DEFAULT NULL, |
| 333 | + `asMessageChannel` int DEFAULT '0', | ||
| 332 | `status` bit(1) DEFAULT NULL, | 334 | `status` bit(1) DEFAULT NULL, |
| 333 | `startOfflinePush` int DEFAULT '0', | 335 | `startOfflinePush` int DEFAULT '0', |
| 334 | `administrativeDivision` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | 336 | `administrativeDivision` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java
| @@ -48,6 +48,7 @@ public class UserSetting { | @@ -48,6 +48,7 @@ public class UserSetting { | ||
| 48 | private Boolean syncChannelOnDeviceOnline = Boolean.FALSE; | 48 | private Boolean syncChannelOnDeviceOnline = Boolean.FALSE; |
| 49 | 49 | ||
| 50 | private Boolean sipLog = Boolean.FALSE; | 50 | private Boolean sipLog = Boolean.FALSE; |
| 51 | + private Boolean sendToPlatformsWhenIdLost = Boolean.FALSE; | ||
| 51 | 52 | ||
| 52 | private String serverId = "000000"; | 53 | private String serverId = "000000"; |
| 53 | 54 | ||
| @@ -218,4 +219,12 @@ public class UserSetting { | @@ -218,4 +219,12 @@ public class UserSetting { | ||
| 218 | public void setSipLog(Boolean sipLog) { | 219 | public void setSipLog(Boolean sipLog) { |
| 219 | this.sipLog = sipLog; | 220 | this.sipLog = sipLog; |
| 220 | } | 221 | } |
| 222 | + | ||
| 223 | + public Boolean getSendToPlatformsWhenIdLost() { | ||
| 224 | + return sendToPlatformsWhenIdLost; | ||
| 225 | + } | ||
| 226 | + | ||
| 227 | + public void setSendToPlatformsWhenIdLost(Boolean sendToPlatformsWhenIdLost) { | ||
| 228 | + this.sendToPlatformsWhenIdLost = sendToPlatformsWhenIdLost; | ||
| 229 | + } | ||
| 221 | } | 230 | } |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java
| @@ -188,6 +188,9 @@ public class Device { | @@ -188,6 +188,9 @@ public class Device { | ||
| 188 | @Schema(description = "SIP交互IP(设备访问平台的IP)") | 188 | @Schema(description = "SIP交互IP(设备访问平台的IP)") |
| 189 | private String localIp; | 189 | private String localIp; |
| 190 | 190 | ||
| 191 | + @Schema(description = "是否作为消息通道") | ||
| 192 | + private boolean asMessageChannel; | ||
| 193 | + | ||
| 191 | 194 | ||
| 192 | public String getDeviceId() { | 195 | public String getDeviceId() { |
| 193 | return deviceId; | 196 | return deviceId; |
| @@ -428,4 +431,12 @@ public class Device { | @@ -428,4 +431,12 @@ public class Device { | ||
| 428 | public void setKeepaliveIntervalTime(int keepaliveIntervalTime) { | 431 | public void setKeepaliveIntervalTime(int keepaliveIntervalTime) { |
| 429 | this.keepaliveIntervalTime = keepaliveIntervalTime; | 432 | this.keepaliveIntervalTime = keepaliveIntervalTime; |
| 430 | } | 433 | } |
| 434 | + | ||
| 435 | + public boolean isAsMessageChannel() { | ||
| 436 | + return asMessageChannel; | ||
| 437 | + } | ||
| 438 | + | ||
| 439 | + public void setAsMessageChannel(boolean asMessageChannel) { | ||
| 440 | + this.asMessageChannel = asMessageChannel; | ||
| 441 | + } | ||
| 431 | } | 442 | } |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java
| @@ -189,6 +189,9 @@ public class ParentPlatform { | @@ -189,6 +189,9 @@ public class ParentPlatform { | ||
| 189 | @Schema(description = "树类型 国标规定了两种树的展现方式 行政区划 CivilCode 和业务分组:BusinessGrou") | 189 | @Schema(description = "树类型 国标规定了两种树的展现方式 行政区划 CivilCode 和业务分组:BusinessGrou") |
| 190 | private String treeType; | 190 | private String treeType; |
| 191 | 191 | ||
| 192 | + @Schema(description = "是否作为消息通道") | ||
| 193 | + private boolean asMessageChannel; | ||
| 194 | + | ||
| 192 | public Integer getId() { | 195 | public Integer getId() { |
| 193 | return id; | 196 | return id; |
| 194 | } | 197 | } |
| @@ -428,4 +431,12 @@ public class ParentPlatform { | @@ -428,4 +431,12 @@ public class ParentPlatform { | ||
| 428 | public void setTreeType(String treeType) { | 431 | public void setTreeType(String treeType) { |
| 429 | this.treeType = treeType; | 432 | this.treeType = treeType; |
| 430 | } | 433 | } |
| 434 | + | ||
| 435 | + public boolean isAsMessageChannel() { | ||
| 436 | + return asMessageChannel; | ||
| 437 | + } | ||
| 438 | + | ||
| 439 | + public void setAsMessageChannel(boolean asMessageChannel) { | ||
| 440 | + this.asMessageChannel = asMessageChannel; | ||
| 441 | + } | ||
| 431 | } | 442 | } |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/RecordInfo.java
| 1 | package com.genersoft.iot.vmp.gb28181.bean; | 1 | package com.genersoft.iot.vmp.gb28181.bean; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 5 | + | ||
| 4 | import java.time.Instant; | 6 | import java.time.Instant; |
| 5 | import java.util.List; | 7 | import java.util.List; |
| 6 | 8 | ||
| @@ -9,22 +11,29 @@ import java.util.List; | @@ -9,22 +11,29 @@ import java.util.List; | ||
| 9 | * @author: swwheihei | 11 | * @author: swwheihei |
| 10 | * @date: 2020年5月8日 下午2:05:56 | 12 | * @date: 2020年5月8日 下午2:05:56 |
| 11 | */ | 13 | */ |
| 14 | +@Schema(description = "设备录像查询结果信息") | ||
| 12 | public class RecordInfo { | 15 | public class RecordInfo { |
| 13 | 16 | ||
| 17 | + @Schema(description = "设备编号") | ||
| 14 | private String deviceId; | 18 | private String deviceId; |
| 15 | 19 | ||
| 20 | + @Schema(description = "通道编号") | ||
| 16 | private String channelId; | 21 | private String channelId; |
| 17 | 22 | ||
| 23 | + @Schema(description = "命令序列号") | ||
| 18 | private String sn; | 24 | private String sn; |
| 19 | 25 | ||
| 26 | + @Schema(description = "设备名称") | ||
| 20 | private String name; | 27 | private String name; |
| 21 | - | 28 | + |
| 29 | + @Schema(description = "列表总数") | ||
| 22 | private int sumNum; | 30 | private int sumNum; |
| 23 | 31 | ||
| 24 | private int count; | 32 | private int count; |
| 25 | 33 | ||
| 26 | private Instant lastTime; | 34 | private Instant lastTime; |
| 27 | - | 35 | + |
| 36 | + @Schema(description = "") | ||
| 28 | private List<RecordItem> recordList; | 37 | private List<RecordItem> recordList; |
| 29 | 38 | ||
| 30 | public String getDeviceId() { | 39 | public String getDeviceId() { |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/RecordItem.java
| @@ -2,9 +2,9 @@ package com.genersoft.iot.vmp.gb28181.bean; | @@ -2,9 +2,9 @@ package com.genersoft.iot.vmp.gb28181.bean; | ||
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | import com.genersoft.iot.vmp.utils.DateUtil; | 4 | import com.genersoft.iot.vmp.utils.DateUtil; |
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 5 | import org.jetbrains.annotations.NotNull; | 6 | import org.jetbrains.annotations.NotNull; |
| 6 | 7 | ||
| 7 | -import java.text.ParseException; | ||
| 8 | import java.time.Instant; | 8 | import java.time.Instant; |
| 9 | import java.time.temporal.TemporalAccessor; | 9 | import java.time.temporal.TemporalAccessor; |
| 10 | 10 | ||
| @@ -13,26 +13,37 @@ import java.time.temporal.TemporalAccessor; | @@ -13,26 +13,37 @@ import java.time.temporal.TemporalAccessor; | ||
| 13 | * @author: swwheihei | 13 | * @author: swwheihei |
| 14 | * @date: 2020年5月8日 下午2:06:54 | 14 | * @date: 2020年5月8日 下午2:06:54 |
| 15 | */ | 15 | */ |
| 16 | +@Schema(description = "设备录像详情") | ||
| 16 | public class RecordItem implements Comparable<RecordItem>{ | 17 | public class RecordItem implements Comparable<RecordItem>{ |
| 17 | 18 | ||
| 19 | + @Schema(description = "设备编号") | ||
| 18 | private String deviceId; | 20 | private String deviceId; |
| 19 | - | 21 | + |
| 22 | + @Schema(description = "名称") | ||
| 20 | private String name; | 23 | private String name; |
| 21 | - | 24 | + |
| 25 | + @Schema(description = "文件路径名 (可选)") | ||
| 22 | private String filePath; | 26 | private String filePath; |
| 23 | 27 | ||
| 28 | + @Schema(description = "录像文件大小,单位:Byte(可选)") | ||
| 24 | private String fileSize; | 29 | private String fileSize; |
| 25 | 30 | ||
| 31 | + @Schema(description = "录像地址(可选)") | ||
| 26 | private String address; | 32 | private String address; |
| 27 | - | 33 | + |
| 34 | + @Schema(description = "录像开始时间(可选)") | ||
| 28 | private String startTime; | 35 | private String startTime; |
| 29 | - | 36 | + |
| 37 | + @Schema(description = "录像结束时间(可选)") | ||
| 30 | private String endTime; | 38 | private String endTime; |
| 31 | - | 39 | + |
| 40 | + @Schema(description = "保密属性(必选)缺省为0;0:不涉密,1:涉密") | ||
| 32 | private int secrecy; | 41 | private int secrecy; |
| 33 | - | 42 | + |
| 43 | + @Schema(description = "录像产生类型(可选)time或alarm 或 manua") | ||
| 34 | private String type; | 44 | private String type; |
| 35 | - | 45 | + |
| 46 | + @Schema(description = "录像触发者ID(可选)") | ||
| 36 | private String recorderId; | 47 | private String recorderId; |
| 37 | 48 | ||
| 38 | public String getDeviceId() { | 49 | public String getDeviceId() { |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
| @@ -1376,7 +1376,7 @@ public class SIPCommander implements ISIPCommander { | @@ -1376,7 +1376,7 @@ public class SIPCommander implements ISIPCommander { | ||
| 1376 | if (device == null) { | 1376 | if (device == null) { |
| 1377 | return; | 1377 | return; |
| 1378 | } | 1378 | } |
| 1379 | - logger.info("[发送 报警通知] {}/{}->{},{}", device.getDeviceId(), deviceAlarm.getChannelId(), | 1379 | + logger.info("[发送报警通知]设备: {}/{}->{},{}", device.getDeviceId(), deviceAlarm.getChannelId(), |
| 1380 | deviceAlarm.getLongitude(), deviceAlarm.getLatitude()); | 1380 | deviceAlarm.getLongitude(), deviceAlarm.getLatitude()); |
| 1381 | 1381 | ||
| 1382 | String characterSet = device.getCharset(); | 1382 | String characterSet = device.getCharset(); |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java
| @@ -402,7 +402,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | @@ -402,7 +402,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | ||
| 402 | if (parentPlatform == null) { | 402 | if (parentPlatform == null) { |
| 403 | return; | 403 | return; |
| 404 | } | 404 | } |
| 405 | - logger.info("[发送报警通知] {}/{}->{},{}: {}", parentPlatform.getServerGBId(), deviceAlarm.getChannelId(), | 405 | + logger.info("[发送报警通知]平台: {}/{}->{},{}: {}", parentPlatform.getServerGBId(), deviceAlarm.getChannelId(), |
| 406 | deviceAlarm.getLongitude(), deviceAlarm.getLatitude(), JSON.toJSONString(deviceAlarm)); | 406 | deviceAlarm.getLongitude(), deviceAlarm.getLatitude(), JSON.toJSONString(deviceAlarm)); |
| 407 | String characterSet = parentPlatform.getCharacterSet(); | 407 | String characterSet = parentPlatform.getCharacterSet(); |
| 408 | StringBuffer deviceStatusXml = new StringBuffer(600); | 408 | StringBuffer deviceStatusXml = new StringBuffer(600); |
src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisAlarmMsgListener.java
| 1 | package com.genersoft.iot.vmp.service.redisMsg; | 1 | package com.genersoft.iot.vmp.service.redisMsg; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson2.JSON; | 3 | import com.alibaba.fastjson2.JSON; |
| 4 | +import com.genersoft.iot.vmp.conf.UserSetting; | ||
| 4 | import com.genersoft.iot.vmp.gb28181.bean.*; | 5 | import com.genersoft.iot.vmp.gb28181.bean.*; |
| 5 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander; | 6 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander; |
| 6 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; | 7 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; |
| @@ -44,8 +45,12 @@ public class RedisAlarmMsgListener implements MessageListener { | @@ -44,8 +45,12 @@ public class RedisAlarmMsgListener implements MessageListener { | ||
| 44 | @Autowired | 45 | @Autowired |
| 45 | private ThreadPoolTaskExecutor taskExecutor; | 46 | private ThreadPoolTaskExecutor taskExecutor; |
| 46 | 47 | ||
| 48 | + @Autowired | ||
| 49 | + private UserSetting userSetting; | ||
| 50 | + | ||
| 47 | @Override | 51 | @Override |
| 48 | public void onMessage(@NotNull Message message, byte[] bytes) { | 52 | public void onMessage(@NotNull Message message, byte[] bytes) { |
| 53 | + // 消息示例: PUBLISH alarm_receive '{ "gbId": "", "alarmSn": 1, "alarmType": "111", "alarmDescription": "222", }' | ||
| 49 | logger.info("收到来自REDIS的ALARM通知: {}", new String(message.getBody())); | 54 | logger.info("收到来自REDIS的ALARM通知: {}", new String(message.getBody())); |
| 50 | boolean isEmpty = taskQueue.isEmpty(); | 55 | boolean isEmpty = taskQueue.isEmpty(); |
| 51 | taskQueue.offer(message); | 56 | taskQueue.offer(message); |
| @@ -74,17 +79,44 @@ public class RedisAlarmMsgListener implements MessageListener { | @@ -74,17 +79,44 @@ public class RedisAlarmMsgListener implements MessageListener { | ||
| 74 | deviceAlarm.setLatitude(0); | 79 | deviceAlarm.setLatitude(0); |
| 75 | 80 | ||
| 76 | if (ObjectUtils.isEmpty(gbId)) { | 81 | if (ObjectUtils.isEmpty(gbId)) { |
| 77 | - // 发送给所有的上级 | ||
| 78 | - List<ParentPlatform> parentPlatforms = storage.queryEnableParentPlatformList(true); | ||
| 79 | - if (parentPlatforms.size() > 0) { | ||
| 80 | - for (ParentPlatform parentPlatform : parentPlatforms) { | 82 | + if (userSetting.getSendToPlatformsWhenIdLost()) { |
| 83 | + // 发送给所有的上级 | ||
| 84 | + List<ParentPlatform> parentPlatforms = storage.queryEnableParentPlatformList(true); | ||
| 85 | + if (parentPlatforms.size() > 0) { | ||
| 86 | + for (ParentPlatform parentPlatform : parentPlatforms) { | ||
| 87 | + try { | ||
| 88 | + commanderForPlatform.sendAlarmMessage(parentPlatform, deviceAlarm); | ||
| 89 | + } catch (SipException | InvalidArgumentException | ParseException e) { | ||
| 90 | + logger.error("[命令发送失败] 国标级联 发送报警: {}", e.getMessage()); | ||
| 91 | + } | ||
| 92 | + } | ||
| 93 | + } | ||
| 94 | + }else { | ||
| 95 | + // 获取开启了消息推送的设备和平台 | ||
| 96 | + List<ParentPlatform> parentPlatforms = storage.queryEnablePlatformListWithAsMessageChannel(); | ||
| 97 | + if (parentPlatforms.size() > 0) { | ||
| 98 | + for (ParentPlatform parentPlatform : parentPlatforms) { | ||
| 99 | + try { | ||
| 100 | + commanderForPlatform.sendAlarmMessage(parentPlatform, deviceAlarm); | ||
| 101 | + } catch (SipException | InvalidArgumentException | ParseException e) { | ||
| 102 | + logger.error("[命令发送失败] 国标级联 发送报警: {}", e.getMessage()); | ||
| 103 | + } | ||
| 104 | + } | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + } | ||
| 108 | + // 获取开启了消息推送的设备和平台 | ||
| 109 | + List<Device> devices = storage.queryDeviceWithAsMessageChannel(); | ||
| 110 | + if (devices.size() > 0) { | ||
| 111 | + for (Device device : devices) { | ||
| 81 | try { | 112 | try { |
| 82 | - commanderForPlatform.sendAlarmMessage(parentPlatform, deviceAlarm); | ||
| 83 | - } catch (SipException | InvalidArgumentException | ParseException e) { | ||
| 84 | - logger.error("[命令发送失败] 国标级联 发送报警: {}", e.getMessage()); | 113 | + commander.sendAlarmMessage(device, deviceAlarm); |
| 114 | + } catch (InvalidArgumentException | SipException | ParseException e) { | ||
| 115 | + logger.error("[命令发送失败] 发送报警: {}", e.getMessage()); | ||
| 85 | } | 116 | } |
| 86 | } | 117 | } |
| 87 | } | 118 | } |
| 119 | + | ||
| 88 | }else { | 120 | }else { |
| 89 | Device device = storage.queryVideoDevice(gbId); | 121 | Device device = storage.queryVideoDevice(gbId); |
| 90 | ParentPlatform platform = storage.queryParentPlatByServerGBId(gbId); | 122 | ParentPlatform platform = storage.queryParentPlatByServerGBId(gbId); |
src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorage.java
| @@ -378,4 +378,7 @@ public interface IVideoManagerStorage { | @@ -378,4 +378,7 @@ public interface IVideoManagerStorage { | ||
| 378 | 378 | ||
| 379 | List<DeviceChannelExtend> queryChannelsByDeviceId(String serial, List<String> channelIds, Boolean online); | 379 | List<DeviceChannelExtend> queryChannelsByDeviceId(String serial, List<String> channelIds, Boolean online); |
| 380 | 380 | ||
| 381 | + List<ParentPlatform> queryEnablePlatformListWithAsMessageChannel(); | ||
| 382 | + | ||
| 383 | + List<Device> queryDeviceWithAsMessageChannel(); | ||
| 381 | } | 384 | } |
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java
| @@ -39,6 +39,7 @@ public interface DeviceMapper { | @@ -39,6 +39,7 @@ public interface DeviceMapper { | ||
| 39 | "mobilePositionSubmissionInterval," + | 39 | "mobilePositionSubmissionInterval," + |
| 40 | "subscribeCycleForAlarm," + | 40 | "subscribeCycleForAlarm," + |
| 41 | "ssrcCheck," + | 41 | "ssrcCheck," + |
| 42 | + "asMessageChannel," + | ||
| 42 | "geoCoordSys," + | 43 | "geoCoordSys," + |
| 43 | "treeType," + | 44 | "treeType," + |
| 44 | "online" + | 45 | "online" + |
| @@ -70,6 +71,7 @@ public interface DeviceMapper { | @@ -70,6 +71,7 @@ public interface DeviceMapper { | ||
| 70 | "mobilePositionSubmissionInterval," + | 71 | "mobilePositionSubmissionInterval," + |
| 71 | "subscribeCycleForAlarm," + | 72 | "subscribeCycleForAlarm," + |
| 72 | "ssrcCheck," + | 73 | "ssrcCheck," + |
| 74 | + "asMessageChannel," + | ||
| 73 | "geoCoordSys," + | 75 | "geoCoordSys," + |
| 74 | "treeType," + | 76 | "treeType," + |
| 75 | "online" + | 77 | "online" + |
| @@ -98,6 +100,7 @@ public interface DeviceMapper { | @@ -98,6 +100,7 @@ public interface DeviceMapper { | ||
| 98 | "#{mobilePositionSubmissionInterval}," + | 100 | "#{mobilePositionSubmissionInterval}," + |
| 99 | "#{subscribeCycleForAlarm}," + | 101 | "#{subscribeCycleForAlarm}," + |
| 100 | "#{ssrcCheck}," + | 102 | "#{ssrcCheck}," + |
| 103 | + "#{asMessageChannel}," + | ||
| 101 | "#{geoCoordSys}," + | 104 | "#{geoCoordSys}," + |
| 102 | "#{treeType}," + | 105 | "#{treeType}," + |
| 103 | "#{online}" + | 106 | "#{online}" + |
| @@ -152,6 +155,7 @@ public interface DeviceMapper { | @@ -152,6 +155,7 @@ public interface DeviceMapper { | ||
| 152 | "mobilePositionSubmissionInterval," + | 155 | "mobilePositionSubmissionInterval," + |
| 153 | "subscribeCycleForAlarm," + | 156 | "subscribeCycleForAlarm," + |
| 154 | "ssrcCheck," + | 157 | "ssrcCheck," + |
| 158 | + "asMessageChannel," + | ||
| 155 | "geoCoordSys," + | 159 | "geoCoordSys," + |
| 156 | "treeType," + | 160 | "treeType," + |
| 157 | "online," + | 161 | "online," + |
| @@ -192,6 +196,7 @@ public interface DeviceMapper { | @@ -192,6 +196,7 @@ public interface DeviceMapper { | ||
| 192 | "mobilePositionSubmissionInterval," + | 196 | "mobilePositionSubmissionInterval," + |
| 193 | "subscribeCycleForAlarm," + | 197 | "subscribeCycleForAlarm," + |
| 194 | "ssrcCheck," + | 198 | "ssrcCheck," + |
| 199 | + "asMessageChannel," + | ||
| 195 | "geoCoordSys," + | 200 | "geoCoordSys," + |
| 196 | "treeType," + | 201 | "treeType," + |
| 197 | "online " + | 202 | "online " + |
| @@ -222,6 +227,7 @@ public interface DeviceMapper { | @@ -222,6 +227,7 @@ public interface DeviceMapper { | ||
| 222 | "mobilePositionSubmissionInterval," + | 227 | "mobilePositionSubmissionInterval," + |
| 223 | "subscribeCycleForAlarm," + | 228 | "subscribeCycleForAlarm," + |
| 224 | "ssrcCheck," + | 229 | "ssrcCheck," + |
| 230 | + "asMessageChannel," + | ||
| 225 | "geoCoordSys," + | 231 | "geoCoordSys," + |
| 226 | "treeType," + | 232 | "treeType," + |
| 227 | "online" + | 233 | "online" + |
| @@ -243,6 +249,7 @@ public interface DeviceMapper { | @@ -243,6 +249,7 @@ public interface DeviceMapper { | ||
| 243 | "<if test=\"mobilePositionSubmissionInterval != null\">, mobilePositionSubmissionInterval=#{mobilePositionSubmissionInterval}</if>" + | 249 | "<if test=\"mobilePositionSubmissionInterval != null\">, mobilePositionSubmissionInterval=#{mobilePositionSubmissionInterval}</if>" + |
| 244 | "<if test=\"subscribeCycleForAlarm != null\">, subscribeCycleForAlarm=#{subscribeCycleForAlarm}</if>" + | 250 | "<if test=\"subscribeCycleForAlarm != null\">, subscribeCycleForAlarm=#{subscribeCycleForAlarm}</if>" + |
| 245 | "<if test=\"ssrcCheck != null\">, ssrcCheck=#{ssrcCheck}</if>" + | 251 | "<if test=\"ssrcCheck != null\">, ssrcCheck=#{ssrcCheck}</if>" + |
| 252 | + "<if test=\"asMessageChannel != null\">, asMessageChannel=#{asMessageChannel}</if>" + | ||
| 246 | "<if test=\"geoCoordSys != null\">, geoCoordSys=#{geoCoordSys}</if>" + | 253 | "<if test=\"geoCoordSys != null\">, geoCoordSys=#{geoCoordSys}</if>" + |
| 247 | "<if test=\"treeType != null\">, treeType=#{treeType}</if>" + | 254 | "<if test=\"treeType != null\">, treeType=#{treeType}</if>" + |
| 248 | "<if test=\"mediaServerId != null\">, mediaServerId=#{mediaServerId}</if>" + | 255 | "<if test=\"mediaServerId != null\">, mediaServerId=#{mediaServerId}</if>" + |
| @@ -259,6 +266,7 @@ public interface DeviceMapper { | @@ -259,6 +266,7 @@ public interface DeviceMapper { | ||
| 259 | "updateTime," + | 266 | "updateTime," + |
| 260 | "charset," + | 267 | "charset," + |
| 261 | "ssrcCheck," + | 268 | "ssrcCheck," + |
| 269 | + "asMessageChannel," + | ||
| 262 | "geoCoordSys," + | 270 | "geoCoordSys," + |
| 263 | "treeType," + | 271 | "treeType," + |
| 264 | "online" + | 272 | "online" + |
| @@ -271,6 +279,7 @@ public interface DeviceMapper { | @@ -271,6 +279,7 @@ public interface DeviceMapper { | ||
| 271 | "#{updateTime}," + | 279 | "#{updateTime}," + |
| 272 | "#{charset}," + | 280 | "#{charset}," + |
| 273 | "#{ssrcCheck}," + | 281 | "#{ssrcCheck}," + |
| 282 | + "#{asMessageChannel}," + | ||
| 274 | "#{geoCoordSys}," + | 283 | "#{geoCoordSys}," + |
| 275 | "#{treeType}," + | 284 | "#{treeType}," + |
| 276 | "#{online}" + | 285 | "#{online}" + |
| @@ -282,4 +291,7 @@ public interface DeviceMapper { | @@ -282,4 +291,7 @@ public interface DeviceMapper { | ||
| 282 | 291 | ||
| 283 | @Select("select * from device") | 292 | @Select("select * from device") |
| 284 | List<Device> getAll(); | 293 | List<Device> getAll(); |
| 294 | + | ||
| 295 | + @Select("select * from device where asMessageChannel = 1") | ||
| 296 | + List<Device> queryDeviceWithAsMessageChannel(); | ||
| 285 | } | 297 | } |
src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java
| @@ -15,10 +15,10 @@ import java.util.List; | @@ -15,10 +15,10 @@ import java.util.List; | ||
| 15 | public interface ParentPlatformMapper { | 15 | public interface ParentPlatformMapper { |
| 16 | 16 | ||
| 17 | @Insert("INSERT INTO parent_platform (enable, name, serverGBId, serverGBDomain, serverIP, serverPort, deviceGBId, deviceIp, " + | 17 | @Insert("INSERT INTO parent_platform (enable, name, serverGBId, serverGBDomain, serverIP, serverPort, deviceGBId, deviceIp, " + |
| 18 | - " devicePort, username, password, expires, keepTimeout, transport, characterSet, ptz, rtcp, " + | 18 | + " devicePort, username, password, expires, keepTimeout, transport, characterSet, ptz, rtcp, asMessageChannel, " + |
| 19 | " status, startOfflinePush, catalogId, administrativeDivision, catalogGroup, createTime, updateTime, treeType) " + | 19 | " status, startOfflinePush, catalogId, administrativeDivision, catalogGroup, createTime, updateTime, treeType) " + |
| 20 | " VALUES (#{enable}, #{name}, #{serverGBId}, #{serverGBDomain}, #{serverIP}, #{serverPort}, #{deviceGBId}, #{deviceIp}, " + | 20 | " VALUES (#{enable}, #{name}, #{serverGBId}, #{serverGBDomain}, #{serverIP}, #{serverPort}, #{deviceGBId}, #{deviceIp}, " + |
| 21 | - " #{devicePort}, #{username}, #{password}, #{expires}, #{keepTimeout}, #{transport}, #{characterSet}, #{ptz}, #{rtcp}, " + | 21 | + " #{devicePort}, #{username}, #{password}, #{expires}, #{keepTimeout}, #{transport}, #{characterSet}, #{ptz}, #{rtcp}, #{asMessageChannel}, " + |
| 22 | " #{status}, #{startOfflinePush}, #{catalogId}, #{administrativeDivision}, #{catalogGroup}, #{createTime}, #{updateTime}, #{treeType})") | 22 | " #{status}, #{startOfflinePush}, #{catalogId}, #{administrativeDivision}, #{catalogGroup}, #{createTime}, #{updateTime}, #{treeType})") |
| 23 | int addParentPlatform(ParentPlatform parentPlatform); | 23 | int addParentPlatform(ParentPlatform parentPlatform); |
| 24 | 24 | ||
| @@ -40,6 +40,7 @@ public interface ParentPlatformMapper { | @@ -40,6 +40,7 @@ public interface ParentPlatformMapper { | ||
| 40 | "characterSet=#{characterSet}, " + | 40 | "characterSet=#{characterSet}, " + |
| 41 | "ptz=#{ptz}, " + | 41 | "ptz=#{ptz}, " + |
| 42 | "rtcp=#{rtcp}, " + | 42 | "rtcp=#{rtcp}, " + |
| 43 | + "asMessageChannel=#{asMessageChannel}, " + | ||
| 43 | "status=#{status}, " + | 44 | "status=#{status}, " + |
| 44 | "startOfflinePush=#{startOfflinePush}, " + | 45 | "startOfflinePush=#{startOfflinePush}, " + |
| 45 | "catalogGroup=#{catalogGroup}, " + | 46 | "catalogGroup=#{catalogGroup}, " + |
| @@ -68,9 +69,12 @@ public interface ParentPlatformMapper { | @@ -68,9 +69,12 @@ public interface ParentPlatformMapper { | ||
| 68 | "FROM parent_platform pp ") | 69 | "FROM parent_platform pp ") |
| 69 | List<ParentPlatform> getParentPlatformList(); | 70 | List<ParentPlatform> getParentPlatformList(); |
| 70 | 71 | ||
| 71 | - @Select("SELECT * FROM parent_platform WHERE enable=#{enable}") | 72 | + @Select("SELECT * FROM parent_platform WHERE enable=#{enable} ") |
| 72 | List<ParentPlatform> getEnableParentPlatformList(boolean enable); | 73 | List<ParentPlatform> getEnableParentPlatformList(boolean enable); |
| 73 | 74 | ||
| 75 | + @Select("SELECT * FROM parent_platform WHERE enable=1 and asMessageChannel = 1") | ||
| 76 | + List<ParentPlatform> queryEnablePlatformListWithAsMessageChannel(); | ||
| 77 | + | ||
| 74 | @Select("SELECT * FROM parent_platform WHERE serverGBId=#{platformGbId}") | 78 | @Select("SELECT * FROM parent_platform WHERE serverGBId=#{platformGbId}") |
| 75 | ParentPlatform getParentPlatByServerGBId(String platformGbId); | 79 | ParentPlatform getParentPlatByServerGBId(String platformGbId); |
| 76 | 80 |
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java
| @@ -525,6 +525,16 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { | @@ -525,6 +525,16 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { | ||
| 525 | } | 525 | } |
| 526 | 526 | ||
| 527 | @Override | 527 | @Override |
| 528 | + public List<ParentPlatform> queryEnablePlatformListWithAsMessageChannel() { | ||
| 529 | + return platformMapper.queryEnablePlatformListWithAsMessageChannel(); | ||
| 530 | + } | ||
| 531 | + | ||
| 532 | + @Override | ||
| 533 | + public List<Device> queryDeviceWithAsMessageChannel() { | ||
| 534 | + return deviceMapper.queryDeviceWithAsMessageChannel(); | ||
| 535 | + } | ||
| 536 | + | ||
| 537 | + @Override | ||
| 528 | public void outlineForAllParentPlatform() { | 538 | public void outlineForAllParentPlatform() { |
| 529 | platformMapper.outlineForAllParentPlatform(); | 539 | platformMapper.outlineForAllParentPlatform(); |
| 530 | } | 540 | } |
src/main/resources/all-application.yml
| @@ -199,8 +199,8 @@ user-settings: | @@ -199,8 +199,8 @@ user-settings: | ||
| 199 | sip-use-source-ip-as-remote-address: false | 199 | sip-use-source-ip-as-remote-address: false |
| 200 | # 是否开启sip日志 | 200 | # 是否开启sip日志 |
| 201 | sip-log: true | 201 | sip-log: true |
| 202 | - # 自动数据库升级,保证表结构完整 | ||
| 203 | - sync-db: true | 202 | + # 消息通道功能-缺少国标ID是否给所有上级发送消息 |
| 203 | + send-to-platforms-when-id-lost: true | ||
| 204 | 204 | ||
| 205 | # 关闭在线文档(生产环境建议关闭) | 205 | # 关闭在线文档(生产环境建议关闭) |
| 206 | springdoc: | 206 | springdoc: |
web_src/index.html
| @@ -15,5 +15,6 @@ | @@ -15,5 +15,6 @@ | ||
| 15 | <script type="text/javascript" src="./static/js/ZLMRTCClient.js"></script> | 15 | <script type="text/javascript" src="./static/js/ZLMRTCClient.js"></script> |
| 16 | <script type="text/javascript" src="./static/js/config.js"></script> | 16 | <script type="text/javascript" src="./static/js/config.js"></script> |
| 17 | <div id="app"></div> | 17 | <div id="app"></div> |
| 18 | + | ||
| 18 | </body> | 19 | </body> |
| 19 | </html> | 20 | </html> |
web_src/src/components/dialog/deviceEdit.vue
| @@ -66,6 +66,7 @@ | @@ -66,6 +66,7 @@ | ||
| 66 | </el-form-item> | 66 | </el-form-item> |
| 67 | <el-form-item label="其他选项"> | 67 | <el-form-item label="其他选项"> |
| 68 | <el-checkbox label="SSRC校验" v-model="form.ssrcCheck" style="float: left"></el-checkbox> | 68 | <el-checkbox label="SSRC校验" v-model="form.ssrcCheck" style="float: left"></el-checkbox> |
| 69 | + <el-checkbox label="作为消息通道" v-model="form.asMessageChannel" style="float: left"></el-checkbox> | ||
| 69 | </el-form-item> | 70 | </el-form-item> |
| 70 | <el-form-item> | 71 | <el-form-item> |
| 71 | <div style="float: right;"> | 72 | <div style="float: right;"> |
web_src/src/components/dialog/platformEdit.vue
| @@ -96,9 +96,10 @@ | @@ -96,9 +96,10 @@ | ||
| 96 | </el-form-item> | 96 | </el-form-item> |
| 97 | <el-form-item label="其他选项"> | 97 | <el-form-item label="其他选项"> |
| 98 | <el-checkbox label="启用" v-model="platform.enable" @change="checkExpires"></el-checkbox> | 98 | <el-checkbox label="启用" v-model="platform.enable" @change="checkExpires"></el-checkbox> |
| 99 | - <el-checkbox label="云台控制" v-model="platform.ptz"></el-checkbox> | 99 | +<!-- <el-checkbox label="云台控制" v-model="platform.ptz"></el-checkbox>--> |
| 100 | <el-checkbox label="拉起离线推流" v-model="platform.startOfflinePush"></el-checkbox> | 100 | <el-checkbox label="拉起离线推流" v-model="platform.startOfflinePush"></el-checkbox> |
| 101 | <el-checkbox label="RTCP保活" v-model="platform.rtcp" @change="rtcpCheckBoxChange"></el-checkbox> | 101 | <el-checkbox label="RTCP保活" v-model="platform.rtcp" @change="rtcpCheckBoxChange"></el-checkbox> |
| 102 | + <el-checkbox label="作为消息通道" v-model="platform.asMessageChannel" ></el-checkbox> | ||
| 102 | </el-form-item> | 103 | </el-form-item> |
| 103 | <el-form-item> | 104 | <el-form-item> |
| 104 | <el-button type="primary" @click="onSubmit">{{ | 105 | <el-button type="primary" @click="onSubmit">{{ |
| @@ -145,6 +146,7 @@ export default { | @@ -145,6 +146,7 @@ export default { | ||
| 145 | enable: true, | 146 | enable: true, |
| 146 | ptz: true, | 147 | ptz: true, |
| 147 | rtcp: false, | 148 | rtcp: false, |
| 149 | + asMessageChannel: false, | ||
| 148 | name: null, | 150 | name: null, |
| 149 | serverGBId: null, | 151 | serverGBId: null, |
| 150 | serverGBDomain: null, | 152 | serverGBDomain: null, |
| @@ -213,6 +215,7 @@ export default { | @@ -213,6 +215,7 @@ export default { | ||
| 213 | this.platform.enable = platform.enable; | 215 | this.platform.enable = platform.enable; |
| 214 | this.platform.ptz = platform.ptz; | 216 | this.platform.ptz = platform.ptz; |
| 215 | this.platform.rtcp = platform.rtcp; | 217 | this.platform.rtcp = platform.rtcp; |
| 218 | + this.platform.rtcpasMessageChannel = platform.asMessageChannel; | ||
| 216 | this.platform.name = platform.name; | 219 | this.platform.name = platform.name; |
| 217 | this.platform.serverGBId = platform.serverGBId; | 220 | this.platform.serverGBId = platform.serverGBId; |
| 218 | this.platform.serverGBDomain = platform.serverGBDomain; | 221 | this.platform.serverGBDomain = platform.serverGBDomain; |
| @@ -290,6 +293,7 @@ export default { | @@ -290,6 +293,7 @@ export default { | ||
| 290 | enable: true, | 293 | enable: true, |
| 291 | ptz: true, | 294 | ptz: true, |
| 292 | rtcp: false, | 295 | rtcp: false, |
| 296 | + asMessageChannel: false, | ||
| 293 | name: null, | 297 | name: null, |
| 294 | serverGBId: null, | 298 | serverGBId: null, |
| 295 | administrativeDivision: null, | 299 | administrativeDivision: null, |