From d2ab6f7153e604bac7bc4ad58f27f368b65d8a1e Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期二, 16 六月 2026 13:54:58 +0800
Subject: [PATCH] feat: 添加能耗数据综合分析功能,支持按天和周维度的趋势分析
---
src/main/java/com/ruoyi/http/controller/StatisticEleController.java | 89 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 89 insertions(+), 0 deletions(-)
diff --git a/src/main/java/com/ruoyi/http/controller/StatisticEleController.java b/src/main/java/com/ruoyi/http/controller/StatisticEleController.java
new file mode 100644
index 0000000..24e5169
--- /dev/null
+++ b/src/main/java/com/ruoyi/http/controller/StatisticEleController.java
@@ -0,0 +1,89 @@
+package com.ruoyi.http.controller;
+
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.http.service.StatisticEleService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@Tag(name = "鑳借�楃數琛ㄧ粺璁�")
+@RequestMapping("/statisticEle")
+@RequiredArgsConstructor
+public class StatisticEleController extends BaseController {
+
+ private final StatisticEleService statisticEleService;
+
+ @GetMapping("/list")
+ @Operation(summary = "鑳借�楁暟鎹�-鍒楄〃鏌ヨ(鏈湴搴�)")
+ @Log(title = "鑳借�楁暟鎹�-鍒楄〃鏌ヨ", businessType = BusinessType.OTHER)
+ public AjaxResult list(
+ @RequestParam(defaultValue = "hour") String dimension,
+ @RequestParam String startTime,
+ @RequestParam String endTime,
+ @RequestParam(defaultValue = "1") Integer ignoreRadio) {
+ return AjaxResult.success(statisticEleService.listRecords(dimension, startTime, endTime, ignoreRadio));
+ }
+
+ @GetMapping("/summary")
+ @Operation(summary = "鑳借�楁暟鎹�-姹囨�荤粺璁�(鏈湴搴�)")
+ @Log(title = "鑳借�楁暟鎹�-姹囨�荤粺璁�", businessType = BusinessType.OTHER)
+ public AjaxResult summary(
+ @RequestParam(defaultValue = "hour") String dimension,
+ @RequestParam String startTime,
+ @RequestParam String endTime) {
+ return AjaxResult.success(statisticEleService.getSummary(dimension, startTime, endTime));
+ }
+
+ @GetMapping("/analytics")
+ @Operation(summary = "鑳借�楁暟鎹�-缁煎悎鍒嗘瀽")
+ public AjaxResult analytics(
+ @RequestParam(defaultValue = "day") String dimension,
+ @RequestParam String startTime,
+ @RequestParam String endTime,
+ @RequestParam(required = false) String trendGranularity) {
+ return AjaxResult.success(statisticEleService.getAnalytics(dimension, startTime, endTime, trendGranularity));
+ }
+
+ @GetMapping("/yesterday")
+ @Operation(summary = "鏄ㄦ棩鐢ㄧ數閲忔眹鎬�")
+ public AjaxResult yesterday() {
+ return AjaxResult.success(statisticEleService.getYesterdaySummary());
+ }
+
+ @GetMapping("/syncStatus")
+ @Operation(summary = "鑳借�楁暟鎹�-鍚屾鐘舵��")
+ public AjaxResult syncStatus() {
+ return AjaxResult.success(statisticEleService.getSyncStatus());
+ }
+
+ @GetMapping("/raw")
+ @Operation(summary = "鑳借�楁暟鎹�-鍘熷鎺ュ彛(璋冭瘯鐢紝鎱庣敤)")
+ @Log(title = "鑳借�楁暟鎹�-鍘熷鎺ュ彛", businessType = BusinessType.OTHER)
+ public AjaxResult raw(
+ @RequestParam(defaultValue = "hour") String dimension,
+ @RequestParam String startTime,
+ @RequestParam String endTime) {
+ return AjaxResult.success(statisticEleService.fetchRawData(dimension, startTime, endTime));
+ }
+
+ @PostMapping("/export")
+ @Operation(summary = "鑳借�楁暟鎹�-瀵煎嚭")
+ @Log(title = "鑳借�楁暟鎹�-瀵煎嚭", businessType = BusinessType.EXPORT)
+ public void export(
+ @RequestParam(defaultValue = "hour") String dimension,
+ @RequestParam String startTime,
+ @RequestParam String endTime,
+ HttpServletResponse response) {
+ statisticEleService.exportRecords(dimension, startTime, endTime, response);
+ }
+}
--
Gitblit v1.9.3