From 378669e94558e6d4d7383604f84dabd9d2242e7c Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期五, 06 六月 2025 09:54:12 +0800
Subject: [PATCH] 调整参数

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TScreenContentController.java |   50 +++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 47 insertions(+), 3 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..6a3f91c 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
@@ -9,9 +9,11 @@
 import com.ruoyi.common.security.annotation.RequiresPermissions;
 import com.ruoyi.other.api.domain.TNotice;
 import com.ruoyi.other.api.domain.TScreenContent;
+import com.ruoyi.other.api.domain.TSystemConfiguration;
 import com.ruoyi.other.api.dto.NoticeQueryDto;
 import com.ruoyi.other.service.TNoticeService;
 import com.ruoyi.other.service.TScreenContentService;
+import com.ruoyi.other.service.TSystemConfigurationService;
 import com.ruoyi.other.util.EnergyRefreshService;
 import com.ruoyi.other.vo.*;
 import io.swagger.annotations.ApiOperation;
@@ -19,6 +21,11 @@
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.Arrays;
+import java.time.LocalDateTime;
+import java.util.HashMap;
 import java.util.List;
 
 /**
@@ -37,6 +44,8 @@
     private TScreenContentService screenContentService;
     @Resource
     private EnergyRefreshService energyRefreshService;
+    @Resource
+    private TSystemConfigurationService systemConfigurationService;
 
     /**
      * 顶部-累计电量
@@ -54,8 +63,26 @@
     @GetMapping(value = "/photovoltaicAndConsumption")
     public AjaxResult<PhotovoltaicAndConsumptionVO> photovoltaicAndConsumption() {
         //需调用接口 获取光伏发电量
+        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(new PhotovoltaicAndConsumptionVO());
+        TSystemConfiguration sysConfig = systemConfigurationService.getOne(new LambdaQueryWrapper<TSystemConfiguration>()
+                .eq(TSystemConfiguration::getType,4));
+        BigDecimal refreshValueOne = new BigDecimal(sysConfig.getContent());
+        vo.setTodayGenerateElectricity(refreshValueOne);
+        vo.setGreenElectricityToday(refreshValueOne.multiply(new BigDecimal("0.94")).setScale(2, RoundingMode.HALF_UP));
+
+
+        return AjaxResult.success(vo);
     }
 
 
@@ -101,7 +128,7 @@
         if(list==null|| list.isEmpty()){
             return AjaxResult.success(tScreenContent);
         }
-        BeanUtils.copyProperties( list.get(0),tScreenContent);
+        BeanUtils.copyProperties(list.get(0),tScreenContent);
         list.remove(0);
         list.forEach(x->{
             tScreenContent.setCarDischarge(tScreenContent.getCarDischarge().add(x.getCarDischarge()));
@@ -110,11 +137,28 @@
             tScreenContent.setValueOne(tScreenContent.getValueOne().add(x.getValueOne()));
             tScreenContent.setValueTwo(tScreenContent.getValueTwo().add(x.getValueTwo()));
             tScreenContent.setValueThree(tScreenContent.getValueThree().add(x.getValueThree()));
-            if(tScreenContent.getStatisticalDeadline().isBefore(x.getStatisticalDeadline())) tScreenContent.setStatisticalDeadline(x.getStatisticalDeadline());
+            if(tScreenContent.getStatisticalDeadline().getTime()<(x.getStatisticalDeadline().getTime())) {
+                tScreenContent.setStatisticalDeadline(x.getStatisticalDeadline());
+            }
         });
         return AjaxResult.success(tScreenContent);
     }
 
+    @ApiOperation(tags = {"车位数据传输"},value = "充电桩数据大屏")
+    @PostMapping(value = "/carportData")
+    public AjaxResult<?> carportData(Integer parkingPlace,Integer remainPlace) {
+        screenContentService.carportData(parkingPlace,remainPlace);
+        return AjaxResult.success();
+    }
+
+    @ApiOperation(tags = {"获取车位数据传输"},value = "充电桩数据大屏")
+    @GetMapping(value = "/getCarportData")
+    public AjaxResult<?> getCarportData() {
+        HashMap<String,Object> map = screenContentService.getCarportData();
+        return AjaxResult.success(map);
+    }
+
+
     /**
      * 数据回显 站点id
      */

--
Gitblit v1.7.1