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");