From 7908eba1358828cbb3f7f3e5efa0bcf3874fe7cf Mon Sep 17 00:00:00 2001 From: zhuangtianxiang <2913129173@qq.com> Date: Thu, 27 Mar 2025 19:52:06 +0800 Subject: [PATCH] =?UTF-8?q?feat(device):=20=E6=B7=BB=E5=8A=A0=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E5=91=8A=E8=AD=A6=E7=BB=9F=E8=AE=A1=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 DeviceServiceImpl 类中的 overview 方法中增加了设备告警相关的统计信息 - 新增 warningCount 字段用于统计当前所有处于告警状态的设备数量 - 新增 todayWarningCount 字段用于统计今日内处于告警状态的设备数量 --- .../modules/iot/device/service/impl/DeviceServiceImpl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/com/zsc/edu/gateway/modules/iot/device/service/impl/DeviceServiceImpl.java b/src/main/java/com/zsc/edu/gateway/modules/iot/device/service/impl/DeviceServiceImpl.java index 547a769..2f7f331 100644 --- a/src/main/java/com/zsc/edu/gateway/modules/iot/device/service/impl/DeviceServiceImpl.java +++ b/src/main/java/com/zsc/edu/gateway/modules/iot/device/service/impl/DeviceServiceImpl.java @@ -33,6 +33,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors; @@ -203,6 +204,8 @@ public class DeviceServiceImpl extends ServiceImpl imp .directCount(productRepo.selectCount(new LambdaQueryWrapper().eq(Product::getLink, Product.LinkType.HTTP))) .gatewayCount(productRepo.selectCount(new LambdaQueryWrapper().eq(Product::getLink, Product.LinkType.TCP))) .gatewaySubCount(productRepo.selectCount(new LambdaQueryWrapper().eq(Product::getLink, Product.LinkType.MQTT))) + .warningCount(baseMapper.selectCount(new LambdaQueryWrapper().eq(Device::getDeviceState, false))) + .todayWarningCount(baseMapper.selectCount(new LambdaQueryWrapper().eq(Device::getDeviceState, false).between(Device::getCreateTime, LocalDateTime.now().withHour(0).withMinute(0).withSecond(0), LocalDateTime.now()))) .build(); }