From dc8773fc85289f3aeea914b77fb1b65b76c25b73 Mon Sep 17 00:00:00 2001 From: ZZ Date: Thu, 29 Jul 2021 16:19:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=BE=E7=BD=AE=E8=B4=B9?= =?UTF-8?q?=E7=8E=87=E6=A8=A1=E5=9E=8B=E7=9A=84=E6=A1=A9=E5=8F=B7=E9=9B=86?= =?UTF-8?q?=E5=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xhpc/common/api/dto/ChargingStationDto.java | 11 +++++++++++ .../java/com/xhpc/pp/controller/PileController.java | 9 ++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/dto/ChargingStationDto.java b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/dto/ChargingStationDto.java index c4c86aa8..a18abdda 100644 --- a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/dto/ChargingStationDto.java +++ b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/dto/ChargingStationDto.java @@ -8,6 +8,7 @@ public class ChargingStationDto { private Long stationId; private Set piles; + private Set pilesSettingRateModel; private Long rateModelId; public Long getStationId() { @@ -30,6 +31,16 @@ public class ChargingStationDto { this.piles = piles; } + public Set getPilesSettingRateModel() { + + return pilesSettingRateModel; + } + + public void setPilesSettingRateModel(Set pilesSettingRateModel) { + + this.pilesSettingRateModel = pilesSettingRateModel; + } + public Long getRateModelId() { return rateModelId; diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/controller/PileController.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/controller/PileController.java index 1dad93e3..26c34db1 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/controller/PileController.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/controller/PileController.java @@ -30,8 +30,10 @@ public class PileController { Set stationPiles = cacheStation.getPiles(); if (stationPiles == null) { cacheStation.setPiles(pileNoSet); + cacheStation.setPilesSettingRateModel(pileNoSet); } else { - stationPiles.addAll(pileNoSet); + cacheStation.getPiles().addAll(pileNoSet); + cacheStation.getPilesSettingRateModel().addAll(pileNoSet); } REDIS.setCacheObject(stationKey, cacheStation); for (String pileNo : pileNoSet) { @@ -49,6 +51,11 @@ public class PileController { Set cacheWhitelist = REDIS.getCacheSet("PILE_WHITELIST"); cacheWhitelist.removeAll(pileNoSet); REDIS.setCacheSet("PILE_WHITELIST", cacheWhitelist); + String stationKey = "station:".concat(stationId.toString()); + ChargingStationDto cacheStation = REDIS.getCacheObject(stationKey); + cacheStation.getPiles().removeAll(pileNoSet); + cacheStation.getPilesSettingRateModel().removeAll(pileNoSet); + REDIS.setCacheObject(stationKey, cacheStation); return R.ok(); }