Merge branch '648540858:wvp-28181-2.0' into wvp-28181-2.0
77个文件已修改
17个文件已添加
1 文件已重命名
| | |
| | | `treeType` varchar(50) COLLATE utf8mb4_general_ci NOT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | UNIQUE KEY `device_deviceId_uindex` (`deviceId`) USING BTREE |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=45 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | /*!40101 SET character_set_client = @saved_cs_client */; |
| | | |
| | | -- |
| | |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | UNIQUE KEY `device_channel_id_uindex` (`id`) USING BTREE, |
| | | UNIQUE KEY `device_channel_pk` (`channelId`,`deviceId`) USING BTREE |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=19324 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=19336 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | /*!40101 SET character_set_client = @saved_cs_client */; |
| | | |
| | | -- |
| | |
| | | `latitudeWgs84` double DEFAULT NULL, |
| | | `createTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=5649 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=6751 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | /*!40101 SET character_set_client = @saved_cs_client */; |
| | | |
| | | -- |
| | |
| | | `latitude` double DEFAULT NULL, |
| | | `streamType` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `mediaServerId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `status` int DEFAULT NULL, |
| | | `createTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `gpsTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | PRIMARY KEY (`gbStreamId`) USING BTREE, |
| | | UNIQUE KEY `app` (`app`,`stream`) USING BTREE, |
| | | UNIQUE KEY `gbId` (`gbId`) USING BTREE |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=301681 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=301740 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | /*!40101 SET character_set_client = @saved_cs_client */; |
| | | |
| | | -- |
| | |
| | | `username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=29943 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=37760 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | /*!40101 SET character_set_client = @saved_cs_client */; |
| | | |
| | | -- |
| | |
| | | `ptz` int DEFAULT NULL, |
| | | `rtcp` int DEFAULT NULL, |
| | | `status` bit(1) DEFAULT NULL, |
| | | `shareAllLiveStream` int DEFAULT NULL, |
| | | `startOfflinePush` int DEFAULT '0', |
| | | `administrativeDivision` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `catalogGroup` int DEFAULT '1', |
| | | `createTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `updateTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `treeType` varchar(50) COLLATE utf8mb4_general_ci NOT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | UNIQUE KEY `parent_platform_id_uindex` (`id`) USING BTREE, |
| | | UNIQUE KEY `parent_platform_pk` (`serverGBId`) USING BTREE |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | /*!40101 SET character_set_client = @saved_cs_client */; |
| | | |
| | | -- |
| | |
| | | `platformId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `parentId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `civilCode` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `businessGroupId` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | /*!40101 SET character_set_client = @saved_cs_client */; |
| | |
| | | `catalogId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `deviceChannelId` int NOT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=4889 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=4912 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | /*!40101 SET character_set_client = @saved_cs_client */; |
| | | |
| | | -- |
| | |
| | | `id` int NOT NULL AUTO_INCREMENT, |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | UNIQUE KEY `platform_gb_stream_pk` (`platformId`,`catalogId`,`gbStreamId`) USING BTREE |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=302077 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=302134 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | /*!40101 SET character_set_client = @saved_cs_client */; |
| | | |
| | | -- |
| | |
| | | `updateTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | UNIQUE KEY `stream_proxy_pk` (`app`,`stream`) USING BTREE |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=65 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=66 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | /*!40101 SET character_set_client = @saved_cs_client */; |
| | | |
| | | -- |
| | |
| | | `serverId` varchar(50) COLLATE utf8mb4_general_ci NOT NULL, |
| | | `pushTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `updateTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | `status` int DEFAULT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | UNIQUE KEY `stream_push_pk` (`app`,`stream`) USING BTREE |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=305304 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=305390 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | | /*!40101 SET character_set_client = @saved_cs_client */; |
| | | |
| | | -- |
| | |
| | | `roleId` int NOT NULL, |
| | | `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
| | | `pushKey` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | UNIQUE KEY `user_username_uindex` (`username`) USING BTREE |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; |
| | |
| | | |
| | | LOCK TABLES `user` WRITE; |
| | | /*!40000 ALTER TABLE `user` DISABLE KEYS */; |
| | | INSERT INTO `user` VALUES (1,'admin','21232f297a57a5a743894a0e4a801fc3',1,'2021 - 04 - 13 14:14:57','2021 - 04 - 13 14:14:57'); |
| | | INSERT INTO `user` VALUES (1,'admin','21232f297a57a5a743894a0e4a801fc3',1,'2021 - 04 - 13 14:14:57','2021 - 04 - 13 14:14:57','453df297a57a5a7438934sda801fc3'); |
| | | /*!40000 ALTER TABLE `user` ENABLE KEYS */; |
| | | UNLOCK TABLES; |
| | | |
| | |
| | | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; |
| | | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; |
| | | |
| | | -- Dump completed on 2022-07-06 9:43:54 |
| | | -- Dump completed on 2022-07-17 23:15:09 |
| | |
| | | alter table stream_push |
| | | add pushTime varchar(50) default null; |
| | | alter table stream_push |
| | | add status int DEFAULT NULL; |
| | | alter table stream_push |
| | | add updateTime varchar(50) default null; |
| | | alter table stream_push |
| | | add pushIng int DEFAULT NULL; |
| | | alter table stream_push |
| | | change createStamp createTime varchar(50) default null; |
| | | |
| | | alter table gb_stream |
| | | drop column status; |
| | | |
| | | alter table user |
| | | add pushKey varchar(50) default null; |
| | | update user set pushKey='453df297a57a5a7438934sda801fc3' where id=1; |
| | | |
| | | alter table parent_platform |
| | | add treeType varchar(50) not null; |
| | | update parent_platform set parent_platform.treeType='BusinessGroup'; |
| | | alter table parent_platform drop shareAllLiveStream; |
| | | |
| | | alter table platform_catalog |
| | | add civilCode varchar(50) default null; |
| | | alter table platform_catalog |
| | | add businessGroupId varchar(50) default null; |
| | | |
| | | |
| | | |
| | |
| | | import springfox.documentation.oas.annotations.EnableOpenApi;
|
| | |
|
| | | /**
|
| | | *
|
| | | * å¯å¨ç±»
|
| | | */
|
| | | @ServletComponentScan("com.genersoft.iot.vmp.conf")
|
| | | @SpringBootApplication
|
| | |
| | | private String deviceID; |
| | | private String channelId; |
| | | private String flv; |
| | | |
| | | private String ip; |
| | | |
| | | private String https_flv; |
| | | private String ws_flv; |
| | | private String wss_flv; |
| | |
| | | public void setProgress(double progress) { |
| | | this.progress = progress; |
| | | } |
| | | |
| | | public String getIp() { |
| | | return ip; |
| | | } |
| | | |
| | | public void setIp(String ip) { |
| | | this.ip = ip; |
| | | } |
| | | } |
| | |
| | |
|
| | | public static final String MEDIA_TRANSACTION_USED_PREFIX = "VMP_MEDIA_TRANSACTION_";
|
| | |
|
| | | public static final String MEDIA_STREAM_AUTHORITY = "MEDIA_STREAM_AUTHORITY_";
|
| | |
|
| | | public static final String SIP_CSEQ_PREFIX = "VMP_SIP_CSEQ_";
|
| | |
|
| | | public static final String SIP_SN_PREFIX = "VMP_SIP_SN_";
|
| | |
| | | public static final String SYSTEM_INFO_NET_PREFIX = "VMP_SYSTEM_INFO_NET_";
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | //************************** redis æ¶æ¯*********************************
|
| | |
|
| | | // æµååçéç¥
|
| | |
| | | // æ¥æ¶æ¨æµè®¾å¤çGPSååéç¥
|
| | | public static final String VM_MSG_GPS = "VM_MSG_GPS";
|
| | |
|
| | | // æ¥æ¶æ¨æµè®¾å¤çGPSååéç¥
|
| | | public static final String VM_MSG_PUSH_STREAM_STATUS_CHANGE = "VM_MSG_PUSH_STREAM_STATUS_CHANGE";
|
| | |
|
| | | // redis æ¶æ¯éç¥è®¾å¤æ¨æµå°å¹³å°
|
| | | public static final String VM_MSG_STREAM_PUSH_REQUESTED = "VM_MSG_STREAM_PUSH_REQUESTED";
|
| | |
|
| | | // redis æ¶æ¯è¯·æ±ææçå¨çº¿éé
|
| | | public static final String VM_MSG_GET_ALL_ONLINE_REQUESTED = "VM_MSG_GET_ALL_ONLINE_REQUESTED";
|
| | |
|
| | | // ç§»å¨ä½ç½®è®¢é
éç¥
|
| | | public static final String VM_MSG_SUBSCRIBE_MOBILE_POSITION = "mobileposition";
|
| | |
| | | // 设å¤ç¶æè®¢é
çéç¥
|
| | | public static final String VM_MSG_SUBSCRIBE_DEVICE_STATUS = "device";
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | //************************** ç¬¬ä¸æ¹ ****************************************
|
| | | public static final String WVP_STREAM_GB_ID_PREFIX = "memberNo_";
|
| | | public static final String WVP_STREAM_GPS_MSG_PREFIX = "WVP_STREAM_GPS_MSG_";
|
| | |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | |
| | | public void stop(String key) { |
| | | if (futureMap.get(key) != null && !futureMap.get(key).isCancelled()) { |
| | | // Runnable runnable = runnableMap.get(key); |
| | | // if (runnable instanceof ISubscribeTask) { |
| | | // ISubscribeTask subscribeTask = (ISubscribeTask) runnable; |
| | | // subscribeTask.stop(); |
| | | // } |
| | | futureMap.get(key).cancel(false); |
| | | futureMap.remove(key); |
| | | runnableMap.remove(key); |
| | | } |
| | | } |
| | | |
| | |
| | | public Runnable get(String key) { |
| | | return runnableMap.get(key); |
| | | } |
| | | |
| | | /** |
| | | * æ¯äºå鿣æ¥å¤±æçä»»å¡ï¼å¹¶ç§»é¤ |
| | | */ |
| | | @Scheduled(cron="0 0/5 * * * ?") |
| | | public void execute(){ |
| | | if (futureMap.size() > 0) { |
| | | for (String key : futureMap.keySet()) { |
| | | if (futureMap.get(key).isDone()) { |
| | | futureMap.remove(key); |
| | | runnableMap.remove(key); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.genersoft.iot.vmp.conf;
|
| | |
|
| | | import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
| | | import com.genersoft.iot.vmp.service.impl.RedisAlarmMsgListener;
|
| | | import com.genersoft.iot.vmp.service.impl.RedisGpsMsgListener;
|
| | | import com.genersoft.iot.vmp.service.impl.RedisGbPlayMsgListener;
|
| | | import com.genersoft.iot.vmp.service.impl.RedisStreamMsgListener;
|
| | | import com.genersoft.iot.vmp.service.impl.*;
|
| | | import org.apache.commons.lang3.StringUtils;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.beans.factory.annotation.Value;
|
| | |
| | | @Autowired
|
| | | private RedisGbPlayMsgListener redisGbPlayMsgListener;
|
| | |
|
| | | @Autowired
|
| | | private RedisPushStreamStatusMsgListener redisPushStreamStatusMsgListener;
|
| | |
|
| | | @Bean
|
| | | public JedisPool jedisPool() {
|
| | | if (StringUtils.isBlank(password)) {
|
| | |
| | | container.addMessageListener(redisAlarmMsgListener, new PatternTopic(VideoManagerConstants.VM_MSG_SUBSCRIBE_ALARM_RECEIVE));
|
| | | container.addMessageListener(redisStreamMsgListener, new PatternTopic(VideoManagerConstants.WVP_MSG_STREAM_CHANGE_PREFIX + "PUSH"));
|
| | | container.addMessageListener(redisGbPlayMsgListener, new PatternTopic(RedisGbPlayMsgListener.WVP_PUSH_STREAM_KEY));
|
| | | container.addMessageListener(redisPushStreamStatusMsgListener, new PatternTopic(VideoManagerConstants.VM_MSG_PUSH_STREAM_STATUS_CHANGE));
|
| | | return container;
|
| | | }
|
| | |
|
| | |
| | | private int channelCount; |
| | | |
| | | /** |
| | | * å
±äº«ææçç´ææµ |
| | | */ |
| | | private boolean shareAllLiveStream; |
| | | |
| | | /** |
| | | * é»è®¤ç®å½Id,èªå¨æ·»å çéé夿¾å¨è¿ä¸ªç®å½ä¸ |
| | | */ |
| | | private String catalogId; |
| | |
| | | * å建æ¶é´ |
| | | */ |
| | | private String createTime; |
| | | |
| | | /** |
| | | * æ ç±»å 彿 è§å®äºä¸¤ç§æ çå±ç°æ¹å¼ è¡æ¿åºå CivilCode åä¸å¡åç»:BusinessGroup |
| | | */ |
| | | private String treeType; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | |
| | | this.channelCount = channelCount; |
| | | } |
| | | |
| | | |
| | | public boolean isShareAllLiveStream() { |
| | | return shareAllLiveStream; |
| | | } |
| | | |
| | | public void setShareAllLiveStream(boolean shareAllLiveStream) { |
| | | this.shareAllLiveStream = shareAllLiveStream; |
| | | } |
| | | |
| | | public String getCatalogId() { |
| | | return catalogId; |
| | | } |
| | |
| | | public void setCreateTime(String createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public String getTreeType() { |
| | | return treeType; |
| | | } |
| | | |
| | | public void setTreeType(String treeType) { |
| | | this.treeType = treeType; |
| | | } |
| | | } |
| | |
| | | package com.genersoft.iot.vmp.gb28181.bean; |
| | | |
| | | /** |
| | | * 彿 级è-ç®å½ |
| | | * @author lin |
| | | */ |
| | | public class PlatformCatalog { |
| | | private String id; |
| | | private String name; |
| | | private String platformId; |
| | | private String parentId; |
| | | private int childrenCount; // åèç¹æ° |
| | | private int type; // 0 ç®å½, 1 彿 éé, 2 ç´ææµ |
| | | |
| | | private String civilCode; |
| | | |
| | | private String businessGroupId; |
| | | |
| | | /** |
| | | * åèç¹æ° |
| | | */ |
| | | private int childrenCount; |
| | | |
| | | /** |
| | | * 0 ç®å½, 1 彿 éé, 2 ç´ææµ |
| | | */ |
| | | private int type; |
| | | |
| | | public String getId() { |
| | | return id; |
| | |
| | | this.type = 2; |
| | | } |
| | | |
| | | public String getCivilCode() { |
| | | return civilCode; |
| | | } |
| | | |
| | | public void setCivilCode(String civilCode) { |
| | | this.civilCode = civilCode; |
| | | } |
| | | |
| | | public String getBusinessGroupId() { |
| | | return businessGroupId; |
| | | } |
| | | |
| | | public void setBusinessGroupId(String businessGroupId) { |
| | | this.businessGroupId = businessGroupId; |
| | | } |
| | | } |
File was renamed from src/main/java/com/genersoft/iot/vmp/domain/req/PresetQuerySipReq.java |
| | |
| | | package com.genersoft.iot.vmp.domain.req; |
| | | package com.genersoft.iot.vmp.gb28181.bean; |
| | | |
| | | |
| | | /** |
New file |
| | |
| | | package com.genersoft.iot.vmp.gb28181.bean; |
| | | |
| | | /** |
| | | * ç®å½ç»æç±»å |
| | | * @author lin |
| | | */ |
| | | public class TreeType { |
| | | public static final String BUSINESS_GROUP = "BusinessGroup"; |
| | | public static final String CIVIL_CODE = "CivilCode"; |
| | | } |
| | |
| | | } |
| | | // æ¥è¯¢æ¯å¦ææ¨æµï¼ 妿æåé½åæ¢ |
| | | List<SendRtpItem> sendRtpItems = redisCatchStorage.querySendRTPServer(event.getPlatformGbID()); |
| | | logger.info("[ 平尿ªæ³¨åäºä»¶ ] 忢[ {} ]çæææ¨æµsize", sendRtpItems.size()); |
| | | if (sendRtpItems != null && sendRtpItems.size() > 0) { |
| | | logger.info("[ 平尿ªæ³¨åäºä»¶ ] 忢[ {} ]çæææ¨æµ", event.getPlatformGbID()); |
| | | for (SendRtpItem sendRtpItem : sendRtpItems) { |
| | |
| | | super(source); |
| | | } |
| | | |
| | | public static final String ON = "ON"; // ä¸çº¿ |
| | | public static final String OFF = "OFF"; // 离线 |
| | | public static final String VLOST = "VLOST"; // è§é¢ä¸¢å¤± |
| | | public static final String DEFECT = "DEFECT"; // æ
é |
| | | public static final String ADD = "ADD"; // å¢å |
| | | public static final String DEL = "DEL"; // å é¤ |
| | | public static final String UPDATE = "UPDATE"; // æ´æ° |
| | | /** |
| | | * ä¸çº¿ |
| | | */ |
| | | public static final String ON = "ON"; |
| | | |
| | | /** |
| | | * 离线 |
| | | */ |
| | | public static final String OFF = "OFF"; |
| | | |
| | | /** |
| | | * è§é¢ä¸¢å¤± |
| | | */ |
| | | public static final String VLOST = "VLOST"; |
| | | |
| | | /** |
| | | * æ
é |
| | | */ |
| | | public static final String DEFECT = "DEFECT"; |
| | | |
| | | /** |
| | | * å¢å |
| | | */ |
| | | public static final String ADD = "ADD"; |
| | | |
| | | /** |
| | | * å é¤ |
| | | */ |
| | | public static final String DEL = "DEL"; |
| | | |
| | | /** |
| | | * æ´æ° |
| | | */ |
| | | public static final String UPDATE = "UPDATE"; |
| | | |
| | | private List<DeviceChannel> deviceChannels; |
| | | private List<GbStream> gbStreams; |
| | |
| | | ParentPlatform parentPlatform = null; |
| | | |
| | | Map<String, List<ParentPlatform>> parentPlatformMap = new HashMap<>(); |
| | | if (event.getPlatformId() != null) { |
| | | if (!StringUtils.isEmpty(event.getPlatformId())) { |
| | | subscribe = subscribeHolder.getCatalogSubscribe(event.getPlatformId()); |
| | | if (subscribe == null) { |
| | | return; |
| | | } |
| | | parentPlatform = storager.queryParentPlatByServerGBId(event.getPlatformId()); |
| | | if (parentPlatform != null && !parentPlatform.isStatus()) { |
| | | return; |
| | | } |
| | | subscribe = subscribeHolder.getCatalogSubscribe(event.getPlatformId()); |
| | | |
| | | if (subscribe == null) { |
| | | logger.info("åé订é
æ¶æ¯æ¶åç°è®¢é
ä¿¡æ¯å·²ç»ä¸åå¨: {}", event.getPlatformId()); |
| | | return; |
| | | } |
| | | }else { |
| | | // è·åæç¨è®¢é
|
| | | List<String> platforms = subscribeHolder.getAllCatalogSubscribePlatform(); |
| | |
| | | } |
| | | if (event.getGbStreams() != null && event.getGbStreams().size() > 0){ |
| | | for (GbStream gbStream : event.getGbStreams()) { |
| | | DeviceChannel deviceChannelByStream = gbStreamService.getDeviceChannelListByStream(gbStream, gbStream.getCatalogId(), parentPlatform); |
| | | if (deviceChannelByStream.getParentId().length() <= 10) { // ç¶èç¹æ¯è¡æ¿åºå,å设置CivilCodeä½¿ç¨æ¤è¡æ¿åºå |
| | | deviceChannelByStream.setCivilCode(deviceChannelByStream.getParentId()); |
| | | } |
| | | deviceChannelList.add(deviceChannelByStream); |
| | | deviceChannelList.add( |
| | | gbStreamService.getDeviceChannelListByStream(gbStream, gbStream.getCatalogId(), parentPlatform)); |
| | | } |
| | | } |
| | | if (deviceChannelList.size() > 0) { |
| | |
| | | SubscribeInfo subscribe = subscribeHolder.getMobilePositionSubscribe(platform.getServerGBId()); |
| | | if (subscribe != null) { |
| | | |
| | | // if (!parentPlatform.isStatus()) { |
| | | // logger.info("åé订é
æ¶åç°å¹³å°å·²ç»ç¦»çº¿ï¼{}", platformId); |
| | | // return; |
| | | // } |
| | | // TODO ææ¶åªå¤çè§é¢æµçåå¤,åç»å¢å 坹彿 设å¤çæ¯æ |
| | | List<GbStream> gbStreams = storager.queryGbStreamListInPlatform(platform.getServerGBId()); |
| | | List<DeviceChannel> gbStreams = storager.queryGbStreamListInPlatform(platform.getServerGBId()); |
| | | if (gbStreams.size() == 0) { |
| | | logger.info("åé订é
æ¶åç°å¹³å°å·²ç»æ²¡æå
³èçç´ææµï¼{}", platform.getServerGBId()); |
| | | return; |
| | | } |
| | | for (GbStream gbStream : gbStreams) { |
| | | String gbId = gbStream.getGbId(); |
| | | for (DeviceChannel deviceChannel : gbStreams) { |
| | | String gbId = deviceChannel.getChannelId(); |
| | | GPSMsgInfo gpsMsgInfo = redisCatchStorage.getGpsMsgInfo(gbId); |
| | | if (gpsMsgInfo != null) { // æ ææ°ä½ç½®ä¸åé |
| | | if (logger.isDebugEnabled()) { |
| | | logger.debug("æ ææ°ä½ç½®ä¸åé"); |
| | | } |
| | | // æ ææ°ä½ç½®ä¸åé |
| | | if (gpsMsgInfo != null) { |
| | | // ç»çº¬åº¦é½ä¸º0ä¸åé |
| | | if (gpsMsgInfo.getLng() == 0 && gpsMsgInfo.getLat() == 0) { |
| | | continue; |
| | |
| | | catalogXml.append("<DeviceList Num=\"" + channels.size() +"\">\r\n"); |
| | | if (channels.size() > 0) { |
| | | for (DeviceChannel channel : channels) { |
| | | if (parentPlatform.getServerGBId().equals(channel.getParentId())) { |
| | | channel.setParentId(parentPlatform.getDeviceGBId()); |
| | | } |
| | | catalogXml.append("<Item>\r\n"); |
| | | // è¡æ¿åºååç»åªéè¦è¿ä¸¤é¡¹å°±å¯ä»¥ |
| | | catalogXml.append("<DeviceID>" + channel.getChannelId() + "</DeviceID>\r\n"); |
| | | catalogXml.append("<Name>" + channel.getName() + "</Name>\r\n"); |
| | | catalogXml.append("<Parental>" + channel.getParental() + "</Parental>\r\n"); |
| | | if (channel.getParentId() != null) { |
| | | // ä¸å¡åç»å ä¸è¿ä¸é¡¹å³å¯ï¼æé«å
¼å®¹æ§ï¼ |
| | | catalogXml.append("<ParentID>" + channel.getParentId() + "</ParentID>\r\n"); |
| | | } |
| | | if (channel.getChannelId().length() == 20) { |
| | | if (Integer.parseInt(channel.getChannelId().substring(10, 13)) == 216) { // èæç»ç»å¢å BusinessGroupIDåæ®µ |
| | | catalogXml.append("<BusinessGroupID>" + channel.getParentId() + "</BusinessGroupID>\r\n"); |
| | | } |
| | | if (channel.getChannelId().length() == 20 && Integer.parseInt(channel.getChannelId().substring(10, 13)) == 216) { |
| | | // èæç»ç»å¢å BusinessGroupIDåæ®µ |
| | | catalogXml.append("<BusinessGroupID>" + channel.getParentId() + "</BusinessGroupID>\r\n"); |
| | | } |
| | | catalogXml.append("<Parental>" + channel.getParental() + "</Parental>\r\n"); |
| | | if (channel.getParental() == 0) { |
| | | // éé项 |
| | | catalogXml.append("<Manufacturer>" + channel.getManufacture() + "</Manufacturer>\r\n"); |
| | | catalogXml.append("<Secrecy>" + channel.getSecrecy() + "</Secrecy>\r\n"); |
| | | catalogXml.append("<RegisterWay>" + channel.getRegisterWay() + "</RegisterWay>\r\n"); |
| | | catalogXml.append("<Status>" + (channel.getStatus() == 0?"OFF":"ON") + "</Status>\r\n"); |
| | | if (channel.getChannelType() != 2) { // ä¸å¡åç»/èæç»ç»/è¡æ¿åºå ä¸è®¾ç½®ä»¥ä¸å段 |
| | | catalogXml.append("<Secrecy>" + channel.getSecrecy() + "</Secrecy>\r\n"); |
| | | catalogXml.append("<Status>" + (channel.getStatus() == 0 ? "OFF" : "ON") + "</Status>\r\n"); |
| | | |
| | | if (channel.getChannelType() != 2) { // ä¸å¡åç»/èæç»ç»/è¡æ¿åºå ä¸è®¾ç½®ä»¥ä¸å±æ§ |
| | | catalogXml.append("<Model>" + channel.getModel() + "</Model>\r\n"); |
| | | catalogXml.append("<Owner>" + channel.getOwner() + "</Owner>\r\n"); |
| | | catalogXml.append("<Owner> " + channel.getOwner()+ "</Owner>\r\n"); |
| | | catalogXml.append("<CivilCode>" + channel.getCivilCode() + "</CivilCode>\r\n"); |
| | | catalogXml.append("<Address>" + channel.getAddress() + "</Address>\r\n"); |
| | | catalogXml.append("<Longitude>" + channel.getLongitudeWgs84() + "</Longitude>\r\n"); |
| | | catalogXml.append("<Latitude>" + channel.getLatitudeWgs84() + "</Latitude>\r\n"); |
| | | catalogXml.append("<IPAddress>" + channel.getIpAddress() + "</IPAddress>\r\n"); |
| | | catalogXml.append("<Port>" + channel.getPort() + "</Port>\r\n"); |
| | | catalogXml.append("<Info>\r\n"); |
| | | catalogXml.append("<PTZType>" + channel.getPTZType() + "</PTZType>\r\n"); |
| | | catalogXml.append("</Info>\r\n"); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | catalogXml.append("</Item>\r\n"); |
| | | } |
| | | } |
| | |
| | | channel.setParentId(parentPlatform.getDeviceGBId()); |
| | | } |
| | | catalogXml.append("<Item>\r\n"); |
| | | // è¡æ¿åºååç»åªéè¦è¿ä¸¤é¡¹å°±å¯ä»¥ |
| | | catalogXml.append("<DeviceID>" + channel.getChannelId() + "</DeviceID>\r\n"); |
| | | catalogXml.append("<Name>" + channel.getName() + "</Name>\r\n"); |
| | | catalogXml.append("<Manufacturer>" + channel.getManufacture() + "</Manufacturer>\r\n"); |
| | | catalogXml.append("<Parental>" + channel.getParental() + "</Parental>\r\n"); |
| | | if (channel.getParentId() != null) { |
| | | // ä¸å¡åç»å ä¸è¿ä¸é¡¹å³å¯ï¼æé«å
¼å®¹æ§ï¼ |
| | | catalogXml.append("<ParentID>" + channel.getParentId() + "</ParentID>\r\n"); |
| | | } |
| | | catalogXml.append("<Secrecy>" + channel.getSecrecy() + "</Secrecy>\r\n"); |
| | | catalogXml.append("<RegisterWay>" + channel.getRegisterWay() + "</RegisterWay>\r\n"); |
| | | catalogXml.append("<Status>" + (channel.getStatus() == 0 ? "OFF" : "ON") + "</Status>\r\n"); |
| | | if (channel.getChannelId().length() == 20 && Integer.parseInt(channel.getChannelId().substring(10, 13)) == 216) { // èæç»ç»å¢å BusinessGroupIDåæ®µ |
| | | if (channel.getChannelId().length() == 20 && Integer.parseInt(channel.getChannelId().substring(10, 13)) == 216) { |
| | | // èæç»ç»å¢å BusinessGroupIDåæ®µ |
| | | catalogXml.append("<BusinessGroupID>" + channel.getParentId() + "</BusinessGroupID>\r\n"); |
| | | } |
| | | if (channel.getChannelType() == 2) { // ä¸å¡åç»/èæç»ç»/è¡æ¿åºå ä¸è®¾ç½®ä»¥ä¸å±æ§ |
| | | catalogXml.append("<Model>" + channel.getModel() + "</Model>\r\n"); |
| | | catalogXml.append("<Owner>0</Owner>\r\n"); |
| | | catalogXml.append("<CivilCode>CivilCode</CivilCode>\r\n"); |
| | | catalogXml.append("<Address>" + channel.getAddress() + "</Address>\r\n"); |
| | | } |
| | | if (!"presence".equals(subscribeInfo.getEventType())) { |
| | | catalogXml.append("<Event>" + type + "</Event>\r\n"); |
| | | catalogXml.append("<Parental>" + channel.getParental() + "</Parental>\r\n"); |
| | | if (channel.getParental() == 0) { |
| | | // éé项 |
| | | catalogXml.append("<Manufacturer>" + channel.getManufacture() + "</Manufacturer>\r\n"); |
| | | catalogXml.append("<Secrecy>" + channel.getSecrecy() + "</Secrecy>\r\n"); |
| | | catalogXml.append("<RegisterWay>" + channel.getRegisterWay() + "</RegisterWay>\r\n"); |
| | | catalogXml.append("<Status>" + (channel.getStatus() == 0 ? "OFF" : "ON") + "</Status>\r\n"); |
| | | |
| | | if (channel.getChannelType() != 2) { // ä¸å¡åç»/èæç»ç»/è¡æ¿åºå ä¸è®¾ç½®ä»¥ä¸å±æ§ |
| | | catalogXml.append("<Model>" + channel.getModel() + "</Model>\r\n"); |
| | | catalogXml.append("<Owner> " + channel.getOwner()+ "</Owner>\r\n"); |
| | | catalogXml.append("<CivilCode>" + channel.getCivilCode() + "</CivilCode>\r\n"); |
| | | catalogXml.append("<Address>" + channel.getAddress() + "</Address>\r\n"); |
| | | } |
| | | if (!"presence".equals(subscribeInfo.getEventType())) { |
| | | catalogXml.append("<Event>" + type + "</Event>\r\n"); |
| | | } |
| | | |
| | | } |
| | | catalogXml.append("</Item>\r\n"); |
| | | } |
| | |
| | | import com.genersoft.iot.vmp.gb28181.utils.NumericUtil; |
| | | import com.genersoft.iot.vmp.gb28181.utils.SipUtils; |
| | | import com.genersoft.iot.vmp.gb28181.utils.XmlUtil; |
| | | import com.genersoft.iot.vmp.service.IDeviceChannelService; |
| | | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| | | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| | | import com.genersoft.iot.vmp.utils.DateUtil; |
| | |
| | | |
| | | @Autowired |
| | | private SIPProcessorObserver sipProcessorObserver; |
| | | |
| | | @Autowired |
| | | private IDeviceChannelService deviceChannelService; |
| | | |
| | | private boolean taskQueueHandlerRun = false; |
| | | |
| | |
| | | logger.info("[æ¶å° ç§»å¨ä½ç½®è®¢é
]ï¼{}/{}->{}.{}", mobilePosition.getDeviceId(), mobilePosition.getChannelId(), |
| | | mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | mobilePosition.setReportSource("Mobile Position"); |
| | | // é»è®¤æ¥æºåæ 系为WGS-84å¤ç |
| | | if ("WGS84".equals(device.getGeoCoordSys())) { |
| | | mobilePosition.setLongitudeWgs84(mobilePosition.getLongitude()); |
| | | mobilePosition.setLatitudeWgs84(mobilePosition.getLatitude()); |
| | | Double[] position = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | mobilePosition.setLongitudeGcj02(position[0]); |
| | | mobilePosition.setLatitudeGcj02(position[1]); |
| | | }else if ("GCJ02".equals(device.getGeoCoordSys())) { |
| | | mobilePosition.setLongitudeGcj02(mobilePosition.getLongitude()); |
| | | mobilePosition.setLatitudeGcj02(mobilePosition.getLatitude()); |
| | | Double[] position = Coordtransform.GCJ02ToWGS84(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | mobilePosition.setLongitudeWgs84(position[0]); |
| | | mobilePosition.setLatitudeWgs84(position[1]); |
| | | }else { |
| | | mobilePosition.setLongitudeGcj02(0.00); |
| | | mobilePosition.setLatitudeGcj02(0.00); |
| | | mobilePosition.setLongitudeWgs84(0.00); |
| | | mobilePosition.setLatitudeWgs84(0.00); |
| | | } |
| | | if (userSetting.getSavePositionHistory()) { |
| | | storager.insertMobilePosition(mobilePosition); |
| | | } |
| | | |
| | | |
| | | // æ´æ°device channel çç»çº¬åº¦ |
| | | DeviceChannel deviceChannel = new DeviceChannel(); |
| | |
| | | deviceChannel.setChannelId(channelId); |
| | | deviceChannel.setLongitude(mobilePosition.getLongitude()); |
| | | deviceChannel.setLatitude(mobilePosition.getLatitude()); |
| | | deviceChannel.setLongitudeWgs84(mobilePosition.getLongitudeWgs84()); |
| | | deviceChannel.setLatitudeWgs84(mobilePosition.getLatitudeWgs84()); |
| | | deviceChannel.setLongitudeGcj02(mobilePosition.getLongitudeGcj02()); |
| | | deviceChannel.setLatitudeGcj02(mobilePosition.getLatitudeGcj02()); |
| | | deviceChannel.setGpsTime(mobilePosition.getTime()); |
| | | deviceChannel = deviceChannelService.updateGps(deviceChannel, device); |
| | | |
| | | mobilePosition.setLongitudeWgs84(deviceChannel.getLongitudeWgs84()); |
| | | mobilePosition.setLatitudeWgs84(deviceChannel.getLatitudeWgs84()); |
| | | mobilePosition.setLongitudeGcj02(deviceChannel.getLongitudeGcj02()); |
| | | mobilePosition.setLatitudeGcj02(deviceChannel.getLatitudeGcj02()); |
| | | |
| | | if (userSetting.getSavePositionHistory()) { |
| | | storager.insertMobilePosition(mobilePosition); |
| | | } |
| | | |
| | | storager.updateChannelPosition(deviceChannel); |
| | | // åéredisæ¶æ¯ã éç¥ä½ç½®ä¿¡æ¯çåå |
| | | JSONObject jsonObject = new JSONObject(); |
| | |
| | | mobilePosition.setLongitude(deviceAlarm.getLongitude()); |
| | | mobilePosition.setLatitude(deviceAlarm.getLatitude()); |
| | | mobilePosition.setReportSource("GPS Alarm"); |
| | | if ("WGS84".equals(device.getGeoCoordSys())) { |
| | | mobilePosition.setLongitudeWgs84(mobilePosition.getLongitude()); |
| | | mobilePosition.setLatitudeWgs84(mobilePosition.getLatitude()); |
| | | Double[] position = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | mobilePosition.setLongitudeGcj02(position[0]); |
| | | mobilePosition.setLatitudeGcj02(position[1]); |
| | | }else if ("GCJ02".equals(device.getGeoCoordSys())) { |
| | | mobilePosition.setLongitudeGcj02(mobilePosition.getLongitude()); |
| | | mobilePosition.setLatitudeGcj02(mobilePosition.getLatitude()); |
| | | Double[] position = Coordtransform.GCJ02ToWGS84(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | mobilePosition.setLongitudeWgs84(position[0]); |
| | | mobilePosition.setLatitudeWgs84(position[1]); |
| | | }else { |
| | | mobilePosition.setLongitudeGcj02(0.00); |
| | | mobilePosition.setLatitudeGcj02(0.00); |
| | | mobilePosition.setLongitudeWgs84(0.00); |
| | | mobilePosition.setLatitudeWgs84(0.00); |
| | | } |
| | | if (userSetting.getSavePositionHistory()) { |
| | | storager.insertMobilePosition(mobilePosition); |
| | | } |
| | | |
| | | |
| | | |
| | | // æ´æ°device channel çç»çº¬åº¦ |
| | | DeviceChannel deviceChannel = new DeviceChannel(); |
| | | deviceChannel.setDeviceId(device.getDeviceId()); |
| | | deviceChannel.setChannelId(channelId); |
| | | deviceChannel.setLongitude(mobilePosition.getLongitude()); |
| | | deviceChannel.setLatitude(mobilePosition.getLatitude()); |
| | | deviceChannel.setLongitudeWgs84(mobilePosition.getLongitudeWgs84()); |
| | | deviceChannel.setLatitudeWgs84(mobilePosition.getLatitudeWgs84()); |
| | | deviceChannel.setLongitudeGcj02(mobilePosition.getLongitudeGcj02()); |
| | | deviceChannel.setLatitudeGcj02(mobilePosition.getLatitudeGcj02()); |
| | | deviceChannel.setGpsTime(mobilePosition.getTime()); |
| | | |
| | | deviceChannel = deviceChannelService.updateGps(deviceChannel, device); |
| | | |
| | | mobilePosition.setLongitudeWgs84(deviceChannel.getLongitudeWgs84()); |
| | | mobilePosition.setLatitudeWgs84(deviceChannel.getLatitudeWgs84()); |
| | | mobilePosition.setLongitudeGcj02(deviceChannel.getLongitudeGcj02()); |
| | | mobilePosition.setLatitudeGcj02(deviceChannel.getLatitudeGcj02()); |
| | | |
| | | if (userSetting.getSavePositionHistory()) { |
| | | storager.insertMobilePosition(mobilePosition); |
| | | } |
| | | |
| | | storager.updateChannelPosition(deviceChannel); |
| | | } |
| | | // TODO: éè¦å®ç°å卿¥è¦ä¿¡æ¯ãæ¥è¦åç±» |
| | |
| | | }else { |
| | | event = eventElement.getText().toUpperCase(); |
| | | } |
| | | DeviceChannel channel = XmlUtil.channelContentHander(itemDevice, device); |
| | | DeviceChannel channel = XmlUtil.channelContentHander(itemDevice, device, event); |
| | | channel.setDeviceId(device.getDeviceId()); |
| | | logger.info("[æ¶å° ç®å½è®¢é
]ï¼{}/{}", device.getDeviceId(), channel.getChannelId()); |
| | | switch (event) { |
| | |
| | | case CatalogEvent.ADD: |
| | | // å¢å |
| | | logger.info("æ¶å°æ¥èªè®¾å¤ã{}ãçå¢å ééã{}ãéç¥", device.getDeviceId(), channel.getChannelId()); |
| | | storager.updateChannel(deviceId, channel); |
| | | deviceChannelService.updateChannel(deviceId, channel); |
| | | break; |
| | | case CatalogEvent.DEL: |
| | | // å é¤ |
| | |
| | | case CatalogEvent.UPDATE: |
| | | // æ´æ° |
| | | logger.info("æ¶å°æ¥èªè®¾å¤ã{}ãçæ´æ°ééã{}ãéç¥", device.getDeviceId(), channel.getChannelId()); |
| | | storager.updateChannel(deviceId, channel); |
| | | deviceChannelService.updateChannel(deviceId, channel); |
| | | break; |
| | | default: |
| | | logger.warn("[ NotifyCatalog ] event not found ï¼ {}", event ); |
| | |
| | | import com.genersoft.iot.vmp.gb28181.utils.NumericUtil; |
| | | import com.genersoft.iot.vmp.gb28181.utils.XmlUtil; |
| | | import com.genersoft.iot.vmp.service.IDeviceAlarmService; |
| | | import com.genersoft.iot.vmp.service.IDeviceChannelService; |
| | | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| | | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| | | import com.genersoft.iot.vmp.utils.DateUtil; |
| | |
| | | |
| | | @Autowired |
| | | private IDeviceAlarmService deviceAlarmService; |
| | | |
| | | @Autowired |
| | | private IDeviceChannelService deviceChannelService; |
| | | |
| | | @Override |
| | | public void afterPropertiesSet() throws Exception { |
| | |
| | | mobilePosition.setLongitude(deviceAlarm.getLongitude()); |
| | | mobilePosition.setLatitude(deviceAlarm.getLatitude()); |
| | | mobilePosition.setReportSource("GPS Alarm"); |
| | | if ("WGS84".equals(device.getGeoCoordSys())) { |
| | | mobilePosition.setLongitudeWgs84(mobilePosition.getLongitude()); |
| | | mobilePosition.setLatitudeWgs84(mobilePosition.getLatitude()); |
| | | Double[] position = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | mobilePosition.setLongitudeGcj02(position[0]); |
| | | mobilePosition.setLatitudeGcj02(position[1]); |
| | | }else if ("GCJ02".equals(device.getGeoCoordSys())) { |
| | | mobilePosition.setLongitudeGcj02(mobilePosition.getLongitude()); |
| | | mobilePosition.setLatitudeGcj02(mobilePosition.getLatitude()); |
| | | Double[] position = Coordtransform.GCJ02ToWGS84(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | mobilePosition.setLongitudeWgs84(position[0]); |
| | | mobilePosition.setLatitudeWgs84(position[1]); |
| | | }else { |
| | | mobilePosition.setLongitudeGcj02(0.00); |
| | | mobilePosition.setLatitudeGcj02(0.00); |
| | | mobilePosition.setLongitudeWgs84(0.00); |
| | | mobilePosition.setLatitudeWgs84(0.00); |
| | | } |
| | | if (userSetting.getSavePositionHistory()) { |
| | | storager.insertMobilePosition(mobilePosition); |
| | | } |
| | | |
| | | |
| | | // æ´æ°device channel çç»çº¬åº¦ |
| | | DeviceChannel deviceChannel = new DeviceChannel(); |
| | | deviceChannel.setDeviceId(device.getDeviceId()); |
| | | deviceChannel.setChannelId(channelId); |
| | | deviceChannel.setLongitude(mobilePosition.getLongitude()); |
| | | deviceChannel.setLatitude(mobilePosition.getLatitude()); |
| | | deviceChannel.setLongitudeWgs84(mobilePosition.getLongitudeWgs84()); |
| | | deviceChannel.setLatitudeWgs84(mobilePosition.getLatitudeWgs84()); |
| | | deviceChannel.setLongitudeGcj02(mobilePosition.getLongitudeGcj02()); |
| | | deviceChannel.setLatitudeGcj02(mobilePosition.getLatitudeGcj02()); |
| | | deviceChannel.setGpsTime(mobilePosition.getTime()); |
| | | |
| | | deviceChannel = deviceChannelService.updateGps(deviceChannel, device); |
| | | |
| | | mobilePosition.setLongitudeWgs84(deviceChannel.getLongitudeWgs84()); |
| | | mobilePosition.setLatitudeWgs84(deviceChannel.getLatitudeWgs84()); |
| | | mobilePosition.setLongitudeGcj02(deviceChannel.getLongitudeGcj02()); |
| | | mobilePosition.setLatitudeGcj02(deviceChannel.getLatitudeGcj02()); |
| | | |
| | | if (userSetting.getSavePositionHistory()) { |
| | | storager.insertMobilePosition(mobilePosition); |
| | | } |
| | | storager.updateChannelPosition(deviceChannel); |
| | | } |
| | | } |
| | |
| | | // åå¤åå¤ééä¿¡æ¯ |
| | | List<DeviceChannelInPlatform> deviceChannels = storage.queryChannelListInParentPlatform(parentPlatform.getServerGBId()); |
| | | // æ¥è¯¢å
³èçç´æéé |
| | | List<GbStream> gbStreams = storage.queryGbStreamListInPlatform(parentPlatform.getServerGBId()); |
| | | List<DeviceChannel> gbStreams = storage.queryGbStreamListInPlatform(parentPlatform.getServerGBId()); |
| | | // åå¤ç®å½ä¿¡æ¯ |
| | | List<DeviceChannel> catalogs = storage.queryCatalogInPlatform(parentPlatform.getServerGBId()); |
| | | |
| | | List<DeviceChannel> allChannels = new ArrayList<>(); |
| | | // åå¤ç®å½ä¿¡æ¯ |
| | | List<PlatformCatalog> catalogs = storage.queryCatalogInPlatform(parentPlatform.getServerGBId()); |
| | | if (catalogs.size() > 0) { |
| | | for (PlatformCatalog catalog : catalogs) { |
| | | if (catalog.getParentId().equals(catalog.getPlatformId())) { |
| | | catalog.setParentId(parentPlatform.getDeviceGBId()); |
| | | } |
| | | DeviceChannel deviceChannel = new DeviceChannel(); |
| | | deviceChannel.setChannelId(catalog.getId()); |
| | | deviceChannel.setName(catalog.getName()); |
| | | deviceChannel.setLongitude(0.0); |
| | | deviceChannel.setLatitude(0.0); |
| | | deviceChannel.setDeviceId(parentPlatform.getDeviceGBId()); |
| | | deviceChannel.setManufacture("wvp-pro"); |
| | | deviceChannel.setStatus(1); |
| | | deviceChannel.setParental(1); |
| | | deviceChannel.setParentId(catalog.getParentId()); |
| | | deviceChannel.setRegisterWay(1); |
| | | if (catalog.getParentId() != null && catalog.getParentId().length() <= 10) { |
| | | deviceChannel.setCivilCode(catalog.getParentId()); |
| | | }else { |
| | | deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision()); |
| | | } |
| | | deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision()); |
| | | deviceChannel.setModel("live"); |
| | | deviceChannel.setOwner("wvp-pro"); |
| | | deviceChannel.setSecrecy("0"); |
| | | allChannels.add(deviceChannel); |
| | | } |
| | | allChannels.addAll(catalogs); |
| | | } |
| | | // åå¤çº§èçéé |
| | | if (deviceChannels.size() > 0) { |
| | | for (DeviceChannelInPlatform channel : deviceChannels) { |
| | | if (channel.getCatalogId().equals(parentPlatform.getServerGBId())) { |
| | | channel.setCatalogId(parentPlatform.getDeviceGBId()); |
| | | } |
| | | DeviceChannel deviceChannel = storage.queryChannel(channel.getDeviceId(), channel.getChannelId()); |
| | | deviceChannel.setParental(0); |
| | | deviceChannel.setParentId(channel.getCatalogId()); |
| | | if (channel.getCatalogId() != null && channel.getCatalogId().length() <= 10) { |
| | | channel.setCivilCode(channel.getCatalogId()); |
| | | }else { |
| | | deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision()); |
| | | } |
| | | |
| | | allChannels.add(deviceChannel); |
| | | } |
| | | allChannels.addAll(deviceChannels); |
| | | } |
| | | // åå¤ç´æçéé |
| | | if (gbStreams.size() > 0) { |
| | | for (GbStream gbStream : gbStreams) { |
| | | if (gbStream.getCatalogId().equals(parentPlatform.getServerGBId())) { |
| | | gbStream.setCatalogId(null); |
| | | } |
| | | DeviceChannel deviceChannel = new DeviceChannel(); |
| | | deviceChannel.setChannelId(gbStream.getGbId()); |
| | | deviceChannel.setName(gbStream.getName()); |
| | | deviceChannel.setLongitude(gbStream.getLongitude()); |
| | | deviceChannel.setLatitude(gbStream.getLatitude()); |
| | | deviceChannel.setDeviceId(parentPlatform.getDeviceGBId()); |
| | | deviceChannel.setManufacture("wvp-pro"); |
| | | // deviceChannel.setStatus(gbStream.isStatus()?1:0); |
| | | deviceChannel.setStatus(1); |
| | | deviceChannel.setParentId(gbStream.getCatalogId()); |
| | | deviceChannel.setRegisterWay(1); |
| | | if (gbStream.getCatalogId() != null && gbStream.getCatalogId().length() <= 10) { |
| | | deviceChannel.setCivilCode(gbStream.getCatalogId()); |
| | | }else { |
| | | deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision()); |
| | | } |
| | | deviceChannel.setModel("live"); |
| | | deviceChannel.setOwner("wvp-pro"); |
| | | deviceChannel.setParental(0); |
| | | deviceChannel.setSecrecy("0"); |
| | | allChannels.add(deviceChannel); |
| | | } |
| | | allChannels.addAll(gbStreams); |
| | | } |
| | | if (allChannels.size() > 0) { |
| | | cmderFroPlatform.catalogQuery(allChannels, parentPlatform, sn, fromHeader.getTag()); |
| | |
| | | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.NotifyMessageHandler; |
| | | import com.genersoft.iot.vmp.gb28181.utils.Coordtransform; |
| | | import com.genersoft.iot.vmp.gb28181.utils.NumericUtil; |
| | | import com.genersoft.iot.vmp.service.IDeviceChannelService; |
| | | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| | | import com.genersoft.iot.vmp.utils.DateUtil; |
| | | import com.genersoft.iot.vmp.utils.GpsUtil; |
| | |
| | | |
| | | @Autowired |
| | | private IVideoManagerStorage storager; |
| | | |
| | | @Autowired |
| | | private IDeviceChannelService deviceChannelService; |
| | | |
| | | @Override |
| | | public void afterPropertiesSet() throws Exception { |
| | |
| | | mobilePosition.setAltitude(0.0); |
| | | } |
| | | mobilePosition.setReportSource("Mobile Position"); |
| | | if ("WGS84".equals(device.getGeoCoordSys())) { |
| | | mobilePosition.setLongitudeWgs84(mobilePosition.getLongitude()); |
| | | mobilePosition.setLatitudeWgs84(mobilePosition.getLatitude()); |
| | | Double[] position = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | mobilePosition.setLongitudeGcj02(position[0]); |
| | | mobilePosition.setLatitudeGcj02(position[1]); |
| | | }else if ("GCJ02".equals(device.getGeoCoordSys())) { |
| | | mobilePosition.setLongitudeGcj02(mobilePosition.getLongitude()); |
| | | mobilePosition.setLatitudeGcj02(mobilePosition.getLatitude()); |
| | | Double[] position = Coordtransform.GCJ02ToWGS84(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | mobilePosition.setLongitudeWgs84(position[0]); |
| | | mobilePosition.setLatitudeWgs84(position[1]); |
| | | }else { |
| | | mobilePosition.setLongitudeGcj02(0.00); |
| | | mobilePosition.setLatitudeGcj02(0.00); |
| | | mobilePosition.setLongitudeWgs84(0.00); |
| | | mobilePosition.setLatitudeWgs84(0.00); |
| | | } |
| | | if (userSetting.getSavePositionHistory()) { |
| | | storager.insertMobilePosition(mobilePosition); |
| | | } |
| | | |
| | | |
| | | // æ´æ°device channel çç»çº¬åº¦ |
| | | DeviceChannel deviceChannel = new DeviceChannel(); |
| | | deviceChannel.setDeviceId(device.getDeviceId()); |
| | | deviceChannel.setChannelId(mobilePosition.getChannelId()); |
| | | deviceChannel.setLongitude(mobilePosition.getLongitude()); |
| | | deviceChannel.setLatitude(mobilePosition.getLatitude()); |
| | | deviceChannel.setLongitudeWgs84(mobilePosition.getLongitudeWgs84()); |
| | | deviceChannel.setLatitudeWgs84(mobilePosition.getLatitudeWgs84()); |
| | | deviceChannel.setLongitudeGcj02(mobilePosition.getLongitudeGcj02()); |
| | | deviceChannel.setLatitudeGcj02(mobilePosition.getLatitudeGcj02()); |
| | | deviceChannel.setGpsTime(mobilePosition.getTime()); |
| | | |
| | | deviceChannel = deviceChannelService.updateGps(deviceChannel, device); |
| | | |
| | | mobilePosition.setLongitudeWgs84(deviceChannel.getLongitudeWgs84()); |
| | | mobilePosition.setLatitudeWgs84(deviceChannel.getLatitudeWgs84()); |
| | | mobilePosition.setLongitudeGcj02(deviceChannel.getLongitudeGcj02()); |
| | | mobilePosition.setLatitudeGcj02(deviceChannel.getLatitudeGcj02()); |
| | | |
| | | if (userSetting.getSavePositionHistory()) { |
| | | storager.insertMobilePosition(mobilePosition); |
| | | } |
| | | storager.updateChannelPosition(deviceChannel); |
| | | //åå¤ 200 OK |
| | | responseAck(evt, Response.OK); |
| | |
| | | Element snElement = rootElement.element("SN"); |
| | | String sn = snElement.getText(); |
| | | // åå¤åå¤ééä¿¡æ¯ |
| | | List<DeviceChannelInPlatform> deviceChannelInPlatforms = storager.queryChannelListInParentPlatform(parentPlatform.getServerGBId()); |
| | | List<DeviceChannel> deviceChannelInPlatforms = storager.queryChannelWithCatalog(parentPlatform.getServerGBId()); |
| | | // æ¥è¯¢å
³èçç´æéé |
| | | List<GbStream> gbStreams = storager.queryGbStreamListInPlatform(parentPlatform.getServerGBId()); |
| | | List<DeviceChannel> gbStreams = storager.queryGbStreamListInPlatform(parentPlatform.getServerGBId()); |
| | | // åå¤ç®å½ä¿¡æ¯ |
| | | List<PlatformCatalog> catalogs = storager.queryCatalogInPlatform(parentPlatform.getServerGBId()); |
| | | List<DeviceChannel> catalogs = storager.queryCatalogInPlatform(parentPlatform.getServerGBId()); |
| | | |
| | | List<DeviceChannel> allChannels = new ArrayList<>(); |
| | | |
| | | if (catalogs.size() > 0) { |
| | | for (PlatformCatalog catalog : catalogs) { |
| | | if (catalog.getParentId().equals(catalog.getPlatformId())) { |
| | | catalog.setParentId(parentPlatform.getDeviceGBId()); |
| | | } |
| | | DeviceChannel deviceChannel = new DeviceChannel(); |
| | | // ééçç±»åï¼0->彿 éé 1->ç´ææµéé 2->ä¸å¡åç»/èæç»ç»/è¡æ¿åºå |
| | | deviceChannel.setChannelType(2); |
| | | deviceChannel.setChannelId(catalog.getId()); |
| | | deviceChannel.setName(catalog.getName()); |
| | | deviceChannel.setDeviceId(parentPlatform.getDeviceGBId()); |
| | | deviceChannel.setManufacture("wvp-pro"); |
| | | deviceChannel.setStatus(1); |
| | | deviceChannel.setParental(1); |
| | | deviceChannel.setParentId(catalog.getParentId()); |
| | | deviceChannel.setRegisterWay(1); |
| | | if (catalog.getParentId() != null && catalog.getParentId().length() < 10) { |
| | | deviceChannel.setCivilCode(catalog.getParentId()); |
| | | }else { |
| | | deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision()); |
| | | } |
| | | allChannels.add(deviceChannel); |
| | | } |
| | | allChannels.addAll(catalogs); |
| | | } |
| | | // åå¤çº§èçéé |
| | | if (deviceChannelInPlatforms.size() > 0) { |
| | | for (DeviceChannelInPlatform channel : deviceChannelInPlatforms) { |
| | | if (channel.getCatalogId().equals(parentPlatform.getServerGBId())) { |
| | | channel.setCatalogId(parentPlatform.getDeviceGBId()); |
| | | } |
| | | DeviceChannel deviceChannel = storage.queryChannel(channel.getDeviceId(), channel.getChannelId()); |
| | | // ééçç±»åï¼0->彿 éé 1->ç´ææµéé 2->ä¸å¡åç»/èæç»ç»/è¡æ¿åºå |
| | | deviceChannel.setChannelType(0); |
| | | deviceChannel.setParental(0); |
| | | deviceChannel.setParentId(channel.getCatalogId()); |
| | | if (channel.getCatalogId() != null && channel.getCatalogId().length() < 10) { |
| | | deviceChannel.setCivilCode(channel.getCatalogId()); |
| | | }else { |
| | | deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision()); |
| | | } |
| | | allChannels.add(deviceChannel); |
| | | } |
| | | allChannels.addAll(deviceChannelInPlatforms); |
| | | } |
| | | // åå¤ç´æçéé |
| | | if (gbStreams.size() > 0) { |
| | | for (GbStream gbStream : gbStreams) { |
| | | if (gbStream.getCatalogId().equals(parentPlatform.getServerGBId())) { |
| | | gbStream.setCatalogId(null); |
| | | } |
| | | DeviceChannel deviceChannel = new DeviceChannel(); |
| | | // ééçç±»åï¼0->彿 éé 1->ç´ææµéé 2->ä¸å¡åç»/èæç»ç»/è¡æ¿åºå |
| | | deviceChannel.setChannelType(1); |
| | | deviceChannel.setChannelId(gbStream.getGbId()); |
| | | deviceChannel.setName(gbStream.getName()); |
| | | deviceChannel.setLongitude(gbStream.getLongitude()); |
| | | deviceChannel.setLatitude(gbStream.getLatitude()); |
| | | deviceChannel.setDeviceId(parentPlatform.getDeviceGBId()); |
| | | deviceChannel.setManufacture("wvp-pro"); |
| | | // deviceChannel.setStatus(gbStream.isStatus()?1:0); |
| | | deviceChannel.setStatus(1); |
| | | deviceChannel.setParentId(gbStream.getCatalogId()); |
| | | deviceChannel.setRegisterWay(1); |
| | | if (gbStream.getCatalogId() != null && gbStream.getCatalogId().length() < 10) { |
| | | deviceChannel.setCivilCode(gbStream.getCatalogId()); |
| | | }else { |
| | | deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision()); |
| | | } |
| | | deviceChannel.setModel("live"); |
| | | deviceChannel.setOwner("wvp-pro"); |
| | | deviceChannel.setParental(0); |
| | | deviceChannel.setSecrecy("0"); |
| | | allChannels.add(deviceChannel); |
| | | } |
| | | allChannels.addAll(gbStreams); |
| | | } |
| | | if (allChannels.size() > 0) { |
| | | cmderFroPlatform.catalogQuery(allChannels, parentPlatform, sn, fromHeader.getTag()); |
| | |
| | | if (channelDeviceElement == null) { |
| | | continue; |
| | | } |
| | | //by brewswang |
| | | // if (NumericUtil.isDouble(XmlUtil.getText(itemDevice, "Longitude"))) {//妿å
å«ä½ç½®ä¿¡æ¯ï¼å°±æ´æ°ä¸ä¸ä½ç½® |
| | | // processNotifyMobilePosition(evt, itemDevice); |
| | | // } |
| | | DeviceChannel deviceChannel = XmlUtil.channelContentHander(itemDevice, device); |
| | | DeviceChannel deviceChannel = XmlUtil.channelContentHander(itemDevice, device, null); |
| | | deviceChannel.setDeviceId(take.getDevice().getDeviceId()); |
| | | |
| | | channelList.add(deviceChannel); |
| | |
| | | device.setStreamMode("UDP"); |
| | | } |
| | | deviceService.updateDevice(device); |
| | | // storager.updateDevice(device); |
| | | |
| | | RequestMessage msg = new RequestMessage(); |
| | | msg.setKey(key); |
| | |
| | | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler; |
| | | import com.genersoft.iot.vmp.gb28181.utils.Coordtransform; |
| | | import com.genersoft.iot.vmp.gb28181.utils.NumericUtil; |
| | | import com.genersoft.iot.vmp.service.IDeviceChannelService; |
| | | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| | | import com.genersoft.iot.vmp.utils.DateUtil; |
| | | import com.genersoft.iot.vmp.utils.GpsUtil; |
| | |
| | | |
| | | @Autowired |
| | | private IVideoManagerStorage storager; |
| | | |
| | | @Autowired |
| | | private IDeviceChannelService deviceChannelService; |
| | | |
| | | @Override |
| | | public void afterPropertiesSet() throws Exception { |
| | |
| | | mobilePosition.setAltitude(0.0); |
| | | } |
| | | mobilePosition.setReportSource("Mobile Position"); |
| | | if ("WGS84".equals(device.getGeoCoordSys())) { |
| | | mobilePosition.setLongitudeWgs84(mobilePosition.getLongitude()); |
| | | mobilePosition.setLatitudeWgs84(mobilePosition.getLatitude()); |
| | | Double[] position = Coordtransform.WGS84ToGCJ02(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | mobilePosition.setLongitudeGcj02(position[0]); |
| | | mobilePosition.setLatitudeGcj02(position[1]); |
| | | }else if ("GCJ02".equals(device.getGeoCoordSys())) { |
| | | mobilePosition.setLongitudeGcj02(mobilePosition.getLongitude()); |
| | | mobilePosition.setLatitudeGcj02(mobilePosition.getLatitude()); |
| | | Double[] position = Coordtransform.GCJ02ToWGS84(mobilePosition.getLongitude(), mobilePosition.getLatitude()); |
| | | mobilePosition.setLongitudeWgs84(position[0]); |
| | | mobilePosition.setLatitudeWgs84(position[1]); |
| | | }else { |
| | | mobilePosition.setLongitudeGcj02(0.00); |
| | | mobilePosition.setLatitudeGcj02(0.00); |
| | | mobilePosition.setLongitudeWgs84(0.00); |
| | | mobilePosition.setLatitudeWgs84(0.00); |
| | | } |
| | | if (userSetting.getSavePositionHistory()) { |
| | | storager.insertMobilePosition(mobilePosition); |
| | | } |
| | | |
| | | // æ´æ°device channel çç»çº¬åº¦ |
| | | DeviceChannel deviceChannel = new DeviceChannel(); |
| | | deviceChannel.setDeviceId(device.getDeviceId()); |
| | | deviceChannel.setChannelId(mobilePosition.getChannelId()); |
| | | deviceChannel.setLongitude(mobilePosition.getLongitude()); |
| | | deviceChannel.setLatitude(mobilePosition.getLatitude()); |
| | | deviceChannel.setLongitudeWgs84(mobilePosition.getLongitudeWgs84()); |
| | | deviceChannel.setLatitudeWgs84(mobilePosition.getLatitudeWgs84()); |
| | | deviceChannel.setLongitudeGcj02(mobilePosition.getLongitudeGcj02()); |
| | | deviceChannel.setLatitudeGcj02(mobilePosition.getLatitudeGcj02()); |
| | | deviceChannel.setGpsTime(mobilePosition.getTime()); |
| | | |
| | | deviceChannel = deviceChannelService.updateGps(deviceChannel, device); |
| | | |
| | | mobilePosition.setLongitudeWgs84(deviceChannel.getLongitudeWgs84()); |
| | | mobilePosition.setLatitudeWgs84(deviceChannel.getLatitudeWgs84()); |
| | | mobilePosition.setLongitudeGcj02(deviceChannel.getLongitudeGcj02()); |
| | | mobilePosition.setLatitudeGcj02(deviceChannel.getLatitudeGcj02()); |
| | | |
| | | if (userSetting.getSavePositionHistory()) { |
| | | storager.insertMobilePosition(mobilePosition); |
| | | } |
| | | storager.updateChannelPosition(deviceChannel); |
| | | //åå¤ 200 OK |
| | | responseAck(evt, Response.OK); |
| | |
| | | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd; |
| | | |
| | | import com.genersoft.iot.vmp.domain.req.PresetQuerySipReq; |
| | | import com.genersoft.iot.vmp.gb28181.bean.PresetQuerySipReq; |
| | | import com.genersoft.iot.vmp.gb28181.bean.*; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; |
| | |
| | | import com.alibaba.fastjson.JSONObject;
|
| | | import com.genersoft.iot.vmp.gb28181.bean.Device;
|
| | | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
| | | import com.genersoft.iot.vmp.gb28181.bean.TreeType;
|
| | | import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
|
| | | import com.genersoft.iot.vmp.utils.DateUtil;
|
| | | import org.dom4j.Attribute;
|
| | | import org.dom4j.Document;
|
| | |
| | | /**
|
| | | * æ¥å¿æå¡
|
| | | */
|
| | | private static Logger LOG = LoggerFactory.getLogger(XmlUtil.class);
|
| | | private static Logger logger = LoggerFactory.getLogger(XmlUtil.class);
|
| | |
|
| | | /**
|
| | | * è§£æXML为Document对象
|
| | |
| | | try {
|
| | | document = saxReader.read(sr);
|
| | | } catch (DocumentException e) {
|
| | | LOG.error("è§£æå¤±è´¥", e);
|
| | | logger.error("è§£æå¤±è´¥", e);
|
| | | }
|
| | | return null == document ? null : document.getRootElement();
|
| | | }
|
| | |
| | | return xml.getRootElement();
|
| | | }
|
| | |
|
| | | public static DeviceChannel channelContentHander(Element itemDevice, Device device){
|
| | | Element channdelNameElement = itemDevice.element("Name");
|
| | | String channelName = channdelNameElement != null ? channdelNameElement.getTextTrim().toString() : "";
|
| | | Element statusElement = itemDevice.element("Status");
|
| | | String status = statusElement != null ? statusElement.getTextTrim().toString() : "ON";
|
| | | private enum ChannelType{
|
| | | CivilCode, BusinessGroup,VirtualOrganization,Other
|
| | | }
|
| | |
|
| | | public static DeviceChannel channelContentHander(Element itemDevice, Device device, String event){
|
| | | DeviceChannel deviceChannel = new DeviceChannel();
|
| | | deviceChannel.setName(channelName);
|
| | | deviceChannel.setDeviceId(device.getDeviceId());
|
| | | Element channdelIdElement = itemDevice.element("DeviceID");
|
| | | String channelId = channdelIdElement != null ? channdelIdElement.getTextTrim().toString() : "";
|
| | | deviceChannel.setChannelId(channelId);
|
| | | // ONLINE OFFLINE HIKVISION DS-7716N-E4 NVRçå
¼å®¹æ§å¤ç
|
| | | if (status.equals("ON") || status.equals("On") || status.equals("ONLINE") || status.equals("OK")) {
|
| | | deviceChannel.setStatus(1);
|
| | | if (channdelIdElement == null) {
|
| | | logger.warn("è§£æCatalogæ¶æ¯æ¶åç°ç¼ºå° DeviceID");
|
| | | return null;
|
| | | }
|
| | | if (status.equals("OFF") || status.equals("Off") || status.equals("OFFLINE")) {
|
| | | deviceChannel.setStatus(0);
|
| | | String channelId = channdelIdElement.getTextTrim();
|
| | | if (StringUtils.isEmpty(channelId)) {
|
| | | logger.warn("è§£æCatalogæ¶æ¯æ¶åç°ç¼ºå° DeviceID");
|
| | | return null;
|
| | | }
|
| | | deviceChannel.setChannelId(channelId);
|
| | | if (event != null && !event.equals(CatalogEvent.ADD) && !event.equals(CatalogEvent.UPDATE)) {
|
| | | // é¤äºADDåupdateæ
åµä¸éè¦è¯å«å
¨é¨å
容ï¼
|
| | | return deviceChannel;
|
| | | }
|
| | |
|
| | | deviceChannel.setManufacture(XmlUtil.getText(itemDevice, "Manufacturer"));
|
| | | deviceChannel.setModel(XmlUtil.getText(itemDevice, "Model"));
|
| | | deviceChannel.setOwner(XmlUtil.getText(itemDevice, "Owner"));
|
| | | deviceChannel.setCivilCode(XmlUtil.getText(itemDevice, "CivilCode"));
|
| | | deviceChannel.setBlock(XmlUtil.getText(itemDevice, "Block"));
|
| | | deviceChannel.setAddress(XmlUtil.getText(itemDevice, "Address"));
|
| | | String businessGroupID = XmlUtil.getText(itemDevice, "BusinessGroupID");
|
| | | if (XmlUtil.getText(itemDevice, "Parental") == null
|
| | | || XmlUtil.getText(itemDevice, "Parental").equals("")) {
|
| | | if (deviceChannel.getChannelId().length() <= 10
|
| | | || (deviceChannel.getChannelId().length() == 20 && (
|
| | | Integer.parseInt(deviceChannel.getChannelId().substring(10, 13)) == 215
|
| | | || Integer.parseInt(deviceChannel.getChannelId().substring(10, 13)) == 216
|
| | | )
|
| | | )
|
| | | ) {
|
| | | deviceChannel.setParental(1);
|
| | | }else {
|
| | | deviceChannel.setParental(0);
|
| | | ChannelType channelType = ChannelType.Other;
|
| | | if (channelId.length() <= 8) {
|
| | | channelType = ChannelType.CivilCode;
|
| | | }else {
|
| | | if (channelId.length() == 20) {
|
| | | int code = Integer.parseInt(channelId.substring(10, 13));
|
| | | switch (code){
|
| | | case 215:
|
| | | channelType = ChannelType.BusinessGroup;
|
| | | break;
|
| | | case 216:
|
| | | channelType = ChannelType.VirtualOrganization;
|
| | | break;
|
| | | default:
|
| | | break;
|
| | |
|
| | | }
|
| | | }
|
| | | } else {
|
| | | // ç±äºæµ·åº·ä¼é误çåé65535ä½ä¸ºè¿éçåå¼,æä»¥è¿éé¤éæ¯0å¦å认为æ¯1
|
| | | deviceChannel.setParental(Integer.parseInt(XmlUtil.getText(itemDevice, "Parental")) == 1?1:0);
|
| | | }
|
| | |
|
| | | Element channdelNameElement = itemDevice.element("Name");
|
| | | String channelName = channdelNameElement != null ? channdelNameElement.getTextTrim() : "";
|
| | | deviceChannel.setName(channelName);
|
| | |
|
| | | String civilCode = XmlUtil.getText(itemDevice, "CivilCode");
|
| | | deviceChannel.setCivilCode(civilCode);
|
| | | if (channelType == ChannelType.CivilCode && civilCode == null) {
|
| | | deviceChannel.setParental(1);
|
| | | // è¡æ¿åºåå¦ææ²¡æä¼ éå
·ä½å¼ï¼åæ¨æµä¸ä¸ª
|
| | | if (channelId.length() > 2) {
|
| | | deviceChannel.setCivilCode(channelId.substring(0, channelId.length() - 2));
|
| | | }
|
| | | }
|
| | | if (channelType.equals(ChannelType.CivilCode)) {
|
| | | // è¡æ¿åºåå
¶ä»å段没å¿
è¦è¯å«äºï¼é»è®¤å¨çº¿å³å¯
|
| | | deviceChannel.setStatus(1);
|
| | | deviceChannel.setParental(1);
|
| | | deviceChannel.setCreateTime(DateUtil.getNow());
|
| | | deviceChannel.setUpdateTime(DateUtil.getNow());
|
| | | return deviceChannel;
|
| | | }
|
| | | /**
|
| | | * è¡æ¿åºåå±ç¤ºè®¾å¤æ ä¸ä¸å¡åç»å±ç¤ºè®¾å¤æ æ¯ä¸¤ç§ä¸åçæ¨¡å¼
|
| | |
| | | * æ²³åç
|
| | | * --> ç³å®¶åºå¸
|
| | | * --> æå头
|
| | | * --> æ£å®å¿
|
| | | *String parentId = XmlUtil.getText(itemDevice, "ParentID");
|
| | | if (parentId != null) {
|
| | | if (parentId.contains("/")) {
|
| | | String lastParentId = parentId.substring(parentId.lastIndexOf("/") + 1);
|
| | | String businessGroup = parentId.substring(0, parentId.indexOf("/"));
|
| | | deviceChannel.setParentId(lastParentId);
|
| | | }else {
|
| | | deviceChannel.setParentId(parentId);
|
| | | }
|
| | | }
|
| | | deviceCh --> æ£å®å¿
|
| | | * --> æå头
|
| | | * --> æå头
|
| | | *
|
| | |
| | | * --> æå头
|
| | | */
|
| | | String parentId = XmlUtil.getText(itemDevice, "ParentID");
|
| | | String businessGroupID = XmlUtil.getText(itemDevice, "BusinessGroupID");
|
| | | if (parentId != null) {
|
| | | if (parentId.contains("/")) {
|
| | | String lastParentId = parentId.substring(parentId.lastIndexOf("/") + 1);
|
| | | if (businessGroupID == null) {
|
| | | businessGroupID = parentId.substring(0, parentId.indexOf("/"));
|
| | | }
|
| | | deviceChannel.setParentId(lastParentId);
|
| | | }else {
|
| | | deviceChannel.setParentId(parentId);
|
| | | }
|
| | | }
|
| | | deviceChannel.setBusinessGroupId(businessGroupID);
|
| | | if (channelType.equals(ChannelType.BusinessGroup) || channelType.equals(ChannelType.VirtualOrganization)) {
|
| | | // ä¸å¡åç»åèæç»ç» å
¶ä»å段没å¿
è¦è¯å«äºï¼é»è®¤å¨çº¿å³å¯
|
| | | deviceChannel.setStatus(1);
|
| | | deviceChannel.setParental(1);
|
| | | deviceChannel.setCreateTime(DateUtil.getNow());
|
| | | deviceChannel.setUpdateTime(DateUtil.getNow());
|
| | | return deviceChannel;
|
| | | }
|
| | |
|
| | | // else {
|
| | | // if (deviceChannel.getChannelId().length() <= 10) { // æ¤æ¶ä¸ºè¡æ¿åºå, ä¸ä¸çº§è¡æ¿åºå使ç¨DeviceIdå
³è
|
| | | // deviceChannel.setParentId(deviceChannel.getChannelId().substring(0, deviceChannel.getChannelId().length() - 2));
|
| | | // }else if (deviceChannel.getChannelId().length() == 20) {
|
| | | // if (Integer.parseInt(deviceChannel.getChannelId().substring(10, 13)) == 216) { // èæç»ç»
|
| | | // deviceChannel.setBusinessGroupId(businessGroupID);
|
| | | // }else if (Integer.parseInt(device.getDeviceId().substring(10, 13) )== 118) {//NVR 妿ä¸çº§è®¾å¤ç¼å·æ¯NVRåç´æ¥å°NVRçç¼å·è®¾ç½®ç»ééçä¸çº§ç¼å·
|
| | | // deviceChannel.setParentId(device.getDeviceId());
|
| | | // }else if (deviceChannel.getCivilCode() != null) {
|
| | | // // 设å¤ï¼ æ parentIdç20使¯ä½¿ç¨CivilCode表示ä¸çº§ç设å¤ï¼
|
| | | // // 注ï¼215 ä¸å¡åç»æ¯éè¦æparentIdç
|
| | | // deviceChannel.setParentId(deviceChannel.getCivilCode());
|
| | | // }
|
| | | // }else {
|
| | | // deviceChannel.setParentId(deviceChannel.getDeviceId());
|
| | | // }
|
| | | // }
|
| | | Element statusElement = itemDevice.element("Status");
|
| | |
|
| | | if (XmlUtil.getText(itemDevice, "SafetyWay") == null
|
| | | || XmlUtil.getText(itemDevice, "SafetyWay") == "") {
|
| | | if (statusElement != null) {
|
| | | String status = statusElement.getTextTrim().trim();
|
| | | // ONLINE OFFLINE HIKVISION DS-7716N-E4 NVRçå
¼å®¹æ§å¤ç
|
| | | if (status.equals("ON") || status.equals("On") || status.equals("ONLINE") || status.equals("OK")) {
|
| | | deviceChannel.setStatus(1);
|
| | | }
|
| | | if (status.equals("OFF") || status.equals("Off") || status.equals("OFFLINE")) {
|
| | | deviceChannel.setStatus(0);
|
| | | }
|
| | | }else {
|
| | | deviceChannel.setStatus(1);
|
| | | }
|
| | | // è¯å«èªå¸¦çç®å½æ è¯
|
| | | String parental = XmlUtil.getText(itemDevice, "Parental");
|
| | | // ç±äºæµ·åº·ä¼é误çåé65535ä½ä¸ºè¿éçåå¼,æä»¥è¿éé¤éæ¯0å¦å认为æ¯1
|
| | | if (!StringUtils.isEmpty(parental) && parental.length() == 1 && Integer.parseInt(parental) == 0) {
|
| | | deviceChannel.setParental(0);
|
| | | }else {
|
| | | deviceChannel.setParental(1);
|
| | | }
|
| | |
|
| | |
|
| | | deviceChannel.setManufacture(XmlUtil.getText(itemDevice, "Manufacturer"));
|
| | | deviceChannel.setModel(XmlUtil.getText(itemDevice, "Model"));
|
| | | deviceChannel.setOwner(XmlUtil.getText(itemDevice, "Owner"));
|
| | | deviceChannel.setCertNum(XmlUtil.getText(itemDevice, "CertNum"));
|
| | | deviceChannel.setBlock(XmlUtil.getText(itemDevice, "Block"));
|
| | | deviceChannel.setAddress(XmlUtil.getText(itemDevice, "Address"));
|
| | | deviceChannel.setPassword(XmlUtil.getText(itemDevice, "Password"));
|
| | |
|
| | | String safetyWay = XmlUtil.getText(itemDevice, "SafetyWay");
|
| | | if (StringUtils.isEmpty(safetyWay)) {
|
| | | deviceChannel.setSafetyWay(0);
|
| | | } else {
|
| | | deviceChannel.setSafetyWay(Integer.parseInt(XmlUtil.getText(itemDevice, "SafetyWay")));
|
| | | deviceChannel.setSafetyWay(Integer.parseInt(safetyWay));
|
| | | }
|
| | | if (XmlUtil.getText(itemDevice, "RegisterWay") == null
|
| | | || XmlUtil.getText(itemDevice, "RegisterWay") == "") {
|
| | |
|
| | | String registerWay = XmlUtil.getText(itemDevice, "RegisterWay");
|
| | | if (StringUtils.isEmpty(registerWay)) {
|
| | | deviceChannel.setRegisterWay(1);
|
| | | } else {
|
| | | deviceChannel.setRegisterWay(Integer.parseInt(XmlUtil.getText(itemDevice, "RegisterWay")));
|
| | | deviceChannel.setRegisterWay(Integer.parseInt(registerWay));
|
| | | }
|
| | | deviceChannel.setCertNum(XmlUtil.getText(itemDevice, "CertNum"));
|
| | |
|
| | | if (XmlUtil.getText(itemDevice, "Certifiable") == null
|
| | | || XmlUtil.getText(itemDevice, "Certifiable") == "") {
|
| | | deviceChannel.setCertifiable(0);
|
| | | } else {
|
| | | deviceChannel.setCertifiable(Integer.parseInt(XmlUtil.getText(itemDevice, "Certifiable")));
|
| | | }
|
| | |
|
| | | if (XmlUtil.getText(itemDevice, "ErrCode") == null
|
| | | || XmlUtil.getText(itemDevice, "ErrCode") == "") {
|
| | | deviceChannel.setErrCode(0);
|
| | | } else {
|
| | | deviceChannel.setErrCode(Integer.parseInt(XmlUtil.getText(itemDevice, "ErrCode")));
|
| | | }
|
| | |
|
| | | deviceChannel.setEndTime(XmlUtil.getText(itemDevice, "EndTime"));
|
| | | deviceChannel.setSecrecy(XmlUtil.getText(itemDevice, "Secrecy"));
|
| | | deviceChannel.setIpAddress(XmlUtil.getText(itemDevice, "IPAddress"));
|
| | |
| | | } else {
|
| | | deviceChannel.setPort(Integer.parseInt(XmlUtil.getText(itemDevice, "Port")));
|
| | | }
|
| | | deviceChannel.setPassword(XmlUtil.getText(itemDevice, "Password"));
|
| | | if (NumericUtil.isDouble(XmlUtil.getText(itemDevice, "Longitude"))) {
|
| | | deviceChannel.setLongitude(Double.parseDouble(XmlUtil.getText(itemDevice, "Longitude")));
|
| | |
|
| | |
|
| | | String longitude = XmlUtil.getText(itemDevice, "Longitude");
|
| | | if (NumericUtil.isDouble(longitude)) {
|
| | | deviceChannel.setLongitude(Double.parseDouble(longitude));
|
| | | } else {
|
| | | deviceChannel.setLongitude(0.00);
|
| | | }
|
| | | if (NumericUtil.isDouble(XmlUtil.getText(itemDevice, "Latitude"))) {
|
| | | deviceChannel.setLatitude(Double.parseDouble(XmlUtil.getText(itemDevice, "Latitude")));
|
| | | String latitude = XmlUtil.getText(itemDevice, "Latitude");
|
| | | if (NumericUtil.isDouble(latitude)) {
|
| | | deviceChannel.setLatitude(Double.parseDouble(latitude));
|
| | | } else {
|
| | | deviceChannel.setLatitude(0.00);
|
| | | }
|
| | | deviceChannel.setGpsTime(DateUtil.getNow());
|
| | | if (deviceChannel.getLongitude()*deviceChannel.getLatitude() > 0) {
|
| | | if ("WGS84".equals(device.getGeoCoordSys())) {
|
| | | deviceChannel.setLongitudeWgs84(deviceChannel.getLongitude());
|
| | | deviceChannel.setLatitudeWgs84(deviceChannel.getLatitude());
|
| | | Double[] position = Coordtransform.WGS84ToGCJ02(deviceChannel.getLongitude(), deviceChannel.getLatitude());
|
| | | deviceChannel.setLongitudeGcj02(position[0]);
|
| | | deviceChannel.setLatitudeGcj02(position[1]);
|
| | | }else if ("GCJ02".equals(device.getGeoCoordSys())) {
|
| | | deviceChannel.setLongitudeGcj02(deviceChannel.getLongitude());
|
| | | deviceChannel.setLatitudeGcj02(deviceChannel.getLatitude());
|
| | | Double[] position = Coordtransform.GCJ02ToWGS84(deviceChannel.getLongitude(), deviceChannel.getLatitude());
|
| | | deviceChannel.setLongitudeWgs84(position[0]);
|
| | | deviceChannel.setLatitudeWgs84(position[1]);
|
| | | }else {
|
| | | deviceChannel.setLongitudeGcj02(0.00);
|
| | | deviceChannel.setLatitudeGcj02(0.00);
|
| | | deviceChannel.setLongitudeWgs84(0.00);
|
| | | deviceChannel.setLatitudeWgs84(0.00);
|
| | | }
|
| | | }else {
|
| | | deviceChannel.setLongitudeGcj02(deviceChannel.getLongitude());
|
| | | deviceChannel.setLatitudeGcj02(deviceChannel.getLatitude());
|
| | | deviceChannel.setLongitudeWgs84(deviceChannel.getLongitude());
|
| | | deviceChannel.setLatitudeWgs84(deviceChannel.getLatitude());
|
| | | }
|
| | |
|
| | |
|
| | | if (XmlUtil.getText(itemDevice, "PTZType") == null || "".equals(XmlUtil.getText(itemDevice, "PTZType"))) {
|
| | | //å
¼å®¹INFOä¸çä¿¡æ¯
|
| | | Element info = itemDevice.element("Info");
|
| | |
| | | return sendGet(mediaServerItem, "api/record/file/duration",param, callback); |
| | | } |
| | | |
| | | public JSONObject addStreamCallInfo(MediaServerItem mediaServerItem, String app, String stream, String callId, RequestCallback callback){ |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("app",app); |
| | | param.put("stream",stream); |
| | | param.put("callId",callId); |
| | | return sendGet(mediaServerItem, "api/record/addStreamCallInfo",param, callback); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.genersoft.iot.vmp.media.zlm;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import com.alibaba.fastjson.JSON;
|
| | | import com.genersoft.iot.vmp.common.StreamInfo;
|
| | |
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.http.HttpStatus;
|
| | | import org.springframework.http.ResponseEntity;
|
| | | import org.springframework.util.StringUtils;
|
| | | import org.springframework.web.bind.annotation.PostMapping;
|
| | | import org.springframework.web.bind.annotation.RequestBody;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | |
| | | private UserSetting userSetting;
|
| | |
|
| | | @Autowired
|
| | | private IUserService userService;
|
| | |
|
| | | @Autowired
|
| | | private VideoStreamSessionManager sessionManager;
|
| | |
|
| | | @Autowired
|
| | | private AssistRESTfulUtils assistRESTfulUtils;
|
| | |
|
| | | /**
|
| | | * æå¡å¨å®æ¶ä¸æ¥æ¶é´ï¼ä¸æ¥é´éå¯é
ç½®ï¼é»è®¤10s䏿¥ä¸æ¬¡
|
| | |
| | | */
|
| | | @ResponseBody
|
| | | @PostMapping(value = "/on_play", produces = "application/json;charset=UTF-8")
|
| | | public ResponseEntity<String> onPlay(@RequestBody JSONObject json){
|
| | | |
| | | public ResponseEntity<String> onPlay(@RequestBody OnPlayHookParam param){
|
| | |
|
| | | JSONObject json = (JSONObject)JSON.toJSON(param);
|
| | |
|
| | | if (logger.isDebugEnabled()) {
|
| | | logger.debug("[ ZLM HOOK ]on_play APIè°ç¨ï¼åæ°ï¼" + json.toString());
|
| | | logger.debug("[ ZLM HOOK ]on_play APIè°ç¨ï¼åæ°ï¼" + JSON.toJSONString(param));
|
| | | }
|
| | | String mediaServerId = json.getString("mediaServerId");
|
| | | String mediaServerId = param.getMediaServerId();
|
| | | ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_play, json);
|
| | | if (subscribe != null ) {
|
| | | MediaServerItem mediaInfo = mediaServerService.getOne(mediaServerId);
|
| | |
| | | }
|
| | | }
|
| | | JSONObject ret = new JSONObject();
|
| | | if (!"rtp".equals(param.getApp())) {
|
| | | Map<String, String> paramMap = urlParamToMap(param.getParams());
|
| | | StreamAuthorityInfo streamAuthorityInfo = redisCatchStorage.getStreamAuthorityInfo(param.getApp(), param.getStream());
|
| | | if (streamAuthorityInfo == null
|
| | | || (streamAuthorityInfo.getCallId() != null && !streamAuthorityInfo.getCallId().equals(paramMap.get("callId")))) {
|
| | | ret.put("code", 401);
|
| | | ret.put("msg", "Unauthorized");
|
| | | return new ResponseEntity<>(ret.toString(),HttpStatus.OK);
|
| | | }
|
| | | }
|
| | |
|
| | | ret.put("code", 0);
|
| | | ret.put("msg", "success");
|
| | | return new ResponseEntity<String>(ret.toString(),HttpStatus.OK);
|
| | | return new ResponseEntity<>(ret.toString(),HttpStatus.OK);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | */
|
| | | @ResponseBody
|
| | | @PostMapping(value = "/on_publish", produces = "application/json;charset=UTF-8")
|
| | | public ResponseEntity<String> onPublish(@RequestBody JSONObject json) {
|
| | | public ResponseEntity<String> onPublish(@RequestBody OnPublishHookParam param) {
|
| | |
|
| | | JSONObject json = (JSONObject) JSON.toJSON(param);
|
| | |
|
| | | logger.info("[ ZLM HOOK ]on_publish APIè°ç¨ï¼åæ°ï¼" + json.toString());
|
| | | JSONObject ret = new JSONObject();
|
| | | String mediaServerId = json.getString("mediaServerId");
|
| | | MediaServerItem mediaInfo = mediaServerService.getOne(mediaServerId);
|
| | | if (!"rtp".equals(param.getApp())) {
|
| | | // æ¨æµé´æ
|
| | | if (param.getParams() == null) {
|
| | | logger.info("æ¨æµé´æå¤±è´¥ï¼ 缺å°ä¸è¦åæ°ï¼sign=md5(user表çpushKey)");
|
| | | ret.put("code", 401);
|
| | | ret.put("msg", "Unauthorized");
|
| | | return new ResponseEntity<>(ret.toString(), HttpStatus.OK);
|
| | | }
|
| | | Map<String, String> paramMap = urlParamToMap(param.getParams());
|
| | | String sign = paramMap.get("sign");
|
| | | if (sign == null) {
|
| | | logger.info("æ¨æµé´æå¤±è´¥ï¼ 缺å°ä¸è¦åæ°ï¼sign=md5(user表çpushKey)");
|
| | | ret.put("code", 401);
|
| | | ret.put("msg", "Unauthorized");
|
| | | return new ResponseEntity<>(ret.toString(), HttpStatus.OK);
|
| | | }
|
| | | // æ¨æµèªå®ä¹ææ¾é´æç
|
| | | String callId = paramMap.get("callId");
|
| | | // é´æé
ç½®
|
| | | boolean hasAuthority = userService.checkPushAuthority(callId, sign);
|
| | | if (!hasAuthority) {
|
| | | logger.info("æ¨æµé´æå¤±è´¥ï¼ sign æ æé: callId={}. sign={}", callId, sign);
|
| | | ret.put("code", 401);
|
| | | ret.put("msg", "Unauthorized");
|
| | | return new ResponseEntity<>(ret.toString(), HttpStatus.OK);
|
| | | }
|
| | | StreamAuthorityInfo streamAuthorityInfo = StreamAuthorityInfo.getInstanceByHook(param);
|
| | | streamAuthorityInfo.setCallId(callId);
|
| | | streamAuthorityInfo.setSign(sign);
|
| | | // é´æéè¿
|
| | | redisCatchStorage.updateStreamAuthorityInfo(param.getApp(), param.getStream(), streamAuthorityInfo);
|
| | | // éç¥assistæ°çcallId
|
| | | if (mediaInfo != null) {
|
| | | assistRESTfulUtils.addStreamCallInfo(mediaInfo, param.getApp(), param.getStream(), callId, null);
|
| | | }
|
| | | }
|
| | |
|
| | | ret.put("code", 0);
|
| | | ret.put("msg", "success");
|
| | | ret.put("enable_hls", true);
|
| | | if (json.getInteger("originType") == 1
|
| | | || json.getInteger("originType") == 2
|
| | | || json.getInteger("originType") == 3) {
|
| | | if (!"rtp".equals(param.getApp())) {
|
| | | ret.put("enable_audio", true);
|
| | | }
|
| | |
|
| | | String mediaServerId = json.getString("mediaServerId");
|
| | |
|
| | | ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_publish, json);
|
| | | if (subscribe != null) {
|
| | | MediaServerItem mediaInfo = mediaServerService.getOne(mediaServerId);
|
| | | if (mediaInfo != null) {
|
| | | subscribe.response(mediaInfo, json);
|
| | | }else {
|
| | |
| | | ret.put("msg", "zlm not register");
|
| | | }
|
| | | }
|
| | | String app = json.getString("app");
|
| | | String stream = json.getString("stream");
|
| | | if ("rtp".equals(app)) {
|
| | |
|
| | | if ("rtp".equals(param.getApp())) {
|
| | | ret.put("enable_mp4", userSetting.getRecordSip());
|
| | | }else {
|
| | | ret.put("enable_mp4", userSetting.isRecordPushLive());
|
| | | }
|
| | | List<SsrcTransaction> ssrcTransactionForAll = sessionManager.getSsrcTransactionForAll(null, null, null, stream);
|
| | | List<SsrcTransaction> ssrcTransactionForAll = sessionManager.getSsrcTransactionForAll(null, null, null, param.getStream());
|
| | | if (ssrcTransactionForAll != null && ssrcTransactionForAll.size() == 1) {
|
| | | String deviceId = ssrcTransactionForAll.get(0).getDeviceId();
|
| | | String channelId = ssrcTransactionForAll.get(0).getChannelId();
|
| | |
| | | ret.put("mp4_max_second", 10);
|
| | | ret.put("enable_mp4", true);
|
| | | ret.put("enable_audio", true);
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | return new ResponseEntity<String>(ret.toString(), HttpStatus.OK);
|
| | | }
|
| | | |
| | |
|
| | |
|
| | |
|
| | | /**
|
| | | * å½å¶mp4宿åéç¥äºä»¶ï¼æ¤äºä»¶å¯¹åå¤ä¸ææã
|
| | | *
|
| | |
| | | if (logger.isDebugEnabled()) {
|
| | | logger.debug("[ ZLM HOOK ]on_shell_login APIè°ç¨ï¼åæ°ï¼" + json.toString());
|
| | | }
|
| | | // TODO 妿æ¯å¸¦ærtpstreamåå¼å¯æéææµ
|
| | | // String app = json.getString("app");
|
| | | // String stream = json.getString("stream");
|
| | | String mediaServerId = json.getString("mediaServerId");
|
| | | ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_shell_login, json);
|
| | | if (subscribe != null ) {
|
| | |
| | | }
|
| | | // æµæ¶å¤±ç§»é¤redis play
|
| | | String app = item.getApp();
|
| | | String streamId = item.getStream();
|
| | | String stream = item.getStream();
|
| | | String schema = item.getSchema();
|
| | | List<MediaItem.MediaTrack> tracks = item.getTracks();
|
| | | boolean regist = item.isRegist();
|
| | | if (regist) {
|
| | | StreamAuthorityInfo streamAuthorityInfo = redisCatchStorage.getStreamAuthorityInfo(app, stream);
|
| | | if (streamAuthorityInfo == null) {
|
| | | streamAuthorityInfo = StreamAuthorityInfo.getInstanceByHook(item);
|
| | | }else {
|
| | | streamAuthorityInfo.setOriginType(item.getOriginType());
|
| | | streamAuthorityInfo.setOriginTypeStr(item.getOriginTypeStr());
|
| | | }
|
| | | redisCatchStorage.updateStreamAuthorityInfo(app, stream, streamAuthorityInfo);
|
| | | }else {
|
| | | redisCatchStorage.removeStreamAuthorityInfo(app, stream);
|
| | | }
|
| | | if ("rtmp".equals(schema)){
|
| | | logger.info("on_stream_changedï¼æ³¨å->{}, app->{}, stream->{}", regist, app, streamId);
|
| | | logger.info("on_stream_changedï¼æ³¨å->{}, app->{}, stream->{}", regist, app, stream);
|
| | | if (regist) {
|
| | | mediaServerService.addCount(mediaServerId);
|
| | | }else {
|
| | |
| | | if (item.getOriginType() == OriginType.PULL.ordinal()
|
| | | || item.getOriginType() == OriginType.FFMPEG_PULL.ordinal()) {
|
| | | // è®¾ç½®ææµä»£çä¸çº¿/离线
|
| | | streamProxyService.updateStatus(regist, app, streamId);
|
| | | streamProxyService.updateStatus(regist, app, stream);
|
| | | }
|
| | | if ("rtp".equals(app) && !regist ) {
|
| | | StreamInfo streamInfo = redisCatchStorage.queryPlayByStreamId(streamId);
|
| | | StreamInfo streamInfo = redisCatchStorage.queryPlayByStreamId(stream);
|
| | | if (streamInfo!=null){
|
| | | redisCatchStorage.stopPlay(streamInfo);
|
| | | storager.stopPlay(streamInfo.getDeviceID(), streamInfo.getChannelId());
|
| | | }else{
|
| | | streamInfo = redisCatchStorage.queryPlayback(null, null, streamId, null);
|
| | | streamInfo = redisCatchStorage.queryPlayback(null, null, stream, null);
|
| | | if (streamInfo != null) {
|
| | | redisCatchStorage.stopPlayback(streamInfo.getDeviceID(), streamInfo.getChannelId(),
|
| | | streamInfo.getStream(), null);
|
| | |
| | |
|
| | | if (mediaServerItem != null){
|
| | | if (regist) {
|
| | | StreamInfo streamInfoByAppAndStream = mediaService.getStreamInfoByAppAndStream(mediaServerItem, app, streamId, tracks);
|
| | | StreamAuthorityInfo streamAuthorityInfo = redisCatchStorage.getStreamAuthorityInfo(app, stream);
|
| | | StreamInfo streamInfoByAppAndStream = mediaService.getStreamInfoByAppAndStream(mediaServerItem,
|
| | | app, stream, tracks, streamAuthorityInfo.getCallId());
|
| | | item.setStreamInfo(streamInfoByAppAndStream);
|
| | |
|
| | | redisCatchStorage.addStream(mediaServerItem, type, app, streamId, item);
|
| | | item.setSeverId(userSetting.getServerId());
|
| | | redisCatchStorage.addStream(mediaServerItem, type, app, stream, item);
|
| | | if (item.getOriginType() == OriginType.RTSP_PUSH.ordinal()
|
| | | || item.getOriginType() == OriginType.RTMP_PUSH.ordinal()
|
| | | || item.getOriginType() == OriginType.RTC_PUSH.ordinal() ) {
|
| | |
| | |
|
| | | }else {
|
| | | // å
¼å®¹æµæ³¨éæ¶ç±»åä»redisè®°å½è·å
|
| | | MediaItem mediaItem = redisCatchStorage.getStreamInfo(app, streamId, mediaServerId);
|
| | | MediaItem mediaItem = redisCatchStorage.getStreamInfo(app, stream, mediaServerId);
|
| | | if (mediaItem != null) {
|
| | | type = OriginType.values()[mediaItem.getOriginType()].getType();
|
| | | redisCatchStorage.removeStream(mediaServerItem.getId(), type, app, streamId);
|
| | | redisCatchStorage.removeStream(mediaServerItem.getId(), type, app, stream);
|
| | | }
|
| | | GbStream gbStream = storager.getGbStream(app, streamId);
|
| | | GbStream gbStream = storager.getGbStream(app, stream);
|
| | | if (gbStream != null) {
|
| | | // eventPublisher.catalogEventPublishForStream(null, gbStream, CatalogEvent.OFF);
|
| | | }
|
| | | zlmMediaListManager.removeMedia(app, streamId);
|
| | | zlmMediaListManager.removeMedia(app, stream);
|
| | | }
|
| | | if (type != null) {
|
| | | // åéæµååredisæ¶æ¯
|
| | | JSONObject jsonObject = new JSONObject();
|
| | | jsonObject.put("serverId", userSetting.getServerId());
|
| | | jsonObject.put("app", app);
|
| | | jsonObject.put("stream", streamId);
|
| | | jsonObject.put("stream", stream);
|
| | | jsonObject.put("register", regist);
|
| | | jsonObject.put("mediaServerId", mediaServerId);
|
| | | redisCatchStorage.sendStreamChangeMsg(type, jsonObject);
|
| | |
| | | ret.put("msg", "success");
|
| | | return new ResponseEntity<String>(ret.toString(),HttpStatus.OK);
|
| | | }
|
| | |
|
| | | private Map<String, String> urlParamToMap(String params) {
|
| | | HashMap<String, String> map = new HashMap<>();
|
| | | if (StringUtils.isEmpty(params)) {
|
| | | return map;
|
| | | }
|
| | | String[] paramsArray = params.split("&");
|
| | | if (paramsArray.length == 0) {
|
| | | return map;
|
| | | }
|
| | | for (String param : paramsArray) {
|
| | | String[] paramArray = param.split("=");
|
| | | if (paramArray.length == 2){
|
| | | map.put(paramArray[0], paramArray[1]);
|
| | | }
|
| | | }
|
| | | return map;
|
| | | }
|
| | | }
|
| | |
| | | public StreamPushItem addPush(MediaItem mediaItem) { |
| | | // æ¥æ¾æ¤ç´ææµæ¯å¦åå¨redisé¢è®¾gbId |
| | | StreamPushItem transform = streamPushService.transform(mediaItem); |
| | | // ä»streamIdååºæ¥è¯¢å
³é®å¼ |
| | | Pattern pattern = Pattern.compile(userSetting.getThirdPartyGBIdReg()); |
| | | Matcher matcher = pattern.matcher(mediaItem.getStream());// æå®è¦å¹é
çå符串 |
| | | String queryKey = null; |
| | | if (matcher.find()) { //æ¤å¤findï¼ï¼æ¯æ¬¡è¢«è°ç¨åï¼ä¼åç§»å°ä¸ä¸ä¸ªå¹é
|
| | | queryKey = matcher.group(); |
| | | StreamPushItem pushInDb = streamPushService.getPush(mediaItem.getApp(), mediaItem.getStream()); |
| | | transform.setPushIng(true); |
| | | transform.setUpdateTime(DateUtil.getNow()); |
| | | transform.setPushTime(DateUtil.getNow()); |
| | | if (pushInDb == null) { |
| | | transform.setCreateTime(DateUtil.getNow()); |
| | | streamPushMapper.add(transform); |
| | | }else { |
| | | streamPushMapper.update(transform); |
| | | } |
| | | if (queryKey != null) { |
| | | ThirdPartyGB thirdPartyGB = redisCatchStorage.queryMemberNoGBId(queryKey); |
| | | if (thirdPartyGB != null && !StringUtils.isEmpty(thirdPartyGB.getNationalStandardNo())) { |
| | | transform.setGbId(thirdPartyGB.getNationalStandardNo()); |
| | | transform.setName(thirdPartyGB.getName()); |
| | | } |
| | | } |
| | | if (!StringUtils.isEmpty(transform.getGbId())) { |
| | | // 妿è¿ä¸ªå½æ IDå·²ç»ç»äºå
¶ä»æ¨æµä¸æµå·²ç¦»çº¿ï¼åç§»é¤å
¶ä»æ¨æµ |
| | | List<GbStream> gbStreams = gbStreamMapper.selectByGBId(transform.getGbId()); |
| | | if (gbStreams.size() > 0) { |
| | | for (GbStream gbStream : gbStreams) { |
| | | // åºç°ä½¿ç¨ç¸å彿 Idçè§é¢æµæ¶ï¼ä½¿ç¨æ°æµæ¿æ¢æ§æµï¼ |
| | | if (queryKey != null && gbStream.getApp().equals(mediaItem.getApp())) { |
| | | Matcher matcherForStream = pattern.matcher(gbStream.getStream()); |
| | | String queryKeyForStream = null; |
| | | if (matcherForStream.find()) { //æ¤å¤findï¼ï¼æ¯æ¬¡è¢«è°ç¨åï¼ä¼åç§»å°ä¸ä¸ä¸ªå¹é
|
| | | queryKeyForStream = matcherForStream.group(); |
| | | } |
| | | if (queryKeyForStream == null || !queryKeyForStream.equals(queryKey)) { |
| | | // æ¤æ¶ä¸æ¯åä¸ä¸ªæµ |
| | | gbStreamMapper.del(gbStream.getApp(), gbStream.getStream()); |
| | | if (!gbStream.isStatus()) { |
| | | streamPushMapper.del(gbStream.getApp(), gbStream.getStream()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | List<GbStream> gbStreamList = gbStreamMapper.selectByGBId(transform.getGbId()); |
| | | if (gbStreamList != null && gbStreamList.size() == 1) { |
| | | transform.setGbStreamId(gbStreamList.get(0).getGbStreamId()); |
| | | transform.setPlatformId(gbStreamList.get(0).getPlatformId()); |
| | | transform.setCatalogId(gbStreamList.get(0).getCatalogId()); |
| | | transform.setGbId(gbStreamList.get(0).getGbId()); |
| | | gbStreamMapper.update(transform); |
| | | streamPushMapper.del(gbStreamList.get(0).getApp(), gbStreamList.get(0).getStream()); |
| | | }else { |
| | | transform.setCreateTime(DateUtil.getNow()); |
| | | transform.setUpdateTime(DateUtil.getNow()); |
| | | gbStreamMapper.add(transform); |
| | | } |
| | | if (transform != null) { |
| | | if (channelOnlineEvents.get(transform.getGbId()) != null) { |
| | | channelOnlineEvents.get(transform.getGbId()).run(transform.getApp(), transform.getStream(), transform.getServerId()); |
| | | channelOnlineEvents.remove(transform.getGbId()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | storager.updateMedia(transform); |
| | | return transform; |
| | | } |
| | | |
| | |
| | | |
| | | public int removeMedia(String app, String streamId) { |
| | | // æ¥æ¾æ¯å¦å
³èäºå½æ ï¼ å
³èäºä¸å é¤ï¼ 置为离线 |
| | | StreamProxyItem streamProxyItem = gbStreamMapper.selectOne(app, streamId); |
| | | int result = 0; |
| | | if (streamProxyItem == null) { |
| | | GbStream gbStream = gbStreamMapper.selectOne(app, streamId); |
| | | int result; |
| | | if (gbStream == null) { |
| | | result = storager.removeMedia(app, streamId); |
| | | }else { |
| | | // TODO æä¸è®¾ç½®ä¸ºç¦»çº¿ |
| | | result =storager.mediaOutline(app, streamId); |
| | | result =storager.mediaOffline(app, streamId); |
| | | } |
| | | return result; |
| | | } |
| | |
| | | String stream = UUID.randomUUID().toString(); |
| | | param.put("enable_tcp", 1); |
| | | param.put("stream_id", stream); |
| | | param.put("port", 0); |
| | | // param.put("port", 0); |
| | | JSONObject openRtpServerResultJson = zlmresTfulUtils.openRtpServer(mediaServerItem, param); |
| | | |
| | | if (openRtpServerResultJson != null) { |
| | |
| | | } |
| | | |
| | | Map<String, Object> param = new HashMap<>(); |
| | | // æ¨æµç«¯å£è®¾ç½®0å使ç¨éæºç«¯å£ |
| | | |
| | | param.put("enable_tcp", 1); |
| | | param.put("stream_id", streamId); |
| | | // æ¨æµç«¯å£è®¾ç½®0å使ç¨éæºç«¯å£ |
| | | param.put("port", 0); |
| | | param.put("ssrc", ssrc); |
| | | JSONObject openRtpServerResultJson = zlmresTfulUtils.openRtpServer(mediaServerItem, param); |
| | |
| | | logger.warn("æ¥è¯¢æµ({}/{})æ¯å¦æå
¶å®è§çè
æ¶å¾å°ï¼ {}", app, streamId, mediaInfo.getString("msg")); |
| | | return -1; |
| | | } |
| | | if ( code == 0 && ! mediaInfo.getBoolean("online")) { |
| | | if ( code == 0 && mediaInfo.getBoolean("online") != null && !mediaInfo.getBoolean("online")) { |
| | | logger.warn("æ¥è¯¢æµ({}/{})æ¯å¦æå
¶å®è§çè
æ¶å¾å°ï¼ {}", app, streamId, mediaInfo.getString("msg")); |
| | | return -1; |
| | | } |
New file |
| | |
| | | package com.genersoft.iot.vmp.media.zlm.dto; |
| | | |
| | | /** |
| | | * zlm hookäºä»¶çåæ° |
| | | * @author lin |
| | | */ |
| | | public class HookParam { |
| | | private String mediaServerId; |
| | | |
| | | public String getMediaServerId() { |
| | | return mediaServerId; |
| | | } |
| | | |
| | | public void setMediaServerId(String mediaServerId) { |
| | | this.mediaServerId = mediaServerId; |
| | | } |
| | | } |
| | |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author lin |
| | | */ |
| | | public class MediaItem { |
| | | |
| | | /** |
| | |
| | | * æµid |
| | | */ |
| | | private String stream; |
| | | |
| | | /** |
| | | * æ¨æµé´æId |
| | | */ |
| | | private String callId; |
| | | |
| | | /** |
| | | * è§çæ»äººæ°ï¼å
æ¬hls/rtsp/rtmp/http-flv/ws-flv |
| | |
| | | public void setSeverId(String severId) { |
| | | this.severId = severId; |
| | | } |
| | | |
| | | public String getCallId() { |
| | | return callId; |
| | | } |
| | | |
| | | public void setCallId(String callId) { |
| | | this.callId = callId; |
| | | } |
| | | } |
New file |
| | |
| | | package com.genersoft.iot.vmp.media.zlm.dto; |
| | | |
| | | /** |
| | | * zlm hookäºä»¶ä¸çon_playäºä»¶çåæ° |
| | | * @author lin |
| | | */ |
| | | public class OnPlayHookParam extends HookParam{ |
| | | private String id; |
| | | private String app; |
| | | private String stream; |
| | | private String ip; |
| | | private String params; |
| | | private int port; |
| | | private String schema; |
| | | private String vhost; |
| | | |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getApp() { |
| | | return app; |
| | | } |
| | | |
| | | public void setApp(String app) { |
| | | this.app = app; |
| | | } |
| | | |
| | | public String getStream() { |
| | | return stream; |
| | | } |
| | | |
| | | public void setStream(String stream) { |
| | | this.stream = stream; |
| | | } |
| | | |
| | | public String getIp() { |
| | | return ip; |
| | | } |
| | | |
| | | public void setIp(String ip) { |
| | | this.ip = ip; |
| | | } |
| | | |
| | | public String getParams() { |
| | | return params; |
| | | } |
| | | |
| | | public void setParams(String params) { |
| | | this.params = params; |
| | | } |
| | | |
| | | public int getPort() { |
| | | return port; |
| | | } |
| | | |
| | | public void setPort(int port) { |
| | | this.port = port; |
| | | } |
| | | |
| | | public String getSchema() { |
| | | return schema; |
| | | } |
| | | |
| | | public void setSchema(String schema) { |
| | | this.schema = schema; |
| | | } |
| | | |
| | | public String getVhost() { |
| | | return vhost; |
| | | } |
| | | |
| | | public void setVhost(String vhost) { |
| | | this.vhost = vhost; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.genersoft.iot.vmp.media.zlm.dto; |
| | | |
| | | /** |
| | | * zlm hookäºä»¶ä¸çon_publishäºä»¶çåæ° |
| | | * @author lin |
| | | */ |
| | | public class OnPublishHookParam extends HookParam{ |
| | | private String id; |
| | | private String app; |
| | | private String stream; |
| | | private String ip; |
| | | private String params; |
| | | private int port; |
| | | private String schema; |
| | | private String vhost; |
| | | |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getApp() { |
| | | return app; |
| | | } |
| | | |
| | | public void setApp(String app) { |
| | | this.app = app; |
| | | } |
| | | |
| | | public String getStream() { |
| | | return stream; |
| | | } |
| | | |
| | | public void setStream(String stream) { |
| | | this.stream = stream; |
| | | } |
| | | |
| | | public String getIp() { |
| | | return ip; |
| | | } |
| | | |
| | | public void setIp(String ip) { |
| | | this.ip = ip; |
| | | } |
| | | |
| | | public String getParams() { |
| | | return params; |
| | | } |
| | | |
| | | public void setParams(String params) { |
| | | this.params = params; |
| | | } |
| | | |
| | | public int getPort() { |
| | | return port; |
| | | } |
| | | |
| | | public void setPort(int port) { |
| | | this.port = port; |
| | | } |
| | | |
| | | public String getSchema() { |
| | | return schema; |
| | | } |
| | | |
| | | public void setSchema(String schema) { |
| | | this.schema = schema; |
| | | } |
| | | |
| | | public String getVhost() { |
| | | return vhost; |
| | | } |
| | | |
| | | public void setVhost(String vhost) { |
| | | this.vhost = vhost; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.genersoft.iot.vmp.media.zlm.dto; |
| | | |
| | | /** |
| | | * æµçé´æä¿¡æ¯ |
| | | * @author lin |
| | | */ |
| | | public class StreamAuthorityInfo { |
| | | |
| | | private String id; |
| | | private String app; |
| | | private String stream; |
| | | |
| | | /** |
| | | * äº§çæºç±»åï¼ |
| | | * unknown = 0, |
| | | * rtmp_push=1, |
| | | * rtsp_push=2, |
| | | * rtp_push=3, |
| | | * pull=4, |
| | | * ffmpeg_pull=5, |
| | | * mp4_vod=6, |
| | | * device_chn=7 |
| | | */ |
| | | private int originType; |
| | | |
| | | /** |
| | | * äº§çæºç±»åçå符串æè¿° |
| | | */ |
| | | private String originTypeStr; |
| | | |
| | | /** |
| | | * æ¨æµæ¶èªå®ä¹çææ¾é´æID |
| | | */ |
| | | private String callId; |
| | | |
| | | /** |
| | | * æ¨æµçé´æç¾å |
| | | */ |
| | | private String sign; |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getApp() { |
| | | return app; |
| | | } |
| | | |
| | | public void setApp(String app) { |
| | | this.app = app; |
| | | } |
| | | |
| | | public String getStream() { |
| | | return stream; |
| | | } |
| | | |
| | | public void setStream(String stream) { |
| | | this.stream = stream; |
| | | } |
| | | |
| | | public int getOriginType() { |
| | | return originType; |
| | | } |
| | | |
| | | public void setOriginType(int originType) { |
| | | this.originType = originType; |
| | | } |
| | | |
| | | public String getOriginTypeStr() { |
| | | return originTypeStr; |
| | | } |
| | | |
| | | public void setOriginTypeStr(String originTypeStr) { |
| | | this.originTypeStr = originTypeStr; |
| | | } |
| | | |
| | | public String getCallId() { |
| | | return callId; |
| | | } |
| | | |
| | | public void setCallId(String callId) { |
| | | this.callId = callId; |
| | | } |
| | | |
| | | public String getSign() { |
| | | return sign; |
| | | } |
| | | |
| | | public void setSign(String sign) { |
| | | this.sign = sign; |
| | | } |
| | | |
| | | public static StreamAuthorityInfo getInstanceByHook(OnPublishHookParam hookParam) { |
| | | StreamAuthorityInfo streamAuthorityInfo = new StreamAuthorityInfo(); |
| | | streamAuthorityInfo.setApp(hookParam.getApp()); |
| | | streamAuthorityInfo.setStream(hookParam.getStream()); |
| | | streamAuthorityInfo.setId(hookParam.getId()); |
| | | return streamAuthorityInfo; |
| | | } |
| | | |
| | | public static StreamAuthorityInfo getInstanceByHook(MediaItem mediaItem) { |
| | | StreamAuthorityInfo streamAuthorityInfo = new StreamAuthorityInfo(); |
| | | streamAuthorityInfo.setApp(mediaItem.getApp()); |
| | | streamAuthorityInfo.setStream(mediaItem.getStream()); |
| | | streamAuthorityInfo.setId(mediaItem.getMediaServerId()); |
| | | streamAuthorityInfo.setOriginType(mediaItem.getOriginType()); |
| | | streamAuthorityInfo.setOriginTypeStr(mediaItem.getOriginTypeStr()); |
| | | return streamAuthorityInfo; |
| | | } |
| | | } |
| | |
| | | */ |
| | | private String createTime; |
| | | |
| | | /** |
| | | * æ¯å¦æ£å¨æ¨æµ |
| | | */ |
| | | private boolean pushIng; |
| | | |
| | | public String getVhost() { |
| | | return vhost; |
| | | } |
| | |
| | | public void setCreateTime(String createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public boolean isPushIng() { |
| | | return pushIng; |
| | | } |
| | | |
| | | public void setPushIng(boolean pushIng) { |
| | | this.pushIng = pushIng; |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.genersoft.iot.vmp.service; |
| | | |
| | | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| | | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 彿 ééä¸å¡ç±» |
| | | * @author lin |
| | | */ |
| | | public interface IDeviceChannelService { |
| | | |
| | | /** |
| | | * æ´æ°gpsä¿¡æ¯ |
| | | */ |
| | | DeviceChannel updateGps(DeviceChannel deviceChannel, Device device); |
| | | |
| | | /** |
| | | * æ·»å 设å¤éé |
| | | * |
| | | * @param deviceId 设å¤id |
| | | * @param channel éé |
| | | */ |
| | | void updateChannel(String deviceId, DeviceChannel channel); |
| | | |
| | | /** |
| | | * æ¹éæ·»å 设å¤éé |
| | | * |
| | | * @param deviceId 设å¤id |
| | | * @param channels å¤ä¸ªéé |
| | | */ |
| | | int updateChannels(String deviceId, List<DeviceChannel> channels); |
| | | |
| | | } |
| | |
| | | * @param count |
| | | * @return |
| | | */ |
| | | PageInfo<GbStream> getAll(Integer page, Integer count, String platFormId, String catalogId,String query,Boolean pushing,String mediaServerId); |
| | | PageInfo<GbStream> getAll(Integer page, Integer count, String platFormId, String catalogId,String query,String mediaServerId); |
| | | |
| | | |
| | | /** |
| | |
| | | * @param stream |
| | | * @return |
| | | */ |
| | | StreamInfo getStreamInfoByAppAndStreamWithCheck(String app, String stream, String mediaServerId,String addr); |
| | | StreamInfo getStreamInfoByAppAndStreamWithCheck(String app, String stream, String mediaServerId,String addr, boolean authority); |
| | | |
| | | |
| | | /** |
| | |
| | | * @param stream |
| | | * @return |
| | | */ |
| | | StreamInfo getStreamInfoByAppAndStreamWithCheck(String app, String stream, String mediaServerId); |
| | | StreamInfo getStreamInfoByAppAndStreamWithCheck(String app, String stream, String mediaServerId, boolean authority); |
| | | |
| | | /** |
| | | * æ ¹æ®åºç¨ååæµIDè·åææ¾å°å, åªæ¯å°åæ¼æ¥ |
| | |
| | | * @param stream |
| | | * @return |
| | | */ |
| | | StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaServerItem, String app, String stream, Object tracks); |
| | | StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaServerItem, String app, String stream, Object tracks, String callId); |
| | | |
| | | /** |
| | | * æ ¹æ®åºç¨ååæµIDè·åææ¾å°å, åªæ¯å°åæ¼æ¥ï¼è¿åçip使ç¨è¿ç¨è®¿é®ipï¼éç¨ä¸zlmä¸wvpå¨ä¸å°ä¸»æºçæ
åµ |
| | |
| | | * @param stream |
| | | * @return |
| | | */ |
| | | StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaInfo, String app, String stream, Object tracks, String addr); |
| | | StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaInfo, String app, String stream, Object tracks, String addr, String callId); |
| | | } |
New file |
| | |
| | | package com.genersoft.iot.vmp.service; |
| | | |
| | | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * å¹³å°å
³èéé管ç |
| | | * @author lin |
| | | */ |
| | | public interface IPlatformChannelService { |
| | | |
| | | /** |
| | | * æ´æ°ç®å½ä¸çéé |
| | | * @param platformId å¹³å°ç¼å· |
| | | * @param channelReduces ééä¿¡æ¯ |
| | | * @param catalogId ç®å½ç¼å· |
| | | * @return |
| | | */ |
| | | int updateChannelForGB(String platformId, List<ChannelReduce> channelReduces, String catalogId); |
| | | |
| | | } |
| | |
| | | void zlmServerOffline(String mediaServerId); |
| | | |
| | | void clean(); |
| | | |
| | | /** |
| | | * æ´æ°ä»£çæµ |
| | | */ |
| | | boolean updateStreamProxy(StreamProxyItem streamProxyItem); |
| | | } |
| | |
| | | import com.genersoft.iot.vmp.media.zlm.dto.MediaItem; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; |
| | | import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis; |
| | | import com.genersoft.iot.vmp.vmanager.bean.StreamPushExcelDto; |
| | | import com.github.pagehelper.PageInfo; |
| | | |
| | |
| | | * 忢ä¸è·¯æ¨æµ |
| | | * @param app åºç¨å |
| | | * @param streamId æµID |
| | | * @return |
| | | */ |
| | | boolean stop(String app, String streamId); |
| | | |
| | | /** |
| | | * æ°çèç¹å å
¥ |
| | | * @param mediaServerId |
| | | * @return |
| | | */ |
| | | void zlmServerOnline(String mediaServerId); |
| | | |
| | | /** |
| | | * èç¹ç¦»çº¿ |
| | | * @param mediaServerId |
| | | * @return |
| | | */ |
| | | void zlmServerOffline(String mediaServerId); |
| | | |
| | | /** |
| | | * æ¸
空 |
| | | */ |
| | | void clean(); |
| | | |
| | | |
| | | boolean saveToRandomGB(); |
| | | |
| | | /** |
| | | * æ¹éæ·»å |
| | | */ |
| | | void batchAdd(List<StreamPushItem> streamPushExcelDtoList); |
| | | |
| | | /** |
| | | * 䏿¢å¤ä¸ªæ¨æµ |
| | | */ |
| | | boolean batchStop(List<GbStream> streamPushItems); |
| | | |
| | | /** |
| | | * 导å
¥æ¶æ¹éå¢å |
| | | */ |
| | | void batchAddForUpload(List<StreamPushItem> streamPushItems, Map<String, List<String[]>> streamPushItemsForAll); |
| | | |
| | | /** |
| | | * å
¨é¨ç¦»çº¿ |
| | | */ |
| | | void allStreamOffline(); |
| | | |
| | | /** |
| | | * æ¨æµç¦»çº¿ |
| | | */ |
| | | void offline(List<StreamPushItemFromRedis> offlineStreams); |
| | | |
| | | /** |
| | | * æ¨æµä¸çº¿ |
| | | */ |
| | | void online(List<StreamPushItemFromRedis> onlineStreams); |
| | | |
| | | } |
| | |
| | | package com.genersoft.iot.vmp.service; |
| | | |
| | | import com.genersoft.iot.vmp.storager.dao.dto.User; |
| | | import com.github.pagehelper.PageInfo; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | List<User> getAllUsers(); |
| | | |
| | | int updateUsers(User user); |
| | | |
| | | boolean checkPushAuthority(String callId, String sign); |
| | | |
| | | PageInfo<User> getUsers(int page, int count); |
| | | |
| | | int changePushKey(int id, String pushKey); |
| | | } |
New file |
| | |
| | | package com.genersoft.iot.vmp.service.bean; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æ¶å°rediséç¥ä¿®æ¹æ¨æµééç¶æ |
| | | * @author lin |
| | | */ |
| | | public class PushStreamStatusChangeFromRedisDto { |
| | | |
| | | private boolean setAllOffline; |
| | | |
| | | private List<StreamPushItemFromRedis> onlineStreams; |
| | | |
| | | private List<StreamPushItemFromRedis> offlineStreams; |
| | | |
| | | |
| | | public boolean isSetAllOffline() { |
| | | return setAllOffline; |
| | | } |
| | | |
| | | public void setSetAllOffline(boolean setAllOffline) { |
| | | this.setAllOffline = setAllOffline; |
| | | } |
| | | |
| | | public List<StreamPushItemFromRedis> getOnlineStreams() { |
| | | return onlineStreams; |
| | | } |
| | | |
| | | public void setOnlineStreams(List<StreamPushItemFromRedis> onlineStreams) { |
| | | this.onlineStreams = onlineStreams; |
| | | } |
| | | |
| | | public List<StreamPushItemFromRedis> getOfflineStreams() { |
| | | return offlineStreams; |
| | | } |
| | | |
| | | public void setOfflineStreams(List<StreamPushItemFromRedis> offlineStreams) { |
| | | this.offlineStreams = offlineStreams; |
| | | } |
| | | } |
New file |
| | |
| | | package com.genersoft.iot.vmp.service.bean; |
| | | |
| | | |
| | | public class StreamPushItemFromRedis { |
| | | private String app; |
| | | private String stream; |
| | | private long timeStamp; |
| | | |
| | | public String getApp() { |
| | | return app; |
| | | } |
| | | |
| | | public void setApp(String app) { |
| | | this.app = app; |
| | | } |
| | | |
| | | public String getStream() { |
| | | return stream; |
| | | } |
| | | |
| | | public void setStream(String stream) { |
| | | this.stream = stream; |
| | | } |
| | | |
| | | public long getTimeStamp() { |
| | | return timeStamp; |
| | | } |
| | | |
| | | public void setTimeStamp(long timeStamp) { |
| | | this.timeStamp = timeStamp; |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | @Autowired |
| | | private DeviceAlarmMapper deviceAlarmMapper; |
| | | |
| | | |
| | | @Override |
| | | public PageInfo<DeviceAlarm> getAllAlarm(int page, int count, String deviceId, String alarmPriority, String alarmMethod, String alarmType, String startTime, String endTime) { |
| | | PageHelper.startPage(page, count); |
New file |
| | |
| | | package com.genersoft.iot.vmp.service.impl; |
| | | |
| | | import com.genersoft.iot.vmp.common.StreamInfo; |
| | | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| | | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| | | import com.genersoft.iot.vmp.gb28181.utils.Coordtransform; |
| | | import com.genersoft.iot.vmp.service.IDeviceChannelService; |
| | | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| | | import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper; |
| | | import com.genersoft.iot.vmp.storager.dao.DeviceMapper; |
| | | import com.genersoft.iot.vmp.utils.DateUtil; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author lin |
| | | */ |
| | | @Service |
| | | public class DeviceChannelServiceImpl implements IDeviceChannelService { |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(DeviceChannelServiceImpl.class); |
| | | |
| | | @Autowired |
| | | private IRedisCatchStorage redisCatchStorage; |
| | | |
| | | @Autowired |
| | | private DeviceChannelMapper channelMapper; |
| | | |
| | | @Autowired |
| | | private DeviceMapper deviceMapper; |
| | | |
| | | @Override |
| | | public DeviceChannel updateGps(DeviceChannel deviceChannel, Device device) { |
| | | if (deviceChannel.getLongitude()*deviceChannel.getLatitude() > 0) { |
| | | if (device == null) { |
| | | device = deviceMapper.getDeviceByDeviceId(deviceChannel.getDeviceId()); |
| | | } |
| | | |
| | | if ("WGS84".equals(device.getGeoCoordSys())) { |
| | | deviceChannel.setLongitudeWgs84(deviceChannel.getLongitude()); |
| | | deviceChannel.setLatitudeWgs84(deviceChannel.getLatitude()); |
| | | Double[] position = Coordtransform.WGS84ToGCJ02(deviceChannel.getLongitude(), deviceChannel.getLatitude()); |
| | | deviceChannel.setLongitudeGcj02(position[0]); |
| | | deviceChannel.setLatitudeGcj02(position[1]); |
| | | }else if ("GCJ02".equals(device.getGeoCoordSys())) { |
| | | deviceChannel.setLongitudeGcj02(deviceChannel.getLongitude()); |
| | | deviceChannel.setLatitudeGcj02(deviceChannel.getLatitude()); |
| | | Double[] position = Coordtransform.GCJ02ToWGS84(deviceChannel.getLongitude(), deviceChannel.getLatitude()); |
| | | deviceChannel.setLongitudeWgs84(position[0]); |
| | | deviceChannel.setLatitudeWgs84(position[1]); |
| | | }else { |
| | | deviceChannel.setLongitudeGcj02(0.00); |
| | | deviceChannel.setLatitudeGcj02(0.00); |
| | | deviceChannel.setLongitudeWgs84(0.00); |
| | | deviceChannel.setLatitudeWgs84(0.00); |
| | | } |
| | | }else { |
| | | deviceChannel.setLongitudeGcj02(deviceChannel.getLongitude()); |
| | | deviceChannel.setLatitudeGcj02(deviceChannel.getLatitude()); |
| | | deviceChannel.setLongitudeWgs84(deviceChannel.getLongitude()); |
| | | deviceChannel.setLatitudeWgs84(deviceChannel.getLatitude()); |
| | | } |
| | | return deviceChannel; |
| | | } |
| | | |
| | | @Override |
| | | public void updateChannel(String deviceId, DeviceChannel channel) { |
| | | String channelId = channel.getChannelId(); |
| | | channel.setDeviceId(deviceId); |
| | | StreamInfo streamInfo = redisCatchStorage.queryPlayByDevice(deviceId, channelId); |
| | | if (streamInfo != null) { |
| | | channel.setStreamId(streamInfo.getStream()); |
| | | } |
| | | String now = DateUtil.getNow(); |
| | | channel.setUpdateTime(now); |
| | | DeviceChannel deviceChannel = channelMapper.queryChannel(deviceId, channelId); |
| | | channel = updateGps(channel, null); |
| | | if (deviceChannel == null) { |
| | | channel.setCreateTime(now); |
| | | channelMapper.add(channel); |
| | | }else { |
| | | channelMapper.update(channel); |
| | | } |
| | | channelMapper.updateChannelSubCount(deviceId,channel.getParentId()); |
| | | } |
| | | |
| | | @Override |
| | | public int updateChannels(String deviceId, List<DeviceChannel> channels) { |
| | | List<DeviceChannel> addChannels = new ArrayList<>(); |
| | | List<DeviceChannel> updateChannels = new ArrayList<>(); |
| | | HashMap<String, DeviceChannel> channelsInStore = new HashMap<>(); |
| | | Device device = deviceMapper.getDeviceByDeviceId(deviceId); |
| | | if (channels != null && channels.size() > 0) { |
| | | List<DeviceChannel> channelList = channelMapper.queryChannels(deviceId, null, null, null, null); |
| | | if (channelList.size() == 0) { |
| | | for (DeviceChannel channel : channels) { |
| | | channel.setDeviceId(deviceId); |
| | | StreamInfo streamInfo = redisCatchStorage.queryPlayByDevice(deviceId, channel.getChannelId()); |
| | | if (streamInfo != null) { |
| | | channel.setStreamId(streamInfo.getStream()); |
| | | } |
| | | String now = DateUtil.getNow(); |
| | | channel.setUpdateTime(now); |
| | | channel.setCreateTime(now); |
| | | channel = updateGps(channel, device); |
| | | addChannels.add(channel); |
| | | } |
| | | }else { |
| | | for (DeviceChannel deviceChannel : channelList) { |
| | | channelsInStore.put(deviceChannel.getChannelId(), deviceChannel); |
| | | } |
| | | for (DeviceChannel channel : channels) { |
| | | channel.setDeviceId(deviceId); |
| | | StreamInfo streamInfo = redisCatchStorage.queryPlayByDevice(deviceId, channel.getChannelId()); |
| | | if (streamInfo != null) { |
| | | channel.setStreamId(streamInfo.getStream()); |
| | | } |
| | | String now = DateUtil.getNow(); |
| | | channel.setUpdateTime(now); |
| | | channel = updateGps(channel, device); |
| | | if (channelsInStore.get(channel.getChannelId()) != null) { |
| | | updateChannels.add(channel); |
| | | }else { |
| | | addChannels.add(channel); |
| | | channel.setCreateTime(now); |
| | | } |
| | | } |
| | | } |
| | | int limitCount = 300; |
| | | if (addChannels.size() > 0) { |
| | | if (addChannels.size() > limitCount) { |
| | | for (int i = 0; i < addChannels.size(); i += limitCount) { |
| | | int toIndex = i + limitCount; |
| | | if (i + limitCount > addChannels.size()) { |
| | | toIndex = addChannels.size(); |
| | | } |
| | | channelMapper.batchAdd(addChannels.subList(i, toIndex)); |
| | | } |
| | | }else { |
| | | channelMapper.batchAdd(addChannels); |
| | | } |
| | | } |
| | | if (updateChannels.size() > 0) { |
| | | if (updateChannels.size() > limitCount) { |
| | | for (int i = 0; i < updateChannels.size(); i += limitCount) { |
| | | int toIndex = i + limitCount; |
| | | if (i + limitCount > updateChannels.size()) { |
| | | toIndex = updateChannels.size(); |
| | | } |
| | | channelMapper.batchUpdate(updateChannels.subList(i, toIndex)); |
| | | } |
| | | }else { |
| | | channelMapper.batchUpdate(updateChannels); |
| | | } |
| | | } |
| | | } |
| | | return addChannels.size() + updateChannels.size(); |
| | | } |
| | | } |
| | |
| | | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd.CatalogResponseMessageHandler; |
| | | import com.genersoft.iot.vmp.gb28181.utils.Coordtransform; |
| | | import com.genersoft.iot.vmp.service.IDeviceChannelService; |
| | | import com.genersoft.iot.vmp.service.IDeviceService; |
| | | import com.genersoft.iot.vmp.gb28181.task.impl.CatalogSubscribeTask; |
| | | import com.genersoft.iot.vmp.gb28181.task.impl.MobilePositionSubscribeTask; |
| | |
| | | |
| | | @Autowired |
| | | private DeviceMapper deviceMapper; |
| | | |
| | | @Autowired |
| | | private IDeviceChannelService deviceChannelService; |
| | | |
| | | @Autowired |
| | | private DeviceChannelMapper deviceChannelMapper; |
| | |
| | | private void updateDeviceChannelGeoCoordSys(Device device) { |
| | | List<DeviceChannel> deviceChannels = deviceChannelMapper.getAllChannelWithCoordinate(device.getDeviceId()); |
| | | if (deviceChannels.size() > 0) { |
| | | List<DeviceChannel> deviceChannelsForStore = new ArrayList<>(); |
| | | for (DeviceChannel deviceChannel : deviceChannels) { |
| | | if ("WGS84".equals(device.getGeoCoordSys())) { |
| | | deviceChannel.setLongitudeWgs84(deviceChannel.getLongitude()); |
| | | deviceChannel.setLatitudeWgs84(deviceChannel.getLatitude()); |
| | | Double[] position = Coordtransform.WGS84ToGCJ02(deviceChannel.getLongitude(), deviceChannel.getLatitude()); |
| | | deviceChannel.setLongitudeGcj02(position[0]); |
| | | deviceChannel.setLatitudeGcj02(position[1]); |
| | | }else if ("GCJ02".equals(device.getGeoCoordSys())) { |
| | | deviceChannel.setLongitudeGcj02(deviceChannel.getLongitude()); |
| | | deviceChannel.setLatitudeGcj02(deviceChannel.getLatitude()); |
| | | Double[] position = Coordtransform.GCJ02ToWGS84(deviceChannel.getLongitude(), deviceChannel.getLatitude()); |
| | | deviceChannel.setLongitudeWgs84(position[0]); |
| | | deviceChannel.setLatitudeWgs84(position[1]); |
| | | } |
| | | deviceChannelsForStore.add(deviceChannelService.updateGps(deviceChannel, device)); |
| | | } |
| | | deviceChannelService.updateChannels(device.getDeviceId(), deviceChannelsForStore); |
| | | } |
| | | storage.updateChannels(device.getDeviceId(), deviceChannels); |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | if (parentId == null || parentId.equals(deviceId)) { |
| | | // åæ ¹èç¹å¼å§æ¥è¯¢ |
| | | List<DeviceChannel> rootNodes = getRootNodes(deviceId, "CivilCode".equals(device.getTreeType()), true, !onlyCatalog); |
| | | List<DeviceChannel> rootNodes = getRootNodes(deviceId, TreeType.CIVIL_CODE.equals(device.getTreeType()), true, !onlyCatalog); |
| | | return transportChannelsToTree(rootNodes, ""); |
| | | } |
| | | |
| | | if ("CivilCode".equals(device.getTreeType())) { |
| | | if (TreeType.CIVIL_CODE.equals(device.getTreeType())) { |
| | | if (parentId.length()%2 != 0) { |
| | | return null; |
| | | } |
| | |
| | | |
| | | } |
| | | // 使ç¨ä¸å¡åç»å±ç¤ºæ |
| | | if ("BusinessGroup".equals(device.getTreeType())) { |
| | | if (TreeType.BUSINESS_GROUP.equals(device.getTreeType())) { |
| | | if (parentId.length() < 14 ) { |
| | | return null; |
| | | } |
| | |
| | | } |
| | | if (parentId == null || parentId.equals(deviceId)) { |
| | | // åæ ¹èç¹å¼å§æ¥è¯¢ |
| | | List<DeviceChannel> rootNodes = getRootNodes(deviceId, "CivilCode".equals(device.getTreeType()), false, true); |
| | | List<DeviceChannel> rootNodes = getRootNodes(deviceId, TreeType.CIVIL_CODE.equals(device.getTreeType()), false, true); |
| | | return rootNodes; |
| | | } |
| | | |
| | | if ("CivilCode".equals(device.getTreeType())) { |
| | | if (TreeType.CIVIL_CODE.equals(device.getTreeType())) { |
| | | if (parentId.length()%2 != 0) { |
| | | return null; |
| | | } |
| | |
| | | |
| | | } |
| | | // 使ç¨ä¸å¡åç»å±ç¤ºæ |
| | | if ("BusinessGroup".equals(device.getTreeType())) { |
| | | if (TreeType.BUSINESS_GROUP.equals(device.getTreeType())) { |
| | | if (parentId.length() < 14 ) { |
| | | return null; |
| | | } |
| | |
| | | package com.genersoft.iot.vmp.service.impl; |
| | | |
| | | import com.genersoft.iot.vmp.conf.SipConfig; |
| | | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| | | import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
| | | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| | | import com.genersoft.iot.vmp.gb28181.bean.*; |
| | | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| | | import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; |
| | | import com.genersoft.iot.vmp.storager.dao.GbStreamMapper; |
| | | import com.genersoft.iot.vmp.storager.dao.ParentPlatformMapper; |
| | | import com.genersoft.iot.vmp.storager.dao.PlatformCatalogMapper; |
| | | import com.genersoft.iot.vmp.storager.dao.PlatformGbStreamMapper; |
| | | import com.genersoft.iot.vmp.service.IGbStreamService; |
| | | import com.github.pagehelper.PageHelper; |
| | |
| | | private ParentPlatformMapper platformMapper; |
| | | |
| | | @Autowired |
| | | private SipConfig sipConfig; |
| | | private PlatformCatalogMapper catalogMapper; |
| | | |
| | | @Autowired |
| | | private EventPublisher eventPublisher; |
| | | |
| | | @Override |
| | | public PageInfo<GbStream> getAll(Integer page, Integer count, String platFormId, String catalogId, String query, Boolean pushing, String mediaServerId) { |
| | | public PageInfo<GbStream> getAll(Integer page, Integer count, String platFormId, String catalogId, String query, String mediaServerId) { |
| | | PageHelper.startPage(page, count); |
| | | List<GbStream> all = gbStreamMapper.selectAll(platFormId, catalogId, query, pushing, mediaServerId); |
| | | List<GbStream> all = gbStreamMapper.selectAll(platFormId, catalogId, query, mediaServerId); |
| | | return new PageInfo<>(all); |
| | | } |
| | | |
| | |
| | | deviceChannel.setLatitude(gbStream.getLatitude()); |
| | | deviceChannel.setDeviceId(platform.getDeviceGBId()); |
| | | deviceChannel.setManufacture("wvp-pro"); |
| | | // deviceChannel.setStatus(gbStream.isStatus()?1:0); |
| | | deviceChannel.setStatus(1); |
| | | deviceChannel.setParentId(catalogId ==null?gbStream.getCatalogId():catalogId); |
| | | deviceChannel.setStatus(gbStream.isStatus()?1:0); |
| | | |
| | | deviceChannel.setRegisterWay(1); |
| | | if (catalogId.length() > 0 && catalogId.length() <= 10) { |
| | | // ç¶èç¹æ¯è¡æ¿åºå,å设置CivilCodeä½¿ç¨æ¤è¡æ¿åºå |
| | | deviceChannel.setCivilCode(platform.getAdministrativeDivision()); |
| | | |
| | | if (platform.getTreeType().equals(TreeType.CIVIL_CODE)){ |
| | | deviceChannel.setCivilCode(catalogId); |
| | | }else { |
| | | deviceChannel.setCivilCode(platform.getAdministrativeDivision()); |
| | | }else if (platform.getTreeType().equals(TreeType.BUSINESS_GROUP)){ |
| | | PlatformCatalog catalog = catalogMapper.select(catalogId); |
| | | if (catalog == null) { |
| | | deviceChannel.setParentId(platform.getDeviceGBId()); |
| | | deviceChannel.setBusinessGroupId(null); |
| | | }else { |
| | | deviceChannel.setParentId(catalog.getId()); |
| | | deviceChannel.setBusinessGroupId(catalog.getBusinessGroupId()); |
| | | } |
| | | |
| | | } |
| | | |
| | | deviceChannel.setModel("live"); |
| | | deviceChannel.setOwner("wvp-pro"); |
| | | deviceChannel.setParental(0); |
| | |
| | | if (gbStream.getGbId() != null) { |
| | | gbStreams.add(gbStream); |
| | | }else { |
| | | StreamProxyItem streamProxyItem = gbStreamMapper.selectOne(gbStream.getApp(), gbStream.getStream()); |
| | | if (streamProxyItem != null && streamProxyItem.getGbId() != null){ |
| | | gbStreams.add(streamProxyItem); |
| | | GbStream gbStreamIndb = gbStreamMapper.selectOne(gbStream.getApp(), gbStream.getStream()); |
| | | if (gbStreamIndb != null && gbStreamIndb.getGbId() != null){ |
| | | gbStreams.add(gbStreamIndb); |
| | | } |
| | | } |
| | | sendCatalogMsgs(gbStreams, type); |
| | |
| | | import com.genersoft.iot.vmp.conf.MediaConfig; |
| | | import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.OnPublishHookParam; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo; |
| | | import com.genersoft.iot.vmp.service.IMediaServerService; |
| | | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| | | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| | | import com.genersoft.iot.vmp.service.IMediaService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | @Service |
| | | public class MediaServiceImpl implements IMediaService { |
| | |
| | | |
| | | |
| | | @Override |
| | | public StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaInfo, String app, String stream, Object tracks) { |
| | | return getStreamInfoByAppAndStream(mediaInfo, app, stream, tracks, null); |
| | | public StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaInfo, String app, String stream, Object tracks, String callId) { |
| | | return getStreamInfoByAppAndStream(mediaInfo, app, stream, tracks, null, callId); |
| | | } |
| | | |
| | | @Override |
| | | public StreamInfo getStreamInfoByAppAndStreamWithCheck(String app, String stream, String mediaServerId, String addr) { |
| | | public StreamInfo getStreamInfoByAppAndStreamWithCheck(String app, String stream, String mediaServerId, String addr, boolean authority) { |
| | | StreamInfo streamInfo = null; |
| | | if (mediaServerId == null) { |
| | | mediaServerId = mediaConfig.getId(); |
| | | } |
| | | MediaServerItem mediaInfo = mediaServerService.getOne(mediaServerId);; |
| | | MediaServerItem mediaInfo = mediaServerService.getOne(mediaServerId); |
| | | if (mediaInfo == null) { |
| | | return null; |
| | | } |
| | | StreamAuthorityInfo streamAuthorityInfo = redisCatchStorage.getStreamAuthorityInfo(app, stream); |
| | | if (streamAuthorityInfo == null) { |
| | | return null; |
| | | } |
| | | JSONObject mediaList = zlmresTfulUtils.getMediaList(mediaInfo, app, stream); |
| | |
| | | } |
| | | JSONObject mediaJSON = JSON.parseObject(JSON.toJSONString(data.get(0)), JSONObject.class); |
| | | JSONArray tracks = mediaJSON.getJSONArray("tracks"); |
| | | streamInfo = getStreamInfoByAppAndStream(mediaInfo, app, stream, tracks); |
| | | if (authority) { |
| | | streamInfo = getStreamInfoByAppAndStream(mediaInfo, app, stream, tracks, streamAuthorityInfo.getCallId()); |
| | | }else { |
| | | streamInfo = getStreamInfoByAppAndStream(mediaInfo, app, stream, tracks, null); |
| | | } |
| | | |
| | | } |
| | | } |
| | | return streamInfo; |
| | |
| | | |
| | | |
| | | @Override |
| | | public StreamInfo getStreamInfoByAppAndStreamWithCheck(String app, String stream, String mediaServerId) { |
| | | return getStreamInfoByAppAndStreamWithCheck(app, stream, mediaServerId, null); |
| | | public StreamInfo getStreamInfoByAppAndStreamWithCheck(String app, String stream, String mediaServerId, boolean authority) { |
| | | return getStreamInfoByAppAndStreamWithCheck(app, stream, mediaServerId, null, authority); |
| | | } |
| | | |
| | | @Override |
| | | public StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaInfo, String app, String stream, Object tracks, String addr) { |
| | | public StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaInfo, String app, String stream, Object tracks, String addr, String callId) { |
| | | StreamInfo streamInfoResult = new StreamInfo(); |
| | | streamInfoResult.setStream(stream); |
| | | streamInfoResult.setApp(app); |
| | | if (addr == null) { |
| | | addr = mediaInfo.getStreamIp(); |
| | | } |
| | | streamInfoResult.setIp(addr); |
| | | streamInfoResult.setMediaServerId(mediaInfo.getId()); |
| | | streamInfoResult.setRtmp(String.format("rtmp://%s:%s/%s/%s", addr, mediaInfo.getRtmpPort(), app, stream)); |
| | | String callIdParam = StringUtils.isEmpty(callId)?"":"?callId=" + callId; |
| | | streamInfoResult.setRtmp(String.format("rtmp://%s:%s/%s/%s%s", addr, mediaInfo.getRtmpPort(), app, stream, callIdParam)); |
| | | if (mediaInfo.getRtmpSSlPort() != 0) { |
| | | streamInfoResult.setRtmps(String.format("rtmps://%s:%s/%s/%s", addr, mediaInfo.getRtmpSSlPort(), app, stream)); |
| | | streamInfoResult.setRtmps(String.format("rtmps://%s:%s/%s/%s%s", addr, mediaInfo.getRtmpSSlPort(), app, stream, callIdParam)); |
| | | } |
| | | streamInfoResult.setRtsp(String.format("rtsp://%s:%s/%s/%s", addr, mediaInfo.getRtspPort(), app, stream)); |
| | | streamInfoResult.setRtsp(String.format("rtsp://%s:%s/%s/%s%s", addr, mediaInfo.getRtspPort(), app, stream, callIdParam)); |
| | | if (mediaInfo.getRtspSSLPort() != 0) { |
| | | streamInfoResult.setRtsps(String.format("rtsps://%s:%s/%s/%s", addr, mediaInfo.getRtspSSLPort(), app, stream)); |
| | | streamInfoResult.setRtsps(String.format("rtsps://%s:%s/%s/%s%s", addr, mediaInfo.getRtspSSLPort(), app, stream, callIdParam)); |
| | | } |
| | | streamInfoResult.setFlv(String.format("http://%s:%s/%s/%s.live.flv", addr, mediaInfo.getHttpPort(), app, stream)); |
| | | streamInfoResult.setWs_flv(String.format("ws://%s:%s/%s/%s.live.flv", addr, mediaInfo.getHttpPort(), app, stream)); |
| | | streamInfoResult.setHls(String.format("http://%s:%s/%s/%s/hls.m3u8", addr, mediaInfo.getHttpPort(), app, stream)); |
| | | streamInfoResult.setWs_hls(String.format("ws://%s:%s/%s/%s/hls.m3u8", addr, mediaInfo.getHttpPort(), app, stream)); |
| | | streamInfoResult.setFmp4(String.format("http://%s:%s/%s/%s.live.mp4", addr, mediaInfo.getHttpPort(), app, stream)); |
| | | streamInfoResult.setWs_fmp4(String.format("ws://%s:%s/%s/%s.live.mp4", addr, mediaInfo.getHttpPort(), app, stream)); |
| | | streamInfoResult.setTs(String.format("http://%s:%s/%s/%s.live.ts", addr, mediaInfo.getHttpPort(), app, stream)); |
| | | streamInfoResult.setWs_ts(String.format("ws://%s:%s/%s/%s.live.ts", addr, mediaInfo.getHttpPort(), app, stream)); |
| | | streamInfoResult.setFlv(String.format("http://%s:%s/%s/%s.live.flv%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam)); |
| | | streamInfoResult.setWs_flv(String.format("ws://%s:%s/%s/%s.live.flv%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam)); |
| | | streamInfoResult.setHls(String.format("http://%s:%s/%s/%s/hls.m3u8%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam)); |
| | | streamInfoResult.setWs_hls(String.format("ws://%s:%s/%s/%s/hls.m3u8%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam)); |
| | | streamInfoResult.setFmp4(String.format("http://%s:%s/%s/%s.live.mp4%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam)); |
| | | streamInfoResult.setWs_fmp4(String.format("ws://%s:%s/%s/%s.live.mp4%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam)); |
| | | streamInfoResult.setTs(String.format("http://%s:%s/%s/%s.live.ts%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam)); |
| | | streamInfoResult.setWs_ts(String.format("ws://%s:%s/%s/%s.live.ts%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam)); |
| | | if (mediaInfo.getHttpSSlPort() != 0) { |
| | | streamInfoResult.setHttps_flv(String.format("https://%s:%s/%s/%s.live.flv", addr, mediaInfo.getHttpSSlPort(), app, stream)); |
| | | streamInfoResult.setWss_flv(String.format("wss://%s:%s/%s/%s.live.flv", addr, mediaInfo.getHttpSSlPort(), app, stream)); |
| | | streamInfoResult.setHttps_hls(String.format("https://%s:%s/%s/%s/hls.m3u8", addr, mediaInfo.getHttpSSlPort(), app, stream)); |
| | | streamInfoResult.setWss_hls(String.format("wss://%s:%s/%s/%s/hls.m3u8", addr, mediaInfo.getHttpSSlPort(), app, stream)); |
| | | streamInfoResult.setHttps_fmp4(String.format("https://%s:%s/%s/%s.live.mp4", addr, mediaInfo.getHttpSSlPort(), app, stream)); |
| | | streamInfoResult.setWss_fmp4(String.format("wss://%s:%s/%s/%s.live.mp4", addr, mediaInfo.getHttpSSlPort(), app, stream)); |
| | | streamInfoResult.setHttps_ts(String.format("https://%s:%s/%s/%s.live.ts", addr, mediaInfo.getHttpSSlPort(), app, stream)); |
| | | streamInfoResult.setWss_ts(String.format("wss://%s:%s/%s/%s.live.ts", addr, mediaInfo.getHttpSSlPort(), app, stream)); |
| | | streamInfoResult.setWss_ts(String.format("wss://%s:%s/%s/%s.live.ts", addr, mediaInfo.getHttpSSlPort(), app, stream)); |
| | | streamInfoResult.setRtc(String.format("https://%s:%s/index/api/webrtc?app=%s&stream=%s&type=play", mediaInfo.getStreamIp(), mediaInfo.getHttpSSlPort(), app, stream)); |
| | | streamInfoResult.setHttps_flv(String.format("https://%s:%s/%s/%s.live.flv%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam)); |
| | | streamInfoResult.setWss_flv(String.format("wss://%s:%s/%s/%s.live.flv%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam)); |
| | | streamInfoResult.setHttps_hls(String.format("https://%s:%s/%s/%s/hls.m3u8%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam)); |
| | | streamInfoResult.setWss_hls(String.format("wss://%s:%s/%s/%s/hls.m3u8%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam)); |
| | | streamInfoResult.setHttps_fmp4(String.format("https://%s:%s/%s/%s.live.mp4%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam)); |
| | | streamInfoResult.setWss_fmp4(String.format("wss://%s:%s/%s/%s.live.mp4%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam)); |
| | | streamInfoResult.setHttps_ts(String.format("https://%s:%s/%s/%s.live.ts%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam)); |
| | | streamInfoResult.setWss_ts(String.format("wss://%s:%s/%s/%s.live.ts%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam)); |
| | | streamInfoResult.setWss_ts(String.format("wss://%s:%s/%s/%s.live.ts%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam)); |
| | | streamInfoResult.setRtc(String.format("https://%s:%s/index/api/webrtc?app=%s&stream=%s&type=play%s", mediaInfo.getStreamIp(), mediaInfo.getHttpSSlPort(), app, stream, StringUtils.isEmpty(callId)?"":"&callId=" + callId)); |
| | | } |
| | | |
| | | streamInfoResult.setTracks(tracks); |
New file |
| | |
| | | package com.genersoft.iot.vmp.service.impl; |
| | | |
| | | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| | | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| | | import com.genersoft.iot.vmp.gb28181.bean.PlatformCatalog; |
| | | import com.genersoft.iot.vmp.gb28181.bean.TreeType; |
| | | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| | | import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; |
| | | import com.genersoft.iot.vmp.service.IPlatformChannelService; |
| | | import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper; |
| | | import com.genersoft.iot.vmp.storager.dao.ParentPlatformMapper; |
| | | import com.genersoft.iot.vmp.storager.dao.PlatformCatalogMapper; |
| | | import com.genersoft.iot.vmp.storager.dao.PlatformChannelMapper; |
| | | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author lin |
| | | */ |
| | | @Service |
| | | public class PlatformChannelServiceImpl implements IPlatformChannelService { |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(PlatformChannelServiceImpl.class); |
| | | |
| | | @Autowired |
| | | private PlatformChannelMapper platformChannelMapper; |
| | | |
| | | @Autowired |
| | | private DeviceChannelMapper deviceChannelMapper; |
| | | |
| | | @Autowired |
| | | private PlatformCatalogMapper catalogManager; |
| | | |
| | | @Autowired |
| | | private ParentPlatformMapper platformMapper; |
| | | |
| | | @Autowired |
| | | EventPublisher eventPublisher; |
| | | |
| | | @Override |
| | | public int updateChannelForGB(String platformId, List<ChannelReduce> channelReduces, String catalogId) { |
| | | ParentPlatform platform = platformMapper.getParentPlatByServerGBId(platformId); |
| | | if (platform == null) { |
| | | logger.warn("æ´æ°çº§èééä¿¡æ¯æ¶æªæ¾å°å¹³å°{}çä¿¡æ¯", platformId); |
| | | return 0; |
| | | } |
| | | Map<Integer, ChannelReduce> deviceAndChannels = new HashMap<>(); |
| | | for (ChannelReduce channelReduce : channelReduces) { |
| | | channelReduce.setCatalogId(catalogId); |
| | | deviceAndChannels.put(channelReduce.getId(), channelReduce); |
| | | } |
| | | List<Integer> deviceAndChannelList = new ArrayList<>(deviceAndChannels.keySet()); |
| | | // æ¥è¯¢å½åå·²ç»åå¨ç |
| | | List<Integer> channelIds = platformChannelMapper.findChannelRelatedPlatform(platformId, channelReduces); |
| | | if (deviceAndChannelList != null) { |
| | | deviceAndChannelList.removeAll(channelIds); |
| | | } |
| | | for (Integer channelId : channelIds) { |
| | | deviceAndChannels.remove(channelId); |
| | | } |
| | | List<ChannelReduce> channelReducesToAdd = new ArrayList<>(deviceAndChannels.values()); |
| | | // 对å©ä¸çæ°æ®è¿è¡åå¨ |
| | | int result = 0; |
| | | if (channelReducesToAdd.size() > 0) { |
| | | result = platformChannelMapper.addChannels(platformId, channelReducesToAdd); |
| | | // TODO åç»ç»å¹³å°å¢å æ§å¶å¼å
³ä»¥æ§å¶æ¯å¦ååºç®å½è®¢é
|
| | | List<DeviceChannel> deviceChannelList = getDeviceChannelListByChannelReduceList(channelReducesToAdd, catalogId, platform); |
| | | eventPublisher.catalogEventPublish(platformId, deviceChannelList, CatalogEvent.ADD); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | private List<DeviceChannel> getDeviceChannelListByChannelReduceList(List<ChannelReduce> channelReduces, String catalogId, ParentPlatform platform) { |
| | | List<DeviceChannel> deviceChannelList = new ArrayList<>(); |
| | | if (channelReduces.size() > 0){ |
| | | PlatformCatalog catalog = catalogManager.select(catalogId); |
| | | if (catalog == null && !catalogId.equals(platform.getServerGBId())) { |
| | | logger.warn("æªæ¥è¯¢å°ç®å½{}çä¿¡æ¯", catalogId); |
| | | return null; |
| | | } |
| | | for (ChannelReduce channelReduce : channelReduces) { |
| | | DeviceChannel deviceChannel = deviceChannelMapper.queryChannel(channelReduce.getDeviceId(), channelReduce.getChannelId()); |
| | | deviceChannel.setParental(0); |
| | | deviceChannelList.add(deviceChannel); |
| | | if (platform.getTreeType().equals(TreeType.CIVIL_CODE)){ |
| | | deviceChannel.setCivilCode(catalogId); |
| | | }else if (platform.getTreeType().equals(TreeType.BUSINESS_GROUP)){ |
| | | deviceChannel.setParentId(catalogId); |
| | | if (catalog != null) { |
| | | deviceChannel.setBusinessGroupId(catalog.getBusinessGroupId()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return deviceChannelList; |
| | | } |
| | | } |
| | |
| | | public StreamInfo onPublishHandler(MediaServerItem mediaServerItem, JSONObject resonse, String deviceId, String channelId) { |
| | | String streamId = resonse.getString("stream"); |
| | | JSONArray tracks = resonse.getJSONArray("tracks"); |
| | | StreamInfo streamInfo = mediaService.getStreamInfoByAppAndStream(mediaServerItem,"rtp", streamId, tracks); |
| | | StreamInfo streamInfo = mediaService.getStreamInfoByAppAndStream(mediaServerItem,"rtp", streamId, tracks, null); |
| | | streamInfo.setDeviceID(deviceId); |
| | | streamInfo.setChannelId(channelId); |
| | | return streamInfo; |
| | |
| | | |
| | | @Override |
| | | public void onMessage(@NotNull Message message, byte[] bytes) { |
| | | if (logger.isDebugEnabled()) { |
| | | logger.debug("æ¶å°æ¥èªREDISçGPSéç¥ï¼ {}", new String(message.getBody())); |
| | | } |
| | | // TODO å æ¶æ¯éå |
| | | GPSMsgInfo gpsMsgInfo = JSON.parseObject(message.getBody(), GPSMsgInfo.class); |
| | | redisCatchStorage.updateGpsMsgInfo(gpsMsgInfo); |
| | | } |
New file |
| | |
| | | package com.genersoft.iot.vmp.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.genersoft.iot.vmp.common.VideoManagerConstants; |
| | | import com.genersoft.iot.vmp.conf.DynamicTask; |
| | | import com.genersoft.iot.vmp.conf.UserSetting; |
| | | import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
| | | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| | | import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; |
| | | import com.genersoft.iot.vmp.media.zlm.ZLMMediaListManager; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.MediaItem; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; |
| | | import com.genersoft.iot.vmp.service.IStreamPushService; |
| | | import com.genersoft.iot.vmp.service.bean.PushStreamStatusChangeFromRedisDto; |
| | | import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis; |
| | | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| | | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.ApplicationArguments; |
| | | import org.springframework.boot.ApplicationRunner; |
| | | import org.springframework.data.redis.connection.Message; |
| | | import org.springframework.data.redis.connection.MessageListener; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * æ¥æ¶redisåéçæ¨æµè®¾å¤ä¸çº¿ä¸çº¿éç¥ |
| | | * @author lin |
| | | */ |
| | | @Component |
| | | public class RedisPushStreamStatusMsgListener implements MessageListener, ApplicationRunner { |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(RedisPushStreamStatusMsgListener.class); |
| | | |
| | | @Autowired |
| | | private IRedisCatchStorage redisCatchStorage; |
| | | |
| | | @Autowired |
| | | private IStreamPushService streamPushService; |
| | | |
| | | @Autowired |
| | | private EventPublisher eventPublisher; |
| | | |
| | | @Autowired |
| | | private UserSetting userSetting; |
| | | |
| | | @Autowired |
| | | private DynamicTask dynamicTask; |
| | | |
| | | @Override |
| | | public void onMessage(Message message, byte[] bytes) { |
| | | PushStreamStatusChangeFromRedisDto statusChangeFromPushStream = JSON.parseObject(message.getBody(), PushStreamStatusChangeFromRedisDto.class); |
| | | if (statusChangeFromPushStream == null) { |
| | | logger.warn("[REDIS æ¶æ¯]æ¨æµè®¾å¤ç¶æååæ¶æ¯è§£æå¤±è´¥"); |
| | | return; |
| | | } |
| | | if (statusChangeFromPushStream.isSetAllOffline()) { |
| | | // ææè®¾å¤ç¦»çº¿ |
| | | streamPushService.allStreamOffline(); |
| | | } |
| | | if (statusChangeFromPushStream.getOfflineStreams() != null |
| | | && statusChangeFromPushStream.getOfflineStreams().size() > 0) { |
| | | // æ´æ°é¨å设å¤ç¦»çº¿ |
| | | streamPushService.offline(statusChangeFromPushStream.getOfflineStreams()); |
| | | } |
| | | if (statusChangeFromPushStream.getOnlineStreams() != null && |
| | | statusChangeFromPushStream.getOnlineStreams().size() > 0) { |
| | | // æ´æ°é¨å设å¤ä¸çº¿ |
| | | streamPushService.online(statusChangeFromPushStream.getOnlineStreams()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void run(ApplicationArguments args) throws Exception { |
| | | // å¯å¨æ¶è®¾ç½®æææ¨æµéé离线ï¼åèµ·æ¥è¯¢è¯·æ± |
| | | redisCatchStorage.sendStreamPushRequestedMsgForStatus(); |
| | | dynamicTask.startDelay(VideoManagerConstants.VM_MSG_GET_ALL_ONLINE_REQUESTED, ()->{ |
| | | logger.info("[REDIS æ¶æ¯]æªæ¶å°rediså夿¨æµè®¾å¤ç¶æï¼æ§è¡æ¨æµè®¾å¤ç¦»çº¿"); |
| | | // äºç§æ¶ä¸å°è¯·æ±å°±è®¾ç½®éé离线ï¼ç¶åéç¥ä¸çº§ç¦»çº¿ |
| | | streamPushService.allStreamOffline(); |
| | | }, 5000); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.genersoft.iot.vmp.conf.UserSetting; |
| | | import com.genersoft.iot.vmp.gb28181.bean.AlarmChannelMessage; |
| | | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| | | import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm; |
| | | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| | | |
| | | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; |
| | | import com.genersoft.iot.vmp.media.zlm.ZLMMediaListManager; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.MediaItem; |
| | | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| | | import com.genersoft.iot.vmp.utils.DateUtil; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | |
| | | /** |
| | | * æ¥æ¶å
¶ä»wvpåéæµååéç¥ |
| | | * @author lin |
| | | */ |
| | | @Component |
| | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.genersoft.iot.vmp.common.StreamInfo; |
| | | import com.genersoft.iot.vmp.conf.SipConfig; |
| | | import com.genersoft.iot.vmp.conf.UserSetting; |
| | | import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
| | | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| | | import com.genersoft.iot.vmp.gb28181.bean.TreeType; |
| | | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| | | import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; |
| | | import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; |
| | |
| | | import com.genersoft.iot.vmp.storager.dao.PlatformGbStreamMapper; |
| | | import com.genersoft.iot.vmp.storager.dao.StreamProxyMapper; |
| | | import com.genersoft.iot.vmp.service.IStreamProxyService; |
| | | import com.genersoft.iot.vmp.utils.DateUtil; |
| | | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| | | import com.github.pagehelper.PageInfo; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.jdbc.datasource.DataSourceTransactionManager; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.TransactionDefinition; |
| | | import org.springframework.transaction.TransactionStatus; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.net.InetAddress; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | private IMediaService mediaService; |
| | | |
| | | @Autowired |
| | | private ZLMRESTfulUtils zlmresTfulUtils;; |
| | | private ZLMRESTfulUtils zlmresTfulUtils; |
| | | |
| | | @Autowired |
| | | private StreamProxyMapper streamProxyMapper; |
| | |
| | | |
| | | @Autowired |
| | | private UserSetting userSetting; |
| | | |
| | | @Autowired |
| | | private SipConfig sipConfig; |
| | | |
| | | @Autowired |
| | | private GbStreamMapper gbStreamMapper; |
| | |
| | | @Autowired |
| | | private IMediaServerService mediaServerService; |
| | | |
| | | @Autowired |
| | | DataSourceTransactionManager dataSourceTransactionManager; |
| | | |
| | | @Autowired |
| | | TransactionDefinition transactionDefinition; |
| | | |
| | | |
| | | @Override |
| | | public WVPResult<StreamInfo> save(StreamProxyItem param) { |
| | |
| | | wvpResult.setMsg("ä¿å失败"); |
| | | return wvpResult; |
| | | } |
| | | |
| | | String dstUrl = String.format("rtmp://%s:%s/%s/%s", "127.0.0.1", mediaInfo.getRtmpPort(), param.getApp(), |
| | | param.getStream() ); |
| | | param.setDst_url(dstUrl); |
| | |
| | | boolean saveResult; |
| | | // æ´æ° |
| | | if (videoManagerStorager.queryStreamProxy(param.getApp(), param.getStream()) != null) { |
| | | saveResult = videoManagerStorager.updateStreamProxy(param); |
| | | saveResult = updateStreamProxy(param); |
| | | }else { // æ°å¢ |
| | | saveResult = videoManagerStorager.addStreamProxy(param); |
| | | saveResult = addStreamProxy(param); |
| | | } |
| | | if (saveResult) { |
| | | result.append("ä¿åæå"); |
| | |
| | | if (param.isEnable_remove_none_reader()) { |
| | | del(param.getApp(), param.getStream()); |
| | | }else { |
| | | videoManagerStorager.updateStreamProxy(param); |
| | | updateStreamProxy(param); |
| | | } |
| | | |
| | | }else { |
| | |
| | | result.append(", å
³è彿 å¹³å°[ " + param.getPlatformGbId() + " ]失败"); |
| | | } |
| | | } |
| | | if (!StringUtils.isEmpty(param.getGbId())) { |
| | | // æ¥æ¾å¼å¯äºå
¨é¨ç´ææµå
±äº«çä¸çº§å¹³å° |
| | | List<ParentPlatform> parentPlatforms = parentPlatformMapper.selectAllAhareAllLiveStream(); |
| | | if (parentPlatforms.size() > 0) { |
| | | for (ParentPlatform parentPlatform : parentPlatforms) { |
| | | param.setPlatformId(parentPlatform.getServerGBId()); |
| | | param.setCatalogId(parentPlatform.getCatalogId()); |
| | | String stream = param.getStream(); |
| | | StreamProxyItem streamProxyItems = platformGbStreamMapper.selectOne(param.getApp(), stream, parentPlatform.getServerGBId()); |
| | | if (streamProxyItems == null) { |
| | | platformGbStreamMapper.add(param); |
| | | eventPublisher.catalogEventPublishForStream(parentPlatform.getServerGBId(), param, CatalogEvent.ADD); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | wvpResult.setMsg(result.toString()); |
| | | return wvpResult; |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢ä»£çæµ |
| | | * @param streamProxyItem |
| | | * @return |
| | | */ |
| | | private boolean addStreamProxy(StreamProxyItem streamProxyItem) { |
| | | TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition); |
| | | boolean result = false; |
| | | streamProxyItem.setStreamType("proxy"); |
| | | streamProxyItem.setStatus(true); |
| | | String now = DateUtil.getNow(); |
| | | streamProxyItem.setCreateTime(now); |
| | | try { |
| | | if (streamProxyMapper.add(streamProxyItem) > 0) { |
| | | if (!StringUtils.isEmpty(streamProxyItem.getGbId())) { |
| | | if (gbStreamMapper.add(streamProxyItem) < 0) { |
| | | //äºå¡åæ» |
| | | dataSourceTransactionManager.rollback(transactionStatus); |
| | | return false; |
| | | } |
| | | } |
| | | }else { |
| | | //äºå¡åæ» |
| | | dataSourceTransactionManager.rollback(transactionStatus); |
| | | return false; |
| | | } |
| | | result = true; |
| | | dataSourceTransactionManager.commit(transactionStatus); //æå¨æäº¤ |
| | | }catch (Exception e) { |
| | | logger.error("åæ°æ®åºæ·»å æµä»£ç失败ï¼", e); |
| | | dataSourceTransactionManager.rollback(transactionStatus); |
| | | } |
| | | |
| | | |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * æ´æ°ä»£çæµ |
| | | * @param streamProxyItem |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean updateStreamProxy(StreamProxyItem streamProxyItem) { |
| | | TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition); |
| | | boolean result = false; |
| | | streamProxyItem.setStreamType("proxy"); |
| | | try { |
| | | if (streamProxyMapper.update(streamProxyItem) > 0) { |
| | | if (!StringUtils.isEmpty(streamProxyItem.getGbId())) { |
| | | if (gbStreamMapper.updateByAppAndStream(streamProxyItem) == 0) { |
| | | //äºå¡åæ» |
| | | dataSourceTransactionManager.rollback(transactionStatus); |
| | | return false; |
| | | } |
| | | } |
| | | } else { |
| | | //äºå¡åæ» |
| | | dataSourceTransactionManager.rollback(transactionStatus); |
| | | return false; |
| | | } |
| | | |
| | | dataSourceTransactionManager.commit(transactionStatus); //æå¨æäº¤ |
| | | result = true; |
| | | }catch (Exception e) { |
| | | e.printStackTrace(); |
| | | dataSourceTransactionManager.rollback(transactionStatus); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | |
| | | if (jsonObject.getInteger("code") == 0) { |
| | | result = true; |
| | | streamProxy.setEnable(true); |
| | | videoManagerStorager.updateStreamProxy(streamProxy); |
| | | updateStreamProxy(streamProxy); |
| | | } |
| | | } |
| | | return result; |
| | |
| | | JSONObject jsonObject = removeStreamProxyFromZlm(streamProxyDto); |
| | | if (jsonObject != null && jsonObject.getInteger("code") == 0) { |
| | | streamProxyDto.setEnable(false); |
| | | result = videoManagerStorager.updateStreamProxy(streamProxyDto); |
| | | result = updateStreamProxy(streamProxyDto); |
| | | } |
| | | } |
| | | return result; |
| | |
| | | } |
| | | streamProxyMapper.deleteAutoRemoveItemByMediaServerId(mediaServerId); |
| | | // å
¶ä»çæµè®¾ç½®ç¦»çº¿ |
| | | streamProxyMapper.updateStatusByMediaServerId(false, mediaServerId); |
| | | streamProxyMapper.updateStatusByMediaServerId(mediaServerId, false); |
| | | String type = "PULL"; |
| | | |
| | | // åéredisæ¶æ¯ |
| | |
| | | |
| | | @Override |
| | | public int updateStatus(boolean status, String app, String stream) { |
| | | return streamProxyMapper.updateStatus(status, app, stream); |
| | | return streamProxyMapper.updateStatus(app, stream, status); |
| | | } |
| | | |
| | | private void syncPullStream(String mediaServerId){ |
| | |
| | | import com.genersoft.iot.vmp.service.IGbStreamService; |
| | | import com.genersoft.iot.vmp.service.IMediaServerService; |
| | | import com.genersoft.iot.vmp.service.IStreamPushService; |
| | | import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis; |
| | | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| | | import com.genersoft.iot.vmp.storager.dao.*; |
| | | import com.genersoft.iot.vmp.utils.DateUtil; |
| | |
| | | |
| | | @Autowired |
| | | private StreamPushMapper streamPushMapper; |
| | | |
| | | @Autowired |
| | | private StreamProxyMapper streamProxyMapper; |
| | | |
| | | @Autowired |
| | | private ParentPlatformMapper parentPlatformMapper; |
| | |
| | | stream.setStatus(true); |
| | | stream.setCreateTime(DateUtil.getNow()); |
| | | int add = gbStreamMapper.add(stream); |
| | | |
| | | // æ¥æ¾å¼å¯äºå
¨é¨ç´ææµå
±äº«çä¸çº§å¹³å° |
| | | List<ParentPlatform> parentPlatforms = parentPlatformMapper.selectAllAhareAllLiveStream(); |
| | | if (parentPlatforms.size() > 0) { |
| | | for (ParentPlatform parentPlatform : parentPlatforms) { |
| | | stream.setCatalogId(parentPlatform.getCatalogId()); |
| | | stream.setPlatformId(parentPlatform.getServerGBId()); |
| | | String streamId = stream.getStream(); |
| | | StreamProxyItem streamProxyItem = platformGbStreamMapper.selectOne(stream.getApp(), streamId, parentPlatform.getServerGBId()); |
| | | if (streamProxyItem == null) { |
| | | platformGbStreamMapper.add(stream); |
| | | eventPublisher.catalogEventPublishForStream(parentPlatform.getServerGBId(), stream, CatalogEvent.ADD); |
| | | }else { |
| | | if (!streamProxyItem.getGbId().equals(stream.getGbId())) { |
| | | // æ¤æµä½¿ç¨å¦ä¸ä¸ªå½æ Idå·²ç»ä¸è¯¥å¹³å°å
³èï¼ç§»é¤æ¤è®°å½ |
| | | platformGbStreamMapper.delByAppAndStreamAndPlatform(stream.getApp(), streamId, parentPlatform.getServerGBId()); |
| | | platformGbStreamMapper.add(stream); |
| | | eventPublisher.catalogEventPublishForStream(parentPlatform.getServerGBId(), stream, CatalogEvent.ADD); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return add > 0; |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | public StreamPushItem getPush(String app, String streamId) { |
| | | |
| | | return streamPushMapper.selectOne(app, streamId); |
| | | } |
| | | |
| | |
| | | streamPushMapper.deleteWithoutGBId(mediaServerId); |
| | | gbStreamMapper.deleteWithoutGBId("push", mediaServerId); |
| | | // å
¶ä»çæµè®¾ç½®æªå¯ç¨ |
| | | gbStreamMapper.updateStatusByMediaServerId(mediaServerId, false); |
| | | streamPushMapper.updateStatusByMediaServerId(mediaServerId, false); |
| | | streamProxyMapper.updateStatusByMediaServerId(mediaServerId, false); |
| | | // åéæµåæ¢æ¶æ¯ |
| | | String type = "PUSH"; |
| | | // åéredisæ¶æ¯ |
| | |
| | | public void batchAdd(List<StreamPushItem> streamPushItems) { |
| | | streamPushMapper.addAll(streamPushItems); |
| | | gbStreamMapper.batchAdd(streamPushItems); |
| | | // æ¥æ¾å¼å¯äºå
¨é¨ç´ææµå
±äº«çä¸çº§å¹³å° |
| | | List<ParentPlatform> parentPlatforms = parentPlatformMapper.selectAllAhareAllLiveStream(); |
| | | if (parentPlatforms.size() > 0) { |
| | | for (StreamPushItem stream : streamPushItems) { |
| | | for (ParentPlatform parentPlatform : parentPlatforms) { |
| | | stream.setCatalogId(parentPlatform.getCatalogId()); |
| | | stream.setPlatformId(parentPlatform.getServerGBId()); |
| | | String streamId = stream.getStream(); |
| | | StreamProxyItem streamProxyItem = platformGbStreamMapper.selectOne(stream.getApp(), streamId, parentPlatform.getServerGBId()); |
| | | if (streamProxyItem == null) { |
| | | platformGbStreamMapper.add(stream); |
| | | eventPublisher.catalogEventPublishForStream(parentPlatform.getServerGBId(), stream, CatalogEvent.ADD); |
| | | }else { |
| | | if (!streamProxyItem.getGbId().equals(stream.getGbId())) { |
| | | // æ¤æµä½¿ç¨å¦ä¸ä¸ªå½æ Idå·²ç»ä¸è¯¥å¹³å°å
³èï¼ç§»é¤æ¤è®°å½ |
| | | platformGbStreamMapper.delByAppAndStreamAndPlatform(stream.getApp(), streamId, parentPlatform.getServerGBId()); |
| | | platformGbStreamMapper.add(stream); |
| | | eventPublisher.catalogEventPublishForStream(parentPlatform.getServerGBId(), stream, CatalogEvent.ADD); |
| | | stream.setGbId(streamProxyItem.getGbId()); |
| | | eventPublisher.catalogEventPublishForStream(parentPlatform.getServerGBId(), stream, CatalogEvent.DEL); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public void allStreamOffline() { |
| | | List<GbStream> onlinePushers = streamPushMapper.getOnlinePusherForGb(); |
| | | if (onlinePushers.size() == 0) { |
| | | return; |
| | | } |
| | | streamPushMapper.setAllStreamOffline(); |
| | | |
| | | // åééç¥ |
| | | eventPublisher.catalogEventPublishForStream(null, onlinePushers, CatalogEvent.OFF); |
| | | } |
| | | |
| | | @Override |
| | | public void offline(List<StreamPushItemFromRedis> offlineStreams) { |
| | | // æ´æ°é¨å设å¤ç¦»çº¿ |
| | | List<GbStream> onlinePushers = streamPushMapper.getOnlinePusherForGbInList(offlineStreams); |
| | | streamPushMapper.offline(offlineStreams); |
| | | // åééç¥ |
| | | eventPublisher.catalogEventPublishForStream(null, onlinePushers, CatalogEvent.OFF); |
| | | } |
| | | |
| | | @Override |
| | | public void online(List<StreamPushItemFromRedis> onlineStreams) { |
| | | // æ´æ°é¨å设å¤ä¸çº¿streamPushService |
| | | List<GbStream> onlinePushers = streamPushMapper.getOfflinePusherForGbInList(onlineStreams); |
| | | streamPushMapper.online(onlineStreams); |
| | | // åééç¥ |
| | | eventPublisher.catalogEventPublishForStream(null, onlinePushers, CatalogEvent.ON); |
| | | } |
| | | } |
| | |
| | | |
| | | public class StreamPushUploadFileHandler extends AnalysisEventListener<StreamPushExcelDto> { |
| | | |
| | | // éè¯¯æ°æ®çåè°ï¼ç¨äºå°éè¯¯æ°æ®åéç»é¡µé¢ |
| | | /** |
| | | * éè¯¯æ°æ®çåè°ï¼ç¨äºå°éè¯¯æ°æ®åéç»é¡µé¢ |
| | | */ |
| | | private ErrorDataHandler errorDataHandler; |
| | | |
| | | // æ¨æµçä¸å¡ç±»ç¨äºå卿°æ® |
| | | /** |
| | | * æ¨æµçä¸å¡ç±»ç¨äºå卿°æ® |
| | | */ |
| | | private IStreamPushService pushService; |
| | | |
| | | // é»è®¤æµåªä½èç¹ID |
| | | /** |
| | | * é»è®¤æµåªä½èç¹ID |
| | | */ |
| | | private String defaultMediaServerId; |
| | | |
| | | // ç¨äºåå¨ä¸å è¿æ»¤çæææ°æ® |
| | | /** |
| | | * ç¨äºåå¨ä¸å è¿æ»¤çæææ°æ® |
| | | */ |
| | | private List<StreamPushItem> streamPushItems = new ArrayList<>(); |
| | | |
| | | // ç¨äºå卿´å
·APP+Streamè¿æ»¤åçæ°æ®ï¼å¯ä»¥ç´æ¥åå
¥stream_push表ä¸gb_stream表 |
| | | /** |
| | | * ç¨äºå卿´å
·APP+Streamè¿æ»¤åçæ°æ®ï¼å¯ä»¥ç´æ¥åå
¥stream_push表ä¸gb_stream表 |
| | | */ |
| | | private Map<String,StreamPushItem> streamPushItemForSave = new HashMap<>(); |
| | | |
| | | // ç¨äºå卿ç
§APP+Stream为KEYï¼ å¹³å°ID+ç®å½Id 为valueçæ°æ®ï¼ç¨äºåå¨å°gb_stream表åè·åapp+Stream对åºçå¹³å°ä¸ç®å½ä¿¡æ¯ï¼ç¶ååå
¥å
³è表 |
| | | /** |
| | | * ç¨äºå卿ç
§APP+Stream为KEYï¼ å¹³å°ID+ç®å½Id 为valueçæ°æ®ï¼ç¨äºåå¨å°gb_stream表åè·åapp+Stream对åºçå¹³å°ä¸ç®å½ä¿¡æ¯ï¼ç¶ååå
¥å
³è表 |
| | | */ |
| | | private Map<String, List<String[]>> streamPushItemsForPlatform = new HashMap<>(); |
| | | |
| | | // ç¨äºå¤ææä»¶æ¯å¦åå¨éå¤çapp+Stream+å¹³å°ID |
| | | /** |
| | | * ç¨äºå¤ææä»¶æ¯å¦åå¨éå¤çapp+Stream+å¹³å°ID |
| | | */ |
| | | private Set<String> streamPushStreamSet = new HashSet<>(); |
| | | |
| | | // ç¨äºåå¨APP+Stream->彿 ID çæ°æ®ç»æ, æ°æ®ä¸ä¸å¯¹åºï¼å
¨å±å¤æAPP+Stream->彿 IDæ¯å¦åå¨ä¸å¯¹åº |
| | | /** |
| | | * ç¨äºåå¨APP+Stream->彿 ID çæ°æ®ç»æ, æ°æ®ä¸ä¸å¯¹åºï¼å
¨å±å¤æAPP+Stream->彿 IDæ¯å¦åå¨ä¸å¯¹åº |
| | | */ |
| | | private BiMap<String,String> gBMap = HashBiMap.create(); |
| | | |
| | | // è®°å½é误çAPP+Stream |
| | | /** |
| | | * è®°å½é误çAPP+Stream |
| | | */ |
| | | private List<String> errorStreamList = new ArrayList<>(); |
| | | |
| | | |
| | | // è®°å½é误ç彿 ID |
| | | /** |
| | | * è®°å½é误ç彿 ID |
| | | */ |
| | | private List<String> errorGBList = new ArrayList<>(); |
| | | |
| | | // è¯»åæ°é计æ°å¨ |
| | | /** |
| | | * è¯»åæ°é计æ°å¨ |
| | | */ |
| | | private int loadedSize = 0; |
| | | |
| | | public StreamPushUploadFileHandler(IStreamPushService pushService, String defaultMediaServerId, ErrorDataHandler errorDataHandler) { |
| | |
| | | import com.genersoft.iot.vmp.service.IUserService; |
| | | import com.genersoft.iot.vmp.storager.dao.UserMapper; |
| | | import com.genersoft.iot.vmp.storager.dao.dto.User; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class UserServiceImpl implements IUserService { |
| | | |
| | | |
| | | @Autowired |
| | | private UserMapper userMapper; |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public boolean checkPushAuthority(String callId, String sign) { |
| | | if (StringUtils.isEmpty(callId)) { |
| | | return userMapper.checkPushAuthorityByCallId(sign).size() > 0; |
| | | }else { |
| | | return userMapper.checkPushAuthorityByCallIdAndSign(callId, sign).size() > 0; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<User> getUsers(int page, int count) { |
| | | PageHelper.startPage(page, count); |
| | | List<User> users = userMapper.getUsers(); |
| | | return new PageInfo<>(users); |
| | | } |
| | | |
| | | @Override |
| | | public int changePushKey(int id, String pushKey) { |
| | | return userMapper.changePushKey(id,pushKey); |
| | | } |
| | | } |
| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.genersoft.iot.vmp.common.StreamInfo; |
| | | import com.genersoft.iot.vmp.gb28181.bean.*; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.MediaItem; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.*; |
| | | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; |
| | | import com.genersoft.iot.vmp.service.bean.MessageForPushChannel; |
| | | import com.genersoft.iot.vmp.service.bean.SSRCInfo; |
| | |
| | | */ |
| | | public boolean deviceIsOnline(String deviceId); |
| | | |
| | | /** |
| | | * å卿¨æµçé´æä¿¡æ¯ |
| | | * @param app åºç¨å |
| | | * @param stream æµ |
| | | * @param streamAuthorityInfo é´æä¿¡æ¯ |
| | | */ |
| | | void updateStreamAuthorityInfo(String app, String stream, StreamAuthorityInfo streamAuthorityInfo); |
| | | |
| | | /** |
| | | * ç§»é¤æ¨æµçé´æä¿¡æ¯ |
| | | * @param app åºç¨å |
| | | * @param streamId æµ |
| | | */ |
| | | void removeStreamAuthorityInfo(String app, String streamId); |
| | | |
| | | /** |
| | | * è·åæ¨æµçé´æä¿¡æ¯ |
| | | * @param app åºç¨å |
| | | * @param stream æµ |
| | | * @return |
| | | */ |
| | | StreamAuthorityInfo getStreamAuthorityInfo(String app, String stream); |
| | | |
| | | /** |
| | | * åéredisæ¶æ¯ æ¥è¯¢æææ¨æµè®¾å¤çç¶æ |
| | | */ |
| | | void sendStreamPushRequestedMsgForStatus(); |
| | | } |
| | |
| | | public boolean exists(String deviceId); |
| | | |
| | | /** |
| | | * æ·»å 设å¤éé |
| | | * |
| | | * @param deviceId 设å¤id |
| | | * @param channel éé |
| | | */ |
| | | public void updateChannel(String deviceId, DeviceChannel channel); |
| | | |
| | | /** |
| | | * æ¹éæ·»å 设å¤éé |
| | | * |
| | | * @param deviceId 设å¤id |
| | | * @param channels å¤ä¸ªéé |
| | | */ |
| | | public int updateChannels(String deviceId, List<DeviceChannel> channels); |
| | | |
| | | /** |
| | | * å¼å§ææ¾ |
| | | * @param deviceId 设å¤id |
| | | * @param channelId ééID |
| | |
| | | List<DeviceChannelInPlatform> queryChannelListInParentPlatform(String platformId); |
| | | |
| | | |
| | | /** |
| | | * æ´æ°ä¸çº§å¹³å°çééä¿¡æ¯ |
| | | * @param platformId |
| | | * @param channelReduces |
| | | * @return |
| | | */ |
| | | int updateChannelForGB(String platformId, List<ChannelReduce> channelReduces, String catalogId); |
| | | |
| | | /** |
| | | * ç§»é¤ä¸çº§å¹³å°çééä¿¡æ¯ |
| | |
| | | public int clearMobilePositionsByDeviceId(String deviceId); |
| | | |
| | | /** |
| | | * æ°å¢ä»£çæµ |
| | | * @param streamProxyDto |
| | | * @return |
| | | */ |
| | | public boolean addStreamProxy(StreamProxyItem streamProxyDto); |
| | | |
| | | /** |
| | | * æ´æ°ä»£çæµ |
| | | * @param streamProxyDto |
| | | * @return |
| | | */ |
| | | public boolean updateStreamProxy(StreamProxyItem streamProxyDto); |
| | | |
| | | /** |
| | | * ç§»é¤ä»£çæµ |
| | | * @param app |
| | | * @param stream |
| | |
| | | * @param platformId |
| | | * @return |
| | | */ |
| | | List<GbStream> queryGbStreamListInPlatform(String platformId); |
| | | List<DeviceChannel> queryGbStreamListInPlatform(String platformId); |
| | | |
| | | /** |
| | | * æ¹éæ´æ°æ¨æµå表 |
| | |
| | | |
| | | /** |
| | | * 设置æµç¦»çº¿ |
| | | * @param app |
| | | * @param streamId |
| | | */ |
| | | int mediaOutline(String app, String streamId); |
| | | int mediaOffline(String app, String streamId); |
| | | |
| | | /** |
| | | * 设置æµä¸çº¿ |
| | | */ |
| | | int mediaOnline(String app, String streamId); |
| | | |
| | | /** |
| | | * 设置平å°å¨çº¿/离线 |
| | | * @param online |
| | | */ |
| | | void updateParentPlatformStatus(String platformGbID, boolean online); |
| | | |
| | |
| | | |
| | | int setDefaultCatalog(String platformId, String catalogId); |
| | | |
| | | List<PlatformCatalog> queryCatalogInPlatform(String serverGBId); |
| | | List<DeviceChannel> queryCatalogInPlatform(String serverGBId); |
| | | |
| | | int delRelation(PlatformCatalog platformCatalog); |
| | | |
| | |
| | | List<ChannelSourceInfo> getChannelSource(String platformId, String gbId); |
| | | |
| | | void updateChannelPosition(DeviceChannel deviceChannel); |
| | | |
| | | void cleanContentForPlatform(String serverGBId); |
| | | |
| | | List<DeviceChannel> queryChannelWithCatalog(String serverGBId); |
| | | } |
| | |
| | | @Select("select * from device_channel where deviceId=#{deviceId} and SUBSTRING(channelId, 11, 3)=#{typeCode}") |
| | | List<DeviceChannel> getBusinessGroups(String deviceId, String typeCode); |
| | | |
| | | |
| | | @Select("select dc.id, dc.channelId, dc.deviceId, dc.name, dc.manufacture,dc.model,dc.owner, pc.civilCode,dc.block, " + |
| | | " dc.address, '0' as parental,'0' as channelType, pc.id as parentId, dc.safetyWay, dc.registerWay,dc.certNum, dc.certifiable, " + |
| | | " dc.errCode,dc.endTime, dc.secrecy, dc.ipAddress, dc.port, dc.PTZType, dc.password, dc.status, " + |
| | | " dc.longitudeWgs84 as longitude, dc.latitudeWgs84 as latitude, pc.businessGroupId " + |
| | | " from device_channel dc" + |
| | | " left join platform_gb_channel pgc on dc.id = pgc.deviceChannelId" + |
| | | " left join platform_catalog pc on pgc.catalogId = pc.id and pgc.platformId = pc.platformId" + |
| | | " where pgc.platformId=#{serverGBId}") |
| | | List<DeviceChannel> queryChannelWithCatalog(String serverGBId); |
| | | } |
| | |
| | | package com.genersoft.iot.vmp.storager.dao; |
| | | |
| | | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| | | import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; |
| | |
| | | public interface GbStreamMapper { |
| | | |
| | | @Insert("REPLACE INTO gb_stream (app, stream, gbId, name, " + |
| | | "longitude, latitude, streamType, mediaServerId, status, createTime) VALUES" + |
| | | "longitude, latitude, streamType, mediaServerId, createTime) VALUES" + |
| | | "('${app}', '${stream}', '${gbId}', '${name}', " + |
| | | "'${longitude}', '${latitude}', '${streamType}', " + |
| | | "'${mediaServerId}', ${status}, '${createTime}')") |
| | | "'${mediaServerId}', '${createTime}')") |
| | | @Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gbStreamId") |
| | | int add(GbStream gbStream); |
| | | |
| | |
| | | "streamType=#{streamType}," + |
| | | "longitude=#{longitude}, " + |
| | | "latitude=#{latitude}," + |
| | | "mediaServerId=#{mediaServerId}," + |
| | | "status=${status} " + |
| | | "mediaServerId=#{mediaServerId}" + |
| | | "WHERE app=#{app} AND stream=#{stream}") |
| | | int updateByAppAndStream(GbStream gbStream); |
| | | |
| | |
| | | "streamType=#{streamType}," + |
| | | "longitude=#{longitude}, " + |
| | | "latitude=#{latitude}," + |
| | | "mediaServerId=#{mediaServerId}," + |
| | | "status=${status} " + |
| | | "mediaServerId=#{mediaServerId}" + |
| | | "WHERE gbStreamId=#{gbStreamId}") |
| | | int update(GbStream gbStream); |
| | | |
| | |
| | | " <if test='catalogId == null'> AND gs.gbStreamId not in" + |
| | | "(select pgs.gbStreamId from platform_gb_stream pgs where pgs.platformId = #{platformId}) </if> " + |
| | | " <if test='query != null'> AND (gs.app LIKE '%${query}%' OR gs.stream LIKE '%${query}%' OR gs.gbId LIKE '%${query}%' OR gs.name LIKE '%${query}%')</if> " + |
| | | " <if test='pushing == true' > AND gs.status=1</if>" + |
| | | " <if test='pushing == false' > AND gs.status=0</if>" + |
| | | " <if test='mediaServerId != null' > AND gs.mediaServerId=#{mediaServerId} </if>" + |
| | | " order by gs.gbStreamId asc " + |
| | | "</script>") |
| | | List<GbStream> selectAll(String platformId, String catalogId, String query, Boolean pushing, String mediaServerId); |
| | | List<GbStream> selectAll(String platformId, String catalogId, String query, String mediaServerId); |
| | | |
| | | @Select("SELECT * FROM gb_stream WHERE app=#{app} AND stream=#{stream}") |
| | | StreamProxyItem selectOne(String app, String stream); |
| | | GbStream selectOne(String app, String stream); |
| | | |
| | | @Select("SELECT * FROM gb_stream WHERE gbId=#{gbId}") |
| | | List<GbStream> selectByGBId(String gbId); |
| | |
| | | "WHERE gs.gbId = '${gbId}' AND pgs.platformId = '${platformId}'") |
| | | GbStream queryStreamInPlatform(String platformId, String gbId); |
| | | |
| | | @Select("SELECT gs.*, pgs.platformId as platformId, pgs.catalogId as catalogId FROM gb_stream gs " + |
| | | "LEFT JOIN platform_gb_stream pgs ON gs.gbStreamId = pgs.gbStreamId " + |
| | | "WHERE pgs.platformId = #{platformId}") |
| | | List<GbStream> queryGbStreamListInPlatform(String platformId); |
| | | @Select("select gt.gbId as channelId, gt.name, 'wvp-pro' as manufacture, st.status, gt.longitude, gt.latitude, pc.id as parentId," + |
| | | " '1' as registerWay, pc.civilCode, 'live' as model, 'wvp-pro' as owner, '0' as parental,'0' as secrecy" + |
| | | " from gb_stream gt " + |
| | | " left join (" + |
| | | " select sp.status, sp.app, sp.stream from stream_push sp" + |
| | | " union all" + |
| | | " select spxy.status, spxy.app, spxy.stream from stream_proxy spxy" + |
| | | " ) st on st.app = gt.app and st.stream = gt.stream" + |
| | | " left join platform_gb_stream pgs on gt.gbStreamId = pgs.gbStreamId" + |
| | | " left join platform_catalog pc on pgs.catalogId = pc.id and pgs.platformId = pc.platformId" + |
| | | " where pgs.platformId=#{platformId}") |
| | | List<DeviceChannel> queryGbStreamListInPlatform(String platformId); |
| | | |
| | | |
| | | @Select("SELECT gs.* FROM gb_stream gs LEFT JOIN platform_gb_stream pgs " + |
| | | "ON gs.gbStreamId = pgs.gbStreamId WHERE pgs.gbStreamId is NULL") |
| | | List<GbStream> queryStreamNotInPlatform(); |
| | | |
| | | @Update("UPDATE gb_stream " + |
| | | "SET status=${status} " + |
| | | "WHERE app=#{app} AND stream=#{stream}") |
| | | int setStatus(String app, String stream, boolean status); |
| | | |
| | | @Update("UPDATE gb_stream " + |
| | | "SET status=${status} " + |
| | | "WHERE mediaServerId=#{mediaServerId} ") |
| | | void updateStatusByMediaServerId(String mediaServerId, boolean status); |
| | | |
| | | @Delete("DELETE FROM gb_stream WHERE streamType=#{type} AND gbId=NULL AND mediaServerId=#{mediaServerId}") |
| | | void deleteWithoutGBId(String type, String mediaServerId); |
| | |
| | | @Insert("<script> " + |
| | | "INSERT IGNORE into gb_stream " + |
| | | "(app, stream, gbId, name, " + |
| | | "longitude, latitude, streamType, mediaServerId, status, createTime)" + |
| | | "longitude, latitude, streamType, mediaServerId, createTime)" + |
| | | "values " + |
| | | "<foreach collection='subList' index='index' item='item' separator=','> " + |
| | | "('${item.app}', '${item.stream}', '${item.gbId}', '${item.name}', " + |
| | | "'${item.longitude}', '${item.latitude}', '${item.streamType}', " + |
| | | "'${item.mediaServerId}', ${item.status}, '${item.createTime}') "+ |
| | | "'${item.mediaServerId}', '${item.createTime}') "+ |
| | | "</foreach> " + |
| | | "</script>") |
| | | @Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gbStreamId") |
| | |
| | | |
| | | @Insert("INSERT INTO parent_platform (enable, name, serverGBId, serverGBDomain, serverIP, serverPort, deviceGBId, deviceIp, " + |
| | | " devicePort, username, password, expires, keepTimeout, transport, characterSet, ptz, rtcp, " + |
| | | " status, shareAllLiveStream, startOfflinePush, catalogId, administrativeDivision, catalogGroup, createTime, updateTime) " + |
| | | " 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}, " + |
| | | " ${status}, ${shareAllLiveStream}, ${startOfflinePush}, #{catalogId}, #{administrativeDivision}, #{catalogGroup}, #{createTime}, #{updateTime})") |
| | | " ${status}, ${startOfflinePush}, #{catalogId}, #{administrativeDivision}, #{catalogGroup}, #{createTime}, #{updateTime}, #{treeType})") |
| | | int addParentPlatform(ParentPlatform parentPlatform); |
| | | |
| | | @Update("UPDATE parent_platform " + |
| | |
| | | "ptz=#{ptz}, " + |
| | | "rtcp=#{rtcp}, " + |
| | | "status=#{status}, " + |
| | | "shareAllLiveStream=#{shareAllLiveStream}, " + |
| | | "startOfflinePush=${startOfflinePush}, " + |
| | | "catalogGroup=#{catalogGroup}, " + |
| | | "administrativeDivision=#{administrativeDivision}, " + |
| | | "createTime=#{createTime}, " + |
| | | "updateTime=#{updateTime}, " + |
| | | "treeType=#{treeType}, " + |
| | | "catalogId=#{catalogId} " + |
| | | "WHERE id=#{id}") |
| | | int updateParentPlatform(ParentPlatform parentPlatform); |
| | |
| | | |
| | | @Update("UPDATE parent_platform SET status=#{online} WHERE serverGBId=#{platformGbID}" ) |
| | | int updateParentPlatformStatus(String platformGbID, boolean online); |
| | | |
| | | @Select("SELECT * FROM parent_platform WHERE shareAllLiveStream=true") |
| | | List<ParentPlatform> selectAllAhareAllLiveStream(); |
| | | |
| | | @Update(value = {" <script>" + |
| | | "UPDATE parent_platform " + |
| | |
| | | package com.genersoft.iot.vmp.storager.dao; |
| | | |
| | | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| | | import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
| | | import com.genersoft.iot.vmp.gb28181.bean.PlatformCatalog; |
| | | import com.genersoft.iot.vmp.gb28181.bean.PlatformGbStream; |
| | |
| | | @Repository |
| | | public interface PlatformCatalogMapper { |
| | | |
| | | @Insert("INSERT INTO platform_catalog (id, name, platformId, parentId) VALUES" + |
| | | "(#{id}, #{name}, #{platformId}, #{parentId})") |
| | | @Insert("INSERT INTO platform_catalog (id, name, platformId, parentId, civilCode, businessGroupId) VALUES" + |
| | | "(#{id}, #{name}, #{platformId}, #{parentId}, #{civilCode}, #{businessGroupId})") |
| | | int add(PlatformCatalog platformCatalog); |
| | | |
| | | @Delete("DELETE FROM platform_catalog WHERE id=#{id}") |
| | |
| | | |
| | | @Select("SELECT pc.* FROM platform_catalog pc WHERE pc.id = (SELECT pp.catalogId from parent_platform pp WHERE pp.serverGBId=#{platformId})") |
| | | PlatformCatalog selectDefaultByPlatFormId(String platformId); |
| | | |
| | | |
| | | @Select("SELECT pc.* FROM platform_catalog pc WHERE pc.id = #{id}") |
| | | PlatformCatalog selectParentCatalog(String id); |
| | | |
| | | @Select("SELECT pc.id as channelId, pc.name, pc.civilCode, pc.businessGroupId,'0' as parental, pc.parentId " + |
| | | " FROM platform_catalog pc WHERE pc.platformId=#{platformId}") |
| | | List<DeviceChannel> queryCatalogInPlatform(String platformId); |
| | | } |
| | |
| | | @Update("UPDATE stream_proxy " + |
| | | "SET status=#{status} " + |
| | | "WHERE mediaServerId=#{mediaServerId}") |
| | | void updateStatusByMediaServerId(boolean status, String mediaServerId); |
| | | void updateStatusByMediaServerId(String mediaServerId, boolean status); |
| | | |
| | | @Update("UPDATE stream_proxy " + |
| | | "SET status=${status} " + |
| | | "WHERE app=#{app} AND stream=#{stream}") |
| | | int updateStatus(boolean status, String app, String stream); |
| | | int updateStatus(String app, String stream, boolean status); |
| | | |
| | | @Delete("DELETE FROM stream_proxy WHERE enable_remove_none_reader=true AND mediaServerId=#{mediaServerId}") |
| | | void deleteAutoRemoveItemByMediaServerId(String mediaServerId); |
| | |
| | | |
| | | import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; |
| | | import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis; |
| | | import org.apache.ibatis.annotations.*; |
| | | // import org.omg.PortableInterceptor.INACTIVE; |
| | | import org.springframework.stereotype.Repository; |
| | |
| | | public interface StreamPushMapper { |
| | | |
| | | @Insert("INSERT INTO stream_push (app, stream, totalReaderCount, originType, originTypeStr, " + |
| | | "createStamp, aliveSecond, mediaServerId, serverId) VALUES" + |
| | | "pushTime, aliveSecond, mediaServerId, serverId, updateTime, createTime, pushIng) VALUES" + |
| | | "('${app}', '${stream}', '${totalReaderCount}', '${originType}', '${originTypeStr}', " + |
| | | "'${createStamp}', '${aliveSecond}', '${mediaServerId}' , '${serverId}' )") |
| | | "'${pushTime}', '${aliveSecond}', '${mediaServerId}' , '${serverId}' , '${updateTime}' , '${createTime}', ${pushIng} )") |
| | | int add(StreamPushItem streamPushItem); |
| | | |
| | | @Update("UPDATE stream_push " + |
| | | "SET app=#{app}," + |
| | | "stream=#{stream}," + |
| | | "mediaServerId=#{mediaServerId}," + |
| | | "totalReaderCount=#{totalReaderCount}, " + |
| | | "originType=#{originType}," + |
| | | "originTypeStr=#{originTypeStr}, " + |
| | | "createStamp=#{createStamp}, " + |
| | | "aliveSecond=#{aliveSecond} " + |
| | | "WHERE app=#{app} AND stream=#{stream}") |
| | | |
| | | @Update(value = {" <script>" + |
| | | "UPDATE stream_push " + |
| | | "SET updateTime='${updateTime}'" + |
| | | "<if test=\"mediaServerId != null\">, mediaServerId='${mediaServerId}'</if>" + |
| | | "<if test=\"totalReaderCount != null\">, totalReaderCount='${totalReaderCount}'</if>" + |
| | | "<if test=\"originType != null\">, originType=${originType}</if>" + |
| | | "<if test=\"originTypeStr != null\">, originTypeStr='${originTypeStr}'</if>" + |
| | | "<if test=\"pushTime != null\">, pushTime='${pushTime}'</if>" + |
| | | "<if test=\"aliveSecond != null\">, aliveSecond='${aliveSecond}'</if>" + |
| | | "<if test=\"pushIng != null\">, pushIng=${pushIng}</if>" + |
| | | "WHERE app=#{app} AND stream=#{stream}"+ |
| | | " </script>"}) |
| | | int update(StreamPushItem streamPushItem); |
| | | |
| | | @Delete("DELETE FROM stream_push WHERE app=#{app} AND stream=#{stream}") |
| | |
| | | @Select(value = {" <script>" + |
| | | "SELECT " + |
| | | "st.*, " + |
| | | "gs.gbId, gs.status, gs.name, gs.longitude, gs.latitude, gs.gbStreamId " + |
| | | "gs.gbId, gs.name, gs.longitude, gs.latitude, gs.gbStreamId " + |
| | | "from " + |
| | | "stream_push st " + |
| | | "LEFT JOIN gb_stream gs " + |
| | |
| | | "WHERE " + |
| | | "1=1 " + |
| | | " <if test='query != null'> AND (st.app LIKE '%${query}%' OR st.stream LIKE '%${query}%' OR gs.gbId LIKE '%${query}%' OR gs.name LIKE '%${query}%')</if> " + |
| | | " <if test='pushing == true' > AND (gs.gbId is null OR gs.status=1)</if>" + |
| | | " <if test='pushing == false' > AND gs.status=0</if>" + |
| | | " <if test='pushing == true' > AND (gs.gbId is null OR st.status=1)</if>" + |
| | | " <if test='pushing == false' > AND st.status=0</if>" + |
| | | " <if test='mediaServerId != null' > AND st.mediaServerId=#{mediaServerId} </if>" + |
| | | "order by st.createStamp desc" + |
| | | "order by st.createTime desc" + |
| | | " </script>"}) |
| | | List<StreamPushItem> selectAllForList(String query, Boolean pushing, String mediaServerId); |
| | | |
| | | @Select("SELECT st.*, gs.gbId, gs.status, gs.name, gs.longitude, gs.latitude FROM stream_push st LEFT JOIN gb_stream gs on st.app = gs.app AND st.stream = gs.stream order by st.createStamp desc") |
| | | @Select("SELECT st.*, gs.gbId, gs.name, gs.longitude, gs.latitude FROM stream_push st LEFT JOIN gb_stream gs on st.app = gs.app AND st.stream = gs.stream order by st.createTime desc") |
| | | List<StreamPushItem> selectAll(); |
| | | |
| | | @Select("SELECT st.*, gs.gbId, gs.status, gs.name, gs.longitude, gs.latitude FROM stream_push st LEFT JOIN gb_stream gs on st.app = gs.app AND st.stream = gs.stream WHERE st.app=#{app} AND st.stream=#{stream}") |
| | | @Select("SELECT st.*, gs.gbId, gs.name, gs.longitude, gs.latitude FROM stream_push st LEFT JOIN gb_stream gs on st.app = gs.app AND st.stream = gs.stream WHERE st.app=#{app} AND st.stream=#{stream}") |
| | | StreamPushItem selectOne(String app, String stream); |
| | | |
| | | @Insert("<script>" + |
| | | "Insert IGNORE INTO stream_push (app, stream, totalReaderCount, originType, originTypeStr, " + |
| | | "createStamp, aliveSecond, mediaServerId) " + |
| | | "createTime, aliveSecond, mediaServerId, status, pushIng) " + |
| | | "VALUES <foreach collection='streamPushItems' item='item' index='index' separator=','>" + |
| | | "( '${item.app}', '${item.stream}', '${item.totalReaderCount}', #{item.originType}, " + |
| | | "'${item.originTypeStr}',#{item.createStamp}, #{item.aliveSecond}, '${item.mediaServerId}' )" + |
| | | "'${item.originTypeStr}',#{item.createTime}, #{item.aliveSecond}, '${item.mediaServerId}', ${item.status} ," + |
| | | " ${item.pushIng} )" + |
| | | " </foreach>" + |
| | | "</script>") |
| | | @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") |
| | |
| | | @Select("SELECT sp.* FROM stream_push sp left join gb_stream gs on gs.app = sp.app and gs.stream= sp.stream WHERE sp.mediaServerId=#{mediaServerId} and gs.gbId is null") |
| | | List<StreamPushItem> selectAllByMediaServerIdWithOutGbID(String mediaServerId); |
| | | |
| | | @Update("UPDATE stream_push " + |
| | | "SET status=${status} " + |
| | | "WHERE app=#{app} AND stream=#{stream}") |
| | | int updateStatus(String app, String stream, boolean status); |
| | | |
| | | @Update("UPDATE stream_push " + |
| | | "SET pushIng=${pushIng} " + |
| | | "WHERE app=#{app} AND stream=#{stream}") |
| | | int updatePushStatus(String app, String stream, boolean status); |
| | | |
| | | @Update("UPDATE stream_push " + |
| | | "SET status=#{status} " + |
| | | "WHERE mediaServerId=#{mediaServerId}") |
| | | void updateStatusByMediaServerId(String mediaServerId, boolean status); |
| | | |
| | | |
| | | @Select("<script> "+ |
| | | "SELECT gs.* FROM stream_push sp left join gb_stream gs on sp.app = gs.app AND sp.stream = gs.stream " + |
| | | "where sp.status = 1 and (gs.app, gs.stream) in (" + |
| | | "<foreach collection='offlineStreams' item='item' separator=','>" + |
| | | "(#{item.app}, #{item.stream}) " + |
| | | "</foreach>" + |
| | | ")</script>") |
| | | List<GbStream> getOnlinePusherForGbInList(List<StreamPushItemFromRedis> offlineStreams); |
| | | |
| | | @Update("<script> "+ |
| | | "UPDATE stream_push SET status=0 where (app, stream) in (" + |
| | | "<foreach collection='offlineStreams' item='item' separator=','>" + |
| | | "(#{item.app}, #{item.stream}) " + |
| | | "</foreach>" + |
| | | ")</script>") |
| | | void offline(List<StreamPushItemFromRedis> offlineStreams); |
| | | |
| | | @Select("<script> "+ |
| | | "SELECT * FROM stream_push sp left join gb_stream gs on sp.app = gs.app AND sp.stream = gs.stream " + |
| | | "where sp.status = 0 and (gs.app, gs.stream) in (" + |
| | | "<foreach collection='onlineStreams' item='item' separator=','>" + |
| | | "(#{item.app}, #{item.stream}) " + |
| | | "</foreach>" + |
| | | ") </script>") |
| | | List<GbStream> getOfflinePusherForGbInList(List<StreamPushItemFromRedis> onlineStreams); |
| | | |
| | | @Update("<script> "+ |
| | | "UPDATE stream_push SET status=1 where (app, stream) in (" + |
| | | "<foreach collection='onlineStreams' item='item' separator=','>" + |
| | | "(#{item.app}, #{item.stream}) " + |
| | | "</foreach>" + |
| | | ")</script>") |
| | | void online(List<StreamPushItemFromRedis> onlineStreams); |
| | | |
| | | @Select("SELECT gs.* FROM stream_push sp left join gb_stream gs on sp.app = gs.app AND sp.stream = gs.stream where sp.status = 1") |
| | | List<GbStream> getOnlinePusherForGb(); |
| | | |
| | | @Update("UPDATE stream_push SET status=0") |
| | | void setAllStreamOffline(); |
| | | } |
| | |
| | | @Repository |
| | | public interface UserMapper { |
| | | |
| | | @Insert("INSERT INTO user (username, password, roleId, createTime, updateTime) VALUES" + |
| | | "('${username}', '${password}', '${role.id}', '${createTime}', '${updateTime}')") |
| | | @Insert("INSERT INTO user (username, password, roleId, pushKey, createTime, updateTime) VALUES" + |
| | | "('${username}', '${password}', '${role.id}', '${pushKey}', '${createTime}', '${updateTime}')") |
| | | int add(User user); |
| | | |
| | | @Update(value = {" <script>" + |
| | | "UPDATE user " + |
| | | "SET updateTime='${updateTime}' " + |
| | | "<if test=\"pushKey != null\">, pushKey='${pushKey}'</if>" + |
| | | "<if test=\"role != null\">, roleId='${role.id}'</if>" + |
| | | "<if test=\"password != null\">, password='${password}'</if>" + |
| | | "<if test=\"username != null\">, username='${username}'</if>" + |
| | |
| | | @Select("select u.*, r.id as roleID, r.name as roleName, r.authority as roleAuthority , r.createTime as roleCreateTime , r.updateTime as roleUpdateTime FROM user u, user_role r WHERE u.roleId=r.id") |
| | | @ResultMap(value="roleMap") |
| | | List<User> selectAll(); |
| | | |
| | | @Select("select * from (select user.*, concat('${callId}_', pushKey) as str1 from user) as u where md5(u.str1) = '${sign}'") |
| | | List<User> checkPushAuthorityByCallIdAndSign(String callId, String sign); |
| | | |
| | | @Select("select * from user where md5(pushKey) = '${sign}'") |
| | | List<User> checkPushAuthorityByCallId(String sign); |
| | | |
| | | @Select("select u.id, u.username,u.pushKey,u.roleId, r.id as roleID, r.name as roleName, r.authority as roleAuthority , r.createTime as roleCreateTime , r.updateTime as roleUpdateTime FROM user u join user_role r on u.roleId=r.id") |
| | | @ResultMap(value="roleMap") |
| | | List<User> getUsers(); |
| | | |
| | | @Update("update user set pushKey=#{pushKey} where id=#{id}") |
| | | int changePushKey(int id, String pushKey); |
| | | } |
| | |
| | | private String password; |
| | | private String createTime; |
| | | private String updateTime; |
| | | private String pushKey; |
| | | private Role role; |
| | | |
| | | public int getId() { |
| | |
| | | public void setRole(Role role) { |
| | | this.role = role; |
| | | } |
| | | |
| | | public String getPushKey() { |
| | | return pushKey; |
| | | } |
| | | |
| | | public void setPushKey(String pushKey) { |
| | | this.pushKey = pushKey; |
| | | } |
| | | } |
| | |
| | | import com.genersoft.iot.vmp.gb28181.bean.*; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.MediaItem; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.OnPublishHookParam; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo; |
| | | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; |
| | | import com.genersoft.iot.vmp.service.bean.MessageForPushChannel; |
| | | import com.genersoft.iot.vmp.service.bean.ThirdPartyGB; |
| | |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.util.*; |
| | | |
| | |
| | | |
| | | @Override |
| | | public void addStream(MediaServerItem mediaServerItem, String type, String app, String streamId, MediaItem mediaItem) { |
| | | // æ¥æ¾æ¯å¦ä½¿ç¨äºcallID |
| | | StreamAuthorityInfo streamAuthorityInfo = getStreamAuthorityInfo(app, streamId); |
| | | String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_" + type + "_" + app + "_" + streamId + "_" + mediaServerItem.getId(); |
| | | if (streamAuthorityInfo != null) { |
| | | mediaItem.setCallId(streamAuthorityInfo.getCallId()); |
| | | } |
| | | redis.set(key, mediaItem); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void updateStreamAuthorityInfo(String app, String stream, StreamAuthorityInfo streamAuthorityInfo) { |
| | | String key = VideoManagerConstants.MEDIA_STREAM_AUTHORITY + userSetting.getServerId() + "_" + app+ "_" + stream; |
| | | redis.set(key, streamAuthorityInfo); |
| | | } |
| | | |
| | | @Override |
| | | public void removeStreamAuthorityInfo(String app, String stream) { |
| | | String key = VideoManagerConstants.MEDIA_STREAM_AUTHORITY + userSetting.getServerId() + "_" + app+ "_" + stream ; |
| | | redis.del(key); |
| | | } |
| | | |
| | | @Override |
| | | public StreamAuthorityInfo getStreamAuthorityInfo(String app, String stream) { |
| | | String key = VideoManagerConstants.MEDIA_STREAM_AUTHORITY + userSetting.getServerId() + "_" + app+ "_" + stream ; |
| | | return (StreamAuthorityInfo) redis.get(key); |
| | | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public MediaItem getStreamInfo(String app, String streamId, String mediaServerId) { |
| | | String scanKey = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_*_" + app + "_" + streamId + "_" + mediaServerId; |
| | | |
| | |
| | | public boolean deviceIsOnline(String deviceId) { |
| | | return getDevice(deviceId).getOnline() == 1; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void sendStreamPushRequestedMsgForStatus() { |
| | | String key = VideoManagerConstants.VM_MSG_GET_ALL_ONLINE_REQUESTED; |
| | | logger.info("[redis éç¥]è·åæææ¨æµè®¾å¤çç¶æ"); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put(key, key); |
| | | redis.convertAndSend(key, jsonObject); |
| | | } |
| | | } |
| | |
| | | @Autowired |
| | | SipConfig sipConfig; |
| | | |
| | | @Autowired |
| | | DataSourceTransactionManager dataSourceTransactionManager; |
| | | |
| | | @Autowired |
| | | TransactionDefinition transactionDefinition; |
| | | |
| | | @Autowired |
| | | DataSourceTransactionManager dataSourceTransactionManager; |
| | | |
| | | @Autowired |
| | | private DeviceMapper deviceMapper; |
| | |
| | | @Override |
| | | public boolean exists(String deviceId) { |
| | | return deviceMapper.getDeviceByDeviceId(deviceId) != null; |
| | | } |
| | | |
| | | @Override |
| | | public synchronized void updateChannel(String deviceId, DeviceChannel channel) { |
| | | String channelId = channel.getChannelId(); |
| | | channel.setDeviceId(deviceId); |
| | | StreamInfo streamInfo = redisCatchStorage.queryPlayByDevice(deviceId, channelId); |
| | | if (streamInfo != null) { |
| | | channel.setStreamId(streamInfo.getStream()); |
| | | } |
| | | String now = DateUtil.getNow(); |
| | | channel.setUpdateTime(now); |
| | | DeviceChannel deviceChannel = deviceChannelMapper.queryChannel(deviceId, channelId); |
| | | if (deviceChannel == null) { |
| | | channel.setCreateTime(now); |
| | | deviceChannelMapper.add(channel); |
| | | }else { |
| | | deviceChannelMapper.update(channel); |
| | | } |
| | | deviceChannelMapper.updateChannelSubCount(deviceId,channel.getParentId()); |
| | | } |
| | | |
| | | @Override |
| | | public int updateChannels(String deviceId, List<DeviceChannel> channels) { |
| | | List<DeviceChannel> addChannels = new ArrayList<>(); |
| | | List<DeviceChannel> updateChannels = new ArrayList<>(); |
| | | HashMap<String, DeviceChannel> channelsInStore = new HashMap<>(); |
| | | if (channels != null && channels.size() > 0) { |
| | | List<DeviceChannel> channelList = deviceChannelMapper.queryChannels(deviceId, null, null, null, null); |
| | | if (channelList.size() == 0) { |
| | | for (DeviceChannel channel : channels) { |
| | | channel.setDeviceId(deviceId); |
| | | StreamInfo streamInfo = redisCatchStorage.queryPlayByDevice(deviceId, channel.getChannelId()); |
| | | if (streamInfo != null) { |
| | | channel.setStreamId(streamInfo.getStream()); |
| | | } |
| | | String now = DateUtil.getNow(); |
| | | channel.setUpdateTime(now); |
| | | channel.setCreateTime(now); |
| | | addChannels.add(channel); |
| | | } |
| | | }else { |
| | | for (DeviceChannel deviceChannel : channelList) { |
| | | channelsInStore.put(deviceChannel.getChannelId(), deviceChannel); |
| | | } |
| | | for (DeviceChannel channel : channels) { |
| | | channel.setDeviceId(deviceId); |
| | | StreamInfo streamInfo = redisCatchStorage.queryPlayByDevice(deviceId, channel.getChannelId()); |
| | | if (streamInfo != null) { |
| | | channel.setStreamId(streamInfo.getStream()); |
| | | } |
| | | String now = DateUtil.getNow(); |
| | | channel.setUpdateTime(now); |
| | | if (channelsInStore.get(channel.getChannelId()) != null) { |
| | | updateChannels.add(channel); |
| | | }else { |
| | | addChannels.add(channel); |
| | | channel.setCreateTime(now); |
| | | } |
| | | } |
| | | } |
| | | int limitCount = 300; |
| | | if (addChannels.size() > 0) { |
| | | if (addChannels.size() > limitCount) { |
| | | for (int i = 0; i < addChannels.size(); i += limitCount) { |
| | | int toIndex = i + limitCount; |
| | | if (i + limitCount > addChannels.size()) { |
| | | toIndex = addChannels.size(); |
| | | } |
| | | deviceChannelMapper.batchAdd(addChannels.subList(i, toIndex)); |
| | | } |
| | | }else { |
| | | deviceChannelMapper.batchAdd(addChannels); |
| | | } |
| | | } |
| | | if (updateChannels.size() > 0) { |
| | | if (updateChannels.size() > limitCount) { |
| | | for (int i = 0; i < updateChannels.size(); i += limitCount) { |
| | | int toIndex = i + limitCount; |
| | | if (i + limitCount > updateChannels.size()) { |
| | | toIndex = updateChannels.size(); |
| | | } |
| | | deviceChannelMapper.batchUpdate(updateChannels.subList(i, toIndex)); |
| | | } |
| | | }else { |
| | | deviceChannelMapper.batchUpdate(updateChannels); |
| | | } |
| | | } |
| | | } |
| | | return addChannels.size() + updateChannels.size(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | // æ´æ°ç¼å |
| | | parentPlatformCatch.setParentPlatform(parentPlatform); |
| | | redisCatchStorage.updatePlatformCatchInfo(parentPlatformCatch); |
| | | if (parentPlatform.isEnable()) { |
| | | // å
±äº«ææè§é¢æµï¼éè¦å°ç°æè§é¢æµæ·»å å°æ¤å¹³å° |
| | | List<GbStream> gbStreams = gbStreamMapper.queryStreamNotInPlatform(); |
| | | if (gbStreams.size() > 0) { |
| | | for (GbStream gbStream : gbStreams) { |
| | | gbStream.setCatalogId(parentPlatform.getCatalogId()); |
| | | } |
| | | if (parentPlatform.isShareAllLiveStream()) { |
| | | gbStreamService.addPlatformInfo(gbStreams, parentPlatform.getServerGBId(), parentPlatform.getCatalogId()); |
| | | }else { |
| | | gbStreamService.delPlatformInfo(parentPlatform.getServerGBId(), gbStreams); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return result > 0; |
| | | } |
| | |
| | | public List<DeviceChannelInPlatform> queryChannelListInParentPlatform(String platformId) { |
| | | |
| | | return deviceChannelMapper.queryChannelByPlatformId(platformId); |
| | | } |
| | | |
| | | @Override |
| | | public int updateChannelForGB(String platformId, List<ChannelReduce> channelReduces, String catalogId) { |
| | | |
| | | Map<Integer, ChannelReduce> deviceAndChannels = new HashMap<>(); |
| | | for (ChannelReduce channelReduce : channelReduces) { |
| | | channelReduce.setCatalogId(catalogId); |
| | | deviceAndChannels.put(channelReduce.getId(), channelReduce); |
| | | } |
| | | List<Integer> deviceAndChannelList = new ArrayList<>(deviceAndChannels.keySet()); |
| | | // æ¥è¯¢å½åå·²ç»åå¨ç |
| | | List<Integer> channelIds = platformChannelMapper.findChannelRelatedPlatform(platformId, channelReduces); |
| | | if (deviceAndChannelList != null) { |
| | | deviceAndChannelList.removeAll(channelIds); |
| | | } |
| | | for (Integer channelId : channelIds) { |
| | | deviceAndChannels.remove(channelId); |
| | | } |
| | | List<ChannelReduce> channelReducesToAdd = new ArrayList<>(deviceAndChannels.values()); |
| | | // 对å©ä¸çæ°æ®è¿è¡åå¨ |
| | | int result = 0; |
| | | if (channelReducesToAdd.size() > 0) { |
| | | result = platformChannelMapper.addChannels(platformId, channelReducesToAdd); |
| | | // TODO åç»ç»å¹³å°å¢å æ§å¶å¼å
³ä»¥æ§å¶æ¯å¦ååºç®å½è®¢é
|
| | | List<DeviceChannel> deviceChannelList = getDeviceChannelListByChannelReduceList(channelReducesToAdd, catalogId); |
| | | eventPublisher.catalogEventPublish(platformId, deviceChannelList, CatalogEvent.ADD); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | |
| | |
| | | return deviceMobilePositionMapper.clearMobilePositionsByDeviceId(deviceId); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢ä»£çæµ |
| | | * @param streamProxyItem |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean addStreamProxy(StreamProxyItem streamProxyItem) { |
| | | TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition); |
| | | boolean result = false; |
| | | streamProxyItem.setStreamType("proxy"); |
| | | streamProxyItem.setStatus(true); |
| | | String now = DateUtil.getNow(); |
| | | streamProxyItem.setCreateTime(now); |
| | | try { |
| | | if (streamProxyMapper.add(streamProxyItem) > 0) { |
| | | if (!StringUtils.isEmpty(streamProxyItem.getGbId())) { |
| | | if (gbStreamMapper.add(streamProxyItem) < 0) { |
| | | //äºå¡åæ» |
| | | dataSourceTransactionManager.rollback(transactionStatus); |
| | | return false; |
| | | } |
| | | } |
| | | }else { |
| | | //äºå¡åæ» |
| | | dataSourceTransactionManager.rollback(transactionStatus); |
| | | return false; |
| | | } |
| | | result = true; |
| | | dataSourceTransactionManager.commit(transactionStatus); //æå¨æäº¤ |
| | | }catch (Exception e) { |
| | | logger.error("åæ°æ®åºæ·»å æµä»£ç失败ï¼", e); |
| | | dataSourceTransactionManager.rollback(transactionStatus); |
| | | } |
| | | |
| | | |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * æ´æ°ä»£çæµ |
| | | * @param streamProxyItem |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean updateStreamProxy(StreamProxyItem streamProxyItem) { |
| | | TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition); |
| | | boolean result = false; |
| | | streamProxyItem.setStreamType("proxy"); |
| | | try { |
| | | if (streamProxyMapper.update(streamProxyItem) > 0) { |
| | | if (!StringUtils.isEmpty(streamProxyItem.getGbId())) { |
| | | if (gbStreamMapper.updateByAppAndStream(streamProxyItem) == 0) { |
| | | //äºå¡åæ» |
| | | dataSourceTransactionManager.rollback(transactionStatus); |
| | | return false; |
| | | } |
| | | } |
| | | } else { |
| | | //äºå¡åæ» |
| | | dataSourceTransactionManager.rollback(transactionStatus); |
| | | return false; |
| | | } |
| | | |
| | | dataSourceTransactionManager.commit(transactionStatus); //æå¨æäº¤ |
| | | result = true; |
| | | }catch (Exception e) { |
| | | e.printStackTrace(); |
| | | dataSourceTransactionManager.rollback(transactionStatus); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * ç§»é¤ä»£çæµ |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<GbStream> queryGbStreamListInPlatform(String platformId) { |
| | | public List<DeviceChannel> queryGbStreamListInPlatform(String platformId) { |
| | | return gbStreamMapper.queryGbStreamListInPlatform(platformId); |
| | | } |
| | | |
| | |
| | | streamPushMapper.addAll(streamPushItems); |
| | | // TODO å¾
ä¼å |
| | | for (int i = 0; i < streamPushItems.size(); i++) { |
| | | int onlineResult = gbStreamMapper.setStatus(streamPushItems.get(i).getApp(), streamPushItems.get(i).getStream(), true); |
| | | int onlineResult = mediaOnline(streamPushItems.get(i).getApp(), streamPushItems.get(i).getStream()); |
| | | if (onlineResult > 0) { |
| | | // åéä¸çº¿éç¥ |
| | | eventPublisher.catalogEventPublishForStream(null, streamPushItems.get(i), CatalogEvent.ON); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public void updateMedia(StreamPushItem streamPushItem) { |
| | | streamPushMapper.del(streamPushItem.getApp(), streamPushItem.getStream()); |
| | | streamPushMapper.add(streamPushItem); |
| | | gbStreamMapper.setStatus(streamPushItem.getApp(), streamPushItem.getStream(), true); |
| | | |
| | | if(!StringUtils.isEmpty(streamPushItem.getGbId() )){ |
| | | // æ¥æ¾å¼å¯äºå
¨é¨ç´ææµå
±äº«çä¸çº§å¹³å° |
| | | List<ParentPlatform> parentPlatforms = parentPlatformMapper.selectAllAhareAllLiveStream(); |
| | | if (parentPlatforms.size() > 0) { |
| | | for (ParentPlatform parentPlatform : parentPlatforms) { |
| | | StreamProxyItem streamProxyItem = platformGbStreamMapper.selectOne(streamPushItem.getApp(), streamPushItem.getStream(), |
| | | parentPlatform.getServerGBId()); |
| | | if (streamProxyItem == null) { |
| | | streamPushItem.setCatalogId(parentPlatform.getCatalogId()); |
| | | streamPushItem.setPlatformId(parentPlatform.getServerGBId()); |
| | | platformGbStreamMapper.add(streamPushItem); |
| | | eventPublisher.catalogEventPublishForStream(parentPlatform.getServerGBId(), streamPushItem, CatalogEvent.ADD); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | mediaOffline(streamPushItem.getApp(), streamPushItem.getStream()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @Override |
| | | public int mediaOutline(String app, String streamId) { |
| | | return gbStreamMapper.setStatus(app, streamId, false); |
| | | public int mediaOffline(String app, String stream) { |
| | | GbStream gbStream = gbStreamMapper.selectOne(app, stream); |
| | | int result; |
| | | if ("proxy".equals(gbStream.getStreamType())) { |
| | | result = streamProxyMapper.updateStatus(app, stream, false); |
| | | }else { |
| | | result = streamPushMapper.updateStatus(app, stream, false); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public int mediaOnline(String app, String stream) { |
| | | GbStream gbStream = gbStreamMapper.selectOne(app, stream); |
| | | int result; |
| | | if ("proxy".equals(gbStream.getStreamType())) { |
| | | result = streamProxyMapper.updateStatus(app, stream, true); |
| | | }else { |
| | | result = streamPushMapper.updateStatus(app, stream, true); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public int addCatalog(PlatformCatalog platformCatalog) { |
| | | ParentPlatform platform = platformMapper.getParentPlatByServerGBId(platformCatalog.getPlatformId()); |
| | | if (platform == null) { |
| | | return 0; |
| | | } |
| | | if (platform.getTreeType().equals(TreeType.BUSINESS_GROUP)) { |
| | | if (platformCatalog.getPlatformId().equals(platformCatalog.getParentId())) { |
| | | // 第ä¸å±èç¹ |
| | | platformCatalog.setBusinessGroupId(platformCatalog.getId()); |
| | | }else { |
| | | // è·åé¡¶å±ç |
| | | PlatformCatalog topCatalog = getTopCatalog(platformCatalog.getParentId(), platformCatalog.getPlatformId()); |
| | | platformCatalog.setBusinessGroupId(topCatalog.getId()); |
| | | } |
| | | } |
| | | if (platform.getTreeType().equals(TreeType.CIVIL_CODE)) { |
| | | platformCatalog.setCivilCode(platformCatalog.getId()); |
| | | } |
| | | |
| | | int result = catalogMapper.add(platformCatalog); |
| | | if (result > 0) { |
| | | DeviceChannel deviceChannel = getDeviceChannelByCatalog(platformCatalog); |
| | | eventPublisher.catalogEventPublish(platformCatalog.getPlatformId(), deviceChannel, CatalogEvent.ADD); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | private PlatformCatalog getTopCatalog(String id, String platformId) { |
| | | PlatformCatalog catalog = catalogMapper.selectParentCatalog(id); |
| | | if (catalog.getParentId().equals(platformId)) { |
| | | return catalog; |
| | | }else { |
| | | return getTopCatalog(catalog.getParentId(), platformId); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<PlatformCatalog> queryCatalogInPlatform(String platformId) { |
| | | return catalogMapper.selectByPlatForm(platformId); |
| | | public List<DeviceChannel> queryCatalogInPlatform(String platformId) { |
| | | return catalogMapper.queryCatalogInPlatform(platformId); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | private DeviceChannel getDeviceChannelByCatalog(PlatformCatalog catalog) { |
| | | ParentPlatform parentPlatByServerGBId = platformMapper.getParentPlatByServerGBId(catalog.getPlatformId()); |
| | | ParentPlatform platform = platformMapper.getParentPlatByServerGBId(catalog.getPlatformId()); |
| | | DeviceChannel deviceChannel = new DeviceChannel(); |
| | | deviceChannel.setChannelId(catalog.getId()); |
| | | deviceChannel.setName(catalog.getName()); |
| | | deviceChannel.setLongitude(0.0); |
| | | deviceChannel.setLatitude(0.0); |
| | | deviceChannel.setDeviceId(parentPlatByServerGBId.getDeviceGBId()); |
| | | deviceChannel.setDeviceId(platform.getDeviceGBId()); |
| | | deviceChannel.setManufacture("wvp-pro"); |
| | | deviceChannel.setStatus(1); |
| | | deviceChannel.setParental(1); |
| | | deviceChannel.setParentId(catalog.getParentId()); |
| | | |
| | | deviceChannel.setRegisterWay(1); |
| | | // è¡æ¿åºååºè¯¥æ¯Domainçåå
«ä½ |
| | | deviceChannel.setCivilCode(parentPlatByServerGBId.getAdministrativeDivision()); |
| | | if (platform.getTreeType().equals(TreeType.BUSINESS_GROUP)) { |
| | | deviceChannel.setParentId(catalog.getParentId()); |
| | | deviceChannel.setBusinessGroupId(catalog.getBusinessGroupId()); |
| | | } |
| | | |
| | | deviceChannel.setModel("live"); |
| | | deviceChannel.setOwner("wvp-pro"); |
| | | deviceChannel.setSecrecy("0"); |
| | |
| | | |
| | | deviceChannelMapper.updatePosition(deviceChannel); |
| | | } |
| | | |
| | | @Override |
| | | public void cleanContentForPlatform(String serverGBId) { |
| | | // List<PlatformCatalog> catalogList = catalogMapper.selectByPlatForm(serverGBId); |
| | | // if (catalogList.size() > 0) { |
| | | // int result = catalogMapper.delByPlatformId(serverGBId); |
| | | // if (result > 0) { |
| | | // List<DeviceChannel> deviceChannels = new ArrayList<>(); |
| | | // for (PlatformCatalog catalog : catalogList) { |
| | | // deviceChannels.add(getDeviceChannelByCatalog(catalog)); |
| | | // } |
| | | // eventPublisher.catalogEventPublish(serverGBId, deviceChannels, CatalogEvent.DEL); |
| | | // } |
| | | // } |
| | | catalogMapper.delByPlatformId(serverGBId); |
| | | platformChannelMapper.delByPlatformId(serverGBId); |
| | | platformGbStreamMapper.delByPlatformId(serverGBId); |
| | | } |
| | | |
| | | @Override |
| | | public List<DeviceChannel> queryChannelWithCatalog(String serverGBId) { |
| | | return deviceChannelMapper.queryChannelWithCatalog(serverGBId); |
| | | } |
| | | } |
| | |
| | | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; |
| | | import com.genersoft.iot.vmp.service.IDeviceChannelService; |
| | | import com.genersoft.iot.vmp.service.IDeviceService; |
| | | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| | | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| | |
| | | |
| | | @Autowired |
| | | private IVideoManagerStorage storager; |
| | | |
| | | @Autowired |
| | | private IDeviceChannelService deviceChannelService; |
| | | |
| | | @Autowired |
| | | private IRedisCatchStorage redisCatchStorage; |
| | |
| | | }) |
| | | @PostMapping("/channel/update/{deviceId}") |
| | | public ResponseEntity<PageInfo> updateChannel(@PathVariable String deviceId,DeviceChannel channel){ |
| | | storager.updateChannel(deviceId, channel); |
| | | deviceChannelService.updateChannel(deviceId, channel); |
| | | return new ResponseEntity<>(null,HttpStatus.OK); |
| | | } |
| | | |
| | |
| | | @ApiImplicitParam(name = "platformId", value = "å¹³å°ID", required = true , dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "catalogId", value = "ç®å½ID", required = false , dataTypeClass = String.class), |
| | | @ApiImplicitParam(name="query", value = "æ¥è¯¢å
容", required = false , dataTypeClass = String.class), |
| | | @ApiImplicitParam(name="pushing", value = "æ¯å¦æ£å¨æ¨æµ", required = false , dataTypeClass = Boolean.class), |
| | | @ApiImplicitParam(name="mediaServerId", value = "æµåªä½ID", required = false , dataTypeClass = String.class), |
| | | |
| | | }) |
| | |
| | | @RequestParam(required = true)String platformId, |
| | | @RequestParam(required = false)String catalogId, |
| | | @RequestParam(required = false)String query, |
| | | @RequestParam(required = false)Boolean pushing, |
| | | @RequestParam(required = false)String mediaServerId){ |
| | | if (StringUtils.isEmpty(catalogId)) { |
| | | catalogId = null; |
| | |
| | | |
| | | // catalogId 为null æ¥è¯¢æªå¨å¹³å°ä¸åé
çæ°æ® |
| | | // catalogId ä¸ä¸ºnull æ¥è¯¢å¹³å°ä¸è¿ä¸ªï¼ç®å½ä¸çéé |
| | | return gbStreamService.getAll(page, count, platformId, catalogId, query, pushing, mediaServerId); |
| | | return gbStreamService.getAll(page, count, platformId, catalogId, query, mediaServerId); |
| | | } |
| | | |
| | | |
| | |
| | | package com.genersoft.iot.vmp.vmanager.gb28181.media; |
| | | |
| | | import com.genersoft.iot.vmp.common.StreamInfo; |
| | | import com.genersoft.iot.vmp.conf.security.SecurityUtils; |
| | | import com.genersoft.iot.vmp.conf.security.dto.LoginUser; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.OnPublishHookParam; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo; |
| | | import com.genersoft.iot.vmp.service.IMediaServerService; |
| | | import com.genersoft.iot.vmp.service.IStreamPushService; |
| | | import com.genersoft.iot.vmp.service.IMediaService; |
| | | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| | | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| | | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| | | import io.swagger.annotations.Api; |
| | |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | |
| | | @Api(tags = "åªä½æµç¸å
³") |
| | | @Controller |
| | |
| | | private final static Logger logger = LoggerFactory.getLogger(MediaController.class); |
| | | |
| | | @Autowired |
| | | private IVideoManagerStorage storager; |
| | | |
| | | @Autowired |
| | | private IStreamPushService streamPushService; |
| | | private IRedisCatchStorage redisCatchStorage; |
| | | |
| | | @Autowired |
| | | private IMediaService mediaService; |
| | | |
| | | @Autowired |
| | | private IMediaServerService mediaServerService; |
| | | |
| | | |
| | | /** |
| | |
| | | }) |
| | | @GetMapping(value = "/stream_info_by_app_and_stream") |
| | | @ResponseBody |
| | | public WVPResult<StreamInfo> getStreamInfoByAppAndStream(@RequestParam String app, @RequestParam String stream, @RequestParam(required = false) String mediaServerId){ |
| | | StreamInfo streamInfoByAppAndStreamWithCheck = mediaService.getStreamInfoByAppAndStreamWithCheck(app, stream, mediaServerId); |
| | | public WVPResult<StreamInfo> getStreamInfoByAppAndStream(HttpServletRequest request, @RequestParam String app, |
| | | @RequestParam String stream, |
| | | @RequestParam(required = false) String mediaServerId, |
| | | @RequestParam(required = false) String callId, |
| | | @RequestParam(required = false) Boolean useSourceIpAsStreamIp){ |
| | | boolean authority = false; |
| | | if (callId != null) { |
| | | // æéæ ¡éª |
| | | StreamAuthorityInfo streamAuthorityInfo = redisCatchStorage.getStreamAuthorityInfo(app, stream); |
| | | if (streamAuthorityInfo.getCallId().equals(callId)) { |
| | | authority = true; |
| | | }else { |
| | | WVPResult<StreamInfo> result = new WVPResult<>(); |
| | | result.setCode(401); |
| | | result.setMsg("fail"); |
| | | return result; |
| | | } |
| | | }else { |
| | | // æ¯å¦ç»éç¨æ·, ç»éç¨æ·è¿å宿´ä¿¡æ¯ |
| | | LoginUser userInfo = SecurityUtils.getUserInfo(); |
| | | if (userInfo!= null) { |
| | | authority = true; |
| | | } |
| | | } |
| | | |
| | | StreamInfo streamInfo; |
| | | |
| | | if (useSourceIpAsStreamIp != null && useSourceIpAsStreamIp) { |
| | | String host = request.getHeader("Host"); |
| | | String localAddr = host.split(":")[0]; |
| | | logger.info("使ç¨{}ä½ä¸ºè¿åæµçip", localAddr); |
| | | streamInfo = mediaService.getStreamInfoByAppAndStreamWithCheck(app, stream, mediaServerId, localAddr, authority); |
| | | }else { |
| | | streamInfo = mediaService.getStreamInfoByAppAndStreamWithCheck(app, stream, mediaServerId, authority); |
| | | } |
| | | |
| | | WVPResult<StreamInfo> result = new WVPResult<>(); |
| | | if (streamInfoByAppAndStreamWithCheck != null){ |
| | | if (streamInfo != null){ |
| | | result.setCode(0); |
| | | result.setMsg("scccess"); |
| | | result.setData(streamInfoByAppAndStreamWithCheck); |
| | | result.setData(streamInfo); |
| | | }else { |
| | | result.setCode(-1); |
| | | result.setMsg("fail"); |
| | |
| | | import com.genersoft.iot.vmp.gb28181.bean.PlatformCatalog; |
| | | import com.genersoft.iot.vmp.gb28181.bean.SubscribeHolder; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; |
| | | import com.genersoft.iot.vmp.service.IPlatformChannelService; |
| | | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| | | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| | | import com.genersoft.iot.vmp.utils.DateUtil; |
| | |
| | | |
| | | @Autowired |
| | | private IVideoManagerStorage storager; |
| | | |
| | | @Autowired |
| | | private IPlatformChannelService platformChannelService; |
| | | |
| | | @Autowired |
| | | private IRedisCatchStorage redisCatchStorage; |
| | |
| | | parentPlatform.setCharacterSet(parentPlatform.getCharacterSet().toUpperCase()); |
| | | ParentPlatform parentPlatformOld = storager.queryParentPlatByServerGBId(parentPlatform.getServerGBId()); |
| | | parentPlatform.setUpdateTime(DateUtil.getNow()); |
| | | if (!parentPlatformOld.getTreeType().equals(parentPlatform.getTreeType())) { |
| | | // ç®å½ç»æåçååï¼æ¸
空ä¹åçå
³èå
³ç³» |
| | | logger.info("ä¿åå¹³å°{}æ¶åç°ç®å½ç»æååï¼æ¸
空å
³èå
³ç³»", parentPlatform.getDeviceGBId()); |
| | | storager.cleanContentForPlatform(parentPlatform.getServerGBId()); |
| | | |
| | | } |
| | | boolean updateResult = storager.updateParentPlatform(parentPlatform); |
| | | |
| | | if (updateResult) { |
| | |
| | | } |
| | | } else if (parentPlatformOld != null && parentPlatformOld.isEnable() && !parentPlatform.isEnable()) { // å
³éå¯ç¨æ¶æ³¨é |
| | | commanderForPlatform.unregister(parentPlatformOld, null, null); |
| | | // åæ¢è®¢é
ç¸å
³ç宿¶ä»»å¡ |
| | | subscribeHolder.removeAllSubscribe(parentPlatform.getServerGBId()); |
| | | } |
| | | wvpResult.setCode(0); |
| | | wvpResult.setMsg("success"); |
| | |
| | | if (logger.isDebugEnabled()) { |
| | | logger.debug("ç»ä¸çº§å¹³å°æ·»å 彿 ééAPIè°ç¨"); |
| | | } |
| | | int result = storager.updateChannelForGB(param.getPlatformId(), param.getChannelReduces(), param.getCatalogId()); |
| | | int result = platformChannelService.updateChannelForGB(param.getPlatformId(), param.getChannelReduces(), param.getCatalogId()); |
| | | |
| | | return new ResponseEntity<>(String.valueOf(result > 0), HttpStatus.OK); |
| | | } |
| | |
| | | } |
| | | PlatformCatalog platformCatalogInStore = storager.getCatalog(platformCatalog.getId()); |
| | | WVPResult<List<PlatformCatalog>> result = new WVPResult<>(); |
| | | |
| | | |
| | | if (platformCatalogInStore != null) { |
| | | result.setCode(-1); |
| | |
| | | JSONObject data = jsonObject.getJSONObject("data"); |
| | | if (data != null) { |
| | | result.put("key", data.getString("key")); |
| | | StreamInfo streamInfoResult = mediaService.getStreamInfoByAppAndStreamWithCheck("convert", streamId, mediaInfo.getId()); |
| | | StreamInfo streamInfoResult = mediaService.getStreamInfoByAppAndStreamWithCheck("convert", streamId, mediaInfo.getId(), false); |
| | | result.put("data", streamInfoResult); |
| | | } |
| | | }else { |
| | |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.alibaba.excel.ExcelReader; |
| | | import com.alibaba.excel.read.metadata.ReadSheet; |
| | | import com.genersoft.iot.vmp.common.StreamInfo; |
| | | import com.genersoft.iot.vmp.conf.security.SecurityUtils; |
| | | import com.genersoft.iot.vmp.conf.security.dto.LoginUser; |
| | | import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; |
| | | import com.genersoft.iot.vmp.service.IMediaServerService; |
| | | import com.genersoft.iot.vmp.service.IMediaService; |
| | | import com.genersoft.iot.vmp.service.IStreamPushService; |
| | | import com.genersoft.iot.vmp.service.impl.StreamPushUploadFileHandler; |
| | | import com.genersoft.iot.vmp.vmanager.bean.BatchGBStreamParam; |
| | |
| | | import org.springframework.web.context.request.async.DeferredResult; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.util.HashMap; |
| | |
| | | |
| | | @Autowired |
| | | private DeferredResultHolder resultHolder; |
| | | |
| | | @Autowired |
| | | private IMediaService mediaService; |
| | | |
| | | @ApiOperation("æ¨æµå表æ¥è¯¢") |
| | | @ApiImplicitParams({ |
| | |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * è·åæ¨æµææ¾å°å |
| | | * @param app åºç¨å |
| | | * @param stream æµid |
| | | * @return |
| | | */ |
| | | @ApiOperation("è·åæ¨æµææ¾å°å") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "app", value = "åºç¨å", dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "stream", value = "æµid", dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "mediaServerId", value = "åªä½æå¡å¨id", dataTypeClass = String.class, required = false), |
| | | }) |
| | | @GetMapping(value = "/getPlayUrl") |
| | | @ResponseBody |
| | | public WVPResult<StreamInfo> getPlayUrl(HttpServletRequest request, @RequestParam String app, |
| | | @RequestParam String stream, |
| | | @RequestParam(required = false) String mediaServerId){ |
| | | boolean authority = false; |
| | | // æ¯å¦ç»éç¨æ·, ç»éç¨æ·è¿å宿´ä¿¡æ¯ |
| | | LoginUser userInfo = SecurityUtils.getUserInfo(); |
| | | if (userInfo!= null) { |
| | | authority = true; |
| | | } |
| | | |
| | | StreamInfo streamInfo = mediaService.getStreamInfoByAppAndStreamWithCheck(app, stream, mediaServerId, authority); |
| | | |
| | | WVPResult<StreamInfo> result = new WVPResult<>(); |
| | | if (streamInfo != null){ |
| | | result.setCode(0); |
| | | result.setMsg("scccess"); |
| | | result.setData(streamInfo); |
| | | }else { |
| | | result.setCode(-1); |
| | | result.setMsg("fail"); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import com.genersoft.iot.vmp.storager.dao.dto.User; |
| | | import com.genersoft.iot.vmp.utils.DateUtil; |
| | | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| | | import com.github.pagehelper.PageInfo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | User user = new User(); |
| | | user.setUsername(username); |
| | | user.setPassword(DigestUtils.md5DigestAsHex(password.getBytes())); |
| | | |
| | | //æ°å¢ç¨æ·çpushKeyççæè§å为md5(æ¶é´æ³+ç¨æ·å) |
| | | user.setPushKey(DigestUtils.md5DigestAsHex((System.currentTimeMillis()+password).getBytes())); |
| | | Role role = roleService.getRoleById(roleId); |
| | | |
| | | if (role == null) { |
| | |
| | | user.setCreateTime(DateUtil.getNow()); |
| | | user.setUpdateTime(DateUtil.getNow()); |
| | | int addResult = userService.addUser(user); |
| | | |
| | | |
| | | result.setCode(addResult > 0 ? 0 : -1); |
| | | result.setMsg(addResult > 0 ? "success" : "fail"); |
| | |
| | | result.setData(allUsers); |
| | | return new ResponseEntity<>(result, HttpStatus.OK); |
| | | } |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ç¨æ· |
| | | * |
| | | * @param page å½å页 |
| | | * @param count æ¯é¡µæ¥è¯¢æ°é |
| | | * @return åé¡µç¨æ·å表 |
| | | */ |
| | | @ApiOperation("å页æ¥è¯¢ç¨æ·") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "page", value = "å½å页", required = true, dataTypeClass = Integer.class), |
| | | @ApiImplicitParam(name = "count", value = "æ¯é¡µæ¥è¯¢æ°é", required = true, dataTypeClass = Integer.class), |
| | | }) |
| | | @GetMapping("/users") |
| | | public PageInfo<User> users(int page, int count) { |
| | | return userService.getUsers(page, count); |
| | | } |
| | | |
| | | @ApiOperation("ä¿®æ¹pushkey") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "userId", required = true, value = "ç¨æ·Id", dataTypeClass = Integer.class), |
| | | @ApiImplicitParam(name = "pushKey", required = true, value = "æ°çpushKey", dataTypeClass = String.class), |
| | | }) |
| | | @RequestMapping("/changePushKey") |
| | | public ResponseEntity<WVPResult<String>> changePushKey(@RequestParam Integer userId,@RequestParam String pushKey) { |
| | | // è·åå½åç»å½ç¨æ·id |
| | | int currenRoleId = SecurityUtils.getUserInfo().getRole().getId(); |
| | | WVPResult<String> result = new WVPResult<>(); |
| | | if (currenRoleId != 1) { |
| | | // åªç¨è§è²id为0æå¯ä»¥å é¤åæ·»å ç¨æ· |
| | | result.setCode(-1); |
| | | result.setMsg("ç¨æ·æ æé"); |
| | | return new ResponseEntity<>(result, HttpStatus.FORBIDDEN); |
| | | } |
| | | int resetPushKeyResult = userService.changePushKey(userId,pushKey); |
| | | |
| | | result.setCode(resetPushKeyResult > 0 ? 0 : -1); |
| | | result.setMsg(resetPushKeyResult > 0 ? "success" : "fail"); |
| | | return new ResponseEntity<>(result, HttpStatus.OK); |
| | | } |
| | | |
| | | @ApiOperation("管çåä¿®æ¹æ®éç¨æ·å¯ç ") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "adminId", required = true, value = "管çåid", dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "userId", required = true, value = "ç¨æ·id", dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "password", required = true, value = "æ°å¯ç ï¼æªmd5å å¯çå¯ç ï¼", dataTypeClass = String.class), |
| | | }) |
| | | @PostMapping("/changePasswordForAdmin") |
| | | public String changePasswordForAdmin(@RequestParam int userId, @RequestParam String password) { |
| | | // è·åå½åç»å½ç¨æ·id |
| | | LoginUser userInfo = SecurityUtils.getUserInfo(); |
| | | if (userInfo == null) { |
| | | return "fail"; |
| | | } |
| | | Role role = userInfo.getRole(); |
| | | if (role != null && role.getId() == 1) { |
| | | boolean result = userService.changePassword(userId, DigestUtils.md5DigestAsHex(password.getBytes())); |
| | | if (result) { |
| | | return "success"; |
| | | } |
| | | } |
| | | |
| | | return "fail"; |
| | | } |
| | | } |
| | |
| | | record-sip: true |
| | | # æ¯å¦å°æ¥å¿åå¨è¿æ°æ®åº |
| | | logInDatebase: true |
| | | # ç¬¬ä¸æ¹å¹é
ï¼ç¨äºä»streaméè·åææä¿¡æ¯ |
| | | thirdPartyGBIdReg: "[\\s\\S]*" |
| | | |
| | | # å¨çº¿ææ¡£ï¼ swagger-uiï¼ç产ç¯å¢å»ºè®®å
³éï¼ |
| | | swagger-ui: |
| | |
| | | }).then(function (res) { |
| | | console.log(JSON.stringify(res)); |
| | | if (res.data.code == 0 && res.data.msg == "success") { |
| | | that.$cookies.set("session", {"username": that.username}) ; |
| | | that.$cookies.set("session", {"username": that.username,"roleId":res.data.data.role.id}) ; |
| | | //ç»å½æåå |
| | | that.cancelEnterkeyDefaultAction(); |
| | | that.$router.push('/'); |
| | |
| | | }); |
| | | }, |
| | | chooseChannel: function(platform) { |
| | | this.$refs.chooseChannelDialog.openDialog(platform.serverGBId, platform.name, platform.catalogId, this.initData) |
| | | this.$refs.chooseChannelDialog.openDialog(platform.serverGBId, platform.name, platform.catalogId, platform.treeType, this.initData) |
| | | }, |
| | | initData: function() { |
| | | this.getPlatformList(); |
| | |
| | | <el-table-column label="å¼å§æ¶é´" min-width="200"> |
| | | <template slot-scope="scope"> |
| | | <el-button-group> |
| | | {{ dateFormat(parseInt(scope.row.createStamp)) }} |
| | | {{ scope.row.pushTime == null? "-":scope.row.pushTime }} |
| | | </el-button-group> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æ£å¨æ¨æµ" min-width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ (scope.row.status == false && scope.row.gbId == null) || scope.row.status ? 'æ¯' : 'å¦' }} |
| | | {{scope.row.pushIng ? 'æ¯' : 'å¦' }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æ¬å¹³å°æ¨æµ" min-width="100"> |
| | | <template slot-scope="scope"> |
| | | {{scope.row.pushIng && !!!scope.row.serverId ? 'æ¯' : 'å¦' }} |
| | | </template> |
| | | </el-table-column> |
| | | |
| | |
| | | this.getListLoading = true; |
| | | this.$axios({ |
| | | method: 'get', |
| | | url: '/api/media/stream_info_by_app_and_stream', |
| | | url: '/api/push/getPlayUrl', |
| | | params: { |
| | | app: row.app, |
| | | stream: row.stream, |
| | |
| | | }).catch(function (error) { |
| | | console.error(error); |
| | | }); |
| | | }, |
| | | dateFormat: function (/** timestamp=0 **/) { |
| | | let ts = arguments[0] || 0; |
| | | let t, y, m, d, h, i, s; |
| | | t = ts ? new Date(ts) : new Date(); |
| | | y = t.getFullYear(); |
| | | m = t.getMonth() + 1; |
| | | d = t.getDate(); |
| | | h = t.getHours(); |
| | | i = t.getMinutes(); |
| | | s = t.getSeconds(); |
| | | // 坿 ¹æ®éè¦å¨è¿éå®ä¹æ¶é´æ ¼å¼ |
| | | return y + '-' + (m < 10 ? '0' + m : m) + '-' + (d < 10 ? '0' + d : d) + ' ' + (h < 10 ? '0' + h : h) + ':' + (i < 10 ? '0' + i : i) + ':' + (s < 10 ? '0' + s : s); |
| | | }, |
| | | importChannel: function () { |
| | | this.$refs.importChannel.openDialog(() => { |
New file |
| | |
| | | <template> |
| | | |
| | | <div id="app" style="width: 100%"> |
| | | <div class="page-header"> |
| | | |
| | | <div class="page-title">ç¨æ·å表</div> |
| | | <div class="page-header-btn"> |
| | | <el-button icon="el-icon-plus" size="mini" style="margin-right: 1rem;" type="primary" @click="addUser"> |
| | | æ·»å ç¨æ· |
| | | </el-button> |
| | | |
| | | </div> |
| | | </div> |
| | | <!--ç¨æ·å表--> |
| | | <el-table :data="userList" style="width: 100%;font-size: 12px;" :height="winHeight" |
| | | header-row-class-name="table-header"> |
| | | <el-table-column prop="username" label="ç¨æ·å" min-width="160"/> |
| | | <el-table-column prop="pushKey" label="pushkey" min-width="160"/> |
| | | <el-table-column prop="role.name" label="ç±»å" min-width="160"/> |
| | | <el-table-column label="æä½" min-width="450" fixed="right"> |
| | | <template slot-scope="scope"> |
| | | <el-button size="medium" icon="el-icon-edit" type="text" @click="edit(scope.row)">ä¿®æ¹å¯ç </el-button> |
| | | <el-divider direction="vertical"></el-divider> |
| | | <el-button size="medium" icon="el-icon-edit" type="text" @click="changePushKey(scope.row)">ä¿®æ¹pushkey</el-button> |
| | | <el-divider direction="vertical"></el-divider> |
| | | <el-button size="medium" icon="el-icon-delete" type="text" @click="deleteUser(scope.row)" |
| | | style="color: #f56c6c">å é¤ |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <changePasswordForAdmin ref="changePasswordForAdmin"></changePasswordForAdmin> |
| | | <changePushKey ref="changePushKey"></changePushKey> |
| | | <addUser ref="addUser"></addUser> |
| | | <el-pagination |
| | | style="float: right" |
| | | @size-change="handleSizeChange" |
| | | @current-change="currentChange" |
| | | :current-page="currentPage" |
| | | :page-size="count" |
| | | :page-sizes="[15, 25, 35, 50]" |
| | | layout="total, sizes, prev, pager, next" |
| | | :total="total"> |
| | | </el-pagination> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import uiHeader from '../layout/UiHeader.vue' |
| | | import changePasswordForAdmin from './dialog/changePasswordForAdmin.vue' |
| | | import changePushKey from './dialog/changePushKey.vue' |
| | | import addUser from '../components/dialog/addUser.vue' |
| | | |
| | | export default { |
| | | name: 'userManager', |
| | | components: { |
| | | uiHeader, |
| | | changePasswordForAdmin, |
| | | changePushKey, |
| | | addUser |
| | | }, |
| | | data() { |
| | | return { |
| | | userList: [], //设å¤å表 |
| | | currentUser: {}, //å½åæä½è®¾å¤å¯¹è±¡ |
| | | |
| | | videoComponentList: [], |
| | | updateLooper: 0, //æ°æ®å·æ°è½®è®æ å¿ |
| | | currentUserLenth: 0, |
| | | winHeight: window.innerHeight - 200, |
| | | currentPage: 1, |
| | | count: 15, |
| | | total: 0, |
| | | getUserListLoading: false |
| | | }; |
| | | }, |
| | | mounted() { |
| | | this.initData(); |
| | | this.updateLooper = setInterval(this.initData, 10000); |
| | | }, |
| | | destroyed() { |
| | | this.$destroy('videojs'); |
| | | clearTimeout(this.updateLooper); |
| | | }, |
| | | methods: { |
| | | initData: function () { |
| | | this.getUserList(); |
| | | }, |
| | | currentChange: function (val) { |
| | | this.currentPage = val; |
| | | this.getUserList(); |
| | | }, |
| | | handleSizeChange: function (val) { |
| | | this.count = val; |
| | | this.getUserList(); |
| | | }, |
| | | getUserList: function () { |
| | | let that = this; |
| | | this.getUserListLoading = true; |
| | | this.$axios({ |
| | | method: 'get', |
| | | url: `/api/user/users`, |
| | | params: { |
| | | page: that.currentPage, |
| | | count: that.count |
| | | } |
| | | }).then(function (res) { |
| | | that.total = res.data.total; |
| | | that.userList = res.data.list; |
| | | that.getUserListLoading = false; |
| | | }).catch(function (error) { |
| | | that.getUserListLoading = false; |
| | | }); |
| | | |
| | | }, |
| | | edit: function (row) { |
| | | this.$refs.changePasswordForAdmin.openDialog(row, () => { |
| | | this.$refs.changePasswordForAdmin.close(); |
| | | this.$message({ |
| | | showClose: true, |
| | | message: "å¯ç ä¿®æ¹æå", |
| | | type: "success", |
| | | }); |
| | | setTimeout(this.getUserList, 200) |
| | | |
| | | }) |
| | | }, |
| | | deleteUser: function (row) { |
| | | let msg = "ç¡®å®å 餿¤ç¨æ·ï¼" |
| | | if (row.online !== 0) { |
| | | msg = "<strong>ç¡®å®å 餿¤ç¨æ·ï¼</strong>" |
| | | } |
| | | this.$confirm(msg, 'æç¤º', { |
| | | dangerouslyUseHTMLString: true, |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | center: true, |
| | | type: 'warning' |
| | | }).then(() => { |
| | | this.$axios({ |
| | | method: 'delete', |
| | | url: `/api/user/delete?id=${row.id}` |
| | | }).then((res) => { |
| | | this.getUserList(); |
| | | }).catch((error) => { |
| | | console.error(error); |
| | | }); |
| | | }).catch(() => { |
| | | |
| | | }); |
| | | |
| | | |
| | | }, |
| | | |
| | | changePushKey: function (row) { |
| | | this.$refs.changePushKey.openDialog(row, () => { |
| | | this.$refs.changePushKey.close(); |
| | | this.$message({ |
| | | showClose: true, |
| | | message: "pushKeyä¿®æ¹æå", |
| | | type: "success", |
| | | }); |
| | | setTimeout(this.getUserList, 200) |
| | | |
| | | }) |
| | | }, |
| | | addUser: function () { |
| | | // this.$refs.addUser.openDialog() |
| | | this.$refs.addUser.openDialog( () => { |
| | | this.$refs.addUser.close(); |
| | | this.$message({ |
| | | showClose: true, |
| | | message: "ç¨æ·æ·»å æå", |
| | | type: "success", |
| | | }); |
| | | setTimeout(this.getUserList, 200) |
| | | |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | <style> |
| | | .videoList { |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | align-content: flex-start; |
| | | } |
| | | |
| | | .video-item { |
| | | position: relative; |
| | | width: 15rem; |
| | | height: 10rem; |
| | | margin-right: 1rem; |
| | | background-color: #000000; |
| | | } |
| | | |
| | | .video-item-img { |
| | | position: absolute; |
| | | top: 0; |
| | | bottom: 0; |
| | | left: 0; |
| | | right: 0; |
| | | margin: auto; |
| | | width: 100%; |
| | | height: 100%; |
| | | } |
| | | |
| | | .video-item-img:after { |
| | | content: ""; |
| | | display: inline-block; |
| | | position: absolute; |
| | | z-index: 2; |
| | | top: 0; |
| | | bottom: 0; |
| | | left: 0; |
| | | right: 0; |
| | | margin: auto; |
| | | width: 3rem; |
| | | height: 3rem; |
| | | background-image: url("../assets/loading.png"); |
| | | background-size: cover; |
| | | background-color: #000000; |
| | | } |
| | | |
| | | .video-item-title { |
| | | position: absolute; |
| | | bottom: 0; |
| | | color: #000000; |
| | | background-color: #ffffff; |
| | | line-height: 1.5rem; |
| | | padding: 0.3rem; |
| | | width: 14.4rem; |
| | | } |
| | | |
| | | </style> |
New file |
| | |
| | | <template> |
| | | <div id="addUser" v-loading="isLoging"> |
| | | <el-dialog |
| | | title="æ·»å ç¨æ·" |
| | | width="40%" |
| | | top="2rem" |
| | | :close-on-click-modal="false" |
| | | :visible.sync="showDialog" |
| | | :destroy-on-close="true" |
| | | @close="close()" |
| | | > |
| | | <div id="shared" style="margin-right: 20px;"> |
| | | <el-form ref="passwordForm" :rules="rules" status-icon label-width="80px"> |
| | | <el-form-item label="ç¨æ·å" prop="username"> |
| | | <el-input v-model="username" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="ç¨æ·ç±»å" prop="roleId"> |
| | | <el-select v-model="roleId" placeholder="è¯·éæ©"> |
| | | <el-option |
| | | v-for="item in options" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="å¯ç " prop="password"> |
| | | <el-input v-model="password" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="确认å¯ç " prop="confirmPassword"> |
| | | <el-input v-model="confirmPassword" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | |
| | | <el-form-item> |
| | | <div style="float: right;"> |
| | | <el-button type="primary" @click="onSubmit">ä¿å</el-button> |
| | | <el-button @click="close">åæ¶</el-button> |
| | | </div> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | |
| | | export default { |
| | | name: "addUser", |
| | | props: {}, |
| | | computed: {}, |
| | | created() { |
| | | this.getAllRole(); |
| | | }, |
| | | data() { |
| | | let validatePass1 = (rule, value, callback) => { |
| | | if (value === '') { |
| | | callback(new Error('请è¾å
¥æ°å¯ç ')); |
| | | } else { |
| | | if (this.confirmPassword !== '') { |
| | | this.$refs.passwordForm.validateField('confirmPassword'); |
| | | } |
| | | callback(); |
| | | } |
| | | }; |
| | | let validatePass2 = (rule, value, callback) => { |
| | | if (this.confirmPassword === '') { |
| | | callback(new Error('è¯·åæ¬¡è¾å
¥å¯ç ')); |
| | | } else if (this.confirmPassword !== this.password) { |
| | | callback(new Error('两次è¾å
¥å¯ç ä¸ä¸è´!')); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | return { |
| | | value:"", |
| | | options: [], |
| | | loading: false, |
| | | username: null, |
| | | password: null, |
| | | roleId: null, |
| | | confirmPassword: null, |
| | | listChangeCallback: null, |
| | | showDialog: false, |
| | | isLoging: false, |
| | | rules: { |
| | | newPassword: [{required: true, validator: validatePass1, trigger: "blur"}, { |
| | | pattern: /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,.\/]).{8,20}$/, |
| | | message: "å¯ç é¿åº¦å¨8-20ä½ä¹é´,ç±åæ¯+æ°å+ç¹æ®åç¬¦ç»æ", |
| | | },], |
| | | confirmPassword: [{required: true, validator: validatePass2, trigger: "blur"}], |
| | | }, |
| | | }; |
| | | }, |
| | | methods: { |
| | | openDialog: function (callback) { |
| | | this.listChangeCallback = callback; |
| | | this.showDialog = true; |
| | | }, |
| | | onSubmit: function () { |
| | | this.$axios({ |
| | | method: 'post', |
| | | url: "/api/user/add", |
| | | params: { |
| | | username: this.username, |
| | | password: this.password, |
| | | roleId: this.roleId |
| | | } |
| | | }).then((res) => { |
| | | if (res.data.code === 0) { |
| | | this.$message({ |
| | | showClose: true, |
| | | message: 'æ·»å æå', |
| | | type: 'success', |
| | | |
| | | }); |
| | | this.showDialog = false; |
| | | this.listChangeCallback() |
| | | |
| | | } else { |
| | | this.$message({ |
| | | showClose: true, |
| | | message: res.data.msg, |
| | | type: 'error' |
| | | }); |
| | | } |
| | | }).catch((error) => { |
| | | console.error(error) |
| | | }); |
| | | }, |
| | | close: function () { |
| | | this.showDialog = false; |
| | | this.password = null; |
| | | this.confirmPassword = null; |
| | | this.username = null; |
| | | this.roleId = null; |
| | | }, |
| | | getAllRole:function () { |
| | | |
| | | this.$axios({ |
| | | method: 'get', |
| | | url: "/api/role/all" |
| | | }).then((res) => { |
| | | this.loading = true; |
| | | console.info(res) |
| | | res.data |
| | | console.info(res.data.code) |
| | | if (res.data.code === 0) { |
| | | console.info(res.data.data) |
| | | this.options=res.data.data |
| | | |
| | | } |
| | | }).catch((error) => { |
| | | console.error(error) |
| | | }); |
| | | } |
| | | }, |
| | | }; |
| | | </script> |
| | |
| | | props: ['platformId'], |
| | | created() {}, |
| | | data() { |
| | | let checkId = (rule, value, callback) => { |
| | | console.log("checkId") |
| | | console.log(this.treeType) |
| | | console.log(rule) |
| | | console.log(value) |
| | | console.log(value.length) |
| | | console.log(this.level) |
| | | if (!value) { |
| | | return callback(new Error('ç¼å·ä¸è½ä¸ºç©º')); |
| | | } |
| | | if (this.treeType === "BusinessGroup" && value.length !== 20) { |
| | | return callback(new Error('ç¼å·å¿
é¡»ç±20使°åç»æ')); |
| | | } |
| | | if (this.treeType === "CivilCode" && value.length <= 8 && value.length%2 !== 0) { |
| | | return callback(new Error('è¡æ¿åºåå¿
é¡»æ¯å
«ä½ä»¥ä¸çå¶æ°ä¸ªæ°åç»æ')); |
| | | } |
| | | if (this.treeType === "BusinessGroup") { |
| | | let catalogType = value.substring(10, 13); |
| | | console.log(catalogType) |
| | | // 216 为èæç»ç» 215 为ä¸å¡åç»ï¼ç®å½ç¬¬ä¸çº§å¿
须为ä¸å¡åç»ï¼ ä¸å¡åç»ä¸ä¸ºèæç»ç»ï¼èæç»ç»ä¸å¯ä»¥æå
¶ä»èæç»ç» |
| | | if (this.level === 1 && catalogType !== "215") { |
| | | return callback(new Error('ä¸å¡åç»æ¨¡å¼ä¸ç¬¬ä¸å±ç®å½çç¼å·10å°13ä½å¿
须为215')); |
| | | } |
| | | if (this.level > 1 && catalogType !== "216") { |
| | | return callback(new Error('ä¸å¡åç»æ¨¡å¼ä¸ç¬¬ä¸å±ä»¥ä¸ç®å½çç¼å·10å°13ä½å¿
须为216')); |
| | | } |
| | | |
| | | } |
| | | callback(); |
| | | } |
| | | return { |
| | | submitCallback: null, |
| | | showDialog: false, |
| | | isLoging: false, |
| | | isEdit: false, |
| | | treeType: null, |
| | | level: 0, |
| | | form: { |
| | | id: null, |
| | | name: null, |
| | |
| | | }, |
| | | rules: { |
| | | name: [{ required: true, message: "请è¾å
¥åç§°", trigger: "blur" }], |
| | | id: [{ required: true, message: "请è¾å
¥ID", trigger: "blur" }] |
| | | id: [{ trigger: "blur",validator: checkId }] |
| | | }, |
| | | }; |
| | | }, |
| | | methods: { |
| | | openDialog: function (isEdit, id, name, parentId, callback) { |
| | | openDialog: function (isEdit, id, name, parentId, treeType, level, callback) { |
| | | console.log("parentId: " + parentId) |
| | | console.log(this.form) |
| | | this.isEdit = isEdit; |
| | |
| | | this.form.parentId = parentId; |
| | | this.showDialog = true; |
| | | this.submitCallback = callback; |
| | | this.treeType = treeType; |
| | | this.level = level; |
| | | }, |
| | | onSubmit: function () { |
| | | console.log("onSubmit"); |
New file |
| | |
| | | <template> |
| | | <div id="changePassword" v-loading="isLoging"> |
| | | <el-dialog |
| | | title="ä¿®æ¹å¯ç " |
| | | width="40%" |
| | | top="2rem" |
| | | :close-on-click-modal="false" |
| | | :visible.sync="showDialog" |
| | | :destroy-on-close="true" |
| | | @close="close()" |
| | | > |
| | | <div id="shared" style="margin-right: 20px;"> |
| | | <el-form ref="passwordForm" :rules="rules" status-icon label-width="80px"> |
| | | <el-form-item label="æ°å¯ç " prop="newPassword" > |
| | | <el-input v-model="newPassword" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="确认å¯ç " prop="confirmPassword"> |
| | | <el-input v-model="confirmPassword" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | |
| | | <el-form-item> |
| | | <div style="float: right;"> |
| | | <el-button type="primary" @click="onSubmit">ä¿å</el-button> |
| | | <el-button @click="close">åæ¶</el-button> |
| | | </div> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | name: "changePasswordForAdmin", |
| | | props: {}, |
| | | computed: {}, |
| | | created() {}, |
| | | data() { |
| | | let validatePass1 = (rule, value, callback) => { |
| | | if (value === '') { |
| | | callback(new Error('请è¾å
¥æ°å¯ç ')); |
| | | } else { |
| | | if (this.confirmPassword !== '') { |
| | | this.$refs.passwordForm.validateField('confirmPassword'); |
| | | } |
| | | callback(); |
| | | } |
| | | }; |
| | | let validatePass2 = (rule, value, callback) => { |
| | | if (this.confirmPassword === '') { |
| | | callback(new Error('è¯·åæ¬¡è¾å
¥å¯ç ')); |
| | | } else if (this.confirmPassword !== this.newPassword) { |
| | | callback(new Error('两次è¾å
¥å¯ç ä¸ä¸è´!')); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | return { |
| | | newPassword: null, |
| | | confirmPassword: null, |
| | | userId: null, |
| | | showDialog: false, |
| | | isLoging: false, |
| | | listChangeCallback: null, |
| | | form: {}, |
| | | rules: { |
| | | newPassword: [{ required: true, validator: validatePass1, trigger: "blur" }, { |
| | | pattern: /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,.\/]).{8,20}$/, |
| | | message: "å¯ç é¿åº¦å¨8-20ä½ä¹é´,ç±åæ¯+æ°å+ç¹æ®åç¬¦ç»æ", |
| | | },], |
| | | confirmPassword: [{ required: true, validator: validatePass2, trigger: "blur" }], |
| | | }, |
| | | }; |
| | | }, |
| | | methods: { |
| | | openDialog: function (row, callback) { |
| | | console.log(row) |
| | | this.showDialog = true; |
| | | this.listChangeCallback = callback; |
| | | if (row != null) { |
| | | this.form = row; |
| | | } |
| | | }, |
| | | onSubmit: function () { |
| | | this.$axios({ |
| | | method: 'post', |
| | | url:"/api/user/changePasswordForAdmin", |
| | | params: { |
| | | password: this.newPassword, |
| | | userId: this.form.id, |
| | | } |
| | | }).then((res)=> { |
| | | if (res.data === "success"){ |
| | | this.$message({ |
| | | showClose: true, |
| | | message: 'ä¿®æ¹æå', |
| | | type: 'success' |
| | | }); |
| | | this.showDialog = false; |
| | | }else { |
| | | this.$message({ |
| | | showClose: true, |
| | | message: 'ä¿®æ¹å¯ç å¤±è´¥ï¼æ¯å¦å·²ç»å½ï¼æ¥å£é´æå
³éæ æ³ä¿®æ¹å¯ç ï¼', |
| | | type: 'error' |
| | | }); |
| | | } |
| | | }).catch((error)=> { |
| | | console.error(error) |
| | | }); |
| | | }, |
| | | close: function () { |
| | | this.showDialog = false; |
| | | this.newPassword = null; |
| | | this.confirmPassword = null; |
| | | this.userId=null; |
| | | this.adminId=null; |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
New file |
| | |
| | | <template> |
| | | <div id="changepushKey" v-loading="isLoging"> |
| | | <el-dialog |
| | | title="ä¿®æ¹å¯ç " |
| | | width="42%" |
| | | top="2rem" |
| | | :close-on-click-modal="false" |
| | | :visible.sync="showDialog" |
| | | :destroy-on-close="true" |
| | | @close="close()" |
| | | > |
| | | <div id="shared" style="margin-right: 18px;"> |
| | | <el-form ref="pushKeyForm" :rules="rules" status-icon label-width="86px"> |
| | | <el-form-item label="æ°pushKey" prop="newPushKey" > |
| | | <el-input v-model="newPushKey" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <div style="float: right;"> |
| | | <el-button type="primary" @click="onSubmit">ä¿å</el-button> |
| | | <el-button @click="close">åæ¶</el-button> |
| | | </div> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | name: "changePushKey", |
| | | props: {}, |
| | | computed: {}, |
| | | created() {}, |
| | | data() { |
| | | let validatePass1 = (rule, value, callback) => { |
| | | if (value === '') { |
| | | callback(new Error('请è¾å
¥æ°pushKey')); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | return { |
| | | newPushKey: null, |
| | | confirmpushKey: null, |
| | | userId: null, |
| | | showDialog: false, |
| | | isLoging: false, |
| | | listChangeCallback: null, |
| | | form: {}, |
| | | rules: { |
| | | newpushKey: [{ required: true, validator: validatePass1, trigger: "blur" }], |
| | | }, |
| | | }; |
| | | }, |
| | | methods: { |
| | | openDialog: function (row, callback) { |
| | | console.log(row) |
| | | this.showDialog = true; |
| | | this.listChangeCallback = callback; |
| | | if (row != null) { |
| | | this.form = row; |
| | | } |
| | | }, |
| | | onSubmit: function () { |
| | | this.$axios({ |
| | | method: 'post', |
| | | url:"/api/user/changePushKey", |
| | | params: { |
| | | pushKey: this.newPushKey, |
| | | userId: this.form.id, |
| | | } |
| | | }).then((res)=> { |
| | | console.log(res.data) |
| | | if (res.data.msg === "success"){ |
| | | this.$message({ |
| | | showClose: true, |
| | | message: 'ä¿®æ¹æå', |
| | | type: 'success' |
| | | }); |
| | | this.showDialog = false; |
| | | this.listChangeCallback(); |
| | | }else { |
| | | this.$message({ |
| | | showClose: true, |
| | | message: 'ä¿®æ¹å¯ç å¤±è´¥ï¼æ¯å¦å·²ç»å½ï¼æ¥å£é´æå
³éæ æ³ä¿®æ¹å¯ç ï¼', |
| | | type: 'error' |
| | | }); |
| | | } |
| | | }).catch((error)=> { |
| | | console.error(error) |
| | | }); |
| | | }, |
| | | close: function () { |
| | | this.showDialog = false; |
| | | this.newpushKey = null; |
| | | this.userId=null; |
| | | this.adminId=null; |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
| | |
| | | <el-tab-pane label="ç®å½ç»æ" name="catalog"> |
| | | <el-container> |
| | | <el-main v-bind:style="{backgroundColor: '#FFF', maxHeight: winHeight + 'px'}"> |
| | | <chooseChannelForCatalog ref="chooseChannelForCatalog" :platformId=platformId :platformName=platformName :defaultCatalogId=defaultCatalogId :catalogIdChange="catalogIdChange" ></chooseChannelForCatalog> |
| | | <chooseChannelForCatalog ref="chooseChannelForCatalog" :platformId=platformId :platformName=platformName :defaultCatalogId=defaultCatalogId :catalogIdChange="catalogIdChange" :treeType=treeType ></chooseChannelForCatalog> |
| | | </el-main> |
| | | </el-container> |
| | | </el-tab-pane> |
| | |
| | | platformName: "", |
| | | defaultCatalogId: "", |
| | | showDialog: false, |
| | | treeType: null, |
| | | chooseData: {}, |
| | | winHeight: window.innerHeight - 250, |
| | | |
| | | }; |
| | | }, |
| | | methods: { |
| | | openDialog(platformId, platformName, defaultCatalogId, closeCallback) { |
| | | openDialog(platformId, platformName, defaultCatalogId, treeType, closeCallback) { |
| | | this.platformId = platformId |
| | | this.platformName = platformName |
| | | this.defaultCatalogId = defaultCatalogId |
| | | this.showDialog = true |
| | | this.closeCallback = closeCallback |
| | | this.treeType = treeType |
| | | }, |
| | | tabClick (tab, event){ |
| | | |
| | |
| | | import catalogEdit from './catalogEdit.vue' |
| | | export default { |
| | | name: 'chooseChannelForCatalog', |
| | | props: ['platformId', 'platformName', 'defaultCatalogId', 'catalogIdChange'], |
| | | props: ['platformId', 'platformName', 'defaultCatalogId', 'catalogIdChange', 'treeType'], |
| | | created() { |
| | | this.chooseId = this.defaultCatalogId; |
| | | this.defaultCatalogIdSign = this.defaultCatalogId; |
| | |
| | | }, |
| | | addCatalog: function (parentId, node){ |
| | | let that = this; |
| | | console.log(this.treeType) |
| | | // æå¼æ·»å å¼¹çª |
| | | that.$refs.catalogEdit.openDialog(false, null, null, parentId, ()=>{ |
| | | that.$refs.catalogEdit.openDialog(false, null, null, parentId, this.treeType, node.level, ()=>{ |
| | | node.loaded = false |
| | | node.expand(); |
| | | }); |
| | |
| | | page: that.currentPage, |
| | | count: that.count, |
| | | query: that.searchSrt, |
| | | pushing: that.pushing, |
| | | platformId: that.platformId, |
| | | catalogId: that.catalogId, |
| | | mediaServerId: that.mediaServerId |
| | |
| | | <el-option label="8" value="8"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="ç®å½ç»æ" prop="treeType" > |
| | | <el-select v-model="platform.treeType" style="width: 100%" > |
| | | <el-option key="WGS84" label="è¡æ¿åºå" value="CivilCode"></el-option> |
| | | <el-option key="GCJ02" label="ä¸å¡åç»" value="BusinessGroup"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="å符é" prop="characterSet"> |
| | | <el-select |
| | | v-model="platform.characterSet" |
| | |
| | | <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.shareAllLiveStream"></el-checkbox> |
| | | <el-checkbox label="æèµ·ç¦»çº¿æ¨æµ" v-model="platform.startOfflinePush"></el-checkbox> |
| | | </el-form-item> |
| | | <el-form-item> |
| | |
| | | keepTimeout: 60, |
| | | transport: "UDP", |
| | | characterSet: "GB2312", |
| | | shareAllLiveStream: false, |
| | | startOfflinePush: false, |
| | | catalogGroup: 1, |
| | | administrativeDivision: null, |
| | | treeType: "BusinessGroup", |
| | | }, |
| | | rules: { |
| | | name: [{ required: true, message: "请è¾å
¥å¹³å°åç§°", trigger: "blur" }], |
| | |
| | | that.platform.devicePort = res.data.devicePort; |
| | | that.platform.username = res.data.username; |
| | | that.platform.password = res.data.password; |
| | | that.platform.treeType = "BusinessGroup"; |
| | | that.platform.administrativeDivision = res.data.username.substr(0, 6); |
| | | }).catch(function (error) { |
| | | console.log(error); |
| | |
| | | this.platform.keepTimeout = platform.keepTimeout; |
| | | this.platform.transport = platform.transport; |
| | | this.platform.characterSet = platform.characterSet; |
| | | this.platform.shareAllLiveStream = platform.shareAllLiveStream; |
| | | this.platform.catalogId = platform.catalogId; |
| | | this.platform.startOfflinePush = platform.startOfflinePush; |
| | | this.platform.catalogGroup = platform.catalogGroup; |
| | | this.platform.administrativeDivision = platform.administrativeDivision; |
| | | this.platform.treeType = platform.treeType; |
| | | this.onSubmit_text = "ä¿å"; |
| | | this.saveUrl = "/api/platform/save"; |
| | | } |
| | |
| | | |
| | | }, |
| | | onSubmit: function () { |
| | | if (this.onSubmit_text === "ä¿å") { |
| | | this.$confirm("ä¿®æ¹ç®å½ç»æä¼å¯¼è´å
³èç®å½ä¸ééæ°æ®è¢«æ¸
空", 'æç¤º', { |
| | | dangerouslyUseHTMLString: true, |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | center: true, |
| | | type: 'warning' |
| | | }).then(() => { |
| | | this.saveForm() |
| | | }).catch(() => { |
| | | |
| | | }); |
| | | }else { |
| | | this.saveForm() |
| | | } |
| | | }, |
| | | saveForm: function (){ |
| | | var that = this; |
| | | that.$axios({ |
| | | method: 'post', |
| | | url: this.saveUrl, |
| | | data: that.platform |
| | | }).then(function (res) { |
| | | if (res.data.code === 0) { |
| | | that.$message({ |
| | | showClose: true, |
| | | message: "ä¿åæå", |
| | | type: "success", |
| | | }); |
| | | that.showDialog = false; |
| | | if (that.listChangeCallback != null) { |
| | | that.listChangeCallback(); |
| | | } |
| | | }else { |
| | | that.$message({ |
| | | showClose: true, |
| | | message: res.data.msg, |
| | | type: "error", |
| | | }); |
| | | if (res.data.code === 0) { |
| | | that.$message({ |
| | | showClose: true, |
| | | message: "ä¿åæå", |
| | | type: "success", |
| | | }); |
| | | that.showDialog = false; |
| | | if (that.listChangeCallback != null) { |
| | | that.listChangeCallback(); |
| | | } |
| | | }).catch(function (error) { |
| | | console.log(error); |
| | | }); |
| | | }else { |
| | | that.$message({ |
| | | showClose: true, |
| | | message: res.data.msg, |
| | | type: "error", |
| | | }); |
| | | } |
| | | }).catch(function (error) { |
| | | console.log(error); |
| | | }); |
| | | }, |
| | | close: function () { |
| | | this.showDialog = false; |
| | |
| | | keepTimeout: 60, |
| | | transport: "UDP", |
| | | characterSet: "GB2312", |
| | | shareAllLiveStream: false, |
| | | treeType: "BusinessGroup", |
| | | startOfflinePush: false, |
| | | catalogGroup: 1, |
| | | } |
| | |
| | | <el-menu-item index="/cloudRecord">äºç«¯å½å</el-menu-item> |
| | | <el-menu-item index="/mediaServerManger">èç¹ç®¡ç</el-menu-item> |
| | | <el-menu-item index="/parentPlatformList/15/1">彿 级è</el-menu-item> |
| | | <el-menu-item v-if="editUser" index="/userManager">ç¨æ·ç®¡ç</el-menu-item> |
| | | |
| | | <!-- <el-submenu index="/setting">--> |
| | | <!-- <template slot="title">ç³»ç»è®¾ç½®</template>--> |
| | |
| | | <!-- <el-menu-item style="float: right;" @click="loginout">éåº</el-menu-item>--> |
| | | <el-submenu index="" style="float: right;"> |
| | | <template slot="title">欢è¿ï¼{{ this.$cookies.get("session").username }}</template> |
| | | <el-menu-item @click="changePassword">ä¿®æ¹å¯ç </el-menu-item> |
| | | <el-menu-item @click="loginout">注é</el-menu-item> |
| | | <el-menu-item @click="openDoc">å¨çº¿ææ¡£</el-menu-item> |
| | | <el-menu-item > |
| | | <el-switch v-model="alarmNotify" inactive-text="æ¥è¦ä¿¡æ¯æ¨é" @change="alarmNotifyChannge"></el-switch> |
| | | </el-menu-item> |
| | | <el-menu-item @click="changePassword">ä¿®æ¹å¯ç </el-menu-item> |
| | | <el-menu-item @click="loginout">注é</el-menu-item> |
| | | </el-submenu> |
| | | </el-menu> |
| | | <changePasswordDialog ref="changePasswordDialog"></changePasswordDialog> |
| | |
| | | alarmNotify: false, |
| | | sseSource: null, |
| | | activeIndex: this.$route.path, |
| | | editUser: this.$cookies.get("session").roleId==1 |
| | | }; |
| | | }, |
| | | created() { |
| | | console.log(this.$cookies.get("session")) |
| | | if (this.$route.path.startsWith("/channelList")) { |
| | | this.activeIndex = "/deviceList" |
| | | } |
| | |
| | | import media from '../components/setting/Media.vue' |
| | | import live from '../components/live.vue' |
| | | import deviceTree from '../components/common/DeviceTree.vue' |
| | | import userManager from '../components/UserManager.vue' |
| | | |
| | | import wasmPlayer from '../components/common/jessibuca.vue' |
| | | import rtcPlayer from '../components/dialog/rtcPlayer.vue' |
| | |
| | | name: 'map', |
| | | component: map, |
| | | }, |
| | | { |
| | | path: '/userManager', |
| | | name: 'userManager', |
| | | component: userManager, |
| | | } |
| | | ] |
| | | }, |
| | | { |