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 | 72 | ResponseBody responseBody = response.body(); |
| 73 | 73 | if (responseBody != null) { |
| 74 | 74 | String responseStr = responseBody.string(); |
| 75 | - System.out.println(responseStr); | |
| 76 | 75 | responseJSON = JSON.parseObject(responseStr); |
| 77 | 76 | } |
| 78 | 77 | }else { | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java
| ... | ... | @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; |
| 4 | 4 | import com.alibaba.fastjson.JSONArray; |
| 5 | 5 | import com.alibaba.fastjson.JSONObject; |
| 6 | 6 | import com.genersoft.iot.vmp.common.VideoManagerConstants; |
| 7 | +import com.genersoft.iot.vmp.conf.MediaConfig; | |
| 7 | 8 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 8 | 9 | import com.genersoft.iot.vmp.conf.UserSetup; |
| 9 | 10 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| ... | ... | @@ -278,6 +279,7 @@ public class MediaServerServiceImpl implements IMediaServerService, CommandLineR |
| 278 | 279 | |
| 279 | 280 | @Override |
| 280 | 281 | public MediaServerItem getDefaultMediaServer() { |
| 282 | + | |
| 281 | 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 | 4 | import com.alibaba.fastjson.JSONArray; |
| 5 | 5 | import com.alibaba.fastjson.JSONObject; |
| 6 | 6 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 7 | +import com.genersoft.iot.vmp.conf.MediaConfig; | |
| 7 | 8 | import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; |
| 8 | 9 | import com.genersoft.iot.vmp.media.zlm.dto.MediaItem; |
| 9 | 10 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| ... | ... | @@ -26,6 +27,10 @@ public class MediaServiceImpl implements IMediaService { |
| 26 | 27 | @Autowired |
| 27 | 28 | private IMediaServerService mediaServerService; |
| 28 | 29 | |
| 30 | + | |
| 31 | + @Autowired | |
| 32 | + private MediaConfig mediaConfig; | |
| 33 | + | |
| 29 | 34 | @Autowired |
| 30 | 35 | private ZLMRESTfulUtils zlmresTfulUtils; |
| 31 | 36 | |
| ... | ... | @@ -39,15 +44,12 @@ public class MediaServiceImpl implements IMediaService { |
| 39 | 44 | @Override |
| 40 | 45 | public StreamInfo getStreamInfoByAppAndStreamWithCheck(String app, String stream, String mediaServerId, String addr) { |
| 41 | 46 | StreamInfo streamInfo = null; |
| 42 | - | |
| 43 | - MediaServerItem mediaInfo; | |
| 44 | 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 | 51 | if (mediaInfo == null) { |
| 50 | - return streamInfo; | |
| 52 | + return null; | |
| 51 | 53 | } |
| 52 | 54 | JSONObject mediaList = zlmresTfulUtils.getMediaList(mediaInfo, app, stream); |
| 53 | 55 | if (mediaList != null) { | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java
| ... | ... | @@ -41,7 +41,11 @@ public interface PlatformChannelMapper { |
| 41 | 41 | int delChannelForGB(String platformId, List<ChannelReduce> channelReducesToDel); |
| 42 | 42 | |
| 43 | 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 | 49 | "</script>") |
| 46 | 50 | int delChannelForDeviceId(String deviceId); |
| 47 | 51 | |
| ... | ... | @@ -50,8 +54,7 @@ public interface PlatformChannelMapper { |
| 50 | 54 | "</script>") |
| 51 | 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 | 58 | DeviceChannel queryChannelInParentPlatform(String platformId, String channelId); |
| 56 | 59 | |
| 57 | 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 " + | ... | ... |