Browse Source

修复设备删除

pull/360/head
648540858 3 years ago
parent
commit
0cd86a79c2
  1. 1
      src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java
  2. 2
      src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java
  3. 14
      src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java
  4. 9
      src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java

1
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java

@ -72,7 +72,6 @@ public class ZLMRESTfulUtils {
ResponseBody responseBody = response.body();
if (responseBody != null) {
String responseStr = responseBody.string();
System.out.println(responseStr);
responseJSON = JSON.parseObject(responseStr);
}
}else {

2
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.genersoft.iot.vmp.common.VideoManagerConstants;
import com.genersoft.iot.vmp.conf.MediaConfig;
import com.genersoft.iot.vmp.conf.SipConfig;
import com.genersoft.iot.vmp.conf.UserSetup;
import com.genersoft.iot.vmp.gb28181.bean.Device;
@ -278,6 +279,7 @@ public class MediaServerServiceImpl implements IMediaServerService, CommandLineR
@Override
public MediaServerItem getDefaultMediaServer() {
return mediaServerMapper.queryDefault();
}

14
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.genersoft.iot.vmp.common.StreamInfo;
import com.genersoft.iot.vmp.conf.MediaConfig;
import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
import com.genersoft.iot.vmp.media.zlm.dto.MediaItem;
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
@ -26,6 +27,10 @@ public class MediaServiceImpl implements IMediaService {
@Autowired
private IMediaServerService mediaServerService;
@Autowired
private MediaConfig mediaConfig;
@Autowired
private ZLMRESTfulUtils zlmresTfulUtils;
@ -39,15 +44,12 @@ public class MediaServiceImpl implements IMediaService {
@Override
public StreamInfo getStreamInfoByAppAndStreamWithCheck(String app, String stream, String mediaServerId, String addr) {
StreamInfo streamInfo = null;
MediaServerItem mediaInfo;
if (mediaServerId == null) {
mediaInfo = mediaServerService.getDefaultMediaServer();
}else {
mediaInfo = mediaServerService.getOne(mediaServerId);
mediaServerId = mediaConfig.getId();
}
MediaServerItem mediaInfo = mediaServerService.getOne(mediaServerId);;
if (mediaInfo == null) {
return streamInfo;
return null;
}
JSONObject mediaList = zlmresTfulUtils.getMediaList(mediaInfo, app, stream);
if (mediaList != null) {

9
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java

@ -41,7 +41,11 @@ public interface PlatformChannelMapper {
int delChannelForGB(String platformId, List<ChannelReduce> channelReducesToDel);
@Delete("<script> "+
"DELETE FROM platform_gb_channel WHERE deviceId='${deviceId}' " +
"DELETE FROM platform_gb_channel WHERE deviceChannelId in " +
"( select temp.deviceChannelId from " +
"(select pgc.deviceChannelId from platform_gb_channel pgc " +
"left join device_channel dc on dc.id = pgc.deviceChannelId where dc.deviceId =#{deviceId} " +
") temp)" +
"</script>")
int delChannelForDeviceId(String deviceId);
@ -50,8 +54,7 @@ public interface PlatformChannelMapper {
"</script>")
int cleanChannelForGB(String platformId);
@Select("SELECT * FROM device_channel WHERE deviceId = (SELECT deviceId FROM platform_gb_channel WHERE " +
"platformId='${platformId}' AND channelId='${channelId}' ) AND channelId='${channelId}'")
@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}'")
DeviceChannel queryChannelInParentPlatform(String platformId, String channelId);
@Select("select dc.channelId as id, dc.name as name, pgc.platformId as platformId, pgc.catalogId as parentId, 0 as childrenCount, 1 as type " +

Loading…
Cancel
Save