diff --git a/pom.xml b/pom.xml
index a343309726..0b8e28284d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -16,7 +16,7 @@
yudao-module-system
yudao-module-infra
-
+ yudao-module-bpm
diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/statistics/IotStatisticsController.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/statistics/IotStatisticsController.java
index c4ef83a4ac..31cc5121ad 100644
--- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/statistics/IotStatisticsController.java
+++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/statistics/IotStatisticsController.java
@@ -36,43 +36,42 @@ public class IotStatisticsController {
@Resource
private IotDeviceLogService deviceLogService;
- // TODO @super:description 非必要,可以不写哈
@GetMapping("/get-summary")
- @Operation(summary = "获取IOT数据统计")
+ @Operation(summary = "获取 IoT 数据统计")
public CommonResult getIotStatisticsSummary(){
IotStatisticsSummaryRespVO respVO = new IotStatisticsSummaryRespVO();
- // 获取总数
+ // 1.1 获取总数
respVO.setProductCategoryCount(productCategoryService.getProductCategoryCount(null));
respVO.setProductCount(productService.getProductCount(null));
respVO.setDeviceCount(deviceService.getDeviceCount(null));
respVO.setDeviceMessageCount(deviceLogService.getDeviceLogCount(null));
-
- // 获取今日新增数量
+ // 1.2 获取今日新增数量
+ // TODO @super:使用 LocalDateTimeUtils.getToday()
LocalDateTime todayStart = LocalDateTime.now().withHour(0).withMinute(0).withSecond(0);
respVO.setProductCategoryTodayCount(productCategoryService.getProductCategoryCount(todayStart));
respVO.setProductTodayCount(productService.getProductCount(todayStart));
respVO.setDeviceTodayCount(deviceService.getDeviceCount(todayStart));
respVO.setDeviceMessageTodayCount(deviceLogService.getDeviceLogCount(todayStart));
- // 获取各个品类下设备数量统计
+ // 2. 获取各个品类下设备数量统计
respVO.setProductCategoryDeviceCounts(productCategoryService.getProductCategoryDeviceCountMap());
- // 获取设备状态数量统计
+ // 3. 获取设备状态数量统计
Map deviceCountMap = deviceService.getDeviceCountMapByState();
respVO.setDeviceOnlineCount(deviceCountMap.getOrDefault(IotDeviceStateEnum.ONLINE.getState(), 0L));
respVO.setDeviceOfflineCount(deviceCountMap.getOrDefault(IotDeviceStateEnum.OFFLINE.getState(), 0L));
respVO.setDeviceInactiveCount(deviceCountMap.getOrDefault(IotDeviceStateEnum.INACTIVE.getState(), 0L));
-
return CommonResult.success(respVO);
}
- @GetMapping("/get-log-summary")
- @Operation(summary = "获取IOT上下行消息数据统计")
- public CommonResult getIotStatisticsDeviceMessageSummary(@Valid IotStatisticsReqVO reqVO){
- // 根据传入时间范围获取设备上下行消息数量统计
- IotStatisticsDeviceMessageSummaryRespVO iotStatisticsRespVO = new IotStatisticsDeviceMessageSummaryRespVO();
- iotStatisticsRespVO.setUpstreamCounts(deviceLogService.getDeviceLogUpCountByHour(null, reqVO.getStartTime(), reqVO.getEndTime()));
- iotStatisticsRespVO.setDownstreamCounts(deviceLogService.getDeviceLogDownCountByHour(null, reqVO.getStartTime(), reqVO.getEndTime()));
- return CommonResult.success(iotStatisticsRespVO);
+ // TODO @super:要不干掉 IotStatisticsReqVO 参数,直接使用 @RequestParam 接收,简单一些。
+ @GetMapping("/get-log-summary")
+ @Operation(summary = "获取 IoT 设备上下行消息数据统计")
+ public CommonResult getIotStatisticsDeviceMessageSummary(
+ @Valid IotStatisticsReqVO reqVO) {
+ return CommonResult.success(new IotStatisticsDeviceMessageSummaryRespVO()
+ .setDownstreamCounts(deviceLogService.getDeviceLogUpCountByHour(null, reqVO.getStartTime(), reqVO.getEndTime()))
+ .setDownstreamCounts((deviceLogService.getDeviceLogDownCountByHour(null, reqVO.getStartTime(), reqVO.getEndTime()))));
}
+
}
diff --git a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/statistics/vo/IotStatisticsDeviceMessageSummaryRespVO.java b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/statistics/vo/IotStatisticsDeviceMessageSummaryRespVO.java
index 250c63e2ab..15d2abccc6 100644
--- a/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/statistics/vo/IotStatisticsDeviceMessageSummaryRespVO.java
+++ b/yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/statistics/vo/IotStatisticsDeviceMessageSummaryRespVO.java
@@ -6,14 +6,14 @@ import lombok.Data;
import java.util.List;
import java.util.Map;
-@Schema(description = "管理后台 - Iot 上下行消息数量统计 Response VO")
+@Schema(description = "管理后台 - IoT 设备上下行消息数量统计 Response VO")
@Data
public class IotStatisticsDeviceMessageSummaryRespVO {
+
@Schema(description = "每小时上行数据数量统计")
private List