From 483d7b2716740c3033d18b7d149f51f95710bcba Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期三, 28 五月 2025 16:44:08 +0800
Subject: [PATCH] 大屏接口 修改bug

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TScreenContentService.java          |    9 ++++
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TScreenContentServiceImpl.java |   18 +++++++--
 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TScreenContent.java              |   12 +++---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TScreenContentMapper.java            |   15 ++++++-
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TScreenContentController.java    |   23 ++++++++++-
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/util/EnergyRefreshService.java              |    2 
 6 files changed, 64 insertions(+), 15 deletions(-)

diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TScreenContent.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TScreenContent.java
index debe154..ef41a69 100644
--- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TScreenContent.java
+++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TScreenContent.java
@@ -30,15 +30,15 @@
 
     @TableField("green_electricity_today")
     @ApiModelProperty("今日绿电消纳值")
-    private BigDecimal greenElectricityToday;
+    private BigDecimal greenElectricityToday=BigDecimal.ZERO;
 
     @TableField("car_discharge")
     @ApiModelProperty("累计汽车放电量")
-    private BigDecimal carDischarge;
+    private BigDecimal carDischarge=BigDecimal.ZERO;
 
     @TableField("green_electricity")
     @ApiModelProperty("累计绿电消纳电量")
-    private BigDecimal greenElectricity;
+    private BigDecimal greenElectricity=BigDecimal.ZERO;
 
     @TableField("title")
     @ApiModelProperty("标题")
@@ -83,15 +83,15 @@
     @TableField("statistical_deadline")
     @ApiModelProperty("截止统计日期")
     @JsonFormat(pattern = "yyyy-MM-dd")
-    private LocalDateTime statisticalDeadline;
+    private Date statisticalDeadline;
 
     @TableField("create_time")
     @ApiModelProperty("创建时间")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private LocalDateTime createTime;
+    private Date createTime;
 
     @TableField("update_time")
     @ApiModelProperty("更新时间")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private LocalDateTime updateTime;
+    private Date updateTime;
 }
\ No newline at end of file
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..80f612a 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,8 @@
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
+import java.time.LocalDateTime;
+import java.util.HashMap;
 import java.util.List;
 
 /**
@@ -101,7 +103,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 +112,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
      */
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TScreenContentMapper.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TScreenContentMapper.java
index 18fb859..8bec3aa 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TScreenContentMapper.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TScreenContentMapper.java
@@ -4,8 +4,10 @@
 import com.ruoyi.other.api.domain.TNotice;
 import com.ruoyi.other.api.domain.TScreenContent;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 
 import java.math.BigDecimal;
+import java.util.HashMap;
 import java.util.List;
 
 /**
@@ -19,7 +21,16 @@
 @Mapper
 public interface TScreenContentMapper extends BaseMapper<TScreenContent> {
 
-    BigDecimal getCarDisCharge(List<Integer> siteIds);
+    BigDecimal getCarDisCharge(@Param("siteIds") List<Integer> siteIds);
 
-    BigDecimal getGreenElectricity(List<Integer> siteIds);
+    BigDecimal getGreenElectricity(@Param("siteIds") List<Integer> siteIds);
+
+    void carportData(@Param("parkingPlace") Integer parkingPlace, @Param("remainPlace") Integer remainPlace);
+
+
+    HashMap<String, Object> getCarportData();
+
+
+
+
 }
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TScreenContentService.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TScreenContentService.java
index c1ce779..35769eb 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TScreenContentService.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TScreenContentService.java
@@ -7,6 +7,7 @@
 import com.ruoyi.other.vo.PhotovoltaicPowerGenerationVO;
 import com.ruoyi.other.vo.ScreenTopVO;
 
+import java.util.HashMap;
 import java.util.List;
 
 /**
@@ -24,4 +25,12 @@
     PhotovoltaicPowerGenerationVO photovoltaicPowerGeneration(List<Integer> siteIds);
 
     ScreenTopVO top(List<Integer> siteIds);
+
+    void carportData(Integer parkingPlace, Integer remainPlace);
+
+
+    HashMap<String, Object> getCarportData();
+
+
+
 }
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 52dc72a..93e5242 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
@@ -30,10 +30,7 @@
 import java.time.LocalDateTime;
 import java.time.LocalTime;
 import java.time.temporal.ChronoUnit;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Random;
+import java.util.*;
 import java.util.concurrent.ThreadLocalRandom;
 
 /**
@@ -163,4 +160,17 @@
         vo.setStorageDisCharge(storageDisCharge);
         return vo;
     }
+
+    @Override
+    public void carportData(Integer parkingPlace, Integer remainPlace) {
+        this.baseMapper.carportData(parkingPlace,remainPlace);
+    }
+
+    @Override
+    public HashMap<String, Object> getCarportData() {
+        HashMap<String, Object> carportData = this.baseMapper.getCarportData();
+        int count = Integer.valueOf(carportData.get("parkingPlace").toString()) - Integer.valueOf(carportData.get("remainPlace").toString());
+        carportData.put("useCarport",count);
+        return carportData;
+    }
 }
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/util/EnergyRefreshService.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/util/EnergyRefreshService.java
index 9a90ec5..e5cd892 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/util/EnergyRefreshService.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/util/EnergyRefreshService.java
@@ -29,7 +29,7 @@
     }
 
     // 定时任务方法
-    @Scheduled(cron = "${0 */15 * * * ?}")//15分钟执行一次
+    @Scheduled(cron = "0 */15 * * * ?")//15分钟执行一次
     public synchronized void refreshValue() {
         // 检查是否已停止或达到目标范围
         if (!isRunning || isWithinTargetRange(currentValue)) {

--
Gitblit v1.7.1