Skip to content

Commit 072e5f3

Browse files
committed
refactor
1 parent c8e49c1 commit 072e5f3

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/main/java/de/rwth/idsg/steve/ocpp/task/SetChargingProfileTaskFromDB.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ public void success(String chargeBoxId, String statusValue) {
7474

7575
@Override
7676
public SetChargingProfileRequest getOcpp16Request() {
77-
ocpp.cp._2015._10.ChargingProfile ocppProfile = ChargingProfileDetailsMapper.mapToOcpp(details);
78-
79-
ocppProfile.setTransactionId(transactionId);
77+
ocpp.cp._2015._10.ChargingProfile ocppProfile = ChargingProfileDetailsMapper.mapToOcpp(details, transactionId);
8078

8179
var request = new SetChargingProfileRequest()
8280
.withConnectorId(connectorId)

src/main/java/de/rwth/idsg/steve/service/ChargePointServiceClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ public final int remoteStartTransaction(RemoteStartTransactionParams params,
205205
Integer chargingProfilePk = params.getChargingProfilePk();
206206
if (chargingProfilePk != null) {
207207
ChargingProfile.Details details = chargingProfileRepository.getDetails(chargingProfilePk);
208-
chargingProfile = ChargingProfileDetailsMapper.mapToOcpp(details);
208+
chargingProfile = ChargingProfileDetailsMapper.mapToOcpp(details, null);
209209
if (chargingProfile.getChargingProfilePurpose() != ChargingProfilePurposeType.TX_PROFILE) {
210210
throw new SteveException("ChargingProfilePurposeType is not TX_PROFILE");
211211
}

src/main/java/de/rwth/idsg/steve/utils/mapper/ChargingProfileDetailsMapper.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
@NoArgsConstructor(access = AccessLevel.PRIVATE)
4242
public final class ChargingProfileDetailsMapper {
4343

44-
public static ocpp.cp._2015._10.ChargingProfile mapToOcpp(ChargingProfile.Details details) {
44+
public static ocpp.cp._2015._10.ChargingProfile mapToOcpp(ChargingProfile.Details details,
45+
Integer transactionId) {
4546
ChargingProfileRecord profile = details.getProfile();
4647

4748
List<ChargingSchedulePeriod> schedulePeriods =
@@ -65,6 +66,7 @@ public static ocpp.cp._2015._10.ChargingProfile mapToOcpp(ChargingProfile.Detail
6566

6667
return new ocpp.cp._2015._10.ChargingProfile()
6768
.withChargingProfileId(profile.getChargingProfilePk())
69+
.withTransactionId(transactionId)
6870
.withStackLevel(profile.getStackLevel())
6971
.withChargingProfilePurpose(ChargingProfilePurposeType.fromValue(profile.getChargingProfilePurpose()))
7072
.withChargingProfileKind(ChargingProfileKindType.fromValue(profile.getChargingProfileKind()))

0 commit comments

Comments
 (0)