Commit 0cd86a79c229167f9e2f9d3284d577732061c317
1 parent
7400ace6
修复设备删除
Showing
4 changed files
with
16 additions
and
10 deletions
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java
| @@ -72,7 +72,6 @@ public class ZLMRESTfulUtils { | @@ -72,7 +72,6 @@ public class ZLMRESTfulUtils { | ||
| 72 | ResponseBody responseBody = response.body(); | 72 | ResponseBody responseBody = response.body(); |
| 73 | if (responseBody != null) { | 73 | if (responseBody != null) { |
| 74 | String responseStr = responseBody.string(); | 74 | String responseStr = responseBody.string(); |
| 75 | - System.out.println(responseStr); | ||
| 76 | responseJSON = JSON.parseObject(responseStr); | 75 | responseJSON = JSON.parseObject(responseStr); |
| 77 | } | 76 | } |
| 78 | }else { | 77 | }else { |
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java
| @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; | @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; | ||
| 4 | import com.alibaba.fastjson.JSONArray; | 4 | import com.alibaba.fastjson.JSONArray; |
| 5 | import com.alibaba.fastjson.JSONObject; | 5 | import com.alibaba.fastjson.JSONObject; |
| 6 | import com.genersoft.iot.vmp.common.VideoManagerConstants; | 6 | import com.genersoft.iot.vmp.common.VideoManagerConstants; |
| 7 | +import com.genersoft.iot.vmp.conf.MediaConfig; | ||
| 7 | import com.genersoft.iot.vmp.conf.SipConfig; | 8 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 8 | import com.genersoft.iot.vmp.conf.UserSetup; | 9 | import com.genersoft.iot.vmp.conf.UserSetup; |
| 9 | import com.genersoft.iot.vmp.gb28181.bean.Device; | 10 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| @@ -278,6 +279,7 @@ public class MediaServerServiceImpl implements IMediaServerService, CommandLineR | @@ -278,6 +279,7 @@ public class MediaServerServiceImpl implements IMediaServerService, CommandLineR | ||
| 278 | 279 | ||
| 279 | @Override | 280 | @Override |
| 280 | public MediaServerItem getDefaultMediaServer() { | 281 | public MediaServerItem getDefaultMediaServer() { |
| 282 | + | ||
| 281 | return mediaServerMapper.queryDefault(); | 283 | return mediaServerMapper.queryDefault(); |
| 282 | } | 284 | } |
| 283 | 285 |
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java
| @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; | @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; | ||
| 4 | import com.alibaba.fastjson.JSONArray; | 4 | import com.alibaba.fastjson.JSONArray; |
| 5 | import com.alibaba.fastjson.JSONObject; | 5 | import com.alibaba.fastjson.JSONObject; |
| 6 | import com.genersoft.iot.vmp.common.StreamInfo; | 6 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 7 | +import com.genersoft.iot.vmp.conf.MediaConfig; | ||
| 7 | import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; | 8 | import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; |
| 8 | import com.genersoft.iot.vmp.media.zlm.dto.MediaItem; | 9 | import com.genersoft.iot.vmp.media.zlm.dto.MediaItem; |
| 9 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | 10 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| @@ -26,6 +27,10 @@ public class MediaServiceImpl implements IMediaService { | @@ -26,6 +27,10 @@ public class MediaServiceImpl implements IMediaService { | ||
| 26 | @Autowired | 27 | @Autowired |
| 27 | private IMediaServerService mediaServerService; | 28 | private IMediaServerService mediaServerService; |
| 28 | 29 | ||
| 30 | + | ||
| 31 | + @Autowired | ||
| 32 | + private MediaConfig mediaConfig; | ||
| 33 | + | ||
| 29 | @Autowired | 34 | @Autowired |
| 30 | private ZLMRESTfulUtils zlmresTfulUtils; | 35 | private ZLMRESTfulUtils zlmresTfulUtils; |
| 31 | 36 | ||
| @@ -39,15 +44,12 @@ public class MediaServiceImpl implements IMediaService { | @@ -39,15 +44,12 @@ public class MediaServiceImpl implements IMediaService { | ||
| 39 | @Override | 44 | @Override |
| 40 | public StreamInfo getStreamInfoByAppAndStreamWithCheck(String app, String stream, String mediaServerId, String addr) { | 45 | public StreamInfo getStreamInfoByAppAndStreamWithCheck(String app, String stream, String mediaServerId, String addr) { |
| 41 | StreamInfo streamInfo = null; | 46 | StreamInfo streamInfo = null; |
| 42 | - | ||
| 43 | - MediaServerItem mediaInfo; | ||
| 44 | if (mediaServerId == null) { | 47 | if (mediaServerId == null) { |
| 45 | - mediaInfo = mediaServerService.getDefaultMediaServer(); | ||
| 46 | - }else { | ||
| 47 | - mediaInfo = mediaServerService.getOne(mediaServerId); | 48 | + mediaServerId = mediaConfig.getId(); |
| 48 | } | 49 | } |
| 50 | + MediaServerItem mediaInfo = mediaServerService.getOne(mediaServerId);; | ||
| 49 | if (mediaInfo == null) { | 51 | if (mediaInfo == null) { |
| 50 | - return streamInfo; | 52 | + return null; |
| 51 | } | 53 | } |
| 52 | JSONObject mediaList = zlmresTfulUtils.getMediaList(mediaInfo, app, stream); | 54 | JSONObject mediaList = zlmresTfulUtils.getMediaList(mediaInfo, app, stream); |
| 53 | if (mediaList != null) { | 55 | if (mediaList != null) { |
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java
| @@ -41,7 +41,11 @@ public interface PlatformChannelMapper { | @@ -41,7 +41,11 @@ public interface PlatformChannelMapper { | ||
| 41 | int delChannelForGB(String platformId, List<ChannelReduce> channelReducesToDel); | 41 | int delChannelForGB(String platformId, List<ChannelReduce> channelReducesToDel); |
| 42 | 42 | ||
| 43 | @Delete("<script> "+ | 43 | @Delete("<script> "+ |
| 44 | - "DELETE FROM platform_gb_channel WHERE deviceId='${deviceId}' " + | 44 | + "DELETE FROM platform_gb_channel WHERE deviceChannelId in " + |
| 45 | + "( select temp.deviceChannelId from " + | ||
| 46 | + "(select pgc.deviceChannelId from platform_gb_channel pgc " + | ||
| 47 | + "left join device_channel dc on dc.id = pgc.deviceChannelId where dc.deviceId =#{deviceId} " + | ||
| 48 | + ") temp)" + | ||
| 45 | "</script>") | 49 | "</script>") |
| 46 | int delChannelForDeviceId(String deviceId); | 50 | int delChannelForDeviceId(String deviceId); |
| 47 | 51 | ||
| @@ -50,8 +54,7 @@ public interface PlatformChannelMapper { | @@ -50,8 +54,7 @@ public interface PlatformChannelMapper { | ||
| 50 | "</script>") | 54 | "</script>") |
| 51 | int cleanChannelForGB(String platformId); | 55 | int cleanChannelForGB(String platformId); |
| 52 | 56 | ||
| 53 | - @Select("SELECT * FROM device_channel WHERE deviceId = (SELECT deviceId FROM platform_gb_channel WHERE " + | ||
| 54 | - "platformId='${platformId}' AND channelId='${channelId}' ) AND channelId='${channelId}'") | 57 | + @Select("SELECT dc.* FROM platform_gb_channel pgc left join device_channel dc on dc.id = pgc.deviceChannelId WHERE dc.channelId='${channelId}' and pgc.platformId='${platformId}'") |
| 55 | DeviceChannel queryChannelInParentPlatform(String platformId, String channelId); | 58 | DeviceChannel queryChannelInParentPlatform(String platformId, String channelId); |
| 56 | 59 | ||
| 57 | @Select("select dc.channelId as id, dc.name as name, pgc.platformId as platformId, pgc.catalogId as parentId, 0 as childrenCount, 1 as type " + | 60 | @Select("select dc.channelId as id, dc.name as name, pgc.platformId as platformId, pgc.catalogId as parentId, 0 as childrenCount, 1 as type " + |