From 568eac31d05d075075a69285a2c77b2d3afec23e Mon Sep 17 00:00:00 2001
From: huliguo <2023611923@qq.com>
Date: 星期四, 29 五月 2025 15:43:56 +0800
Subject: [PATCH] 优化

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TScreenContentController.java |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TScreenContentController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TScreenContentController.java
index bd3274f..c44227f 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TScreenContentController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TScreenContentController.java
@@ -19,6 +19,7 @@
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
+import java.util.Arrays;
 import java.util.List;
 
 /**
@@ -54,8 +55,18 @@
     @GetMapping(value = "/photovoltaicAndConsumption")
     public AjaxResult<PhotovoltaicAndConsumptionVO> photovoltaicAndConsumption() {
         //需调用接口 获取光伏发电量
-
-        return AjaxResult.success(new PhotovoltaicAndConsumptionVO());
+        List<Integer> siteIds= Arrays.asList(25,26);
+        PhotovoltaicAndConsumptionVO vo = new PhotovoltaicAndConsumptionVO();
+        List<TScreenContent> list = screenContentService.list(new LambdaQueryWrapper<TScreenContent>().in(TScreenContent::getSiteId, siteIds));
+        if(list==null|| list.isEmpty()){
+            return AjaxResult.success(vo);
+        }
+        vo.setGreenElectricityToday(list.get(0).getGreenElectricityToday());
+        list.remove(0);
+        list.forEach(x->{
+            vo.setGreenElectricityToday(vo.getGreenElectricityToday().add(x.getGreenElectricityToday()));
+        });
+        return AjaxResult.success(vo);
     }
 
 

--
Gitblit v1.7.1