Changing the comparison method of stationId.
This commit is contained in:
parent
fa55722dec
commit
8923503ccf
@ -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,27 +41,31 @@ 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) {
|
||||||
boolean existsGun = false;
|
ChargingStationDto chargingStationDto = REDIS.getCacheObject("station:" + stationID);
|
||||||
List<ConnectorStatusInfo> connectorStatusInfos = new ArrayList<>();
|
Set<String> pileIds = chargingStationDto.getPiles();
|
||||||
for (String value : gunsIds) {
|
for (String pileId : pileIds) {
|
||||||
if (stationID.equals(value.substring(0, 12))) {
|
boolean existsGun = false;
|
||||||
existsGun = true;
|
List<ConnectorStatusInfo> connectorStatusInfos = new ArrayList<>();
|
||||||
ConnectorStatusInfo connectorStatusInfo = new ConnectorStatusInfo();
|
for (String value : gunsIds) {
|
||||||
Object status = REDIS.getCacheMapValue("gun:" + value, "status");
|
if (pileId.equals(value.substring(0, 14))) {
|
||||||
if (isInteger(status.toString())) {
|
existsGun = true;
|
||||||
connectorStatusInfo.setStatus(3);
|
ConnectorStatusInfo connectorStatusInfo = new ConnectorStatusInfo();
|
||||||
} else {
|
Object status = REDIS.getCacheMapValue("gun:" + value, "status");
|
||||||
connectorStatusInfo.setStatus(statusMap.get(status));
|
if (isInteger(status.toString())) {
|
||||||
|
connectorStatusInfo.setStatus(3);
|
||||||
|
} else {
|
||||||
|
connectorStatusInfo.setStatus(statusMap.get(status));
|
||||||
|
}
|
||||||
|
connectorStatusInfo.setConnectorID(value);
|
||||||
|
connectorStatusInfos.add(connectorStatusInfo);
|
||||||
}
|
}
|
||||||
connectorStatusInfo.setConnectorID(value);
|
|
||||||
connectorStatusInfos.add(connectorStatusInfo);
|
|
||||||
}
|
}
|
||||||
}
|
if (existsGun) {
|
||||||
if (existsGun) {
|
StationStatusInfo stationStatusInfo = new StationStatusInfo();
|
||||||
StationStatusInfo stationStatusInfo = new StationStatusInfo();
|
stationStatusInfo.setStationID(stationID);
|
||||||
stationStatusInfo.setStationID(stationID);
|
stationStatusInfo.setConnectorStatusInfos(connectorStatusInfos);
|
||||||
stationStatusInfo.setConnectorStatusInfos(connectorStatusInfos);
|
stationStatusInfos.add(stationStatusInfo);
|
||||||
stationStatusInfos.add(stationStatusInfo);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user