Commit 4df90d9ba440e01efe5b1b8958d86b2dd9b5d2b7
Merge branch 'wvp-28181-2.0' into main-dev
Showing
23 changed files
with
224 additions
and
114 deletions
Too many changes to show.
To preserve performance only 23 of 25 files are displayed.
src/main/java/com/genersoft/iot/vmp/common/StreamInfo.java
| @@ -523,6 +523,69 @@ public class StreamInfo implements Serializable, Cloneable{ | @@ -523,6 +523,69 @@ public class StreamInfo implements Serializable, Cloneable{ | ||
| 523 | StreamInfo instance = null; | 523 | StreamInfo instance = null; |
| 524 | try{ | 524 | try{ |
| 525 | instance = (StreamInfo)super.clone(); | 525 | instance = (StreamInfo)super.clone(); |
| 526 | + if (this.flv != null) { | ||
| 527 | + instance.flv=this.flv.clone(); | ||
| 528 | + } | ||
| 529 | + if (this.ws_flv != null ){ | ||
| 530 | + instance.ws_flv= this.ws_flv.clone(); | ||
| 531 | + } | ||
| 532 | + if (this.hls != null ) { | ||
| 533 | + instance.hls= this.hls.clone(); | ||
| 534 | + } | ||
| 535 | + if (this.ws_hls != null ) { | ||
| 536 | + instance.ws_hls= this.ws_hls.clone(); | ||
| 537 | + } | ||
| 538 | + if (this.ts != null ) { | ||
| 539 | + instance.ts= this.ts.clone(); | ||
| 540 | + } | ||
| 541 | + if (this.ws_ts != null ) { | ||
| 542 | + instance.ws_ts= this.ws_ts.clone(); | ||
| 543 | + } | ||
| 544 | + if (this.fmp4 != null ) { | ||
| 545 | + instance.fmp4= this.fmp4.clone(); | ||
| 546 | + } | ||
| 547 | + if (this.ws_fmp4 != null ) { | ||
| 548 | + instance.ws_fmp4= this.ws_fmp4.clone(); | ||
| 549 | + } | ||
| 550 | + if (this.rtc != null ) { | ||
| 551 | + instance.rtc= this.rtc.clone(); | ||
| 552 | + } | ||
| 553 | + if (this.https_flv != null) { | ||
| 554 | + instance.https_flv= this.https_flv.clone(); | ||
| 555 | + } | ||
| 556 | + if (this.wss_flv != null) { | ||
| 557 | + instance.wss_flv= this.wss_flv.clone(); | ||
| 558 | + } | ||
| 559 | + if (this.https_hls != null) { | ||
| 560 | + instance.https_hls= this.https_hls.clone(); | ||
| 561 | + } | ||
| 562 | + if (this.wss_hls != null) { | ||
| 563 | + instance.wss_hls= this.wss_hls.clone(); | ||
| 564 | + } | ||
| 565 | + if (this.wss_ts != null) { | ||
| 566 | + instance.wss_ts= this.wss_ts.clone(); | ||
| 567 | + } | ||
| 568 | + if (this.https_fmp4 != null) { | ||
| 569 | + instance.https_fmp4= this.https_fmp4.clone(); | ||
| 570 | + } | ||
| 571 | + if (this.wss_fmp4 != null) { | ||
| 572 | + instance.wss_fmp4= this.wss_fmp4.clone(); | ||
| 573 | + } | ||
| 574 | + if (this.rtcs != null) { | ||
| 575 | + instance.rtcs= this.rtcs.clone(); | ||
| 576 | + } | ||
| 577 | + if (this.rtsp != null) { | ||
| 578 | + instance.rtsp= this.rtsp.clone(); | ||
| 579 | + } | ||
| 580 | + if (this.rtsps != null) { | ||
| 581 | + instance.rtsps= this.rtsps.clone(); | ||
| 582 | + } | ||
| 583 | + if (this.rtmp != null) { | ||
| 584 | + instance.rtmp= this.rtmp.clone(); | ||
| 585 | + } | ||
| 586 | + if (this.rtmps != null) { | ||
| 587 | + instance.rtmps= this.rtmps.clone(); | ||
| 588 | + } | ||
| 526 | }catch(CloneNotSupportedException e) { | 589 | }catch(CloneNotSupportedException e) { |
| 527 | e.printStackTrace(); | 590 | e.printStackTrace(); |
| 528 | } | 591 | } |
src/main/java/com/genersoft/iot/vmp/common/StreamURL.java
| @@ -6,7 +6,7 @@ import java.io.Serializable; | @@ -6,7 +6,7 @@ import java.io.Serializable; | ||
| 6 | 6 | ||
| 7 | 7 | ||
| 8 | @Schema(description = "流地址信息") | 8 | @Schema(description = "流地址信息") |
| 9 | -public class StreamURL implements Serializable { | 9 | +public class StreamURL implements Serializable,Cloneable { |
| 10 | 10 | ||
| 11 | @Schema(description = "协议") | 11 | @Schema(description = "协议") |
| 12 | private String protocol; | 12 | private String protocol; |
| @@ -77,4 +77,8 @@ public class StreamURL implements Serializable { | @@ -77,4 +77,8 @@ public class StreamURL implements Serializable { | ||
| 77 | return null; | 77 | return null; |
| 78 | } | 78 | } |
| 79 | } | 79 | } |
| 80 | + @Override | ||
| 81 | + public StreamURL clone() throws CloneNotSupportedException { | ||
| 82 | + return (StreamURL) super.clone(); | ||
| 83 | + } | ||
| 80 | } | 84 | } |
src/main/java/com/genersoft/iot/vmp/gb28181/session/SSRCFactory.java
| @@ -8,6 +8,7 @@ import org.springframework.stereotype.Component; | @@ -8,6 +8,7 @@ import org.springframework.stereotype.Component; | ||
| 8 | 8 | ||
| 9 | import java.util.ArrayList; | 9 | import java.util.ArrayList; |
| 10 | import java.util.List; | 10 | import java.util.List; |
| 11 | +import java.util.Objects; | ||
| 11 | import java.util.Set; | 12 | import java.util.Set; |
| 12 | 13 | ||
| 13 | /** | 14 | /** |
| @@ -118,7 +119,7 @@ public class SSRCFactory { | @@ -118,7 +119,7 @@ public class SSRCFactory { | ||
| 118 | */ | 119 | */ |
| 119 | public boolean hasMediaServerSSRC(String mediaServerId) { | 120 | public boolean hasMediaServerSSRC(String mediaServerId) { |
| 120 | String redisKey = SSRC_INFO_KEY + userSetting.getServerId() + "_" + mediaServerId; | 121 | String redisKey = SSRC_INFO_KEY + userSetting.getServerId() + "_" + mediaServerId; |
| 121 | - return redisTemplate.opsForSet().members(redisKey) != null; | 122 | + return Boolean.TRUE.equals(redisTemplate.hasKey(redisKey)); |
| 122 | } | 123 | } |
| 123 | 124 | ||
| 124 | } | 125 | } |
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceChannelServiceImpl.java
| @@ -141,7 +141,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService { | @@ -141,7 +141,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService { | ||
| 141 | } | 141 | } |
| 142 | } | 142 | } |
| 143 | } | 143 | } |
| 144 | - int limitCount = 300; | 144 | + int limitCount = 50; |
| 145 | if (addChannels.size() > 0) { | 145 | if (addChannels.size() > 0) { |
| 146 | if (addChannels.size() > limitCount) { | 146 | if (addChannels.size() > limitCount) { |
| 147 | for (int i = 0; i < addChannels.size(); i += limitCount) { | 147 | for (int i = 0; i < addChannels.size(); i += limitCount) { |
| @@ -199,7 +199,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService { | @@ -199,7 +199,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService { | ||
| 199 | deviceChannel.setUpdateTime(now); | 199 | deviceChannel.setUpdateTime(now); |
| 200 | result.add(updateGps(deviceChannel, device)); | 200 | result.add(updateGps(deviceChannel, device)); |
| 201 | }); | 201 | }); |
| 202 | - int limitCount = 300; | 202 | + int limitCount = 50; |
| 203 | if (result.size() > limitCount) { | 203 | if (result.size() > limitCount) { |
| 204 | for (int i = 0; i < result.size(); i += limitCount) { | 204 | for (int i = 0; i < result.size(); i += limitCount) { |
| 205 | int toIndex = i + limitCount; | 205 | int toIndex = i + limitCount; |
src/main/java/com/genersoft/iot/vmp/service/impl/PlatformChannelServiceImpl.java
| @@ -82,7 +82,7 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService { | @@ -82,7 +82,7 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService { | ||
| 82 | int allCount = 0; | 82 | int allCount = 0; |
| 83 | boolean result = false; | 83 | boolean result = false; |
| 84 | TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition); | 84 | TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition); |
| 85 | - int limitCount = 300; | 85 | + int limitCount = 50; |
| 86 | if (channelReducesToAdd.size() > 0) { | 86 | if (channelReducesToAdd.size() > 0) { |
| 87 | if (channelReducesToAdd.size() > limitCount) { | 87 | if (channelReducesToAdd.size() > limitCount) { |
| 88 | for (int i = 0; i < channelReducesToAdd.size(); i += limitCount) { | 88 | for (int i = 0; i < channelReducesToAdd.size(); i += limitCount) { |
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceAlarmMapper.java
| @@ -4,6 +4,7 @@ import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm; | @@ -4,6 +4,7 @@ import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm; | ||
| 4 | import org.apache.ibatis.annotations.Delete; | 4 | import org.apache.ibatis.annotations.Delete; |
| 5 | import org.apache.ibatis.annotations.Insert; | 5 | import org.apache.ibatis.annotations.Insert; |
| 6 | import org.apache.ibatis.annotations.Mapper; | 6 | import org.apache.ibatis.annotations.Mapper; |
| 7 | +import org.apache.ibatis.annotations.Param; | ||
| 7 | import org.apache.ibatis.annotations.Select; | 8 | import org.apache.ibatis.annotations.Select; |
| 8 | import org.springframework.stereotype.Repository; | 9 | import org.springframework.stereotype.Repository; |
| 9 | 10 | ||
| @@ -32,8 +33,8 @@ public interface DeviceAlarmMapper { | @@ -32,8 +33,8 @@ public interface DeviceAlarmMapper { | ||
| 32 | " <if test=\"endTime != null\" > AND alarm_time <= #{endTime} </if>" + | 33 | " <if test=\"endTime != null\" > AND alarm_time <= #{endTime} </if>" + |
| 33 | " ORDER BY alarm_time ASC " + | 34 | " ORDER BY alarm_time ASC " + |
| 34 | " </script>"}) | 35 | " </script>"}) |
| 35 | - List<DeviceAlarm> query(String deviceId, String alarmPriority, String alarmMethod, | ||
| 36 | - String alarmType, String startTime, String endTime); | 36 | + List<DeviceAlarm> query(@Param("deviceId") String deviceId, @Param("alarmPriority") String alarmPriority, @Param("alarmMethod") String alarmMethod, |
| 37 | + @Param("alarmType") String alarmType, @Param("startTime") String startTime, @Param("endTime") String endTime); | ||
| 37 | 38 | ||
| 38 | 39 | ||
| 39 | @Delete(" <script>" + | 40 | @Delete(" <script>" + |
| @@ -45,5 +46,5 @@ public interface DeviceAlarmMapper { | @@ -45,5 +46,5 @@ public interface DeviceAlarmMapper { | ||
| 45 | " <if test=\"id != null\" > AND id = #{id}</if>" + | 46 | " <if test=\"id != null\" > AND id = #{id}</if>" + |
| 46 | " </script>" | 47 | " </script>" |
| 47 | ) | 48 | ) |
| 48 | - int clearAlarmBeforeTime(Integer id, List<String> deviceIdList, String time); | 49 | + int clearAlarmBeforeTime(@Param("id") Integer id, @Param("deviceIdList") List<String> deviceIdList, @Param("time") String time); |
| 49 | } | 50 | } |
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
| @@ -6,6 +6,7 @@ import com.genersoft.iot.vmp.gb28181.bean.DeviceChannelInPlatform; | @@ -6,6 +6,7 @@ import com.genersoft.iot.vmp.gb28181.bean.DeviceChannelInPlatform; | ||
| 6 | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; | 6 | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; |
| 7 | import com.genersoft.iot.vmp.web.gb28181.dto.DeviceChannelExtend; | 7 | import com.genersoft.iot.vmp.web.gb28181.dto.DeviceChannelExtend; |
| 8 | import org.apache.ibatis.annotations.*; | 8 | import org.apache.ibatis.annotations.*; |
| 9 | +import org.apache.ibatis.annotations.Param; | ||
| 9 | import org.springframework.stereotype.Repository; | 10 | import org.springframework.stereotype.Repository; |
| 10 | 11 | ||
| 11 | import java.util.List; | 12 | import java.util.List; |
| @@ -82,7 +83,7 @@ public interface DeviceChannelMapper { | @@ -82,7 +83,7 @@ public interface DeviceChannelMapper { | ||
| 82 | "</foreach> </if>" + | 83 | "</foreach> </if>" + |
| 83 | "ORDER BY dc.channel_id " + | 84 | "ORDER BY dc.channel_id " + |
| 84 | " </script>"}) | 85 | " </script>"}) |
| 85 | - List<DeviceChannel> queryChannels(String deviceId, String parentChannelId, String query, Boolean hasSubChannel, Boolean online, List<String> channelIds); | 86 | + 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); |
| 86 | 87 | ||
| 87 | @Select(value = {" <script>" + | 88 | @Select(value = {" <script>" + |
| 88 | "SELECT " + | 89 | "SELECT " + |
| @@ -105,7 +106,7 @@ public interface DeviceChannelMapper { | @@ -105,7 +106,7 @@ public interface DeviceChannelMapper { | ||
| 105 | "</foreach> </if>" + | 106 | "</foreach> </if>" + |
| 106 | "ORDER BY dc.channel_id ASC" + | 107 | "ORDER BY dc.channel_id ASC" + |
| 107 | " </script>"}) | 108 | " </script>"}) |
| 108 | - List<DeviceChannelExtend> queryChannelsWithDeviceInfo(String deviceId, String parentChannelId, String query, Boolean hasSubChannel, Boolean online, List<String> channelIds); | 109 | + 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); |
| 109 | 110 | ||
| 110 | 111 | ||
| 111 | @Select(value = {" <script>" + | 112 | @Select(value = {" <script>" + |
| @@ -130,23 +131,23 @@ public interface DeviceChannelMapper { | @@ -130,23 +131,23 @@ public interface DeviceChannelMapper { | ||
| 130 | "ORDER BY dc.channel_id ASC " + | 131 | "ORDER BY dc.channel_id ASC " + |
| 131 | "Limit #{limit} OFFSET #{start}" + | 132 | "Limit #{limit} OFFSET #{start}" + |
| 132 | " </script>"}) | 133 | " </script>"}) |
| 133 | - List<DeviceChannelExtend> queryChannelsByDeviceIdWithStartAndLimit(String deviceId,List<String> channelIds, String parentChannelId, String query, | ||
| 134 | - Boolean hasSubChannel, Boolean online, int start, int limit); | 134 | + 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); |
| 135 | 135 | ||
| 136 | @Select("SELECT * FROM wvp_device_channel WHERE device_id=#{deviceId} AND channel_id=#{channelId}") | 136 | @Select("SELECT * FROM wvp_device_channel WHERE device_id=#{deviceId} AND channel_id=#{channelId}") |
| 137 | - DeviceChannel queryChannel(String deviceId, String channelId); | 137 | + DeviceChannel queryChannel(@Param("deviceId") String deviceId,@Param("channelId") String channelId); |
| 138 | 138 | ||
| 139 | @Delete("DELETE FROM wvp_device_channel WHERE device_id=#{deviceId}") | 139 | @Delete("DELETE FROM wvp_device_channel WHERE device_id=#{deviceId}") |
| 140 | - int cleanChannelsByDeviceId(String deviceId); | 140 | + int cleanChannelsByDeviceId(@Param("deviceId") String deviceId); |
| 141 | 141 | ||
| 142 | @Delete("DELETE FROM wvp_device_channel WHERE device_id=#{deviceId} AND channel_id=#{channelId}") | 142 | @Delete("DELETE FROM wvp_device_channel WHERE device_id=#{deviceId} AND channel_id=#{channelId}") |
| 143 | - int del(String deviceId, String channelId); | 143 | + int del(@Param("deviceId") String deviceId, @Param("channelId") String channelId); |
| 144 | 144 | ||
| 145 | @Update(value = {"UPDATE wvp_device_channel SET stream_id=null WHERE device_id=#{deviceId} AND channel_id=#{channelId}"}) | 145 | @Update(value = {"UPDATE wvp_device_channel SET stream_id=null WHERE device_id=#{deviceId} AND channel_id=#{channelId}"}) |
| 146 | - void stopPlay(String deviceId, String channelId); | 146 | + void stopPlay(@Param("deviceId") String deviceId, @Param("channelId") String channelId); |
| 147 | 147 | ||
| 148 | @Update(value = {"UPDATE wvp_device_channel SET stream_id=#{streamId} WHERE device_id=#{deviceId} AND channel_id=#{channelId}"}) | 148 | @Update(value = {"UPDATE wvp_device_channel SET stream_id=#{streamId} WHERE device_id=#{deviceId} AND channel_id=#{channelId}"}) |
| 149 | - void startPlay(String deviceId, String channelId, String streamId); | 149 | + void startPlay(@Param("deviceId") String deviceId, @Param("channelId") String channelId, @Param("streamId") String streamId); |
| 150 | + | ||
| 150 | 151 | ||
| 151 | @Select(value = {" <script>" + | 152 | @Select(value = {" <script>" + |
| 152 | "SELECT " + | 153 | "SELECT " + |
| @@ -172,7 +173,7 @@ public interface DeviceChannelMapper { | @@ -172,7 +173,7 @@ public interface DeviceChannelMapper { | ||
| 172 | " <if test='catalogId != null ' > AND pgc.platform_id = #{platformId} and pgc.catalog_id=#{catalogId} </if> " + | 173 | " <if test='catalogId != null ' > AND pgc.platform_id = #{platformId} and pgc.catalog_id=#{catalogId} </if> " + |
| 173 | " ORDER BY dc.device_id, dc.channel_id ASC" + | 174 | " ORDER BY dc.device_id, dc.channel_id ASC" + |
| 174 | " </script>"}) | 175 | " </script>"}) |
| 175 | - List<ChannelReduce> queryChannelListInAll(String query, Boolean online, Boolean hasSubChannel, String platformId, String catalogId); | 176 | + List<ChannelReduce> queryChannelListInAll(@Param("query") String query, @Param("online") Boolean online, @Param("hasSubChannel") Boolean hasSubChannel, @Param("platformId") String platformId, @Param("catalogId") String catalogId); |
| 176 | 177 | ||
| 177 | @Select(value = {" <script>" + | 178 | @Select(value = {" <script>" + |
| 178 | "SELECT " + | 179 | "SELECT " + |
| @@ -191,7 +192,7 @@ public interface DeviceChannelMapper { | @@ -191,7 +192,7 @@ public interface DeviceChannelMapper { | ||
| 191 | List<DeviceChannel> queryChannelByChannelId( String channelId); | 192 | List<DeviceChannel> queryChannelByChannelId( String channelId); |
| 192 | 193 | ||
| 193 | @Update(value = {"UPDATE wvp_device_channel SET status=false WHERE device_id=#{deviceId} AND channel_id=#{channelId}"}) | 194 | @Update(value = {"UPDATE wvp_device_channel SET status=false WHERE device_id=#{deviceId} AND channel_id=#{channelId}"}) |
| 194 | - void offline(String deviceId, String channelId); | 195 | + void offline(@Param("deviceId") String deviceId, @Param("channelId") String channelId); |
| 195 | 196 | ||
| 196 | @Update(value = {"UPDATE wvp_device_channel SET status=false WHERE device_id=#{deviceId}"}) | 197 | @Update(value = {"UPDATE wvp_device_channel SET status=false WHERE device_id=#{deviceId}"}) |
| 197 | void offlineByDeviceId(String deviceId); | 198 | void offlineByDeviceId(String deviceId); |
| @@ -214,7 +215,7 @@ public interface DeviceChannelMapper { | @@ -214,7 +215,7 @@ public interface DeviceChannelMapper { | ||
| 214 | "#{item.businessGroupId}, #{item.gpsTime}) " + | 215 | "#{item.businessGroupId}, #{item.gpsTime}) " + |
| 215 | "</foreach> " + | 216 | "</foreach> " + |
| 216 | "</script>") | 217 | "</script>") |
| 217 | - int batchAdd(List<DeviceChannel> addChannels); | 218 | + int batchAdd(@Param("addChannels") List<DeviceChannel> addChannels); |
| 218 | 219 | ||
| 219 | 220 | ||
| 220 | @Insert("<script> " + | 221 | @Insert("<script> " + |
| @@ -271,7 +272,7 @@ public interface DeviceChannelMapper { | @@ -271,7 +272,7 @@ public interface DeviceChannelMapper { | ||
| 271 | int batchAddOrUpdate(List<DeviceChannel> addChannels); | 272 | int batchAddOrUpdate(List<DeviceChannel> addChannels); |
| 272 | 273 | ||
| 273 | @Update(value = {"UPDATE wvp_device_channel SET status=true WHERE device_id=#{deviceId} AND channel_id=#{channelId}"}) | 274 | @Update(value = {"UPDATE wvp_device_channel SET status=true WHERE device_id=#{deviceId} AND channel_id=#{channelId}"}) |
| 274 | - void online(String deviceId, String channelId); | 275 | + void online(@Param("deviceId") String deviceId, @Param("channelId") String channelId); |
| 275 | 276 | ||
| 276 | @Update({"<script>" + | 277 | @Update({"<script>" + |
| 277 | "<foreach collection='updateChannels' item='item' separator=';'>" + | 278 | "<foreach collection='updateChannels' item='item' separator=';'>" + |
| @@ -328,7 +329,7 @@ public interface DeviceChannelMapper { | @@ -328,7 +329,7 @@ public interface DeviceChannelMapper { | ||
| 328 | " AND channel_id NOT IN " + | 329 | " AND channel_id NOT IN " + |
| 329 | "<foreach collection='channels' item='item' open='(' separator=',' close=')' > #{item.channelId}</foreach>" + | 330 | "<foreach collection='channels' item='item' open='(' separator=',' close=')' > #{item.channelId}</foreach>" + |
| 330 | " </script>"}) | 331 | " </script>"}) |
| 331 | - int cleanChannelsNotInList(String deviceId, List<DeviceChannel> channels); | 332 | + int cleanChannelsNotInList(@Param("deviceId") String deviceId, @Param("channels") List<DeviceChannel> channels); |
| 332 | 333 | ||
| 333 | @Update(" update wvp_device_channel" + | 334 | @Update(" update wvp_device_channel" + |
| 334 | " set sub_count = (select *" + | 335 | " set sub_count = (select *" + |
| @@ -337,7 +338,7 @@ public interface DeviceChannelMapper { | @@ -337,7 +338,7 @@ public interface DeviceChannelMapper { | ||
| 337 | " where device_id = #{deviceId} and parent_id = #{channelId}) as temp)" + | 338 | " where device_id = #{deviceId} and parent_id = #{channelId}) as temp)" + |
| 338 | " where device_id = #{deviceId} " + | 339 | " where device_id = #{deviceId} " + |
| 339 | " and channel_id = #{channelId}") | 340 | " and channel_id = #{channelId}") |
| 340 | - int updateChannelSubCount(String deviceId, String channelId); | 341 | + int updateChannelSubCount(@Param("deviceId") String deviceId, @Param("channelId") String channelId); |
| 341 | 342 | ||
| 342 | @Update(value = {" <script>" + | 343 | @Update(value = {" <script>" + |
| 343 | "UPDATE wvp_device_channel " + | 344 | "UPDATE wvp_device_channel " + |
| @@ -370,14 +371,14 @@ public interface DeviceChannelMapper { | @@ -370,14 +371,14 @@ public interface DeviceChannelMapper { | ||
| 370 | " <if test='parentId == null and length == null' > and parent_id= #{parentId} </if>" + | 371 | " <if test='parentId == null and length == null' > and parent_id= #{parentId} </if>" + |
| 371 | " <if test='parentId != null and length == null' > and parent_id= #{parentId} or left(channel_id, LENGTH(#{parentId})) = #{parentId} </if>" + | 372 | " <if test='parentId != null and length == null' > and parent_id= #{parentId} or left(channel_id, LENGTH(#{parentId})) = #{parentId} </if>" + |
| 372 | " </script>"}) | 373 | " </script>"}) |
| 373 | - List<DeviceChannel> getChannelsWithCivilCodeAndLength(String deviceId, String parentId, Integer length); | 374 | + List<DeviceChannel> getChannelsWithCivilCodeAndLength(@Param("deviceId") String deviceId, @Param("parentId") String parentId, @Param("length") Integer length); |
| 374 | 375 | ||
| 375 | @Select(value = {" <script>" + | 376 | @Select(value = {" <script>" + |
| 376 | "select * " + | 377 | "select * " + |
| 377 | "from wvp_device_channel " + | 378 | "from wvp_device_channel " + |
| 378 | "where device_id=#{deviceId} and length(channel_id)>14 and civil_code=#{parentId}" + | 379 | "where device_id=#{deviceId} and length(channel_id)>14 and civil_code=#{parentId}" + |
| 379 | " </script>"}) | 380 | " </script>"}) |
| 380 | - List<DeviceChannel> getChannelsByCivilCode(String deviceId, String parentId); | 381 | + List<DeviceChannel> getChannelsByCivilCode(@Param("deviceId") String deviceId, @Param("parentId") String parentId); |
| 381 | 382 | ||
| 382 | @Select("select min(length(channel_id)) as minLength " + | 383 | @Select("select min(length(channel_id)) as minLength " + |
| 383 | "from wvp_device_channel " + | 384 | "from wvp_device_channel " + |
| @@ -389,7 +390,7 @@ public interface DeviceChannelMapper { | @@ -389,7 +390,7 @@ public interface DeviceChannelMapper { | ||
| 389 | List<DeviceChannel> getChannelWithoutCivilCode(String deviceId); | 390 | List<DeviceChannel> getChannelWithoutCivilCode(String deviceId); |
| 390 | 391 | ||
| 391 | @Select("select * from wvp_device_channel where device_id=#{deviceId} and SUBSTRING(channel_id, 11, 3)=#{typeCode}") | 392 | @Select("select * from wvp_device_channel where device_id=#{deviceId} and SUBSTRING(channel_id, 11, 3)=#{typeCode}") |
| 392 | - List<DeviceChannel> getBusinessGroups(String deviceId, String typeCode); | 393 | + List<DeviceChannel> getBusinessGroups(@Param("deviceId") String deviceId, @Param("typeCode") String typeCode); |
| 393 | 394 | ||
| 394 | @Select("select dc.id, dc.channel_id, dc.device_id, dc.name, dc.manufacture,dc.model,dc.owner, pc.civil_code,dc.block, " + | 395 | @Select("select dc.id, dc.channel_id, dc.device_id, dc.name, dc.manufacture,dc.model,dc.owner, pc.civil_code,dc.block, " + |
| 395 | " 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, " + | 396 | " 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 { | @@ -428,14 +429,14 @@ public interface DeviceChannelMapper { | ||
| 428 | "DELETE FROM wvp_device_channel WHERE device_id=#{item.deviceId} AND channel_id=#{item.channelId}" + | 429 | "DELETE FROM wvp_device_channel WHERE device_id=#{item.deviceId} AND channel_id=#{item.channelId}" + |
| 429 | "</foreach>" + | 430 | "</foreach>" + |
| 430 | "</script>"}) | 431 | "</script>"}) |
| 431 | - int batchDel(List<DeviceChannel> deleteChannelList); | 432 | + int batchDel(@Param("deleteChannelList") List<DeviceChannel> deleteChannelList); |
| 432 | 433 | ||
| 433 | @Update({"<script>" + | 434 | @Update({"<script>" + |
| 434 | "<foreach collection='channels' item='item' separator=';'>" + | 435 | "<foreach collection='channels' item='item' separator=';'>" + |
| 435 | "UPDATE wvp_device_channel SET status=true WHERE device_id=#{item.deviceId} AND channel_id=#{item.channelId}" + | 436 | "UPDATE wvp_device_channel SET status=true WHERE device_id=#{item.deviceId} AND channel_id=#{item.channelId}" + |
| 436 | "</foreach>" + | 437 | "</foreach>" + |
| 437 | "</script>"}) | 438 | "</script>"}) |
| 438 | - int batchOnline(List<DeviceChannel> channels); | 439 | + int batchOnline(@Param("channels") List<DeviceChannel> channels); |
| 439 | 440 | ||
| 440 | @Update({"<script>" + | 441 | @Update({"<script>" + |
| 441 | "<foreach collection='channels' item='item' separator=';'>" + | 442 | "<foreach collection='channels' item='item' separator=';'>" + |
| @@ -463,6 +464,6 @@ public interface DeviceChannelMapper { | @@ -463,6 +464,6 @@ public interface DeviceChannelMapper { | ||
| 463 | " <if test='parentId == null or parentId == deviceId'> and parent_id is null or parent_id = #{deviceId}</if>" + | 464 | " <if test='parentId == null or parentId == deviceId'> and parent_id is null or parent_id = #{deviceId}</if>" + |
| 464 | " <if test='onlyCatalog == true '> and parental = 1 </if>" + | 465 | " <if test='onlyCatalog == true '> and parental = 1 </if>" + |
| 465 | " </script>"}) | 466 | " </script>"}) |
| 466 | - List<DeviceChannel> getSubChannelsByDeviceId(String deviceId, String parentId, boolean onlyCatalog); | 467 | + List<DeviceChannel> getSubChannelsByDeviceId(@Param("deviceId") String deviceId, @Param("parentId") String parentId, @Param("onlyCatalog") boolean onlyCatalog); |
| 467 | 468 | ||
| 468 | } | 469 | } |
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java
| @@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.storager.dao; | @@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.storager.dao; | ||
| 2 | 2 | ||
| 3 | import com.genersoft.iot.vmp.gb28181.bean.Device; | 3 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 4 | import org.apache.ibatis.annotations.*; | 4 | import org.apache.ibatis.annotations.*; |
| 5 | +import org.apache.ibatis.annotations.Param; | ||
| 5 | import org.springframework.stereotype.Repository; | 6 | import org.springframework.stereotype.Repository; |
| 6 | 7 | ||
| 7 | import java.util.List; | 8 | import java.util.List; |
| @@ -235,7 +236,7 @@ public interface DeviceMapper { | @@ -235,7 +236,7 @@ public interface DeviceMapper { | ||
| 235 | "geo_coord_sys,"+ | 236 | "geo_coord_sys,"+ |
| 236 | "on_line"+ | 237 | "on_line"+ |
| 237 | " FROM wvp_device WHERE ip = #{host} AND port=#{port}") | 238 | " FROM wvp_device WHERE ip = #{host} AND port=#{port}") |
| 238 | - Device getDeviceByHostAndPort(String host, int port); | 239 | + Device getDeviceByHostAndPort(@Param("host") String host, @Param("port") int port); |
| 239 | 240 | ||
| 240 | @Update(value = {" <script>" + | 241 | @Update(value = {" <script>" + |
| 241 | "UPDATE wvp_device " + | 242 | "UPDATE wvp_device " + |
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMobilePositionMapper.java
| @@ -4,6 +4,7 @@ import com.genersoft.iot.vmp.gb28181.bean.MobilePosition; | @@ -4,6 +4,7 @@ import com.genersoft.iot.vmp.gb28181.bean.MobilePosition; | ||
| 4 | import org.apache.ibatis.annotations.Delete; | 4 | import org.apache.ibatis.annotations.Delete; |
| 5 | import org.apache.ibatis.annotations.Insert; | 5 | import org.apache.ibatis.annotations.Insert; |
| 6 | import org.apache.ibatis.annotations.Mapper; | 6 | import org.apache.ibatis.annotations.Mapper; |
| 7 | +import org.apache.ibatis.annotations.Param; | ||
| 7 | import org.apache.ibatis.annotations.Select; | 8 | import org.apache.ibatis.annotations.Select; |
| 8 | 9 | ||
| 9 | import java.util.List; | 10 | import java.util.List; |
| @@ -23,7 +24,7 @@ public interface DeviceMobilePositionMapper { | @@ -23,7 +24,7 @@ public interface DeviceMobilePositionMapper { | ||
| 23 | "<if test=\"endTime != null\"> AND time<=#{endTime}</if>" + | 24 | "<if test=\"endTime != null\"> AND time<=#{endTime}</if>" + |
| 24 | " ORDER BY time ASC" + | 25 | " ORDER BY time ASC" + |
| 25 | " </script>"}) | 26 | " </script>"}) |
| 26 | - List<MobilePosition> queryPositionByDeviceIdAndTime(String deviceId, String channelId, String startTime, String endTime); | 27 | + List<MobilePosition> queryPositionByDeviceIdAndTime(@Param("deviceId") String deviceId, @Param("channelId") String channelId, @Param("startTime") String startTime, @Param("endTime") String endTime); |
| 27 | 28 | ||
| 28 | @Select("SELECT * FROM wvp_device_mobile_position WHERE device_id = #{deviceId}" + | 29 | @Select("SELECT * FROM wvp_device_mobile_position WHERE device_id = #{deviceId}" + |
| 29 | " ORDER BY time DESC LIMIT 1") | 30 | " ORDER BY time DESC LIMIT 1") |
src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java
| @@ -6,6 +6,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; | @@ -6,6 +6,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; | ||
| 6 | import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; | 6 | import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; |
| 7 | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; | 7 | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; |
| 8 | import org.apache.ibatis.annotations.*; | 8 | import org.apache.ibatis.annotations.*; |
| 9 | +import org.apache.ibatis.annotations.Param; | ||
| 9 | import org.springframework.stereotype.Repository; | 10 | import org.springframework.stereotype.Repository; |
| 10 | 11 | ||
| 11 | import java.util.List; | 12 | import java.util.List; |
| @@ -14,7 +15,7 @@ import java.util.List; | @@ -14,7 +15,7 @@ import java.util.List; | ||
| 14 | @Repository | 15 | @Repository |
| 15 | public interface GbStreamMapper { | 16 | public interface GbStreamMapper { |
| 16 | 17 | ||
| 17 | - @Insert("REPLACE INTO wvp_gb_stream (app, stream, gb_id, name, " + | 18 | + @Insert("INSERT INTO wvp_gb_stream (app, stream, gb_id, name, " + |
| 18 | "longitude, latitude, stream_type,media_server_id,create_time) VALUES" + | 19 | "longitude, latitude, stream_type,media_server_id,create_time) VALUES" + |
| 19 | "(#{app}, #{stream}, #{gbId}, #{name}, " + | 20 | "(#{app}, #{stream}, #{gbId}, #{name}, " + |
| 20 | "#{longitude}, #{latitude}, #{streamType}, " + | 21 | "#{longitude}, #{latitude}, #{streamType}, " + |
| @@ -47,7 +48,7 @@ public interface GbStreamMapper { | @@ -47,7 +48,7 @@ public interface GbStreamMapper { | ||
| 47 | int update(GbStream gbStream); | 48 | int update(GbStream gbStream); |
| 48 | 49 | ||
| 49 | @Delete("DELETE FROM wvp_gb_stream WHERE app=#{app} AND stream=#{stream}") | 50 | @Delete("DELETE FROM wvp_gb_stream WHERE app=#{app} AND stream=#{stream}") |
| 50 | - int del(String app, String stream); | 51 | + int del(@Param("app") String app, @Param("stream") String stream); |
| 51 | 52 | ||
| 52 | @Select("<script> "+ | 53 | @Select("<script> "+ |
| 53 | "SELECT gs.* FROM wvp_gb_stream gs " + | 54 | "SELECT gs.* FROM wvp_gb_stream gs " + |
| @@ -61,10 +62,10 @@ public interface GbStreamMapper { | @@ -61,10 +62,10 @@ public interface GbStreamMapper { | ||
| 61 | " <if test='mediaServerId != null' > AND gs.media_server_id=#{mediaServerId} </if>" + | 62 | " <if test='mediaServerId != null' > AND gs.media_server_id=#{mediaServerId} </if>" + |
| 62 | " order by gs.gb_stream_id asc " + | 63 | " order by gs.gb_stream_id asc " + |
| 63 | "</script>") | 64 | "</script>") |
| 64 | - List<GbStream> selectAll(String platformId, String catalogId, String query, String mediaServerId); | 65 | + List<GbStream> selectAll(@Param("platformId") String platformId, @Param("catalogId") String catalogId, @Param("query") String query, @Param("mediaServerId") String mediaServerId); |
| 65 | 66 | ||
| 66 | @Select("SELECT * FROM wvp_gb_stream WHERE app=#{app} AND stream=#{stream}") | 67 | @Select("SELECT * FROM wvp_gb_stream WHERE app=#{app} AND stream=#{stream}") |
| 67 | - GbStream selectOne(String app, String stream); | 68 | + GbStream selectOne(@Param("app") String app, @Param("stream") String stream); |
| 68 | 69 | ||
| 69 | @Select("SELECT * FROM wvp_gb_stream WHERE gb_id=#{gbId}") | 70 | @Select("SELECT * FROM wvp_gb_stream WHERE gb_id=#{gbId}") |
| 70 | List<GbStream> selectByGBId(String gbId); | 71 | List<GbStream> selectByGBId(String gbId); |
| @@ -72,7 +73,7 @@ public interface GbStreamMapper { | @@ -72,7 +73,7 @@ public interface GbStreamMapper { | ||
| 72 | @Select("SELECT gs.*, pgs.platform_id as platform_id, pgs.catalog_id as catalog_id FROM wvp_gb_stream gs " + | 73 | @Select("SELECT gs.*, pgs.platform_id as platform_id, pgs.catalog_id as catalog_id FROM wvp_gb_stream gs " + |
| 73 | "LEFT JOIN wvp_platform_gb_stream pgs ON gs.gb_stream_id = pgs.gb_stream_id " + | 74 | "LEFT JOIN wvp_platform_gb_stream pgs ON gs.gb_stream_id = pgs.gb_stream_id " + |
| 74 | "WHERE gs.gb_id = #{gbId} AND pgs.platform_id = #{platformId}") | 75 | "WHERE gs.gb_id = #{gbId} AND pgs.platform_id = #{platformId}") |
| 75 | - GbStream queryStreamInPlatform(String platformId, String gbId); | 76 | + GbStream queryStreamInPlatform(@Param("platformId") String platformId, @Param("gbId") String gbId); |
| 76 | 77 | ||
| 77 | @Select("<script> "+ | 78 | @Select("<script> "+ |
| 78 | "select gt.gb_id as channel_id, gt.name, 'wvp-pro' as manufacture, st.status, gt.longitude, gt.latitude, pc.id as parent_id," + | 79 | "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 { | @@ -90,7 +91,7 @@ public interface GbStreamMapper { | ||
| 90 | " left join wvp_platform_catalog pc on pgs.catalog_id = pc.id and pgs.platform_id = pc.platform_id" + | 91 | " left join wvp_platform_catalog pc on pgs.catalog_id = pc.id and pgs.platform_id = pc.platform_id" + |
| 91 | " where pgs.platform_id=#{platformId}" + | 92 | " where pgs.platform_id=#{platformId}" + |
| 92 | "</script>") | 93 | "</script>") |
| 93 | - List<DeviceChannel> queryGbStreamListInPlatform(String platformId, boolean usPushingAsStatus); | 94 | + List<DeviceChannel> queryGbStreamListInPlatform(String platformId, @Param("usPushingAsStatus") boolean usPushingAsStatus); |
| 94 | 95 | ||
| 95 | 96 | ||
| 96 | @Select("SELECT gs.* FROM wvp_gb_stream gs left join wvp_platform_gb_stream pgs " + | 97 | @Select("SELECT gs.* FROM wvp_gb_stream gs left join wvp_platform_gb_stream pgs " + |
| @@ -98,7 +99,7 @@ public interface GbStreamMapper { | @@ -98,7 +99,7 @@ public interface GbStreamMapper { | ||
| 98 | List<GbStream> queryStreamNotInPlatform(); | 99 | List<GbStream> queryStreamNotInPlatform(); |
| 99 | 100 | ||
| 100 | @Delete("DELETE FROM wvp_gb_stream WHERE stream_type=#{type} AND gb_id=NULL AND media_server_id=#{mediaServerId}") | 101 | @Delete("DELETE FROM wvp_gb_stream WHERE stream_type=#{type} AND gb_id=NULL AND media_server_id=#{mediaServerId}") |
| 101 | - void deleteWithoutGBId(String type, String mediaServerId); | 102 | + void deleteWithoutGBId(@Param("type") String type, @Param("mediaServerId") String mediaServerId); |
| 102 | 103 | ||
| 103 | @Delete("<script> "+ | 104 | @Delete("<script> "+ |
| 104 | "DELETE FROM wvp_gb_stream where " + | 105 | "DELETE FROM wvp_gb_stream where " + |
| @@ -128,7 +129,7 @@ public interface GbStreamMapper { | @@ -128,7 +129,7 @@ public interface GbStreamMapper { | ||
| 128 | "</foreach> " + | 129 | "</foreach> " + |
| 129 | "</script>") | 130 | "</script>") |
| 130 | @Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gb_stream_id") | 131 | @Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gb_stream_id") |
| 131 | - void batchAdd(List<StreamPushItem> subList); | 132 | + void batchAdd(@Param("subList") List<StreamPushItem> subList); |
| 132 | 133 | ||
| 133 | @Update({"<script>" + | 134 | @Update({"<script>" + |
| 134 | "<foreach collection='gpsMsgInfos' item='item' separator=';'>" + | 135 | "<foreach collection='gpsMsgInfos' item='item' separator=';'>" + |
| @@ -164,9 +165,9 @@ public interface GbStreamMapper { | @@ -164,9 +165,9 @@ public interface GbStreamMapper { | ||
| 164 | int updateGbIdOrName(List<StreamPushItem> streamPushItemForUpdate); | 165 | int updateGbIdOrName(List<StreamPushItem> streamPushItemForUpdate); |
| 165 | 166 | ||
| 166 | @Select("SELECT status FROM wvp_stream_proxy WHERE app=#{app} AND stream=#{stream}") | 167 | @Select("SELECT status FROM wvp_stream_proxy WHERE app=#{app} AND stream=#{stream}") |
| 167 | - Boolean selectStatusForProxy(String app, String stream); | 168 | + Boolean selectStatusForProxy(@Param("app") String app, @Param("stream") String stream); |
| 168 | 169 | ||
| 169 | @Select("SELECT status FROM wvp_stream_push WHERE app=#{app} AND stream=#{stream}") | 170 | @Select("SELECT status FROM wvp_stream_push WHERE app=#{app} AND stream=#{stream}") |
| 170 | - Boolean selectStatusForPush(String app, String stream); | 171 | + Boolean selectStatusForPush(@Param("app") String app, @Param("stream") String stream); |
| 171 | 172 | ||
| 172 | } | 173 | } |
src/main/java/com/genersoft/iot/vmp/storager/dao/LogMapper.java
| @@ -4,6 +4,7 @@ import com.genersoft.iot.vmp.storager.dao.dto.LogDto; | @@ -4,6 +4,7 @@ import com.genersoft.iot.vmp.storager.dao.dto.LogDto; | ||
| 4 | import org.apache.ibatis.annotations.Delete; | 4 | import org.apache.ibatis.annotations.Delete; |
| 5 | import org.apache.ibatis.annotations.Insert; | 5 | import org.apache.ibatis.annotations.Insert; |
| 6 | import org.apache.ibatis.annotations.Mapper; | 6 | import org.apache.ibatis.annotations.Mapper; |
| 7 | +import org.apache.ibatis.annotations.Param; | ||
| 7 | import org.apache.ibatis.annotations.Select; | 8 | import org.apache.ibatis.annotations.Select; |
| 8 | import org.springframework.stereotype.Repository; | 9 | import org.springframework.stereotype.Repository; |
| 9 | 10 | ||
| @@ -29,7 +30,7 @@ public interface LogMapper { | @@ -29,7 +30,7 @@ public interface LogMapper { | ||
| 29 | " <if test=\"endTime != null\" > AND create_time <= #{endTime} </if>" + | 30 | " <if test=\"endTime != null\" > AND create_time <= #{endTime} </if>" + |
| 30 | " ORDER BY create_time DESC " + | 31 | " ORDER BY create_time DESC " + |
| 31 | " </script>"}) | 32 | " </script>"}) |
| 32 | - List<LogDto> query(String query, String type, String startTime, String endTime); | 33 | + List<LogDto> query(@Param("query") String query, @Param("type") String type, @Param("startTime") String startTime, @Param("endTime") String endTime); |
| 33 | 34 | ||
| 34 | @Delete("DELETE FROM wvp_log") | 35 | @Delete("DELETE FROM wvp_log") |
| 35 | int clear(); | 36 | int clear(); |
src/main/java/com/genersoft/iot/vmp/storager/dao/MediaServerMapper.java
| @@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.storager.dao; | @@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.storager.dao; | ||
| 2 | 2 | ||
| 3 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | 3 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 4 | import org.apache.ibatis.annotations.*; | 4 | import org.apache.ibatis.annotations.*; |
| 5 | +import org.apache.ibatis.annotations.Param; | ||
| 5 | import org.springframework.stereotype.Repository; | 6 | import org.springframework.stereotype.Repository; |
| 6 | 7 | ||
| 7 | import java.util.List; | 8 | import java.util.List; |
| @@ -119,13 +120,13 @@ public interface MediaServerMapper { | @@ -119,13 +120,13 @@ public interface MediaServerMapper { | ||
| 119 | void delOne(String id); | 120 | void delOne(String id); |
| 120 | 121 | ||
| 121 | @Select("DELETE FROM wvp_media_server WHERE ip=#{host} and http_port=#{port}") | 122 | @Select("DELETE FROM wvp_media_server WHERE ip=#{host} and http_port=#{port}") |
| 122 | - void delOneByIPAndPort(String host, int port); | 123 | + void delOneByIPAndPort(@Param("host") String host, @Param("port") int port); |
| 123 | 124 | ||
| 124 | @Delete("DELETE FROM wvp_media_server WHERE default_server=true") | 125 | @Delete("DELETE FROM wvp_media_server WHERE default_server=true") |
| 125 | int delDefault(); | 126 | int delDefault(); |
| 126 | 127 | ||
| 127 | @Select("SELECT * FROM wvp_media_server WHERE ip=#{host} and http_port=#{port}") | 128 | @Select("SELECT * FROM wvp_media_server WHERE ip=#{host} and http_port=#{port}") |
| 128 | - MediaServerItem queryOneByHostAndPort(String host, int port); | 129 | + MediaServerItem queryOneByHostAndPort(@Param("host") String host, @Param("port") int port); |
| 129 | 130 | ||
| 130 | @Select("SELECT * FROM wvp_media_server WHERE default_server=true") | 131 | @Select("SELECT * FROM wvp_media_server WHERE default_server=true") |
| 131 | MediaServerItem queryDefault(); | 132 | MediaServerItem queryDefault(); |
src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java
| @@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.storager.dao; | @@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.storager.dao; | ||
| 3 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | 3 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| 4 | import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo; | 4 | import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo; |
| 5 | import org.apache.ibatis.annotations.*; | 5 | import org.apache.ibatis.annotations.*; |
| 6 | +import org.apache.ibatis.annotations.Param; | ||
| 6 | import org.springframework.stereotype.Repository; | 7 | import org.springframework.stereotype.Repository; |
| 7 | 8 | ||
| 8 | import java.util.List; | 9 | import java.util.List; |
| @@ -84,17 +85,17 @@ public interface ParentPlatformMapper { | @@ -84,17 +85,17 @@ public interface ParentPlatformMapper { | ||
| 84 | int outlineForAllParentPlatform(); | 85 | int outlineForAllParentPlatform(); |
| 85 | 86 | ||
| 86 | @Update("UPDATE wvp_platform SET status=#{online} WHERE server_gb_id=#{platformGbID}" ) | 87 | @Update("UPDATE wvp_platform SET status=#{online} WHERE server_gb_id=#{platformGbID}" ) |
| 87 | - int updateParentPlatformStatus(String platformGbID, boolean online); | 88 | + int updateParentPlatformStatus(@Param("platformGbID") String platformGbID, @Param("online") boolean online); |
| 88 | 89 | ||
| 89 | @Update(value = {" <script>" + | 90 | @Update(value = {" <script>" + |
| 90 | "UPDATE wvp_platform " + | 91 | "UPDATE wvp_platform " + |
| 91 | "SET catalog_id=#{catalogId}, update_time=#{updateTime}" + | 92 | "SET catalog_id=#{catalogId}, update_time=#{updateTime}" + |
| 92 | "WHERE server_gb_id=#{platformId}"+ | 93 | "WHERE server_gb_id=#{platformId}"+ |
| 93 | "</script>"}) | 94 | "</script>"}) |
| 94 | - int setDefaultCatalog(String platformId, String catalogId, String updateTime); | 95 | + int setDefaultCatalog(@Param("platformId") String platformId, @Param("catalogId") String catalogId, @Param("updateTime") String updateTime); |
| 95 | 96 | ||
| 96 | @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} " + | 97 | @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} " + |
| 97 | "union " + | 98 | "union " + |
| 98 | "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}") | 99 | "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}") |
| 99 | - List<ChannelSourceInfo> getChannelSource(String platform_id, String gbId); | 100 | + List<ChannelSourceInfo> getChannelSource(@Param("platform_id") String platform_id, @Param("gbId") String gbId); |
| 100 | } | 101 | } |
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformCatalogMapper.java
| @@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.storager.dao; | @@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.storager.dao; | ||
| 3 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; | 3 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| 4 | import com.genersoft.iot.vmp.gb28181.bean.PlatformCatalog; | 4 | import com.genersoft.iot.vmp.gb28181.bean.PlatformCatalog; |
| 5 | import org.apache.ibatis.annotations.*; | 5 | import org.apache.ibatis.annotations.*; |
| 6 | +import org.apache.ibatis.annotations.Param; | ||
| 6 | import org.springframework.stereotype.Repository; | 7 | import org.springframework.stereotype.Repository; |
| 7 | 8 | ||
| 8 | import java.util.List; | 9 | import java.util.List; |
| @@ -17,37 +18,37 @@ public interface PlatformCatalogMapper { | @@ -17,37 +18,37 @@ public interface PlatformCatalogMapper { | ||
| 17 | int add(PlatformCatalog platformCatalog); | 18 | int add(PlatformCatalog platformCatalog); |
| 18 | 19 | ||
| 19 | @Delete("DELETE from wvp_platform_catalog WHERE platform_id=#{platformId} and id=#{id}") | 20 | @Delete("DELETE from wvp_platform_catalog WHERE platform_id=#{platformId} and id=#{id}") |
| 20 | - int del(String platformId, String id); | 21 | + int del(@Param("platformId") String platformId, @Param("id") String id); |
| 21 | 22 | ||
| 22 | @Delete("DELETE from wvp_platform_catalog WHERE platform_id=#{platformId}") | 23 | @Delete("DELETE from wvp_platform_catalog WHERE platform_id=#{platformId}") |
| 23 | - int delByPlatformId(String platformId); | 24 | + int delByPlatformId(@Param("platformId") String platformId); |
| 24 | 25 | ||
| 25 | @Select("SELECT pc.*, count(pc2.id) as children_count from wvp_platform_catalog pc " + | 26 | @Select("SELECT pc.*, count(pc2.id) as children_count from wvp_platform_catalog pc " + |
| 26 | "left join wvp_platform_catalog pc2 on pc.id = pc2.parent_id " + | 27 | "left join wvp_platform_catalog pc2 on pc.id = pc2.parent_id " + |
| 27 | "WHERE pc.parent_id=#{parentId} AND pc.platform_id=#{platformId} " + | 28 | "WHERE pc.parent_id=#{parentId} AND pc.platform_id=#{platformId} " + |
| 28 | "group by pc.id, pc.name, pc.platform_id, pc.business_group_id, pc.civil_code, pc.parent_id") | 29 | "group by pc.id, pc.name, pc.platform_id, pc.business_group_id, pc.civil_code, pc.parent_id") |
| 29 | - List<PlatformCatalog> selectByParentId(String platformId, String parentId); | 30 | + List<PlatformCatalog> selectByParentId(@Param("platformId") String platformId, @Param("parentId") String parentId); |
| 30 | 31 | ||
| 31 | @Update(value = {" <script>" + | 32 | @Update(value = {" <script>" + |
| 32 | "UPDATE wvp_platform_catalog " + | 33 | "UPDATE wvp_platform_catalog " + |
| 33 | "SET name=#{name}" + | 34 | "SET name=#{name}" + |
| 34 | "WHERE id=#{id} and platform_id=#{platformId}"+ | 35 | "WHERE id=#{id} and platform_id=#{platformId}"+ |
| 35 | "</script>"}) | 36 | "</script>"}) |
| 36 | - int update(PlatformCatalog platformCatalog); | 37 | + int update(@Param("platformCatalog") PlatformCatalog platformCatalog); |
| 37 | 38 | ||
| 38 | @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}") | 39 | @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}") |
| 39 | - List<PlatformCatalog> selectByPlatForm(String platformId); | 40 | + List<PlatformCatalog> selectByPlatForm(@Param("platformId") String platformId); |
| 40 | 41 | ||
| 41 | @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})") | 42 | @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})") |
| 42 | - PlatformCatalog selectDefaultByPlatFormId(String platformId); | 43 | + PlatformCatalog selectDefaultByPlatFormId(@Param("platformId") String platformId); |
| 43 | 44 | ||
| 44 | @Select("SELECT pc.id as channel_id, pc.name, pc.civil_code, pc.business_group_id,'1' as parental, pc.parent_id " + | 45 | @Select("SELECT pc.id as channel_id, pc.name, pc.civil_code, pc.business_group_id,'1' as parental, pc.parent_id " + |
| 45 | " from wvp_platform_catalog pc WHERE pc.platform_id=#{platformId}") | 46 | " from wvp_platform_catalog pc WHERE pc.platform_id=#{platformId}") |
| 46 | - List<DeviceChannel> queryCatalogInPlatform(String platformId); | 47 | + List<DeviceChannel> queryCatalogInPlatform(@Param("platformId") String platformId); |
| 47 | 48 | ||
| 48 | @Select("SELECT *, " + | 49 | @Select("SELECT *, " + |
| 49 | "(SELECT COUNT(1) from wvp_platform_catalog where parent_id = pc.id) as children_count " + | 50 | "(SELECT COUNT(1) from wvp_platform_catalog where parent_id = pc.id) as children_count " + |
| 50 | " from wvp_platform_catalog pc " + | 51 | " from wvp_platform_catalog pc " + |
| 51 | " WHERE pc.id=#{id} and pc.platform_id=#{platformId}") | 52 | " WHERE pc.id=#{id} and pc.platform_id=#{platformId}") |
| 52 | - PlatformCatalog selectByPlatFormAndCatalogId(String platformId, String id); | 53 | + PlatformCatalog selectByPlatFormAndCatalogId(@Param("platformId") String platformId, @Param("id") String id); |
| 53 | } | 54 | } |
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; | @@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; | ||
| 8 | import org.apache.ibatis.annotations.Delete; | 8 | import org.apache.ibatis.annotations.Delete; |
| 9 | import org.apache.ibatis.annotations.Insert; | 9 | import org.apache.ibatis.annotations.Insert; |
| 10 | import org.apache.ibatis.annotations.Mapper; | 10 | import org.apache.ibatis.annotations.Mapper; |
| 11 | +import org.apache.ibatis.annotations.Param; | ||
| 11 | import org.apache.ibatis.annotations.Select; | 12 | import org.apache.ibatis.annotations.Select; |
| 12 | import org.springframework.stereotype.Repository; | 13 | import org.springframework.stereotype.Repository; |
| 13 | 14 | ||
| @@ -24,7 +25,7 @@ public interface PlatformChannelMapper { | @@ -24,7 +25,7 @@ public interface PlatformChannelMapper { | ||
| 24 | "SELECT device_channel_id from wvp_platform_gb_channel WHERE platform_id=#{platformId} AND device_channel_id in" + | 25 | "SELECT device_channel_id from wvp_platform_gb_channel WHERE platform_id=#{platformId} AND device_channel_id in" + |
| 25 | "<foreach collection='channelReduces' open='(' item='item' separator=',' close=')'> #{item.id}</foreach>" + | 26 | "<foreach collection='channelReduces' open='(' item='item' separator=',' close=')'> #{item.id}</foreach>" + |
| 26 | "</script>") | 27 | "</script>") |
| 27 | - List<Integer> findChannelRelatedPlatform(String platformId, List<ChannelReduce> channelReduces); | 28 | + List<Integer> findChannelRelatedPlatform(@Param("platformId") String platformId, @Param("channelReduces") List<ChannelReduce> channelReduces); |
| 28 | 29 | ||
| 29 | @Insert("<script> "+ | 30 | @Insert("<script> "+ |
| 30 | "INSERT INTO wvp_platform_gb_channel (platform_id, device_channel_id, catalog_id) VALUES" + | 31 | "INSERT INTO wvp_platform_gb_channel (platform_id, device_channel_id, catalog_id) VALUES" + |
| @@ -32,13 +33,13 @@ public interface PlatformChannelMapper { | @@ -32,13 +33,13 @@ public interface PlatformChannelMapper { | ||
| 32 | " (#{platformId}, #{item.id} , #{item.catalogId} )" + | 33 | " (#{platformId}, #{item.id} , #{item.catalogId} )" + |
| 33 | "</foreach>" + | 34 | "</foreach>" + |
| 34 | "</script>") | 35 | "</script>") |
| 35 | - int addChannels(String platformId, List<ChannelReduce> channelReducesToAdd); | 36 | + int addChannels(@Param("platformId") String platformId, @Param("channelReducesToAdd") List<ChannelReduce> channelReducesToAdd); |
| 36 | 37 | ||
| 37 | @Delete("<script> "+ | 38 | @Delete("<script> "+ |
| 38 | "DELETE from wvp_platform_gb_channel WHERE platform_id=#{platformId} AND device_channel_id in" + | 39 | "DELETE from wvp_platform_gb_channel WHERE platform_id=#{platformId} AND device_channel_id in" + |
| 39 | "<foreach collection='channelReducesToDel' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" + | 40 | "<foreach collection='channelReducesToDel' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" + |
| 40 | "</script>") | 41 | "</script>") |
| 41 | - int delChannelForGB(String platformId, List<ChannelReduce> channelReducesToDel); | 42 | + int delChannelForGB(@Param("platformId") String platformId, @Param("channelReducesToDel") List<ChannelReduce> channelReducesToDel); |
| 42 | 43 | ||
| 43 | @Delete("<script> "+ | 44 | @Delete("<script> "+ |
| 44 | "DELETE from wvp_platform_gb_channel WHERE device_channel_id in " + | 45 | "DELETE from wvp_platform_gb_channel WHERE device_channel_id in " + |
| @@ -55,27 +56,27 @@ public interface PlatformChannelMapper { | @@ -55,27 +56,27 @@ public interface PlatformChannelMapper { | ||
| 55 | int cleanChannelForGB(String platformId); | 56 | int cleanChannelForGB(String platformId); |
| 56 | 57 | ||
| 57 | @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}") | 58 | @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}") |
| 58 | - List<DeviceChannel> queryChannelInParentPlatform(String platformId, String channelId); | 59 | + List<DeviceChannel> queryChannelInParentPlatform(@Param("platformId") String platformId, @Param("channelId") String channelId); |
| 59 | 60 | ||
| 60 | @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}") | 61 | @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}") |
| 61 | - List<DeviceChannel> queryAllChannelInCatalog(String platformId, String catalogId); | 62 | + List<DeviceChannel> queryAllChannelInCatalog(@Param("platformId") String platformId, @Param("catalogId") String catalogId); |
| 62 | 63 | ||
| 63 | @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 " + | 64 | @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 " + |
| 64 | " from wvp_device_channel dc left join wvp_platform_gb_channel pgc on dc.id = pgc.device_channel_id " + | 65 | " from wvp_device_channel dc left join wvp_platform_gb_channel pgc on dc.id = pgc.device_channel_id " + |
| 65 | " where pgc.platform_id=#{platformId} and pgc.catalog_id=#{catalogId}") | 66 | " where pgc.platform_id=#{platformId} and pgc.catalog_id=#{catalogId}") |
| 66 | - List<PlatformCatalog> queryChannelInParentPlatformAndCatalog(String platformId, String catalogId); | 67 | + List<PlatformCatalog> queryChannelInParentPlatformAndCatalog(@Param("platformId") String platformId, @Param("catalogId") String catalogId); |
| 67 | 68 | ||
| 68 | @Select("select d.*\n" + | 69 | @Select("select d.*\n" + |
| 69 | "from wvp_platform_gb_channel pgc\n" + | 70 | "from wvp_platform_gb_channel pgc\n" + |
| 70 | " left join wvp_device_channel dc on dc.id = pgc.device_channel_id\n" + | 71 | " left join wvp_device_channel dc on dc.id = pgc.device_channel_id\n" + |
| 71 | " left join wvp_device d on dc.device_id = d.device_id\n" + | 72 | " left join wvp_device d on dc.device_id = d.device_id\n" + |
| 72 | "where dc.channel_id = #{channelId} and pgc.platform_id=#{platformId}") | 73 | "where dc.channel_id = #{channelId} and pgc.platform_id=#{platformId}") |
| 73 | - List<Device> queryVideoDeviceByPlatformIdAndChannelId(String platformId, String channelId); | 74 | + List<Device> queryVideoDeviceByPlatformIdAndChannelId(@Param("platformId") String platformId, @Param("channelId") String channelId); |
| 74 | 75 | ||
| 75 | @Delete("<script> "+ | 76 | @Delete("<script> "+ |
| 76 | "DELETE from wvp_platform_gb_channel WHERE platform_id=#{platformId} and catalog_id=#{id}" + | 77 | "DELETE from wvp_platform_gb_channel WHERE platform_id=#{platformId} and catalog_id=#{id}" + |
| 77 | "</script>") | 78 | "</script>") |
| 78 | - int delByCatalogId(String platformId, String id); | 79 | + int delByCatalogId(@Param("platformId") String platformId, @Param("id") String id); |
| 79 | 80 | ||
| 80 | @Delete("<script> "+ | 81 | @Delete("<script> "+ |
| 81 | "DELETE from wvp_platform_gb_channel WHERE catalog_id=#{parentId} AND platform_id=#{platformId} AND channel_id=#{id}" + | 82 | "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 { | @@ -96,7 +97,7 @@ public interface PlatformChannelMapper { | ||
| 96 | "AND pp.server_gb_id IN" + | 97 | "AND pp.server_gb_id IN" + |
| 97 | "<foreach collection='platforms' item='item' open='(' separator=',' close=')' > #{item}</foreach>" + | 98 | "<foreach collection='platforms' item='item' open='(' separator=',' close=')' > #{item}</foreach>" + |
| 98 | "</script> ") | 99 | "</script> ") |
| 99 | - List<ParentPlatform> queryPlatFormListForGBWithGBId(String channelId, List<String> platforms); | 100 | + List<ParentPlatform> queryPlatFormListForGBWithGBId(@Param("channelId") String channelId, @Param("platforms") List<String> platforms); |
| 100 | 101 | ||
| 101 | @Delete("<script> " + | 102 | @Delete("<script> " + |
| 102 | "DELETE from wvp_platform_gb_channel WHERE platform_id=#{serverGBId}" + | 103 | "DELETE from wvp_platform_gb_channel WHERE platform_id=#{serverGBId}" + |
| @@ -106,14 +107,14 @@ public interface PlatformChannelMapper { | @@ -106,14 +107,14 @@ public interface PlatformChannelMapper { | ||
| 106 | @Delete("<script> " + | 107 | @Delete("<script> " + |
| 107 | "DELETE from wvp_platform_gb_channel WHERE platform_id=#{platformId} and catalog_id=#{catalogId}" + | 108 | "DELETE from wvp_platform_gb_channel WHERE platform_id=#{platformId} and catalog_id=#{catalogId}" + |
| 108 | "</script>") | 109 | "</script>") |
| 109 | - int delChannelForGBByCatalogId(String platformId, String catalogId); | 110 | + int delChannelForGBByCatalogId(@Param("platformId") String platformId, @Param("catalogId") String catalogId); |
| 110 | 111 | ||
| 111 | @Select("select dc.channel_id dc.device_id,dc.name,d.manufacturer,d.model,d.firmware\n" + | 112 | @Select("select dc.channel_id dc.device_id,dc.name,d.manufacturer,d.model,d.firmware\n" + |
| 112 | "from wvp_platform_gb_channel pgc\n" + | 113 | "from wvp_platform_gb_channel pgc\n" + |
| 113 | " left join wvp_device_channel dc on dc.id = pgc.device_channel_id\n" + | 114 | " left join wvp_device_channel dc on dc.id = pgc.device_channel_id\n" + |
| 114 | " left join wvp_device d on dc.device_id = d.device_id\n" + | 115 | " left join wvp_device d on dc.device_id = d.device_id\n" + |
| 115 | "where dc.channel_id = #{channelId} and pgc.platform_id=#{platformId}") | 116 | "where dc.channel_id = #{channelId} and pgc.platform_id=#{platformId}") |
| 116 | - List<Device> queryDeviceInfoByPlatformIdAndChannelId(String platformId, String channelId); | 117 | + List<Device> queryDeviceInfoByPlatformIdAndChannelId(@Param("platformId") String platformId, @Param("channelId") String channelId); |
| 117 | 118 | ||
| 118 | @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}'") | 119 | @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}'") |
| 119 | List<String> queryParentPlatformByChannelId(String channelId); | 120 | List<String> queryParentPlatformByChannelId(String channelId); |
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java
| @@ -16,7 +16,7 @@ import java.util.List; | @@ -16,7 +16,7 @@ import java.util.List; | ||
| 16 | @Repository | 16 | @Repository |
| 17 | public interface PlatformGbStreamMapper { | 17 | public interface PlatformGbStreamMapper { |
| 18 | 18 | ||
| 19 | - @Insert("REPLACE INTO wvp_platform_gb_stream (gb_stream_id, platform_id, catalog_id) VALUES" + | 19 | + @Insert("INSERT INTO wvp_platform_gb_stream (gb_stream_id, platform_id, catalog_id) VALUES" + |
| 20 | "( #{gbStreamId}, #{platformId}, #{catalogId})") | 20 | "( #{gbStreamId}, #{platformId}, #{catalogId})") |
| 21 | int add(PlatformGbStream platformGbStream); | 21 | int add(PlatformGbStream platformGbStream); |
| 22 | 22 | ||
| @@ -32,7 +32,7 @@ public interface PlatformGbStreamMapper { | @@ -32,7 +32,7 @@ public interface PlatformGbStreamMapper { | ||
| 32 | int batchAdd(List<StreamPushItem> streamPushItems); | 32 | int batchAdd(List<StreamPushItem> streamPushItems); |
| 33 | 33 | ||
| 34 | @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})") | 34 | @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})") |
| 35 | - int delByAppAndStream(String app, String stream); | 35 | + int delByAppAndStream(@Param("app") String app, @Param("stream") String stream); |
| 36 | 36 | ||
| 37 | @Delete("DELETE from wvp_platform_gb_stream WHERE platform_id=#{platformId}") | 37 | @Delete("DELETE from wvp_platform_gb_stream WHERE platform_id=#{platformId}") |
| 38 | int delByPlatformId(String platformId); | 38 | int delByPlatformId(String platformId); |
| @@ -46,26 +46,26 @@ public interface PlatformGbStreamMapper { | @@ -46,26 +46,26 @@ public interface PlatformGbStreamMapper { | ||
| 46 | "WHERE " + | 46 | "WHERE " + |
| 47 | "gs.app =#{app} " + | 47 | "gs.app =#{app} " + |
| 48 | "AND gs.stream =#{stream} ") | 48 | "AND gs.stream =#{stream} ") |
| 49 | - List<ParentPlatform> selectByAppAndStream(String app, String stream); | 49 | + List<ParentPlatform> selectByAppAndStream(@Param("app") String app, @Param("stream") String stream); |
| 50 | 50 | ||
| 51 | @Select("SELECT pgs.*, gs.gb_id from wvp_platform_gb_stream pgs " + | 51 | @Select("SELECT pgs.*, gs.gb_id from wvp_platform_gb_stream pgs " + |
| 52 | "LEFT join wvp_gb_stream gs ON pgs.gb_stream_id = gs.gb_stream_id " + | 52 | "LEFT join wvp_gb_stream gs ON pgs.gb_stream_id = gs.gb_stream_id " + |
| 53 | "WHERE gs.app=#{app} AND gs.stream=#{stream} AND pgs.platform_id=#{platformId}") | 53 | "WHERE gs.app=#{app} AND gs.stream=#{stream} AND pgs.platform_id=#{platformId}") |
| 54 | - StreamProxyItem selectOne(String app, String stream, String platformId); | 54 | + StreamProxyItem selectOne(@Param("app") String app, @Param("stream") String stream, @Param("platformId") String platformId); |
| 55 | 55 | ||
| 56 | @Select("select gs.* \n" + | 56 | @Select("select gs.* \n" + |
| 57 | "from wvp_gb_stream gs\n" + | 57 | "from wvp_gb_stream gs\n" + |
| 58 | " left join wvp_platform_gb_stream pgs\n" + | 58 | " left join wvp_platform_gb_stream pgs\n" + |
| 59 | " on gs.gb_stream_id = pgs.gb_stream_id\n" + | 59 | " on gs.gb_stream_id = pgs.gb_stream_id\n" + |
| 60 | "where pgs.platform_id=#{platformId} and pgs.catalog_id=#{catalogId}") | 60 | "where pgs.platform_id=#{platformId} and pgs.catalog_id=#{catalogId}") |
| 61 | - List<GbStream> queryChannelInParentPlatformAndCatalog(String platformId, String catalogId); | 61 | + List<GbStream> queryChannelInParentPlatformAndCatalog(@Param("platformId") String platformId, @Param("catalogId") String catalogId); |
| 62 | 62 | ||
| 63 | @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" + | 63 | @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" + |
| 64 | "from wvp_gb_stream gs\n" + | 64 | "from wvp_gb_stream gs\n" + |
| 65 | " left join wvp_platform_gb_stream pgs\n" + | 65 | " left join wvp_platform_gb_stream pgs\n" + |
| 66 | " on gs.gb_stream_id = pgs.gb_stream_id\n" + | 66 | " on gs.gb_stream_id = pgs.gb_stream_id\n" + |
| 67 | "where pgs.platform_id=#{platformId} and pgs.catalog_id=#{catalogId}") | 67 | "where pgs.platform_id=#{platformId} and pgs.catalog_id=#{catalogId}") |
| 68 | - List<PlatformCatalog> queryChannelInParentPlatformAndCatalogForCatalog(String platformId, String catalogId); | 68 | + List<PlatformCatalog> queryChannelInParentPlatformAndCatalogForCatalog(@Param("platformId") String platformId, @Param("catalogId") String catalogId); |
| 69 | 69 | ||
| 70 | @Select("<script> " + | 70 | @Select("<script> " + |
| 71 | "SELECT " + | 71 | "SELECT " + |
| @@ -82,7 +82,7 @@ public interface PlatformGbStreamMapper { | @@ -82,7 +82,7 @@ public interface PlatformGbStreamMapper { | ||
| 82 | "AND pp.server_gb_id IN" + | 82 | "AND pp.server_gb_id IN" + |
| 83 | "<foreach collection='platforms' item='item' open='(' separator=',' close=')' > #{item}</foreach>" + | 83 | "<foreach collection='platforms' item='item' open='(' separator=',' close=')' > #{item}</foreach>" + |
| 84 | "</script> ") | 84 | "</script> ") |
| 85 | - List<ParentPlatform> queryPlatFormListForGBWithGBId(String app, String stream, List<String> platforms); | 85 | + List<ParentPlatform> queryPlatFormListForGBWithGBId(@Param("app") String app, @Param("stream") String stream, @Param("platforms") List<String> platforms); |
| 86 | 86 | ||
| 87 | @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}") | 87 | @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}") |
| 88 | int delByAppAndStreamAndPlatform(String app, String stream, String platformId); | 88 | int delByAppAndStreamAndPlatform(String app, String stream, String platformId); |
| @@ -101,8 +101,8 @@ public interface PlatformGbStreamMapper { | @@ -101,8 +101,8 @@ public interface PlatformGbStreamMapper { | ||
| 101 | "#{item.gbStreamId} " + | 101 | "#{item.gbStreamId} " + |
| 102 | "</foreach>" + | 102 | "</foreach>" + |
| 103 | "</script>") | 103 | "</script>") |
| 104 | - void delByAppAndStreamsByPlatformId(List<GbStream> gbStreams, String platformId); | 104 | + void delByAppAndStreamsByPlatformId(@Param("gbStreams") List<GbStream> gbStreams, @Param("platformId") String platformId); |
| 105 | 105 | ||
| 106 | @Delete("DELETE from wvp_platform_gb_stream WHERE platform_id=#{platformId} and catalog_id=#{catalogId}") | 106 | @Delete("DELETE from wvp_platform_gb_stream WHERE platform_id=#{platformId} and catalog_id=#{catalogId}") |
| 107 | - int delByPlatformAndCatalogId(String platformId, String catalogId); | 107 | + int delByPlatformAndCatalogId(@Param("platformId") String platformId, @Param("catalogId") String catalogId); |
| 108 | } | 108 | } |
src/main/java/com/genersoft/iot/vmp/storager/dao/StreamProxyMapper.java
| @@ -49,12 +49,12 @@ public interface StreamProxyMapper { | @@ -49,12 +49,12 @@ public interface StreamProxyMapper { | ||
| 49 | List<StreamProxyItem> selectForEnable(boolean enable); | 49 | List<StreamProxyItem> selectForEnable(boolean enable); |
| 50 | 50 | ||
| 51 | @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") | 51 | @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") |
| 52 | - StreamProxyItem selectOne(String app, String stream); | 52 | + StreamProxyItem selectOne(@Param("app") String app, @Param("stream") String stream); |
| 53 | 53 | ||
| 54 | @Select("SELECT st.*, pgs.gb_id, pgs.name, pgs.longitude, pgs.latitude FROM wvp_stream_proxy st " + | 54 | @Select("SELECT st.*, pgs.gb_id, pgs.name, pgs.longitude, pgs.latitude FROM wvp_stream_proxy st " + |
| 55 | "LEFT join wvp_gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream " + | 55 | "LEFT join wvp_gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream " + |
| 56 | "WHERE st.enable=#{enable} and st.media_server_id= #{id} order by st.create_time desc") | 56 | "WHERE st.enable=#{enable} and st.media_server_id= #{id} order by st.create_time desc") |
| 57 | - List<StreamProxyItem> selectForEnableInMediaServer(String id, boolean enable); | 57 | + List<StreamProxyItem> selectForEnableInMediaServer( @Param("id") String id, @Param("enable") boolean enable); |
| 58 | 58 | ||
| 59 | @Select("SELECT st.*, pgs.gb_id, pgs.name, pgs.longitude, pgs.latitude FROM wvp_stream_proxy st " + | 59 | @Select("SELECT st.*, pgs.gb_id, pgs.name, pgs.longitude, pgs.latitude FROM wvp_stream_proxy st " + |
| 60 | "LEFT join wvp_gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream " + | 60 | "LEFT join wvp_gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream " + |
| @@ -64,12 +64,12 @@ public interface StreamProxyMapper { | @@ -64,12 +64,12 @@ public interface StreamProxyMapper { | ||
| 64 | @Update("UPDATE wvp_stream_proxy " + | 64 | @Update("UPDATE wvp_stream_proxy " + |
| 65 | "SET status=#{status} " + | 65 | "SET status=#{status} " + |
| 66 | "WHERE media_server_id=#{mediaServerId}") | 66 | "WHERE media_server_id=#{mediaServerId}") |
| 67 | - void updateStatusByMediaServerId(String mediaServerId, boolean status); | 67 | + void updateStatusByMediaServerId(@Param("mediaServerId") String mediaServerId, @Param("status") boolean status); |
| 68 | 68 | ||
| 69 | @Update("UPDATE wvp_stream_proxy " + | 69 | @Update("UPDATE wvp_stream_proxy " + |
| 70 | "SET status=#{status} " + | 70 | "SET status=#{status} " + |
| 71 | "WHERE app=#{app} AND stream=#{stream}") | 71 | "WHERE app=#{app} AND stream=#{stream}") |
| 72 | - int updateStatus(String app, String stream, boolean status); | 72 | + int updateStatus(@Param("app") String app, @Param("stream") String stream, @Param("status") boolean status); |
| 73 | 73 | ||
| 74 | @Delete("DELETE FROM wvp_stream_proxy WHERE enable_remove_none_reader=true AND media_server_id=#{mediaServerId}") | 74 | @Delete("DELETE FROM wvp_stream_proxy WHERE enable_remove_none_reader=true AND media_server_id=#{mediaServerId}") |
| 75 | void deleteAutoRemoveItemByMediaServerId(String mediaServerId); | 75 | void deleteAutoRemoveItemByMediaServerId(String mediaServerId); |
src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java
| @@ -79,13 +79,13 @@ public interface StreamPushMapper { | @@ -79,13 +79,13 @@ public interface StreamPushMapper { | ||
| 79 | " <if test='mediaServerId != null' > AND st.media_server_id=#{mediaServerId} </if>" + | 79 | " <if test='mediaServerId != null' > AND st.media_server_id=#{mediaServerId} </if>" + |
| 80 | "order by st.create_time desc" + | 80 | "order by st.create_time desc" + |
| 81 | " </script>"}) | 81 | " </script>"}) |
| 82 | - List<StreamPushItem> selectAllForList(String query, Boolean pushing, String mediaServerId); | 82 | + List<StreamPushItem> selectAllForList(@Param("query") String query, @Param("pushing") Boolean pushing, @Param("mediaServerId") String mediaServerId); |
| 83 | 83 | ||
| 84 | @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") | 84 | @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") |
| 85 | List<StreamPushItem> selectAll(); | 85 | List<StreamPushItem> selectAll(); |
| 86 | 86 | ||
| 87 | @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}") | 87 | @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}") |
| 88 | - StreamPushItem selectOne(String app, String stream); | 88 | + StreamPushItem selectOne(@Param("app") String app, @Param("stream") String stream); |
| 89 | 89 | ||
| 90 | @Insert("<script>" + | 90 | @Insert("<script>" + |
| 91 | "Insert INTO wvp_stream_push (app, stream, total_reader_count, origin_type, origin_type_str, " + | 91 | "Insert INTO wvp_stream_push (app, stream, total_reader_count, origin_type, origin_type_str, " + |
| @@ -122,17 +122,17 @@ public interface StreamPushMapper { | @@ -122,17 +122,17 @@ public interface StreamPushMapper { | ||
| 122 | @Update("UPDATE wvp_stream_push " + | 122 | @Update("UPDATE wvp_stream_push " + |
| 123 | "SET status=#{status} " + | 123 | "SET status=#{status} " + |
| 124 | "WHERE app=#{app} AND stream=#{stream}") | 124 | "WHERE app=#{app} AND stream=#{stream}") |
| 125 | - int updateStatus(String app, String stream, boolean status); | 125 | + int updateStatus(@Param("app") String app, @Param("stream") String stream, @Param("status") boolean status); |
| 126 | 126 | ||
| 127 | @Update("UPDATE wvp_stream_push " + | 127 | @Update("UPDATE wvp_stream_push " + |
| 128 | "SET push_ing=#{pushIng} " + | 128 | "SET push_ing=#{pushIng} " + |
| 129 | "WHERE app=#{app} AND stream=#{stream}") | 129 | "WHERE app=#{app} AND stream=#{stream}") |
| 130 | - int updatePushStatus(String app, String stream, boolean pushIng); | 130 | + int updatePushStatus(@Param("app") String app, @Param("stream") String stream, @Param("pushIng") boolean pushIng); |
| 131 | 131 | ||
| 132 | @Update("UPDATE wvp_stream_push " + | 132 | @Update("UPDATE wvp_stream_push " + |
| 133 | "SET status=#{status} " + | 133 | "SET status=#{status} " + |
| 134 | "WHERE media_server_id=#{mediaServerId}") | 134 | "WHERE media_server_id=#{mediaServerId}") |
| 135 | - void updateStatusByMediaServerId(String mediaServerId, boolean status); | 135 | + void updateStatusByMediaServerId(@Param("mediaServerId") String mediaServerId, @Param("status") boolean status); |
| 136 | 136 | ||
| 137 | 137 | ||
| 138 | @Select("<script> "+ | 138 | @Select("<script> "+ |
src/main/java/com/genersoft/iot/vmp/storager/dao/UserMapper.java
| @@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.storager.dao; | @@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.storager.dao; | ||
| 2 | 2 | ||
| 3 | import com.genersoft.iot.vmp.storager.dao.dto.User; | 3 | import com.genersoft.iot.vmp.storager.dao.dto.User; |
| 4 | import org.apache.ibatis.annotations.*; | 4 | import org.apache.ibatis.annotations.*; |
| 5 | +import org.apache.ibatis.annotations.Param; | ||
| 5 | import org.springframework.stereotype.Repository; | 6 | import org.springframework.stereotype.Repository; |
| 6 | 7 | ||
| 7 | import java.util.List; | 8 | import java.util.List; |
| @@ -36,7 +37,7 @@ public interface UserMapper { | @@ -36,7 +37,7 @@ public interface UserMapper { | ||
| 36 | @Result(column = "role_create_time", property = "role.createTime"), | 37 | @Result(column = "role_create_time", property = "role.createTime"), |
| 37 | @Result(column = "role_update_time", property = "role.updateTime") | 38 | @Result(column = "role_update_time", property = "role.updateTime") |
| 38 | }) | 39 | }) |
| 39 | - User select(String username, String password); | 40 | + User select(@Param("username") String username, @Param("password") String password); |
| 40 | 41 | ||
| 41 | @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}") | 42 | @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}") |
| 42 | @ResultMap(value="roleMap") | 43 | @ResultMap(value="roleMap") |
| @@ -55,5 +56,5 @@ public interface UserMapper { | @@ -55,5 +56,5 @@ public interface UserMapper { | ||
| 55 | List<User> getUsers(); | 56 | List<User> getUsers(); |
| 56 | 57 | ||
| 57 | @Update("UPDATE wvp_user set push_key=#{pushKey} where id=#{id}") | 58 | @Update("UPDATE wvp_user set push_key=#{pushKey} where id=#{id}") |
| 58 | - int changePushKey(int id, String pushKey); | 59 | + int changePushKey(@Param("id") int id, @Param("pushKey") String pushKey); |
| 59 | } | 60 | } |
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java
| @@ -179,9 +179,19 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { | @@ -179,9 +179,19 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { | ||
| 179 | return false; | 179 | return false; |
| 180 | } | 180 | } |
| 181 | try { | 181 | try { |
| 182 | - int cleanChannelsResult = deviceChannelMapper.cleanChannelsNotInList(deviceId, channels); | ||
| 183 | - | ||
| 184 | - int limitCount = 300; | 182 | + int limitCount = 50; |
| 183 | + int cleanChannelsResult = 0; | ||
| 184 | + if (channels.size() > limitCount) { | ||
| 185 | + for (int i = 0; i < channels.size(); i += limitCount) { | ||
| 186 | + int toIndex = i + limitCount; | ||
| 187 | + if (i + limitCount > channels.size()) { | ||
| 188 | + toIndex = channels.size(); | ||
| 189 | + } | ||
| 190 | + cleanChannelsResult += this.deviceChannelMapper.cleanChannelsNotInList(deviceId, channels.subList(i, toIndex)); | ||
| 191 | + } | ||
| 192 | + } else { | ||
| 193 | + cleanChannelsResult = this.deviceChannelMapper.cleanChannelsNotInList(deviceId, channels); | ||
| 194 | + } | ||
| 185 | boolean result = cleanChannelsResult < 0; | 195 | boolean result = cleanChannelsResult < 0; |
| 186 | if (!result && addChannels.size() > 0) { | 196 | if (!result && addChannels.size() > 0) { |
| 187 | if (addChannels.size() > limitCount) { | 197 | if (addChannels.size() > limitCount) { |
| @@ -237,12 +247,12 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { | @@ -237,12 +247,12 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { | ||
| 237 | allChannelMap.put(deviceChannel.getChannelId(), deviceChannel); | 247 | allChannelMap.put(deviceChannel.getChannelId(), deviceChannel); |
| 238 | } | 248 | } |
| 239 | } | 249 | } |
| 240 | - List<DeviceChannel> addChannels = new ArrayList<>(); | ||
| 241 | - List<DeviceChannel> updateChannels = new ArrayList<>(); | ||
| 242 | - | ||
| 243 | - | ||
| 244 | TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition); | 250 | TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition); |
| 245 | // 数据去重 | 251 | // 数据去重 |
| 252 | + List<DeviceChannel> channels = new ArrayList<>(); | ||
| 253 | + | ||
| 254 | + List<DeviceChannel> updateChannels = new ArrayList<>(); | ||
| 255 | + List<DeviceChannel> addChannels = new ArrayList<>(); | ||
| 246 | StringBuilder stringBuilder = new StringBuilder(); | 256 | StringBuilder stringBuilder = new StringBuilder(); |
| 247 | Map<String, Integer> subContMap = new HashMap<>(); | 257 | Map<String, Integer> subContMap = new HashMap<>(); |
| 248 | if (deviceChannelList.size() > 0) { | 258 | if (deviceChannelList.size() > 0) { |
| @@ -251,15 +261,24 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { | @@ -251,15 +261,24 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { | ||
| 251 | for (DeviceChannel deviceChannel : deviceChannelList) { | 261 | for (DeviceChannel deviceChannel : deviceChannelList) { |
| 252 | if (!gbIdSet.contains(deviceChannel.getChannelId())) { | 262 | if (!gbIdSet.contains(deviceChannel.getChannelId())) { |
| 253 | gbIdSet.add(deviceChannel.getChannelId()); | 263 | gbIdSet.add(deviceChannel.getChannelId()); |
| 264 | + deviceChannel.setUpdateTime(DateUtil.getNow()); | ||
| 254 | if (allChannelMap.containsKey(deviceChannel.getChannelId())) { | 265 | if (allChannelMap.containsKey(deviceChannel.getChannelId())) { |
| 255 | deviceChannel.setStreamId(allChannelMap.get(deviceChannel.getChannelId()).getStreamId()); | 266 | deviceChannel.setStreamId(allChannelMap.get(deviceChannel.getChannelId()).getStreamId()); |
| 256 | deviceChannel.setHasAudio(allChannelMap.get(deviceChannel.getChannelId()).isHasAudio()); | 267 | deviceChannel.setHasAudio(allChannelMap.get(deviceChannel.getChannelId()).isHasAudio()); |
| 257 | - deviceChannel.setUpdateTime(DateUtil.getNow()); | 268 | + if (allChannelMap.get(deviceChannel.getChannelId()).isStatus() !=deviceChannel.isStatus()){ |
| 269 | + List<String> strings = platformChannelMapper.queryParentPlatformByChannelId(deviceChannel.getChannelId()); | ||
| 270 | + if (!CollectionUtils.isEmpty(strings)){ | ||
| 271 | + strings.forEach(platformId->{ | ||
| 272 | + eventPublisher.catalogEventPublish(platformId, deviceChannel, deviceChannel.isStatus()?CatalogEvent.ON:CatalogEvent.OFF); | ||
| 273 | + }); | ||
| 274 | + } | ||
| 275 | + } | ||
| 258 | updateChannels.add(deviceChannel); | 276 | updateChannels.add(deviceChannel); |
| 259 | }else { | 277 | }else { |
| 260 | deviceChannel.setCreateTime(DateUtil.getNow()); | 278 | deviceChannel.setCreateTime(DateUtil.getNow()); |
| 261 | addChannels.add(deviceChannel); | 279 | addChannels.add(deviceChannel); |
| 262 | } | 280 | } |
| 281 | + channels.add(deviceChannel); | ||
| 263 | if (!ObjectUtils.isEmpty(deviceChannel.getParentId())) { | 282 | if (!ObjectUtils.isEmpty(deviceChannel.getParentId())) { |
| 264 | if (subContMap.get(deviceChannel.getParentId()) == null) { | 283 | if (subContMap.get(deviceChannel.getParentId()) == null) { |
| 265 | subContMap.put(deviceChannel.getParentId(), 1); | 284 | subContMap.put(deviceChannel.getParentId(), 1); |
| @@ -272,15 +291,8 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { | @@ -272,15 +291,8 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { | ||
| 272 | stringBuilder.append(deviceChannel.getChannelId()).append(","); | 291 | stringBuilder.append(deviceChannel.getChannelId()).append(","); |
| 273 | } | 292 | } |
| 274 | } | 293 | } |
| 275 | - if (addChannels.size() > 0) { | ||
| 276 | - for (DeviceChannel channel : addChannels) { | ||
| 277 | - if (subContMap.get(channel.getChannelId()) != null){ | ||
| 278 | - channel.setSubCount(subContMap.get(channel.getChannelId())); | ||
| 279 | - } | ||
| 280 | - } | ||
| 281 | - } | ||
| 282 | - if (updateChannels.size() > 0) { | ||
| 283 | - for (DeviceChannel channel : updateChannels) { | 294 | + if (channels.size() > 0) { |
| 295 | + for (DeviceChannel channel : channels) { | ||
| 284 | if (subContMap.get(channel.getChannelId()) != null){ | 296 | if (subContMap.get(channel.getChannelId()) != null){ |
| 285 | channel.setSubCount(subContMap.get(channel.getChannelId())); | 297 | channel.setSubCount(subContMap.get(channel.getChannelId())); |
| 286 | } | 298 | } |
| @@ -291,12 +303,12 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { | @@ -291,12 +303,12 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { | ||
| 291 | if (stringBuilder.length() > 0) { | 303 | if (stringBuilder.length() > 0) { |
| 292 | logger.info("[目录查询]收到的数据存在重复: {}" , stringBuilder); | 304 | logger.info("[目录查询]收到的数据存在重复: {}" , stringBuilder); |
| 293 | } | 305 | } |
| 294 | - if(CollectionUtils.isEmpty(updateChannels) && CollectionUtils.isEmpty(addChannels) ){ | ||
| 295 | - logger.info("通道更新,数据为空={}" , deviceChannelList); | 306 | + if(CollectionUtils.isEmpty(channels)){ |
| 307 | + logger.info("通道重设,数据为空={}" , deviceChannelList); | ||
| 296 | return false; | 308 | return false; |
| 297 | } | 309 | } |
| 298 | try { | 310 | try { |
| 299 | - int limitCount = 300; | 311 | + int limitCount = 50; |
| 300 | boolean result = false; | 312 | boolean result = false; |
| 301 | if (addChannels.size() > 0) { | 313 | if (addChannels.size() > 0) { |
| 302 | if (addChannels.size() > limitCount) { | 314 | if (addChannels.size() > limitCount) { |
| @@ -305,10 +317,10 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { | @@ -305,10 +317,10 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { | ||
| 305 | if (i + limitCount > addChannels.size()) { | 317 | if (i + limitCount > addChannels.size()) { |
| 306 | toIndex = addChannels.size(); | 318 | toIndex = addChannels.size(); |
| 307 | } | 319 | } |
| 308 | - result = result || deviceChannelMapper.batchAddOrUpdate(addChannels.subList(i, toIndex)) < 0; | 320 | + result = result || deviceChannelMapper.batchAdd(addChannels.subList(i, toIndex)) < 0; |
| 309 | } | 321 | } |
| 310 | }else { | 322 | }else { |
| 311 | - result = result || deviceChannelMapper.batchAddOrUpdate(addChannels) < 0; | 323 | + result = result || deviceChannelMapper.batchAdd(addChannels) < 0; |
| 312 | } | 324 | } |
| 313 | } | 325 | } |
| 314 | if (updateChannels.size() > 0) { | 326 | if (updateChannels.size() > 0) { |
| @@ -324,13 +336,12 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { | @@ -324,13 +336,12 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { | ||
| 324 | result = result || deviceChannelMapper.batchUpdate(updateChannels) < 0; | 336 | result = result || deviceChannelMapper.batchUpdate(updateChannels) < 0; |
| 325 | } | 337 | } |
| 326 | } | 338 | } |
| 339 | + | ||
| 327 | if (result) { | 340 | if (result) { |
| 328 | //事务回滚 | 341 | //事务回滚 |
| 329 | dataSourceTransactionManager.rollback(transactionStatus); | 342 | dataSourceTransactionManager.rollback(transactionStatus); |
| 330 | - }else { | ||
| 331 | - //手动提交 | ||
| 332 | - dataSourceTransactionManager.commit(transactionStatus); | ||
| 333 | } | 343 | } |
| 344 | + dataSourceTransactionManager.commit(transactionStatus); //手动提交 | ||
| 334 | return true; | 345 | return true; |
| 335 | }catch (Exception e) { | 346 | }catch (Exception e) { |
| 336 | logger.error("未处理的异常 ", e); | 347 | logger.error("未处理的异常 ", e); |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java
| @@ -41,6 +41,8 @@ import org.springframework.web.context.request.async.DeferredResult; | @@ -41,6 +41,8 @@ import org.springframework.web.context.request.async.DeferredResult; | ||
| 41 | import javax.servlet.http.HttpServletRequest; | 41 | import javax.servlet.http.HttpServletRequest; |
| 42 | import javax.sip.InvalidArgumentException; | 42 | import javax.sip.InvalidArgumentException; |
| 43 | import javax.sip.SipException; | 43 | import javax.sip.SipException; |
| 44 | +import java.net.MalformedURLException; | ||
| 45 | +import java.net.URL; | ||
| 44 | import java.text.ParseException; | 46 | import java.text.ParseException; |
| 45 | import java.util.List; | 47 | import java.util.List; |
| 46 | import java.util.UUID; | 48 | import java.util.UUID; |
| @@ -133,7 +135,15 @@ public class PlayController { | @@ -133,7 +135,15 @@ public class PlayController { | ||
| 133 | if (data != null) { | 135 | if (data != null) { |
| 134 | StreamInfo streamInfo = (StreamInfo)data; | 136 | StreamInfo streamInfo = (StreamInfo)data; |
| 135 | if (userSetting.getUseSourceIpAsStreamIp()) { | 137 | if (userSetting.getUseSourceIpAsStreamIp()) { |
| 136 | - streamInfo.channgeStreamIp(request.getLocalAddr()); | 138 | + streamInfo=streamInfo.clone();//深拷贝 |
| 139 | + String host; | ||
| 140 | + try { | ||
| 141 | + URL url=new URL(request.getRequestURL().toString()); | ||
| 142 | + host=url.getHost(); | ||
| 143 | + } catch (MalformedURLException e) { | ||
| 144 | + host=request.getLocalAddr(); | ||
| 145 | + } | ||
| 146 | + streamInfo.channgeStreamIp(host); | ||
| 137 | } | 147 | } |
| 138 | wvpResult.setData(new StreamContent(streamInfo)); | 148 | wvpResult.setData(new StreamContent(streamInfo)); |
| 139 | } | 149 | } |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java
| @@ -34,6 +34,8 @@ import org.springframework.web.context.request.async.DeferredResult; | @@ -34,6 +34,8 @@ import org.springframework.web.context.request.async.DeferredResult; | ||
| 34 | import javax.servlet.http.HttpServletRequest; | 34 | import javax.servlet.http.HttpServletRequest; |
| 35 | import javax.sip.InvalidArgumentException; | 35 | import javax.sip.InvalidArgumentException; |
| 36 | import javax.sip.SipException; | 36 | import javax.sip.SipException; |
| 37 | +import java.net.MalformedURLException; | ||
| 38 | +import java.net.URL; | ||
| 37 | import java.text.ParseException; | 39 | import java.text.ParseException; |
| 38 | import java.util.UUID; | 40 | import java.util.UUID; |
| 39 | 41 | ||
| @@ -99,7 +101,15 @@ public class PlaybackController { | @@ -99,7 +101,15 @@ public class PlaybackController { | ||
| 99 | if (data != null) { | 101 | if (data != null) { |
| 100 | StreamInfo streamInfo = (StreamInfo)data; | 102 | StreamInfo streamInfo = (StreamInfo)data; |
| 101 | if (userSetting.getUseSourceIpAsStreamIp()) { | 103 | if (userSetting.getUseSourceIpAsStreamIp()) { |
| 102 | - streamInfo.channgeStreamIp(request.getLocalAddr()); | 104 | + streamInfo=streamInfo.clone();//深拷贝 |
| 105 | + String host; | ||
| 106 | + try { | ||
| 107 | + URL url=new URL(request.getRequestURL().toString()); | ||
| 108 | + host=url.getHost(); | ||
| 109 | + } catch (MalformedURLException e) { | ||
| 110 | + host=request.getLocalAddr(); | ||
| 111 | + } | ||
| 112 | + streamInfo.channgeStreamIp(host); | ||
| 103 | } | 113 | } |
| 104 | wvpResult.setData(new StreamContent(streamInfo)); | 114 | wvpResult.setData(new StreamContent(streamInfo)); |
| 105 | } | 115 | } |
src/main/resources/application.yml