|
|
|
@ -15,8 +15,6 @@ import eu.chargetime.ocpp.model.core.RemoteStopTransactionConfirmation; |
|
|
|
|
import eu.chargetime.ocpp.model.core.ResetConfirmation; |
|
|
|
|
import eu.chargetime.ocpp.model.core.ResetRequest; |
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.util.Map.Entry; |
|
|
|
|
import java.util.Objects; |
|
|
|
|
import java.util.UUID; |
|
|
|
|
import java.util.concurrent.ExecutionException; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
@ -51,12 +49,7 @@ public class ResetController { |
|
|
|
|
@PathVariable("identity") final String identity, @RequestBody final ResetRequest request) { |
|
|
|
|
// TODO REFACTOR THIS
|
|
|
|
|
log.info("Send reset to {}, parameters {}", identity, request); |
|
|
|
|
var session = sessionService.getCache() |
|
|
|
|
.entrySet().stream() |
|
|
|
|
.filter((entry) -> Objects.equals(entry.getValue().getIdentifier(), identity)) |
|
|
|
|
.map(Entry::getKey) |
|
|
|
|
.findFirst() |
|
|
|
|
.orElseThrow(); |
|
|
|
|
var session = sessionService.getSessionByIdentity(identity); |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
var stage = ocppStub.send(session, request); |
|
|
|
@ -76,7 +69,12 @@ public class ResetController { |
|
|
|
|
|
|
|
|
|
@PostMapping("/start/{identity}") |
|
|
|
|
public RemoteStartTransactionConfirmation startTransaction(@PathVariable("identity") final String identity) { |
|
|
|
|
return transactionService.remoteStart(identity); |
|
|
|
|
return transactionService.remoteStart(identity, null); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@PostMapping("/start/{identity}/{connectorId}") |
|
|
|
|
public RemoteStartTransactionConfirmation startTransactionOnConnector(@PathVariable("identity") final String identity, @PathVariable("connectorId") final Integer connectorId) { |
|
|
|
|
return transactionService.remoteStart(identity, connectorId); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@DeleteMapping("/stop/{identity}") |
|
|
|
|