解决串流,解决编辑上级平台却新建了的问题

This commit is contained in:
panlinlin
2021-04-15 17:48:52 +08:00
parent 662ce3b484
commit 937e591430
32 changed files with 574 additions and 153 deletions

View File

@@ -111,7 +111,7 @@ public class PlatformController {
// TODO 检查是否已经存在,且注册成功, 如果注册成功,需要先注销之前再,修改并注册
// ParentPlatform parentPlatformOld = storager.queryParentPlatById(parentPlatform.getDeviceGBId());
ParentPlatform parentPlatformOld = storager.queryParentPlatById(parentPlatform.getServerGBId());
ParentPlatform parentPlatformOld = storager.queryParentPlatByServerGBId(parentPlatform.getServerGBId());
boolean updateResult = storager.updateParentPlatform(parentPlatform);
@@ -123,8 +123,6 @@ public class PlatformController {
} else if (parentPlatformOld != null && parentPlatformOld.isEnable() && !parentPlatform.isEnable()){ // 关闭启用时注销
commanderForPlatform.unregister(parentPlatform, null, null);
}
return new ResponseEntity<>("success", HttpStatus.OK);
} else {
return new ResponseEntity<>("fail", HttpStatus.OK);
@@ -151,7 +149,7 @@ public class PlatformController {
){
return new ResponseEntity<>("missing parameters", HttpStatus.BAD_REQUEST);
}
ParentPlatform parentPlatform = storager.queryParentPlatById(serverGBId);
ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(serverGBId);
if (parentPlatform == null) return new ResponseEntity<>("fail", HttpStatus.OK);
// 发送离线消息,无论是否成功都删除缓存
commanderForPlatform.unregister(parentPlatform, (event -> {
@@ -192,7 +190,7 @@ public class PlatformController {
if (logger.isDebugEnabled()) {
logger.debug("查询上级平台是否存在API调用" + serverGBId);
}
ParentPlatform parentPlatform = storager.queryParentPlatById(serverGBId);
ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(serverGBId);
return new ResponseEntity<>(String.valueOf(parentPlatform != null), HttpStatus.OK);
}

View File

@@ -73,7 +73,6 @@ public class PlayController {
public DeferredResult<ResponseEntity<String>> play(@PathVariable String deviceId,
@PathVariable String channelId) {
PlayResult playResult = playService.play(deviceId, channelId, null, null);
// 超时处理
@@ -181,7 +180,7 @@ public class PlayController {
JSONObject data = jsonObject.getJSONObject("data");
if (data != null) {
result.put("key", data.getString("key"));
StreamInfo streamInfoResult = mediaService.getStreamInfoByAppAndStream("convert", streamId);
StreamInfo streamInfoResult = mediaService.getStreamInfoByAppAndStreamWithCheck("convert", streamId);
result.put("data", streamInfoResult);
}
}else {

View File

@@ -71,7 +71,7 @@ public class PlaybackController {
logger.debug(String.format("设备回放 API调用deviceId%s channelId%s", deviceId, channelId));
}
UUID uuid = UUID.randomUUID();
DeferredResult<ResponseEntity<String>> result = new DeferredResult<ResponseEntity<String>>();
DeferredResult<ResponseEntity<String>> result = new DeferredResult<ResponseEntity<String>>(30000L);
// 超时处理
result.onTimeout(()->{
logger.warn(String.format("设备回放超时deviceId%s channelId%s", deviceId, channelId));

View File

@@ -21,10 +21,10 @@ import javax.security.sasl.AuthenticationException;
public class UserController {
@Autowired
AuthenticationManager authenticationManager;
private AuthenticationManager authenticationManager;
@Autowired
IUserService userService;
private IUserService userService;
@ApiOperation("登录")
@ApiImplicitParams({
@@ -33,7 +33,7 @@ public class UserController {
})
@GetMapping("/login")
public String login(String username, String password){
LoginUser user = null;
LoginUser user;
try {
user = SecurityUtils.login(username, password, authenticationManager);
} catch (AuthenticationException e) {