From a432ff3c95923f9929236de9f7a9224e8517bb70 Mon Sep 17 00:00:00 2001 From: huliguo <2023611923@qq.com> Date: 星期五, 23 五月 2025 20:55:43 +0800 Subject: [PATCH] 大屏 --- ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java | 65 ++++ ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TScreenContentMapper.java | 25 + ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TChargingOrderMapper.java | 5 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingGunController.java | 13 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/PhotovoltaicPowerGenerationVO.java | 15 + ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/StatisticsOfBatteryVO.java | 19 + ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TScreenContentService.java | 27 + ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TScreenContentServiceImpl.java | 166 +++++++++++ ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TScreenContent.java | 97 ++++++ ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ScreenStorageConfigVO.java | 28 + ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TChargingOrderService.java | 8 ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/factory/ChargingGunFallbackFactory.java | 6 ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TScreenContentMapper.xml | 25 + ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/ChargingOrderClient.java | 8 ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml | 25 + ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/util/EnergyRefreshService.java | 73 ++++ ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java | 22 + ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/EmissionReductionVO.java | 27 + ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ChargingBillController.java | 1 ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/ChargingOrderFallbackFactory.java | 7 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/EnergyStorageDischargeVO.java | 18 + ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/PhotovoltaicAndConsumptionVO.java | 18 + ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/feignClient/ChargingGunClient.java | 6 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ScreenTopVO.java | 24 + ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TScreenContentController.java | 142 +++++++++ ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderCountByDate.java | 12 26 files changed, 882 insertions(+), 0 deletions(-) diff --git a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/factory/ChargingGunFallbackFactory.java b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/factory/ChargingGunFallbackFactory.java index 8bce10c..7da496b 100644 --- a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/factory/ChargingGunFallbackFactory.java +++ b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/factory/ChargingGunFallbackFactory.java @@ -12,6 +12,7 @@ import org.slf4j.LoggerFactory; import org.springframework.cloud.openfeign.FallbackFactory; import org.springframework.stereotype.Component; +import org.springframework.web.bind.annotation.RequestParam; import java.util.List; @@ -84,6 +85,11 @@ public R<TChargingGun> getChargingGunByFullNumber(String fullNumber) { return R.fail("根据枪唯一码查询信息失败:" + throwable.getMessage()); } + @Override + public R<List<Integer>> getGunIdsBySiteIdsAndChargeModels(List<Integer> siteIds, List<Integer> chargeModels){ + return R.fail("根据站点ids和充电模式集合查询充电枪集合失败:" + throwable.getMessage()); + } + }; } } diff --git a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/feignClient/ChargingGunClient.java b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/feignClient/ChargingGunClient.java index 79ee4b4..fdb0b87 100644 --- a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/feignClient/ChargingGunClient.java +++ b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/feignClient/ChargingGunClient.java @@ -111,4 +111,10 @@ */ @PostMapping("/t-charging-gun/getChargingGunByFullNumber") R<TChargingGun> getChargingGunByFullNumber(@RequestParam("fullNumber") String fullNumber); + + /** + * 大屏 根据站点ids和充电模式集合查询充电枪集合 + */ + @GetMapping("/t-charging-gun/getGunIdsBySiteIdsAndChargeModels") + R<List<Integer>> getGunIdsBySiteIdsAndChargeModels(@RequestParam("siteIds") List<Integer> siteIds ,@RequestParam("chargeModels") List<Integer> chargeModels); } diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/ChargingOrderFallbackFactory.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/ChargingOrderFallbackFactory.java index 6d50bbe..cd782a1 100644 --- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/ChargingOrderFallbackFactory.java +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/ChargingOrderFallbackFactory.java @@ -16,8 +16,11 @@ import org.slf4j.LoggerFactory; import org.springframework.cloud.openfeign.FallbackFactory; import org.springframework.stereotype.Component; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestParam; +import java.math.BigDecimal; import java.util.List; /** @@ -211,6 +214,10 @@ public R tripartitePlatformStopCharge(String startChargeSeq) { return R.fail("三方平台请求停止充电失败:" + throwable.getMessage()); } + @Override + public R<BigDecimal> getSumDegreeBySiteIds(@RequestParam("siteIds") List<Integer> SiteIds){ + return R.fail("获取站点集合中总的充电量失败:" + throwable.getMessage()); + } }; } } diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/ChargingOrderClient.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/ChargingOrderClient.java index fc03e1f..5570939 100644 --- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/ChargingOrderClient.java +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/ChargingOrderClient.java @@ -20,6 +20,7 @@ import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.*; +import java.math.BigDecimal; import java.util.List; /** @@ -307,4 +308,11 @@ */ @PostMapping("/t-charging-order/tripartitePlatformStopCharge") R tripartitePlatformStopCharge(@RequestParam("startChargeSeq") String startChargeSeq); + + /** + * 充电桩大屏 获取站点集合中总的充电量 + */ + @GetMapping("/t-charging-order/getSumDegreeBySiteIds") + R<BigDecimal> getSumDegreeBySiteIds(@RequestParam("siteIds") List<Integer> SiteIds); + } 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 new file mode 100644 index 0000000..debe154 --- /dev/null +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TScreenContent.java @@ -0,0 +1,97 @@ +package com.ruoyi.other.api.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.core.web.domain.BasePojo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.Date; + +@Data +@TableName("t_screen_content") +@ApiModel("大屏设置对象") +public class TScreenContent { + + @TableId(value = "id", type = IdType.AUTO) + @ApiModelProperty("主键ID") + private Integer id; + + @TableField("site_id") + @ApiModelProperty("站点id") + private Integer siteId; + + @TableField("green_electricity_today") + @ApiModelProperty("今日绿电消纳值") + private BigDecimal greenElectricityToday; + + @TableField("car_discharge") + @ApiModelProperty("累计汽车放电量") + private BigDecimal carDischarge; + + @TableField("green_electricity") + @ApiModelProperty("累计绿电消纳电量") + private BigDecimal greenElectricity; + + @TableField("title") + @ApiModelProperty("标题") + private String title; + + @TableField("title_one") + @ApiModelProperty("标题1") + private String titleOne; + + @TableField("value_one") + @ApiModelProperty("值1") + private BigDecimal valueOne; + + @TableField("unit_one") + @ApiModelProperty("计量单位1") + private String unitOne; + + @TableField("title_two") + @ApiModelProperty("标题2") + private String titleTwo; + + @TableField("value_two") + @ApiModelProperty("值2") + private BigDecimal valueTwo; + + @TableField("unit_two") + @ApiModelProperty("计量单位2") + private String unitTwo; + + @TableField("title_three") + @ApiModelProperty("标题3") + private String titleThree; + + @TableField("value_three") + @ApiModelProperty("值3") + private BigDecimal valueThree; + + @TableField("unit_three") + @ApiModelProperty("计量单位3") + private String unitThree; + + @TableField("statistical_deadline") + @ApiModelProperty("截止统计日期") + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDateTime statisticalDeadline; + + @TableField("create_time") + @ApiModelProperty("创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @TableField("update_time") + @ApiModelProperty("更新时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; +} \ No newline at end of file diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingGunController.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingGunController.java index 4ac3c29..fb71dd3 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingGunController.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingGunController.java @@ -42,6 +42,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.stream.Collectors; /** * <p> @@ -348,5 +349,17 @@ TChargingGun chargingGun = chargingGunService.getOne(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getDelFlag, 0).eq(TChargingGun::getFullNumber, fullNumber)); return R.ok(chargingGun); } + + /** + * 大屏 根据站点ids和充电模式集合查询充电枪集合 没有过滤del_flag + */ + @GetMapping("/getGunIdsBySiteIdsAndChargeModels") + public R<List<Integer>> getGunIdsBySiteIdsAndChargeModels(@RequestParam("siteIds") List<Integer> siteIds ,@RequestParam("chargeModels") List<Integer> chargeModels){ + List<TChargingGun> list = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>() + .select(TChargingGun::getId).in(TChargingGun::getSiteId, siteIds) + .in(TChargingGun::getChargeMode, chargeModels)); + return R.ok(list.stream().map(TChargingGun::getId).collect(Collectors.toList())); + } + } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ChargingBillController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ChargingBillController.java index f50bbf3..6db46cb 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ChargingBillController.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ChargingBillController.java @@ -26,6 +26,7 @@ import com.ruoyi.order.api.vo.TOrderInvoiceVO; import com.ruoyi.order.export.*; import com.ruoyi.order.service.*; +import com.ruoyi.order.vo.StatisticsOfBatteryVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.poi.ss.usermodel.Workbook; diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java index 2838c76..90f2041 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java @@ -1,5 +1,6 @@ package com.ruoyi.order.controller; import com.alibaba.fastjson2.JSON; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import java.math.BigDecimal; @@ -58,6 +59,7 @@ import com.ruoyi.order.service.*; import com.ruoyi.order.util.PreviousSixMonths; import com.ruoyi.order.vo.EndOfChargePageInfo; +import com.ruoyi.order.vo.StatisticsOfBatteryVO; import com.ruoyi.order.vo.WatchChargingOrderVo; import com.ruoyi.other.api.feignClient.RoleSiteClient; import com.ruoyi.other.api.feignClient.UserSiteClient; @@ -2359,4 +2361,24 @@ public R addChargingOrderSummaryData(){ return chargingOrderService.addChargingOrderSummaryData(); } + + /** + * 充电桩数据大屏 新能源汽车电池安全检测次数统计 + */ + @ResponseBody + @GetMapping(value = "/getStatisticsOfBattery") + @ApiOperation(value = "新能源汽车电池安全检测次数统计", tags = {"充电桩数据大屏"}) + public R<StatisticsOfBatteryVO> getStatisticsOfBattery(){ + + return chargingOrderService.getStatisticsOfBattery(); + } + + /** + * 充电桩数据大屏 获取站点集合中总的充电量 + */ + @GetMapping("/getSumDegreeBySiteIds") + public R<BigDecimal> getSumDegreeBySiteIds(@RequestParam("siteIds") List<Integer> SiteIds){ + return R.ok(chargingOrderService.getSumDegreeBySiteIds(SiteIds)); + } + } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TChargingOrderMapper.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TChargingOrderMapper.java index 397efcf..f4a307a 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TChargingOrderMapper.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TChargingOrderMapper.java @@ -11,6 +11,7 @@ import com.ruoyi.order.api.vo.ChargingOrderListVO; import com.ruoyi.order.api.vo.ChargingOrderVO; import com.ruoyi.order.dto.*; +import com.ruoyi.order.vo.OrderCountByDate; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -142,4 +143,8 @@ Long countNoTag(); Long countCar(@Param("brands") List<String> brands); + + List<OrderCountByDate> countOrdersByDate(@Param("startTime")LocalDateTime startTime, @Param("endTime")LocalDateTime endTime,@Param("gunIds")List<Integer> gunIds); + + BigDecimal getSumDegreeBySiteIds(@Param("siteIds") List<Integer> siteIds); } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TChargingOrderService.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TChargingOrderService.java index 3e72100..771d12c 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TChargingOrderService.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TChargingOrderService.java @@ -15,6 +15,7 @@ import com.ruoyi.order.dto.*; import com.ruoyi.order.vo.ChargingOrderListInfoVO; import com.ruoyi.order.vo.EndOfChargePageInfo; +import com.ruoyi.order.vo.StatisticsOfBatteryVO; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; @@ -322,4 +323,11 @@ R addChargingOrderSummaryData(); + + /** + * 大屏-新能源汽车电池安全检测次数统计 + */ + R<StatisticsOfBatteryVO> getStatisticsOfBattery(); + + BigDecimal getSumDegreeBySiteIds(List<Integer> siteIds); } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java index 896a517..4fd1554 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java @@ -17,6 +17,7 @@ import com.ruoyi.common.core.dto.ChargingOrderGroup; import com.ruoyi.common.core.dto.ChargingPercentProvinceDto; import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.core.web.domain.BasePojo; import com.ruoyi.common.core.web.page.PageInfo; import com.ruoyi.common.redis.service.RedisService; import com.ruoyi.common.security.service.TokenService; @@ -51,6 +52,8 @@ import com.ruoyi.order.service.TOrderEvaluateService; import com.ruoyi.order.service.*; import com.ruoyi.order.vo.EndOfChargePageInfo; +import com.ruoyi.order.vo.OrderCountByDate; +import com.ruoyi.order.vo.StatisticsOfBatteryVO; import com.ruoyi.other.api.domain.*; import com.ruoyi.order.vo.ChargingOrderListInfoVO; import com.ruoyi.other.api.domain.TVip; @@ -4064,4 +4067,66 @@ } return R.ok(); } + + /** + * 大屏-新能源汽车电池安全检测次数统计 + */ + @Override + public R<StatisticsOfBatteryVO> getStatisticsOfBattery() { + StatisticsOfBatteryVO vo = new StatisticsOfBatteryVO(); + //1.计算累计次数 + //查询该俩站点的快充和超充的充电枪id集合 site_id 25 26 charge_model 1 2 + R<List<Integer>> r = chargingGunClient.getGunIdsBySiteIdsAndChargeModels(Arrays.asList(25,26),Arrays.asList(1,2)); + if (r.getCode()!=200){ + return R.ok(vo); + } + List<Integer> gunIds=r.getData(); + //统计 + Long total= 0L; + if(gunIds!=null && !gunIds.isEmpty()) { + total = this.baseMapper.selectCount(new LambdaQueryWrapper<TChargingOrder>() + .eq(TChargingOrder::getDelFlag, 0)//未删除 + .in(TChargingOrder::getStatus, Arrays.asList(3, 5))//充电中、已结束 + .in(TChargingOrder::getChargingGunId, gunIds));//符合条件的充电枪 + } + vo.setTotal(total.intValue()); + //2.折线图 + /* // 计算日期范围:前七天(不含今日)直接查找数据量太大,内存报错 + LocalDate today = LocalDate.now(); + LocalDateTime startDate = today.minusDays(7).atStartOfDay(); + LocalDateTime endDate = today.minusDays(1).atTime(LocalTime.MAX); + // 查询数据库 + List<OrderCountByDate> orderCounts = this.baseMapper.countOrdersByDate(startDate, endDate, gunIds);*/ + // 转换结果 + List<LocalDate> dates = new ArrayList<>(); + List<Integer> counts = new ArrayList<>(); + LocalDate today = LocalDate.now(); + // 直接查找数据量太大,内存报错,分每天查找 + for (int i = 7; i >= 1; i--) {//升序 + LocalDate day = today.minusDays(i); + LocalDateTime startOfDay = day.atStartOfDay(); + LocalDateTime endOfDay = day.atTime(LocalTime.MAX); + //统计 + Long count=0L; + if(gunIds!=null && !gunIds.isEmpty()){ + count = this.baseMapper.selectCount(new LambdaQueryWrapper<TChargingOrder>() + .eq(TChargingOrder::getDelFlag,0)//未删除 + .in(TChargingOrder::getStatus,Arrays.asList(3,5))//充电中、已结束 + .in(TChargingOrder::getChargingGunId,gunIds)//符合条件的充电枪 站点 超充快充 + .between(BasePojo::getCreateTime,startOfDay,endOfDay));//每天 + } + dates.add(day); + counts.add(count.intValue()); + } + vo.setDates(dates); + vo.setCounts(counts); + return R.ok(vo); + } + + @Override + public BigDecimal getSumDegreeBySiteIds(List<Integer> siteIds) { + + return this.baseMapper.getSumDegreeBySiteIds(siteIds); + + } } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderCountByDate.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderCountByDate.java new file mode 100644 index 0000000..ac8d817 --- /dev/null +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderCountByDate.java @@ -0,0 +1,12 @@ +package com.ruoyi.order.vo; + +import lombok.Data; + +import java.time.LocalDate; + +@Data +public class OrderCountByDate { + + private LocalDate date; + private Long count; +} \ No newline at end of file diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/StatisticsOfBatteryVO.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/StatisticsOfBatteryVO.java new file mode 100644 index 0000000..54f6719 --- /dev/null +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/StatisticsOfBatteryVO.java @@ -0,0 +1,19 @@ +package com.ruoyi.order.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +import java.time.LocalDate; +import java.util.Date; +import java.util.List; + +@Data +public class StatisticsOfBatteryVO { + @ApiModelProperty("累计检测") + private Integer total; + @ApiModelProperty("日期") + private List<LocalDate> dates; + @ApiModelProperty("次数") + private List<Integer> counts; +} diff --git a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml index c8284c3..1ab40bb 100644 --- a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml +++ b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml @@ -1748,4 +1748,29 @@ and t1.del_flag = 0 ) </select> + <select id="countOrdersByDate" resultType="com.ruoyi.order.vo.OrderCountByDate"> + SELECT DATE_FORMAT(create_time, '%m/%d') AS `date`, COUNT(*) AS `count` + FROM t_charging_order + WHERE + del_flag = 0 + and + status in (3,5) + + and charging_gun_id in + <foreach item="item" index="index" collection="gunIds" open="(" separator="," close=")"> + #{item} + </foreach> + and create_time BETWEEN #{startTime} AND #{endTime} + GROUP BY DATE(create_time, '%m/%d') + ORDER BY DATE(create_time, '%m/%d') ASC + </select> + + <select id="getSumDegreeBySiteIds" resultType="java.math.BigDecimal"> + select sum(charging_capacity) from t_charging_order where del_flag=0 + and site_id in + <foreach item="item" index="index" collection="siteIds" open="(" separator="," close=")"> + #{item} + </foreach> + + </select> </mapper> 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 new file mode 100644 index 0000000..bd3274f --- /dev/null +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TScreenContentController.java @@ -0,0 +1,142 @@ +package com.ruoyi.other.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.log.annotation.Log; +import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.common.security.annotation.Logical; +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.dto.NoticeQueryDto; +import com.ruoyi.other.service.TNoticeService; +import com.ruoyi.other.service.TScreenContentService; +import com.ruoyi.other.util.EnergyRefreshService; +import com.ruoyi.other.vo.*; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.BeanUtils; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * <p> + * 前端控制器 + * </p> + * + * @author huliguo + * @since 2025/5/23 + */ +@RestController +@RequestMapping("/t_screen_content") +public class TScreenContentController { + + @Resource + private TScreenContentService screenContentService; + @Resource + private EnergyRefreshService energyRefreshService; + + /** + * 顶部-累计电量 + */ + @ApiOperation(tags = {"顶部-累计电量"},value = "充电桩数据大屏") + @GetMapping(value = "/top") + public AjaxResult<ScreenTopVO> top(@RequestParam("siteIds") List<Integer> siteIds) { + return AjaxResult.success(screenContentService.top(siteIds)); + } + + /** + * 光伏发电和消纳 这里的绿电是调后台大屏内容管理的 + */ + @ApiOperation(tags = {"光伏发电和消纳"},value = "充电桩数据大屏") + @GetMapping(value = "/photovoltaicAndConsumption") + public AjaxResult<PhotovoltaicAndConsumptionVO> photovoltaicAndConsumption() { + //需调用接口 获取光伏发电量 + + return AjaxResult.success(new PhotovoltaicAndConsumptionVO()); + } + + + /** + * 累计减排数据 + */ + @ApiOperation(tags = {"减排数据"},value = "充电桩数据大屏") + @GetMapping(value = "/emissionReduction") + public AjaxResult<EmissionReductionVO> emissionReduction (@RequestParam("siteIds") List<Integer> siteIds) { + return AjaxResult.success( screenContentService.emissionReduction(siteIds)); + } + /** + * 光伏发电实时情况 + */ + @ApiOperation(tags = {"光伏发电实时情况"},value = "充电桩数据大屏") + @GetMapping(value = "/photovoltaicPowerGeneration") + public AjaxResult<PhotovoltaicPowerGenerationVO> photovoltaicPowerGeneration (@RequestParam("siteIds") List<Integer> siteIds) { + return AjaxResult.success( screenContentService.photovoltaicPowerGeneration(siteIds)); + } + + /** + * 储能放电情况 + */ + @ApiOperation(tags = {"储能放电情况"},value = "充电桩数据大屏") + @GetMapping(value = "/energyStorageDischarge") + public AjaxResult<EnergyStorageDischargeVO> energyStorageDischarge() { + //需调用接口 获取光伏发电量 + EnergyStorageDischargeVO vo = new EnergyStorageDischargeVO(); + vo.setTodayDischarge(energyRefreshService.getCurrentValue()); + return AjaxResult.success(vo); + } + + + + /** + * 停车场共享情况及相关数据 + */ + @ApiOperation(tags = {"停车场共享情况及相关数据"},value = "充电桩数据大屏") + @GetMapping(value = "/screen") + public AjaxResult<TScreenContent> screen(@RequestParam("siteIds") List<Integer> siteIds) { + List<TScreenContent> list = screenContentService.list(new LambdaQueryWrapper<TScreenContent>().in(TScreenContent::getSiteId, siteIds)); + TScreenContent tScreenContent = new TScreenContent(); + if(list==null|| list.isEmpty()){ + return AjaxResult.success(tScreenContent); + } + BeanUtils.copyProperties( list.get(0),tScreenContent); + list.remove(0); + list.forEach(x->{ + tScreenContent.setCarDischarge(tScreenContent.getCarDischarge().add(x.getCarDischarge())); + tScreenContent.setGreenElectricity(tScreenContent.getGreenElectricity().add(x.getGreenElectricity())); + tScreenContent.setGreenElectricityToday(tScreenContent.getGreenElectricityToday().add(x.getGreenElectricityToday())); + 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()); + }); + return AjaxResult.success(tScreenContent); + } + + /** + * 数据回显 站点id + */ + //todo 鉴权 + @RequiresPermissions(value = {"/publicAnnouncementManagement"}, logical = Logical.OR) + @ApiOperation(tags = {"后台-大屏内容设置-基础信息"},value = "查询") + @GetMapping(value = "/{siteId}") + public AjaxResult<TScreenContent> detail(@PathVariable("siteId") Integer siteId) { + TScreenContent one = screenContentService.getOne(new LambdaQueryWrapper<TScreenContent>().eq(TScreenContent::getSiteId, siteId)); + return AjaxResult.success(one); + } + + /** + * 新增修改 + */ + //todo 鉴权 + @RequiresPermissions(value = {"",""}, logical = Logical.OR) + @ApiOperation(tags = {"后台-大屏内容设置-基础信息"},value = "新增修改") + @PostMapping(value = "/saveOrUpdate") + @Log(title = "【大屏管理】新增修改内容", businessType = BusinessType.INSERT) + public AjaxResult saveOrUpdate(@RequestBody TScreenContent screenContent) { + screenContentService.saveOrUpdate(screenContent); + return AjaxResult.success(); + } +} 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 new file mode 100644 index 0000000..18fb859 --- /dev/null +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TScreenContentMapper.java @@ -0,0 +1,25 @@ +package com.ruoyi.other.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.other.api.domain.TNotice; +import com.ruoyi.other.api.domain.TScreenContent; +import org.apache.ibatis.annotations.Mapper; + +import java.math.BigDecimal; +import java.util.List; + +/** + * <p> + * 服务实现类 + * </p> + * + * @author huliguo + * @since 2025/5/23 + */ +@Mapper +public interface TScreenContentMapper extends BaseMapper<TScreenContent> { + + BigDecimal getCarDisCharge(List<Integer> siteIds); + + BigDecimal getGreenElectricity(List<Integer> siteIds); +} 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 new file mode 100644 index 0000000..c1ce779 --- /dev/null +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TScreenContentService.java @@ -0,0 +1,27 @@ +package com.ruoyi.other.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.other.api.domain.TNotice; +import com.ruoyi.other.api.domain.TScreenContent; +import com.ruoyi.other.vo.EmissionReductionVO; +import com.ruoyi.other.vo.PhotovoltaicPowerGenerationVO; +import com.ruoyi.other.vo.ScreenTopVO; + +import java.util.List; + +/** + * <p> + * 服务实现类 + * </p> + * + * @author huliguo + * @since 2025/5/23 + */ +public interface TScreenContentService extends IService<TScreenContent> { + + EmissionReductionVO emissionReduction(List<Integer> siteIds); + + PhotovoltaicPowerGenerationVO photovoltaicPowerGeneration(List<Integer> siteIds); + + ScreenTopVO top(List<Integer> siteIds); +} 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 new file mode 100644 index 0000000..52dc72a --- /dev/null +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TScreenContentServiceImpl.java @@ -0,0 +1,166 @@ +package com.ruoyi.other.service.impl; + +import com.alibaba.fastjson2.JSON; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.web.domain.BasePojo; +import com.ruoyi.order.api.feignClient.ChargingOrderClient; +import com.ruoyi.order.api.model.TChargingOrder; +import com.ruoyi.other.api.domain.TScreenContent; +import com.ruoyi.other.api.domain.TSystemConfiguration; +import com.ruoyi.other.mapper.TScreenContentMapper; +import com.ruoyi.other.mapper.TSystemConfigurationMapper; +import com.ruoyi.other.service.TScreenContentService; +import com.ruoyi.other.service.TSystemConfigurationService; +import com.ruoyi.other.vo.EmissionReductionVO; +import com.ruoyi.other.vo.PhotovoltaicPowerGenerationVO; +import com.ruoyi.other.vo.ScreenStorageConfigVO; +import com.ruoyi.other.vo.ScreenTopVO; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import javax.json.Json; +import javax.json.JsonObject; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.time.LocalDate; +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.concurrent.ThreadLocalRandom; + +/** + * <p> + * 服务实现类 + * </p> + * + * @author huliguo + * @since 2025/5/23 + */ +@Service +public class TScreenContentServiceImpl extends ServiceImpl<TScreenContentMapper, TScreenContent> implements TScreenContentService { + + @Resource + private ChargingOrderClient chargingOrderClient; + @Resource + private TSystemConfigurationMapper systemConfigurationMapper; + + @Override + public EmissionReductionVO emissionReduction(List<Integer> siteIds) { + //需调用接口 计算光伏减排 + EmissionReductionVO vo = new EmissionReductionVO(); + //获取总电量 计算电量 + BigDecimal charge=new BigDecimal("0.00"); + if (siteIds!=null && !siteIds.isEmpty()){ + R<BigDecimal> r = chargingOrderClient.getSumDegreeBySiteIds(siteIds); + if (r.getCode()==200){ + charge=r.getData(); + } + } + //计算电量占比率 + if (charge.compareTo(BigDecimal.ZERO) != 0) { + // 定义乘数和除数 + BigDecimal multiplier = new BigDecimal("0.1404"); // 0.1404 + BigDecimal divisor = new BigDecimal("1000"); // 1000 + // 计算:charge × 0.1404 ÷ 1000 + charge = charge + .multiply(multiplier) // 乘以 0.1404 + .divide(divisor, 2, RoundingMode.HALF_UP); // 除以 1000,保留6位小数,四舍五入 + } + vo.setCharge(charge); + return vo; + } + + @Override + public PhotovoltaicPowerGenerationVO photovoltaicPowerGeneration(List<Integer> siteIds) { + //需调用接口 + + //假数据 + PhotovoltaicPowerGenerationVO vo = new PhotovoltaicPowerGenerationVO(); + List<LocalDate> dates = new ArrayList<>(); + List<Integer> values = new ArrayList<>(); + LocalDate today = LocalDate.now(); + // 生成每天数据 + for (int i = 7; i >= 1; i--) {//升序 + LocalDate day = today.minusDays(i); + //统计 + dates.add(day); + int value = new Random().nextInt(151) + 100; // 100-250 + values.add(value); + } + vo.setDates(dates); + vo.setValues(values); + return vo; + } + + @Override + public ScreenTopVO top(List<Integer> siteIds) { + ScreenTopVO vo = new ScreenTopVO(); + + BigDecimal charge=new BigDecimal("0.00"); + BigDecimal carCharge=new BigDecimal("0.00"); + BigDecimal greenElectricity=new BigDecimal("0.00"); + if (siteIds!=null && !siteIds.isEmpty()){ + //获取充电量 + R<BigDecimal> r = chargingOrderClient.getSumDegreeBySiteIds(siteIds); + if (r.getCode()==200){ + charge=r.getData(); + } + //汽车放电量 + carCharge = this.baseMapper.getCarDisCharge(siteIds); + + //累计绿电消纳电量 + greenElectricity = this.baseMapper.getGreenElectricity(siteIds); + } + vo.setCarCharge(charge); + vo.setCarDisCharge(carCharge); + vo.setGreenElectricity(greenElectricity); + + //获取系统建设日期和累计储能放电量 + TSystemConfiguration sysConfig = systemConfigurationMapper.selectOne(new LambdaQueryWrapper<TSystemConfiguration>() + .eq(TSystemConfiguration::getType,3)); + //解析 + ScreenStorageConfigVO configVO = JSON.parseObject(sysConfig.getContent(), ScreenStorageConfigVO.class); + //计算储能充电量 + LocalDate systemCreateTime = configVO.getSystemCreateTime(); + LocalDate today = LocalDate.now(); + int days = (int) ChronoUnit.DAYS.between(systemCreateTime, today) +1;//包括今天 + + BigDecimal dailyRate = new BigDecimal("100"); + BigDecimal totalCharge = dailyRate.multiply(BigDecimal.valueOf(days)) + .divide(BigDecimal.valueOf(10000), 2, RoundingMode.HALF_UP); + vo.setStorageCharge(totalCharge); + //获取储能放电量 + + // 判断是否等于今天 + if (configVO.getLastUpdated().equals(today)) { + vo.setStorageDisCharge(configVO.getStorageDisCharge()); + return vo; + } + //判断离今天还有几天 + int count = (int) ChronoUnit.DAYS.between(configVO.getLastUpdated(), today) +1;//包括今天 + BigDecimal storageDisCharge = configVO.getStorageDisCharge(); + // 每天生成一个随机值(不超过100)并累加 + for (int i = 0; i < count; i++) { + int dailyCharge = ThreadLocalRandom.current().nextInt(0, 101); // 0-100的随机数 + storageDisCharge = storageDisCharge.add(new BigDecimal(dailyCharge)); + } + + // 更新回对象 + configVO.setStorageDisCharge(storageDisCharge); + configVO.setLastUpdated(today); + String json = JSON.toJSONString(configVO); + sysConfig.setContent(json); + + systemConfigurationMapper.updateById(sysConfig); + vo.setStorageDisCharge(storageDisCharge); + return vo; + } +} 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 new file mode 100644 index 0000000..9a90ec5 --- /dev/null +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/util/EnergyRefreshService.java @@ -0,0 +1,73 @@ +package com.ruoyi.other.util; + +import lombok.Value; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.time.LocalTime; +import java.util.Random; + +@Service +public class EnergyRefreshService { + private final Random random = new Random(); + private BigDecimal currentValue; + + + private final BigDecimal targetLow = new BigDecimal("85"); + + private final BigDecimal targetHigh = new BigDecimal("87"); + + + private final int maxIncrement = 10; + + private boolean isRunning = true; // 控制任务是否继续执行 + + public EnergyRefreshService() { + this.currentValue = BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP); + } + + // 定时任务方法 + @Scheduled(cron = "${0 */15 * * * ?}")//15分钟执行一次 + public synchronized void refreshValue() { + // 检查是否已停止或达到目标范围 + if (!isRunning || isWithinTargetRange(currentValue)) { + isRunning = false; + return; + } + + // 检查当前时间是否在允许的时间段内 + LocalTime now = LocalTime.now(); + boolean isInMorning = now.isAfter(LocalTime.of(10, 0)) && now.isBefore(LocalTime.of(12, 0)); + boolean isInAfternoon = now.isAfter(LocalTime.of(15, 0)) && now.isBefore(LocalTime.of(21, 0)); + + if (!isInMorning && !isInAfternoon) { + return; + } + + // 生成随机增量并更新值 + int increment = random.nextInt(maxIncrement + 1); + currentValue = currentValue.add(BigDecimal.valueOf(increment)) + .setScale(2, RoundingMode.HALF_UP); + + System.out.printf("定时刷新:当前时间 %s,当前值:%.2f%n", now, currentValue); + } + + private boolean isWithinTargetRange(BigDecimal value) { + return value.compareTo(targetLow) >= 0 && value.compareTo(targetHigh) <= 0; + } + + // 提供获取当前值的方法 + public BigDecimal getCurrentValue() { + return currentValue; + } + + // 重置任务 + public void reset() { + this.currentValue = BigDecimal.ZERO; + this.isRunning = true; + } + + +} \ No newline at end of file diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/EmissionReductionVO.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/EmissionReductionVO.java new file mode 100644 index 0000000..adb7c77 --- /dev/null +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/EmissionReductionVO.java @@ -0,0 +1,27 @@ +package com.ruoyi.other.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class EmissionReductionVO { + @ApiModelProperty("累计光伏发电二氧化碳减排量(吨)") + private BigDecimal photovoltaic = new BigDecimal("63.00"); + @ApiModelProperty("累计光伏发电二氧化碳减排量(占比率)") + private BigDecimal photovoltaicRate = new BigDecimal("48.8"); + + @ApiModelProperty("累计储能二氧化碳减排量(吨)") + private BigDecimal energyStorage = new BigDecimal("20.00"); + @ApiModelProperty("累计储能二氧化碳减排量(占比率)") + private BigDecimal energyStorageRate = new BigDecimal("48.8"); + + @ApiModelProperty("累计充电二氧化碳减排量(吨)") + private BigDecimal charge; + @ApiModelProperty("累计充电二氧化碳减排量(占比率)") + private BigDecimal chargeRate = new BigDecimal("4.8"); + + @ApiModelProperty("总计二氧化碳减排量(吨)") + private BigDecimal total = new BigDecimal("48000"); +} diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/EnergyStorageDischargeVO.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/EnergyStorageDischargeVO.java new file mode 100644 index 0000000..d8086c5 --- /dev/null +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/EnergyStorageDischargeVO.java @@ -0,0 +1,18 @@ +package com.ruoyi.other.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class EnergyStorageDischargeVO { + @ApiModelProperty("储能配置") + private Integer config=100; + @ApiModelProperty("今日储能") + private Integer todayStorage=100; + @ApiModelProperty("今日放能") + private BigDecimal todayDischarge; + + +} diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/PhotovoltaicAndConsumptionVO.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/PhotovoltaicAndConsumptionVO.java new file mode 100644 index 0000000..cb2148a --- /dev/null +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/PhotovoltaicAndConsumptionVO.java @@ -0,0 +1,18 @@ +package com.ruoyi.other.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class PhotovoltaicAndConsumptionVO { + @ApiModelProperty("光伏面积") + private Integer area = 3593; + @ApiModelProperty("装机容量") + private BigDecimal capacity = new BigDecimal("759.52"); + @ApiModelProperty("今日已发电") + private BigDecimal todayGenerateElectricity=new BigDecimal("71.29"); + +} diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/PhotovoltaicPowerGenerationVO.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/PhotovoltaicPowerGenerationVO.java new file mode 100644 index 0000000..578eac3 --- /dev/null +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/PhotovoltaicPowerGenerationVO.java @@ -0,0 +1,15 @@ +package com.ruoyi.other.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDate; +import java.util.List; + +@Data +public class PhotovoltaicPowerGenerationVO { + @ApiModelProperty("日期") + private List<LocalDate> dates; + @ApiModelProperty("数据") + private List<Integer> values; +} diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ScreenStorageConfigVO.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ScreenStorageConfigVO.java new file mode 100644 index 0000000..efee467 --- /dev/null +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ScreenStorageConfigVO.java @@ -0,0 +1,28 @@ +package com.ruoyi.other.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +@Data +public class ScreenStorageConfigVO { + /** + * 系统建设日期 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDate systemCreateTime; + + /** + * 储能放电量 随机增长,每日不超过100度 + */ + private BigDecimal storageDisCharge; + + /** + * 最后一次更改时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDate lastUpdated; +} diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ScreenTopVO.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ScreenTopVO.java new file mode 100644 index 0000000..fd9d887 --- /dev/null +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ScreenTopVO.java @@ -0,0 +1,24 @@ +package com.ruoyi.other.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class ScreenTopVO { + @ApiModelProperty("汽车充电量") + private BigDecimal carCharge; + @ApiModelProperty("汽车放电量") + private BigDecimal carDisCharge; + @ApiModelProperty("光伏发电量") + private BigDecimal photovoltaic=new BigDecimal("0.00"); + @ApiModelProperty("光伏用电量") + private BigDecimal greenElectricity; + @ApiModelProperty("储能充电量") + private BigDecimal storageCharge; + @ApiModelProperty("储能放电量") + private BigDecimal storageDisCharge; + + +} diff --git a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TScreenContentMapper.xml b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TScreenContentMapper.xml new file mode 100644 index 0000000..fed5aea --- /dev/null +++ b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TScreenContentMapper.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.ruoyi.other.mapper.TScreenContentMapper"> + + <select id="getCarDisCharge" resultType="java.math.BigDecimal"> + select + sum(car_discharge) + FROM t_screen_content + WHERE + site_id in + <foreach item="item" index="index" collection="siteIds" open="(" separator="," close=")"> + #{item} + </foreach> + </select> + <select id="getGreenElectricity" resultType="java.math.BigDecimal"> + select + sum(green_electricity) + FROM t_screen_content + WHERE + site_id in + <foreach item="item" index="index" collection="siteIds" open="(" separator="," close=")"> + #{item} + </foreach> + </select> +</mapper> -- Gitblit v1.7.1