11package com .example .quaterback .websocket .boot .notification .handler ;
22
3+ import com .example .quaterback .api .domain .txinfo .repository .SpringDataJpaTxInfoRepository ;
34import com .example .quaterback .common .annotation .Handler ;
45import com .example .quaterback .websocket .MessageUtil ;
56import com .example .quaterback .websocket .OcppMessageHandler ;
1617
1718import java .io .IOException ;
1819import java .time .LocalDateTime ;
20+ import java .util .Optional ;
1921
2022@ Handler
2123@ RequiredArgsConstructor
@@ -25,6 +27,7 @@ public class BootNotificationHandler implements OcppMessageHandler {
2527 private final BootNotificationService bootNotificationService ;
2628 private final ObjectMapper objectMapper ;
2729 private final RefreshTimeoutService refreshTimeoutService ;
30+ private final SpringDataJpaTxInfoRepository springDataJpaTxInfoRepository ;
2831
2932 @ Override
3033 public String getAction () {
@@ -53,7 +56,11 @@ public void handle(WebSocketSession session, JsonNode jsonNode) {
5356 payloadNode .put ("interval" , 15 );
5457 payloadNode .put ("status" , "Accepted" );
5558
56- response .add (payloadNode );
59+ ObjectNode customDataNode = mapper .createObjectNode ();
60+ Optional <String > transactionId = springDataJpaTxInfoRepository .findLatestTransactionId ();
61+ customDataNode .put ("transactionId" , transactionId .orElse ("tx-000" ));
62+ // payload에 customData 추가
63+ payloadNode .set ("customData" , customDataNode );
5764
5865 // 메시지 전송
5966 try {
0 commit comments