From dca440a3ffc59710656931de97f797c4e13c5f3f Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期三, 09 七月 2025 19:41:29 +0800
Subject: [PATCH] Merge branch 'dev' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TScreenContentServiceImpl.java |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TScreenContentServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TScreenContentServiceImpl.java
index caa54aa..569de12 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TScreenContentServiceImpl.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TScreenContentServiceImpl.java
@@ -133,13 +133,17 @@
         List<LocalDate> dates = new ArrayList<>();
         List<Double> values = new ArrayList<>();
         LocalDate today = LocalDate.now();
+        ArrayList<Map<String, Object>> monthEnergy = KsolarUtils.getMonthEnergy(today.minusDays(7).toString().substring(0, 7), today.minusDays(1).toString().substring(0, 7));
         // 生成每天数据
         for (int i = 7; i >= 1; i--) {//升序
             LocalDate day = today.minusDays(i);
-            //统计
             dates.add(day);
-            Double value = KsolarUtils.getTodayEnergy(day.toString()); // 100-250
-            values.add(value);
+            Map<String, Object> stringObjectMap = monthEnergy.stream().filter(e -> e.get("time").toString().contains(day.toString())).findFirst().orElse(null);
+            if(stringObjectMap!=null){
+                values.add(Double.valueOf(stringObjectMap.get("value").toString()));
+            }else {
+                values.add(0.0);
+            }
         }
         vo.setDates(dates);
         vo.setValues(values);

--
Gitblit v1.7.1