Merge branch 'wvp-28181-2.0' into wvp-28181-2.0
This commit is contained in:
@@ -50,8 +50,6 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
||||
device = deviceMapper.getDeviceByDeviceId(deviceChannel.getDeviceId());
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ("WGS84".equals(device.getGeoCoordSys())) {
|
||||
deviceChannel.setLongitudeWgs84(deviceChannel.getLongitude());
|
||||
deviceChannel.setLatitudeWgs84(deviceChannel.getLatitude());
|
||||
@@ -262,4 +260,6 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -122,9 +122,10 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
}
|
||||
|
||||
// 第一次上线 或则设备之前是离线状态--进行通道同步和设备信息查询
|
||||
if (device.getCreateTime() == null) {
|
||||
if (deviceInDb == null) {
|
||||
device.setOnLine(true);
|
||||
device.setCreateTime(now);
|
||||
device.setUpdateTime(now);
|
||||
logger.info("[设备上线,首次注册]: {},查询设备信息以及通道信息", device.getDeviceId());
|
||||
deviceMapper.add(device);
|
||||
redisCatchStorage.updateDevice(device);
|
||||
@@ -389,63 +390,11 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
if (device == null) {
|
||||
return null;
|
||||
}
|
||||
if (parentId == null || parentId.equals(deviceId)) {
|
||||
// 字根节点开始查询
|
||||
List<DeviceChannel> rootNodes = getRootNodes(deviceId, TreeType.CIVIL_CODE.equals(device.getTreeType()), true, !onlyCatalog);
|
||||
return transportChannelsToTree(rootNodes, "");
|
||||
if (ObjectUtils.isEmpty(parentId) || parentId.equals(deviceId)) {
|
||||
parentId = null;
|
||||
}
|
||||
|
||||
if (TreeType.CIVIL_CODE.equals(device.getTreeType())) {
|
||||
if (parentId.length()%2 != 0) {
|
||||
return null;
|
||||
}
|
||||
// 使用行政区划展示树
|
||||
// if (parentId.length() > 10) {
|
||||
// // TODO 可能是行政区划与业务分组混杂的情形
|
||||
// return null;
|
||||
// }
|
||||
|
||||
if (parentId.length() == 10 ) {
|
||||
if (onlyCatalog) {
|
||||
return null;
|
||||
}
|
||||
// parentId为行业编码, 其下不会再有行政区划
|
||||
List<DeviceChannel> channels = deviceChannelMapper.getChannelsByCivilCode(deviceId, parentId);
|
||||
List<BaseTree<DeviceChannel>> trees = transportChannelsToTree(channels, parentId);
|
||||
return trees;
|
||||
}
|
||||
// 查询其下的行政区划和摄像机
|
||||
List<DeviceChannel> channelsForCivilCode = deviceChannelMapper.getChannelsWithCivilCodeAndLength(deviceId, parentId, parentId.length() + 2);
|
||||
if (!onlyCatalog) {
|
||||
List<DeviceChannel> channels = deviceChannelMapper.getChannelsByCivilCode(deviceId, parentId);
|
||||
|
||||
for(DeviceChannel channel : channels) {
|
||||
boolean flag = false;
|
||||
for(DeviceChannel deviceChannel : channelsForCivilCode) {
|
||||
if(channel.getChannelId().equals(deviceChannel.getChannelId())) {
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
if(!flag) {
|
||||
channelsForCivilCode.add(channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
List<BaseTree<DeviceChannel>> trees = transportChannelsToTree(channelsForCivilCode, parentId);
|
||||
return trees;
|
||||
|
||||
}
|
||||
// 使用业务分组展示树
|
||||
if (TreeType.BUSINESS_GROUP.equals(device.getTreeType())) {
|
||||
if (parentId.length() < 14 ) {
|
||||
return null;
|
||||
}
|
||||
List<DeviceChannel> deviceChannels = deviceChannelMapper.queryChannels(deviceId, parentId, null, null, null,null);
|
||||
List<BaseTree<DeviceChannel>> trees = transportChannelsToTree(deviceChannels, parentId);
|
||||
return trees;
|
||||
}
|
||||
|
||||
return null;
|
||||
List<DeviceChannel> rootNodes = deviceChannelMapper.getSubChannelsByDeviceId(deviceId, parentId, onlyCatalog);
|
||||
return transportChannelsToTree(rootNodes, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -454,42 +403,11 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
if (device == null) {
|
||||
return null;
|
||||
}
|
||||
if (parentId == null || parentId.equals(deviceId)) {
|
||||
// 字根节点开始查询
|
||||
List<DeviceChannel> rootNodes = getRootNodes(deviceId, TreeType.CIVIL_CODE.equals(device.getTreeType()), false, true);
|
||||
return rootNodes;
|
||||
if (ObjectUtils.isEmpty(parentId) || parentId.equals(deviceId)) {
|
||||
return deviceChannelMapper.getSubChannelsByDeviceId(deviceId, null, false);
|
||||
}else {
|
||||
return deviceChannelMapper.getSubChannelsByDeviceId(deviceId, parentId, false);
|
||||
}
|
||||
|
||||
if (TreeType.CIVIL_CODE.equals(device.getTreeType())) {
|
||||
if (parentId.length()%2 != 0) {
|
||||
return null;
|
||||
}
|
||||
// 使用行政区划展示树
|
||||
if (parentId.length() > 10) {
|
||||
// TODO 可能是行政区划与业务分组混杂的情形
|
||||
return null;
|
||||
}
|
||||
|
||||
if (parentId.length() == 10 ) {
|
||||
// parentId为行业编码, 其下不会再有行政区划
|
||||
List<DeviceChannel> channels = deviceChannelMapper.getChannelsByCivilCode(deviceId, parentId);
|
||||
return channels;
|
||||
}
|
||||
// 查询其下的行政区划和摄像机
|
||||
List<DeviceChannel> channels = deviceChannelMapper.getChannelsByCivilCode(deviceId, parentId);
|
||||
return channels;
|
||||
|
||||
}
|
||||
// 使用业务分组展示树
|
||||
if (TreeType.BUSINESS_GROUP.equals(device.getTreeType())) {
|
||||
if (parentId.length() < 14 ) {
|
||||
return null;
|
||||
}
|
||||
List<DeviceChannel> deviceChannels = deviceChannelMapper.queryChannels(deviceId, parentId, null, null, null,null);
|
||||
return deviceChannels;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<BaseTree<DeviceChannel>> transportChannelsToTree(List<DeviceChannel> channels, String parentId) {
|
||||
@@ -509,13 +427,21 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
node.setPid(parentId);
|
||||
node.setBasicData(channel);
|
||||
node.setParent(false);
|
||||
if (channel.getChannelId().length() > 8) {
|
||||
if (channel.getChannelId().length() > 13) {
|
||||
String gbCodeType = channel.getChannelId().substring(10, 13);
|
||||
node.setParent(gbCodeType.equals(ChannelIdType.BUSINESS_GROUP) || gbCodeType.equals(ChannelIdType.VIRTUAL_ORGANIZATION) );
|
||||
}
|
||||
}else {
|
||||
if (channel.getChannelId().length() <= 8) {
|
||||
node.setParent(true);
|
||||
}else {
|
||||
if (channel.getChannelId().length() != 20) {
|
||||
node.setParent(channel.getParental() == 1);
|
||||
}else {
|
||||
try {
|
||||
int type = Integer.parseInt(channel.getChannelId().substring(10, 13));
|
||||
if (type == 215 || type == 216 || type == 200) {
|
||||
node.setParent(true);
|
||||
}
|
||||
}catch (NumberFormatException e) {
|
||||
node.setParent(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
treeNotes.add(node);
|
||||
}
|
||||
@@ -523,53 +449,6 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
return treeNotes;
|
||||
}
|
||||
|
||||
private List<DeviceChannel> getRootNodes(String deviceId, boolean isCivilCode, boolean haveCatalog, boolean haveChannel) {
|
||||
if (!haveCatalog && !haveChannel) {
|
||||
return null;
|
||||
}
|
||||
List<DeviceChannel> result = new ArrayList<>();
|
||||
if (isCivilCode) {
|
||||
// 使用行政区划
|
||||
Integer length= deviceChannelMapper.getChannelMinLength(deviceId);
|
||||
if (length == null) {
|
||||
return null;
|
||||
}
|
||||
if (length <= 10) {
|
||||
if (haveCatalog) {
|
||||
List<DeviceChannel> provinceNode = deviceChannelMapper.getChannelsWithCivilCodeAndLength(deviceId, null, length);
|
||||
if (provinceNode != null && provinceNode.size() > 0) {
|
||||
result.addAll(provinceNode);
|
||||
}
|
||||
}
|
||||
|
||||
if (haveChannel) {
|
||||
// 查询那些civilCode不在通道中的不规范通道,放置在根目录
|
||||
List<DeviceChannel> nonstandardNode = deviceChannelMapper.getChannelWithoutCivilCode(deviceId);
|
||||
if (nonstandardNode != null && nonstandardNode.size() > 0) {
|
||||
result.addAll(nonstandardNode);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
if (haveChannel) {
|
||||
List<DeviceChannel> deviceChannels = deviceChannelMapper.queryChannels(deviceId, null, null, null, null,null);
|
||||
if (deviceChannels != null && deviceChannels.size() > 0) {
|
||||
result.addAll(deviceChannels);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}else {
|
||||
// 使用业务分组+虚拟组织
|
||||
|
||||
// 只获取业务分组
|
||||
List<DeviceChannel> deviceChannels = deviceChannelMapper.getBusinessGroups(deviceId, ChannelIdType.BUSINESS_GROUP);
|
||||
if (deviceChannels != null && deviceChannels.size() > 0) {
|
||||
result.addAll(deviceChannels);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExist(String deviceId) {
|
||||
return deviceMapper.getDeviceByDeviceId(deviceId) != null;
|
||||
@@ -617,7 +496,6 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
}
|
||||
deviceInStore.setSdpIp(device.getSdpIp());
|
||||
deviceInStore.setCharset(device.getCharset());
|
||||
deviceInStore.setTreeType(device.getTreeType());
|
||||
|
||||
// 目录订阅相关的信息
|
||||
if (device.getSubscribeCycleForCatalog() > 0) {
|
||||
@@ -673,6 +551,9 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
}catch (Exception e) {
|
||||
dataSourceTransactionManager.rollback(transactionStatus);
|
||||
}
|
||||
if (result) {
|
||||
redisCatchStorage.removeDevice(deviceId);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -113,20 +113,15 @@ public class GbStreamServiceImpl implements IGbStreamService {
|
||||
deviceChannel.setStatus(gbStream.isStatus());
|
||||
|
||||
deviceChannel.setRegisterWay(1);
|
||||
deviceChannel.setCivilCode(platform.getAdministrativeDivision());
|
||||
|
||||
if (platform.getTreeType().equals(TreeType.CIVIL_CODE)){
|
||||
deviceChannel.setCivilCode(catalogId);
|
||||
}else if (platform.getTreeType().equals(TreeType.BUSINESS_GROUP)){
|
||||
PlatformCatalog catalog = catalogMapper.select(catalogId);
|
||||
if (catalog == null) {
|
||||
deviceChannel.setParentId(platform.getDeviceGBId());
|
||||
deviceChannel.setBusinessGroupId(null);
|
||||
}else {
|
||||
deviceChannel.setParentId(catalog.getId());
|
||||
deviceChannel.setBusinessGroupId(catalog.getBusinessGroupId());
|
||||
}
|
||||
|
||||
PlatformCatalog catalog = catalogMapper.select(catalogId);
|
||||
if (catalog != null) {
|
||||
deviceChannel.setCivilCode(catalog.getCivilCode());
|
||||
deviceChannel.setParentId(catalog.getParentId());
|
||||
deviceChannel.setBusinessGroupId(catalog.getBusinessGroupId());
|
||||
}else {
|
||||
deviceChannel.setCivilCode(platform.getAdministrativeDivision());
|
||||
deviceChannel.setParentId(platform.getDeviceGBId());
|
||||
}
|
||||
|
||||
deviceChannel.setModel("live");
|
||||
@@ -221,20 +216,14 @@ public class GbStreamServiceImpl implements IGbStreamService {
|
||||
deviceChannel.setStatus(status != null && status);
|
||||
|
||||
deviceChannel.setRegisterWay(1);
|
||||
deviceChannel.setCivilCode(platform.getAdministrativeDivision());
|
||||
|
||||
if (platform.getTreeType().equals(TreeType.CIVIL_CODE)){
|
||||
deviceChannel.setCivilCode(catalogId);
|
||||
}else if (platform.getTreeType().equals(TreeType.BUSINESS_GROUP)){
|
||||
PlatformCatalog catalog = catalogMapper.select(catalogId);
|
||||
if (catalog == null) {
|
||||
deviceChannel.setParentId(platform.getDeviceGBId());
|
||||
deviceChannel.setBusinessGroupId(null);
|
||||
}else {
|
||||
deviceChannel.setParentId(catalog.getId());
|
||||
deviceChannel.setBusinessGroupId(catalog.getBusinessGroupId());
|
||||
}
|
||||
|
||||
PlatformCatalog catalog = catalogMapper.select(catalogId);
|
||||
if (catalog != null) {
|
||||
deviceChannel.setCivilCode(catalog.getCivilCode());
|
||||
deviceChannel.setParentId(catalog.getParentId());
|
||||
deviceChannel.setBusinessGroupId(catalog.getBusinessGroupId());
|
||||
}else {
|
||||
deviceChannel.setCivilCode(platform.getAdministrativeDivision());
|
||||
deviceChannel.setParentId(platform.getDeviceGBId());
|
||||
}
|
||||
|
||||
deviceChannel.setModel("live");
|
||||
|
||||
@@ -126,22 +126,17 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
|
||||
List<DeviceChannel> deviceChannelList = new ArrayList<>();
|
||||
if (channelReduces.size() > 0){
|
||||
PlatformCatalog catalog = catalogManager.select(catalogId);
|
||||
if (catalog == null && !catalogId.equals(platform.getDeviceGBId())) {
|
||||
if (catalog == null || !catalogId.equals(platform.getDeviceGBId())) {
|
||||
logger.warn("未查询到目录{}的信息", catalogId);
|
||||
return null;
|
||||
}
|
||||
for (ChannelReduce channelReduce : channelReduces) {
|
||||
DeviceChannel deviceChannel = deviceChannelMapper.queryChannel(channelReduce.getDeviceId(), channelReduce.getChannelId());
|
||||
deviceChannel.setParental(0);
|
||||
deviceChannel.setCivilCode(catalog.getCivilCode());
|
||||
deviceChannel.setParentId(catalog.getParentId());
|
||||
deviceChannel.setBusinessGroupId(catalog.getBusinessGroupId());
|
||||
deviceChannelList.add(deviceChannel);
|
||||
if (platform.getTreeType().equals(TreeType.CIVIL_CODE)){
|
||||
deviceChannel.setCivilCode(catalogId);
|
||||
}else if (platform.getTreeType().equals(TreeType.BUSINESS_GROUP)){
|
||||
deviceChannel.setParentId(catalogId);
|
||||
if (catalog != null) {
|
||||
deviceChannel.setBusinessGroupId(catalog.getBusinessGroupId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return deviceChannelList;
|
||||
|
||||
@@ -35,6 +35,8 @@ import java.util.Map;
|
||||
public class PlatformServiceImpl implements IPlatformService {
|
||||
|
||||
private final static String REGISTER_KEY_PREFIX = "platform_register_";
|
||||
|
||||
private final static String REGISTER_FAIL_AGAIN_KEY_PREFIX = "platform_register_fail_again_";
|
||||
private final static String KEEPALIVE_KEY_PREFIX = "platform_keepalive_";
|
||||
|
||||
private final static Logger logger = LoggerFactory.getLogger(PlatformServiceImpl.class);
|
||||
@@ -132,14 +134,6 @@ public class PlatformServiceImpl implements IPlatformService {
|
||||
ParentPlatform parentPlatformOld = platformMapper.getParentPlatById(parentPlatform.getId());
|
||||
ParentPlatformCatch parentPlatformCatchOld = redisCatchStorage.queryPlatformCatchInfo(parentPlatformOld.getServerGBId());
|
||||
parentPlatform.setUpdateTime(DateUtil.getNow());
|
||||
if (!parentPlatformOld.getTreeType().equals(parentPlatform.getTreeType())) {
|
||||
// 目录结构发生变化,清空之前的关联关系
|
||||
logger.info("保存平台{}时发现目录结构变化,清空关联关系", parentPlatform.getDeviceGBId());
|
||||
catalogMapper.delByPlatformId(parentPlatformOld.getServerGBId());
|
||||
platformChannelMapper.delByPlatformId(parentPlatformOld.getServerGBId());
|
||||
platformGbStreamMapper.delByPlatformId(parentPlatformOld.getServerGBId());
|
||||
}
|
||||
|
||||
|
||||
// 停止心跳定时
|
||||
final String keepaliveTaskKey = KEEPALIVE_KEY_PREFIX + parentPlatformOld.getServerGBId();
|
||||
@@ -150,12 +144,11 @@ public class PlatformServiceImpl implements IPlatformService {
|
||||
// 注销旧的
|
||||
try {
|
||||
if (parentPlatformOld.isStatus()) {
|
||||
logger.info("保存平台{}时发现救平台在线,发送注销命令", parentPlatformOld.getServerGBId());
|
||||
logger.info("保存平台{}时发现旧平台在线,发送注销命令", parentPlatformOld.getServerGBId());
|
||||
commanderForPlatform.unregister(parentPlatformOld, parentPlatformCatchOld.getSipTransactionInfo(), null, eventResult -> {
|
||||
logger.info("[国标级联] 注销成功, 平台:{}", parentPlatformOld.getServerGBId());
|
||||
});
|
||||
}
|
||||
|
||||
} catch (InvalidArgumentException | ParseException | SipException e) {
|
||||
logger.error("[命令发送失败] 国标级联 注销: {}", e.getMessage());
|
||||
}
|
||||
@@ -188,9 +181,6 @@ public class PlatformServiceImpl implements IPlatformService {
|
||||
logger.error("[命令发送失败] 国标级联: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
// 重新开启定时注册, 使用续订消息
|
||||
// 重新开始心跳保活
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -199,6 +189,9 @@ public class PlatformServiceImpl implements IPlatformService {
|
||||
@Override
|
||||
public void online(ParentPlatform parentPlatform, SipTransactionInfo sipTransactionInfo) {
|
||||
logger.info("[国标级联]:{}, 平台上线", parentPlatform.getServerGBId());
|
||||
final String registerFailAgainTaskKey = REGISTER_FAIL_AGAIN_KEY_PREFIX + parentPlatform.getServerGBId();
|
||||
dynamicTask.stop(registerFailAgainTaskKey);
|
||||
|
||||
platformMapper.updateParentPlatformStatus(parentPlatform.getServerGBId(), true);
|
||||
ParentPlatformCatch parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(parentPlatform.getServerGBId());
|
||||
if (parentPlatformCatch == null) {
|
||||
@@ -239,15 +232,9 @@ public class PlatformServiceImpl implements IPlatformService {
|
||||
// 此时是第三次心跳超时, 平台离线
|
||||
if (platformCatch.getKeepAliveReply() == 2) {
|
||||
// 设置平台离线,并重新注册
|
||||
logger.info("[国标级联] {},三次心跳超时后再次发起注册", parentPlatform.getServerGBId());
|
||||
try {
|
||||
commanderForPlatform.register(parentPlatform, eventResult1 -> {
|
||||
logger.info("[国标级联] {},三次心跳超时后再次发起注册仍然失败,开始定时发起注册,间隔为1分钟", parentPlatform.getServerGBId());
|
||||
offline(parentPlatform, false);
|
||||
}, null);
|
||||
} catch (InvalidArgumentException | ParseException | SipException e) {
|
||||
logger.error("[命令发送失败] 国标级联 注册: {}", e.getMessage());
|
||||
}
|
||||
logger.info("[国标级联] 三次心跳超时, 平台{}({})离线", parentPlatform.getName(), parentPlatform.getServerGBId());
|
||||
offline(parentPlatform, false);
|
||||
|
||||
}
|
||||
|
||||
}else {
|
||||
@@ -273,21 +260,22 @@ public class PlatformServiceImpl implements IPlatformService {
|
||||
|
||||
private void registerTask(ParentPlatform parentPlatform, SipTransactionInfo sipTransactionInfo){
|
||||
try {
|
||||
// 设置超时重发, 后续从底层支持消息重发
|
||||
String key = KEEPALIVE_KEY_PREFIX + parentPlatform.getServerGBId() + "_timeout";
|
||||
if (dynamicTask.isAlive(key)) {
|
||||
return;
|
||||
// 不在同一个会话中续订则每次全新注册
|
||||
if (!userSetting.isRegisterKeepIntDialog()) {
|
||||
sipTransactionInfo = null;
|
||||
}
|
||||
dynamicTask.startDelay(key, ()->{
|
||||
registerTask(parentPlatform, sipTransactionInfo);
|
||||
}, 1000);
|
||||
logger.info("[国标级联] 平台:{}注册即将到期,开始续订", parentPlatform.getServerGBId());
|
||||
|
||||
if (sipTransactionInfo == null) {
|
||||
logger.info("[国标级联] 平台:{}注册即将到期,开始重新注册", parentPlatform.getServerGBId());
|
||||
}else {
|
||||
logger.info("[国标级联] 平台:{}注册即将到期,开始续订", parentPlatform.getServerGBId());
|
||||
}
|
||||
|
||||
commanderForPlatform.register(parentPlatform, sipTransactionInfo, eventResult -> {
|
||||
dynamicTask.stop(key);
|
||||
logger.info("[国标级联] 平台:{}注册失败,{}:{}", parentPlatform.getServerGBId(),
|
||||
eventResult.statusCode, eventResult.msg);
|
||||
offline(parentPlatform, false);
|
||||
},eventResult -> {
|
||||
dynamicTask.stop(key);
|
||||
});
|
||||
}, null);
|
||||
} catch (InvalidArgumentException | ParseException | SipException e) {
|
||||
logger.error("[命令发送失败] 国标级联定时注册: {}", e.getMessage());
|
||||
}
|
||||
@@ -308,24 +296,35 @@ public class PlatformServiceImpl implements IPlatformService {
|
||||
// 停止所有推流
|
||||
logger.info("[平台离线] {}, 停止所有推流", parentPlatform.getServerGBId());
|
||||
stopAllPush(parentPlatform.getServerGBId());
|
||||
if (stopRegister) {
|
||||
// 清除注册定时
|
||||
logger.info("[平台离线] {}, 停止定时注册任务", parentPlatform.getServerGBId());
|
||||
final String registerTaskKey = REGISTER_KEY_PREFIX + parentPlatform.getServerGBId();
|
||||
if (dynamicTask.contains(registerTaskKey)) {
|
||||
dynamicTask.stop(registerTaskKey);
|
||||
}
|
||||
|
||||
// 清除注册定时
|
||||
logger.info("[平台离线] {}, 停止定时注册任务", parentPlatform.getServerGBId());
|
||||
final String registerTaskKey = REGISTER_KEY_PREFIX + parentPlatform.getServerGBId();
|
||||
if (dynamicTask.contains(registerTaskKey)) {
|
||||
dynamicTask.stop(registerTaskKey);
|
||||
}
|
||||
// 清除心跳定时
|
||||
logger.info("[平台离线] {}, 停止定时发送心跳任务", parentPlatform.getServerGBId());
|
||||
final String keepaliveTaskKey = KEEPALIVE_KEY_PREFIX + parentPlatform.getServerGBId();
|
||||
if (dynamicTask.contains(keepaliveTaskKey)) {
|
||||
// 添加心跳任务
|
||||
// 清除心跳任务
|
||||
dynamicTask.stop(keepaliveTaskKey);
|
||||
}
|
||||
// 停止目录订阅回复
|
||||
logger.info("[平台离线] {}, 停止订阅回复", parentPlatform.getServerGBId());
|
||||
subscribeHolder.removeAllSubscribe(parentPlatform.getServerGBId());
|
||||
// 发起定时自动重新注册
|
||||
if (!stopRegister) {
|
||||
// 设置为60秒自动尝试重新注册
|
||||
final String registerFailAgainTaskKey = REGISTER_FAIL_AGAIN_KEY_PREFIX + parentPlatform.getServerGBId();
|
||||
ParentPlatform platform = platformMapper.getParentPlatById(parentPlatform.getId());
|
||||
if (platform.isEnable()) {
|
||||
dynamicTask.startCron(registerFailAgainTaskKey,
|
||||
()-> registerTask(platform, null),
|
||||
userSetting.getRegisterAgainAfterTime() * 1000);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void stopAllPush(String platformId) {
|
||||
|
||||
Reference in New Issue
Block a user