临时提交

结构优化
648540858 2024-02-01 22:50:41 +08:00
parent c4804af026
commit 241fa9030a
6 changed files with 62 additions and 12 deletions

View File

@ -75,4 +75,6 @@ public interface ICommonGbChannelService {
PageInfo<ShareCommonChannelListResult> getShareChannelList(int platformId, int page, int count, String query, String type, Boolean online); PageInfo<ShareCommonChannelListResult> getShareChannelList(int platformId, int page, int count, String query, String type, Boolean online);
void ptzControl(CommonGbChannel channel, PTZCommand ptzCommand); void ptzControl(CommonGbChannel channel, PTZCommand ptzCommand);
CommonGbChannel getChannelById(int id);
} }

View File

@ -90,4 +90,9 @@ public interface IDeviceChannelService {
* ID * ID
*/ */
Device getDeviceByChannelCommonGbId(int commonGbId); Device getDeviceByChannelCommonGbId(int commonGbId);
/**
* ID
*/
DeviceChannel getChannelByCommonChannelId(int commonGbId);
} }

View File

@ -117,4 +117,9 @@ public interface IStreamPushService {
* 线 * 线
*/ */
void offline(String app, String stream); void offline(String app, String stream);
/**
*
*/
StreamPush getPushByCommonChannelId(int commonGbId);
} }

View File

@ -496,4 +496,9 @@ public class CommonGbChannelServiceImpl implements ICommonGbChannelService {
assert resourceService != null; assert resourceService != null;
resourceService.ptzControl(channel, ptzCommand); resourceService.ptzControl(channel, ptzCommand);
} }
@Override
public CommonGbChannel getChannelById(int id) {
return commonGbChannelMapper.getOne(id);
}
} }

View File

@ -758,4 +758,9 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
public Device getDeviceByChannelCommonGbId(int commonGbId) { public Device getDeviceByChannelCommonGbId(int commonGbId) {
return channelMapper.getDeviceByChannelCommonGbId(commonGbId); return channelMapper.getDeviceByChannelCommonGbId(commonGbId);
} }
@Override
public DeviceChannel getChannelByCommonChannelId(int commonGbId) {
return channelMapper.getChannelByCommonChannelId(commonGbId);
}
} }

View File

@ -2,10 +2,18 @@ package com.genersoft.iot.vmp.vmanager.channel;
import com.genersoft.iot.vmp.common.CommonGbChannel; import com.genersoft.iot.vmp.common.CommonGbChannel;
import com.genersoft.iot.vmp.conf.UserSetting; import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.conf.security.JwtUtils; import com.genersoft.iot.vmp.conf.security.JwtUtils;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
import com.genersoft.iot.vmp.gb28181.bean.command.PTZCommand; import com.genersoft.iot.vmp.gb28181.bean.command.PTZCommand;
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxy;
import com.genersoft.iot.vmp.media.zlm.dto.StreamPush;
import com.genersoft.iot.vmp.service.ICommonGbChannelService; import com.genersoft.iot.vmp.service.ICommonGbChannelService;
import com.genersoft.iot.vmp.service.IDeviceChannelService;
import com.genersoft.iot.vmp.service.IStreamProxyService;
import com.genersoft.iot.vmp.service.IStreamPushService;
import com.genersoft.iot.vmp.service.bean.CommonGbChannelType;
import com.genersoft.iot.vmp.service.bean.DeviceType; import com.genersoft.iot.vmp.service.bean.DeviceType;
import com.genersoft.iot.vmp.service.bean.IndustryCodeType; import com.genersoft.iot.vmp.service.bean.IndustryCodeType;
import com.genersoft.iot.vmp.service.bean.NetworkIdentificationType; import com.genersoft.iot.vmp.service.bean.NetworkIdentificationType;
@ -27,7 +35,9 @@ import org.springframework.web.context.request.async.DeferredResult;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
@Tag(name = "通用国标通道") @Tag(name = "通用国标通道")
@ -46,6 +56,15 @@ public class CommonChannelController {
@Autowired @Autowired
private UserSetting userSetting; private UserSetting userSetting;
@Autowired
private IDeviceChannelService deviceChannelService;
@Autowired
private IStreamPushService streamPushService;
@Autowired
private IStreamProxyService streamProxyService;
@Operation(summary = "更新通道信息", security = @SecurityRequirement(name = JwtUtils.HEADER)) @Operation(summary = "更新通道信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "CommonGbChannel", description = "commonGbChannel", required = true) @Parameter(name = "CommonGbChannel", description = "commonGbChannel", required = true)
@ -355,16 +374,25 @@ public class CommonChannelController {
} }
// 获取通用通道对应的原始资源信息 // 获取通用通道对应的原始资源信息
// @Operation(summary = "通用通道对应的原始资源信息", security = @SecurityRequirement(name = JwtUtils.HEADER)) @Operation(summary = "通用通道对应的原始资源信息", security = @SecurityRequirement(name = JwtUtils.HEADER))
// @Parameter(name = "param", description = "共享通道参数", required = true) @Parameter(name = "param", description = "共享通道参数", required = true)
// @GetMapping("/resource") @GetMapping("/resource")
// public void removeShareChannel(String id) { public Map<String, Object> removeShareChannel(int id) {
// CommonGbChannel commonGbChannel = commonGbChannelService.getChannelById(id); Map<String, Object> resultMap = new HashMap<>();
// if (commonGbChannel == null) { CommonGbChannel commonGbChannel = commonGbChannelService.getChannelById(id);
// throw new ControllerException(ErrorCode.ERROR100.getCode(), "通道不存在"); if (commonGbChannel == null) {
// } throw new ControllerException(ErrorCode.ERROR100.getCode(), "通道不存在");
// }
// if (commonGbChannel.getType().equals(CommonGbChannelType.GB28181)) {
// commonGbChannelService.removeShareChannel(param); DeviceChannel deviceChannel = deviceChannelService.getChannelByCommonChannelId(commonGbChannel.getCommonGbId());
// } resultMap.put(CommonGbChannelType.GB28181, deviceChannel);
}else if (commonGbChannel.getType().equals(CommonGbChannelType.PUSH)) {
StreamPush streamPush = streamPushService.getPushByCommonChannelId(commonGbChannel.getCommonGbId());
resultMap.put(CommonGbChannelType.PUSH, streamPush);
}else if (commonGbChannel.getType().equals(CommonGbChannelType.PROXY)) {
StreamProxy streamProxy = streamProxyService.getProxyByCommonChnanelId(commonGbChannel.getCommonGbId());
resultMap.put(CommonGbChannelType.PROXY, streamProxy);
}
return resultMap;
}
} }