diff --git a/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/WebSocketService.java b/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/WebSocketService.java index 8fd95f8..ebfbeb5 100644 --- a/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/WebSocketService.java +++ b/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/WebSocketService.java @@ -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; // 初始化 diff --git a/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/BusDeviceServiceImpl.java b/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/BusDeviceServiceImpl.java index e10862d..8ae9d7a 100644 --- a/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/BusDeviceServiceImpl.java +++ b/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/BusDeviceServiceImpl.java @@ -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 dataParam = new HashMap<>(); dataParam.put("UserId", socket.session.getId()); diff --git a/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/WebSocketVueServiceImpl.java b/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/WebSocketVueServiceImpl.java index aca9976..7ec2413 100644 --- a/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/WebSocketVueServiceImpl.java +++ b/eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/WebSocketVueServiceImpl.java @@ -35,8 +35,6 @@ public class WebSocketVueServiceImpl extends WebSocketService { log.info("<<< 设备初始化"); } - // 每30秒刷新设备 - @Scheduled(fixedRate = 30000) public void refreshDeviceList() { deviceList = new ArrayList<>(); List devices = myDeviceService.queryAll(new BusDeviceQueryCriteria());