临时提交

pull/1642/head
648540858 2024-07-10 10:51:35 +08:00
parent e73fb64283
commit bb609b7e09
10 changed files with 345 additions and 339 deletions

View File

@ -55,7 +55,7 @@ public interface CommonGBChannelMapper {
" coalesce(gb_business_group_id, business_group_id) as gb_business_group_id,\n" + " coalesce(gb_business_group_id, business_group_id) as gb_business_group_id,\n" +
" coalesce(gb_download_speed, download_speed) as gb_download_speed,\n" + " coalesce(gb_download_speed, download_speed) as gb_download_speed,\n" +
" coalesce(gb_svc_space_support_mod, svc_space_support_mod) as gb_svc_space_support_mod,\n" + " coalesce(gb_svc_space_support_mod, svc_space_support_mod) as gb_svc_space_support_mod,\n" +
" coalesce(gb_svc_time_support_mode svc_time_support_mode) as gb_svc_time_support_mode\n" + " coalesce(gb_svc_time_support_mode,svc_time_support_mode) as gb_svc_time_support_mode\n" +
"from wvp_device_channel\n" + "from wvp_device_channel\n" +
"where gb_device_id = #{gbDeviceId} or device_id = #{gbDeviceId}") "where gb_device_id = #{gbDeviceId} or device_id = #{gbDeviceId}")
CommonGBChannel queryByDeviceId(@Param("gbDeviceId") String gbDeviceId); CommonGBChannel queryByDeviceId(@Param("gbDeviceId") String gbDeviceId);
@ -198,7 +198,7 @@ public interface CommonGBChannelMapper {
" coalesce(gb_business_group_id, business_group_id) as gb_business_group_id,\n" + " coalesce(gb_business_group_id, business_group_id) as gb_business_group_id,\n" +
" coalesce(gb_download_speed, download_speed) as gb_download_speed,\n" + " coalesce(gb_download_speed, download_speed) as gb_download_speed,\n" +
" coalesce(gb_svc_space_support_mod, svc_space_support_mod) as gb_svc_space_support_mod,\n" + " coalesce(gb_svc_space_support_mod, svc_space_support_mod) as gb_svc_space_support_mod,\n" +
" coalesce(gb_svc_time_support_mode svc_time_support_mode) as gb_svc_time_support_mode\n" + " coalesce(gb_svc_time_support_mode, svc_time_support_mode) as gb_svc_time_support_mode\n" +
" from wvp_device_channel" + " from wvp_device_channel" +
" where id = #{gbId}") " where id = #{gbId}")
CommonGBChannel queryById(@Param("gbId") int gbId); CommonGBChannel queryById(@Param("gbId") int gbId);
@ -355,7 +355,7 @@ public interface CommonGBChannelMapper {
" coalesce(gb_business_group_id, business_group_id) as gb_business_group_id,\n" + " coalesce(gb_business_group_id, business_group_id) as gb_business_group_id,\n" +
" coalesce(gb_download_speed, download_speed) as gb_download_speed,\n" + " coalesce(gb_download_speed, download_speed) as gb_download_speed,\n" +
" coalesce(gb_svc_space_support_mod, svc_space_support_mod) as gb_svc_space_support_mod,\n" + " coalesce(gb_svc_space_support_mod, svc_space_support_mod) as gb_svc_space_support_mod,\n" +
" coalesce(gb_svc_time_support_mode svc_time_support_mode) as gb_svc_time_support_mode\n" + " coalesce(gb_svc_time_support_mode,svc_time_support_mode) as gb_svc_time_support_mode\n" +
" from wvp_device_channel" + " from wvp_device_channel" +
" where gb_status=#{status} and id in " + " where gb_status=#{status} and id in " +
" <foreach collection='commonGBChannelList' item='item' open='(' separator=',' close=')' > #{item.gbId}</foreach>" + " <foreach collection='commonGBChannelList' item='item' open='(' separator=',' close=')' > #{item.gbId}</foreach>" +
@ -471,7 +471,7 @@ public interface CommonGBChannelMapper {
" coalesce(wpgc.business_group_id, wdc.gb_business_group_id, wdc.business_group_id) as gb_business_group_id,\n" + " coalesce(wpgc.business_group_id, wdc.gb_business_group_id, wdc.business_group_id) as gb_business_group_id,\n" +
" coalesce(wdc.gb_download_speed, wdc.download_speed) as gb_download_speed,\n" + " coalesce(wdc.gb_download_speed, wdc.download_speed) as gb_download_speed,\n" +
" coalesce(wdc.gb_svc_space_support_mod, wdc.svc_space_support_mod) as gb_svc_space_support_mod,\n" + " coalesce(wdc.gb_svc_space_support_mod, wdc.svc_space_support_mod) as gb_svc_space_support_mod,\n" +
" coalesce(wdc.gb_svc_time_support_mode wdc.svc_time_support_mode) as gb_svc_time_support_mode\n" + " coalesce(wdc.gb_svc_time_support_mode,wdc.svc_time_support_mode) as gb_svc_time_support_mode\n" +
"from wvp_device_channel wdc left join wvp_platform_gb_channel wpgc on wdc.id = wpgc.device_channel_id\n" + "from wvp_device_channel wdc left join wvp_platform_gb_channel wpgc on wdc.id = wpgc.device_channel_id\n" +
"where wpgc.platform_id = #{platformId}"}) "where wpgc.platform_id = #{platformId}"})
List<CommonGBChannel> queryByPlatformId(@Param("platformId") Integer platformId); List<CommonGBChannel> queryByPlatformId(@Param("platformId") Integer platformId);

View File

@ -17,12 +17,12 @@ import java.util.List;
@Repository @Repository
public interface DeviceChannelMapper { public interface DeviceChannelMapper {
@Insert("INSERT INTO wvp_device_channel (device_id, device_db_id, name, manufacture, model, owner, civil_code, block, " + @Insert("INSERT INTO wvp_device_channel (device_id, device_db_id, name, manufacturer, model, owner, civil_code, block, " +
"address, parental, parent_id, safety_way, register_way, cert_num, certifiable, err_code, end_time, secrecy, " + "address, parental, parent_id, safety_way, register_way, cert_num, certifiable, err_code, end_time, secrecy, " +
"ip_address, port, password, status, longitude, latitude, ptz_type, position_type, room_type, use_type, " + "ip_address, port, password, status, longitude, latitude, ptz_type, position_type, room_type, use_type, " +
"supply_light_type, direction_type, resolution, business_group_id, download_speed, svc_space_support_mod, " + "supply_light_type, direction_type, resolution, business_group_id, download_speed, svc_space_support_mod, " +
"svc_time_support_mode, create_time, update_time, sub_countstream_id, has_audio, gps_time, stream_identification) " + "svc_time_support_mode, create_time, update_time, sub_countstream_id, has_audio, gps_time, stream_identification) " +
"VALUES (#{deviceId}, #{deviceDbId}, #{name}, #{manufacture}, #{model}, #{owner}, #{civilCode}, #{block}," + "VALUES (#{deviceId}, #{deviceDbId}, #{name}, #{manufacturer}, #{model}, #{owner}, #{civilCode}, #{block}," +
"#{address}, #{parental}, #{parentId}, #{safetyWay}, #{registerWay}, #{certNum}, #{certifiable}, #{errCode}, #{endTime}, #{secrecy}, " + "#{address}, #{parental}, #{parentId}, #{safetyWay}, #{registerWay}, #{certNum}, #{certifiable}, #{errCode}, #{endTime}, #{secrecy}, " +
"#{ipAddress}, #{port}, #{password}, #{status}, #{longitude}, #{latitude}, #{ptzType}, #{positionType}, #{roomType}, #{useType}, " + "#{ipAddress}, #{port}, #{password}, #{status}, #{longitude}, #{latitude}, #{ptzType}, #{positionType}, #{roomType}, #{useType}, " +
"#{supplyLightType}, #{directionType}, #{resolution}, #{businessGroupId}, #{downloadSpeed}, #{svcSpaceSupportMod}," + "#{supplyLightType}, #{directionType}, #{resolution}, #{businessGroupId}, #{downloadSpeed}, #{svcSpaceSupportMod}," +
@ -35,7 +35,7 @@ public interface DeviceChannelMapper {
", device_id=#{deviceId}" + ", device_id=#{deviceId}" +
", device_db_id=#{deviceDbId}" + ", device_db_id=#{deviceDbId}" +
", name=#{name}" + ", name=#{name}" +
", manufacture=#{manufacture}" + ", manufacturer#{manufacturer}" +
", model=#{model}" + ", model=#{model}" +
", owner=#{owner}" + ", owner=#{owner}" +
", civil_code=#{civilCode}" + ", civil_code=#{civilCode}" +
@ -159,14 +159,14 @@ public interface DeviceChannelMapper {
" coalesce(dc.gb_business_group_id, dc.business_group_id) as business_group_id,\n" + " coalesce(dc.gb_business_group_id, dc.business_group_id) as business_group_id,\n" +
" coalesce(dc.gb_download_speed, dc.download_speed) as download_speed,\n" + " coalesce(dc.gb_download_speed, dc.download_speed) as download_speed,\n" +
" coalesce(dc.gb_svc_space_support_mod, dc.svc_space_support_mod) as svc_space_support_mod,\n" + " coalesce(dc.gb_svc_space_support_mod, dc.svc_space_support_mod) as svc_space_support_mod,\n" +
" coalesce(dc.gb_svc_time_support_mode dc.svc_time_support_mode) as svc_time_support_mode\n" + " coalesce(dc.gb_svc_time_support_mode,dc.svc_time_support_mode) as svc_time_support_mode\n" +
" from " + " from " +
" wvp_device_channel dc " + " wvp_device_channel dc " +
" left join wvp_device d on d.id=dc.device_db_id" + " left join wvp_device d on d.id=dc.device_db_id" +
" WHERE " + " WHERE " +
" d.device_id = #{deviceId} " + " d.device_id = #{deviceId} " +
" <if test='query != null'> AND (" + " <if test='query != null'> AND (" +
"dc.channel_id LIKE concat('%',#{query},'%') " + "dc.device_id LIKE concat('%',#{query},'%') " +
"OR dc.name LIKE concat('%',#{query},'%') " + "OR dc.name LIKE concat('%',#{query},'%') " +
"OR dc.custom_name LIKE concat('%',#{query},'%')" + "OR dc.custom_name LIKE concat('%',#{query},'%')" +
")</if> " + ")</if> " +
@ -178,7 +178,7 @@ public interface DeviceChannelMapper {
"<if test='channelIds != null'> AND dc.device_id in <foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'>" + "<if test='channelIds != null'> AND dc.device_id in <foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'>" +
"#{item} " + "#{item} " +
"</foreach> </if>" + "</foreach> </if>" +
"ORDER BY dc.channel_id " + "ORDER BY dc.device_id " +
" </script>"}) " </script>"})
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); 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);
@ -226,7 +226,7 @@ public interface DeviceChannelMapper {
" coalesce(gb_business_group_id, business_group_id) as business_group_id,\n" + " coalesce(gb_business_group_id, business_group_id) as business_group_id,\n" +
" coalesce(gb_download_speed, download_speed) as download_speed,\n" + " coalesce(gb_download_speed, download_speed) as download_speed,\n" +
" coalesce(gb_svc_space_support_mod, svc_space_support_mod) as svc_space_support_mod,\n" + " coalesce(gb_svc_space_support_mod, svc_space_support_mod) as svc_space_support_mod,\n" +
" coalesce(gb_svc_time_support_mode svc_time_support_mode) as svc_time_support_mode\n" + " coalesce(gb_svc_time_support_mode,svc_time_support_mode) as svc_time_support_mode\n" +
"from wvp_device_channel\n" + "from wvp_device_channel\n" +
"where device_db_id = #{deviceDbId}") "where device_db_id = #{deviceDbId}")
List<DeviceChannel> queryChannelsByDeviceDbId(@Param("deviceDbId") int deviceDbId); List<DeviceChannel> queryChannelsByDeviceDbId(@Param("deviceDbId") int deviceDbId);
@ -242,7 +242,7 @@ public interface DeviceChannelMapper {
"LEFT JOIN wvp_device de ON dc.device_db_id = de.id " + "LEFT JOIN wvp_device de ON dc.device_db_id = de.id " +
"WHERE 1=1" + "WHERE 1=1" +
" <if test='deviceId != null'> AND de.device_id = #{deviceId} </if> " + " <if test='deviceId != null'> AND de.device_id = #{deviceId} </if> " +
" <if test='query != null'> AND (dc.channel_id LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " + " <if test='query != null'> AND (dc.device_id LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " +
" <if test='parentChannelId != null'> AND dc.parent_id=#{parentChannelId} </if> " + " <if test='parentChannelId != null'> AND dc.parent_id=#{parentChannelId} </if> " +
" <if test='online == true' > AND dc.status=1</if>" + " <if test='online == true' > AND dc.status=1</if>" +
" <if test='online == false' > AND dc.status=0</if>" + " <if test='online == false' > AND dc.status=0</if>" +
@ -251,7 +251,7 @@ public interface DeviceChannelMapper {
"<if test='channelIds != null'> AND dc.device_id in <foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'>" + "<if test='channelIds != null'> AND dc.device_id in <foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'>" +
"#{item} " + "#{item} " +
"</foreach> </if>" + "</foreach> </if>" +
"ORDER BY dc.channel_id ASC" + "ORDER BY dc.device_id ASC" +
" </script>"}) " </script>"})
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); 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);
@ -297,7 +297,7 @@ public interface DeviceChannelMapper {
" coalesce(dc.gb_business_group_id, dc.business_group_id) as business_group_id,\n" + " coalesce(dc.gb_business_group_id, dc.business_group_id) as business_group_id,\n" +
" coalesce(dc.gb_download_speed, dc.download_speed) as download_speed,\n" + " coalesce(dc.gb_download_speed, dc.download_speed) as download_speed,\n" +
" coalesce(dc.gb_svc_space_support_mod, dc.svc_space_support_mod) as svc_space_support_mod,\n" + " coalesce(dc.gb_svc_space_support_mod, dc.svc_space_support_mod) as svc_space_support_mod,\n" +
" coalesce(dc.gb_svc_time_support_mode dc.svc_time_support_mode) as svc_time_support_mode\n" + " coalesce(dc.gb_svc_time_support_mode,dc.svc_time_support_mode) as svc_time_support_mode\n" +
" FROM wvp_device_channel dc " + " FROM wvp_device_channel dc " +
" left join wvp_device d on d.id=dc.device_db_id" + " left join wvp_device d on d.id=dc.device_db_id" +
" WHERE d.device_id=#{deviceId} AND dc.device_id=#{channelId}") " WHERE d.device_id=#{deviceId} AND dc.device_id=#{channelId}")
@ -387,7 +387,7 @@ public interface DeviceChannelMapper {
" coalesce(gb_business_group_id, business_group_id) as business_group_id,\n" + " coalesce(gb_business_group_id, business_group_id) as business_group_id,\n" +
" coalesce(gb_download_speed, download_speed) as download_speed,\n" + " coalesce(gb_download_speed, download_speed) as download_speed,\n" +
" coalesce(gb_svc_space_support_mod, svc_space_support_mod) as svc_space_support_mod,\n" + " coalesce(gb_svc_space_support_mod, svc_space_support_mod) as svc_space_support_mod,\n" +
" coalesce(gb_svc_time_support_mode svc_time_support_mode) as svc_time_support_mode\n" + " coalesce(gb_svc_time_support_mode,svc_time_support_mode) as svc_time_support_mode\n" +
" FROM wvp_device_channel WHERE device_id=#{channelId}") " FROM wvp_device_channel WHERE device_id=#{channelId}")
List<DeviceChannel> queryChannelByChannelId(@Param("channelId") String channelId); List<DeviceChannel> queryChannelByChannelId(@Param("channelId") String channelId);
@ -396,14 +396,14 @@ public interface DeviceChannelMapper {
@Insert("<script> " + @Insert("<script> " +
"insert into wvp_device_channel " + "insert into wvp_device_channel " +
"(device_id, device_db_id, name, manufacture, model, owner, civil_code, block, " + "(device_id, device_db_id, name, manufacturer, model, owner, civil_code, block, " +
"address, parental, parent_id, safety_way, register_way, cert_num, certifiable, err_code, end_time, secrecy, " + "address, parental, parent_id, safety_way, register_way, cert_num, certifiable, err_code, end_time, secrecy, " +
"ip_address, port, password, status, longitude, latitude, ptz_type, position_type, room_type, use_type, " + "ip_address, port, password, status, longitude, latitude, ptz_type, position_type, room_type, use_type, " +
"supply_light_type, direction_type, resolution, business_group_id, download_speed, svc_space_support_mod, " + "supply_light_type, direction_type, resolution, business_group_id, download_speed, svc_space_support_mod, " +
"svc_time_support_mode, create_time, update_time, sub_countstream_id, has_audio, gps_time, stream_identification) " + "svc_time_support_mode, create_time, update_time, sub_count, stream_id, has_audio, gps_time, stream_identification) " +
"values " + "values " +
"<foreach collection='addChannels' index='index' item='item' separator=','> " + "<foreach collection='addChannels' index='index' item='item' separator=','> " +
"(#{item.deviceId}, #{item.deviceDbId}, #{item.name}, #{item.manufacture}, #{item.model}, #{item.owner}, #{item.civilCode}, #{item.block}, " + "(#{item.deviceId}, #{item.deviceDbId}, #{item.name}, #{item.manufacturer}, #{item.model}, #{item.owner}, #{item.civilCode}, #{item.block}, " +
"#{item.address}, #{item.parental}, #{item.parentId}, #{item.safetyWay}, #{item.registerWay}, #{item.certNum}, #{item.certifiable}, #{item.errCode}, #{item.endTime}, #{item.secrecy}, " + "#{item.address}, #{item.parental}, #{item.parentId}, #{item.safetyWay}, #{item.registerWay}, #{item.certNum}, #{item.certifiable}, #{item.errCode}, #{item.endTime}, #{item.secrecy}, " +
"#{item.ipAddress}, #{item.port}, #{item.password}, #{item.status}, #{item.longitude}, #{item.latitude}, #{item.ptzType}, #{item.positionType}, #{item.roomType}, #{item.useType}, " + "#{item.ipAddress}, #{item.port}, #{item.password}, #{item.status}, #{item.longitude}, #{item.latitude}, #{item.ptzType}, #{item.positionType}, #{item.roomType}, #{item.useType}, " +
"#{item.supplyLightType}, #{item.directionType}, #{item.resolution}, #{item.businessGroupId}, #{item.downloadSpeed}, #{item.svcSpaceSupportMod}," + "#{item.supplyLightType}, #{item.directionType}, #{item.resolution}, #{item.businessGroupId}, #{item.downloadSpeed}, #{item.svcSpaceSupportMod}," +
@ -424,7 +424,7 @@ public interface DeviceChannelMapper {
", device_id=#{item.deviceId}" + ", device_id=#{item.deviceId}" +
", device_db_id=#{item.deviceDbId}" + ", device_db_id=#{item.deviceDbId}" +
", name=#{item.name}" + ", name=#{item.name}" +
", manufacture=#{item.manufacture}" + ", manufacturer=#{item.manufacturer}" +
", model=#{item.model}" + ", model=#{item.model}" +
", owner=#{item.owner}" + ", owner=#{item.owner}" +
", civil_code=#{item.civilCode}" + ", civil_code=#{item.civilCode}" +
@ -527,11 +527,11 @@ public interface DeviceChannelMapper {
" coalesce(gb_business_group_id, business_group_id) as business_group_id,\n" + " coalesce(gb_business_group_id, business_group_id) as business_group_id,\n" +
" coalesce(gb_download_speed, download_speed) as download_speed,\n" + " coalesce(gb_download_speed, download_speed) as download_speed,\n" +
" coalesce(gb_svc_space_support_mod, svc_space_support_mod) as svc_space_support_mod,\n" + " coalesce(gb_svc_space_support_mod, svc_space_support_mod) as svc_space_support_mod,\n" +
" coalesce(gb_svc_time_support_mode svc_time_support_mode) as svc_time_support_mode\n" + " coalesce(gb_svc_time_support_mode, svc_time_support_mode) as svc_time_support_mode\n" +
" from wvp_device_channel where device_db_id = #{deviceDbId}") " from wvp_device_channel where device_db_id = #{deviceDbId}")
List<DeviceChannel> queryAllChannels(@Param("deviceDbId") int deviceDbId); List<DeviceChannel> queryAllChannels(@Param("deviceDbId") int deviceDbId);
@Select("select de.* from wvp_device de left join wvp_device_channel dc on de.device_id = dc.deviceId where dc.channel_id=#{channelId}") @Select("select de.* from wvp_device de left join wvp_device_channel dc on de.device_id = dc.deviceId where dc.device_id=#{channelId}")
List<Device> getDeviceByChannelId(String channelId); List<Device> getDeviceByChannelId(String channelId);

View File

@ -15,6 +15,7 @@ import java.util.List;
public interface DeviceMapper { public interface DeviceMapper {
@Select("SELECT " + @Select("SELECT " +
"id, " +
"device_id, " + "device_id, " +
"coalesce(custom_name, name) as name, " + "coalesce(custom_name, name) as name, " +
"password, " + "password, " +
@ -44,8 +45,8 @@ public interface DeviceMapper {
"on_line," + "on_line," +
"media_server_id," + "media_server_id," +
"broadcast_push_after_ack," + "broadcast_push_after_ack," +
"(SELECT count(0) FROM wvp_device_channel WHERE device_id=wvp_device.device_id) as channel_count "+ "(SELECT count(0) FROM wvp_device_channel dc WHERE dc.device_db_id= de.id) as channel_count "+
" FROM wvp_device WHERE device_id = #{deviceId}") " FROM wvp_device de WHERE de.device_id = #{deviceId}")
Device getDeviceByDeviceId(String deviceId); Device getDeviceByDeviceId(String deviceId);
@Insert("INSERT INTO wvp_device (" + @Insert("INSERT INTO wvp_device (" +
@ -133,6 +134,7 @@ public interface DeviceMapper {
@Select( @Select(
" <script>" + " <script>" +
"SELECT " + "SELECT " +
"id, " +
"device_id, " + "device_id, " +
"coalesce(custom_name, name) as name, " + "coalesce(custom_name, name) as name, " +
"password, " + "password, " +
@ -162,10 +164,10 @@ public interface DeviceMapper {
"geo_coord_sys,"+ "geo_coord_sys,"+
"on_line,"+ "on_line,"+
"media_server_id,"+ "media_server_id,"+
"(SELECT count(0) FROM wvp_device_channel WHERE device_id=de.device_id) as channel_count " + "(SELECT count(0) FROM wvp_device_channel dc WHERE dc.device_db_id= de.id) as channel_count " +
"FROM wvp_device de" + "FROM wvp_device de" +
"<if test=\"onLine != null\"> where on_line=${onLine}</if>"+ "<if test=\"onLine != null\"> where de.on_line=${onLine}</if>"+
" order by create_time desc "+ " order by de.create_time desc "+
" </script>" " </script>"
) )
List<Device> getDevices(Boolean onLine); List<Device> getDevices(Boolean onLine);
@ -174,6 +176,7 @@ public interface DeviceMapper {
int del(String deviceId); int del(String deviceId);
@Select("SELECT " + @Select("SELECT " +
"id, " +
"device_id, " + "device_id, " +
"coalesce(custom_name, name) as name, " + "coalesce(custom_name, name) as name, " +
"password, " + "password, " +
@ -204,7 +207,9 @@ public interface DeviceMapper {
"on_line"+ "on_line"+
" FROM wvp_device WHERE on_line = true") " FROM wvp_device WHERE on_line = true")
List<Device> getOnlineDevices(); List<Device> getOnlineDevices();
@Select("SELECT " + @Select("SELECT " +
"id,"+
"device_id,"+ "device_id,"+
"coalesce(custom_name,name)as name,"+ "coalesce(custom_name,name)as name,"+
"password,"+ "password,"+

View File

@ -117,6 +117,6 @@ public interface PlatformChannelMapper {
"where dc.channel_id = #{channelId} and pgc.platform_id=#{platformId}") "where dc.channel_id = #{channelId} and pgc.platform_id=#{platformId}")
List<Device> queryDeviceInfoByPlatformIdAndChannelId(@Param("platformId") String platformId, @Param("channelId") 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}") @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.device_id=#{channelId}")
List<String> queryParentPlatformByChannelId(@Param("channelId") String channelId); List<String> queryParentPlatformByChannelId(@Param("channelId") String channelId);
} }

View File

@ -106,7 +106,6 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp
Iterator<Element> deviceListIterator = deviceListElement.elementIterator(); Iterator<Element> deviceListIterator = deviceListElement.elementIterator();
if (deviceListIterator != null) { if (deviceListIterator != null) {
List<DeviceChannel> channelList = new ArrayList<>(); List<DeviceChannel> channelList = new ArrayList<>();
List<String> parentChannelIds = new ArrayList<>();
// 遍历DeviceList // 遍历DeviceList
while (deviceListIterator.hasNext()) { while (deviceListIterator.hasNext()) {
Element itemDevice = deviceListIterator.next(); Element itemDevice = deviceListIterator.next();
@ -115,16 +114,14 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp
continue; continue;
} }
DeviceChannel channel = DeviceChannel.decode(itemDevice); DeviceChannel channel = DeviceChannel.decode(itemDevice);
// DeviceChannel channel = XmlUtil.channelContentHandler(itemDevice, device, null);
if (channel == null || channel.getDeviceId() == null) { if (channel == null || channel.getDeviceId() == null) {
log.info("[收到目录订阅]:但是解析失败 {}", new String(evt.getRequest().getRawContent())); log.info("[收到目录订阅]:但是解析失败 {}", new String(evt.getRequest().getRawContent()));
continue; continue;
} }
channel.setDeviceDbId(device.getId());
if (channel.getParentId() != null && channel.getParentId().equals(sipConfig.getId())) { if (channel.getParentId() != null && channel.getParentId().equals(sipConfig.getId())) {
channel.setParentId(null); channel.setParentId(null);
} }
channel.setDeviceId(take.getDevice().getDeviceId());
channelList.add(channel); channelList.add(channel);
} }
int sn = Integer.parseInt(snElement.getText()); int sn = Integer.parseInt(snElement.getText());

View File

@ -9,15 +9,15 @@ import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.gb28181.bean.Device; import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
import com.genersoft.iot.vmp.gb28181.bean.MobilePosition; import com.genersoft.iot.vmp.gb28181.bean.MobilePosition;
import com.genersoft.iot.vmp.gb28181.dao.DeviceChannelMapper;
import com.genersoft.iot.vmp.gb28181.dao.DeviceMapper;
import com.genersoft.iot.vmp.gb28181.dao.DeviceMobilePositionMapper;
import com.genersoft.iot.vmp.gb28181.dao.PlatformChannelMapper;
import com.genersoft.iot.vmp.gb28181.event.EventPublisher; import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
import com.genersoft.iot.vmp.service.IDeviceChannelService; import com.genersoft.iot.vmp.service.IDeviceChannelService;
import com.genersoft.iot.vmp.service.IInviteStreamService; import com.genersoft.iot.vmp.service.IInviteStreamService;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage; import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.gb28181.dao.DeviceChannelMapper;
import com.genersoft.iot.vmp.gb28181.dao.DeviceMapper;
import com.genersoft.iot.vmp.gb28181.dao.DeviceMobilePositionMapper;
import com.genersoft.iot.vmp.gb28181.dao.PlatformChannelMapper;
import com.genersoft.iot.vmp.utils.DateUtil; import com.genersoft.iot.vmp.utils.DateUtil;
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo; import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo;
@ -31,7 +31,6 @@ import org.springframework.util.ObjectUtils;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
/** /**
* @author lin * @author lin
@ -90,7 +89,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
List<DeviceChannel> addChannels = new ArrayList<>(); List<DeviceChannel> addChannels = new ArrayList<>();
List<DeviceChannel> updateChannels = new ArrayList<>(); List<DeviceChannel> updateChannels = new ArrayList<>();
HashMap<String, DeviceChannel> channelsInStore = new HashMap<>(); HashMap<String, DeviceChannel> channelsInStore = new HashMap<>();
if (channels != null && channels.size() > 0) { if (channels != null && !channels.isEmpty()) {
List<DeviceChannel> channelList = channelMapper.queryChannelsByDeviceDbId(device.getId()); List<DeviceChannel> channelList = channelMapper.queryChannelsByDeviceDbId(device.getId());
if (channelList.isEmpty()) { if (channelList.isEmpty()) {
for (DeviceChannel channel : channels) { for (DeviceChannel channel : channels) {
@ -106,17 +105,18 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
} }
}else { }else {
for (DeviceChannel deviceChannel : channelList) { for (DeviceChannel deviceChannel : channelList) {
channelsInStore.put(deviceChannel.getDeviceId(), deviceChannel); channelsInStore.put(deviceChannel.getDeviceDbId() + deviceChannel.getDeviceId(), deviceChannel);
} }
for (DeviceChannel channel : channels) { for (DeviceChannel channel : channels) {
channel.setDeviceDbId(device.getId());
InviteInfo inviteInfo = inviteStreamService.getInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, device.getDeviceId(), channel.getDeviceId()); InviteInfo inviteInfo = inviteStreamService.getInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, device.getDeviceId(), channel.getDeviceId());
if (inviteInfo != null && inviteInfo.getStreamInfo() != null) { if (inviteInfo != null && inviteInfo.getStreamInfo() != null) {
channel.setStreamId(inviteInfo.getStreamInfo().getStream()); channel.setStreamId(inviteInfo.getStreamInfo().getStream());
} }
String now = DateUtil.getNow(); String now = DateUtil.getNow();
channel.setUpdateTime(now); channel.setUpdateTime(now);
if (channelsInStore.get(channel.getDeviceId()) != null) { DeviceChannel deviceChannelInDb = channelsInStore.get(channel.getDeviceDbId() + channel.getDeviceId());
if ( deviceChannelInDb != null) {
channel.setId(deviceChannelInDb.getId());
updateChannels.add(channel); updateChannels.add(channel);
}else { }else {
addChannels.add(channel); addChannels.add(channel);
@ -399,9 +399,9 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
} }
List<DeviceChannel> allChannels = channelMapper.queryAllChannels(device.getId()); List<DeviceChannel> allChannels = channelMapper.queryAllChannels(device.getId());
Map<String,DeviceChannel> allChannelMap = new ConcurrentHashMap<>(); Map<String,DeviceChannel> allChannelMap = new ConcurrentHashMap<>();
if (allChannels.size() > 0) { if (!allChannels.isEmpty()) {
for (DeviceChannel deviceChannel : allChannels) { for (DeviceChannel deviceChannel : allChannels) {
allChannelMap.put(deviceChannel.getDeviceId(), deviceChannel); allChannelMap.put(deviceChannel.getDeviceDbId() + deviceChannel.getDeviceId(), deviceChannel);
} }
} }
// 数据去重 // 数据去重
@ -421,17 +421,18 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
continue; continue;
} }
gbIdSet.add(deviceChannel.getDeviceId()); gbIdSet.add(deviceChannel.getDeviceId());
if (allChannelMap.containsKey(deviceChannel.getDeviceId())) { DeviceChannel channelInDb = allChannelMap.get(deviceChannel.getDeviceDbId() + deviceChannel.getDeviceId());
deviceChannel.setStreamId(allChannelMap.get(deviceChannel.getDeviceId()).getStreamId()); if (channelInDb != null) {
deviceChannel.setHasAudio(allChannelMap.get(deviceChannel.getDeviceId()).getHasAudio()); deviceChannel.setStreamId(channelInDb.getStreamId());
if (allChannelMap.get(deviceChannel.getDeviceId()).getStatus().equalsIgnoreCase(deviceChannel.getStatus())){ deviceChannel.setHasAudio(channelInDb.getHasAudio());
deviceChannel.setId(channelInDb.getId());
if (channelInDb.getStatus().equalsIgnoreCase(deviceChannel.getStatus())){
List<String> strings = platformChannelMapper.queryParentPlatformByChannelId(deviceChannel.getDeviceId()); List<String> strings = platformChannelMapper.queryParentPlatformByChannelId(deviceChannel.getDeviceId());
if (!CollectionUtils.isEmpty(strings)){ if (!CollectionUtils.isEmpty(strings)){
strings.forEach(platformId->{ strings.forEach(platformId->{
eventPublisher.catalogEventPublish(platformId, deviceChannel, deviceChannel.getStatus().equals("ON")? CatalogEvent.ON:CatalogEvent.OFF); eventPublisher.catalogEventPublish(platformId, deviceChannel, deviceChannel.getStatus().equals("ON")? CatalogEvent.ON:CatalogEvent.OFF);
}); });
} }
} }
deviceChannel.setUpdateTime(DateUtil.getNow()); deviceChannel.setUpdateTime(DateUtil.getNow());
updateChannels.add(deviceChannel); updateChannels.add(deviceChannel);
@ -440,7 +441,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
deviceChannel.setUpdateTime(DateUtil.getNow()); deviceChannel.setUpdateTime(DateUtil.getNow());
addChannels.add(deviceChannel); addChannels.add(deviceChannel);
} }
allChannelMap.remove(deviceChannel.getDeviceId()); allChannelMap.remove(deviceChannel.getDeviceDbId() + deviceChannel.getDeviceId());
channels.add(deviceChannel); channels.add(deviceChannel);
if (!ObjectUtils.isEmpty(deviceChannel.getParentId())) { if (!ObjectUtils.isEmpty(deviceChannel.getParentId())) {
if (subContMap.get(deviceChannel.getParentId()) == null) { if (subContMap.get(deviceChannel.getParentId()) == null) {

View File

@ -62,6 +62,9 @@ public class StreamProxy extends CommonGBChannel {
@Schema(description = "拉流代理时zlm返回的key用于停止拉流代理") @Schema(description = "拉流代理时zlm返回的key用于停止拉流代理")
private String streamKey; private String streamKey;
@Schema(description = "拉流状态")
private Boolean status;
@Schema(description = "更新时间") @Schema(description = "更新时间")
private String updateTime; private String updateTime;

View File

@ -88,12 +88,25 @@ public interface StreamProxyMapper {
@Select("select count(1) from wvp_stream_proxy where status = true") @Select("select count(1) from wvp_stream_proxy where status = true")
int getOnline(); int getOnline();
/** @Delete("DELETE FROM wvp_stream_proxy WHERE id=#{id}")
* int delete(@Param("id") int id);
*/
List<StreamProxy> selectWithAutoRemoveAndWithoutGbDeviceIdByMediaServerId(String mediaServerId);
int delete(int id);
@Delete(value = "<script>" +
"DELETE FROM wvp_stream_proxy WHERE id in (" +
"<foreach collection='streamProxiesForRemove' index='index' item='item' separator=','> " +
"#{item.id}"+
"</foreach>" +
")" +
"</script>")
void deleteByList(List<StreamProxy> streamProxiesForRemove); void deleteByList(List<StreamProxy> streamProxiesForRemove);
@Update("UPDATE wvp_stream_proxy " +
"SET status=true " +
"WHERE id=#{id}")
int online(@Param("id") int id);
@Update("UPDATE wvp_stream_proxy " +
"SET status=false " +
"WHERE id=#{id}")
int offline(@Param("id") int id);
} }

View File

@ -3,13 +3,11 @@ package com.genersoft.iot.vmp.streamProxy.service.impl;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.annotation.DS;
import com.genersoft.iot.vmp.common.StreamInfo; import com.genersoft.iot.vmp.common.StreamInfo;
import com.genersoft.iot.vmp.conf.DynamicTask;
import com.genersoft.iot.vmp.conf.UserSetting; import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.conf.exception.ControllerException; import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel; import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
import com.genersoft.iot.vmp.gb28181.service.IGbChannelService; import com.genersoft.iot.vmp.gb28181.service.IGbChannelService;
import com.genersoft.iot.vmp.media.bean.MediaServer; import com.genersoft.iot.vmp.media.bean.MediaServer;
import com.genersoft.iot.vmp.media.event.hook.HookSubscribe;
import com.genersoft.iot.vmp.media.event.media.MediaArrivalEvent; import com.genersoft.iot.vmp.media.event.media.MediaArrivalEvent;
import com.genersoft.iot.vmp.media.event.media.MediaDepartureEvent; import com.genersoft.iot.vmp.media.event.media.MediaDepartureEvent;
import com.genersoft.iot.vmp.media.event.media.MediaNotFoundEvent; import com.genersoft.iot.vmp.media.event.media.MediaNotFoundEvent;
@ -18,8 +16,6 @@ import com.genersoft.iot.vmp.media.event.mediaServer.MediaServerOnlineEvent;
import com.genersoft.iot.vmp.media.service.IMediaServerService; import com.genersoft.iot.vmp.media.service.IMediaServerService;
import com.genersoft.iot.vmp.media.zlm.dto.hook.OriginType; import com.genersoft.iot.vmp.media.zlm.dto.hook.OriginType;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage; import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
import com.genersoft.iot.vmp.gb28181.dao.PlatformGbStreamMapper;
import com.genersoft.iot.vmp.streamProxy.bean.StreamProxy; import com.genersoft.iot.vmp.streamProxy.bean.StreamProxy;
import com.genersoft.iot.vmp.streamProxy.dao.StreamProxyMapper; import com.genersoft.iot.vmp.streamProxy.dao.StreamProxyMapper;
import com.genersoft.iot.vmp.streamProxy.service.IStreamProxyService; import com.genersoft.iot.vmp.streamProxy.service.IStreamProxyService;
@ -57,27 +53,15 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
@Autowired @Autowired
private IRedisCatchStorage redisCatchStorage; private IRedisCatchStorage redisCatchStorage;
@Autowired
private IVideoManagerStorage storager;
@Autowired @Autowired
private UserSetting userSetting; private UserSetting userSetting;
@Autowired @Autowired
private IGbChannelService gbChannelService; private IGbChannelService gbChannelService;
@Autowired
private PlatformGbStreamMapper platformGbStreamMapper;
@Autowired @Autowired
private IMediaServerService mediaServerService; private IMediaServerService mediaServerService;
@Autowired
private HookSubscribe hookSubscribe;
@Autowired
private DynamicTask dynamicTask;
@Autowired @Autowired
DataSourceTransactionManager dataSourceTransactionManager; DataSourceTransactionManager dataSourceTransactionManager;
@ -407,16 +391,18 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
@Transactional @Transactional
public int updateStatusByAppAndStream(String app, String stream, boolean status) { public int updateStatusByAppAndStream(String app, String stream, boolean status) {
// 状态变化时推送到国标上级 // 状态变化时推送到国标上级
StreamProxy streamProxyItem = streamProxyMapper.selectOne(app, stream); StreamProxy streamProxy = streamProxyMapper.selectOne(app, stream);
if (streamProxyItem == null) { if (streamProxy == null) {
return 0; return 0;
} }
streamProxyItem.setGbStatus(status?1:0); streamProxy.setStatus(true);
if (streamProxyItem.getGbId() > 0) { streamProxyMapper.online(streamProxy.getId());
streamProxy.setGbStatus(status?1:0);
if (streamProxy.getGbId() > 0) {
if (status) { if (status) {
gbChannelService.online(streamProxyItem.getCommonGBChannel()); gbChannelService.online(streamProxy.getCommonGBChannel());
}else { }else {
gbChannelService.offline(streamProxyItem.getCommonGBChannel()); gbChannelService.offline(streamProxy.getCommonGBChannel());
} }
} }

View File

@ -292,6 +292,7 @@ create table wvp_stream_proxy (
media_server_id character varying(50), media_server_id character varying(50),
enable_audio bool default false, enable_audio bool default false,
enable_mp4 bool default false, enable_mp4 bool default false,
status bool default false,
enable bool default false, enable bool default false,
enable_remove_none_reader bool default false, enable_remove_none_reader bool default false,
create_time character varying(50), create_time character varying(50),