Bläddra i källkod

Merge branch 'wvp-28181-2.0' into main-dev

648540858 2 år sedan
förälder
incheckning
4df90d9ba4
25 ändrade filer med 540 tillägg och 348 borttagningar
  1. 63 0
      src/main/java/com/genersoft/iot/vmp/common/StreamInfo.java
  2. 5 1
      src/main/java/com/genersoft/iot/vmp/common/StreamURL.java
  3. 2 1
      src/main/java/com/genersoft/iot/vmp/gb28181/session/SSRCFactory.java
  4. 2 2
      src/main/java/com/genersoft/iot/vmp/service/impl/DeviceChannelServiceImpl.java
  5. 1 1
      src/main/java/com/genersoft/iot/vmp/service/impl/PlatformChannelServiceImpl.java
  6. 4 3
      src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceAlarmMapper.java
  7. 22 21
      src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
  8. 2 1
      src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java
  9. 2 1
      src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMobilePositionMapper.java
  10. 11 10
      src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java
  11. 2 1
      src/main/java/com/genersoft/iot/vmp/storager/dao/LogMapper.java
  12. 3 2
      src/main/java/com/genersoft/iot/vmp/storager/dao/MediaServerMapper.java
  13. 4 3
      src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java
  14. 9 8
      src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformCatalogMapper.java
  15. 12 11
      src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java
  16. 9 9
      src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java
  17. 4 4
      src/main/java/com/genersoft/iot/vmp/storager/dao/StreamProxyMapper.java
  18. 5 5
      src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java
  19. 3 2
      src/main/java/com/genersoft/iot/vmp/storager/dao/UserMapper.java
  20. 36 25
      src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java
  21. 11 1
      src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java
  22. 11 1
      src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java
  23. 1 1
      src/main/resources/application.yml
  24. 315 234
      web_src/package-lock.json
  25. 1 0
      web_src/src/components/GBRecordDetail.vue

+ 63 - 0
src/main/java/com/genersoft/iot/vmp/common/StreamInfo.java

@@ -523,6 +523,69 @@ public class StreamInfo implements Serializable, Cloneable{
         StreamInfo instance = null;
         try{
             instance = (StreamInfo)super.clone();
+            if (this.flv != null) {
+                instance.flv=this.flv.clone();
+            }
+            if (this.ws_flv != null ){
+                instance.ws_flv= this.ws_flv.clone();
+            }
+            if (this.hls != null ) {
+                instance.hls= this.hls.clone();
+            }
+            if (this.ws_hls != null ) {
+                instance.ws_hls= this.ws_hls.clone();
+            }
+            if (this.ts != null ) {
+                instance.ts= this.ts.clone();
+            }
+            if (this.ws_ts != null ) {
+                instance.ws_ts= this.ws_ts.clone();
+            }
+            if (this.fmp4 != null ) {
+                instance.fmp4= this.fmp4.clone();
+            }
+            if (this.ws_fmp4 != null ) {
+                instance.ws_fmp4= this.ws_fmp4.clone();
+            }
+            if (this.rtc != null ) {
+                instance.rtc= this.rtc.clone();
+            }
+            if (this.https_flv != null) {
+                instance.https_flv= this.https_flv.clone();
+            }
+            if (this.wss_flv != null) {
+                instance.wss_flv= this.wss_flv.clone();
+            }
+            if (this.https_hls != null) {
+                instance.https_hls= this.https_hls.clone();
+            }
+            if (this.wss_hls != null) {
+                instance.wss_hls= this.wss_hls.clone();
+            }
+            if (this.wss_ts != null) {
+                instance.wss_ts= this.wss_ts.clone();
+            }
+            if (this.https_fmp4 != null) {
+                instance.https_fmp4= this.https_fmp4.clone();
+            }
+            if (this.wss_fmp4 != null) {
+                instance.wss_fmp4= this.wss_fmp4.clone();
+            }
+            if (this.rtcs != null) {
+                instance.rtcs= this.rtcs.clone();
+            }
+            if (this.rtsp != null) {
+                instance.rtsp= this.rtsp.clone();
+            }
+            if (this.rtsps != null) {
+                instance.rtsps= this.rtsps.clone();
+            }
+            if (this.rtmp != null) {
+                instance.rtmp= this.rtmp.clone();
+            }
+            if (this.rtmps != null) {
+                instance.rtmps= this.rtmps.clone();
+            }
         }catch(CloneNotSupportedException e) {
             e.printStackTrace();
         }

+ 5 - 1
src/main/java/com/genersoft/iot/vmp/common/StreamURL.java

@@ -6,7 +6,7 @@ import java.io.Serializable;
 
 
 @Schema(description = "流地址信息")
-public class StreamURL implements Serializable {
+public class StreamURL implements Serializable,Cloneable {
 
     @Schema(description = "协议")
     private String protocol;
@@ -77,4 +77,8 @@ public class StreamURL implements Serializable {
             return null;
         }
     }
+    @Override
+    public StreamURL clone() throws CloneNotSupportedException {
+        return (StreamURL) super.clone();
+    }
 }

+ 2 - 1
src/main/java/com/genersoft/iot/vmp/gb28181/session/SSRCFactory.java

@@ -8,6 +8,7 @@ import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Objects;
 import java.util.Set;
 
 /**
@@ -118,7 +119,7 @@ public class SSRCFactory {
      */
     public boolean hasMediaServerSSRC(String mediaServerId) {
         String redisKey = SSRC_INFO_KEY + userSetting.getServerId() + "_" + mediaServerId;
-        return redisTemplate.opsForSet().members(redisKey) != null;
+        return Boolean.TRUE.equals(redisTemplate.hasKey(redisKey));
     }
 
 }

+ 2 - 2
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceChannelServiceImpl.java

@@ -141,7 +141,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
                     }
                 }
             }
-            int limitCount = 300;
+            int limitCount = 50;
             if (addChannels.size() > 0) {
                 if (addChannels.size() > limitCount) {
                     for (int i = 0; i < addChannels.size(); i += limitCount) {
@@ -199,7 +199,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
             deviceChannel.setUpdateTime(now);
             result.add(updateGps(deviceChannel, device));
         });
-        int limitCount = 300;
+        int limitCount = 50;
         if (result.size() > limitCount) {
             for (int i = 0; i < result.size(); i += limitCount) {
                 int toIndex = i + limitCount;

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/service/impl/PlatformChannelServiceImpl.java

@@ -82,7 +82,7 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
         int allCount = 0;
         boolean result = false;
         TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition);
-        int limitCount = 300;
+        int limitCount = 50;
         if (channelReducesToAdd.size() > 0) {
             if (channelReducesToAdd.size() > limitCount) {
                 for (int i = 0; i < channelReducesToAdd.size(); i += limitCount) {

+ 4 - 3
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceAlarmMapper.java

@@ -4,6 +4,7 @@ import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm;
 import org.apache.ibatis.annotations.Delete;
 import org.apache.ibatis.annotations.Insert;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.springframework.stereotype.Repository;
 
@@ -32,8 +33,8 @@ public interface DeviceAlarmMapper {
             " <if test=\"endTime != null\" >  AND alarm_time &lt;= #{endTime} </if>" +
             " ORDER BY alarm_time ASC " +
             " </script>"})
-    List<DeviceAlarm> query(String deviceId, String alarmPriority, String alarmMethod,
-                            String alarmType, String startTime, String endTime);
+    List<DeviceAlarm> query(@Param("deviceId") String deviceId, @Param("alarmPriority") String alarmPriority, @Param("alarmMethod") String alarmMethod,
+                            @Param("alarmType") String alarmType, @Param("startTime") String startTime, @Param("endTime") String endTime);
 
 
     @Delete(" <script>" +
@@ -45,5 +46,5 @@ public interface DeviceAlarmMapper {
             " <if test=\"id != null\" > AND id = #{id}</if>" +
             " </script>"
             )
-    int clearAlarmBeforeTime(Integer id, List<String> deviceIdList, String time);
+    int clearAlarmBeforeTime(@Param("id") Integer id, @Param("deviceIdList") List<String> deviceIdList, @Param("time") String time);
 }

+ 22 - 21
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java

@@ -6,6 +6,7 @@ import com.genersoft.iot.vmp.gb28181.bean.DeviceChannelInPlatform;
 import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
 import com.genersoft.iot.vmp.web.gb28181.dto.DeviceChannelExtend;
 import org.apache.ibatis.annotations.*;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
@@ -82,7 +83,7 @@ public interface DeviceChannelMapper {
             "</foreach> </if>" +
             "ORDER BY dc.channel_id " +
             " </script>"})
-    List<DeviceChannel> queryChannels(String deviceId, String parentChannelId, String query, Boolean hasSubChannel, Boolean online, List<String> channelIds);
+    List<DeviceChannel> queryChannels(@Param("deviceId") String deviceId, @Param("parentChannelId") String parentChannelId, @Param("query") String query, @Param("hasSubChannel") Boolean hasSubChannel, @Param("online") Boolean online, @Param("channelIds") List<String> channelIds);
 
     @Select(value = {" <script>" +
             "SELECT " +
@@ -105,7 +106,7 @@ public interface DeviceChannelMapper {
             "</foreach> </if>" +
             "ORDER BY dc.channel_id ASC" +
             " </script>"})
-    List<DeviceChannelExtend> queryChannelsWithDeviceInfo(String deviceId, String parentChannelId, String query, Boolean hasSubChannel, Boolean online, List<String> channelIds);
+    List<DeviceChannelExtend> queryChannelsWithDeviceInfo(@Param("deviceId") String deviceId, @Param("parentChannelId") String parentChannelId, @Param("query") String query, @Param("hasSubChannel") Boolean hasSubChannel, @Param("online") Boolean online, @Param("channelIds") List<String> channelIds);
 
 
     @Select(value = {" <script>" +
@@ -130,23 +131,23 @@ public interface DeviceChannelMapper {
             "ORDER BY dc.channel_id ASC " +
             "Limit #{limit} OFFSET #{start}" +
             " </script>"})
-    List<DeviceChannelExtend> queryChannelsByDeviceIdWithStartAndLimit(String deviceId,List<String> channelIds, String parentChannelId, String query,
-                                                                       Boolean hasSubChannel, Boolean online, int start, int limit);
+    List<DeviceChannelExtend> queryChannelsByDeviceIdWithStartAndLimit(@Param("deviceId") String deviceId, @Param("channelIds") List<String> channelIds, @Param("parentChannelId") String parentChannelId, @Param("query") String query, @Param("hasSubChannel") Boolean hasSubChannel, @Param("online") Boolean online, @Param("start") int start, @Param("limit") int limit);
 
     @Select("SELECT * FROM wvp_device_channel WHERE device_id=#{deviceId} AND channel_id=#{channelId}")
-    DeviceChannel queryChannel(String deviceId, String channelId);
+    DeviceChannel queryChannel(@Param("deviceId") String deviceId,@Param("channelId") String channelId);
 
     @Delete("DELETE FROM wvp_device_channel WHERE device_id=#{deviceId}")
-    int cleanChannelsByDeviceId(String deviceId);
+    int cleanChannelsByDeviceId(@Param("deviceId") String deviceId);
 
     @Delete("DELETE FROM wvp_device_channel WHERE device_id=#{deviceId} AND channel_id=#{channelId}")
-    int del(String deviceId, String channelId);
+    int del(@Param("deviceId") String deviceId, @Param("channelId") String channelId);
 
     @Update(value = {"UPDATE wvp_device_channel SET stream_id=null WHERE device_id=#{deviceId} AND channel_id=#{channelId}"})
-    void stopPlay(String deviceId, String channelId);
+    void stopPlay(@Param("deviceId") String deviceId, @Param("channelId") String channelId);
 
     @Update(value = {"UPDATE wvp_device_channel SET stream_id=#{streamId} WHERE device_id=#{deviceId} AND channel_id=#{channelId}"})
-    void startPlay(String deviceId, String channelId, String streamId);
+    void startPlay(@Param("deviceId") String deviceId, @Param("channelId") String channelId, @Param("streamId") String streamId);
+
 
     @Select(value = {" <script>" +
             "SELECT " +
@@ -172,7 +173,7 @@ public interface DeviceChannelMapper {
             " <if test='catalogId != null ' >  AND pgc.platform_id = #{platformId} and pgc.catalog_id=#{catalogId} </if> " +
             " ORDER BY dc.device_id, dc.channel_id ASC" +
             " </script>"})
-    List<ChannelReduce> queryChannelListInAll(String query, Boolean online, Boolean hasSubChannel, String platformId, String catalogId);
+    List<ChannelReduce> queryChannelListInAll(@Param("query") String query, @Param("online") Boolean online, @Param("hasSubChannel") Boolean hasSubChannel, @Param("platformId") String platformId, @Param("catalogId") String catalogId);
 
     @Select(value = {" <script>" +
             "SELECT " +
@@ -191,7 +192,7 @@ public interface DeviceChannelMapper {
     List<DeviceChannel> queryChannelByChannelId( String channelId);
 
     @Update(value = {"UPDATE wvp_device_channel SET status=false WHERE device_id=#{deviceId} AND channel_id=#{channelId}"})
-    void offline(String deviceId,  String channelId);
+    void offline(@Param("deviceId") String deviceId, @Param("channelId") String channelId);
 
     @Update(value = {"UPDATE wvp_device_channel SET status=false WHERE device_id=#{deviceId}"})
     void offlineByDeviceId(String deviceId);
@@ -214,7 +215,7 @@ public interface DeviceChannelMapper {
             "#{item.businessGroupId}, #{item.gpsTime}) " +
             "</foreach> " +
             "</script>")
-    int batchAdd(List<DeviceChannel> addChannels);
+    int batchAdd(@Param("addChannels") List<DeviceChannel> addChannels);
 
 
     @Insert("<script> " +
@@ -271,7 +272,7 @@ public interface DeviceChannelMapper {
     int batchAddOrUpdate(List<DeviceChannel> addChannels);
 
     @Update(value = {"UPDATE wvp_device_channel SET status=true WHERE device_id=#{deviceId} AND channel_id=#{channelId}"})
-    void online(String deviceId,  String channelId);
+    void online(@Param("deviceId") String deviceId, @Param("channelId") String channelId);
 
     @Update({"<script>" +
             "<foreach collection='updateChannels' item='item' separator=';'>" +
@@ -328,7 +329,7 @@ public interface DeviceChannelMapper {
             " AND channel_id NOT IN " +
             "<foreach collection='channels'  item='item'  open='(' separator=',' close=')' > #{item.channelId}</foreach>" +
             " </script>"})
-    int cleanChannelsNotInList(String deviceId, List<DeviceChannel> channels);
+    int cleanChannelsNotInList(@Param("deviceId") String deviceId, @Param("channels") List<DeviceChannel> channels);
 
     @Update(" update wvp_device_channel" +
             " set sub_count = (select *" +
@@ -337,7 +338,7 @@ public interface DeviceChannelMapper {
             "                      where device_id = #{deviceId} and parent_id = #{channelId}) as temp)" +
             " where device_id = #{deviceId} " +
             " and channel_id = #{channelId}")
-    int updateChannelSubCount(String deviceId, String channelId);
+    int updateChannelSubCount(@Param("deviceId") String deviceId, @Param("channelId") String channelId);
 
     @Update(value = {" <script>" +
             "UPDATE wvp_device_channel " +
@@ -370,14 +371,14 @@ public interface DeviceChannelMapper {
             " <if test='parentId == null and length == null' > and parent_id= #{parentId} </if>" +
             " <if test='parentId != null and length == null' > and parent_id= #{parentId} or left(channel_id, LENGTH(#{parentId})) = #{parentId} </if>" +
             " </script>"})
-    List<DeviceChannel> getChannelsWithCivilCodeAndLength(String deviceId, String parentId, Integer length);
+    List<DeviceChannel> getChannelsWithCivilCodeAndLength(@Param("deviceId") String deviceId, @Param("parentId") String parentId, @Param("length") Integer length);
 
     @Select(value = {" <script>" +
             "select * " +
             "from wvp_device_channel " +
             "where device_id=#{deviceId} and length(channel_id)>14 and civil_code=#{parentId}" +
             " </script>"})
-    List<DeviceChannel> getChannelsByCivilCode(String deviceId, String parentId);
+    List<DeviceChannel> getChannelsByCivilCode(@Param("deviceId") String deviceId, @Param("parentId") String parentId);
 
     @Select("select min(length(channel_id)) as minLength " +
             "from wvp_device_channel " +
@@ -389,7 +390,7 @@ public interface DeviceChannelMapper {
     List<DeviceChannel> getChannelWithoutCivilCode(String deviceId);
 
     @Select("select * from wvp_device_channel where device_id=#{deviceId} and SUBSTRING(channel_id, 11, 3)=#{typeCode}")
-    List<DeviceChannel> getBusinessGroups(String deviceId, String typeCode);
+    List<DeviceChannel> getBusinessGroups(@Param("deviceId") String deviceId, @Param("typeCode") String typeCode);
 
     @Select("select dc.id, dc.channel_id, dc.device_id, dc.name, dc.manufacture,dc.model,dc.owner, pc.civil_code,dc.block, " +
             " 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,  " +
@@ -428,14 +429,14 @@ public interface DeviceChannelMapper {
             "DELETE FROM wvp_device_channel WHERE device_id=#{item.deviceId} AND channel_id=#{item.channelId}" +
             "</foreach>" +
             "</script>"})
-    int batchDel(List<DeviceChannel> deleteChannelList);
+    int batchDel(@Param("deleteChannelList") List<DeviceChannel> deleteChannelList);
 
     @Update({"<script>" +
             "<foreach collection='channels' item='item' separator=';'>" +
             "UPDATE wvp_device_channel SET status=true WHERE device_id=#{item.deviceId} AND channel_id=#{item.channelId}" +
             "</foreach>" +
             "</script>"})
-    int batchOnline(List<DeviceChannel> channels);
+    int batchOnline(@Param("channels") List<DeviceChannel> channels);
 
     @Update({"<script>" +
             "<foreach collection='channels' item='item' separator=';'>" +
@@ -463,6 +464,6 @@ public interface DeviceChannelMapper {
             " <if test='parentId == null or parentId == deviceId'> and parent_id is null or parent_id = #{deviceId}</if>" +
             " <if test='onlyCatalog == true '> and parental = 1 </if>" +
             " </script>"})
-    List<DeviceChannel> getSubChannelsByDeviceId(String deviceId, String parentId, boolean onlyCatalog);
+    List<DeviceChannel> getSubChannelsByDeviceId(@Param("deviceId") String deviceId, @Param("parentId") String parentId, @Param("onlyCatalog") boolean onlyCatalog);
 
 }

+ 2 - 1
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java

@@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.storager.dao;
 
 import com.genersoft.iot.vmp.gb28181.bean.Device;
 import org.apache.ibatis.annotations.*;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
@@ -235,7 +236,7 @@ public interface DeviceMapper {
             "geo_coord_sys,"+
             "on_line"+
             " FROM wvp_device WHERE ip = #{host} AND port=#{port}")
-    Device getDeviceByHostAndPort(String host, int port);
+    Device getDeviceByHostAndPort(@Param("host") String host, @Param("port") int port);
 
     @Update(value = {" <script>" +
             "UPDATE wvp_device " +

+ 2 - 1
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMobilePositionMapper.java

@@ -4,6 +4,7 @@ import com.genersoft.iot.vmp.gb28181.bean.MobilePosition;
 import org.apache.ibatis.annotations.Delete;
 import org.apache.ibatis.annotations.Insert;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 
 import java.util.List;
@@ -23,7 +24,7 @@ public interface DeviceMobilePositionMapper {
     "<if test=\"endTime != null\"> AND time&lt;=#{endTime}</if>" +
     " ORDER BY time ASC" +
     " </script>"})
-    List<MobilePosition> queryPositionByDeviceIdAndTime(String deviceId, String channelId, String startTime, String endTime);
+    List<MobilePosition> queryPositionByDeviceIdAndTime(@Param("deviceId") String deviceId, @Param("channelId") String channelId, @Param("startTime") String startTime, @Param("endTime") String endTime);
 
     @Select("SELECT * FROM wvp_device_mobile_position WHERE device_id = #{deviceId}" +
             " ORDER BY time DESC LIMIT 1")

+ 11 - 10
src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java

@@ -6,6 +6,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
 import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
 import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
 import org.apache.ibatis.annotations.*;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
@@ -14,7 +15,7 @@ import java.util.List;
 @Repository
 public interface GbStreamMapper {
 
-    @Insert("REPLACE INTO wvp_gb_stream (app, stream, gb_id, name, " +
+    @Insert("INSERT INTO wvp_gb_stream (app, stream, gb_id, name, " +
             "longitude, latitude, stream_type,media_server_id,create_time) VALUES" +
             "(#{app}, #{stream}, #{gbId}, #{name}, " +
             "#{longitude}, #{latitude}, #{streamType}, " +
@@ -47,7 +48,7 @@ public interface GbStreamMapper {
     int update(GbStream gbStream);
 
     @Delete("DELETE FROM wvp_gb_stream WHERE app=#{app} AND stream=#{stream}")
-    int del(String app, String stream);
+    int del(@Param("app") String app, @Param("stream") String stream);
 
     @Select("<script> "+
             "SELECT gs.* FROM wvp_gb_stream gs " +
@@ -61,10 +62,10 @@ public interface GbStreamMapper {
             " <if test='mediaServerId != null' > AND gs.media_server_id=#{mediaServerId} </if>" +
             " order by gs.gb_stream_id asc " +
             "</script>")
-    List<GbStream> selectAll(String platformId, String catalogId, String query, String mediaServerId);
+    List<GbStream> selectAll(@Param("platformId") String platformId, @Param("catalogId") String catalogId, @Param("query") String query, @Param("mediaServerId") String mediaServerId);
 
     @Select("SELECT * FROM wvp_gb_stream WHERE app=#{app} AND stream=#{stream}")
-    GbStream selectOne(String app, String stream);
+    GbStream selectOne(@Param("app") String app, @Param("stream") String stream);
 
     @Select("SELECT * FROM wvp_gb_stream WHERE gb_id=#{gbId}")
     List<GbStream> selectByGBId(String gbId);
@@ -72,7 +73,7 @@ public interface GbStreamMapper {
     @Select("SELECT gs.*, pgs.platform_id as platform_id, pgs.catalog_id as catalog_id FROM wvp_gb_stream gs " +
             "LEFT JOIN wvp_platform_gb_stream pgs ON gs.gb_stream_id = pgs.gb_stream_id " +
             "WHERE gs.gb_id = #{gbId} AND pgs.platform_id = #{platformId}")
-    GbStream queryStreamInPlatform(String platformId, String gbId);
+    GbStream queryStreamInPlatform(@Param("platformId") String platformId, @Param("gbId") String gbId);
 
     @Select("<script> "+
             "select gt.gb_id as channel_id, gt.name, 'wvp-pro' as manufacture,  st.status, gt.longitude, gt.latitude, pc.id as parent_id," +
@@ -90,7 +91,7 @@ public interface GbStreamMapper {
             " left join wvp_platform_catalog pc on pgs.catalog_id = pc.id and pgs.platform_id = pc.platform_id" +
             " where pgs.platform_id=#{platformId}" +
             "</script>")
-    List<DeviceChannel> queryGbStreamListInPlatform(String platformId, boolean usPushingAsStatus);
+    List<DeviceChannel> queryGbStreamListInPlatform(String platformId, @Param("usPushingAsStatus") boolean usPushingAsStatus);
 
 
     @Select("SELECT gs.* FROM wvp_gb_stream gs left join wvp_platform_gb_stream pgs " +
@@ -98,7 +99,7 @@ public interface GbStreamMapper {
     List<GbStream> queryStreamNotInPlatform();
 
     @Delete("DELETE FROM wvp_gb_stream WHERE stream_type=#{type} AND gb_id=NULL AND media_server_id=#{mediaServerId}")
-    void deleteWithoutGBId(String type, String mediaServerId);
+    void deleteWithoutGBId(@Param("type") String type, @Param("mediaServerId") String mediaServerId);
 
     @Delete("<script> "+
             "DELETE FROM wvp_gb_stream where " +
@@ -128,7 +129,7 @@ public interface GbStreamMapper {
             "</foreach> " +
             "</script>")
     @Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gb_stream_id")
-    void batchAdd(List<StreamPushItem> subList);
+    void batchAdd(@Param("subList") List<StreamPushItem> subList);
 
     @Update({"<script>" +
             "<foreach collection='gpsMsgInfos' item='item' separator=';'>" +
@@ -164,9 +165,9 @@ public interface GbStreamMapper {
     int updateGbIdOrName(List<StreamPushItem> streamPushItemForUpdate);
 
     @Select("SELECT status FROM wvp_stream_proxy WHERE app=#{app} AND stream=#{stream}")
-    Boolean selectStatusForProxy(String app, String stream);
+    Boolean selectStatusForProxy(@Param("app") String app, @Param("stream") String stream);
 
     @Select("SELECT status FROM wvp_stream_push WHERE app=#{app} AND stream=#{stream}")
-    Boolean selectStatusForPush(String app, String stream);
+    Boolean selectStatusForPush(@Param("app") String app, @Param("stream") String stream);
 
 }

+ 2 - 1
src/main/java/com/genersoft/iot/vmp/storager/dao/LogMapper.java

@@ -4,6 +4,7 @@ import com.genersoft.iot.vmp.storager.dao.dto.LogDto;
 import org.apache.ibatis.annotations.Delete;
 import org.apache.ibatis.annotations.Insert;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.springframework.stereotype.Repository;
 
@@ -29,7 +30,7 @@ public interface LogMapper {
             " <if test=\"endTime != null\" >  AND create_time &lt;= #{endTime} </if>" +
             " ORDER BY create_time DESC " +
             " </script>"})
-    List<LogDto> query(String query, String type, String startTime, String endTime);
+    List<LogDto> query(@Param("query") String query, @Param("type") String type, @Param("startTime") String startTime, @Param("endTime") String endTime);
 
     @Delete("DELETE FROM wvp_log")
     int clear();

+ 3 - 2
src/main/java/com/genersoft/iot/vmp/storager/dao/MediaServerMapper.java

@@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.storager.dao;
 
 import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
 import org.apache.ibatis.annotations.*;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
@@ -119,13 +120,13 @@ public interface MediaServerMapper {
     void delOne(String id);
 
     @Select("DELETE FROM wvp_media_server WHERE ip=#{host} and http_port=#{port}")
-    void delOneByIPAndPort(String host, int port);
+    void delOneByIPAndPort(@Param("host") String host, @Param("port") int port);
 
     @Delete("DELETE FROM wvp_media_server WHERE default_server=true")
     int delDefault();
 
     @Select("SELECT * FROM wvp_media_server WHERE ip=#{host} and http_port=#{port}")
-    MediaServerItem queryOneByHostAndPort(String host, int port);
+    MediaServerItem queryOneByHostAndPort(@Param("host") String host, @Param("port") int port);
 
     @Select("SELECT * FROM wvp_media_server WHERE default_server=true")
     MediaServerItem queryDefault();

+ 4 - 3
src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java

@@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.storager.dao;
 import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
 import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo;
 import org.apache.ibatis.annotations.*;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
@@ -84,17 +85,17 @@ public interface ParentPlatformMapper {
     int outlineForAllParentPlatform();
 
     @Update("UPDATE wvp_platform SET status=#{online} WHERE server_gb_id=#{platformGbID}" )
-    int updateParentPlatformStatus(String platformGbID, boolean online);
+    int updateParentPlatformStatus(@Param("platformGbID") String platformGbID, @Param("online") boolean online);
 
     @Update(value = {" <script>" +
             "UPDATE wvp_platform " +
             "SET catalog_id=#{catalogId}, update_time=#{updateTime}" +
             "WHERE server_gb_id=#{platformId}"+
             "</script>"})
-    int setDefaultCatalog(String platformId, String catalogId, String updateTime);
+    int setDefaultCatalog(@Param("platformId") String platformId, @Param("catalogId") String catalogId, @Param("updateTime") String updateTime);
 
     @Select("select 'channel' as name, count(pgc.platform_id) count from wvp_platform_gb_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id where  pgc.platform_id=#{platform_id} and dc.channel_id =#{gbId} " +
             "union " +
             "select 'stream' as name, count(pgs.platform_id) count from wvp_platform_gb_stream pgs left join wvp_gb_stream gs on pgs.gb_stream_id = gs.gb_stream_id where  pgs.platform_id=#{platform_id} and gs.gb_id =#{gbId}")
-    List<ChannelSourceInfo> getChannelSource(String platform_id, String gbId);
+    List<ChannelSourceInfo> getChannelSource(@Param("platform_id") String platform_id, @Param("gbId") String gbId);
 }

+ 9 - 8
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformCatalogMapper.java

@@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.storager.dao;
 import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
 import com.genersoft.iot.vmp.gb28181.bean.PlatformCatalog;
 import org.apache.ibatis.annotations.*;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
@@ -17,37 +18,37 @@ public interface PlatformCatalogMapper {
     int add(PlatformCatalog platformCatalog);
 
     @Delete("DELETE from wvp_platform_catalog WHERE platform_id=#{platformId} and id=#{id}")
-    int del(String platformId, String id);
+    int del(@Param("platformId") String platformId, @Param("id") String id);
 
     @Delete("DELETE from wvp_platform_catalog WHERE platform_id=#{platformId}")
-    int delByPlatformId(String platformId);
+    int delByPlatformId(@Param("platformId") String platformId);
 
     @Select("SELECT pc.*, count(pc2.id) as children_count from wvp_platform_catalog pc " +
             "left join wvp_platform_catalog pc2 on pc.id = pc2.parent_id " +
             "WHERE pc.parent_id=#{parentId} AND pc.platform_id=#{platformId} " +
             "group by pc.id, pc.name, pc.platform_id, pc.business_group_id, pc.civil_code, pc.parent_id")
-    List<PlatformCatalog> selectByParentId(String platformId, String parentId);
+    List<PlatformCatalog> selectByParentId(@Param("platformId") String platformId, @Param("parentId") String parentId);
 
     @Update(value = {" <script>" +
             "UPDATE wvp_platform_catalog " +
             "SET name=#{name}" +
             "WHERE id=#{id} and platform_id=#{platformId}"+
             "</script>"})
-    int update(PlatformCatalog platformCatalog);
+    int update(@Param("platformCatalog") PlatformCatalog platformCatalog);
 
     @Select("SELECT *, (SELECT COUNT(1) from wvp_platform_catalog where parent_id = pc.id) as children_count  from wvp_platform_catalog pc WHERE pc.platform_id=#{platformId}")
-    List<PlatformCatalog> selectByPlatForm(String platformId);
+    List<PlatformCatalog> selectByPlatForm(@Param("platformId") String platformId);
 
     @Select("SELECT pc.* FROM  wvp_platform_catalog pc WHERE pc.id = (SELECT pp.catalog_id from wvp_platform pp WHERE pp.server_gb_id=#{platformId})")
-    PlatformCatalog selectDefaultByPlatFormId(String platformId);
+    PlatformCatalog selectDefaultByPlatFormId(@Param("platformId") String platformId);
 
     @Select("SELECT pc.id as channel_id, pc.name, pc.civil_code, pc.business_group_id,'1' as parental, pc.parent_id  " +
             " from wvp_platform_catalog pc WHERE pc.platform_id=#{platformId}")
-    List<DeviceChannel> queryCatalogInPlatform(String platformId);
+    List<DeviceChannel> queryCatalogInPlatform(@Param("platformId") String platformId);
 
     @Select("SELECT *, " +
             "(SELECT COUNT(1) from wvp_platform_catalog where parent_id = pc.id) as children_count " +
             " from wvp_platform_catalog pc " +
             " WHERE pc.id=#{id} and pc.platform_id=#{platformId}")
-    PlatformCatalog selectByPlatFormAndCatalogId(String platformId, String id);
+    PlatformCatalog selectByPlatFormAndCatalogId(@Param("platformId") String platformId, @Param("id") String id);
 }

+ 12 - 11
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java

@@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
 import org.apache.ibatis.annotations.Delete;
 import org.apache.ibatis.annotations.Insert;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.springframework.stereotype.Repository;
 
@@ -24,7 +25,7 @@ public interface PlatformChannelMapper {
             "SELECT device_channel_id from wvp_platform_gb_channel WHERE platform_id=#{platformId} AND device_channel_id in" +
             "<foreach collection='channelReduces' open='(' item='item' separator=',' close=')'> #{item.id}</foreach>" +
             "</script>")
-    List<Integer> findChannelRelatedPlatform(String platformId, List<ChannelReduce> channelReduces);
+    List<Integer> findChannelRelatedPlatform(@Param("platformId") String platformId, @Param("channelReduces") List<ChannelReduce> channelReduces);
 
     @Insert("<script> "+
             "INSERT INTO wvp_platform_gb_channel (platform_id, device_channel_id, catalog_id) VALUES" +
@@ -32,13 +33,13 @@ public interface PlatformChannelMapper {
             " (#{platformId}, #{item.id} , #{item.catalogId} )" +
             "</foreach>" +
             "</script>")
-    int addChannels(String platformId, List<ChannelReduce> channelReducesToAdd);
+    int addChannels(@Param("platformId") String platformId, @Param("channelReducesToAdd") List<ChannelReduce> channelReducesToAdd);
 
     @Delete("<script> "+
             "DELETE from wvp_platform_gb_channel WHERE platform_id=#{platformId} AND device_channel_id in" +
             "<foreach collection='channelReducesToDel'  item='item'  open='(' separator=',' close=')' > #{item.id}</foreach>" +
             "</script>")
-    int delChannelForGB(String platformId, List<ChannelReduce> channelReducesToDel);
+    int delChannelForGB(@Param("platformId") String platformId, @Param("channelReducesToDel") List<ChannelReduce> channelReducesToDel);
 
     @Delete("<script> "+
             "DELETE from wvp_platform_gb_channel WHERE device_channel_id in " +
@@ -55,27 +56,27 @@ public interface PlatformChannelMapper {
     int cleanChannelForGB(String platformId);
 
     @Select("SELECT dc.* from wvp_platform_gb_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE dc.channel_id=#{channelId} and pgc.platform_id=#{platformId}")
-    List<DeviceChannel> queryChannelInParentPlatform(String platformId, String channelId);
+    List<DeviceChannel> queryChannelInParentPlatform(@Param("platformId") String platformId, @Param("channelId") String channelId);
 
     @Select("SELECT dc.* from wvp_platform_gb_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE pgc.platform_id=#{platformId} and pgc.catalog_id=#{catalogId}")
-    List<DeviceChannel> queryAllChannelInCatalog(String platformId, String catalogId);
+    List<DeviceChannel> queryAllChannelInCatalog(@Param("platformId") String platformId, @Param("catalogId") String catalogId);
 
     @Select(" select dc.channel_id as id, dc.name as name, pgc.platform_id as platform_id, pgc.catalog_id as parent_id, 0 as children_count, 1 as type " +
             " from wvp_device_channel dc left join wvp_platform_gb_channel pgc on dc.id = pgc.device_channel_id " +
             " where pgc.platform_id=#{platformId} and pgc.catalog_id=#{catalogId}")
-    List<PlatformCatalog> queryChannelInParentPlatformAndCatalog(String platformId, String catalogId);
+    List<PlatformCatalog> queryChannelInParentPlatformAndCatalog(@Param("platformId") String platformId, @Param("catalogId") String catalogId);
 
     @Select("select d.*\n" +
             "from wvp_platform_gb_channel pgc\n" +
             "         left join wvp_device_channel dc on dc.id = pgc.device_channel_id\n" +
             "         left join wvp_device d on dc.device_id = d.device_id\n" +
             "where dc.channel_id = #{channelId} and pgc.platform_id=#{platformId}")
-    List<Device> queryVideoDeviceByPlatformIdAndChannelId(String platformId, String channelId);
+    List<Device> queryVideoDeviceByPlatformIdAndChannelId(@Param("platformId") String platformId, @Param("channelId") String channelId);
 
     @Delete("<script> "+
             "DELETE from wvp_platform_gb_channel WHERE platform_id=#{platformId} and catalog_id=#{id}"  +
             "</script>")
-    int delByCatalogId(String platformId, String id);
+    int delByCatalogId(@Param("platformId") String platformId, @Param("id") String id);
 
     @Delete("<script> "+
            "DELETE from wvp_platform_gb_channel  WHERE catalog_id=#{parentId} AND platform_id=#{platformId} AND channel_id=#{id}"  +
@@ -96,7 +97,7 @@ public interface PlatformChannelMapper {
             "AND pp.server_gb_id IN" +
             "<foreach collection='platforms' item='item'  open='(' separator=',' close=')' > #{item}</foreach>" +
             "</script> ")
-    List<ParentPlatform> queryPlatFormListForGBWithGBId(String channelId, List<String> platforms);
+    List<ParentPlatform> queryPlatFormListForGBWithGBId(@Param("channelId") String channelId, @Param("platforms") List<String> platforms);
 
     @Delete("<script> " +
            "DELETE from wvp_platform_gb_channel WHERE platform_id=#{serverGBId}"  +
@@ -106,14 +107,14 @@ public interface PlatformChannelMapper {
     @Delete("<script> " +
             "DELETE from wvp_platform_gb_channel WHERE platform_id=#{platformId} and catalog_id=#{catalogId}"  +
             "</script>")
-    int delChannelForGBByCatalogId(String platformId, String catalogId);
+    int delChannelForGBByCatalogId(@Param("platformId") String platformId, @Param("catalogId") String catalogId);
 
     @Select("select dc.channel_id dc.device_id,dc.name,d.manufacturer,d.model,d.firmware\n" +
             "from wvp_platform_gb_channel pgc\n" +
             "         left join wvp_device_channel dc on dc.id = pgc.device_channel_id\n" +
             "         left join wvp_device d on dc.device_id = d.device_id\n" +
             "where dc.channel_id = #{channelId} and pgc.platform_id=#{platformId}")
-    List<Device> queryDeviceInfoByPlatformIdAndChannelId(String platformId, String channelId);
+    List<Device> queryDeviceInfoByPlatformIdAndChannelId(@Param("platformId") String platformId, @Param("channelId") String channelId);
 
     @Select("SELECT pgc.platform_id from wvp_platform_gb_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE dc.channel_id='${channelId}'")
     List<String> queryParentPlatformByChannelId(String channelId);

+ 9 - 9
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java

@@ -16,7 +16,7 @@ import java.util.List;
 @Repository
 public interface PlatformGbStreamMapper {
 
-    @Insert("REPLACE INTO wvp_platform_gb_stream (gb_stream_id, platform_id, catalog_id) VALUES" +
+    @Insert("INSERT INTO wvp_platform_gb_stream (gb_stream_id, platform_id, catalog_id) VALUES" +
             "( #{gbStreamId}, #{platformId}, #{catalogId})")
     int add(PlatformGbStream platformGbStream);
 
@@ -32,7 +32,7 @@ public interface PlatformGbStreamMapper {
     int batchAdd(List<StreamPushItem> streamPushItems);
 
     @Delete("DELETE from wvp_platform_gb_stream WHERE gb_stream_id = (select gb_stream_id from wvp_gb_stream where app=#{app} AND stream=#{stream})")
-    int delByAppAndStream(String app, String stream);
+    int delByAppAndStream(@Param("app") String app, @Param("stream") String stream);
 
     @Delete("DELETE from wvp_platform_gb_stream WHERE platform_id=#{platformId}")
     int delByPlatformId(String platformId);
@@ -46,26 +46,26 @@ public interface PlatformGbStreamMapper {
             "WHERE " +
             "gs.app =#{app} " +
             "AND gs.stream =#{stream} ")
-    List<ParentPlatform> selectByAppAndStream(String app, String stream);
+    List<ParentPlatform> selectByAppAndStream(@Param("app") String app, @Param("stream") String stream);
 
     @Select("SELECT pgs.*, gs.gb_id  from wvp_platform_gb_stream pgs " +
             "LEFT join wvp_gb_stream gs ON pgs.gb_stream_id = gs.gb_stream_id  " +
             "WHERE gs.app=#{app} AND gs.stream=#{stream} AND pgs.platform_id=#{platformId}")
-    StreamProxyItem selectOne(String app, String stream, String platformId);
+    StreamProxyItem selectOne(@Param("app") String app, @Param("stream") String stream, @Param("platformId") String platformId);
 
     @Select("select gs.* \n" +
             "from wvp_gb_stream gs\n" +
             "    left join wvp_platform_gb_stream pgs\n" +
             "        on gs.gb_stream_id = pgs.gb_stream_id\n" +
             "where pgs.platform_id=#{platformId} and pgs.catalog_id=#{catalogId}")
-    List<GbStream> queryChannelInParentPlatformAndCatalog(String platformId, String catalogId);
+    List<GbStream> queryChannelInParentPlatformAndCatalog(@Param("platformId") String platformId, @Param("catalogId") String catalogId);
 
     @Select("select gs.gb_id as id, gs.name as name, pgs.platform_id as platform_id, pgs.catalog_id as catalog_id , 0 as children_count, 2 as type\n" +
             "from wvp_gb_stream gs\n" +
             "    left join wvp_platform_gb_stream pgs\n" +
             "        on gs.gb_stream_id = pgs.gb_stream_id\n" +
             "where pgs.platform_id=#{platformId} and pgs.catalog_id=#{catalogId}")
-    List<PlatformCatalog> queryChannelInParentPlatformAndCatalogForCatalog(String platformId, String catalogId);
+    List<PlatformCatalog> queryChannelInParentPlatformAndCatalogForCatalog(@Param("platformId") String platformId, @Param("catalogId") String catalogId);
 
     @Select("<script> " +
             "SELECT " +
@@ -82,7 +82,7 @@ public interface PlatformGbStreamMapper {
             "AND pp.server_gb_id IN" +
             "<foreach collection='platforms'  item='item'  open='(' separator=',' close=')' > #{item}</foreach>" +
             "</script> ")
-    List<ParentPlatform> queryPlatFormListForGBWithGBId(String app, String stream, List<String> platforms);
+    List<ParentPlatform> queryPlatFormListForGBWithGBId(@Param("app") String app, @Param("stream") String stream, @Param("platforms") List<String> platforms);
 
     @Delete("DELETE from wvp_platform_gb_stream WHERE gb_stream_id = (select id from wvp_gb_stream where app=#{app} AND stream=#{stream}) AND platform_id=#{platformId}")
     int delByAppAndStreamAndPlatform(String app, String stream, String platformId);
@@ -101,8 +101,8 @@ public interface PlatformGbStreamMapper {
             "#{item.gbStreamId} " +
             "</foreach>" +
             "</script>")
-    void delByAppAndStreamsByPlatformId(List<GbStream> gbStreams, String platformId);
+    void delByAppAndStreamsByPlatformId(@Param("gbStreams") List<GbStream> gbStreams, @Param("platformId") String platformId);
 
     @Delete("DELETE from wvp_platform_gb_stream WHERE platform_id=#{platformId} and catalog_id=#{catalogId}")
-    int delByPlatformAndCatalogId(String platformId, String catalogId);
+    int delByPlatformAndCatalogId(@Param("platformId") String platformId, @Param("catalogId") String catalogId);
 }

+ 4 - 4
src/main/java/com/genersoft/iot/vmp/storager/dao/StreamProxyMapper.java

@@ -49,12 +49,12 @@ public interface StreamProxyMapper {
     List<StreamProxyItem> selectForEnable(boolean enable);
 
     @Select("SELECT st.*, pgs.gb_id, pgs.name, pgs.longitude, pgs.latitude FROM wvp_stream_proxy st LEFT join wvp_gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream WHERE st.app=#{app} AND st.stream=#{stream} order by st.create_time desc")
-    StreamProxyItem selectOne(String app, String stream);
+    StreamProxyItem selectOne(@Param("app") String app, @Param("stream") String stream);
 
     @Select("SELECT st.*, pgs.gb_id, pgs.name, pgs.longitude, pgs.latitude FROM wvp_stream_proxy st " +
             "LEFT join wvp_gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream " +
             "WHERE st.enable=#{enable} and st.media_server_id= #{id} order by st.create_time desc")
-    List<StreamProxyItem> selectForEnableInMediaServer(String id, boolean enable);
+    List<StreamProxyItem> selectForEnableInMediaServer( @Param("id")  String id, @Param("enable") boolean enable);
 
     @Select("SELECT st.*, pgs.gb_id, pgs.name, pgs.longitude, pgs.latitude FROM wvp_stream_proxy st " +
             "LEFT join wvp_gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream " +
@@ -64,12 +64,12 @@ public interface StreamProxyMapper {
     @Update("UPDATE wvp_stream_proxy " +
             "SET status=#{status} " +
             "WHERE media_server_id=#{mediaServerId}")
-    void updateStatusByMediaServerId(String mediaServerId, boolean status);
+    void updateStatusByMediaServerId(@Param("mediaServerId") String mediaServerId, @Param("status") boolean status);
 
     @Update("UPDATE wvp_stream_proxy " +
             "SET status=#{status} " +
             "WHERE app=#{app} AND stream=#{stream}")
-    int updateStatus(String app, String stream, boolean status);
+    int updateStatus(@Param("app") String app, @Param("stream") String stream, @Param("status") boolean status);
 
     @Delete("DELETE FROM wvp_stream_proxy WHERE enable_remove_none_reader=true AND media_server_id=#{mediaServerId}")
     void deleteAutoRemoveItemByMediaServerId(String mediaServerId);

+ 5 - 5
src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java

@@ -79,13 +79,13 @@ public interface StreamPushMapper {
             " <if test='mediaServerId != null' > AND st.media_server_id=#{mediaServerId} </if>" +
             "order by st.create_time desc" +
             " </script>"})
-    List<StreamPushItem> selectAllForList(String query, Boolean pushing, String mediaServerId);
+    List<StreamPushItem> selectAllForList(@Param("query") String query, @Param("pushing") Boolean pushing, @Param("mediaServerId") String mediaServerId);
 
     @Select("SELECT st.*, gs.gb_id, gs.name, gs.longitude, gs.latitude FROM wvp_stream_push st LEFT join wvp_gb_stream gs on st.app = gs.app AND st.stream = gs.stream order by st.create_time desc")
     List<StreamPushItem> selectAll();
 
     @Select("SELECT st.*, gs.gb_id, gs.name, gs.longitude, gs.latitude FROM wvp_stream_push st LEFT join wvp_gb_stream gs on st.app = gs.app AND st.stream = gs.stream WHERE st.app=#{app} AND st.stream=#{stream}")
-    StreamPushItem selectOne(String app, String stream);
+    StreamPushItem selectOne(@Param("app") String app, @Param("stream") String stream);
 
     @Insert("<script>"  +
             "Insert INTO wvp_stream_push (app, stream, total_reader_count, origin_type, origin_type_str, " +
@@ -122,17 +122,17 @@ public interface StreamPushMapper {
     @Update("UPDATE wvp_stream_push " +
             "SET status=#{status} " +
             "WHERE app=#{app} AND stream=#{stream}")
-    int updateStatus(String app, String stream, boolean status);
+    int updateStatus(@Param("app") String app, @Param("stream") String stream, @Param("status") boolean status);
 
     @Update("UPDATE wvp_stream_push " +
             "SET push_ing=#{pushIng} " +
             "WHERE app=#{app} AND stream=#{stream}")
-    int updatePushStatus(String app, String stream, boolean pushIng);
+    int updatePushStatus(@Param("app") String app, @Param("stream") String stream, @Param("pushIng") boolean pushIng);
 
     @Update("UPDATE wvp_stream_push " +
             "SET status=#{status} " +
             "WHERE media_server_id=#{mediaServerId}")
-    void updateStatusByMediaServerId(String mediaServerId, boolean status);
+    void updateStatusByMediaServerId(@Param("mediaServerId") String mediaServerId, @Param("status") boolean status);
 
 
     @Select("<script> "+

+ 3 - 2
src/main/java/com/genersoft/iot/vmp/storager/dao/UserMapper.java

@@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.storager.dao;
 
 import com.genersoft.iot.vmp.storager.dao.dto.User;
 import org.apache.ibatis.annotations.*;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
@@ -36,7 +37,7 @@ public interface UserMapper {
             @Result(column = "role_create_time", property = "role.createTime"),
             @Result(column = "role_update_time", property = "role.updateTime")
     })
-    User select(String username, String password);
+    User select(@Param("username") String username, @Param("password") String password);
 
     @Select("select u.*, r.id as role_id, r.name as role_name, r.authority as role_authority , r.create_time as role_create_time , r.update_time as role_update_time from wvp_user u, wvp_user_role r WHERE u.role_id=r.id and u.id=#{id}")
     @ResultMap(value="roleMap")
@@ -55,5 +56,5 @@ public interface UserMapper {
     List<User> getUsers();
 
     @Update("UPDATE wvp_user set push_key=#{pushKey} where id=#{id}")
-    int changePushKey(int id, String pushKey);
+    int changePushKey(@Param("id") int id, @Param("pushKey") String pushKey);
 }

+ 36 - 25
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java

@@ -179,9 +179,19 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
 			return false;
 		}
 		try {
-			int cleanChannelsResult = deviceChannelMapper.cleanChannelsNotInList(deviceId, channels);
-
-			int limitCount = 300;
+			int limitCount = 50;
+			int cleanChannelsResult = 0;
+			if (channels.size() > limitCount) {
+				for (int i = 0; i < channels.size(); i += limitCount) {
+					int toIndex = i + limitCount;
+					if (i + limitCount > channels.size()) {
+						toIndex = channels.size();
+					}
+					cleanChannelsResult += this.deviceChannelMapper.cleanChannelsNotInList(deviceId, channels.subList(i, toIndex));
+				}
+			} else {
+				cleanChannelsResult = this.deviceChannelMapper.cleanChannelsNotInList(deviceId, channels);
+			}
 			boolean result = cleanChannelsResult < 0;
 			if (!result && addChannels.size() > 0) {
 				if (addChannels.size() > limitCount) {
@@ -237,12 +247,12 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
 				allChannelMap.put(deviceChannel.getChannelId(), deviceChannel);
 			}
 		}
-		List<DeviceChannel> addChannels = new ArrayList<>();
-		List<DeviceChannel> updateChannels = new ArrayList<>();
-
-
 		TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition);
 		// 数据去重
+		List<DeviceChannel> channels = new ArrayList<>();
+
+		List<DeviceChannel> updateChannels = new ArrayList<>();
+		List<DeviceChannel> addChannels = new ArrayList<>();
 		StringBuilder stringBuilder = new StringBuilder();
 		Map<String, Integer> subContMap = new HashMap<>();
 		if (deviceChannelList.size() > 0) {
@@ -251,15 +261,24 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
 			for (DeviceChannel deviceChannel : deviceChannelList) {
 				if (!gbIdSet.contains(deviceChannel.getChannelId())) {
 					gbIdSet.add(deviceChannel.getChannelId());
+					deviceChannel.setUpdateTime(DateUtil.getNow());
 					if (allChannelMap.containsKey(deviceChannel.getChannelId())) {
 						deviceChannel.setStreamId(allChannelMap.get(deviceChannel.getChannelId()).getStreamId());
 						deviceChannel.setHasAudio(allChannelMap.get(deviceChannel.getChannelId()).isHasAudio());
-						deviceChannel.setUpdateTime(DateUtil.getNow());
+						if (allChannelMap.get(deviceChannel.getChannelId()).isStatus() !=deviceChannel.isStatus()){
+							List<String> strings = platformChannelMapper.queryParentPlatformByChannelId(deviceChannel.getChannelId());
+							if (!CollectionUtils.isEmpty(strings)){
+								strings.forEach(platformId->{
+									eventPublisher.catalogEventPublish(platformId, deviceChannel, deviceChannel.isStatus()?CatalogEvent.ON:CatalogEvent.OFF);
+								});
+							}
+						}
 						updateChannels.add(deviceChannel);
 					}else {
 						deviceChannel.setCreateTime(DateUtil.getNow());
 						addChannels.add(deviceChannel);
 					}
+					channels.add(deviceChannel);
 					if (!ObjectUtils.isEmpty(deviceChannel.getParentId())) {
 						if (subContMap.get(deviceChannel.getParentId()) == null) {
 							subContMap.put(deviceChannel.getParentId(), 1);
@@ -272,15 +291,8 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
 					stringBuilder.append(deviceChannel.getChannelId()).append(",");
 				}
 			}
-			if (addChannels.size() > 0) {
-				for (DeviceChannel channel : addChannels) {
-					if (subContMap.get(channel.getChannelId()) != null){
-						channel.setSubCount(subContMap.get(channel.getChannelId()));
-					}
-				}
-			}
-			if (updateChannels.size() > 0) {
-				for (DeviceChannel channel : updateChannels) {
+			if (channels.size() > 0) {
+				for (DeviceChannel channel : channels) {
 					if (subContMap.get(channel.getChannelId()) != null){
 						channel.setSubCount(subContMap.get(channel.getChannelId()));
 					}
@@ -291,12 +303,12 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
 		if (stringBuilder.length() > 0) {
 			logger.info("[目录查询]收到的数据存在重复: {}" , stringBuilder);
 		}
-		if(CollectionUtils.isEmpty(updateChannels) && CollectionUtils.isEmpty(addChannels) ){
-			logger.info("通道更新,数据为空={}" , deviceChannelList);
+		if(CollectionUtils.isEmpty(channels)){
+			logger.info("通道重设,数据为空={}" , deviceChannelList);
 			return false;
 		}
 		try {
-			int limitCount = 300;
+			int limitCount = 50;
 			boolean result = false;
 			if (addChannels.size() > 0) {
 				if (addChannels.size() > limitCount) {
@@ -305,10 +317,10 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
 						if (i + limitCount > addChannels.size()) {
 							toIndex = addChannels.size();
 						}
-						result = result || deviceChannelMapper.batchAddOrUpdate(addChannels.subList(i, toIndex)) < 0;
+						result = result || deviceChannelMapper.batchAdd(addChannels.subList(i, toIndex)) < 0;
 					}
 				}else {
-					result = result || deviceChannelMapper.batchAddOrUpdate(addChannels) < 0;
+					result = result || deviceChannelMapper.batchAdd(addChannels) < 0;
 				}
 			}
 			if (updateChannels.size() > 0) {
@@ -324,13 +336,12 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
 					result = result || deviceChannelMapper.batchUpdate(updateChannels) < 0;
 				}
 			}
+
 			if (result) {
 				//事务回滚
 				dataSourceTransactionManager.rollback(transactionStatus);
-			}else {
-				//手动提交
-				dataSourceTransactionManager.commit(transactionStatus);
 			}
+			dataSourceTransactionManager.commit(transactionStatus);     //手动提交
 			return true;
 		}catch (Exception e) {
 			logger.error("未处理的异常 ", e);

+ 11 - 1
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java

@@ -41,6 +41,8 @@ import org.springframework.web.context.request.async.DeferredResult;
 import javax.servlet.http.HttpServletRequest;
 import javax.sip.InvalidArgumentException;
 import javax.sip.SipException;
+import java.net.MalformedURLException;
+import java.net.URL;
 import java.text.ParseException;
 import java.util.List;
 import java.util.UUID;
@@ -133,7 +135,15 @@ public class PlayController {
 				if (data != null) {
 					StreamInfo streamInfo = (StreamInfo)data;
 					if (userSetting.getUseSourceIpAsStreamIp()) {
-						streamInfo.channgeStreamIp(request.getLocalAddr());
+						streamInfo=streamInfo.clone();//深拷贝
+						String host;
+						try {
+							URL url=new URL(request.getRequestURL().toString());
+							host=url.getHost();
+						} catch (MalformedURLException e) {
+							host=request.getLocalAddr();
+						}
+						streamInfo.channgeStreamIp(host);
 					}
 					wvpResult.setData(new StreamContent(streamInfo));
 				}

+ 11 - 1
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java

@@ -34,6 +34,8 @@ import org.springframework.web.context.request.async.DeferredResult;
 import javax.servlet.http.HttpServletRequest;
 import javax.sip.InvalidArgumentException;
 import javax.sip.SipException;
+import java.net.MalformedURLException;
+import java.net.URL;
 import java.text.ParseException;
 import java.util.UUID;
 
@@ -99,7 +101,15 @@ public class PlaybackController {
 						if (data != null) {
 							StreamInfo streamInfo = (StreamInfo)data;
 							if (userSetting.getUseSourceIpAsStreamIp()) {
-								streamInfo.channgeStreamIp(request.getLocalAddr());
+								streamInfo=streamInfo.clone();//深拷贝
+								String host;
+								try {
+									URL url=new URL(request.getRequestURL().toString());
+									host=url.getHost();
+								} catch (MalformedURLException e) {
+									host=request.getLocalAddr();
+								}
+								streamInfo.channgeStreamIp(host);
 							}
 							wvpResult.setData(new StreamContent(streamInfo));
 						}

+ 1 - 1
src/main/resources/application.yml

@@ -2,4 +2,4 @@ spring:
   application:
     name: wvp
   profiles:
-    active: dev
+    active: local

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 315 - 234
web_src/package-lock.json


+ 1 - 0
web_src/src/components/GBRecordDetail.vue

@@ -261,6 +261,7 @@
               this.mediaServerId = this.streamInfo.mediaServerId;
               this.ssrc = this.streamInfo.ssrc;
               this.videoUrl = this.getUrlByStreamInfo();
+              this.hasAudio = this.streamInfo.tracks && this.streamInfo.tracks.length > 1
             }else {
               this.$message({
                 showClose: true,

Vissa filer visades inte eftersom för många filer har ändrats