648540858
2023-03-17 782300452cdc5ff9a8d02f0488fbb76d9d3fc92c
优化对海康平台的兼容性
4个文件已修改
27 ■■■■■ 已修改文件
src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/all-application.yml 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java
@@ -50,6 +50,8 @@
    private Boolean sipLog = Boolean.FALSE;
    private Boolean sendToPlatformsWhenIdLost = Boolean.FALSE;
    private Boolean refuseChannelStatusChannelFormNotify = Boolean.FALSE;
    private String serverId = "000000";
    private String thirdPartyGBIdReg = "[\\s\\S]*";
@@ -237,4 +239,14 @@
    public void setSendToPlatformsWhenIdLost(Boolean sendToPlatformsWhenIdLost) {
        this.sendToPlatformsWhenIdLost = sendToPlatformsWhenIdLost;
    }
    public Boolean getRefuseChannelStatusChannelFormNotify() {
        return refuseChannelStatusChannelFormNotify;
    }
    public void setRefuseChannelStatusChannelFormNotify(Boolean refuseChannelStatusChannelFormNotify) {
        this.refuseChannelStatusChannelFormNotify = refuseChannelStatusChannelFormNotify;
    }
}
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java
@@ -393,12 +393,20 @@
                        case CatalogEvent.OFF :
                            // 离线
                            logger.info("[收到通道离线通知] 来自设备: {}, 通道 {}", device.getDeviceId(), channel.getChannelId());
                            storager.deviceChannelOffline(deviceId, channel.getChannelId());
                            if (userSetting.getRefuseChannelStatusChannelFormNotify()) {
                                storager.deviceChannelOffline(deviceId, channel.getChannelId());
                            }else {
                                logger.info("[收到通道离线通知] 但是平台已配置拒绝此消息,来自设备: {}, 通道 {}", device.getDeviceId(), channel.getChannelId());
                            }
                            break;
                        case CatalogEvent.VLOST:
                            // 视频丢失
                            logger.info("[收到通道视频丢失通知] 来自设备: {}, 通道 {}", device.getDeviceId(), channel.getChannelId());
                            storager.deviceChannelOffline(deviceId, channel.getChannelId());
                            if (userSetting.getRefuseChannelStatusChannelFormNotify()) {
                                storager.deviceChannelOffline(deviceId, channel.getChannelId());
                            }else {
                                logger.info("[收到通道视频丢失通知] 但是平台已配置拒绝此消息,来自设备: {}, 通道 {}", device.getDeviceId(), channel.getChannelId());
                            }
                            break;
                        case CatalogEvent.DEFECT:
                            // 故障
src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
@@ -857,6 +857,7 @@
    @Override
    public void sendAlarmMsg(AlarmChannelMessage msg) {
        // 此消息用于对接第三方服务下级来的消息内容
        String key = VideoManagerConstants.VM_MSG_SUBSCRIBE_ALARM;
        logger.info("[redis发送通知] 报警{}: {}", key, JSON.toJSON(msg));
        RedisUtil.convertAndSend(key, (JSONObject)JSON.toJSON(msg));
src/main/resources/all-application.yml
@@ -201,6 +201,8 @@
    sip-log: true
    # 消息通道功能-缺少国标ID是否给所有上级发送消息
    send-to-platforms-when-id-lost: true
    # 保持通道状态,不接受notify通道状态变化, 兼容海康平台发送错误消息
    refuse-channel-status-channel-form-notify: false
    # 跨域配置,配置你访问前端页面的地址即可, 可以配置多个
    allowed-origins:
        - http://localhost:8008