Commit ec8ab540f8af6dca862d3ec9967e9042fa7dd8eb
Committed by
GitHub
Merge branch '648540858:wvp-28181-2.0' into wvp-28181-2.0
Showing
14 changed files
with
327 additions
and
76 deletions
README.md
| @@ -109,21 +109,45 @@ https://gitee.com/pan648540858/wvp-GB28181-pro.git | @@ -109,21 +109,45 @@ https://gitee.com/pan648540858/wvp-GB28181-pro.git | ||
| 109 | - [X] 支持使用mysql作为数据库,默认sqlite3,开箱即用。 | 109 | - [X] 支持使用mysql作为数据库,默认sqlite3,开箱即用。 |
| 110 | - [X] WEB端支持播放H264与H265,音频支持G.711A/G.711U/AAC,覆盖国标常用编码格式。 | 110 | - [X] WEB端支持播放H264与H265,音频支持G.711A/G.711U/AAC,覆盖国标常用编码格式。 |
| 111 | 111 | ||
| 112 | -# docker快速体验 | ||
| 113 | -目前作者的docker-compose因为时间有限维护不及时,这里提供第三方提供的供大家使用,维护不易,大家记得给这位小伙伴点个star。 | ||
| 114 | -https://github.com/SaltFish001/wvp_pro_compose | ||
| 115 | -[https://github.com/SaltFish001/wvp_pro_compose](https://github.com/SaltFish001/wvp_pro_compose) | ||
| 116 | -这是作者维护的一个镜像,可能存在不及时的问题。 | ||
| 117 | -```shell | ||
| 118 | -docker pull 648540858/wvp_pro | ||
| 119 | - | ||
| 120 | -docker run --env WVP_IP="你的IP" -it -p 18080:18080 -p 30000-30500:30000-30500/udp -p 30000-30500:30000-30500/tcp -p 80:80 -p 5060:5060 -p 5060:5060/udp 648540858/wvp_pro | ||
| 121 | -``` | ||
| 122 | -docker使用详情查看:[https://hub.docker.com/r/648540858/wvp_pro](https://hub.docker.com/r/648540858/wvp_pro) | 112 | +[//]: # (# docker快速体验) |
| 113 | + | ||
| 114 | +[//]: # (目前作者的docker-compose因为时间有限维护不及时,这里提供第三方提供的供大家使用,维护不易,大家记得给这位小伙伴点个star。 ) | ||
| 115 | + | ||
| 116 | +[//]: # (https://github.com/SaltFish001/wvp_pro_compose) | ||
| 117 | + | ||
| 118 | +[//]: # ([https://github.com/SaltFish001/wvp_pro_compose](https://github.com/SaltFish001/wvp_pro_compose)) | ||
| 119 | + | ||
| 120 | +[//]: # (这是作者维护的一个镜像,可能存在不及时的问题。) | ||
| 121 | + | ||
| 122 | +[//]: # (```shell) | ||
| 123 | + | ||
| 124 | +[//]: # (docker pull 648540858/wvp_pro) | ||
| 125 | + | ||
| 126 | +[//]: # () | ||
| 127 | +[//]: # (docker run --env WVP_IP="你的IP" -it -p 18080:18080 -p 30000-30500:30000-30500/udp -p 30000-30500:30000-30500/tcp -p 80:80 -p 5060:5060 -p 5060:5060/udp 648540858/wvp_pro) | ||
| 128 | + | ||
| 129 | +[//]: # (```) | ||
| 130 | + | ||
| 131 | +[//]: # (docker使用详情查看:[https://hub.docker.com/r/648540858/wvp_pro](https://hub.docker.com/r/648540858/wvp_pro)) | ||
| 123 | 132 | ||
| 124 | # gitee同步仓库 | 133 | # gitee同步仓库 |
| 125 | https://gitee.com/pan648540858/wvp-GB28181-pro.git | 134 | https://gitee.com/pan648540858/wvp-GB28181-pro.git |
| 126 | 135 | ||
| 136 | +# 遇到问题 | ||
| 137 | +国标最麻烦的地方在于设备的兼容性,所以需要大量的设备来测试,目前作者手里的设备有限,再加上作者水平有限,所以遇到问题在所难免; | ||
| 138 | +1. 查看wiki,仔细的阅读可以帮你避免几乎所有的问题 | ||
| 139 | +2. 搜索issues,这里有大部分的答案 | ||
| 140 | +3. 加QQ群,这里有大量热心的小伙伴,但是前提新希望你已经仔细阅读了wiki和搜索了issues。 | ||
| 141 | +4. 你可以请作者为你解答,但是我不是免费的。 | ||
| 142 | +5. 你可以把遇到问题的设备寄给我,可以更容易的复现问题。 | ||
| 143 | + | ||
| 144 | + | ||
| 145 | +# 合作 | ||
| 146 | +目前很多打着合作的幌子来私聊的,其实大家大可不必,目前作者没有精力,你有问题可以付费找我解答,也可以提PR | ||
| 147 | +,如果对代码有建议可以提ISSUE;也可以加群一起聊聊。我们欢迎所有有兴趣但遇到项目中来的人。 | ||
| 148 | + | ||
| 149 | + | ||
| 150 | + | ||
| 127 | # 使用帮助 | 151 | # 使用帮助 |
| 128 | QQ群: 901799015, ZLM使用文档[https://github.com/ZLMediaKit/ZLMediaKit](https://github.com/ZLMediaKit/ZLMediaKit) | 152 | QQ群: 901799015, ZLM使用文档[https://github.com/ZLMediaKit/ZLMediaKit](https://github.com/ZLMediaKit/ZLMediaKit) |
| 129 | QQ私信一般不回, 精力有限.欢迎大家在群里讨论.觉得项目对你有帮助,欢迎star和提交pr。 | 153 | QQ私信一般不回, 精力有限.欢迎大家在群里讨论.觉得项目对你有帮助,欢迎star和提交pr。 |
pom.xml
| @@ -256,6 +256,7 @@ | @@ -256,6 +256,7 @@ | ||
| 256 | <plugin> | 256 | <plugin> |
| 257 | <groupId>org.springframework.boot</groupId> | 257 | <groupId>org.springframework.boot</groupId> |
| 258 | <artifactId>spring-boot-maven-plugin</artifactId> | 258 | <artifactId>spring-boot-maven-plugin</artifactId> |
| 259 | + <version>2.3.5.RELEASE</version> | ||
| 259 | <configuration> | 260 | <configuration> |
| 260 | <includeSystemScope>true</includeSystemScope> | 261 | <includeSystemScope>true</includeSystemScope> |
| 261 | </configuration> | 262 | </configuration> |
| @@ -263,6 +264,7 @@ | @@ -263,6 +264,7 @@ | ||
| 263 | <plugin> | 264 | <plugin> |
| 264 | <groupId>org.apache.maven.plugins</groupId> | 265 | <groupId>org.apache.maven.plugins</groupId> |
| 265 | <artifactId>maven-compiler-plugin</artifactId> | 266 | <artifactId>maven-compiler-plugin</artifactId> |
| 267 | + <version>3.8.1</version> | ||
| 266 | <configuration> | 268 | <configuration> |
| 267 | <source>1.8</source> | 269 | <source>1.8</source> |
| 268 | <target>1.8</target> | 270 | <target>1.8</target> |
| @@ -272,6 +274,7 @@ | @@ -272,6 +274,7 @@ | ||
| 272 | <plugin> | 274 | <plugin> |
| 273 | <groupId>pl.project13.maven</groupId> | 275 | <groupId>pl.project13.maven</groupId> |
| 274 | <artifactId>git-commit-id-plugin</artifactId> | 276 | <artifactId>git-commit-id-plugin</artifactId> |
| 277 | + <version>3.0.1</version> | ||
| 275 | <configuration> | 278 | <configuration> |
| 276 | <offline>true</offline> | 279 | <offline>true</offline> |
| 277 | </configuration> | 280 | </configuration> |
| @@ -280,6 +283,7 @@ | @@ -280,6 +283,7 @@ | ||
| 280 | <plugin> | 283 | <plugin> |
| 281 | <groupId>org.apache.maven.plugins</groupId> | 284 | <groupId>org.apache.maven.plugins</groupId> |
| 282 | <artifactId>maven-surefire-plugin</artifactId> | 285 | <artifactId>maven-surefire-plugin</artifactId> |
| 286 | + <version>2.22.2</version> | ||
| 283 | <configuration> | 287 | <configuration> |
| 284 | <skipTests>true</skipTests> | 288 | <skipTests>true</skipTests> |
| 285 | </configuration> | 289 | </configuration> |
src/main/java/com/genersoft/iot/vmp/VManageBootstrap.java
| @@ -7,7 +7,6 @@ import org.springframework.boot.SpringApplication; | @@ -7,7 +7,6 @@ import org.springframework.boot.SpringApplication; | ||
| 7 | import org.springframework.boot.autoconfigure.SpringBootApplication; | 7 | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| 8 | import org.springframework.boot.web.servlet.ServletComponentScan; | 8 | import org.springframework.boot.web.servlet.ServletComponentScan; |
| 9 | import org.springframework.context.ConfigurableApplicationContext; | 9 | import org.springframework.context.ConfigurableApplicationContext; |
| 10 | -import org.springframework.scheduling.annotation.EnableAsync; | ||
| 11 | import org.springframework.scheduling.annotation.EnableScheduling; | 10 | import org.springframework.scheduling.annotation.EnableScheduling; |
| 12 | import springfox.documentation.oas.annotations.EnableOpenApi; | 11 | import springfox.documentation.oas.annotations.EnableOpenApi; |
| 13 | 12 |
src/main/java/com/genersoft/iot/vmp/common/ApiSaveConstant.java
| 1 | package com.genersoft.iot.vmp.common; | 1 | package com.genersoft.iot.vmp.common; |
| 2 | 2 | ||
| 3 | +/** | ||
| 4 | + * 为API重命名, 方便向数据库记录数据的时候展示 | ||
| 5 | + * @author lin | ||
| 6 | + */ | ||
| 3 | public class ApiSaveConstant { | 7 | public class ApiSaveConstant { |
| 4 | 8 | ||
| 5 | public static String getVal(String key) { | 9 | public static String getVal(String key) { |
| @@ -35,8 +39,9 @@ public class ApiSaveConstant { | @@ -35,8 +39,9 @@ public class ApiSaveConstant { | ||
| 35 | return "[设备控制] 强制关键帧"; | 39 | return "[设备控制] 强制关键帧"; |
| 36 | case "home_position": | 40 | case "home_position": |
| 37 | return "[设备控制] 看守位控制"; | 41 | return "[设备控制] 看守位控制"; |
| 42 | + default: | ||
| 43 | + return ""; | ||
| 38 | } | 44 | } |
| 39 | - break; | ||
| 40 | case "query": | 45 | case "query": |
| 41 | if (keyItemArray.length <= 5) { | 46 | if (keyItemArray.length <= 5) { |
| 42 | return null; | 47 | return null; |
| @@ -51,23 +56,30 @@ public class ApiSaveConstant { | @@ -51,23 +56,30 @@ public class ApiSaveConstant { | ||
| 51 | return "[设备查询] 同步设备通道"; | 56 | return "[设备查询] 同步设备通道"; |
| 52 | case "delete": | 57 | case "delete": |
| 53 | return "[设备查询] 移除设备"; | 58 | return "[设备查询] 移除设备"; |
| 59 | + default: | ||
| 60 | + return ""; | ||
| 54 | } | 61 | } |
| 55 | - break; | ||
| 56 | case "channel": | 62 | case "channel": |
| 57 | return "[设备查询] 更新通道信息"; | 63 | return "[设备查询] 更新通道信息"; |
| 58 | case "transport": | 64 | case "transport": |
| 59 | return "[设备查询] 修改数据流传输模式"; | 65 | return "[设备查询] 修改数据流传输模式"; |
| 66 | + default: | ||
| 67 | + return ""; | ||
| 60 | } | 68 | } |
| 61 | - break; | 69 | + default: |
| 70 | + return ""; | ||
| 62 | } | 71 | } |
| 72 | + | ||
| 73 | + break; | ||
| 63 | case "gbStream": | 74 | case "gbStream": |
| 64 | switch (keyItemArray[3]) { | 75 | switch (keyItemArray[3]) { |
| 65 | case "del": | 76 | case "del": |
| 66 | return "移除通道与国标的关联"; | 77 | return "移除通道与国标的关联"; |
| 67 | case "add": | 78 | case "add": |
| 68 | return "添加通道与国标的关联"; | 79 | return "添加通道与国标的关联"; |
| 80 | + default: | ||
| 81 | + return ""; | ||
| 69 | } | 82 | } |
| 70 | - break; | ||
| 71 | case "media": | 83 | case "media": |
| 72 | break; | 84 | break; |
| 73 | case "position": | 85 | case "position": |
| @@ -85,8 +97,9 @@ public class ApiSaveConstant { | @@ -85,8 +97,9 @@ public class ApiSaveConstant { | ||
| 85 | return "向上级平台添加国标通道"; | 97 | return "向上级平台添加国标通道"; |
| 86 | case "del_channel_for_gb": | 98 | case "del_channel_for_gb": |
| 87 | return "从上级平台移除国标通道"; | 99 | return "从上级平台移除国标通道"; |
| 100 | + default: | ||
| 101 | + return ""; | ||
| 88 | } | 102 | } |
| 89 | - break; | ||
| 90 | case "platform_gb_stream": | 103 | case "platform_gb_stream": |
| 91 | break; | 104 | break; |
| 92 | case "play": | 105 | case "play": |
| @@ -101,32 +114,36 @@ public class ApiSaveConstant { | @@ -101,32 +114,36 @@ public class ApiSaveConstant { | ||
| 101 | return "结束转码"; | 114 | return "结束转码"; |
| 102 | case "broadcast": | 115 | case "broadcast": |
| 103 | return "语音广播"; | 116 | return "语音广播"; |
| 117 | + default: | ||
| 118 | + return ""; | ||
| 104 | } | 119 | } |
| 105 | - break; | ||
| 106 | case "download": | 120 | case "download": |
| 107 | switch (keyItemArray[3]) { | 121 | switch (keyItemArray[3]) { |
| 108 | case "start": | 122 | case "start": |
| 109 | return "开始历史媒体下载"; | 123 | return "开始历史媒体下载"; |
| 110 | case "stop": | 124 | case "stop": |
| 111 | return "停止历史媒体下载"; | 125 | return "停止历史媒体下载"; |
| 126 | + default: | ||
| 127 | + return ""; | ||
| 112 | } | 128 | } |
| 113 | - break; | ||
| 114 | case "playback": | 129 | case "playback": |
| 115 | switch (keyItemArray[3]) { | 130 | switch (keyItemArray[3]) { |
| 116 | case "start": | 131 | case "start": |
| 117 | return "开始视频回放"; | 132 | return "开始视频回放"; |
| 118 | case "stop": | 133 | case "stop": |
| 119 | return "停止视频回放"; | 134 | return "停止视频回放"; |
| 135 | + default: | ||
| 136 | + return ""; | ||
| 120 | } | 137 | } |
| 121 | - break; | ||
| 122 | case "ptz": | 138 | case "ptz": |
| 123 | switch (keyItemArray[3]) { | 139 | switch (keyItemArray[3]) { |
| 124 | case "control": | 140 | case "control": |
| 125 | return "云台控制"; | 141 | return "云台控制"; |
| 126 | case "front_end_command": | 142 | case "front_end_command": |
| 127 | return "通用前端控制命令"; | 143 | return "通用前端控制命令"; |
| 144 | + default: | ||
| 145 | + return ""; | ||
| 128 | } | 146 | } |
| 129 | - break; | ||
| 130 | case "gb_record": | 147 | case "gb_record": |
| 131 | break; | 148 | break; |
| 132 | case "onvif": | 149 | case "onvif": |
| @@ -146,16 +163,18 @@ public class ApiSaveConstant { | @@ -146,16 +163,18 @@ public class ApiSaveConstant { | ||
| 146 | return "启用代理"; | 163 | return "启用代理"; |
| 147 | case "stop": | 164 | case "stop": |
| 148 | return "停用代理"; | 165 | return "停用代理"; |
| 166 | + default: | ||
| 167 | + return ""; | ||
| 149 | } | 168 | } |
| 150 | - break; | ||
| 151 | case "push": | 169 | case "push": |
| 152 | switch (keyItemArray[3]) { | 170 | switch (keyItemArray[3]) { |
| 153 | case "save_to_gb": | 171 | case "save_to_gb": |
| 154 | return "将推流添加到国标"; | 172 | return "将推流添加到国标"; |
| 155 | case "remove_form_gb": | 173 | case "remove_form_gb": |
| 156 | return "将推流移出到国标"; | 174 | return "将推流移出到国标"; |
| 175 | + default: | ||
| 176 | + return ""; | ||
| 157 | } | 177 | } |
| 158 | - break; | ||
| 159 | case "user": | 178 | case "user": |
| 160 | switch (keyItemArray[3]) { | 179 | switch (keyItemArray[3]) { |
| 161 | case "login": | 180 | case "login": |
| @@ -166,8 +185,11 @@ public class ApiSaveConstant { | @@ -166,8 +185,11 @@ public class ApiSaveConstant { | ||
| 166 | return "添加用户"; | 185 | return "添加用户"; |
| 167 | case "delete": | 186 | case "delete": |
| 168 | return "删除用户"; | 187 | return "删除用户"; |
| 188 | + default: | ||
| 189 | + return ""; | ||
| 169 | } | 190 | } |
| 170 | - break; | 191 | + default: |
| 192 | + return ""; | ||
| 171 | } | 193 | } |
| 172 | } | 194 | } |
| 173 | return null; | 195 | return null; |
src/main/java/com/genersoft/iot/vmp/conf/security/AnonymousAuthenticationEntryPoint.java
| @@ -13,6 +13,7 @@ import java.io.IOException; | @@ -13,6 +13,7 @@ import java.io.IOException; | ||
| 13 | 13 | ||
| 14 | /** | 14 | /** |
| 15 | * 处理匿名用户访问逻辑 | 15 | * 处理匿名用户访问逻辑 |
| 16 | + * @author lin | ||
| 16 | */ | 17 | */ |
| 17 | @Component | 18 | @Component |
| 18 | public class AnonymousAuthenticationEntryPoint implements AuthenticationEntryPoint { | 19 | public class AnonymousAuthenticationEntryPoint implements AuthenticationEntryPoint { |
| @@ -21,7 +22,6 @@ public class AnonymousAuthenticationEntryPoint implements AuthenticationEntryPoi | @@ -21,7 +22,6 @@ public class AnonymousAuthenticationEntryPoint implements AuthenticationEntryPoi | ||
| 21 | 22 | ||
| 22 | @Override | 23 | @Override |
| 23 | public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e) { | 24 | public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e) { |
| 24 | -// logger.debug("用户需要登录,访问[{}]失败,AuthenticationException=[{}]", request.getRequestURI(), e.getMessage()); | ||
| 25 | // 允许跨域 | 25 | // 允许跨域 |
| 26 | response.setHeader("Access-Control-Allow-Origin", "*"); | 26 | response.setHeader("Access-Control-Allow-Origin", "*"); |
| 27 | // 允许自定义请求头token(允许head跨域) | 27 | // 允许自定义请求头token(允许head跨域) |
| @@ -30,7 +30,8 @@ public class AnonymousAuthenticationEntryPoint implements AuthenticationEntryPoi | @@ -30,7 +30,8 @@ public class AnonymousAuthenticationEntryPoint implements AuthenticationEntryPoi | ||
| 30 | JSONObject jsonObject = new JSONObject(); | 30 | JSONObject jsonObject = new JSONObject(); |
| 31 | jsonObject.put("code", "-1"); | 31 | jsonObject.put("code", "-1"); |
| 32 | jsonObject.put("msg", "请登录后重新请求"); | 32 | jsonObject.put("msg", "请登录后重新请求"); |
| 33 | - if (request.getRequestURI().contains("api/user/login")){ | 33 | + String logUri = "api/user/login"; |
| 34 | + if (request.getRequestURI().contains(logUri)){ | ||
| 34 | jsonObject.put("msg", e.getMessage()); | 35 | jsonObject.put("msg", e.getMessage()); |
| 35 | } | 36 | } |
| 36 | response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); | 37 | response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); |
src/main/java/com/genersoft/iot/vmp/domain/req/PresetQuerySipReq.java
0 → 100644
| 1 | +package com.genersoft.iot.vmp.domain.req; | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +/** | ||
| 5 | + * @author chenjialing | ||
| 6 | + */ | ||
| 7 | +public class PresetQuerySipReq { | ||
| 8 | + | ||
| 9 | + private String presetId; | ||
| 10 | + | ||
| 11 | + private String presetName; | ||
| 12 | + | ||
| 13 | + public String getPresetId() { | ||
| 14 | + return presetId; | ||
| 15 | + } | ||
| 16 | + | ||
| 17 | + public void setPresetId(String presetId) { | ||
| 18 | + this.presetId = presetId; | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + public String getPresetName() { | ||
| 22 | + return presetName; | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + public void setPresetName(String presetName) { | ||
| 26 | + this.presetName = presetName; | ||
| 27 | + } | ||
| 28 | +} |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceAlarmMethod.java
0 → 100644
| 1 | +package com.genersoft.iot.vmp.gb28181.bean; | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * 报警方式 | ||
| 5 | + * @author lin | ||
| 6 | + * 1为电话报警, 2为设备报警, 3为短信报警, 4为 GPS报警, 5为视频报警, 6为设备故障报警, | ||
| 7 | + * 7其他报警;可以为直接组合如12为电话报警或 设备报警- | ||
| 8 | + */ | ||
| 9 | +public enum DeviceAlarmMethod { | ||
| 10 | + // 1为电话报警 | ||
| 11 | + Telephone(1), | ||
| 12 | + | ||
| 13 | + // 2为设备报警 | ||
| 14 | + Device(2), | ||
| 15 | + | ||
| 16 | + // 3为短信报警 | ||
| 17 | + SMS(3), | ||
| 18 | + | ||
| 19 | + // 4为 GPS报警 | ||
| 20 | + GPS(4), | ||
| 21 | + | ||
| 22 | + // 5为视频报警 | ||
| 23 | + Video(5), | ||
| 24 | + | ||
| 25 | + // 6为设备故障报警 | ||
| 26 | + DeviceFailure(6), | ||
| 27 | + | ||
| 28 | + // 7其他报警 | ||
| 29 | + Other(7); | ||
| 30 | + | ||
| 31 | + private final int val; | ||
| 32 | + | ||
| 33 | + DeviceAlarmMethod(int val) { | ||
| 34 | + this.val=val; | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + public int getVal() { | ||
| 38 | + return val; | ||
| 39 | + } | ||
| 40 | +} |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderPlarformProvider.java
| @@ -68,9 +68,6 @@ public class SIPRequestHeaderPlarformProvider { | @@ -68,9 +68,6 @@ public class SIPRequestHeaderPlarformProvider { | ||
| 68 | toHeader, viaHeaders, maxForwards); | 68 | toHeader, viaHeaders, maxForwards); |
| 69 | 69 | ||
| 70 | List<String> agentParam = new ArrayList<>(); | 70 | List<String> agentParam = new ArrayList<>(); |
| 71 | - agentParam.add("wvp-pro"); | ||
| 72 | - UserAgentHeader userAgentHeader = sipFactory.createHeaderFactory().createUserAgentHeader(agentParam); | ||
| 73 | - request.addHeader(userAgentHeader); | ||
| 74 | 71 | ||
| 75 | ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("Application", "MANSCDP+xml"); | 72 | ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("Application", "MANSCDP+xml"); |
| 76 | request.setContent(content, contentTypeHeader); | 73 | request.setContent(content, contentTypeHeader); |
| @@ -115,10 +112,6 @@ public class SIPRequestHeaderPlarformProvider { | @@ -115,10 +112,6 @@ public class SIPRequestHeaderPlarformProvider { | ||
| 115 | ExpiresHeader expires = sipFactory.createHeaderFactory().createExpiresHeader(Integer.parseInt(platform.getExpires())); | 112 | ExpiresHeader expires = sipFactory.createHeaderFactory().createExpiresHeader(Integer.parseInt(platform.getExpires())); |
| 116 | request.addHeader(expires); | 113 | request.addHeader(expires); |
| 117 | 114 | ||
| 118 | - List<String> agentParam = new ArrayList<>(); | ||
| 119 | - agentParam.add("wvp-pro"); | ||
| 120 | - UserAgentHeader userAgentHeader = sipFactory.createHeaderFactory().createUserAgentHeader(agentParam); | ||
| 121 | - request.addHeader(userAgentHeader); | ||
| 122 | 115 | ||
| 123 | return request; | 116 | return request; |
| 124 | } | 117 | } |
| @@ -226,10 +219,6 @@ public class SIPRequestHeaderPlarformProvider { | @@ -226,10 +219,6 @@ public class SIPRequestHeaderPlarformProvider { | ||
| 226 | messageFactory.setDefaultContentEncodingCharset(parentPlatform.getCharacterSet()); | 219 | messageFactory.setDefaultContentEncodingCharset(parentPlatform.getCharacterSet()); |
| 227 | request = messageFactory.createRequest(requestURI, Request.MESSAGE, callIdHeader, cSeqHeader, fromHeader, | 220 | request = messageFactory.createRequest(requestURI, Request.MESSAGE, callIdHeader, cSeqHeader, fromHeader, |
| 228 | toHeader, viaHeaders, maxForwards); | 221 | toHeader, viaHeaders, maxForwards); |
| 229 | - List<String> agentParam = new ArrayList<>(); | ||
| 230 | - agentParam.add("wvp-pro"); | ||
| 231 | - UserAgentHeader userAgentHeader = sipFactory.createHeaderFactory().createUserAgentHeader(agentParam); | ||
| 232 | - request.addHeader(userAgentHeader); | ||
| 233 | 222 | ||
| 234 | ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("Application", "MANSCDP+xml"); | 223 | ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("Application", "MANSCDP+xml"); |
| 235 | request.setContent(content, contentTypeHeader); | 224 | request.setContent(content, contentTypeHeader); |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
| @@ -27,6 +27,7 @@ import org.slf4j.Logger; | @@ -27,6 +27,7 @@ import org.slf4j.Logger; | ||
| 27 | import org.slf4j.LoggerFactory; | 27 | import org.slf4j.LoggerFactory; |
| 28 | import org.springframework.beans.factory.annotation.Autowired; | 28 | import org.springframework.beans.factory.annotation.Autowired; |
| 29 | import org.springframework.beans.factory.annotation.Qualifier; | 29 | import org.springframework.beans.factory.annotation.Qualifier; |
| 30 | +import org.springframework.boot.SpringBootVersion; | ||
| 30 | import org.springframework.context.annotation.DependsOn; | 31 | import org.springframework.context.annotation.DependsOn; |
| 31 | import org.springframework.stereotype.Component; | 32 | import org.springframework.stereotype.Component; |
| 32 | import org.springframework.util.StringUtils; | 33 | import org.springframework.util.StringUtils; |
| @@ -37,7 +38,9 @@ import javax.sip.header.*; | @@ -37,7 +38,9 @@ import javax.sip.header.*; | ||
| 37 | import javax.sip.message.Request; | 38 | import javax.sip.message.Request; |
| 38 | import java.lang.reflect.Field; | 39 | import java.lang.reflect.Field; |
| 39 | import java.text.ParseException; | 40 | import java.text.ParseException; |
| 41 | +import java.util.ArrayList; | ||
| 40 | import java.util.HashSet; | 42 | import java.util.HashSet; |
| 43 | +import java.util.List; | ||
| 41 | 44 | ||
| 42 | /** | 45 | /** |
| 43 | * @description:设备能力接口,用于定义设备的控制、查询能力 | 46 | * @description:设备能力接口,用于定义设备的控制、查询能力 |
| @@ -49,7 +52,7 @@ import java.util.HashSet; | @@ -49,7 +52,7 @@ import java.util.HashSet; | ||
| 49 | public class SIPCommander implements ISIPCommander { | 52 | public class SIPCommander implements ISIPCommander { |
| 50 | 53 | ||
| 51 | private final Logger logger = LoggerFactory.getLogger(SIPCommander.class); | 54 | private final Logger logger = LoggerFactory.getLogger(SIPCommander.class); |
| 52 | - | 55 | + |
| 53 | @Autowired | 56 | @Autowired |
| 54 | private SipConfig sipConfig; | 57 | private SipConfig sipConfig; |
| 55 | 58 | ||
| @@ -1643,7 +1646,18 @@ public class SIPCommander implements ISIPCommander { | @@ -1643,7 +1646,18 @@ public class SIPCommander implements ISIPCommander { | ||
| 1643 | } else if("UDP".equals(device.getTransport())) { | 1646 | } else if("UDP".equals(device.getTransport())) { |
| 1644 | clientTransaction = udpSipProvider.getNewClientTransaction(request); | 1647 | clientTransaction = udpSipProvider.getNewClientTransaction(request); |
| 1645 | } | 1648 | } |
| 1646 | - | 1649 | + if (request.getHeader(UserAgentHeader.NAME) == null) { |
| 1650 | + List<String> agentParam = new ArrayList<>(); | ||
| 1651 | + agentParam.add("wvp-pro"); | ||
| 1652 | + // TODO 添加版本信息以及日期 | ||
| 1653 | + UserAgentHeader userAgentHeader = null; | ||
| 1654 | + try { | ||
| 1655 | + userAgentHeader = sipFactory.createHeaderFactory().createUserAgentHeader(agentParam); | ||
| 1656 | + } catch (ParseException e) { | ||
| 1657 | + throw new RuntimeException(e); | ||
| 1658 | + } | ||
| 1659 | + request.addHeader(userAgentHeader); | ||
| 1660 | + } | ||
| 1647 | CallIdHeader callIdHeader = (CallIdHeader)request.getHeader(CallIdHeader.NAME); | 1661 | CallIdHeader callIdHeader = (CallIdHeader)request.getHeader(CallIdHeader.NAME); |
| 1648 | // 添加错误订阅 | 1662 | // 添加错误订阅 |
| 1649 | if (errorEvent != null) { | 1663 | if (errorEvent != null) { |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/AlarmNotifyMessageHandler.java
| @@ -32,7 +32,7 @@ import static com.genersoft.iot.vmp.gb28181.utils.XmlUtil.*; | @@ -32,7 +32,7 @@ import static com.genersoft.iot.vmp.gb28181.utils.XmlUtil.*; | ||
| 32 | @Component | 32 | @Component |
| 33 | public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent implements InitializingBean, IMessageHandler { | 33 | public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent implements InitializingBean, IMessageHandler { |
| 34 | 34 | ||
| 35 | - private Logger logger = LoggerFactory.getLogger(AlarmNotifyMessageHandler.class); | 35 | + private final Logger logger = LoggerFactory.getLogger(AlarmNotifyMessageHandler.class); |
| 36 | private final String cmdType = "Alarm"; | 36 | private final String cmdType = "Alarm"; |
| 37 | 37 | ||
| 38 | @Autowired | 38 | @Autowired |
| @@ -85,24 +85,27 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme | @@ -85,24 +85,27 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme | ||
| 85 | deviceAlarm.setAlarmPriority(getText(rootElement, "AlarmPriority")); | 85 | deviceAlarm.setAlarmPriority(getText(rootElement, "AlarmPriority")); |
| 86 | deviceAlarm.setAlarmMethod(getText(rootElement, "AlarmMethod")); | 86 | deviceAlarm.setAlarmMethod(getText(rootElement, "AlarmMethod")); |
| 87 | deviceAlarm.setAlarmTime(getText(rootElement, "AlarmTime")); | 87 | deviceAlarm.setAlarmTime(getText(rootElement, "AlarmTime")); |
| 88 | - if (getText(rootElement, "AlarmDescription") == null) { | 88 | + String alarmDescription = getText(rootElement, "AlarmDescription"); |
| 89 | + if (alarmDescription == null) { | ||
| 89 | deviceAlarm.setAlarmDescription(""); | 90 | deviceAlarm.setAlarmDescription(""); |
| 90 | } else { | 91 | } else { |
| 91 | - deviceAlarm.setAlarmDescription(getText(rootElement, "AlarmDescription")); | 92 | + deviceAlarm.setAlarmDescription(alarmDescription); |
| 92 | } | 93 | } |
| 93 | - if (NumericUtil.isDouble(getText(rootElement, "Longitude"))) { | ||
| 94 | - deviceAlarm.setLongitude(Double.parseDouble(getText(rootElement, "Longitude"))); | 94 | + String longitude = getText(rootElement, "Longitude"); |
| 95 | + if (longitude != null && NumericUtil.isDouble(longitude)) { | ||
| 96 | + deviceAlarm.setLongitude(Double.parseDouble(longitude)); | ||
| 95 | } else { | 97 | } else { |
| 96 | deviceAlarm.setLongitude(0.00); | 98 | deviceAlarm.setLongitude(0.00); |
| 97 | } | 99 | } |
| 98 | - if (NumericUtil.isDouble(getText(rootElement, "Latitude"))) { | ||
| 99 | - deviceAlarm.setLatitude(Double.parseDouble(getText(rootElement, "Latitude"))); | 100 | + String latitude = getText(rootElement, "Latitude"); |
| 101 | + if (latitude != null && NumericUtil.isDouble(latitude)) { | ||
| 102 | + deviceAlarm.setLatitude(Double.parseDouble(latitude)); | ||
| 100 | } else { | 103 | } else { |
| 101 | deviceAlarm.setLatitude(0.00); | 104 | deviceAlarm.setLatitude(0.00); |
| 102 | } | 105 | } |
| 103 | 106 | ||
| 104 | if (!StringUtils.isEmpty(deviceAlarm.getAlarmMethod())) { | 107 | if (!StringUtils.isEmpty(deviceAlarm.getAlarmMethod())) { |
| 105 | - if ( deviceAlarm.getAlarmMethod().equals("4")) { | 108 | + if ( deviceAlarm.getAlarmMethod().contains(DeviceAlarmMethod.GPS.getVal() + "")) { |
| 106 | MobilePosition mobilePosition = new MobilePosition(); | 109 | MobilePosition mobilePosition = new MobilePosition(); |
| 107 | mobilePosition.setDeviceId(deviceAlarm.getDeviceId()); | 110 | mobilePosition.setDeviceId(deviceAlarm.getDeviceId()); |
| 108 | mobilePosition.setTime(deviceAlarm.getAlarmTime()); | 111 | mobilePosition.setTime(deviceAlarm.getAlarmTime()); |
| @@ -122,7 +125,7 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme | @@ -122,7 +125,7 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme | ||
| 122 | } | 125 | } |
| 123 | } | 126 | } |
| 124 | if (!StringUtils.isEmpty(deviceAlarm.getDeviceId())) { | 127 | if (!StringUtils.isEmpty(deviceAlarm.getDeviceId())) { |
| 125 | - if (deviceAlarm.getAlarmMethod().equals("5")) { | 128 | + if (deviceAlarm.getAlarmMethod().contains(DeviceAlarmMethod.Video.getVal() + "")) { |
| 126 | deviceAlarm.setAlarmType(getText(rootElement.element("Info"), "AlarmType")); | 129 | deviceAlarm.setAlarmType(getText(rootElement.element("Info"), "AlarmType")); |
| 127 | } | 130 | } |
| 128 | } | 131 | } |
| @@ -173,25 +176,28 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme | @@ -173,25 +176,28 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme | ||
| 173 | deviceAlarm.setAlarmPriority(getText(rootElement, "AlarmPriority")); | 176 | deviceAlarm.setAlarmPriority(getText(rootElement, "AlarmPriority")); |
| 174 | deviceAlarm.setAlarmMethod(getText(rootElement, "AlarmMethod")); | 177 | deviceAlarm.setAlarmMethod(getText(rootElement, "AlarmMethod")); |
| 175 | deviceAlarm.setAlarmTime(getText(rootElement, "AlarmTime")); | 178 | deviceAlarm.setAlarmTime(getText(rootElement, "AlarmTime")); |
| 176 | - if (getText(rootElement, "AlarmDescription") == null) { | 179 | + String alarmDescription = getText(rootElement, "AlarmDescription"); |
| 180 | + if (alarmDescription == null) { | ||
| 177 | deviceAlarm.setAlarmDescription(""); | 181 | deviceAlarm.setAlarmDescription(""); |
| 178 | } else { | 182 | } else { |
| 179 | - deviceAlarm.setAlarmDescription(getText(rootElement, "AlarmDescription")); | 183 | + deviceAlarm.setAlarmDescription(alarmDescription); |
| 180 | } | 184 | } |
| 181 | - if (NumericUtil.isDouble(getText(rootElement, "Longitude"))) { | ||
| 182 | - deviceAlarm.setLongitude(Double.parseDouble(getText(rootElement, "Longitude"))); | 185 | + String longitude = getText(rootElement, "Longitude"); |
| 186 | + if (longitude != null && NumericUtil.isDouble(longitude)) { | ||
| 187 | + deviceAlarm.setLongitude(Double.parseDouble(longitude)); | ||
| 183 | } else { | 188 | } else { |
| 184 | deviceAlarm.setLongitude(0.00); | 189 | deviceAlarm.setLongitude(0.00); |
| 185 | } | 190 | } |
| 186 | - if (NumericUtil.isDouble(getText(rootElement, "Latitude"))) { | ||
| 187 | - deviceAlarm.setLatitude(Double.parseDouble(getText(rootElement, "Latitude"))); | 191 | + String latitude = getText(rootElement, "Latitude"); |
| 192 | + if (latitude != null && NumericUtil.isDouble(latitude)) { | ||
| 193 | + deviceAlarm.setLatitude(Double.parseDouble(latitude)); | ||
| 188 | } else { | 194 | } else { |
| 189 | deviceAlarm.setLatitude(0.00); | 195 | deviceAlarm.setLatitude(0.00); |
| 190 | } | 196 | } |
| 191 | 197 | ||
| 192 | if (!StringUtils.isEmpty(deviceAlarm.getAlarmMethod())) { | 198 | if (!StringUtils.isEmpty(deviceAlarm.getAlarmMethod())) { |
| 193 | 199 | ||
| 194 | - if (deviceAlarm.getAlarmMethod().equals("5")) { | 200 | + if (deviceAlarm.getAlarmMethod().contains(DeviceAlarmMethod.Video.getVal() + "")) { |
| 195 | deviceAlarm.setAlarmType(getText(rootElement.element("Info"), "AlarmType")); | 201 | deviceAlarm.setAlarmType(getText(rootElement.element("Info"), "AlarmType")); |
| 196 | } | 202 | } |
| 197 | } | 203 | } |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/PresetQueryResponseMessageHandler.java
0 → 100644
| 1 | +package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd; | ||
| 2 | + | ||
| 3 | +import com.genersoft.iot.vmp.conf.SipConfig; | ||
| 4 | +import com.genersoft.iot.vmp.conf.UserSetting; | ||
| 5 | +import com.genersoft.iot.vmp.domain.req.PresetQuerySipReq; | ||
| 6 | +import com.genersoft.iot.vmp.gb28181.bean.*; | ||
| 7 | +import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | ||
| 8 | +import com.genersoft.iot.vmp.gb28181.session.CatalogDataCatch; | ||
| 9 | +import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; | ||
| 10 | +import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; | ||
| 11 | +import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; | ||
| 12 | +import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; | ||
| 13 | +import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler; | ||
| 14 | +import com.genersoft.iot.vmp.gb28181.utils.Coordtransform; | ||
| 15 | +import com.genersoft.iot.vmp.gb28181.utils.NumericUtil; | ||
| 16 | +import com.genersoft.iot.vmp.gb28181.utils.XmlUtil; | ||
| 17 | +import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | ||
| 18 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | ||
| 19 | +import org.dom4j.DocumentException; | ||
| 20 | +import org.dom4j.Element; | ||
| 21 | +import org.slf4j.Logger; | ||
| 22 | +import org.slf4j.LoggerFactory; | ||
| 23 | +import org.springframework.beans.factory.InitializingBean; | ||
| 24 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 25 | +import org.springframework.stereotype.Component; | ||
| 26 | +import org.springframework.util.StringUtils; | ||
| 27 | + | ||
| 28 | +import javax.sip.InvalidArgumentException; | ||
| 29 | +import javax.sip.RequestEvent; | ||
| 30 | +import javax.sip.SipException; | ||
| 31 | +import javax.sip.message.Response; | ||
| 32 | +import java.text.ParseException; | ||
| 33 | +import java.text.SimpleDateFormat; | ||
| 34 | +import java.util.ArrayList; | ||
| 35 | +import java.util.Iterator; | ||
| 36 | +import java.util.List; | ||
| 37 | +import java.util.UUID; | ||
| 38 | + | ||
| 39 | +import static com.genersoft.iot.vmp.gb28181.utils.XmlUtil.getText; | ||
| 40 | + | ||
| 41 | +@Component | ||
| 42 | +public class PresetQueryResponseMessageHandler extends SIPRequestProcessorParent implements InitializingBean, IMessageHandler { | ||
| 43 | + | ||
| 44 | + private Logger logger = LoggerFactory.getLogger(PresetQueryResponseMessageHandler.class); | ||
| 45 | + private final String cmdType = "PresetQuery"; | ||
| 46 | + | ||
| 47 | + private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
| 48 | + | ||
| 49 | + @Autowired | ||
| 50 | + private ResponseMessageHandler responseMessageHandler; | ||
| 51 | + | ||
| 52 | + @Autowired | ||
| 53 | + private DeferredResultHolder deferredResultHolder; | ||
| 54 | + | ||
| 55 | + | ||
| 56 | + @Override | ||
| 57 | + public void afterPropertiesSet() throws Exception { | ||
| 58 | + responseMessageHandler.addHandler(cmdType, this); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + @Override | ||
| 62 | + public void handForDevice(RequestEvent evt, Device device, Element element) { | ||
| 63 | + Element rootElement = null; | ||
| 64 | + try { | ||
| 65 | + rootElement = getRootElement(evt, device.getCharset()); | ||
| 66 | + | ||
| 67 | + Element presetListNumElement = rootElement.element("PresetList"); | ||
| 68 | + Element snElement = rootElement.element("SN"); | ||
| 69 | + //该字段可能为通道或则设备的id | ||
| 70 | + String deviceId = getText(rootElement, "DeviceID"); | ||
| 71 | + String key = DeferredResultHolder.CALLBACK_CMD_PRESETQUERY + deviceId; | ||
| 72 | + if (snElement == null || presetListNumElement == null) { | ||
| 73 | + responseAck(evt, Response.BAD_REQUEST, "xml error"); | ||
| 74 | + return; | ||
| 75 | + } | ||
| 76 | + int sumNum = Integer.parseInt(presetListNumElement.attributeValue("Num")); | ||
| 77 | + List<PresetQuerySipReq> presetQuerySipReqList = new ArrayList<>(); | ||
| 78 | + if (sumNum == 0) { | ||
| 79 | + // 数据无预置位信息 | ||
| 80 | + | ||
| 81 | + | ||
| 82 | + }else { | ||
| 83 | + for (Iterator<Element> presetIterator = presetListNumElement.elementIterator();presetIterator.hasNext();){ | ||
| 84 | + Element itemListElement = presetIterator.next(); | ||
| 85 | + PresetQuerySipReq presetQuerySipReq = new PresetQuerySipReq(); | ||
| 86 | + for (Iterator<Element> itemListIterator = itemListElement.elementIterator();itemListIterator.hasNext();){ | ||
| 87 | + // 遍历item | ||
| 88 | + Element itemOne = itemListIterator.next(); | ||
| 89 | + String name = itemOne.getName(); | ||
| 90 | + String textTrim = itemOne.getTextTrim(); | ||
| 91 | + if("PresetID".equals(name)){ | ||
| 92 | + presetQuerySipReq.setPresetId(textTrim); | ||
| 93 | + }else { | ||
| 94 | + presetQuerySipReq.setPresetName(textTrim); | ||
| 95 | + } | ||
| 96 | + } | ||
| 97 | + presetQuerySipReqList.add(presetQuerySipReq); | ||
| 98 | + | ||
| 99 | + | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + } | ||
| 103 | + RequestMessage requestMessage = new RequestMessage(); | ||
| 104 | + requestMessage.setKey(key); | ||
| 105 | + requestMessage.setData(presetQuerySipReqList); | ||
| 106 | + deferredResultHolder.invokeAllResult(requestMessage); | ||
| 107 | + responseAck(evt, Response.OK); | ||
| 108 | + } catch (DocumentException e) { | ||
| 109 | + e.printStackTrace(); | ||
| 110 | + } catch (InvalidArgumentException e) { | ||
| 111 | + e.printStackTrace(); | ||
| 112 | + } catch (ParseException e) { | ||
| 113 | + e.printStackTrace(); | ||
| 114 | + } catch (SipException e) { | ||
| 115 | + e.printStackTrace(); | ||
| 116 | + } | ||
| 117 | + } | ||
| 118 | + | ||
| 119 | + @Override | ||
| 120 | + public void handForPlatform(RequestEvent evt, ParentPlatform parentPlatform, Element rootElement) { | ||
| 121 | + | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | +} |
web_src/index.html
| @@ -12,26 +12,7 @@ | @@ -12,26 +12,7 @@ | ||
| 12 | <script type="text/javascript" src="./static/js/jessibuca/jessibuca.js"></script> | 12 | <script type="text/javascript" src="./static/js/jessibuca/jessibuca.js"></script> |
| 13 | <script type="text/javascript" src="./static/js/EasyWasmPlayer.js"></script> | 13 | <script type="text/javascript" src="./static/js/EasyWasmPlayer.js"></script> |
| 14 | <script type="text/javascript" src="./static/js/ZLMRTCClient.js"></script> | 14 | <script type="text/javascript" src="./static/js/ZLMRTCClient.js"></script> |
| 15 | + <script type="text/javascript" src="./static/js/mapConfig.js"></script> | ||
| 15 | <div id="app"></div> | 16 | <div id="app"></div> |
| 16 | - <!-- built files will be auto injected --> | ||
| 17 | - <script> | ||
| 18 | - // map组件全局参数, 注释此内容可以关闭地图功能 | ||
| 19 | - window.mapParam = { | ||
| 20 | - // 坐标系 GCJ-02 WGS-84, | ||
| 21 | - coordinateSystem: "GCJ-02", | ||
| 22 | - // 地图瓦片地址 | ||
| 23 | - tilesUrl: "http://webrd0{1-4}.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scale=1&style=8", | ||
| 24 | - // 瓦片大小 | ||
| 25 | - tileSize: 256, | ||
| 26 | - // 默认层级 | ||
| 27 | - zoom:10, | ||
| 28 | - // 默认地图中心点 | ||
| 29 | - center:[116.41020, 39.915119], | ||
| 30 | - // 地图最大层级 | ||
| 31 | - maxZoom:18, | ||
| 32 | - // 地图最小层级 | ||
| 33 | - minZoom: 3 | ||
| 34 | - } | ||
| 35 | - </script> | ||
| 36 | </body> | 17 | </body> |
| 37 | </html> | 18 | </html> |
web_src/src/components/devicePosition.vue
| @@ -59,7 +59,7 @@ export default { | @@ -59,7 +59,7 @@ export default { | ||
| 59 | }, | 59 | }, |
| 60 | data() { | 60 | data() { |
| 61 | return { | 61 | return { |
| 62 | - onOff: typeof window.mapParam !== "undefined", | 62 | + onOff: typeof window.mapParam !== "undefined" && window.mapParam.enable, |
| 63 | deviceService: new DeviceService(), | 63 | deviceService: new DeviceService(), |
| 64 | layer: null, | 64 | layer: null, |
| 65 | lineLayer: null, | 65 | lineLayer: null, |
web_src/static/js/mapConfig.js
0 → 100644
| 1 | +// map组件全局参数, 注释此内容可以关闭地图功能 | ||
| 2 | +window.mapParam = { | ||
| 3 | + // 开启/关闭地图功能 | ||
| 4 | + enable: true, | ||
| 5 | + // 坐标系 GCJ-02 WGS-84, | ||
| 6 | + coordinateSystem: "GCJ-02", | ||
| 7 | + // 地图瓦片地址 | ||
| 8 | + tilesUrl: "http://webrd0{1-4}.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scale=1&style=8", | ||
| 9 | + // 瓦片大小 | ||
| 10 | + tileSize: 256, | ||
| 11 | + // 默认层级 | ||
| 12 | + zoom:10, | ||
| 13 | + // 默认地图中心点 | ||
| 14 | + center:[116.41020, 39.915119], | ||
| 15 | + // 地图最大层级 | ||
| 16 | + maxZoom:18, | ||
| 17 | + // 地图最小层级 | ||
| 18 | + minZoom: 3 | ||
| 19 | +} |