|
@@ -4,7 +4,6 @@ import lombok.RequiredArgsConstructor;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.jetbrains.annotations.NotNull;
|
|
import org.jetbrains.annotations.NotNull;
|
|
import org.springframework.context.ApplicationEventPublisher;
|
|
import org.springframework.context.ApplicationEventPublisher;
|
|
-import org.springframework.scheduling.annotation.Async;
|
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import vip.xiaonuo.coldchain.core.alarm.bean.SensorAlarm;
|
|
import vip.xiaonuo.coldchain.core.alarm.bean.SensorAlarm;
|
|
@@ -51,7 +50,7 @@ public class DeviceOfflineDetectionService {
|
|
*
|
|
*
|
|
* @param deviceCode 设备标识符
|
|
* @param deviceCode 设备标识符
|
|
*/
|
|
*/
|
|
- @Async("coldChainAsyncTask")
|
|
|
|
|
|
+// @Async("coldChainAsyncTask")
|
|
public void reportDeviceTime(String deviceCode, Integer route) {
|
|
public void reportDeviceTime(String deviceCode, Integer route) {
|
|
// 获取当前时间并格式化为字符串
|
|
// 获取当前时间并格式化为字符串
|
|
String currentTime = LocalDateTime.now().format(DATE_TIME_FORMATTER);
|
|
String currentTime = LocalDateTime.now().format(DATE_TIME_FORMATTER);
|
|
@@ -64,7 +63,7 @@ public class DeviceOfflineDetectionService {
|
|
* 定期检测设备状态是否离线
|
|
* 定期检测设备状态是否离线
|
|
* 每 5 分钟运行一次
|
|
* 每 5 分钟运行一次
|
|
*/
|
|
*/
|
|
- @Scheduled(fixedRate = 300000) // 每 5 分钟(以毫秒为单位)
|
|
|
|
|
|
+ @Scheduled(fixedRate = 60000) // 每 5 分钟(以毫秒为单位)
|
|
// @Scheduled(fixedRateString = "${coldchain.device-offline-interval:300000}")
|
|
// @Scheduled(fixedRateString = "${coldchain.device-offline-interval:300000}")
|
|
public void checkDeviceStatus() {
|
|
public void checkDeviceStatus() {
|
|
log.info("开始检测离线设备状态...");
|
|
log.info("开始检测离线设备状态...");
|