648540858
2022-03-14 354a39961ad26949f597e4c434b0cd470b7f78ee
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java
@@ -2,10 +2,12 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.genersoft.iot.vmp.gb28181.bean.CatalogData;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
import com.genersoft.iot.vmp.common.VideoManagerConstants;
import com.genersoft.iot.vmp.conf.DynamicTask;
import com.genersoft.iot.vmp.conf.UserSetup;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.PlatformCatalog;
import com.genersoft.iot.vmp.gb28181.bean.SubscribeHolder;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
@@ -40,16 +42,25 @@
    private final static Logger logger = LoggerFactory.getLogger(PlatformController.class);
    @Autowired
    private UserSetup userSetup;
    @Autowired
    private IVideoManagerStorager storager;
    @Autowired
    private IRedisCatchStorage redisCatchStorage;
    @Autowired
    private SubscribeHolder subscribeHolder;
    @Autowired
    private ISIPCommanderForPlatform commanderForPlatform;
    @Autowired
    private SipConfig sipConfig;
   @Autowired
   private DynamicTask dynamicTask;
    /**
     * 获取国标服务的配置
@@ -103,10 +114,14 @@
    })
    public PageInfo<ParentPlatform> platforms(@PathVariable int page, @PathVariable int count) {
//        if (logger.isDebugEnabled()) {
//            logger.debug("查询所有上级设备API调用");
//        }
        return storager.queryParentPlatformList(page, count);
        PageInfo<ParentPlatform> parentPlatformPageInfo = storager.queryParentPlatformList(page, count);
        if (parentPlatformPageInfo.getList().size() > 0) {
            for (ParentPlatform platform : parentPlatformPageInfo.getList()) {
                platform.setGpsSubscribe(subscribeHolder.getMobilePositionSubscribe(platform.getServerGBId()) != null);
                platform.setCatalogSubscribe(subscribeHolder.getCatalogSubscribe(platform.getServerGBId()) != null);
            }
        }
        return parentPlatformPageInfo;
    }
    /**
@@ -222,7 +237,7 @@
        if (updateResult) {
            // 保存时启用就发送注册
            if (parentPlatform.isEnable()) {
                if (parentPlatformOld.isStatus()) {
                if (parentPlatformOld != null && parentPlatformOld.isStatus()) {
                    commanderForPlatform.unregister(parentPlatformOld, null, null);
                    try {
                        Thread.sleep(500);
@@ -287,8 +302,9 @@
        boolean deleteResult = storager.deleteParentPlatform(parentPlatform);
        storager.delCatalogByPlatformId(parentPlatform.getServerGBId());
        storager.delRelationByPlatformId(parentPlatform.getServerGBId());
        // 停止发送位置订阅定时任务
        String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() +  "_MobilePosition_" + parentPlatform.getServerGBId();
        dynamicTask.stop(key);
        if (deleteResult) {
            return new ResponseEntity<>("success", HttpStatus.OK);
        } else {