Commit 07b182da98ac54fffa8f36b8db27d6212e1e0bf7

Authored by 648540858
2 parents 41fdb9d1 f8d2b933

Merge branch 'wvp-28181-2.0' into feature/record

# Conflicts:
#	src/main/java/com/genersoft/iot/vmp/conf/security/WebSecurityConfig.java
#	src/main/java/com/genersoft/iot/vmp/vmanager/cloudRecord/CloudRecordController.java
Showing 28 changed files with 506 additions and 245 deletions
... ... @@ -163,21 +163,16 @@
163 163 </dependency>
164 164  
165 165 <!--在线文档 -->
  166 + <!--在线文档 -->
166 167 <dependency>
167 168 <groupId>org.springdoc</groupId>
168 169 <artifactId>springdoc-openapi-ui</artifactId>
169   - <version>1.7.0</version>
170   - <exclusions>
171   - <exclusion>
172   - <groupId>org.yaml</groupId>
173   - <artifactId>snakeyaml</artifactId>
174   - </exclusion>
175   - </exclusions>
  170 + <version>1.6.10</version>
176 171 </dependency>
177 172 <dependency>
178   - <groupId>org.yaml</groupId>
179   - <artifactId>snakeyaml</artifactId>
180   - <version>2.2</version>
  173 + <groupId>org.springdoc</groupId>
  174 + <artifactId>springdoc-openapi-security</artifactId>
  175 + <version>1.6.10</version>
181 176 </dependency>
182 177  
183 178 <dependency>
... ...
src/main/java/com/genersoft/iot/vmp/conf/SpringDocConfig.java
1 1 package com.genersoft.iot.vmp.conf;
2 2  
  3 +import com.genersoft.iot.vmp.conf.security.JwtUtils;
  4 +import io.swagger.v3.oas.models.Components;
3 5 import io.swagger.v3.oas.models.OpenAPI;
4 6 import io.swagger.v3.oas.models.info.Contact;
5 7 import io.swagger.v3.oas.models.info.Info;
6 8 import io.swagger.v3.oas.models.info.License;
  9 +import io.swagger.v3.oas.models.security.SecurityScheme;
7 10 import org.springframework.core.annotation.Order;
8 11 import org.springdoc.core.GroupedOpenApi;
9 12 import org.springframework.beans.factory.annotation.Value;
... ... @@ -26,10 +29,14 @@ public class SpringDocConfig {
26 29 contact.setName("pan");
27 30 contact.setEmail("648540858@qq.com");
28 31 return new OpenAPI()
  32 + .components(new Components()
  33 + .addSecuritySchemes(JwtUtils.HEADER, new SecurityScheme()
  34 + .type(SecurityScheme.Type.HTTP)
  35 + .bearerFormat("JWT")))
29 36 .info(new Info().title("WVP-PRO 接口文档")
30 37 .contact(contact)
31 38 .description("开箱即用的28181协议视频平台")
32   - .version("v2.0")
  39 + .version("v3.1.0")
33 40 .license(new License().name("Apache 2.0").url("http://springdoc.org")));
34 41 }
35 42  
... ...
src/main/java/com/genersoft/iot/vmp/conf/security/JwtUtils.java
... ... @@ -28,7 +28,7 @@ public class JwtUtils implements InitializingBean {
28 28  
29 29 private static final Logger logger = LoggerFactory.getLogger(JwtUtils.class);
30 30  
31   - private static final String HEADER = "access-token";
  31 + public static final String HEADER = "access-token";
32 32  
33 33 private static final String AUDIENCE = "Audience";
34 34  
... ...
src/main/java/com/genersoft/iot/vmp/conf/security/WebSecurityConfig.java
... ... @@ -68,6 +68,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
68 68 matchers.add("/");
69 69 matchers.add("/#/**");
70 70 matchers.add("/static/**");
  71 + matchers.add("/swagger-ui.html");
  72 + matchers.add("/swagger-ui/");
71 73 matchers.add("/index.html");
72 74 matchers.add("/doc.html");
73 75 matchers.add("/webjars/**");
... ... @@ -77,6 +79,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
77 79 matchers.add("/api/device/query/snap/**");
78 80 matchers.add("/record_proxy/*/**");
79 81 matchers.add("/api/emit");
  82 + matchers.add("/favicon.ico");
80 83 // 可以直接访问的静态数据
81 84 web.ignoring().antMatchers(matchers.toArray(new String[0]));
82 85 }
... ... @@ -113,7 +116,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
113 116 .authorizeRequests()
114 117 .requestMatchers(CorsUtils::isPreFlightRequest).permitAll()
115 118 .antMatchers(userSetting.getInterfaceAuthenticationExcludes().toArray(new String[0])).permitAll()
116   - .antMatchers("/api/user/login","/index/hook/**","/zlm_Proxy/FhTuMYqB2HeCuNOb/record/t/1/2023-03-25/16:35:07-16:35:16-9353.mp4").permitAll()
  119 + .antMatchers("/api/user/login", "/index/hook/**", "/swagger-ui/**", "/doc.html").permitAll()
117 120 .anyRequest().authenticated()
118 121 // 异常处理器
119 122 .and()
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java
... ... @@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.gb28181.bean.Device;
8 8 import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
9 9 import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
10 10 import com.genersoft.iot.vmp.utils.DateUtil;
  11 +import org.apache.commons.lang3.StringUtils;
11 12 import org.apache.commons.lang3.math.NumberUtils;
12 13 import org.dom4j.Attribute;
13 14 import org.dom4j.Document;
... ... @@ -214,8 +215,11 @@ public class XmlUtil {
214 215 return deviceChannel;
215 216 }
216 217 Element nameElement = itemDevice.element("Name");
217   - if (nameElement != null) {
  218 + // 当通道名称为空时,设置通道名称为通道编码,避免级联时因通道名称为空导致上级接收通道失败
  219 + if (nameElement != null && StringUtils.isNotBlank(nameElement.getText())) {
218 220 deviceChannel.setName(nameElement.getText());
  221 + } else {
  222 + deviceChannel.setName(channelId);
219 223 }
220 224 if(channelId.length() <= 8) {
221 225 deviceChannel.setHasAudio(false);
... ...
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
... ... @@ -6,7 +6,6 @@ import com.genersoft.iot.vmp.gb28181.bean.DeviceChannelInPlatform;
6 6 import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
7 7 import com.genersoft.iot.vmp.web.gb28181.dto.DeviceChannelExtend;
8 8 import org.apache.ibatis.annotations.*;
9   -import org.apache.ibatis.annotations.Param;
10 9 import org.springframework.stereotype.Repository;
11 10  
12 11 import java.util.List;
... ... @@ -31,7 +30,7 @@ public interface DeviceChannelMapper {
31 30 @Update(value = {" <script>" +
32 31 "UPDATE wvp_device_channel " +
33 32 "SET update_time=#{updateTime}" +
34   - "<if test='name != null'>, name=#{name}</if>" +
  33 + ", custom_name=#{name}" +
35 34 "<if test='manufacture != null'>, manufacture=#{manufacture}</if>" +
36 35 "<if test='model != null'>, model=#{model}</if>" +
37 36 "<if test='owner != null'>, owner=#{owner}</if>" +
... ... @@ -49,12 +48,12 @@ public interface DeviceChannelMapper {
49 48 "<if test='ipAddress != null'>, ip_address=#{ipAddress}</if>" +
50 49 "<if test='port != null'>, port=#{port}</if>" +
51 50 "<if test='password != null'>, password=#{password}</if>" +
52   - "<if test='PTZType != null'>, ptz_type=#{PTZType}</if>" +
  51 + "<if test='PTZType != null'>, custom_ptz_type=#{PTZType}</if>" +
53 52 "<if test='status != null'>, status=#{status}</if>" +
54 53 "<if test='streamId != null'>, stream_id=#{streamId}</if>" +
55 54 "<if test='hasAudio != null'>, has_audio=#{hasAudio}</if>" +
56   - "<if test='longitude != null'>, longitude=#{longitude}</if>" +
57   - "<if test='latitude != null'>, latitude=#{latitude}</if>" +
  55 + ", custom_longitude=#{longitude}" +
  56 + ", custom_latitude=#{latitude}" +
58 57 "<if test='longitudeGcj02 != null'>, longitude_gcj02=#{longitudeGcj02}</if>" +
59 58 "<if test='latitudeGcj02 != null'>, latitude_gcj02=#{latitudeGcj02}</if>" +
60 59 "<if test='longitudeWgs84 != null'>, longitude_wgs84=#{longitudeWgs84}</if>" +
... ... @@ -67,7 +66,43 @@ public interface DeviceChannelMapper {
67 66  
68 67 @Select(value = {" <script>" +
69 68 "SELECT " +
70   - "dc.* " +
  69 + "dc.id, " +
  70 + "dc.channel_id, " +
  71 + "COALESCE(dc.custom_name, dc.name) AS name, " +
  72 + "dc.manufacture, " +
  73 + "dc.model, " +
  74 + "dc.owner, " +
  75 + "dc.civil_code, " +
  76 + "dc.block, " +
  77 + "dc.address, " +
  78 + "dc.parent_id, " +
  79 + "dc.safety_way, " +
  80 + "dc.register_way, " +
  81 + "dc.cert_num, " +
  82 + "dc.certifiable, " +
  83 + "dc.err_code, " +
  84 + "dc.end_time, " +
  85 + "dc.secrecy, " +
  86 + "dc.ip_address, " +
  87 + "dc.port, " +
  88 + "dc.password, " +
  89 + "COALESCE(dc.custom_ptz_type, dc.ptz_type) AS ptz_type, " +
  90 + "dc.status, " +
  91 + "COALESCE(dc.custom_longitude, dc.longitude) AS longitude, " +
  92 + "COALESCE(dc.custom_latitude, dc.latitude) AS latitude, " +
  93 + "dc.stream_id, " +
  94 + "dc.device_id, " +
  95 + "dc.parental, " +
  96 + "dc.has_audio, " +
  97 + "dc.create_time, " +
  98 + "dc.update_time, " +
  99 + "dc.sub_count, " +
  100 + "dc.longitude_gcj02, " +
  101 + "dc.latitude_gcj02, " +
  102 + "dc.longitude_wgs84, " +
  103 + "dc.latitude_wgs84, " +
  104 + "dc.business_group_id, " +
  105 + "dc.gps_time " +
71 106 "from " +
72 107 "wvp_device_channel dc " +
73 108 "WHERE " +
... ... @@ -154,7 +189,7 @@ public interface DeviceChannelMapper {
154 189 " dc.id,\n" +
155 190 " dc.channel_id,\n" +
156 191 " dc.device_id,\n" +
157   - " dc.name,\n" +
  192 + " COALESCE(dc.custom_name, dc.name) AS name,\n" +
158 193 " de.manufacturer,\n" +
159 194 " de.host_address,\n" +
160 195 " dc.sub_count,\n" +
... ... @@ -392,10 +427,10 @@ public interface DeviceChannelMapper {
392 427 @Select("select * from wvp_device_channel where device_id=#{deviceId} and SUBSTRING(channel_id, 11, 3)=#{typeCode}")
393 428 List<DeviceChannel> getBusinessGroups(@Param("deviceId") String deviceId, @Param("typeCode") String typeCode);
394 429  
395   - @Select("select dc.id, dc.channel_id, dc.device_id, dc.name, dc.manufacture,dc.model,dc.owner, pc.civil_code,dc.block, " +
  430 + @Select("select dc.id, dc.channel_id, dc.device_id, COALESCE(dc.custom_name, dc.name) AS name, dc.manufacture,dc.model,dc.owner, pc.civil_code,dc.block, " +
396 431 " dc.address, '0' as parental,'0' as channel_type, pc.id as parent_id, dc.safety_way, dc.register_way,dc.cert_num, dc.certifiable, " +
397   - " dc.err_code,dc.end_time, dc.secrecy, dc.ip_address, dc.port, dc.ptz_type, dc.password, dc.status, " +
398   - " dc.longitude_wgs84 as longitude, dc.latitude_wgs84 as latitude, pc.business_group_id " +
  432 + " dc.err_code,dc.end_time, dc.secrecy, dc.ip_address, dc.port, COALESCE(dc.custom_ptz_type, dc.ptz_type) AS ptz_type, dc.password, dc.status, " +
  433 + " COALESCE(dc.custom_longitude, dc.longitude) AS longitude, COALESCE(dc.custom_latitude, dc.latitude) AS latitude, pc.business_group_id " +
399 434 " from wvp_device_channel dc" +
400 435 " LEFT JOIN wvp_platform_gb_channel pgc on dc.id = pgc.device_channel_id" +
401 436 " LEFT JOIN wvp_platform_catalog pc on pgc.catalog_id = pc.id and pgc.platform_id = pc.platform_id" +
... ... @@ -457,7 +492,44 @@ public interface DeviceChannelMapper {
457 492 void clearPlay(String deviceId);
458 493 // 设备主子码流逻辑END
459 494 @Select(value = {" <script>" +
460   - "select * " +
  495 + "SELECT id,\n" +
  496 + " channel_id,\n" +
  497 + " COALESCE(custom_name, name) AS name,\n" +
  498 + " custom_name,\n" +
  499 + " manufacture,\n" +
  500 + " model,\n" +
  501 + " owner,\n" +
  502 + " civil_code,\n" +
  503 + " block,\n" +
  504 + " address,\n" +
  505 + " parent_id,\n" +
  506 + " safety_way,\n" +
  507 + " register_way,\n" +
  508 + " cert_num,\n" +
  509 + " certifiable,\n" +
  510 + " err_code,\n" +
  511 + " end_time,\n" +
  512 + " secrecy,\n" +
  513 + " ip_address,\n" +
  514 + " port,\n" +
  515 + " password,\n" +
  516 + " COALESCE(custom_ptz_type, ptz_type) AS ptz_type,\n" +
  517 + " status,\n" +
  518 + " COALESCE(custom_longitude, longitude) AS longitude,\n" +
  519 + " COALESCE(custom_latitude, latitude) AS latitude,\n" +
  520 + " stream_id,\n" +
  521 + " device_id,\n" +
  522 + " parental,\n" +
  523 + " has_audio,\n" +
  524 + " create_time,\n" +
  525 + " update_time,\n" +
  526 + " sub_count,\n" +
  527 + " longitude_gcj02,\n" +
  528 + " latitude_gcj02,\n" +
  529 + " longitude_wgs84,\n" +
  530 + " latitude_wgs84,\n" +
  531 + " business_group_id,\n" +
  532 + " gps_time\n" +
461 533 "from wvp_device_channel " +
462 534 "where device_id=#{deviceId}" +
463 535 " <if test='parentId != null and parentId != deviceId'> and parent_id = #{parentId} </if>" +
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/cloudRecord/CloudRecordController.java
... ... @@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSONArray;
4 4 import com.genersoft.iot.vmp.conf.DynamicTask;
5 5 import com.genersoft.iot.vmp.conf.UserSetting;
6 6 import com.genersoft.iot.vmp.conf.exception.ControllerException;
  7 +import com.genersoft.iot.vmp.conf.security.JwtUtils;
7 8 import com.genersoft.iot.vmp.media.zlm.SendRtpPortManager;
8 9 import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
9 10 import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
... ... @@ -15,6 +16,7 @@ import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
15 16 import com.github.pagehelper.PageInfo;
16 17 import io.swagger.v3.oas.annotations.Operation;
17 18 import io.swagger.v3.oas.annotations.Parameter;
  19 +import io.swagger.v3.oas.annotations.security.SecurityRequirement;
18 20 import io.swagger.v3.oas.annotations.tags.Tag;
19 21 import org.apache.commons.lang3.ObjectUtils;
20 22 import org.slf4j.Logger;
... ... @@ -46,7 +48,7 @@ public class CloudRecordController {
46 48  
47 49 @ResponseBody
48 50 @GetMapping("/date/list")
49   - @Operation(summary = "查询存在云端录像的日期")
  51 + @Operation(summary = "查询存在云端录像的日期", security = @SecurityRequirement(name = JwtUtils.HEADER))
50 52 @Parameter(name = "app", description = "应用名", required = true)
51 53 @Parameter(name = "stream", description = "流ID", required = true)
52 54 @Parameter(name = "year", description = "年,置空则查询当年", required = false)
... ... @@ -89,7 +91,7 @@ public class CloudRecordController {
89 91  
90 92 @ResponseBody
91 93 @GetMapping("/list")
92   - @Operation(summary = "分页查询云端录像")
  94 + @Operation(summary = "分页查询云端录像"security = @SecurityRequirement(name = JwtUtils.HEADER))
93 95 @Parameter(name = "query", description = "检索内容", required = false)
94 96 @Parameter(name = "app", description = "应用名", required = false)
95 97 @Parameter(name = "stream", description = "流ID", required = false)
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/MobilePosition/MobilePositionController.java
1 1 package com.genersoft.iot.vmp.vmanager.gb28181.MobilePosition;
2 2  
3 3 import com.genersoft.iot.vmp.conf.exception.ControllerException;
  4 +import com.genersoft.iot.vmp.conf.security.JwtUtils;
4 5 import com.genersoft.iot.vmp.gb28181.bean.Device;
5 6 import com.genersoft.iot.vmp.gb28181.bean.MobilePosition;
6 7 import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
... ... @@ -13,6 +14,7 @@ import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
13 14 import com.github.pagehelper.util.StringUtil;
14 15 import io.swagger.v3.oas.annotations.Operation;
15 16 import io.swagger.v3.oas.annotations.Parameter;
  17 +import io.swagger.v3.oas.annotations.security.SecurityRequirement;
16 18 import io.swagger.v3.oas.annotations.tags.Tag;
17 19 import org.slf4j.Logger;
18 20 import org.slf4j.LoggerFactory;
... ... @@ -59,7 +61,7 @@ public class MobilePositionController {
59 61 * @param end 结束时间
60 62 * @return
61 63 */
62   - @Operation(summary = "查询历史轨迹")
  64 + @Operation(summary = "查询历史轨迹", security = @SecurityRequirement(name = JwtUtils.HEADER))
63 65 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
64 66 @Parameter(name = "channelId", description = "通道国标编号")
65 67 @Parameter(name = "start", description = "开始时间")
... ... @@ -84,7 +86,7 @@ public class MobilePositionController {
84 86 * @param deviceId 设备ID
85 87 * @return
86 88 */
87   - @Operation(summary = "查询设备最新位置")
  89 + @Operation(summary = "查询设备最新位置", security = @SecurityRequirement(name = JwtUtils.HEADER))
88 90 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
89 91 @GetMapping("/latest/{deviceId}")
90 92 public MobilePosition latestPosition(@PathVariable String deviceId) {
... ... @@ -96,7 +98,7 @@ public class MobilePositionController {
96 98 * @param deviceId 设备ID
97 99 * @return
98 100 */
99   - @Operation(summary = "获取移动位置信息")
  101 + @Operation(summary = "获取移动位置信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
100 102 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
101 103 @GetMapping("/realtime/{deviceId}")
102 104 public DeferredResult<MobilePosition> realTimePosition(@PathVariable String deviceId) {
... ... @@ -136,7 +138,7 @@ public class MobilePositionController {
136 138 * @param interval 上报时间间隔
137 139 * @return true = 命令发送成功
138 140 */
139   - @Operation(summary = "订阅位置信息")
  141 + @Operation(summary = "订阅位置信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
140 142 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
141 143 @Parameter(name = "expires", description = "订阅超时时间", required = true)
142 144 @Parameter(name = "interval", description = "上报时间间隔", required = true)
... ... @@ -162,7 +164,7 @@ public class MobilePositionController {
162 164 * @param deviceId 设备ID
163 165 * @return true = 命令发送成功
164 166 */
165   - @Operation(summary = "数据位置信息格式处理")
  167 + @Operation(summary = "数据位置信息格式处理", security = @SecurityRequirement(name = JwtUtils.HEADER))
166 168 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
167 169 @GetMapping("/transform/{deviceId}")
168 170 public void positionTransform(@PathVariable String deviceId) {
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/alarm/AlarmController.java
1 1 package com.genersoft.iot.vmp.vmanager.gb28181.alarm;
2 2  
3 3 import com.genersoft.iot.vmp.conf.exception.ControllerException;
  4 +import com.genersoft.iot.vmp.conf.security.JwtUtils;
4 5 import com.genersoft.iot.vmp.gb28181.bean.Device;
5 6 import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm;
6 7 import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
... ... @@ -13,6 +14,7 @@ import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
13 14 import com.github.pagehelper.PageInfo;
14 15 import io.swagger.v3.oas.annotations.Operation;
15 16 import io.swagger.v3.oas.annotations.Parameter;
  17 +import io.swagger.v3.oas.annotations.security.SecurityRequirement;
16 18 import io.swagger.v3.oas.annotations.tags.Tag;
17 19 import org.slf4j.Logger;
18 20 import org.slf4j.LoggerFactory;
... ... @@ -56,7 +58,7 @@ public class AlarmController {
56 58 * @return
57 59 */
58 60 @DeleteMapping("/delete")
59   - @Operation(summary = "删除报警")
  61 + @Operation(summary = "删除报警", security = @SecurityRequirement(name = JwtUtils.HEADER))
60 62 @Parameter(name = "id", description = "ID")
61 63 @Parameter(name = "deviceIds", description = "多个设备id,逗号分隔")
62 64 @Parameter(name = "time", description = "结束时间")
... ... @@ -93,7 +95,7 @@ public class AlarmController {
93 95 * @return
94 96 */
95 97 @GetMapping("/test/notify/alarm")
96   - @Operation(summary = "测试向上级/设备发送模拟报警通知")
  98 + @Operation(summary = "测试向上级/设备发送模拟报警通知", security = @SecurityRequirement(name = JwtUtils.HEADER))
97 99 @Parameter(name = "deviceId", description = "设备国标编号")
98 100 public void delete(@RequestParam String deviceId) {
99 101 Device device = storage.queryVideoDevice(deviceId);
... ... @@ -141,7 +143,7 @@ public class AlarmController {
141 143 * @param endTime 结束时间
142 144 * @return
143 145 */
144   - @Operation(summary = "分页查询报警")
  146 + @Operation(summary = "分页查询报警", security = @SecurityRequirement(name = JwtUtils.HEADER))
145 147 @Parameter(name = "page",description = "当前页",required = true)
146 148 @Parameter(name = "count",description = "每页查询数量",required = true)
147 149 @Parameter(name = "deviceId",description = "设备id")
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceConfig.java
... ... @@ -9,6 +9,7 @@ package com.genersoft.iot.vmp.vmanager.gb28181.device;
9 9  
10 10 import com.alibaba.fastjson2.JSONObject;
11 11 import com.genersoft.iot.vmp.conf.exception.ControllerException;
  12 +import com.genersoft.iot.vmp.conf.security.JwtUtils;
12 13 import com.genersoft.iot.vmp.gb28181.bean.Device;
13 14 import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
14 15 import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
... ... @@ -17,6 +18,7 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
17 18 import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
18 19 import io.swagger.v3.oas.annotations.Operation;
19 20 import io.swagger.v3.oas.annotations.Parameter;
  21 +import io.swagger.v3.oas.annotations.security.SecurityRequirement;
20 22 import io.swagger.v3.oas.annotations.tags.Tag;
21 23 import org.slf4j.Logger;
22 24 import org.slf4j.LoggerFactory;
... ... @@ -57,7 +59,7 @@ public class DeviceConfig {
57 59 * @return
58 60 */
59 61 @GetMapping("/basicParam/{deviceId}")
60   - @Operation(summary = "基本配置设置命令")
  62 + @Operation(summary = "基本配置设置命令", security = @SecurityRequirement(name = JwtUtils.HEADER))
61 63 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
62 64 @Parameter(name = "channelId", description = "通道国标编号", required = true)
63 65 @Parameter(name = "name", description = "名称")
... ... @@ -113,7 +115,7 @@ public class DeviceConfig {
113 115 * @param channelId 通道ID
114 116 * @return
115 117 */
116   - @Operation(summary = "设备配置查询请求")
  118 + @Operation(summary = "设备配置查询请求", security = @SecurityRequirement(name = JwtUtils.HEADER))
117 119 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
118 120 @Parameter(name = "channelId", description = "通道国标编号", required = true)
119 121 @Parameter(name = "configType", description = "配置类型")
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceControl.java
... ... @@ -9,6 +9,7 @@ package com.genersoft.iot.vmp.vmanager.gb28181.device;
9 9  
10 10 import com.alibaba.fastjson2.JSONObject;
11 11 import com.genersoft.iot.vmp.conf.exception.ControllerException;
  12 +import com.genersoft.iot.vmp.conf.security.JwtUtils;
12 13 import com.genersoft.iot.vmp.gb28181.bean.Device;
13 14 import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
14 15 import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
... ... @@ -17,6 +18,7 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
17 18 import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
18 19 import io.swagger.v3.oas.annotations.Operation;
19 20 import io.swagger.v3.oas.annotations.Parameter;
  21 +import io.swagger.v3.oas.annotations.security.SecurityRequirement;
20 22 import io.swagger.v3.oas.annotations.tags.Tag;
21 23 import org.slf4j.Logger;
22 24 import org.slf4j.LoggerFactory;
... ... @@ -53,7 +55,7 @@ public class DeviceControl {
53 55 *
54 56 * @param deviceId 设备ID
55 57 */
56   - @Operation(summary = "远程启动控制命令")
  58 + @Operation(summary = "远程启动控制命令", security = @SecurityRequirement(name = JwtUtils.HEADER))
57 59 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
58 60 @GetMapping("/teleboot/{deviceId}")
59 61 public void teleBootApi(@PathVariable String deviceId) {
... ... @@ -76,7 +78,7 @@ public class DeviceControl {
76 78 * @param recordCmdStr Record:手动录像,StopRecord:停止手动录像
77 79 * @param channelId 通道编码(可选)
78 80 */
79   - @Operation(summary = "录像控制")
  81 + @Operation(summary = "录像控制", security = @SecurityRequirement(name = JwtUtils.HEADER))
80 82 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
81 83 @Parameter(name = "channelId", description = "通道国标编号", required = true)
82 84 @Parameter(name = "recordCmdStr", description = "命令, 可选值:Record(手动录像),StopRecord(停止手动录像)", required = true)
... ... @@ -125,7 +127,7 @@ public class DeviceControl {
125 127 * @param deviceId 设备ID
126 128 * @param guardCmdStr SetGuard:布防,ResetGuard:撤防
127 129 */
128   - @Operation(summary = "布防/撤防命令")
  130 + @Operation(summary = "布防/撤防命令", security = @SecurityRequirement(name = JwtUtils.HEADER))
129 131 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
130 132 @Parameter(name = "guardCmdStr", description = "命令, 可选值:SetGuard(布防),ResetGuard(撤防)", required = true)
131 133 @GetMapping("/guard/{deviceId}/{guardCmdStr}")
... ... @@ -170,7 +172,7 @@ public class DeviceControl {
170 172 * @param alarmMethod 报警方式(可选)
171 173 * @param alarmType 报警类型(可选)
172 174 */
173   - @Operation(summary = "报警复位")
  175 + @Operation(summary = "报警复位", security = @SecurityRequirement(name = JwtUtils.HEADER))
174 176 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
175 177 @Parameter(name = "channelId", description = "通道国标编号", required = true)
176 178 @Parameter(name = "alarmMethod", description = "报警方式")
... ... @@ -217,7 +219,7 @@ public class DeviceControl {
217 219 * @param deviceId 设备ID
218 220 * @param channelId 通道ID
219 221 */
220   - @Operation(summary = "强制关键帧")
  222 + @Operation(summary = "强制关键帧", security = @SecurityRequirement(name = JwtUtils.HEADER))
221 223 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
222 224 @Parameter(name = "channelId", description = "通道国标编号")
223 225 @GetMapping("/i_frame/{deviceId}")
... ... @@ -249,7 +251,7 @@ public class DeviceControl {
249 251 * @param presetIndex 调用预置位编号(可选)
250 252 * @param channelId 通道编码(可选)
251 253 */
252   - @Operation(summary = "看守位控制")
  254 + @Operation(summary = "看守位控制", security = @SecurityRequirement(name = JwtUtils.HEADER))
253 255 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
254 256 @Parameter(name = "channelId", description = "通道国标编号", required = true)
255 257 @Parameter(name = "enabled", description = "是否开启看守位 1:开启,0:关闭", required = true)
... ... @@ -309,7 +311,7 @@ public class DeviceControl {
309 311 * @param lengthy 拉框宽度像素值
310 312 * @return
311 313 */
312   - @Operation(summary = "拉框放大")
  314 + @Operation(summary = "拉框放大", security = @SecurityRequirement(name = JwtUtils.HEADER))
313 315 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
314 316 @Parameter(name = "channelId", description = "通道国标编号", required = true)
315 317 @Parameter(name = "length", description = "播放窗口长度像素值", required = true)
... ... @@ -359,7 +361,7 @@ public class DeviceControl {
359 361 * @param lengthy 拉框宽度像素值
360 362 * @return
361 363 */
362   - @Operation(summary = "拉框放大")
  364 + @Operation(summary = "拉框缩小", security = @SecurityRequirement(name = JwtUtils.HEADER))
363 365 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
364 366 @Parameter(name = "channelId", description = "通道国标编号")
365 367 @Parameter(name = "length", description = "播放窗口长度像素值", required = true)
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java
... ... @@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.vmanager.gb28181.device;
3 3 import com.alibaba.fastjson2.JSONObject;
4 4 import com.genersoft.iot.vmp.conf.DynamicTask;
5 5 import com.genersoft.iot.vmp.conf.exception.ControllerException;
  6 +import com.genersoft.iot.vmp.conf.security.JwtUtils;
6 7 import com.genersoft.iot.vmp.gb28181.bean.Device;
7 8 import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
8 9 import com.genersoft.iot.vmp.gb28181.bean.SyncStatus;
... ... @@ -23,6 +24,7 @@ import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
23 24 import com.github.pagehelper.PageInfo;
24 25 import io.swagger.v3.oas.annotations.Operation;
25 26 import io.swagger.v3.oas.annotations.Parameter;
  27 +import io.swagger.v3.oas.annotations.security.SecurityRequirement;
26 28 import io.swagger.v3.oas.annotations.tags.Tag;
27 29 import org.apache.commons.compress.utils.IOUtils;
28 30 import org.apache.ibatis.annotations.Options;
... ... @@ -85,7 +87,7 @@ public class DeviceQuery {
85 87 * @param deviceId 国标ID
86 88 * @return 国标设备
87 89 */
88   - @Operation(summary = "查询国标设备")
  90 + @Operation(summary = "查询国标设备", security = @SecurityRequirement(name = JwtUtils.HEADER))
89 91 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
90 92 @GetMapping("/devices/{deviceId}")
91 93 public Device devices(@PathVariable String deviceId){
... ... @@ -99,7 +101,7 @@ public class DeviceQuery {
99 101 * @param count 每页查询数量
100 102 * @return 分页国标列表
101 103 */
102   - @Operation(summary = "分页查询国标设备")
  104 + @Operation(summary = "分页查询国标设备", security = @SecurityRequirement(name = JwtUtils.HEADER))
103 105 @Parameter(name = "page", description = "当前页", required = true)
104 106 @Parameter(name = "count", description = "每页查询数量", required = true)
105 107 @GetMapping("/devices")
... ... @@ -123,7 +125,7 @@ public class DeviceQuery {
123 125 * @return 通道列表
124 126 */
125 127 @GetMapping("/devices/{deviceId}/channels")
126   - @Operation(summary = "分页查询通道")
  128 + @Operation(summary = "分页查询通道", security = @SecurityRequirement(name = JwtUtils.HEADER))
127 129 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
128 130 @Parameter(name = "page", description = "当前页", required = true)
129 131 @Parameter(name = "count", description = "每页查询数量", required = true)
... ... @@ -149,7 +151,7 @@ public class DeviceQuery {
149 151 * @param deviceId 设备id
150 152 * @return
151 153 */
152   - @Operation(summary = "同步设备通道")
  154 + @Operation(summary = "同步设备通道", security = @SecurityRequirement(name = JwtUtils.HEADER))
153 155 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
154 156 @GetMapping("/devices/{deviceId}/sync")
155 157 public WVPResult<SyncStatus> devicesSync(@PathVariable String deviceId){
... ... @@ -177,7 +179,7 @@ public class DeviceQuery {
177 179 * @param deviceId 设备id
178 180 * @return
179 181 */
180   - @Operation(summary = "移除设备")
  182 + @Operation(summary = "移除设备", security = @SecurityRequirement(name = JwtUtils.HEADER))
181 183 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
182 184 @DeleteMapping("/devices/{deviceId}/delete")
183 185 public String delete(@PathVariable String deviceId){
... ... @@ -222,7 +224,7 @@ public class DeviceQuery {
222 224 * @param channelType 通道类型
223 225 * @return 子通道列表
224 226 */
225   - @Operation(summary = "分页查询子目录通道")
  227 + @Operation(summary = "分页查询子目录通道", security = @SecurityRequirement(name = JwtUtils.HEADER))
226 228 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
227 229 @Parameter(name = "channelId", description = "通道国标编号", required = true)
228 230 @Parameter(name = "page", description = "当前页", required = true)
... ... @@ -254,7 +256,7 @@ public class DeviceQuery {
254 256 * @param channel 通道
255 257 * @return
256 258 */
257   - @Operation(summary = "更新通道信息")
  259 + @Operation(summary = "更新通道信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
258 260 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
259 261 @Parameter(name = "channel", description = "通道信息", required = true)
260 262 @PostMapping("/channel/update/{deviceId}")
... ... @@ -268,7 +270,7 @@ public class DeviceQuery {
268 270 * @param streamMode 数据流传输模式
269 271 * @return
270 272 */
271   - @Operation(summary = "修改数据流传输模式")
  273 + @Operation(summary = "修改数据流传输模式", security = @SecurityRequirement(name = JwtUtils.HEADER))
272 274 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
273 275 @Parameter(name = "streamMode", description = "数据流传输模式, 取值:" +
274 276 "UDP(udp传输),TCP-ACTIVE(tcp主动模式,暂不支持),TCP-PASSIVE(tcp被动模式)", required = true)
... ... @@ -284,7 +286,7 @@ public class DeviceQuery {
284 286 * @param device 设备信息
285 287 * @return
286 288 */
287   - @Operation(summary = "添加设备信息")
  289 + @Operation(summary = "添加设备信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
288 290 @Parameter(name = "device", description = "设备", required = true)
289 291 @PostMapping("/device/add/")
290 292 public void addDevice(Device device){
... ... @@ -306,7 +308,7 @@ public class DeviceQuery {
306 308 * @param device 设备信息
307 309 * @return
308 310 */
309   - @Operation(summary = "更新设备信息")
  311 + @Operation(summary = "更新设备信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
310 312 @Parameter(name = "device", description = "设备", required = true)
311 313 @PostMapping("/device/update/")
312 314 public void updateDevice(Device device){
... ... @@ -321,7 +323,7 @@ public class DeviceQuery {
321 323 *
322 324 * @param deviceId 设备id
323 325 */
324   - @Operation(summary = "设备状态查询")
  326 + @Operation(summary = "设备状态查询", security = @SecurityRequirement(name = JwtUtils.HEADER))
325 327 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
326 328 @GetMapping("/devices/{deviceId}/status")
327 329 public DeferredResult<ResponseEntity<String>> deviceStatusApi(@PathVariable String deviceId) {
... ... @@ -372,7 +374,7 @@ public class DeviceQuery {
372 374 * @param endTime 报警发生终止时间(可选)
373 375 * @return true = 命令发送成功
374 376 */
375   - @Operation(summary = "设备状态查询")
  377 + @Operation(summary = "设备报警查询", security = @SecurityRequirement(name = JwtUtils.HEADER))
376 378 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
377 379 @Parameter(name = "startPriority", description = "报警起始级别")
378 380 @Parameter(name = "endPriority", description = "报警终止级别")
... ... @@ -422,7 +424,7 @@ public class DeviceQuery {
422 424  
423 425  
424 426 @GetMapping("/{deviceId}/sync_status")
425   - @Operation(summary = "获取通道同步进度")
  427 + @Operation(summary = "获取通道同步进度", security = @SecurityRequirement(name = JwtUtils.HEADER))
426 428 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
427 429 public WVPResult<SyncStatus> getSyncStatus(@PathVariable String deviceId) {
428 430 SyncStatus channelSyncStatus = deviceService.getChannelSyncStatus(deviceId);
... ... @@ -442,7 +444,7 @@ public class DeviceQuery {
442 444 }
443 445  
444 446 @GetMapping("/{deviceId}/subscribe_info")
445   - @Operation(summary = "获取设备的订阅状态")
  447 + @Operation(summary = "获取设备的订阅状态", security = @SecurityRequirement(name = JwtUtils.HEADER))
446 448 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
447 449 public WVPResult<Map<String, Integer>> getSubscribeInfo(@PathVariable String deviceId) {
448 450 Set<String> allKeys = dynamicTask.getAllKeys();
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/gbStream/GbStreamController.java
1 1 package com.genersoft.iot.vmp.vmanager.gb28181.gbStream;
2 2  
3 3 import com.genersoft.iot.vmp.conf.exception.ControllerException;
  4 +import com.genersoft.iot.vmp.conf.security.JwtUtils;
4 5 import com.genersoft.iot.vmp.gb28181.bean.GbStream;
5 6 import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
6 7 import com.genersoft.iot.vmp.service.IGbStreamService;
... ... @@ -11,6 +12,7 @@ import com.genersoft.iot.vmp.vmanager.gb28181.gbStream.bean.GbStreamParam;
11 12 import com.github.pagehelper.PageInfo;
12 13 import io.swagger.v3.oas.annotations.Operation;
13 14 import io.swagger.v3.oas.annotations.Parameter;
  15 +import io.swagger.v3.oas.annotations.security.SecurityRequirement;
14 16 import io.swagger.v3.oas.annotations.tags.Tag;
15 17 import org.slf4j.Logger;
16 18 import org.slf4j.LoggerFactory;
... ... @@ -43,7 +45,7 @@ public class GbStreamController {
43 45 * @param platformId 平台ID
44 46 * @return
45 47 */
46   - @Operation(summary = "查询国标通道")
  48 + @Operation(summary = "查询国标通道", security = @SecurityRequirement(name = JwtUtils.HEADER))
47 49 @Parameter(name = "page", description = "当前页", required = true)
48 50 @Parameter(name = "count", description = "每页条数", required = true)
49 51 @Parameter(name = "platformId", description = "平台ID", required = true)
... ... @@ -79,7 +81,7 @@ public class GbStreamController {
79 81 * @param gbStreamParam
80 82 * @return
81 83 */
82   - @Operation(summary = "移除国标关联")
  84 + @Operation(summary = "移除国标关联", security = @SecurityRequirement(name = JwtUtils.HEADER))
83 85 @DeleteMapping(value = "/del")
84 86 @ResponseBody
85 87 public void del(@RequestBody GbStreamParam gbStreamParam){
... ... @@ -99,7 +101,7 @@ public class GbStreamController {
99 101 * @param gbStreamParam
100 102 * @return
101 103 */
102   - @Operation(summary = "保存国标关联")
  104 + @Operation(summary = "保存国标关联", security = @SecurityRequirement(name = JwtUtils.HEADER))
103 105 @PostMapping(value = "/add")
104 106 @ResponseBody
105 107 public void add(@RequestBody GbStreamParam gbStreamParam){
... ... @@ -118,7 +120,7 @@ public class GbStreamController {
118 120 * @param gbId
119 121 * @return
120 122 */
121   - @Operation(summary = "保存国标关联")
  123 + @Operation(summary = "保存国标关联", security = @SecurityRequirement(name = JwtUtils.HEADER))
122 124 @GetMapping(value = "/addWithGbid")
123 125 @ResponseBody
124 126 public void add(String gbId, String platformGbId, @RequestParam(required = false) String catalogGbId){
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/media/MediaController.java
... ... @@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.vmanager.gb28181.media;
2 2  
3 3 import com.genersoft.iot.vmp.common.StreamInfo;
4 4 import com.genersoft.iot.vmp.conf.exception.ControllerException;
  5 +import com.genersoft.iot.vmp.conf.security.JwtUtils;
5 6 import com.genersoft.iot.vmp.conf.security.SecurityUtils;
6 7 import com.genersoft.iot.vmp.conf.security.dto.LoginUser;
7 8 import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo;
... ... @@ -12,6 +13,7 @@ import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
12 13 import com.genersoft.iot.vmp.vmanager.bean.StreamContent;
13 14 import io.swagger.v3.oas.annotations.Operation;
14 15 import io.swagger.v3.oas.annotations.Parameter;
  16 +import io.swagger.v3.oas.annotations.security.SecurityRequirement;
15 17 import io.swagger.v3.oas.annotations.tags.Tag;
16 18 import org.slf4j.Logger;
17 19 import org.slf4j.LoggerFactory;
... ... @@ -45,7 +47,7 @@ public class MediaController {
45 47 * @param stream 流id
46 48 * @return
47 49 */
48   - @Operation(summary = "根据应用名和流id获取播放地址")
  50 + @Operation(summary = "根据应用名和流id获取播放地址", security = @SecurityRequirement(name = JwtUtils.HEADER))
49 51 @Parameter(name = "app", description = "应用名", required = true)
50 52 @Parameter(name = "stream", description = "流id", required = true)
51 53 @Parameter(name = "mediaServerId", description = "媒体服务器id")
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java
... ... @@ -6,6 +6,7 @@ import com.genersoft.iot.vmp.common.VideoManagerConstants;
6 6 import com.genersoft.iot.vmp.conf.DynamicTask;
7 7 import com.genersoft.iot.vmp.conf.UserSetting;
8 8 import com.genersoft.iot.vmp.conf.exception.ControllerException;
  9 +import com.genersoft.iot.vmp.conf.security.JwtUtils;
9 10 import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
10 11 import com.genersoft.iot.vmp.gb28181.bean.ParentPlatformCatch;
11 12 import com.genersoft.iot.vmp.gb28181.bean.PlatformCatalog;
... ... @@ -21,6 +22,7 @@ import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.UpdateChannelParam;
21 22 import com.github.pagehelper.PageInfo;
22 23 import io.swagger.v3.oas.annotations.Operation;
23 24 import io.swagger.v3.oas.annotations.Parameter;
  25 +import io.swagger.v3.oas.annotations.security.SecurityRequirement;
24 26 import io.swagger.v3.oas.annotations.tags.Tag;
25 27 import org.slf4j.Logger;
26 28 import org.slf4j.LoggerFactory;
... ... @@ -83,7 +85,7 @@ public class PlatformController {
83 85 *
84 86 * @return
85 87 */
86   - @Operation(summary = "获取国标服务的配置")
  88 + @Operation(summary = "获取国标服务的配置", security = @SecurityRequirement(name = JwtUtils.HEADER))
87 89 @GetMapping("/server_config")
88 90 public JSONObject serverConfig() {
89 91 JSONObject result = new JSONObject();
... ... @@ -99,7 +101,7 @@ public class PlatformController {
99 101 *
100 102 * @return
101 103 */
102   - @Operation(summary = "获取级联服务器信息")
  104 + @Operation(summary = "获取级联服务器信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
103 105 @Parameter(name = "id", description = "平台国标编号", required = true)
104 106 @GetMapping("/info/{id}")
105 107 public ParentPlatform getPlatform(@PathVariable String id) {
... ... @@ -119,7 +121,7 @@ public class PlatformController {
119 121 * @return
120 122 */
121 123 @GetMapping("/query/{count}/{page}")
122   - @Operation(summary = "分页查询级联平台")
  124 + @Operation(summary = "分页查询级联平台", security = @SecurityRequirement(name = JwtUtils.HEADER))
123 125 @Parameter(name = "page", description = "当前页", required = true)
124 126 @Parameter(name = "count", description = "每页条数", required = true)
125 127 public PageInfo<ParentPlatform> platforms(@PathVariable int page, @PathVariable int count) {
... ... @@ -140,7 +142,7 @@ public class PlatformController {
140 142 * @param parentPlatform
141 143 * @return
142 144 */
143   - @Operation(summary = "添加上级平台信息")
  145 + @Operation(summary = "添加上级平台信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
144 146 @PostMapping("/add")
145 147 @ResponseBody
146 148 public void addPlatform(@RequestBody ParentPlatform parentPlatform) {
... ... @@ -185,7 +187,7 @@ public class PlatformController {
185 187 * @param parentPlatform
186 188 * @return
187 189 */
188   - @Operation(summary = "保存上级平台信息")
  190 + @Operation(summary = "保存上级平台信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
189 191 @PostMapping("/save")
190 192 @ResponseBody
191 193 public void savePlatform(@RequestBody ParentPlatform parentPlatform) {
... ... @@ -216,7 +218,7 @@ public class PlatformController {
216 218 * @param serverGBId 上级平台国标ID
217 219 * @return
218 220 */
219   - @Operation(summary = "删除上级平台")
  221 + @Operation(summary = "删除上级平台", security = @SecurityRequirement(name = JwtUtils.HEADER))
220 222 @Parameter(name = "serverGBId", description = "上级平台的国标编号")
221 223 @DeleteMapping("/delete/{serverGBId}")
222 224 @ResponseBody
... ... @@ -273,7 +275,7 @@ public class PlatformController {
273 275 * @param serverGBId 上级平台国标ID
274 276 * @return
275 277 */
276   - @Operation(summary = "查询上级平台是否存在")
  278 + @Operation(summary = "查询上级平台是否存在", security = @SecurityRequirement(name = JwtUtils.HEADER))
277 279 @Parameter(name = "serverGBId", description = "上级平台的国标编号")
278 280 @GetMapping("/exit/{serverGBId}")
279 281 @ResponseBody
... ... @@ -294,7 +296,7 @@ public class PlatformController {
294 296 * @param channelType 通道类型
295 297 * @return
296 298 */
297   - @Operation(summary = "查询上级平台是否存在")
  299 + @Operation(summary = "查询上级平台是否存在", security = @SecurityRequirement(name = JwtUtils.HEADER))
298 300 @Parameter(name = "page", description = "当前页", required = true)
299 301 @Parameter(name = "count", description = "每页条数", required = true)
300 302 @Parameter(name = "platformId", description = "上级平台的国标编号")
... ... @@ -331,7 +333,7 @@ public class PlatformController {
331 333 * @param param 通道关联参数
332 334 * @return
333 335 */
334   - @Operation(summary = "向上级平台添加国标通道")
  336 + @Operation(summary = "向上级平台添加国标通道", security = @SecurityRequirement(name = JwtUtils.HEADER))
335 337 @PostMapping("/update_channel_for_gb")
336 338 @ResponseBody
337 339 public void updateChannelForGB(@RequestBody UpdateChannelParam param) {
... ... @@ -360,7 +362,7 @@ public class PlatformController {
360 362 * @param param 通道关联参数
361 363 * @return
362 364 */
363   - @Operation(summary = "从上级平台移除国标通道")
  365 + @Operation(summary = "从上级平台移除国标通道", security = @SecurityRequirement(name = JwtUtils.HEADER))
364 366 @DeleteMapping("/del_channel_for_gb")
365 367 @ResponseBody
366 368 public void delChannelForGB(@RequestBody UpdateChannelParam param) {
... ... @@ -389,7 +391,7 @@ public class PlatformController {
389 391 * @param parentId 目录父ID
390 392 * @return
391 393 */
392   - @Operation(summary = "获取目录")
  394 + @Operation(summary = "获取目录", security = @SecurityRequirement(name = JwtUtils.HEADER))
393 395 @Parameter(name = "platformId", description = "上级平台的国标编号", required = true)
394 396 @Parameter(name = "parentId", description = "父级目录的国标编号", required = true)
395 397 @GetMapping("/catalog")
... ... @@ -420,7 +422,7 @@ public class PlatformController {
420 422 * @param platformCatalog 目录
421 423 * @return
422 424 */
423   - @Operation(summary = "添加目录")
  425 + @Operation(summary = "添加目录", security = @SecurityRequirement(name = JwtUtils.HEADER))
424 426 @PostMapping("/catalog/add")
425 427 @ResponseBody
426 428 public void addCatalog(@RequestBody PlatformCatalog platformCatalog) {
... ... @@ -445,7 +447,7 @@ public class PlatformController {
445 447 * @param platformCatalog 目录
446 448 * @return
447 449 */
448   - @Operation(summary = "编辑目录")
  450 + @Operation(summary = "编辑目录", security = @SecurityRequirement(name = JwtUtils.HEADER))
449 451 @PostMapping("/catalog/edit")
450 452 @ResponseBody
451 453 public void editCatalog(@RequestBody PlatformCatalog platformCatalog) {
... ... @@ -471,7 +473,7 @@ public class PlatformController {
471 473 * @param platformId 平台Id
472 474 * @return
473 475 */
474   - @Operation(summary = "删除目录")
  476 + @Operation(summary = "删除目录", security = @SecurityRequirement(name = JwtUtils.HEADER))
475 477 @Parameter(name = "id", description = "目录Id", required = true)
476 478 @Parameter(name = "platformId", description = "平台Id", required = true)
477 479 @DeleteMapping("/catalog/del")
... ... @@ -506,7 +508,7 @@ public class PlatformController {
506 508 * @param platformCatalog 关联的信息
507 509 * @return
508 510 */
509   - @Operation(summary = "删除关联")
  511 + @Operation(summary = "删除关联", security = @SecurityRequirement(name = JwtUtils.HEADER))
510 512 @DeleteMapping("/catalog/relation/del")
511 513 @ResponseBody
512 514 public void delRelation(@RequestBody PlatformCatalog platformCatalog) {
... ... @@ -529,7 +531,7 @@ public class PlatformController {
529 531 * @param catalogId 目录Id
530 532 * @return
531 533 */
532   - @Operation(summary = "修改默认目录")
  534 + @Operation(summary = "修改默认目录", security = @SecurityRequirement(name = JwtUtils.HEADER))
533 535 @Parameter(name = "catalogId", description = "目录Id", required = true)
534 536 @Parameter(name = "platformId", description = "平台Id", required = true)
535 537 @PostMapping("/catalog/default/update")
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java
... ... @@ -9,6 +9,7 @@ import com.genersoft.iot.vmp.common.StreamInfo;
9 9 import com.genersoft.iot.vmp.conf.UserSetting;
10 10 import com.genersoft.iot.vmp.conf.exception.ControllerException;
11 11 import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException;
  12 +import com.genersoft.iot.vmp.conf.security.JwtUtils;
12 13 import com.genersoft.iot.vmp.gb28181.bean.Device;
13 14 import com.genersoft.iot.vmp.gb28181.bean.SsrcTransaction;
14 15 import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager;
... ... @@ -30,6 +31,7 @@ import com.genersoft.iot.vmp.vmanager.bean.StreamContent;
30 31 import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
31 32 import io.swagger.v3.oas.annotations.Operation;
32 33 import io.swagger.v3.oas.annotations.Parameter;
  34 +import io.swagger.v3.oas.annotations.security.SecurityRequirement;
33 35 import io.swagger.v3.oas.annotations.tags.Tag;
34 36 import org.slf4j.Logger;
35 37 import org.slf4j.LoggerFactory;
... ... @@ -87,7 +89,7 @@ public class PlayController {
87 89 @Autowired
88 90 private UserSetting userSetting;
89 91  
90   - @Operation(summary = "开始点播")
  92 + @Operation(summary = "开始点播", security = @SecurityRequirement(name = JwtUtils.HEADER))
91 93 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
92 94 @Parameter(name = "channelId", description = "通道国标编号", required = true)
93 95 @GetMapping("/start/{deviceId}/{channelId}")
... ... @@ -152,7 +154,7 @@ public class PlayController {
152 154 return result;
153 155 }
154 156  
155   - @Operation(summary = "停止点播")
  157 + @Operation(summary = "停止点播", security = @SecurityRequirement(name = JwtUtils.HEADER))
156 158 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
157 159 @Parameter(name = "channelId", description = "通道国标编号", required = true)
158 160 @Parameter(name = "isSubStream", description = "是否子码流(true-子码流,false-主码流),默认为false", required = true)
... ... @@ -197,7 +199,7 @@ public class PlayController {
197 199 * 将不是h264的视频通过ffmpeg 转码为h264 + aac
198 200 * @param streamId 流ID
199 201 */
200   - @Operation(summary = "将不是h264的视频通过ffmpeg 转码为h264 + aac")
  202 + @Operation(summary = "将不是h264的视频通过ffmpeg 转码为h264 + aac", security = @SecurityRequirement(name = JwtUtils.HEADER))
201 203 @Parameter(name = "streamId", description = "视频流ID", required = true)
202 204 @PostMapping("/convert/{streamId}")
203 205 public JSONObject playConvert(@PathVariable String streamId) {
... ... @@ -239,7 +241,7 @@ public class PlayController {
239 241 /**
240 242 * 结束转码
241 243 */
242   - @Operation(summary = "结束转码")
  244 + @Operation(summary = "结束转码", security = @SecurityRequirement(name = JwtUtils.HEADER))
243 245 @Parameter(name = "key", description = "视频流key", required = true)
244 246 @Parameter(name = "mediaServerId", description = "流媒体服务ID", required = true)
245 247 @PostMapping("/convertStop/{key}")
... ... @@ -264,7 +266,7 @@ public class PlayController {
264 266 }
265 267 }
266 268  
267   - @Operation(summary = "语音广播命令")
  269 + @Operation(summary = "语音广播命令", security = @SecurityRequirement(name = JwtUtils.HEADER))
268 270 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
269 271 @GetMapping("/broadcast/{deviceId}")
270 272 @PostMapping("/broadcast/{deviceId}")
... ... @@ -330,7 +332,7 @@ public class PlayController {
330 332 return result;
331 333 }
332 334  
333   - @Operation(summary = "获取所有的ssrc")
  335 + @Operation(summary = "获取所有的ssrc", security = @SecurityRequirement(name = JwtUtils.HEADER))
334 336 @GetMapping("/ssrc")
335 337 public JSONObject getSSRC() {
336 338 if (logger.isDebugEnabled()) {
... ... @@ -353,7 +355,7 @@ public class PlayController {
353 355 return jsonObject;
354 356 }
355 357  
356   - @Operation(summary = "获取截图")
  358 + @Operation(summary = "获取截图", security = @SecurityRequirement(name = JwtUtils.HEADER))
357 359 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
358 360 @Parameter(name = "channelId", description = "通道国标编号", required = true)
359 361 @Parameter(name = "isSubStream", description = "是否子码流(true-子码流,false-主码流),默认为false", required = true)
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java
... ... @@ -7,6 +7,7 @@ import com.genersoft.iot.vmp.conf.UserSetting;
7 7 import com.genersoft.iot.vmp.conf.exception.ControllerException;
8 8 import com.genersoft.iot.vmp.conf.exception.ServiceException;
9 9 import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException;
  10 +import com.genersoft.iot.vmp.conf.security.JwtUtils;
10 11 import com.genersoft.iot.vmp.gb28181.bean.Device;
11 12 import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
12 13 import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
... ... @@ -20,6 +21,7 @@ import com.genersoft.iot.vmp.vmanager.bean.StreamContent;
20 21 import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
21 22 import io.swagger.v3.oas.annotations.Operation;
22 23 import io.swagger.v3.oas.annotations.Parameter;
  24 +import io.swagger.v3.oas.annotations.security.SecurityRequirement;
23 25 import io.swagger.v3.oas.annotations.tags.Tag;
24 26 import org.slf4j.Logger;
25 27 import org.slf4j.LoggerFactory;
... ... @@ -68,7 +70,7 @@ public class PlaybackController {
68 70 @Autowired
69 71 private UserSetting userSetting;
70 72  
71   - @Operation(summary = "开始视频回放")
  73 + @Operation(summary = "开始视频回放", security = @SecurityRequirement(name = JwtUtils.HEADER))
72 74 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
73 75 @Parameter(name = "channelId", description = "通道国标编号", required = true)
74 76 @Parameter(name = "startTime", description = "开始时间", required = true)
... ... @@ -125,7 +127,7 @@ public class PlaybackController {
125 127 }
126 128  
127 129  
128   - @Operation(summary = "停止视频回放")
  130 + @Operation(summary = "停止视频回放", security = @SecurityRequirement(name = JwtUtils.HEADER))
129 131 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
130 132 @Parameter(name = "channelId", description = "通道国标编号", required = true)
131 133 @Parameter(name = "stream", description = "流ID", required = true)
... ... @@ -149,7 +151,7 @@ public class PlaybackController {
149 151 }
150 152  
151 153  
152   - @Operation(summary = "回放暂停")
  154 + @Operation(summary = "回放暂停", security = @SecurityRequirement(name = JwtUtils.HEADER))
153 155 @Parameter(name = "streamId", description = "回放流ID", required = true)
154 156 @GetMapping("/pause/{streamId}")
155 157 public void playPause(@PathVariable String streamId) {
... ... @@ -165,7 +167,7 @@ public class PlaybackController {
165 167 }
166 168  
167 169  
168   - @Operation(summary = "回放恢复")
  170 + @Operation(summary = "回放恢复", security = @SecurityRequirement(name = JwtUtils.HEADER))
169 171 @Parameter(name = "streamId", description = "回放流ID", required = true)
170 172 @GetMapping("/resume/{streamId}")
171 173 public void playResume(@PathVariable String streamId) {
... ... @@ -180,7 +182,7 @@ public class PlaybackController {
180 182 }
181 183  
182 184  
183   - @Operation(summary = "回放拖动播放")
  185 + @Operation(summary = "回放拖动播放", security = @SecurityRequirement(name = JwtUtils.HEADER))
184 186 @Parameter(name = "streamId", description = "回放流ID", required = true)
185 187 @Parameter(name = "seekTime", description = "拖动偏移量,单位s", required = true)
186 188 @GetMapping("/seek/{streamId}/{seekTime}")
... ... @@ -200,7 +202,7 @@ public class PlaybackController {
200 202 }
201 203 }
202 204  
203   - @Operation(summary = "回放倍速播放")
  205 + @Operation(summary = "回放倍速播放", security = @SecurityRequirement(name = JwtUtils.HEADER))
204 206 @Parameter(name = "streamId", description = "回放流ID", required = true)
205 207 @Parameter(name = "speed", description = "倍速0.25 0.5 1、2、4", required = true)
206 208 @GetMapping("/speed/{streamId}/{speed}")
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/ptz/PtzController.java
... ... @@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.vmanager.gb28181.ptz;
2 2  
3 3  
4 4 import com.genersoft.iot.vmp.conf.exception.ControllerException;
  5 +import com.genersoft.iot.vmp.conf.security.JwtUtils;
5 6 import com.genersoft.iot.vmp.gb28181.bean.Device;
6 7 import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
7 8 import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
... ... @@ -10,6 +11,7 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
10 11 import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
11 12 import io.swagger.v3.oas.annotations.Operation;
12 13 import io.swagger.v3.oas.annotations.Parameter;
  14 +import io.swagger.v3.oas.annotations.security.SecurityRequirement;
13 15 import io.swagger.v3.oas.annotations.tags.Tag;
14 16 import org.slf4j.Logger;
15 17 import org.slf4j.LoggerFactory;
... ... @@ -50,7 +52,7 @@ public class PtzController {
50 52 * @param zoomSpeed 缩放速度
51 53 */
52 54  
53   - @Operation(summary = "云台控制")
  55 + @Operation(summary = "云台控制", security = @SecurityRequirement(name = JwtUtils.HEADER))
54 56 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
55 57 @Parameter(name = "channelId", description = "通道国标编号", required = true)
56 58 @Parameter(name = "command", description = "控制指令,允许值: left, right, up, down, upleft, upright, downleft, downright, zoomin, zoomout, stop", required = true)
... ... @@ -113,7 +115,7 @@ public class PtzController {
113 115 }
114 116  
115 117  
116   - @Operation(summary = "通用前端控制命令")
  118 + @Operation(summary = "通用前端控制命令", security = @SecurityRequirement(name = JwtUtils.HEADER))
117 119 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
118 120 @Parameter(name = "channelId", description = "通道国标编号", required = true)
119 121 @Parameter(name = "cmdCode", description = "指令码", required = true)
... ... @@ -137,7 +139,7 @@ public class PtzController {
137 139 }
138 140  
139 141  
140   - @Operation(summary = "预置位查询")
  142 + @Operation(summary = "预置位查询", security = @SecurityRequirement(name = JwtUtils.HEADER))
141 143 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
142 144 @Parameter(name = "channelId", description = "通道国标编号", required = true)
143 145 @GetMapping("/preset/query/{deviceId}/{channelId}")
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/record/GBRecordController.java
... ... @@ -6,6 +6,7 @@ import com.genersoft.iot.vmp.common.StreamInfo;
6 6 import com.genersoft.iot.vmp.conf.UserSetting;
7 7 import com.genersoft.iot.vmp.conf.exception.ControllerException;
8 8 import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException;
  9 +import com.genersoft.iot.vmp.conf.security.JwtUtils;
9 10 import com.genersoft.iot.vmp.gb28181.bean.Device;
10 11 import com.genersoft.iot.vmp.gb28181.bean.RecordInfo;
11 12 import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
... ... @@ -23,6 +24,7 @@ import com.genersoft.iot.vmp.vmanager.bean.StreamContent;
23 24 import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
24 25 import io.swagger.v3.oas.annotations.Operation;
25 26 import io.swagger.v3.oas.annotations.Parameter;
  27 +import io.swagger.v3.oas.annotations.security.SecurityRequirement;
26 28 import io.swagger.v3.oas.annotations.tags.Tag;
27 29 import org.slf4j.Logger;
28 30 import org.slf4j.LoggerFactory;
... ... @@ -69,7 +71,7 @@ public class GBRecordController {
69 71 @Autowired
70 72 private UserSetting userSetting;
71 73  
72   - @Operation(summary = "录像查询")
  74 + @Operation(summary = "录像查询", security = @SecurityRequirement(name = JwtUtils.HEADER))
73 75 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
74 76 @Parameter(name = "channelId", description = "通道国标编号", required = true)
75 77 @Parameter(name = "startTime", description = "开始时间", required = true)
... ... @@ -123,7 +125,7 @@ public class GBRecordController {
123 125 }
124 126  
125 127  
126   - @Operation(summary = "开始历史媒体下载")
  128 + @Operation(summary = "开始历史媒体下载", security = @SecurityRequirement(name = JwtUtils.HEADER))
127 129 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
128 130 @Parameter(name = "channelId", description = "通道国标编号", required = true)
129 131 @Parameter(name = "startTime", description = "开始时间", required = true)
... ... @@ -172,7 +174,7 @@ public class GBRecordController {
172 174 return result;
173 175 }
174 176  
175   - @Operation(summary = "停止历史媒体下载")
  177 + @Operation(summary = "停止历史媒体下载", security = @SecurityRequirement(name = JwtUtils.HEADER))
176 178 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
177 179 @Parameter(name = "channelId", description = "通道国标编号", required = true)
178 180 @Parameter(name = "stream", description = "流ID", required = true)
... ... @@ -200,7 +202,7 @@ public class GBRecordController {
200 202 }
201 203 }
202 204  
203   - @Operation(summary = "获取历史媒体下载进度")
  205 + @Operation(summary = "获取历史媒体下载进度", security = @SecurityRequirement(name = JwtUtils.HEADER))
204 206 @Parameter(name = "deviceId", description = "设备国标编号", required = true)
205 207 @Parameter(name = "channelId", description = "通道国标编号", required = true)
206 208 @Parameter(name = "stream", description = "流ID", required = true)
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/log/LogController.java
... ... @@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.vmanager.log;
2 2  
3 3 import com.genersoft.iot.vmp.conf.UserSetting;
4 4 import com.genersoft.iot.vmp.conf.exception.ControllerException;
  5 +import com.genersoft.iot.vmp.conf.security.JwtUtils;
5 6 import com.genersoft.iot.vmp.service.ILogService;
6 7 import com.genersoft.iot.vmp.storager.dao.dto.LogDto;
7 8 import com.genersoft.iot.vmp.utils.DateUtil;
... ... @@ -9,6 +10,7 @@ import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
9 10 import com.github.pagehelper.PageInfo;
10 11 import io.swagger.v3.oas.annotations.Operation;
11 12 import io.swagger.v3.oas.annotations.Parameter;
  13 +import io.swagger.v3.oas.annotations.security.SecurityRequirement;
12 14 import io.swagger.v3.oas.annotations.tags.Tag;
13 15 import org.slf4j.Logger;
14 16 import org.slf4j.LoggerFactory;
... ... @@ -42,7 +44,7 @@ public class LogController {
42 44 * @return
43 45 */
44 46 @GetMapping("/all")
45   - @Operation(summary = "分页查询日志")
  47 + @Operation(summary = "分页查询日志", security = @SecurityRequirement(name = JwtUtils.HEADER))
46 48 @Parameter(name = "query", description = "查询内容", required = true)
47 49 @Parameter(name = "page", description = "当前页", required = true)
48 50 @Parameter(name = "count", description = "每页查询数量", required = true)
... ... @@ -84,7 +86,7 @@ public class LogController {
84 86 * 清空日志
85 87 *
86 88 */
87   - @Operation(summary = "清空日志")
  89 + @Operation(summary = "清空日志", security = @SecurityRequirement(name = JwtUtils.HEADER))
88 90 @DeleteMapping("/clear")
89 91 public void clear() {
90 92 logService.clear();
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/ps/PsController.java
... ... @@ -5,6 +5,7 @@ import com.genersoft.iot.vmp.common.VideoManagerConstants;
5 5 import com.genersoft.iot.vmp.conf.DynamicTask;
6 6 import com.genersoft.iot.vmp.conf.UserSetting;
7 7 import com.genersoft.iot.vmp.conf.exception.ControllerException;
  8 +import com.genersoft.iot.vmp.conf.security.JwtUtils;
8 9 import com.genersoft.iot.vmp.media.zlm.SendRtpPortManager;
9 10 import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
10 11 import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe;
... ... @@ -19,6 +20,7 @@ import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
19 20 import com.genersoft.iot.vmp.vmanager.bean.OtherPsSendInfo;
20 21 import io.swagger.v3.oas.annotations.Operation;
21 22 import io.swagger.v3.oas.annotations.Parameter;
  23 +import io.swagger.v3.oas.annotations.security.SecurityRequirement;
22 24 import io.swagger.v3.oas.annotations.tags.Tag;
23 25 import okhttp3.OkHttpClient;
24 26 import okhttp3.Request;
... ... @@ -69,7 +71,7 @@ public class PsController {
69 71  
70 72 @GetMapping(value = "/receive/open")
71 73 @ResponseBody
72   - @Operation(summary = "开启收流和获取发流信息")
  74 + @Operation(summary = "开启收流和获取发流信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
73 75 @Parameter(name = "isSend", description = "是否发送,false时只开启收流, true同时返回推流信息", required = true)
74 76 @Parameter(name = "callId", description = "整个过程的唯一标识,为了与后续接口关联", required = true)
75 77 @Parameter(name = "ssrc", description = "来源流的SSRC,不传则不校验来源ssrc", required = false)
... ... @@ -152,7 +154,7 @@ public class PsController {
152 154  
153 155 @GetMapping(value = "/receive/close")
154 156 @ResponseBody
155   - @Operation(summary = "关闭收流")
  157 + @Operation(summary = "关闭收流", security = @SecurityRequirement(name = JwtUtils.HEADER))
156 158 @Parameter(name = "stream", description = "流的ID", required = true)
157 159 public void closeRtpServer(String stream) {
158 160 logger.info("[第三方PS服务对接->关闭收流] stream->{}", stream);
... ... @@ -170,7 +172,7 @@ public class PsController {
170 172  
171 173 @GetMapping(value = "/send/start")
172 174 @ResponseBody
173   - @Operation(summary = "发送流")
  175 + @Operation(summary = "发送流", security = @SecurityRequirement(name = JwtUtils.HEADER))
174 176 @Parameter(name = "ssrc", description = "发送流的SSRC", required = true)
175 177 @Parameter(name = "dstIp", description = "目标收流IP", required = true)
176 178 @Parameter(name = "dstPort", description = "目标收流端口", required = true)
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/rtp/RtpController.java
... ... @@ -5,6 +5,7 @@ import com.genersoft.iot.vmp.common.VideoManagerConstants;
5 5 import com.genersoft.iot.vmp.conf.DynamicTask;
6 6 import com.genersoft.iot.vmp.conf.UserSetting;
7 7 import com.genersoft.iot.vmp.conf.exception.ControllerException;
  8 +import com.genersoft.iot.vmp.conf.security.JwtUtils;
8 9 import com.genersoft.iot.vmp.media.zlm.SendRtpPortManager;
9 10 import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
10 11 import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe;
... ... @@ -19,6 +20,7 @@ import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
19 20 import com.genersoft.iot.vmp.vmanager.bean.OtherRtpSendInfo;
20 21 import io.swagger.v3.oas.annotations.Operation;
21 22 import io.swagger.v3.oas.annotations.Parameter;
  23 +import io.swagger.v3.oas.annotations.security.SecurityRequirement;
22 24 import io.swagger.v3.oas.annotations.tags.Tag;
23 25 import okhttp3.OkHttpClient;
24 26 import okhttp3.Request;
... ... @@ -69,7 +71,7 @@ public class RtpController {
69 71  
70 72 @GetMapping(value = "/receive/open")
71 73 @ResponseBody
72   - @Operation(summary = "开启收流和获取发流信息")
  74 + @Operation(summary = "开启收流和获取发流信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
73 75 @Parameter(name = "isSend", description = "是否发送,false时只开启收流, true同时返回推流信息", required = true)
74 76 @Parameter(name = "callId", description = "整个过程的唯一标识,为了与后续接口关联", required = true)
75 77 @Parameter(name = "ssrc", description = "来源流的SSRC,不传则不校验来源ssrc", required = false)
... ... @@ -156,7 +158,7 @@ public class RtpController {
156 158  
157 159 @GetMapping(value = "/receive/close")
158 160 @ResponseBody
159   - @Operation(summary = "关闭收流")
  161 + @Operation(summary = "关闭收流", security = @SecurityRequirement(name = JwtUtils.HEADER))
160 162 @Parameter(name = "stream", description = "流的ID", required = true)
161 163 public void closeRtpServer(String stream) {
162 164 logger.info("[第三方服务对接->关闭收流] stream->{}", stream);
... ... @@ -175,7 +177,7 @@ public class RtpController {
175 177  
176 178 @GetMapping(value = "/send/start")
177 179 @ResponseBody
178   - @Operation(summary = "发送流")
  180 + @Operation(summary = "发送流", security = @SecurityRequirement(name = JwtUtils.HEADER))
179 181 @Parameter(name = "ssrc", description = "发送流的SSRC", required = true)
180 182 @Parameter(name = "dstIpForAudio", description = "目标音频收流IP", required = false)
181 183 @Parameter(name = "dstIpForVideo", description = "目标视频收流IP", required = false)
... ... @@ -351,7 +353,7 @@ public class RtpController {
351 353  
352 354 @GetMapping(value = "/send/stop")
353 355 @ResponseBody
354   - @Operation(summary = "关闭发送流")
  356 + @Operation(summary = "关闭发送流", security = @SecurityRequirement(name = JwtUtils.HEADER))
355 357 @Parameter(name = "callId", description = "整个过程的唯一标识,不传则使用随机端口发流", required = true)
356 358 public void closeSendRTP(String callId) {
357 359 logger.info("[第三方服务对接->关闭发送流] callId->{}", callId);
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java
... ... @@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.conf.SipConfig;
8 8 import com.genersoft.iot.vmp.conf.UserSetting;
9 9 import com.genersoft.iot.vmp.conf.VersionInfo;
10 10 import com.genersoft.iot.vmp.conf.exception.ControllerException;
  11 +import com.genersoft.iot.vmp.conf.security.JwtUtils;
11 12 import com.genersoft.iot.vmp.media.zlm.SendRtpPortManager;
12 13 import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe;
13 14 import com.genersoft.iot.vmp.media.zlm.dto.IHookSubscribe;
... ... @@ -21,6 +22,7 @@ import com.genersoft.iot.vmp.vmanager.bean.ResourceInfo;
21 22 import com.genersoft.iot.vmp.vmanager.bean.SystemConfigInfo;
22 23 import io.swagger.v3.oas.annotations.Operation;
23 24 import io.swagger.v3.oas.annotations.Parameter;
  25 +import io.swagger.v3.oas.annotations.security.SecurityRequirement;
24 26 import io.swagger.v3.oas.annotations.tags.Tag;
25 27 import org.springframework.beans.factory.annotation.Autowired;
26 28 import org.springframework.beans.factory.annotation.Value;
... ... @@ -79,27 +81,27 @@ public class ServerController {
79 81  
80 82 @GetMapping(value = "/media_server/list")
81 83 @ResponseBody
82   - @Operation(summary = "流媒体服务列表")
  84 + @Operation(summary = "流媒体服务列表", security = @SecurityRequirement(name = JwtUtils.HEADER))
83 85 public List<MediaServerItem> getMediaServerList() {
84 86 return mediaServerService.getAll();
85 87 }
86 88  
87 89 @GetMapping(value = "/media_server/online/list")
88 90 @ResponseBody
89   - @Operation(summary = "在线流媒体服务列表")
  91 + @Operation(summary = "在线流媒体服务列表", security = @SecurityRequirement(name = JwtUtils.HEADER))
90 92 public List<MediaServerItem> getOnlineMediaServerList() {
91 93 return mediaServerService.getAllOnline();
92 94 }
93 95  
94 96 @GetMapping(value = "/media_server/one/{id}")
95 97 @ResponseBody
96   - @Operation(summary = "停止视频回放")
  98 + @Operation(summary = "停止视频回放", security = @SecurityRequirement(name = JwtUtils.HEADER))
97 99 @Parameter(name = "id", description = "流媒体服务ID", required = true)
98 100 public MediaServerItem getMediaServer(@PathVariable String id) {
99 101 return mediaServerService.getOne(id);
100 102 }
101 103  
102   - @Operation(summary = "测试流媒体服务")
  104 + @Operation(summary = "测试流媒体服务", security = @SecurityRequirement(name = JwtUtils.HEADER))
103 105 @Parameter(name = "ip", description = "流媒体服务IP", required = true)
104 106 @Parameter(name = "port", description = "流媒体服务HTT端口", required = true)
105 107 @Parameter(name = "secret", description = "流媒体服务secret", required = true)
... ... @@ -109,7 +111,7 @@ public class ServerController {
109 111 return mediaServerService.checkMediaServer(ip, port, secret);
110 112 }
111 113  
112   - @Operation(summary = "测试流媒体录像管理服务")
  114 + @Operation(summary = "测试流媒体录像管理服务", security = @SecurityRequirement(name = JwtUtils.HEADER))
113 115 @Parameter(name = "ip", description = "流媒体服务IP", required = true)
114 116 @Parameter(name = "port", description = "流媒体服务HTT端口", required = true)
115 117 @GetMapping(value = "/media_server/record/check")
... ... @@ -121,7 +123,7 @@ public class ServerController {
121 123 }
122 124 }
123 125  
124   - @Operation(summary = "保存流媒体服务")
  126 + @Operation(summary = "保存流媒体服务", security = @SecurityRequirement(name = JwtUtils.HEADER))
125 127 @Parameter(name = "mediaServerItem", description = "流媒体信息", required = true)
126 128 @PostMapping(value = "/media_server/save")
127 129 @ResponseBody
... ... @@ -135,7 +137,7 @@ public class ServerController {
135 137 }
136 138 }
137 139  
138   - @Operation(summary = "移除流媒体服务")
  140 + @Operation(summary = "移除流媒体服务", security = @SecurityRequirement(name = JwtUtils.HEADER))
139 141 @Parameter(name = "id", description = "流媒体ID", required = true)
140 142 @DeleteMapping(value = "/media_server/delete")
141 143 @ResponseBody
... ... @@ -148,7 +150,7 @@ public class ServerController {
148 150 }
149 151  
150 152  
151   - @Operation(summary = "重启服务")
  153 + @Operation(summary = "重启服务", security = @SecurityRequirement(name = JwtUtils.HEADER))
152 154 @GetMapping(value = "/restart")
153 155 @ResponseBody
154 156 public void restart() {
... ... @@ -173,7 +175,7 @@ public class ServerController {
173 175 // });
174 176 };
175 177  
176   - @Operation(summary = "获取系统信息信息")
  178 + @Operation(summary = "获取系统信息信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
177 179 @GetMapping(value = "/system/configInfo")
178 180 @ResponseBody
179 181 public SystemConfigInfo getConfigInfo() {
... ... @@ -185,7 +187,7 @@ public class ServerController {
185 187 return systemConfigInfo;
186 188 }
187 189  
188   - @Operation(summary = "获取版本信息")
  190 + @Operation(summary = "获取版本信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
189 191 @GetMapping(value = "/version")
190 192 @ResponseBody
191 193 public VersionPo VersionPogetVersion() {
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/streamProxy/StreamProxyController.java
... ... @@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSONObject;
4 4 import com.genersoft.iot.vmp.common.StreamInfo;
5 5 import com.genersoft.iot.vmp.conf.UserSetting;
6 6 import com.genersoft.iot.vmp.conf.exception.ControllerException;
  7 +import com.genersoft.iot.vmp.conf.security.JwtUtils;
7 8 import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
8 9 import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
9 10 import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
... ... @@ -16,6 +17,7 @@ import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
16 17 import com.github.pagehelper.PageInfo;
17 18 import io.swagger.v3.oas.annotations.Operation;
18 19 import io.swagger.v3.oas.annotations.Parameter;
  20 +import io.swagger.v3.oas.annotations.security.SecurityRequirement;
19 21 import io.swagger.v3.oas.annotations.tags.Tag;
20 22 import org.slf4j.Logger;
21 23 import org.slf4j.LoggerFactory;
... ... @@ -52,7 +54,7 @@ public class StreamProxyController {
52 54 private UserSetting userSetting;
53 55  
54 56  
55   - @Operation(summary = "分页查询流代理")
  57 + @Operation(summary = "分页查询流代理", security = @SecurityRequirement(name = JwtUtils.HEADER))
56 58 @Parameter(name = "page", description = "当前页")
57 59 @Parameter(name = "count", description = "每页查询数量")
58 60 @Parameter(name = "query", description = "查询内容")
... ... @@ -67,7 +69,7 @@ public class StreamProxyController {
67 69 return streamProxyService.getAll(page, count);
68 70 }
69 71  
70   - @Operation(summary = "查询流代理")
  72 + @Operation(summary = "查询流代理", security = @SecurityRequirement(name = JwtUtils.HEADER))
71 73 @Parameter(name = "app", description = "应用名")
72 74 @Parameter(name = "stream", description = "流Id")
73 75 @GetMapping(value = "/one")
... ... @@ -77,7 +79,7 @@ public class StreamProxyController {
77 79 return streamProxyService.getStreamProxyByAppAndStream(app, stream);
78 80 }
79 81  
80   - @Operation(summary = "保存代理", parameters = {
  82 + @Operation(summary = "保存代理", security = @SecurityRequirement(name = JwtUtils.HEADER), parameters = {
81 83 @Parameter(name = "param", description = "代理参数", required = true),
82 84 })
83 85 @PostMapping(value = "/save")
... ... @@ -131,7 +133,7 @@ public class StreamProxyController {
131 133  
132 134 @GetMapping(value = "/ffmpeg_cmd/list")
133 135 @ResponseBody
134   - @Operation(summary = "获取ffmpeg.cmd模板")
  136 + @Operation(summary = "获取ffmpeg.cmd模板", security = @SecurityRequirement(name = JwtUtils.HEADER))
135 137 @Parameter(name = "mediaServerId", description = "流媒体ID", required = true)
136 138 public JSONObject getFFmpegCMDs(@RequestParam String mediaServerId){
137 139 logger.debug("获取节点[ {} ]ffmpeg.cmd模板", mediaServerId );
... ... @@ -145,7 +147,7 @@ public class StreamProxyController {
145 147  
146 148 @DeleteMapping(value = "/del")
147 149 @ResponseBody
148   - @Operation(summary = "移除代理")
  150 + @Operation(summary = "移除代理", security = @SecurityRequirement(name = JwtUtils.HEADER))
149 151 @Parameter(name = "app", description = "应用名", required = true)
150 152 @Parameter(name = "stream", description = "流id", required = true)
151 153 public void del(@RequestParam String app, @RequestParam String stream){
... ... @@ -159,7 +161,7 @@ public class StreamProxyController {
159 161  
160 162 @GetMapping(value = "/start")
161 163 @ResponseBody
162   - @Operation(summary = "启用代理")
  164 + @Operation(summary = "启用代理", security = @SecurityRequirement(name = JwtUtils.HEADER))
163 165 @Parameter(name = "app", description = "应用名", required = true)
164 166 @Parameter(name = "stream", description = "流id", required = true)
165 167 public void start(String app, String stream){
... ... @@ -172,7 +174,7 @@ public class StreamProxyController {
172 174  
173 175 @GetMapping(value = "/stop")
174 176 @ResponseBody
175   - @Operation(summary = "停用代理")
  177 + @Operation(summary = "停用代理", security = @SecurityRequirement(name = JwtUtils.HEADER))
176 178 @Parameter(name = "app", description = "应用名", required = true)
177 179 @Parameter(name = "stream", description = "流id", required = true)
178 180 public void stop(String app, String stream){
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java
... ... @@ -6,6 +6,7 @@ import com.alibaba.excel.read.metadata.ReadSheet;
6 6 import com.genersoft.iot.vmp.common.StreamInfo;
7 7 import com.genersoft.iot.vmp.conf.UserSetting;
8 8 import com.genersoft.iot.vmp.conf.exception.ControllerException;
  9 +import com.genersoft.iot.vmp.conf.security.JwtUtils;
9 10 import com.genersoft.iot.vmp.conf.security.SecurityUtils;
10 11 import com.genersoft.iot.vmp.conf.security.dto.LoginUser;
11 12 import com.genersoft.iot.vmp.gb28181.bean.GbStream;
... ... @@ -20,6 +21,7 @@ import com.genersoft.iot.vmp.vmanager.bean.*;
20 21 import com.github.pagehelper.PageInfo;
21 22 import io.swagger.v3.oas.annotations.Operation;
22 23 import io.swagger.v3.oas.annotations.Parameter;
  24 +import io.swagger.v3.oas.annotations.security.SecurityRequirement;
23 25 import io.swagger.v3.oas.annotations.tags.Tag;
24 26 import org.slf4j.Logger;
25 27 import org.slf4j.LoggerFactory;
... ... @@ -64,7 +66,7 @@ public class StreamPushController {
64 66  
65 67 @GetMapping(value = "/list")
66 68 @ResponseBody
67   - @Operation(summary = "推流列表查询")
  69 + @Operation(summary = "推流列表查询", security = @SecurityRequirement(name = JwtUtils.HEADER))
68 70 @Parameter(name = "page", description = "当前页")
69 71 @Parameter(name = "count", description = "每页查询数量")
70 72 @Parameter(name = "query", description = "查询内容")
... ... @@ -88,7 +90,7 @@ public class StreamPushController {
88 90  
89 91 @PostMapping(value = "/save_to_gb")
90 92 @ResponseBody
91   - @Operation(summary = "将推流添加到国标")
  93 + @Operation(summary = "将推流添加到国标", security = @SecurityRequirement(name = JwtUtils.HEADER))
92 94 public void saveToGB(@RequestBody GbStream stream){
93 95 if (!streamPushService.saveToGB(stream)){
94 96 throw new ControllerException(ErrorCode.ERROR100);
... ... @@ -98,7 +100,7 @@ public class StreamPushController {
98 100  
99 101 @DeleteMapping(value = "/remove_form_gb")
100 102 @ResponseBody
101   - @Operation(summary = "将推流移出到国标")
  103 + @Operation(summary = "将推流移出到国标", security = @SecurityRequirement(name = JwtUtils.HEADER))
102 104 public void removeFormGB(@RequestBody GbStream stream){
103 105 if (!streamPushService.removeFromGB(stream)){
104 106 throw new ControllerException(ErrorCode.ERROR100);
... ... @@ -108,7 +110,7 @@ public class StreamPushController {
108 110  
109 111 @PostMapping(value = "/stop")
110 112 @ResponseBody
111   - @Operation(summary = "中止一个推流")
  113 + @Operation(summary = "中止一个推流", security = @SecurityRequirement(name = JwtUtils.HEADER))
112 114 @Parameter(name = "app", description = "应用名", required = true)
113 115 @Parameter(name = "stream", description = "流id", required = true)
114 116 public void stop(String app, String streamId){
... ... @@ -119,7 +121,7 @@ public class StreamPushController {
119 121  
120 122 @DeleteMapping(value = "/batchStop")
121 123 @ResponseBody
122   - @Operation(summary = "中止多个推流")
  124 + @Operation(summary = "中止多个推流", security = @SecurityRequirement(name = JwtUtils.HEADER))
123 125 public void batchStop(@RequestBody BatchGBStreamParam batchGBStreamParam){
124 126 if (batchGBStreamParam.getGbStreams().size() == 0) {
125 127 throw new ControllerException(ErrorCode.ERROR100);
... ... @@ -231,7 +233,7 @@ public class StreamPushController {
231 233 */
232 234 @GetMapping(value = "/getPlayUrl")
233 235 @ResponseBody
234   - @Operation(summary = "获取推流播放地址")
  236 + @Operation(summary = "获取推流播放地址", security = @SecurityRequirement(name = JwtUtils.HEADER))
235 237 @Parameter(name = "app", description = "应用名", required = true)
236 238 @Parameter(name = "stream", description = "流id", required = true)
237 239 @Parameter(name = "mediaServerId", description = "媒体服务器id")
... ... @@ -261,7 +263,7 @@ public class StreamPushController {
261 263 */
262 264 @PostMapping(value = "/add")
263 265 @ResponseBody
264   - @Operation(summary = "添加推流信息")
  266 + @Operation(summary = "添加推流信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
265 267 public void add(@RequestBody StreamPushItem stream){
266 268 if (ObjectUtils.isEmpty(stream.getGbId())) {
267 269 throw new ControllerException(ErrorCode.ERROR400.getCode(), "国标ID不可为空");
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/user/RoleController.java
1 1 package com.genersoft.iot.vmp.vmanager.user;
2 2  
3 3 import com.genersoft.iot.vmp.conf.exception.ControllerException;
  4 +import com.genersoft.iot.vmp.conf.security.JwtUtils;
4 5 import com.genersoft.iot.vmp.conf.security.SecurityUtils;
5 6 import com.genersoft.iot.vmp.service.IRoleService;
6 7 import com.genersoft.iot.vmp.storager.dao.dto.Role;
... ... @@ -8,6 +9,7 @@ import com.genersoft.iot.vmp.utils.DateUtil;
8 9 import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
9 10 import io.swagger.v3.oas.annotations.Operation;
10 11 import io.swagger.v3.oas.annotations.Parameter;
  12 +import io.swagger.v3.oas.annotations.security.SecurityRequirement;
11 13 import io.swagger.v3.oas.annotations.tags.Tag;
12 14 import org.springframework.beans.factory.annotation.Autowired;
13 15 import org.springframework.web.bind.annotation.*;
... ... @@ -24,7 +26,7 @@ public class RoleController {
24 26 private IRoleService roleService;
25 27  
26 28 @PostMapping("/add")
27   - @Operation(summary = "添加角色")
  29 + @Operation(summary = "添加角色", security = @SecurityRequirement(name = JwtUtils.HEADER))
28 30 @Parameter(name = "name", description = "角色名", required = true)
29 31 @Parameter(name = "authority", description = "权限(自行定义内容,目前未使用)", required = true)
30 32 public void add(@RequestParam String name,
... ... @@ -49,7 +51,7 @@ public class RoleController {
49 51 }
50 52  
51 53 @DeleteMapping("/delete")
52   - @Operation(summary = "删除角色")
  54 + @Operation(summary = "删除角色", security = @SecurityRequirement(name = JwtUtils.HEADER))
53 55 @Parameter(name = "id", description = "用户Id", required = true)
54 56 public void delete(@RequestParam Integer id){
55 57 // 获取当前登录用户id
... ... @@ -66,7 +68,7 @@ public class RoleController {
66 68 }
67 69  
68 70 @GetMapping("/all")
69   - @Operation(summary = "查询角色")
  71 + @Operation(summary = "查询角色", security = @SecurityRequirement(name = JwtUtils.HEADER))
70 72 public List<Role> all(){
71 73 // 获取当前登录用户id
72 74 List<Role> allRoles = roleService.getAll();
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/user/UserController.java
... ... @@ -14,6 +14,7 @@ import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
14 14 import com.github.pagehelper.PageInfo;
15 15 import io.swagger.v3.oas.annotations.Operation;
16 16 import io.swagger.v3.oas.annotations.Parameter;
  17 +import io.swagger.v3.oas.annotations.security.SecurityRequirement;
17 18 import io.swagger.v3.oas.annotations.tags.Tag;
18 19 import org.springframework.beans.factory.annotation.Autowired;
19 20 import org.springframework.security.authentication.AuthenticationManager;
... ... @@ -66,7 +67,7 @@ public class UserController {
66 67  
67 68  
68 69 @PostMapping("/changePassword")
69   - @Operation(summary = "修改密码")
  70 + @Operation(summary = "修改密码", security = @SecurityRequirement(name = JwtUtils.HEADER))
70 71 @Parameter(name = "username", description = "用户名", required = true)
71 72 @Parameter(name = "oldpassword", description = "旧密码(已md5加密的密码)", required = true)
72 73 @Parameter(name = "password", description = "新密码(未md5加密的密码)", required = true)
... ... @@ -95,7 +96,7 @@ public class UserController {
95 96  
96 97  
97 98 @PostMapping("/add")
98   - @Operation(summary = "添加用户")
  99 + @Operation(summary = "添加用户", security = @SecurityRequirement(name = JwtUtils.HEADER))
99 100 @Parameter(name = "username", description = "用户名", required = true)
100 101 @Parameter(name = "password", description = "密码(未md5加密的密码)", required = true)
101 102 @Parameter(name = "roleId", description = "角色ID", required = true)
... ... @@ -131,7 +132,7 @@ public class UserController {
131 132 }
132 133  
133 134 @DeleteMapping("/delete")
134   - @Operation(summary = "删除用户")
  135 + @Operation(summary = "删除用户", security = @SecurityRequirement(name = JwtUtils.HEADER))
135 136 @Parameter(name = "id", description = "用户Id", required = true)
136 137 public void delete(@RequestParam Integer id){
137 138 // 获取当前登录用户id
... ... @@ -147,7 +148,7 @@ public class UserController {
147 148 }
148 149  
149 150 @GetMapping("/all")
150   - @Operation(summary = "查询用户")
  151 + @Operation(summary = "查询用户", security = @SecurityRequirement(name = JwtUtils.HEADER))
151 152 public List<User> all(){
152 153 // 获取当前登录用户id
153 154 return userService.getAllUsers();
... ... @@ -161,7 +162,7 @@ public class UserController {
161 162 * @return 分页用户列表
162 163 */
163 164 @GetMapping("/users")
164   - @Operation(summary = "分页查询用户")
  165 + @Operation(summary = "分页查询用户", security = @SecurityRequirement(name = JwtUtils.HEADER))
165 166 @Parameter(name = "page", description = "当前页", required = true)
166 167 @Parameter(name = "count", description = "每页查询数量", required = true)
167 168 public PageInfo<User> users(int page, int count) {
... ... @@ -169,7 +170,7 @@ public class UserController {
169 170 }
170 171  
171 172 @RequestMapping("/changePushKey")
172   - @Operation(summary = "修改pushkey")
  173 + @Operation(summary = "修改pushkey", security = @SecurityRequirement(name = JwtUtils.HEADER))
173 174 @Parameter(name = "userId", description = "用户Id", required = true)
174 175 @Parameter(name = "pushKey", description = "新的pushKey", required = true)
175 176 public void changePushKey(@RequestParam Integer userId,@RequestParam String pushKey) {
... ... @@ -187,7 +188,7 @@ public class UserController {
187 188 }
188 189  
189 190 @PostMapping("/changePasswordForAdmin")
190   - @Operation(summary = "管理员修改普通用户密码")
  191 + @Operation(summary = "管理员修改普通用户密码", security = @SecurityRequirement(name = JwtUtils.HEADER))
191 192 @Parameter(name = "adminId", description = "管理员id", required = true)
192 193 @Parameter(name = "userId", description = "用户id", required = true)
193 194 @Parameter(name = "password", description = "新密码(未md5加密的密码)", required = true)
... ...
web_src/src/components/channelList.vue
... ... @@ -33,98 +33,156 @@
33 33 <el-option label="流畅" :value="true"></el-option>
34 34 </el-select>
35 35 </div>
36   - <el-button icon="el-icon-refresh-right" circle size="mini" @click="refresh()"></el-button>
37   - <el-button v-if="showTree" icon="iconfont icon-list" circle size="mini" @click="switchList()"></el-button>
38   - <el-button v-if="!showTree" icon="iconfont icon-tree" circle size="mini" @click="switchTree()"></el-button>
  36 + <el-button icon="el-icon-refresh-right" circle size="mini" @click="refresh()"></el-button>
  37 + <el-button v-if="showTree" icon="iconfont icon-list" circle size="mini" @click="switchList()"></el-button>
  38 + <el-button v-if="!showTree" icon="iconfont icon-tree" circle size="mini" @click="switchTree()"></el-button>
  39 + </div>
39 40 </div>
40   - </div>
41   - <devicePlayer ref="devicePlayer" ></devicePlayer>
42   - <el-container v-loading="isLoging" style="height: 82vh;">
43   - <el-aside width="auto" style="height: 82vh; background-color: #ffffff; overflow: auto" v-if="showTree" >
44   - <DeviceTree ref="deviceTree" :device="device" :onlyCatalog="true" :clickEvent="treeNodeClickEvent" ></DeviceTree>
45   - </el-aside>
46   - <el-main style="padding: 5px;">
47   - <el-table ref="channelListTable" :data="deviceChannelList" :height="winHeight" style="width: 100%" header-row-class-name="table-header">
48   - <el-table-column prop="channelId" label="通道编号" min-width="200">
49   - </el-table-column>
50   - <el-table-column prop="deviceId" label="设备编号" min-width="200">
51   - </el-table-column>
52   - <el-table-column prop="name" label="通道名称" min-width="200">
53   - </el-table-column>
54   - <el-table-column label="快照" min-width="120">
55   - <template v-slot:default="scope">
56   - <el-image
57   - :src="getSnap(scope.row)"
58   - :preview-src-list="getBigSnap(scope.row)"
59   - @error="getSnapErrorEvent(scope.row.deviceId, scope.row.channelId)"
60   - :fit="'contain'"
61   - style="width: 60px">
62   - <div slot="error" class="image-slot">
63   - <i class="el-icon-picture-outline"></i>
  41 + <devicePlayer ref="devicePlayer"></devicePlayer>
  42 + <el-container v-loading="isLoging" style="height: 82vh;">
  43 + <el-aside width="auto" style="height: 82vh; background-color: #ffffff; overflow: auto" v-if="showTree">
  44 + <DeviceTree ref="deviceTree" :device="device" :onlyCatalog="true" :clickEvent="treeNodeClickEvent"></DeviceTree>
  45 + </el-aside>
  46 + <el-main style="padding: 5px;">
  47 + <el-table ref="channelListTable" :data="deviceChannelList" :height="winHeight" style="width: 100%"
  48 + header-row-class-name="table-header">
  49 + <el-table-column prop="channelId" label="通道编号" min-width="200">
  50 + </el-table-column>
  51 + <el-table-column prop="deviceId" label="设备编号" min-width="200">
  52 + </el-table-column>
  53 + <el-table-column prop="name" label="通道名称" min-width="200">
  54 + <template v-slot:default="scope">
  55 + <el-input
  56 + v-show="scope.row.edit"
  57 + v-model="scope.row.name"
  58 + placeholder="通道名称"
  59 + :maxlength="255"
  60 + show-word-limit
  61 + clearable
  62 + />
  63 + <span v-show="!scope.row.edit">{{ scope.row.name }}</span>
  64 + </template>
  65 + </el-table-column>
  66 + <el-table-column label="快照" min-width="120">
  67 + <template v-slot:default="scope">
  68 + <el-image
  69 + :src="getSnap(scope.row)"
  70 + :preview-src-list="getBigSnap(scope.row)"
  71 + @error="getSnapErrorEvent(scope.row.deviceId, scope.row.channelId)"
  72 + :fit="'contain'"
  73 + style="width: 60px">
  74 + <div slot="error" class="image-slot">
  75 + <i class="el-icon-picture-outline"></i>
  76 + </div>
  77 + </el-image>
  78 + </template>
  79 + </el-table-column>
  80 + <el-table-column prop="subCount" label="子节点数" min-width="120">
  81 + </el-table-column>
  82 + <el-table-column prop="manufacture" label="厂家" min-width="120">
  83 + </el-table-column>
  84 + <el-table-column label="位置信息" min-width="200">
  85 + <template v-slot:default="scope">
  86 + <el-input
  87 + v-show="scope.row.edit"
  88 + v-model="scope.row.location"
  89 + placeholder="例:117.234,36.378"
  90 + :maxlength="30"
  91 + show-word-limit
  92 + clearable
  93 + />
  94 + <span v-show="!scope.row.edit">{{ scope.row.location }}</span>
  95 + </template>
  96 + </el-table-column>
  97 + <el-table-column prop="PTZType" label="云台类型" min-width="120">
  98 + <template v-slot:default="scope">
  99 + <el-select v-show="scope.row.edit" v-model="scope.row.PTZType"
  100 + placeholder="云台类型" filterable>
  101 + <el-option
  102 + v-for="(value, key) in ptzTypes"
  103 + :key="key"
  104 + :label="value"
  105 + :value="key"
  106 + />
  107 + </el-select>
  108 + <div v-show="!scope.row.edit">{{ scope.row.PTZTypeText }}</div>
  109 + </template>
  110 + </el-table-column>
  111 + <el-table-column label="开启音频" min-width="120">
  112 + <template slot-scope="scope">
  113 + <el-switch @change="updateChannel(scope.row)" v-model="scope.row.hasAudio" active-color="#409EFF">
  114 + </el-switch>
  115 + </template>
  116 + </el-table-column>
  117 + <el-table-column label="状态" min-width="120">
  118 + <template slot-scope="scope">
  119 + <div slot="reference" class="name-wrapper">
  120 + <el-tag size="medium" v-if="scope.row.status === true">在线</el-tag>
  121 + <el-tag size="medium" type="info" v-if="scope.row.status === false">离线</el-tag>
64 122 </div>
65   - </el-image>
66   - </template>
67   - </el-table-column>
68   - <el-table-column prop="subCount" label="子节点数" min-width="120">
69   - </el-table-column>
70   - <el-table-column prop="manufacture" label="厂家" min-width="120">
71   - </el-table-column>
72   - <el-table-column label="位置信息" min-width="200">
73   - <template slot-scope="scope">
74   - <span v-if="scope.row.longitude*scope.row.latitude > 0">{{ scope.row.longitude }},<br>{{ scope.row.latitude }}</span>
75   - <span v-if="scope.row.longitude*scope.row.latitude === 0">无</span>
76   - </template>
77   - </el-table-column>
78   - <el-table-column prop="PTZTypeText" label="云台类型" min-width="120"/>
79   - <el-table-column label="开启音频" min-width="120">
80   - <template slot-scope="scope">
81   - <el-switch @change="updateChannel(scope.row)" v-model="scope.row.hasAudio" active-color="#409EFF">
82   - </el-switch>
83   - </template>
84   - </el-table-column>
85   - <el-table-column label="状态" min-width="120">
86   - <template slot-scope="scope">
87   - <div slot="reference" class="name-wrapper">
88   - <el-tag size="medium" v-if="scope.row.status === true">在线</el-tag>
89   - <el-tag size="medium" type="info" v-if="scope.row.status === false">离线</el-tag>
90   - </div>
91   - </template>
92   - </el-table-column>
  123 + </template>
  124 + </el-table-column>
93 125  
94 126  
95   - <el-table-column label="操作" min-width="280" fixed="right">
96   - <template slot-scope="scope">
97   - <el-button size="medium" v-bind:disabled="device == null || device.online === 0" icon="el-icon-video-play" type="text" @click="sendDevicePush(scope.row)">播放</el-button>
98   - <el-button size="medium" v-bind:disabled="device == null || device.online === 0" icon="el-icon-switch-button" type="text" style="color: #f56c6c" v-if="!!scope.row.streamId"
99   - @click="stopDevicePush(scope.row)">停止
100   - </el-button>
101   - <el-divider direction="vertical"></el-divider>
102   - <el-button size="medium" icon="el-icon-s-open" type="text" v-if="scope.row.subCount > 0 || scope.row.parental === 1"
103   - @click="changeSubchannel(scope.row)">查看
104   - </el-button>
105   - <el-divider v-if="scope.row.subCount > 0 || scope.row.parental === 1" direction="vertical"></el-divider>
106   - <el-button size="medium" v-bind:disabled="device == null || device.online === 0" icon="el-icon-video-camera" type="text" @click="queryRecords(scope.row)">设备录像
107   - </el-button>
108   - <el-button size="medium" v-bind:disabled="device == null || device.online === 0" icon="el-icon-cloudy"
109   - type="text" @click="queryCloudRecords(scope.row)">云端录像
110   - </el-button>
111   - </template>
112   - </el-table-column>
113   - </el-table>
114   - <el-pagination
115   - style="float: right"
116   - @size-change="handleSizeChange"
117   - @current-change="currentChange"
118   - :current-page="currentPage"
119   - :page-size="count"
120   - :page-sizes="[15, 25, 35, 50]"
121   - layout="total, sizes, prev, pager, next"
122   - :total="total">
123   - </el-pagination>
124   - </el-main>
125   - </el-container>
  127 + <el-table-column label="操作" min-width="340" fixed="right">
  128 + <template slot-scope="scope">
  129 + <el-button size="medium" v-bind:disabled="device == null || device.online === 0" icon="el-icon-video-play"
  130 + type="text" @click="sendDevicePush(scope.row)">播放
  131 + </el-button>
  132 + <el-button size="medium" v-bind:disabled="device == null || device.online === 0"
  133 + icon="el-icon-switch-button"
  134 + type="text" style="color: #f56c6c" v-if="!!scope.row.streamId"
  135 + @click="stopDevicePush(scope.row)">停止
  136 + </el-button>
  137 + <el-divider direction="vertical"></el-divider>
  138 + <el-button
  139 + v-if="scope.row.edit"
  140 + size="medium"
  141 + type="text"
  142 + icon="el-icon-edit-outline"
  143 + @click="handleSave(scope.row)"
  144 + >
  145 + 保存
  146 + </el-button>
  147 + <el-button
  148 + v-else
  149 + size="medium"
  150 + type="text"
  151 + icon="el-icon-edit"
  152 + @click="handleEdit(scope.row)"
  153 + >
  154 + 编辑
  155 + </el-button>
  156 + <el-divider direction="vertical"></el-divider>
  157 + <el-button size="medium" icon="el-icon-s-open" type="text"
  158 + v-if="scope.row.subCount > 0 || scope.row.parental === 1"
  159 + @click="changeSubchannel(scope.row)">查看
  160 + </el-button>
  161 + <el-divider v-if="scope.row.subCount > 0 || scope.row.parental === 1" direction="vertical"></el-divider>
  162 + <el-button size="medium" v-bind:disabled="device == null || device.online === 0"
  163 + icon="el-icon-video-camera"
  164 + type="text" @click="queryRecords(scope.row)">设备录像
  165 + </el-button>
  166 + <el-button size="medium" v-bind:disabled="device == null || device.online === 0" icon="el-icon-cloudy"
  167 + type="text" @click="queryCloudRecords(scope.row)">云端录像
  168 + </el-button>
  169 + </template>
  170 + </el-table-column>
  171 + </el-table>
  172 + <el-pagination
  173 + style="float: right"
  174 + @size-change="handleSizeChange"
  175 + @current-change="currentChange"
  176 + :current-page="currentPage"
  177 + :page-size="count"
  178 + :page-sizes="[15, 25, 35, 50]"
  179 + layout="total, sizes, prev, pager, next"
  180 + :total="total">
  181 + </el-pagination>
  182 + </el-main>
  183 + </el-container>
126 184  
127   - <!--设备列表-->
  185 + <!--设备列表-->
128 186  
129 187 </div>
130 188 </template>
... ... @@ -163,16 +221,23 @@ export default {
163 221 beforeUrl: "/deviceList",
164 222 isLoging: false,
165 223 showTree: false,
166   - loadSnap: {}
  224 + loadSnap: {},
  225 + ptzTypes: {
  226 + 0: "未知",
  227 + 1: "球机",
  228 + 2: "半球",
  229 + 3: "固定枪机",
  230 + 4: "遥控枪机"
  231 + }
167 232 };
168 233 },
169 234  
170 235 mounted() {
171 236 if (this.deviceId) {
172   - this.deviceService.getDevice(this.deviceId, (result)=>{
173   - this.device = result;
  237 + this.deviceService.getDevice(this.deviceId, (result) => {
  238 + this.device = result;
174 239  
175   - }, (error)=>{
  240 + }, (error) => {
176 241 console.log("获取设备信息失败")
177 242 console.error(error)
178 243 })
... ... @@ -227,6 +292,14 @@ export default {
227 292 if (res.data.code === 0) {
228 293 that.total = res.data.data.total;
229 294 that.deviceChannelList = res.data.data.list;
  295 + that.deviceChannelList.forEach(e => {
  296 + e.PTZType = e.PTZType + "";
  297 + that.$set(e, "edit", false);
  298 + that.$set(e, "location", "");
  299 + if (e.longitude && e.latitude) {
  300 + that.$set(e, "location", e.longitude + "," + e.latitude);
  301 + }
  302 + });
230 303 // 防止出现表格错位
231 304 that.$nextTick(() => {
232 305 that.$refs.channelListTable.doLayout();
... ... @@ -248,7 +321,7 @@ export default {
248 321 this.$axios({
249 322 method: 'get',
250 323 url: '/api/play/start/' + deviceId + '/' + channelId,
251   - params:{
  324 + params: {
252 325 isSubStream: this.isSubStream
253 326 }
254 327 }).then(function (res) {
... ... @@ -271,7 +344,7 @@ export default {
271 344 that.initData();
272 345 }, 1000)
273 346  
274   - }else{
  347 + } else {
275 348 that.$message.error(res.data.msg);
276 349 }
277 350 }).catch(function (e) {
... ... @@ -297,7 +370,7 @@ export default {
297 370 this.$axios({
298 371 method: 'get',
299 372 url: '/api/play/stop/' + this.deviceId + "/" + itemData.channelId,
300   - params:{
  373 + params: {
301 374 isSubStream: this.isSubStream
302 375 }
303 376 }).then(function (res) {
... ... @@ -326,7 +399,7 @@ export default {
326 399 return;
327 400 }
328 401 setTimeout(() => {
329   - let url = (process.env.NODE_ENV === 'development'? "debug": "") + '/api/device/query/snap/' + deviceId + '/' + channelId
  402 + let url = (process.env.NODE_ENV === 'development' ? "debug" : "") + '/api/device/query/snap/' + deviceId + '/' + channelId
330 403 this.loadSnap[deviceId + channelId]++
331 404 document.getElementById(deviceId + channelId).setAttribute("src", url + '?' + new Date().getTime())
332 405 }, 1000)
... ... @@ -363,10 +436,18 @@ export default {
363 436 online: this.online,
364 437 channelType: this.channelType
365 438 }
366   - }).then( (res) =>{
  439 + }).then((res) => {
367 440 if (res.data.code === 0) {
368 441 this.total = res.data.data.total;
369 442 this.deviceChannelList = res.data.data.list;
  443 + this.deviceChannelList.forEach(e => {
  444 + e.PTZType = e.PTZType + "";
  445 + this.$set(e, "edit", false);
  446 + this.$set(e, "location", "");
  447 + if (e.longitude && e.latitude) {
  448 + this.$set(e, "location", e.longitude + "," + e.latitude);
  449 + }
  450 + });
370 451 // 防止出现表格错位
371 452 this.$nextTick(() => {
372 453 this.$refs.channelListTable.doLayout();
... ... @@ -376,7 +457,7 @@ export default {
376 457 }).catch(function (error) {
377 458 console.log(error);
378 459 });
379   - }else {
  460 + } else {
380 461 this.$axios({
381 462 method: 'get',
382 463 url: `/api/device/query/tree/channel/${this.deviceId}`,
... ... @@ -385,7 +466,7 @@ export default {
385 466 page: this.currentPage,
386 467 count: this.count,
387 468 }
388   - }).then((res)=> {
  469 + }).then((res) => {
389 470 if (res.data.code === 0) {
390 471 this.total = res.data.total;
391 472 this.deviceChannelList = res.data.list;
... ... @@ -417,14 +498,14 @@ export default {
417 498 refresh: function () {
418 499 this.initData();
419 500 },
420   - switchTree: function (){
  501 + switchTree: function () {
421 502 this.showTree = true;
422 503 this.deviceChannelList = [];
423 504 this.parentChannelId = 0;
424 505 this.currentPage = 1;
425 506  
426 507 },
427   - switchList: function (){
  508 + switchList: function () {
428 509 this.showTree = false;
429 510 this.deviceChannelList = [];
430 511 this.parentChannelId = 0;
... ... @@ -435,12 +516,70 @@ export default {
435 516 console.log(device)
436 517 if (!!!data.channelId) {
437 518 this.parentChannelId = device.deviceId;
438   - }else {
  519 + } else {
439 520 this.parentChannelId = data.channelId;
440 521 }
441 522 this.initData();
442   - }
  523 + },
  524 + // 保存
  525 + handleSave(row) {
  526 + if (row.location) {
  527 + const segements = row.location.split(",");
  528 + if (segements.length !== 2) {
  529 + this.$message.warning("位置信息格式有误,例:117.234,36.378");
  530 + return;
  531 + } else {
  532 + row.longitude = parseFloat(segements[0]);
  533 + row.latitude = parseFloat(segements[1]);
  534 + if (!(row.longitude && row.latitude)) {
  535 + this.$message.warning("位置信息格式有误,例:117.234,36.378");
  536 + return;
  537 + }
  538 + }
  539 + } else {
  540 + delete row.longitude;
  541 + delete row.latitude;
  542 + }
  543 + Object.keys(row).forEach(key => {
  544 + const value = row[key];
  545 + if (value === null || value === undefined || (typeof value === "string" && value.trim() === "")) {
  546 + delete row[key];
  547 + }
  548 + });
  549 + this.$axios({
  550 + method: 'post',
  551 + url: `/api/device/query/channel/update/${this.deviceId}`,
  552 + params: row
  553 + }).then(response => {
  554 + if (response.data.code === 0) {
  555 + this.$message.success("修改成功!");
  556 + this.initData();
  557 + } else {
  558 + this.$message.error("修改失败!");
  559 + }
  560 + }).catch(_ => {
  561 + this.$message.error("修改失败!");
  562 + })
  563 + },
  564 + // 是否正在编辑
  565 + isEdit() {
  566 + let editing = false;
  567 + this.deviceChannelList.forEach(e => {
  568 + if (e.edit) {
  569 + editing = true;
  570 + }
  571 + });
443 572  
  573 + return editing;
  574 + },
  575 + // 编辑
  576 + handleEdit(row) {
  577 + if (this.isEdit()) {
  578 + this.$message.warning('请保存当前编辑项!');
  579 + } else {
  580 + row.edit = true;
  581 + }
  582 + }
444 583 }
445 584 };
446 585 </script>
... ...