diff --git a/src/main/java/com/icomsys/MessagingConnector.java b/src/main/java/com/icomsys/MessagingConnector.java index 3b68a93..51533f2 100644 --- a/src/main/java/com/icomsys/MessagingConnector.java +++ b/src/main/java/com/icomsys/MessagingConnector.java @@ -3,8 +3,11 @@ package com.icomsys; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import com.icomsys.dsl.MessageSendServiceDsl; +import com.icomsys.dsl.MessageSendServiceDslImpl; +import com.icomsys.message.MessageSendLogMapper; import com.icomsys.util.CommonBeanUtils; import com.icomsys.vo.*; +import org.springframework.beans.factory.annotation.Autowired; import java.io.IOException; import java.net.URI; @@ -24,16 +27,17 @@ public class MessagingConnector { private final String mms; private final String kakao; private final String apiKey; - public MessageSendServiceDsl messageSendServiceDsl; + public final MessageSendServiceDsl messageSendServiceDsl; private final HttpClient httpClient; - public MessagingConnector(String sms, String lms, String mms, String kakao, String apiKey) { + public MessagingConnector(String sms, String lms, String mms, String kakao, String apiKey, MessageSendServiceDsl messageSendServiceDsl) { this.sms = sms; this.lms = lms; this.mms = mms; this.kakao = kakao; this.apiKey = apiKey; this.httpClient = HttpClient.newHttpClient(); + this.messageSendServiceDsl = messageSendServiceDsl; } public MessageSendResponse messageDiv(MessageSendRequest messageSendRequest) throws IOException, InterruptedException { @@ -106,6 +110,23 @@ public class MessagingConnector { messageSendResponse.setMessage("서버 통신 오류"); } + if (this.messageSendServiceDsl == null) { + System.out.println("messageSendServiceDsl is null"); + throw new IllegalStateException("messageSendServiceDsl is not initialized."); + } + + if (sejongMessageSendResponse == null) { + System.out.println("sejongMessageSendResponse is null"); + } + + if (messageSendRequest == null) { + System.out.println("messageSendRequest is null"); + } + + if (messageSendResponse == null) { + System.out.println("messageSendResponse is null"); + } + messageSendResponse = this.responseChange(sejongMessageSendResponse, messageSendRequest); this.messageSendServiceDsl.insertSendLog(sejongMessageSendResponse, messageSendRequest, messageSendResponse);