完成向上级联->注册
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
package com.genersoft.iot.vmp.gb28181.event;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
||||
import com.genersoft.iot.vmp.gb28181.event.platformNotRegister.PlatformNotRegisterEvent;
|
||||
import com.genersoft.iot.vmp.vmanager.platform.PlatformController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -31,4 +34,14 @@ public class EventPublisher {
|
||||
outEvent.setFrom(from);
|
||||
applicationEventPublisher.publishEvent(outEvent);
|
||||
}
|
||||
|
||||
/**
|
||||
* 平台未注册事件
|
||||
* @param platformGbId
|
||||
*/
|
||||
public void platformNotRegisterEventPublish(String platformGbId){
|
||||
PlatformNotRegisterEvent platformNotRegisterEvent = new PlatformNotRegisterEvent(this);
|
||||
platformNotRegisterEvent.setPlatformGbID(platformGbId);
|
||||
applicationEventPublisher.publishEvent(platformNotRegisterEvent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.genersoft.iot.vmp.gb28181.event.platformNotRegister;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
public class PlatformNotRegisterEvent extends ApplicationEvent {
|
||||
|
||||
private String platformGbID;
|
||||
|
||||
public PlatformNotRegisterEvent(Object source) {
|
||||
super(source);
|
||||
}
|
||||
|
||||
public String getPlatformGbID() {
|
||||
return platformGbID;
|
||||
}
|
||||
|
||||
public void setPlatformGbID(String platformGbID) {
|
||||
this.platformGbID = platformGbID;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.genersoft.iot.vmp.gb28181.event.platformNotRegister;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
||||
import com.genersoft.iot.vmp.gb28181.event.online.OnlineEvent;
|
||||
import com.genersoft.iot.vmp.gb28181.event.online.OnlineEventListener;
|
||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
||||
import com.genersoft.iot.vmp.utils.redis.RedisUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Description: 平台未注册事件,来源有二:
|
||||
* 1、平台新添加
|
||||
* 2、平台心跳超时
|
||||
* @author: panll
|
||||
* @date: 2020年11月24日 10:00
|
||||
*/
|
||||
@Component
|
||||
public class PlatformNotRegisterEventLister implements ApplicationListener<PlatformNotRegisterEvent> {
|
||||
|
||||
private final static Logger logger = LoggerFactory.getLogger(PlatformNotRegisterEventLister.class);
|
||||
|
||||
@Autowired
|
||||
private IVideoManagerStorager storager;
|
||||
|
||||
@Autowired
|
||||
private RedisUtil redis;
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(PlatformNotRegisterEvent event) {
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("平台未注册事件触发,平台国标ID:" + event.getPlatformGbID());
|
||||
}
|
||||
ParentPlatform parentPlatform = storager.queryParentPlatById(event.getPlatformGbID());
|
||||
if (parentPlatform == null) {
|
||||
logger.debug("平台未注册事件触发,但平台已经删除!!! 平台国标ID:" + event.getPlatformGbID());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user