From 7ff418ef44ccf7ed009afeaea34758e6dd3b8498 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A2=A8=E5=A4=A7=E5=8F=94?= <494979559@qq.com> Date: Sat, 21 Sep 2024 17:38:46 +0800 Subject: [PATCH] =?UTF-8?q?debug:=E8=AE=BE=E5=A4=87=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=AE=BE=E5=A4=87=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/DeviceServiceImpl.java | 28 +++++++++---------- .../ruoyi/task/device/DeviceStatusTask.java | 24 ++++++++-------- .../src/main/resources/application-prod.yml | 2 +- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceServiceImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceServiceImpl.java index 40e9b2e5..ad0866b3 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceServiceImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceServiceImpl.java @@ -579,23 +579,23 @@ public class DeviceServiceImpl implements DeviceService this.pullDeviceInfoAsync(Collections.singletonList(deviceId), 3, TimeUnit.SECONDS); // 时长结束后修改设备状态 - scheduledExecutorService.schedule(()-> { - freshStatus(deviceId); - }, seconds, TimeUnit.SECONDS); +// scheduledExecutorService.schedule(()-> { +// freshStatus(deviceId); +// }, seconds, TimeUnit.SECONDS); } return success; } - private void freshStatus(Long deviceId) { - DeviceVO device = deviceMapper.selectSmDeviceByDeviceId(deviceId); - freshStatus(device); - } +// private void freshStatus(Long deviceId) { +// DeviceVO device = deviceMapper.selectSmDeviceByDeviceId(deviceId); +// freshStatus(device); +// } @Override public void freshStatus(DeviceVO device) { - if (device == null) { + if (device == null || device.getExpireTime() == null) { return; } if (!DeviceStatus.USING.getStatus().equals(device.getStatus())) { @@ -610,12 +610,12 @@ public class DeviceServiceImpl implements DeviceService return; } - // 如果没有过期,则延迟至过期时间继续查询 - if (between.getSeconds() > 0) { - scheduledExecutorService.schedule(() -> { - freshStatus(device.getDeviceId()); - }, between.getSeconds() , TimeUnit.SECONDS); - } +// // 如果没有过期,则延迟至过期时间继续查询 +// if (between.getSeconds() > 0) { +// scheduledExecutorService.schedule(() -> { +// freshStatus(device.getDeviceId()); +// }, between.getSeconds() , TimeUnit.SECONDS); +// } } /** diff --git a/smart-switch-service/src/main/java/com/ruoyi/task/device/DeviceStatusTask.java b/smart-switch-service/src/main/java/com/ruoyi/task/device/DeviceStatusTask.java index 5ee77e0b..f0e1e973 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/task/device/DeviceStatusTask.java +++ b/smart-switch-service/src/main/java/com/ruoyi/task/device/DeviceStatusTask.java @@ -31,18 +31,18 @@ public class DeviceStatusTask implements ApplicationRunner { */ @Override public void run(ApplicationArguments args) throws Exception { - log.info("项目启动,查询正在使用中的设备"); - DeviceQuery query = new DeviceQuery(); - query.setStatus(DeviceStatus.USING.getStatus()); - List list = deviceService.selectSmDeviceList(query); - if (CollectionUtils.isEmptyElement(list)) { - log.info("没有正在使用中的设备"); - return; - } - - for (DeviceVO device : list) { - deviceService.freshStatus(device); - } +// log.info("项目启动,查询正在使用中的设备"); +// DeviceQuery query = new DeviceQuery(); +// query.setStatus(DeviceStatus.USING.getStatus()); +// List list = deviceService.selectSmDeviceList(query); +// if (CollectionUtils.isEmptyElement(list)) { +// log.info("没有正在使用中的设备"); +// return; +// } +// +// for (DeviceVO device : list) { +// deviceService.freshStatus(device); +// } } } diff --git a/smart-switch-web/src/main/resources/application-prod.yml b/smart-switch-web/src/main/resources/application-prod.yml index 9582f503..6f97bf6c 100644 --- a/smart-switch-web/src/main/resources/application-prod.yml +++ b/smart-switch-web/src/main/resources/application-prod.yml @@ -33,7 +33,7 @@ wx: # 设备配置 device: # 项目启动时抄表 - startRecord: true + startRecord: false spring: # redis 配置