Commit b97db305eb110da024e2e5c922e31f8665d65520

Authored by luoshuyue
1 parent a42dda2b

修复了拉流添加国标编码上级级联调取不到视频的bug

sql/mysql.sql
@@ -389,7 +389,7 @@ DROP TABLE IF EXISTS `platform_gb_stream`; @@ -389,7 +389,7 @@ DROP TABLE IF EXISTS `platform_gb_stream`;
389 CREATE TABLE `platform_gb_stream` ( 389 CREATE TABLE `platform_gb_stream` (
390 `platformId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, 390 `platformId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
391 `catalogId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, 391 `catalogId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
392 - `gbStreamId` int NOT NULL, 392 + `gbStreamId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
393 `id` int NOT NULL AUTO_INCREMENT, 393 `id` int NOT NULL AUTO_INCREMENT,
394 PRIMARY KEY (`id`), 394 PRIMARY KEY (`id`),
395 UNIQUE KEY `platform_gb_stream_pk` (`platformId`,`catalogId`,`gbStreamId`) 395 UNIQUE KEY `platform_gb_stream_pk` (`platformId`,`catalogId`,`gbStreamId`)
src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java
@@ -41,15 +41,15 @@ public interface GbStreamMapper { @@ -41,15 +41,15 @@ public interface GbStreamMapper {
41 "SELECT gs.* FROM gb_stream gs " + 41 "SELECT gs.* FROM gb_stream gs " +
42 "WHERE " + 42 "WHERE " +
43 "1=1 " + 43 "1=1 " +
44 - " <if test='catalogId != null'> AND gs.gbStreamId in" + 44 + " <if test='catalogId != null'> AND gs.gbId in" +
45 "(select pgs.gbStreamId from platform_gb_stream pgs where pgs.platformId = #{platformId} and pgs.catalogId=#{catalogId})</if> " + 45 "(select pgs.gbStreamId from platform_gb_stream pgs where pgs.platformId = #{platformId} and pgs.catalogId=#{catalogId})</if> " +
46 - " <if test='catalogId == null'> AND gs.gbStreamId not in" + 46 + " <if test='catalogId == null'> AND gs.gbId not in" +
47 "(select pgs.gbStreamId from platform_gb_stream pgs where pgs.platformId = #{platformId}) </if> " + 47 "(select pgs.gbStreamId from platform_gb_stream pgs where pgs.platformId = #{platformId}) </if> " +
48 " <if test='query != null'> AND (gs.app LIKE '%${query}%' OR gs.stream LIKE '%${query}%' OR gs.gbId LIKE '%${query}%' OR gs.name LIKE '%${query}%')</if> " + 48 " <if test='query != null'> AND (gs.app LIKE '%${query}%' OR gs.stream LIKE '%${query}%' OR gs.gbId LIKE '%${query}%' OR gs.name LIKE '%${query}%')</if> " +
49 " <if test='pushing == true' > AND gs.status=1</if>" + 49 " <if test='pushing == true' > AND gs.status=1</if>" +
50 " <if test='pushing == false' > AND gs.status=0</if>" + 50 " <if test='pushing == false' > AND gs.status=0</if>" +
51 " <if test='mediaServerId != null' > AND gs.mediaServerId=#{mediaServerId} </if>" + 51 " <if test='mediaServerId != null' > AND gs.mediaServerId=#{mediaServerId} </if>" +
52 - " order by gs.gbStreamId asc " + 52 + " order by gs.gbId asc " +
53 "</script>") 53 "</script>")
54 List<GbStream> selectAll(String platformId, String catalogId, String query, Boolean pushing, String mediaServerId); 54 List<GbStream> selectAll(String platformId, String catalogId, String query, Boolean pushing, String mediaServerId);
55 55
@@ -60,18 +60,18 @@ public interface GbStreamMapper { @@ -60,18 +60,18 @@ public interface GbStreamMapper {
60 List<GbStream> selectByGBId(String gbId); 60 List<GbStream> selectByGBId(String gbId);
61 61
62 @Select("SELECT gs.*, pgs.platformId as platformId, pgs.catalogId as catalogId FROM gb_stream gs " + 62 @Select("SELECT gs.*, pgs.platformId as platformId, pgs.catalogId as catalogId FROM gb_stream gs " +
63 - "LEFT JOIN platform_gb_stream pgs ON gs.gbStreamId = pgs.catalogId " + 63 + "LEFT JOIN platform_gb_stream pgs ON gs.gbId = pgs.gbStreamId " +
64 "WHERE gs.gbId = '${gbId}' AND pgs.platformId = '${platformId}'") 64 "WHERE gs.gbId = '${gbId}' AND pgs.platformId = '${platformId}'")
65 GbStream queryStreamInPlatform(String platformId, String gbId); 65 GbStream queryStreamInPlatform(String platformId, String gbId);
66 66
67 @Select("SELECT gs.*, pgs.platformId as platformId, pgs.catalogId as catalogId FROM gb_stream gs " + 67 @Select("SELECT gs.*, pgs.platformId as platformId, pgs.catalogId as catalogId FROM gb_stream gs " +
68 - "LEFT JOIN platform_gb_stream pgs ON gs.gbStreamId = pgs.gbStreamId " + 68 + "LEFT JOIN platform_gb_stream pgs ON gs.gbId = pgs.gbStreamId " +
69 "WHERE pgs.platformId = #{platformId}") 69 "WHERE pgs.platformId = #{platformId}")
70 List<GbStream> queryGbStreamListInPlatform(String platformId); 70 List<GbStream> queryGbStreamListInPlatform(String platformId);
71 71
72 72
73 @Select("SELECT gs.* FROM gb_stream gs LEFT JOIN platform_gb_stream pgs " + 73 @Select("SELECT gs.* FROM gb_stream gs LEFT JOIN platform_gb_stream pgs " +
74 - "ON gs.gbStreamId = pgs.gbStreamId WHERE pgs.gbStreamId is NULL") 74 + "ON gs.gbId = pgs.gbStreamId WHERE pgs.gbStreamId is NULL")
75 List<GbStream> queryStreamNotInPlatform(); 75 List<GbStream> queryStreamNotInPlatform();
76 76
77 @Update("UPDATE gb_stream " + 77 @Update("UPDATE gb_stream " +
@@ -128,10 +128,10 @@ public interface GbStreamMapper { @@ -128,10 +128,10 @@ public interface GbStreamMapper {
128 int updateStreamGPS(List<GPSMsgInfo> gpsMsgInfos); 128 int updateStreamGPS(List<GPSMsgInfo> gpsMsgInfos);
129 129
130 @Select("<script> "+ 130 @Select("<script> "+
131 - "SELECT * FROM gb_stream where " +  
132 - "<foreach collection='streamPushItems' item='item' separator='or'>" +  
133 - "(app=#{item.app} and stream=#{item.stream}) " +  
134 - "</foreach>" +  
135 - "</script>") 131 + "SELECT * FROM gb_stream where " +
  132 + "<foreach collection='streamPushItems' item='item' separator='or'>" +
  133 + "(app=#{item.app} and stream=#{item.stream}) " +
  134 + "</foreach>" +
  135 + "</script>")
136 List<GbStream> selectAllForAppAndStream(List<StreamPushItem> streamPushItems); 136 List<GbStream> selectAllForAppAndStream(List<StreamPushItem> streamPushItems);
137 } 137 }
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java
@@ -17,7 +17,7 @@ import java.util.List; @@ -17,7 +17,7 @@ import java.util.List;
17 public interface PlatformGbStreamMapper { 17 public interface PlatformGbStreamMapper {
18 18
19 @Insert("REPLACE INTO platform_gb_stream (gbStreamId, platformId, catalogId) VALUES" + 19 @Insert("REPLACE INTO platform_gb_stream (gbStreamId, platformId, catalogId) VALUES" +
20 - "( #{gbStreamId}, #{platformId}, #{catalogId})") 20 + "( #{gbId}, #{platformId}, #{catalogId})")
21 int add(PlatformGbStream platformGbStream); 21 int add(PlatformGbStream platformGbStream);
22 22
23 23
@@ -26,12 +26,12 @@ public interface PlatformGbStreamMapper { @@ -26,12 +26,12 @@ public interface PlatformGbStreamMapper {
26 "(gbStreamId, platformId, catalogId) " + 26 "(gbStreamId, platformId, catalogId) " +
27 "values " + 27 "values " +
28 "<foreach collection='streamPushItems' index='index' item='item' separator=','> " + 28 "<foreach collection='streamPushItems' index='index' item='item' separator=','> " +
29 - "(${item.gbStreamId}, '${item.platformId}', '${item.catalogId}')" + 29 + "(#{item.gbId}, #{item.platformId}, #{item.catalogId})" +
30 "</foreach> " + 30 "</foreach> " +
31 "</script>") 31 "</script>")
32 int batchAdd(List<StreamPushItem> streamPushItems); 32 int batchAdd(List<StreamPushItem> streamPushItems);
33 33
34 - @Delete("DELETE FROM platform_gb_stream WHERE gbStreamId = (select gbStreamId from gb_stream where app=#{app} AND stream=#{stream})") 34 + @Delete("DELETE FROM platform_gb_stream WHERE gbStreamId = (select gbId from gb_stream where app=#{app} AND stream=#{stream})")
35 int delByAppAndStream(String app, String stream); 35 int delByAppAndStream(String app, String stream);
36 36
37 @Delete("DELETE FROM platform_gb_stream WHERE platformId=#{platformId}") 37 @Delete("DELETE FROM platform_gb_stream WHERE platformId=#{platformId}")
@@ -42,28 +42,28 @@ public interface PlatformGbStreamMapper { @@ -42,28 +42,28 @@ public interface PlatformGbStreamMapper {
42 "FROM " + 42 "FROM " +
43 "platform_gb_stream pgs " + 43 "platform_gb_stream pgs " +
44 "LEFT JOIN parent_platform pp ON pp.serverGBId = pgs.platformId " + 44 "LEFT JOIN parent_platform pp ON pp.serverGBId = pgs.platformId " +
45 - "LEFT JOIN gb_stream gs ON gs.gbStreamId = pgs.gbStreamId " + 45 + "LEFT JOIN gb_stream gs ON gs.gbId = pgs.gbStreamId " +
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(String app, String stream);
50 50
51 @Select("SELECT pgs.*, gs.gbId FROM platform_gb_stream pgs " + 51 @Select("SELECT pgs.*, gs.gbId FROM platform_gb_stream pgs " +
52 - "LEFT JOIN gb_stream gs ON pgs.gbStreamId = gs.gbStreamId " + 52 + "LEFT JOIN gb_stream gs ON pgs.gbStreamId = gs.gbId " +
53 "WHERE gs.app=#{app} AND gs.stream=#{stream} AND pgs.platformId=#{serverGBId}") 53 "WHERE gs.app=#{app} AND gs.stream=#{stream} AND pgs.platformId=#{serverGBId}")
54 StreamProxyItem selectOne(String app, String stream, String serverGBId); 54 StreamProxyItem selectOne(String app, String stream, String serverGBId);
55 55
56 @Select("select gs.* \n" + 56 @Select("select gs.* \n" +
57 "from gb_stream gs\n" + 57 "from gb_stream gs\n" +
58 " left join platform_gb_stream pgs\n" + 58 " left join platform_gb_stream pgs\n" +
59 - " on gs.gbStreamId = pgs.gbStreamId\n" + 59 + " on gs.gbId = pgs.gbStreamId\n" +
60 "where pgs.platformId=#{platformId} and pgs.catalogId=#{catalogId}") 60 "where pgs.platformId=#{platformId} and pgs.catalogId=#{catalogId}")
61 List<GbStream> queryChannelInParentPlatformAndCatalog(String platformId, String catalogId); 61 List<GbStream> queryChannelInParentPlatformAndCatalog(String platformId, String catalogId);
62 62
63 @Select("select gs.gbId as id, gs.name as name, pgs.platformId as platformId, pgs.catalogId as catalogId , 0 as childrenCount, 2 as type\n" + 63 @Select("select gs.gbId as id, gs.name as name, pgs.platformId as platformId, pgs.catalogId as catalogId , 0 as childrenCount, 2 as type\n" +
64 "from gb_stream gs\n" + 64 "from gb_stream gs\n" +
65 " left join platform_gb_stream pgs\n" + 65 " left join platform_gb_stream pgs\n" +
66 - " on gs.gbStreamId = pgs.gbStreamId\n" + 66 + " on gs.gbId = pgs.gbStreamId\n" +
67 "where pgs.platformId=#{platformId} and pgs.catalogId=#{catalogId}") 67 "where pgs.platformId=#{platformId} and pgs.catalogId=#{catalogId}")
68 List<PlatformCatalog> queryChannelInParentPlatformAndCatalogForCatalog(String platformId, String catalogId); 68 List<PlatformCatalog> queryChannelInParentPlatformAndCatalogForCatalog(String platformId, String catalogId);
69 69
@@ -78,7 +78,7 @@ public interface PlatformGbStreamMapper { @@ -78,7 +78,7 @@ public interface PlatformGbStreamMapper {
78 "left join platform_gb_stream pgs on " + 78 "left join platform_gb_stream pgs on " +
79 "pp.serverGBId = pgs.platformId " + 79 "pp.serverGBId = pgs.platformId " +
80 "left join gb_stream gs " + 80 "left join gb_stream gs " +
81 - "gs.gbStreamId = pgs.gbStreamId " + 81 + "gs.gbId = pgs.gbStreamId " +
82 "WHERE " + 82 "WHERE " +
83 "gs.app = #{app} " + 83 "gs.app = #{app} " +
84 "AND gs.stream = #{stream}" + 84 "AND gs.stream = #{stream}" +
@@ -87,13 +87,13 @@ public interface PlatformGbStreamMapper { @@ -87,13 +87,13 @@ public interface PlatformGbStreamMapper {
87 "</script> ") 87 "</script> ")
88 List<ParentPlatform> queryPlatFormListForGBWithGBId(String app, String stream, List<String> platforms); 88 List<ParentPlatform> queryPlatFormListForGBWithGBId(String app, String stream, List<String> platforms);
89 89
90 - @Delete("DELETE FROM platform_gb_stream WHERE gbStreamId = (select id from gb_stream where app=#{app} AND stream=#{stream}) AND platformId=#{platformId}") 90 + @Delete("DELETE FROM platform_gb_stream WHERE gbStreamId = (select gbId from gb_stream where app=#{app} AND stream=#{stream}) AND platformId=#{platformId}")
91 int delByAppAndStreamAndPlatform(String app, String stream, String platformId); 91 int delByAppAndStreamAndPlatform(String app, String stream, String platformId);
92 92
93 @Delete("<script> "+ 93 @Delete("<script> "+
94 "DELETE FROM platform_gb_stream where gbStreamId in " + 94 "DELETE FROM platform_gb_stream where gbStreamId in " +
95 "<foreach collection='gbStreams' item='item' open='(' separator=',' close=')' >" + 95 "<foreach collection='gbStreams' item='item' open='(' separator=',' close=')' >" +
96 - "#{item.gbStreamId}" + 96 + "#{item.gbId}" +
97 "</foreach>" + 97 "</foreach>" +
98 "</script>") 98 "</script>")
99 void delByGbStreams(List<GbStream> gbStreams); 99 void delByGbStreams(List<GbStream> gbStreams);
@@ -101,7 +101,7 @@ public interface PlatformGbStreamMapper { @@ -101,7 +101,7 @@ public interface PlatformGbStreamMapper {
101 @Delete("<script> "+ 101 @Delete("<script> "+
102 "DELETE FROM platform_gb_stream where platformId=#{platformId} and gbStreamId in " + 102 "DELETE FROM platform_gb_stream where platformId=#{platformId} and gbStreamId in " +
103 "<foreach collection='gbStreams' item='item' open='(' separator=',' close=')'>" + 103 "<foreach collection='gbStreams' item='item' open='(' separator=',' close=')'>" +
104 - "#{item.gbStreamId} " + 104 + "#{item.gbId} " +
105 "</foreach>" + 105 "</foreach>" +
106 "</script>") 106 "</script>")
107 void delByAppAndStreamsByPlatformId(List<GbStream> gbStreams, String platformId); 107 void delByAppAndStreamsByPlatformId(List<GbStream> gbStreams, String platformId);
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
@@ -707,7 +707,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { @@ -707,7 +707,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
707 try { 707 try {
708 if (streamProxyMapper.add(streamProxyItem) > 0) { 708 if (streamProxyMapper.add(streamProxyItem) > 0) {
709 if (!StringUtils.isEmpty(streamProxyItem.getGbId())) { 709 if (!StringUtils.isEmpty(streamProxyItem.getGbId())) {
710 - if (gbStreamMapper.add(streamProxyItem) > 0) { 710 + if (gbStreamMapper.add(streamProxyItem) < 0) {
711 //事务回滚 711 //事务回滚
712 dataSourceTransactionManager.rollback(transactionStatus); 712 dataSourceTransactionManager.rollback(transactionStatus);
713 return false; 713 return false;
@@ -742,7 +742,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { @@ -742,7 +742,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
742 try { 742 try {
743 if (streamProxyMapper.update(streamProxyItem) > 0) { 743 if (streamProxyMapper.update(streamProxyItem) > 0) {
744 if (!StringUtils.isEmpty(streamProxyItem.getGbId())) { 744 if (!StringUtils.isEmpty(streamProxyItem.getGbId())) {
745 - if (gbStreamMapper.update(streamProxyItem) > 0) { 745 + if (gbStreamMapper.update(streamProxyItem) < 0) {
746 //事务回滚 746 //事务回滚
747 dataSourceTransactionManager.rollback(transactionStatus); 747 dataSourceTransactionManager.rollback(transactionStatus);
748 return false; 748 return false;