修改设置费率模型的桩号集合

This commit is contained in:
ZZ 2021-07-29 16:19:15 +08:00
parent 134abf9d48
commit dc8773fc85
2 changed files with 19 additions and 1 deletions

View File

@ -8,6 +8,7 @@ public class ChargingStationDto {
private Long stationId;
private Set<String> piles;
private Set<String> pilesSettingRateModel;
private Long rateModelId;
public Long getStationId() {
@ -30,6 +31,16 @@ public class ChargingStationDto {
this.piles = piles;
}
public Set<String> getPilesSettingRateModel() {
return pilesSettingRateModel;
}
public void setPilesSettingRateModel(Set<String> pilesSettingRateModel) {
this.pilesSettingRateModel = pilesSettingRateModel;
}
public Long getRateModelId() {
return rateModelId;

View File

@ -30,8 +30,10 @@ public class PileController {
Set<String> 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<String> 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();
}