Changing the comparison method of stationId.

This commit is contained in:
little-cat-sweet 2021-10-28 21:50:56 +08:00
parent fa55722dec
commit 8923503ccf

View File

@ -1,5 +1,6 @@
package com.xhpc.evcs.api; package com.xhpc.evcs.api;
import com.xhpc.common.api.dto.ChargingStationDto;
import com.xhpc.evcs.dto.*; import com.xhpc.evcs.dto.*;
import com.xhpc.evcs.utils.JSONUtil; import com.xhpc.evcs.utils.JSONUtil;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -40,10 +41,13 @@ public class QueryStationStatusController extends CoreDispatcher {
statusMap.put(keys[i], values[i]); statusMap.put(keys[i], values[i]);
} }
for (String stationID : stationIDs) { for (String stationID : stationIDs) {
ChargingStationDto chargingStationDto = REDIS.getCacheObject("station:" + stationID);
Set<String> pileIds = chargingStationDto.getPiles();
for (String pileId : pileIds) {
boolean existsGun = false; boolean existsGun = false;
List<ConnectorStatusInfo> connectorStatusInfos = new ArrayList<>(); List<ConnectorStatusInfo> connectorStatusInfos = new ArrayList<>();
for (String value : gunsIds) { for (String value : gunsIds) {
if (stationID.equals(value.substring(0, 12))) { if (pileId.equals(value.substring(0, 14))) {
existsGun = true; existsGun = true;
ConnectorStatusInfo connectorStatusInfo = new ConnectorStatusInfo(); ConnectorStatusInfo connectorStatusInfo = new ConnectorStatusInfo();
Object status = REDIS.getCacheMapValue("gun:" + value, "status"); Object status = REDIS.getCacheMapValue("gun:" + value, "status");
@ -63,6 +67,7 @@ public class QueryStationStatusController extends CoreDispatcher {
stationStatusInfos.add(stationStatusInfo); stationStatusInfos.add(stationStatusInfo);
} }
} }
}
StationStatusInfoWrapper stationStatusInfoWrappers = new StationStatusInfoWrapper(); StationStatusInfoWrapper stationStatusInfoWrappers = new StationStatusInfoWrapper();
stationStatusInfoWrappers.setTotal(stationStatusInfos.size()); stationStatusInfoWrappers.setTotal(stationStatusInfos.size());