From cc674a3522294b79734f5dae677eba59293bd83e Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Tue, 10 Oct 2023 09:31:45 +0800 Subject: [PATCH] =?UTF-8?q?#=E6=B0=B4=E7=94=B5=E7=AB=99bug=E8=A7=A3?= =?UTF-8?q?=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hnac/hzims/operational/main/vo/ChargeVo.java | 3 +++ .../operational/main/service/impl/HomePageServiceImpl.java | 12 +++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/ChargeVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/ChargeVo.java index 88f696c..1434621 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/ChargeVo.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/ChargeVo.java @@ -27,4 +27,7 @@ public class ChargeVo { @ApiModelProperty(value = "充电总度数") private String totalChargeDegrees; + + @ApiModelProperty(value = "充电桩数量") + private Integer count; } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomePageServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomePageServiceImpl.java index c64a2b2..c4446da 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomePageServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomePageServiceImpl.java @@ -367,8 +367,14 @@ public class HomePageServiceImpl implements IHomePageService { stationCountVo.setStationTypeName(DictCache.getValue("stationType", item)); stationCountVo.setCount(0); if(HomePageConstant.CHARGE.equals(item) && HomePageConstant.HYDROPOWER_SERVETYPE.equals(serveType)){ - String chargeCount = (String) redisTemplate.opsForValue().get(CHARGE_SUM); - stationCountVo.setCount(Integer.valueOf(chargeCount)); + ChargeVo charge = (ChargeVo) redisTemplate.opsForValue().get(CHARGE_SUM); + if(StringUtil.isEmpty(charge)){ + ChargeVo chargeVo = new ChargeVo(); + this.getCharge(chargeVo); + stationCountVo.setCount(chargeVo.getCount()); + }else{ + stationCountVo.setCount(charge.getCount()); + } list.add(stationCountVo); return; } @@ -1010,7 +1016,7 @@ public class HomePageServiceImpl implements IHomePageService { chargeVo.setChargeDegrees(data.get("todayDegree").toString()); chargeVo.setIncome(data.get("income").toString()); chargeVo.setTotalChargeDegrees(data.get("kilowatt").toString()); - redisTemplate.opsForValue().set(CHARGE_SUM,data.get("stationNum").toString()); + redisTemplate.opsForValue().set(CHARGE_SUM,chargeVo); } catch (Exception ex) { chargeVo.setOrder("0"); chargeVo.setChargeDegrees("0");