调整
This commit is contained in:
parent
06466a4e45
commit
712e5e9038
@ -4,6 +4,7 @@ import me.zhengjie.config.properties.FileProperties;
|
||||
import me.zhengjie.modules.system.domain.dto.ImageDataVo;
|
||||
import me.zhengjie.utils.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
@ -16,7 +17,7 @@ public class WebSocketService {
|
||||
|
||||
public static BusDeviceService myDeviceService;
|
||||
public static FileProperties myFileProperties;
|
||||
@Autowired private BusDeviceService deviceService;
|
||||
@Autowired @Lazy private BusDeviceService deviceService;
|
||||
@Autowired private FileProperties fileProperties;
|
||||
|
||||
// 初始化
|
||||
|
@ -32,6 +32,8 @@ import lombok.RequiredArgsConstructor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import me.zhengjie.utils.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -56,9 +58,9 @@ public class BusDeviceServiceImpl extends ServiceImpl<BusDeviceMapper, BusDevice
|
||||
private final BusUserCommandMapper busUserCommandMapper;
|
||||
private final BusCommandLogMapper busCommandLogMapper;
|
||||
private final WeChatService weChatService;
|
||||
private final WebSocketSdcpServiceImpl webSocketSdcpService;
|
||||
private final WebSocketVueServiceImpl webSocketVueService;
|
||||
private final RedisUtils redisUtils;
|
||||
@Autowired @Lazy private WebSocketSdcpServiceImpl webSocketSdcpService;
|
||||
@Autowired @Lazy private WebSocketVueServiceImpl webSocketVueService;
|
||||
// private final RedisUtils redisUtils;
|
||||
|
||||
@Override
|
||||
public BusDevice getByDeviceCode(String deviceCode) {
|
||||
|
@ -109,6 +109,10 @@ public class WebSocketSdcpServiceImpl extends WebSocketService {
|
||||
// 初始状态刷新消息(Cmd:0) 指令
|
||||
private void pushDeviceStatus(String deviceSn) {
|
||||
WebSocketService socket = getSocket(WebSocketConfig.TOPIC_PREFIX);
|
||||
if (null == socket || null == socket.session || !socket.session.isOpen()) {
|
||||
log.info("<<< 第三方未连接,无法初始化,略过");
|
||||
return;
|
||||
}
|
||||
long currentTimeLong = System.currentTimeMillis();
|
||||
Map<String, Object> dataParam = new HashMap<>();
|
||||
dataParam.put("UserId", socket.session.getId());
|
||||
|
@ -35,8 +35,6 @@ public class WebSocketVueServiceImpl extends WebSocketService {
|
||||
log.info("<<< 设备初始化");
|
||||
}
|
||||
|
||||
// 每30秒刷新设备
|
||||
@Scheduled(fixedRate = 30000)
|
||||
public void refreshDeviceList() {
|
||||
deviceList = new ArrayList<>();
|
||||
List<BusDevice> devices = myDeviceService.queryAll(new BusDeviceQueryCriteria());
|
||||
|
Loading…
Reference in New Issue
Block a user