From 6aad35552e8b958ff8480a775343e6de1a66d23b Mon Sep 17 00:00:00 2001 From: liujie <1793218484@qq.com> Date: 星期二, 24 六月 2025 21:02:37 +0800 Subject: [PATCH] 发电对接三方(待测试) --- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TScreenContentController.java | 25 ++++++++++++------------- 1 files changed, 12 insertions(+), 13 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 beb6bee..ba04879 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,10 +9,13 @@ 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.util.KsolarUtils; import com.ruoyi.other.vo.*; import io.swagger.annotations.ApiOperation; import org.springframework.beans.BeanUtils; @@ -20,6 +23,7 @@ import javax.annotation.Resource; import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.Arrays; import java.time.LocalDateTime; import java.util.HashMap; @@ -41,6 +45,8 @@ private TScreenContentService screenContentService; @Resource private EnergyRefreshService energyRefreshService; + @Resource + private TSystemConfigurationService systemConfigurationService; /** * 顶部-累计电量 @@ -58,19 +64,9 @@ @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())); - }); - - vo.setTodayGenerateElectricity(new BigDecimal("1821")); + vo.setTodayGenerateElectricity(new BigDecimal(KsolarUtils.getTodayEnergy(LocalDateTime.now().toString()))); + vo.setGreenElectricityToday(vo.getTodayGenerateElectricity().multiply(new BigDecimal("0.94")).setScale(2, RoundingMode.HALF_UP)); return AjaxResult.success(vo); } @@ -100,7 +96,10 @@ public AjaxResult<EnergyStorageDischargeVO> energyStorageDischarge() { //需调用接口 获取光伏发电量 EnergyStorageDischargeVO vo = new EnergyStorageDischargeVO(); - vo.setTodayDischarge(energyRefreshService.getCurrentValue()); + //今日放能 10:00-11:59 每1分钟随机增值0.5-1,放满90停止;用第一次放能值为基数(85)开始累加,17:00-21:59 每1分钟随机增值0.5-1,放满90停止。 + vo.setTodayDischarge(energyRefreshService.getTodayDischarge()); + //今日储能 00:00-次日7:59 每1分钟随机增长0.5-1,储满115停止,12:00-16:59 每1分钟随机增长0.5-1,增加到115减第一次放能剩余值(如放能值为85,则放能剩余值为90-85)结束; + vo.setTodayStorage(energyRefreshService.getTodayStorage()); return AjaxResult.success(vo); } -- Gitblit v1.7.1