| | |
| | | package com.ard.sample.manage.service.impl; |
| | | |
| | | import com.ard.common.core.domain.model.LoginUser; |
| | | import com.ard.common.core.redis.RedisConst; |
| | | import com.ard.common.core.redis.RedisOpsUtils; |
| | | import com.ard.common.utils.SecurityUtils; |
| | | import com.ard.sample.common.model.ResponseResult; |
| | | import com.ard.sample.component.websocket.enums.MessageType; |
| | | import com.ard.sample.component.websocket.handler.DockWebSocketHandler; |
| | |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.net.URL; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | @Scheduled(cron = "0/2 * * * * ?") |
| | | public void cronOnlineTask() { |
| | | List<DeviceDTO> devicesList = _deviceService.getDevicesTopoForWeb(); |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | for (DeviceDTO device : devicesList) { |
| | | //String key = "online:" + device.getDeviceSn(); |
| | | //System.out.println("在线状态:"+RedisOpsUtils.checkExist(key)); |
| | |
| | | try { |
| | | // 获取直播参数 |
| | | LiveTypeDTO param = _liveStreamHandler.getLiveParam(sn); |
| | | // 判断param是否为空,不为空则返回正确的直播参数,为null则未获取直播参数,不为空则继续操作 |
| | | if (param == null) { |
| | | log.info("SN: {}-未获取到直播参数param为null,无法开启直播!", sn); |
| | | return; |
| | | } |
| | | // 如果存在直播则读取直播地址返回 |
| | | if (RedisOpsUtils.checkExist(RedisConst.WEBSOCKET_VIDEO_ADDRESS_PREFIX + sn)) { |
| | | resultLive = String.valueOf(RedisOpsUtils.get(RedisConst.WEBSOCKET_VIDEO_ADDRESS_PREFIX + sn)); |