20250113_4

main
seokjun jeon 2 weeks ago
parent e58fc1cc26
commit 45e0b2d0d1

@ -1,5 +1,6 @@
package com.icomsys;
import com.icomsys.dsl.MessageSendServiceDsl;
import com.icomsys.util.CommonBeanUtils;
import com.icomsys.vo.*;
@ -22,6 +23,7 @@ import java.util.Map;
import java.util.Objects;
import java.util.UUID;
@Service
public class MessagingConnector {
public RestTemplate restTemplate;
@ -118,12 +120,10 @@ public class MessagingConnector {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
headers.add("sejongApiKey", apiKey);
System.out.println("headers : " + headers);
// Body MULTIPART_FORM_DATA로 변환
MultiValueMap<String, String> body = new LinkedMultiValueMap<>();
ObjectMapper objectMapper = new ObjectMapper();
Map<String, String> map = null;
System.out.println("messageSendRequest : " + messageSendRequest);
// SMS
if (messageSendRequest.getSendType().equals("SMS")) {
@ -148,6 +148,10 @@ public class MessagingConnector {
body.setAll(map);
System.out.println("Request URL: " + url);
System.out.println("Request Headers: " + headers);
System.out.println("Request Body: " + body);
// 연동 API (메세지 전송)
try{
HttpEntity request = new HttpEntity<>(body, headers);
@ -158,11 +162,22 @@ public class MessagingConnector {
return super.getType();
}
});
sejongMessageSendResponse = response.getBody();
System.out.println("response.getBody() : " + response.getBody());
if (response != null) {
System.out.println("Status Code: " + response.getStatusCode());
if (response.hasBody()) {
System.out.println("Response Body: " + response.getBody());
} else {
System.out.println("Response Body is null");
}
} else {
System.out.println("Response is null");
}
sejongMessageSendResponse = response.getBody();
}
catch (Exception e) {
e.printStackTrace();
messageSendResponse.setCode("500");
messageSendResponse.setMessage("서버 통신 오류");
}

Loading…
Cancel
Save