增加消息通道配置,可以通道redis在wvp上下级之间发送消息
16个文件已修改
1个文件已添加
1 文件已重命名
New file |
| | |
| | | alter table device |
| | | add asMessageChannel int default 0; |
| | | |
| | | alter table parent_platform |
| | | add asMessageChannel int default 0; |
| | | |
File was renamed from src/main/resources/db/migration/V2.6.7_20230201__³õʼ»¯.sql |
| | |
| | | `mobilePositionSubmissionInterval` int DEFAULT '5', |
| | | `subscribeCycleForAlarm` int DEFAULT NULL, |
| | | `ssrcCheck` int DEFAULT '0', |
| | | `asMessageChannel` int DEFAULT '0', |
| | | `geoCoordSys` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `treeType` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `custom_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | |
| | | `catalogId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `ptz` int DEFAULT NULL, |
| | | `rtcp` int DEFAULT NULL, |
| | | `asMessageChannel` int DEFAULT '0', |
| | | `status` bit(1) DEFAULT NULL, |
| | | `startOfflinePush` int DEFAULT '0', |
| | | `administrativeDivision` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | |
| | | private Boolean syncChannelOnDeviceOnline = Boolean.FALSE; |
| | | |
| | | private Boolean sipLog = Boolean.FALSE; |
| | | private Boolean sendToPlatformsWhenIdLost = Boolean.FALSE; |
| | | |
| | | private String serverId = "000000"; |
| | | |
| | |
| | | public void setSipLog(Boolean sipLog) { |
| | | this.sipLog = sipLog; |
| | | } |
| | | |
| | | public Boolean getSendToPlatformsWhenIdLost() { |
| | | return sendToPlatformsWhenIdLost; |
| | | } |
| | | |
| | | public void setSendToPlatformsWhenIdLost(Boolean sendToPlatformsWhenIdLost) { |
| | | this.sendToPlatformsWhenIdLost = sendToPlatformsWhenIdLost; |
| | | } |
| | | } |
| | |
| | | @Schema(description = "SIP交äºIPï¼è®¾å¤è®¿é®å¹³å°çIPï¼") |
| | | private String localIp; |
| | | |
| | | @Schema(description = "æ¯å¦ä½ä¸ºæ¶æ¯éé") |
| | | private boolean asMessageChannel; |
| | | |
| | | |
| | | public String getDeviceId() { |
| | | return deviceId; |
| | |
| | | public void setKeepaliveIntervalTime(int keepaliveIntervalTime) { |
| | | this.keepaliveIntervalTime = keepaliveIntervalTime; |
| | | } |
| | | |
| | | public boolean isAsMessageChannel() { |
| | | return asMessageChannel; |
| | | } |
| | | |
| | | public void setAsMessageChannel(boolean asMessageChannel) { |
| | | this.asMessageChannel = asMessageChannel; |
| | | } |
| | | } |
| | |
| | | @Schema(description = "æ ç±»å 彿 è§å®äºä¸¤ç§æ çå±ç°æ¹å¼ è¡æ¿åºå CivilCode åä¸å¡åç»:BusinessGrou") |
| | | private String treeType; |
| | | |
| | | @Schema(description = "æ¯å¦ä½ä¸ºæ¶æ¯éé") |
| | | private boolean asMessageChannel; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | |
| | | public void setTreeType(String treeType) { |
| | | this.treeType = treeType; |
| | | } |
| | | |
| | | public boolean isAsMessageChannel() { |
| | | return asMessageChannel; |
| | | } |
| | | |
| | | public void setAsMessageChannel(boolean asMessageChannel) { |
| | | this.asMessageChannel = asMessageChannel; |
| | | } |
| | | } |
| | |
| | | package com.genersoft.iot.vmp.gb28181.bean;
|
| | |
|
| | |
|
| | | import io.swagger.v3.oas.annotations.media.Schema;
|
| | |
|
| | | import java.time.Instant;
|
| | | import java.util.List;
|
| | |
|
| | |
| | | * @author: swwheihei
|
| | | * @date: 2020å¹´5æ8æ¥ ä¸å2:05:56
|
| | | */
|
| | | @Schema(description = "设å¤å½åæ¥è¯¢ç»æä¿¡æ¯")
|
| | | public class RecordInfo {
|
| | |
|
| | | @Schema(description = "设å¤ç¼å·")
|
| | | private String deviceId;
|
| | |
|
| | | @Schema(description = "ééç¼å·")
|
| | | private String channelId;
|
| | |
|
| | | @Schema(description = "å½ä»¤åºåå·")
|
| | | private String sn;
|
| | |
|
| | | @Schema(description = "设å¤åç§°")
|
| | | private String name;
|
| | | |
| | |
|
| | | @Schema(description = "åè¡¨æ»æ°")
|
| | | private int sumNum;
|
| | |
|
| | | private int count;
|
| | |
|
| | | private Instant lastTime;
|
| | | |
| | |
|
| | | @Schema(description = "")
|
| | | private List<RecordItem> recordList;
|
| | |
|
| | | public String getDeviceId() {
|
| | |
| | |
|
| | |
|
| | | import com.genersoft.iot.vmp.utils.DateUtil;
|
| | | import io.swagger.v3.oas.annotations.media.Schema;
|
| | | import org.jetbrains.annotations.NotNull;
|
| | |
|
| | | import java.text.ParseException;
|
| | | import java.time.Instant;
|
| | | import java.time.temporal.TemporalAccessor;
|
| | |
|
| | |
| | | * @author: swwheihei
|
| | | * @date: 2020å¹´5æ8æ¥ ä¸å2:06:54
|
| | | */
|
| | | @Schema(description = "设å¤å½å详æ
")
|
| | | public class RecordItem implements Comparable<RecordItem>{
|
| | |
|
| | | @Schema(description = "设å¤ç¼å·")
|
| | | private String deviceId;
|
| | | |
| | |
|
| | | @Schema(description = "åç§°")
|
| | | private String name;
|
| | | |
| | |
|
| | | @Schema(description = "æä»¶è·¯å¾å (å¯é)")
|
| | | private String filePath;
|
| | |
|
| | | @Schema(description = "å½åæä»¶å¤§å°,åä½:Byte(å¯é)")
|
| | | private String fileSize;
|
| | |
|
| | | @Schema(description = "å½åå°å(å¯é)")
|
| | | private String address;
|
| | | |
| | |
|
| | | @Schema(description = "å½åå¼å§æ¶é´(å¯é)")
|
| | | private String startTime;
|
| | | |
| | |
|
| | | @Schema(description = "å½åç»ææ¶é´(å¯é)")
|
| | | private String endTime;
|
| | | |
| | |
|
| | | @Schema(description = "ä¿å¯å±æ§(å¿
é)缺ç为0;0:䏿¶å¯,1:æ¶å¯")
|
| | | private int secrecy;
|
| | | |
| | |
|
| | | @Schema(description = "å½å产çç±»å(å¯é)timeæalarm æ manua")
|
| | | private String type;
|
| | | |
| | |
|
| | | @Schema(description = "å½å触åè
ID(å¯é)")
|
| | | private String recorderId;
|
| | |
|
| | | public String getDeviceId() {
|
| | |
| | | if (device == null) {
|
| | | return;
|
| | | }
|
| | | logger.info("[åé æ¥è¦éç¥] {}/{}->{},{}", device.getDeviceId(), deviceAlarm.getChannelId(),
|
| | | logger.info("[å鿥è¦éç¥]设å¤ï¼ {}/{}->{},{}", device.getDeviceId(), deviceAlarm.getChannelId(),
|
| | | deviceAlarm.getLongitude(), deviceAlarm.getLatitude());
|
| | |
|
| | | String characterSet = device.getCharset();
|
| | |
| | | if (parentPlatform == null) { |
| | | return; |
| | | } |
| | | logger.info("[å鿥è¦éç¥] {}/{}->{},{}: {}", parentPlatform.getServerGBId(), deviceAlarm.getChannelId(), |
| | | logger.info("[å鿥è¦éç¥]å¹³å°ï¼ {}/{}->{},{}: {}", parentPlatform.getServerGBId(), deviceAlarm.getChannelId(), |
| | | deviceAlarm.getLongitude(), deviceAlarm.getLatitude(), JSON.toJSONString(deviceAlarm)); |
| | | String characterSet = parentPlatform.getCharacterSet(); |
| | | StringBuffer deviceStatusXml = new StringBuffer(600); |
| | |
| | | package com.genersoft.iot.vmp.service.redisMsg; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.genersoft.iot.vmp.conf.UserSetting; |
| | | import com.genersoft.iot.vmp.gb28181.bean.*; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; |
| | |
| | | @Autowired |
| | | private ThreadPoolTaskExecutor taskExecutor; |
| | | |
| | | @Autowired |
| | | private UserSetting userSetting; |
| | | |
| | | @Override |
| | | public void onMessage(@NotNull Message message, byte[] bytes) { |
| | | // æ¶æ¯ç¤ºä¾ï¼ PUBLISH alarm_receive '{ "gbId": "", "alarmSn": 1, "alarmType": "111", "alarmDescription": "222", }' |
| | | logger.info("æ¶å°æ¥èªREDISçALARMéç¥ï¼ {}", new String(message.getBody())); |
| | | boolean isEmpty = taskQueue.isEmpty(); |
| | | taskQueue.offer(message); |
| | |
| | | deviceAlarm.setLatitude(0); |
| | | |
| | | if (ObjectUtils.isEmpty(gbId)) { |
| | | // åéç»ææçä¸çº§ |
| | | List<ParentPlatform> parentPlatforms = storage.queryEnableParentPlatformList(true); |
| | | if (parentPlatforms.size() > 0) { |
| | | for (ParentPlatform parentPlatform : parentPlatforms) { |
| | | if (userSetting.getSendToPlatformsWhenIdLost()) { |
| | | // åéç»ææçä¸çº§ |
| | | List<ParentPlatform> parentPlatforms = storage.queryEnableParentPlatformList(true); |
| | | if (parentPlatforms.size() > 0) { |
| | | for (ParentPlatform parentPlatform : parentPlatforms) { |
| | | try { |
| | | commanderForPlatform.sendAlarmMessage(parentPlatform, deviceAlarm); |
| | | } catch (SipException | InvalidArgumentException | ParseException e) { |
| | | logger.error("[å½ä»¤åé失败] 彿 级è å鿥è¦: {}", e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | | }else { |
| | | // è·åå¼å¯äºæ¶æ¯æ¨éç设å¤åå¹³å° |
| | | List<ParentPlatform> parentPlatforms = storage.queryEnablePlatformListWithAsMessageChannel(); |
| | | if (parentPlatforms.size() > 0) { |
| | | for (ParentPlatform parentPlatform : parentPlatforms) { |
| | | try { |
| | | commanderForPlatform.sendAlarmMessage(parentPlatform, deviceAlarm); |
| | | } catch (SipException | InvalidArgumentException | ParseException e) { |
| | | logger.error("[å½ä»¤åé失败] 彿 级è å鿥è¦: {}", e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | // è·åå¼å¯äºæ¶æ¯æ¨éç设å¤åå¹³å° |
| | | List<Device> devices = storage.queryDeviceWithAsMessageChannel(); |
| | | if (devices.size() > 0) { |
| | | for (Device device : devices) { |
| | | try { |
| | | commanderForPlatform.sendAlarmMessage(parentPlatform, deviceAlarm); |
| | | } catch (SipException | InvalidArgumentException | ParseException e) { |
| | | logger.error("[å½ä»¤åé失败] 彿 级è å鿥è¦: {}", e.getMessage()); |
| | | commander.sendAlarmMessage(device, deviceAlarm); |
| | | } catch (InvalidArgumentException | SipException | ParseException e) { |
| | | logger.error("[å½ä»¤åé失败] å鿥è¦: {}", e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | }else { |
| | | Device device = storage.queryVideoDevice(gbId); |
| | | ParentPlatform platform = storage.queryParentPlatByServerGBId(gbId); |
| | |
| | | |
| | | List<DeviceChannelExtend> queryChannelsByDeviceId(String serial, List<String> channelIds, Boolean online); |
| | | |
| | | List<ParentPlatform> queryEnablePlatformListWithAsMessageChannel(); |
| | | |
| | | List<Device> queryDeviceWithAsMessageChannel(); |
| | | } |
| | |
| | | "mobilePositionSubmissionInterval," + |
| | | "subscribeCycleForAlarm," + |
| | | "ssrcCheck," + |
| | | "asMessageChannel," + |
| | | "geoCoordSys," + |
| | | "treeType," + |
| | | "online" + |
| | |
| | | "mobilePositionSubmissionInterval," + |
| | | "subscribeCycleForAlarm," + |
| | | "ssrcCheck," + |
| | | "asMessageChannel," + |
| | | "geoCoordSys," + |
| | | "treeType," + |
| | | "online" + |
| | |
| | | "#{mobilePositionSubmissionInterval}," + |
| | | "#{subscribeCycleForAlarm}," + |
| | | "#{ssrcCheck}," + |
| | | "#{asMessageChannel}," + |
| | | "#{geoCoordSys}," + |
| | | "#{treeType}," + |
| | | "#{online}" + |
| | |
| | | "mobilePositionSubmissionInterval," + |
| | | "subscribeCycleForAlarm," + |
| | | "ssrcCheck," + |
| | | "asMessageChannel," + |
| | | "geoCoordSys," + |
| | | "treeType," + |
| | | "online," + |
| | |
| | | "mobilePositionSubmissionInterval," + |
| | | "subscribeCycleForAlarm," + |
| | | "ssrcCheck," + |
| | | "asMessageChannel," + |
| | | "geoCoordSys," + |
| | | "treeType," + |
| | | "online " + |
| | |
| | | "mobilePositionSubmissionInterval," + |
| | | "subscribeCycleForAlarm," + |
| | | "ssrcCheck," + |
| | | "asMessageChannel," + |
| | | "geoCoordSys," + |
| | | "treeType," + |
| | | "online" + |
| | |
| | | "<if test=\"mobilePositionSubmissionInterval != null\">, mobilePositionSubmissionInterval=#{mobilePositionSubmissionInterval}</if>" + |
| | | "<if test=\"subscribeCycleForAlarm != null\">, subscribeCycleForAlarm=#{subscribeCycleForAlarm}</if>" + |
| | | "<if test=\"ssrcCheck != null\">, ssrcCheck=#{ssrcCheck}</if>" + |
| | | "<if test=\"asMessageChannel != null\">, asMessageChannel=#{asMessageChannel}</if>" + |
| | | "<if test=\"geoCoordSys != null\">, geoCoordSys=#{geoCoordSys}</if>" + |
| | | "<if test=\"treeType != null\">, treeType=#{treeType}</if>" + |
| | | "<if test=\"mediaServerId != null\">, mediaServerId=#{mediaServerId}</if>" + |
| | |
| | | "updateTime," + |
| | | "charset," + |
| | | "ssrcCheck," + |
| | | "asMessageChannel," + |
| | | "geoCoordSys," + |
| | | "treeType," + |
| | | "online" + |
| | |
| | | "#{updateTime}," + |
| | | "#{charset}," + |
| | | "#{ssrcCheck}," + |
| | | "#{asMessageChannel}," + |
| | | "#{geoCoordSys}," + |
| | | "#{treeType}," + |
| | | "#{online}" + |
| | |
| | | |
| | | @Select("select * from device") |
| | | List<Device> getAll(); |
| | | |
| | | @Select("select * from device where asMessageChannel = 1") |
| | | List<Device> queryDeviceWithAsMessageChannel(); |
| | | } |
| | |
| | | public interface ParentPlatformMapper { |
| | | |
| | | @Insert("INSERT INTO parent_platform (enable, name, serverGBId, serverGBDomain, serverIP, serverPort, deviceGBId, deviceIp, " + |
| | | " devicePort, username, password, expires, keepTimeout, transport, characterSet, ptz, rtcp, " + |
| | | " devicePort, username, password, expires, keepTimeout, transport, characterSet, ptz, rtcp, asMessageChannel, " + |
| | | " status, startOfflinePush, catalogId, administrativeDivision, catalogGroup, createTime, updateTime, treeType) " + |
| | | " VALUES (#{enable}, #{name}, #{serverGBId}, #{serverGBDomain}, #{serverIP}, #{serverPort}, #{deviceGBId}, #{deviceIp}, " + |
| | | " #{devicePort}, #{username}, #{password}, #{expires}, #{keepTimeout}, #{transport}, #{characterSet}, #{ptz}, #{rtcp}, " + |
| | | " #{devicePort}, #{username}, #{password}, #{expires}, #{keepTimeout}, #{transport}, #{characterSet}, #{ptz}, #{rtcp}, #{asMessageChannel}, " + |
| | | " #{status}, #{startOfflinePush}, #{catalogId}, #{administrativeDivision}, #{catalogGroup}, #{createTime}, #{updateTime}, #{treeType})") |
| | | int addParentPlatform(ParentPlatform parentPlatform); |
| | | |
| | |
| | | "characterSet=#{characterSet}, " + |
| | | "ptz=#{ptz}, " + |
| | | "rtcp=#{rtcp}, " + |
| | | "asMessageChannel=#{asMessageChannel}, " + |
| | | "status=#{status}, " + |
| | | "startOfflinePush=#{startOfflinePush}, " + |
| | | "catalogGroup=#{catalogGroup}, " + |
| | |
| | | "FROM parent_platform pp ") |
| | | List<ParentPlatform> getParentPlatformList(); |
| | | |
| | | @Select("SELECT * FROM parent_platform WHERE enable=#{enable}") |
| | | @Select("SELECT * FROM parent_platform WHERE enable=#{enable} ") |
| | | List<ParentPlatform> getEnableParentPlatformList(boolean enable); |
| | | |
| | | @Select("SELECT * FROM parent_platform WHERE enable=1 and asMessageChannel = 1") |
| | | List<ParentPlatform> queryEnablePlatformListWithAsMessageChannel(); |
| | | |
| | | @Select("SELECT * FROM parent_platform WHERE serverGBId=#{platformGbId}") |
| | | ParentPlatform getParentPlatByServerGBId(String platformGbId); |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<ParentPlatform> queryEnablePlatformListWithAsMessageChannel() { |
| | | return platformMapper.queryEnablePlatformListWithAsMessageChannel(); |
| | | } |
| | | |
| | | @Override |
| | | public List<Device> queryDeviceWithAsMessageChannel() { |
| | | return deviceMapper.queryDeviceWithAsMessageChannel(); |
| | | } |
| | | |
| | | @Override |
| | | public void outlineForAllParentPlatform() { |
| | | platformMapper.outlineForAllParentPlatform(); |
| | | } |
| | |
| | | sip-use-source-ip-as-remote-address: false |
| | | # æ¯å¦å¼å¯sipæ¥å¿ |
| | | sip-log: true |
| | | # èªå¨æ°æ®åºå级ï¼ä¿è¯è¡¨ç»æå®æ´ |
| | | sync-db: true |
| | | # æ¶æ¯ééåè½-缺å°å½æ IDæ¯å¦ç»ææä¸çº§åéæ¶æ¯ |
| | | send-to-platforms-when-id-lost: true |
| | | |
| | | # å
³éå¨çº¿ææ¡£ï¼ç产ç¯å¢å»ºè®®å
³éï¼ |
| | | springdoc: |
| | |
| | | <script type="text/javascript" src="./static/js/ZLMRTCClient.js"></script> |
| | | <script type="text/javascript" src="./static/js/config.js"></script> |
| | | <div id="app"></div> |
| | | |
| | | </body> |
| | | </html> |
| | |
| | | </el-form-item> |
| | | <el-form-item label="å
¶ä»é项"> |
| | | <el-checkbox label="SSRCæ ¡éª" v-model="form.ssrcCheck" style="float: left"></el-checkbox> |
| | | <el-checkbox label="ä½ä¸ºæ¶æ¯éé" v-model="form.asMessageChannel" style="float: left"></el-checkbox> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <div style="float: right;"> |
| | |
| | | </el-form-item> |
| | | <el-form-item label="å
¶ä»é项"> |
| | | <el-checkbox label="å¯ç¨" v-model="platform.enable" @change="checkExpires"></el-checkbox> |
| | | <el-checkbox label="äºå°æ§å¶" v-model="platform.ptz"></el-checkbox> |
| | | <!-- <el-checkbox label="äºå°æ§å¶" v-model="platform.ptz"></el-checkbox>--> |
| | | <el-checkbox label="æèµ·ç¦»çº¿æ¨æµ" v-model="platform.startOfflinePush"></el-checkbox> |
| | | <el-checkbox label="RTCPä¿æ´»" v-model="platform.rtcp" @change="rtcpCheckBoxChange"></el-checkbox> |
| | | <el-checkbox label="ä½ä¸ºæ¶æ¯éé" v-model="platform.asMessageChannel" ></el-checkbox> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="onSubmit">{{ |
| | |
| | | enable: true, |
| | | ptz: true, |
| | | rtcp: false, |
| | | asMessageChannel: false, |
| | | name: null, |
| | | serverGBId: null, |
| | | serverGBDomain: null, |
| | |
| | | this.platform.enable = platform.enable; |
| | | this.platform.ptz = platform.ptz; |
| | | this.platform.rtcp = platform.rtcp; |
| | | this.platform.rtcpasMessageChannel = platform.asMessageChannel; |
| | | this.platform.name = platform.name; |
| | | this.platform.serverGBId = platform.serverGBId; |
| | | this.platform.serverGBDomain = platform.serverGBDomain; |
| | |
| | | enable: true, |
| | | ptz: true, |
| | | rtcp: false, |
| | | asMessageChannel: false, |
| | | name: null, |
| | | serverGBId: null, |
| | | administrativeDivision: null, |