Merge pull request '260826_01_ENH: notihub 수정으로 인한 후속 조치' (#19) from develop into master

Reviewed-on: #19
This commit is contained in:
2026-08-26 12:30:46 +09:00
7 changed files with 99 additions and 17 deletions

View File

@@ -252,6 +252,10 @@ When implementation is complete, report in Korean:
- Multipart filenames, including non-ASCII names, are sent unchanged in the quoted `filename` parameter as raw UTF-8. No ASCII fallback or `filename*` parameter is added; CR/LF rejection and quote/backslash escaping still apply.
- `JsonUtil` requires the consumer's explicit `ObjectMapper`; shared date/time helpers define KST as `Asia/Seoul` and also expose UTC semantics.
### Project Instruction Budget
- Keep `.agent/project.md` at or below 9 KiB (9,216 bytes) as the normal target. Do not delete material rules merely to meet the budget; move schema details, query or procedure inventories, API examples, and migration history to linked project documentation, and keep concise read-routing instructions here.
### Upgrade and Verification
- Review KriCommon release notes, README changes, configuration defaults, auto-configuration conditions, and affected public APIs before upgrading.

View File

@@ -41,12 +41,18 @@ public class NotiHubApiClient {
}
}
public void sendEmailSingle(NotiHubSendRequestSingleDto request, RequestUserContext ctx) {
postSingle("/send-email/single", request, ctx);
public NotiHubSendSingleResponseDto sendEmailSingle(
NotiHubSendRequestSingleDto request,
RequestUserContext ctx
) {
return postSingle("/send-email/single", request, ctx);
}
public void sendSmsSingle(NotiHubSendRequestSingleDto request, RequestUserContext ctx) {
postSingle("/send-sms/single", request, ctx);
public NotiHubSendSingleResponseDto sendSmsSingle(
NotiHubSendRequestSingleDto request,
RequestUserContext ctx
) {
return postSingle("/send-sms/single", request, ctx);
}
public String createEmailBulk(NotiHubBulkSendCreateRequestDto request) {
@@ -85,8 +91,19 @@ public class NotiHubApiClient {
}
}
private void postSingle(String path, NotiHubSendRequestSingleDto request, RequestUserContext ctx) {
post(urlWithContext(path, ctx), request);
private NotiHubSendSingleResponseDto postSingle(
String path,
NotiHubSendRequestSingleDto request,
RequestUserContext ctx
) {
String url = urlWithContext(path, ctx);
try {
ExternalApiResponse response = post(url, request);
return objectMapper.readValue(response.getBody(), NotiHubSendSingleResponseDto.class);
} catch (JsonProcessingException e) {
throw BusinessException.badRequest("NOTI_HUB_RESPONSE_PARSE_FAILED", "noti-hub 응답을 해석할 수 없습니다.")
.with("url", url);
}
}
private String createBulk(String path, NotiHubBulkSendCreateRequestDto request) {

View File

@@ -0,0 +1,20 @@
package com.kri.contact.server.common.external.notihub;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Map;
import lombok.Getter;
import lombok.NoArgsConstructor;
@Getter
@NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
@Schema(description = "NotiHubSendSingleResponseDto")
public class NotiHubSendSingleResponseDto {
@Schema(description = "cmid")
private String cmid;
@Schema(description = "data")
private Map<String, Object> data;
}

View File

@@ -16,6 +16,8 @@ public class NotiHubTemplateDto {
@Schema(description = "tmplatIdx")
private Long tmplatIdx;
@Schema(description = "tmplatPurpose")
private Integer tmplatPurpose;
@Schema(description = "tmplatTitle")
private String tmplatTitle;
@Schema(description = "tmplatBody")

View File

@@ -4,6 +4,7 @@ import com.kri.common.feature.web.RequestUserContext;
import com.kri.contact.server.dto.message.MessageBulkSendResponseDto;
import com.kri.contact.server.dto.message.MessageSendBulkRequestDto;
import com.kri.contact.server.dto.message.MessageSendSingleRequestDto;
import com.kri.contact.server.dto.message.MessageSendSingleResponseDto;
import com.kri.contact.server.service.MessageService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
@@ -25,12 +26,12 @@ public class MessageController {
@Operation(summary = "Email single send")
@PostMapping("/email/single/{prjctIdx}")
public void sendEmailSingle(
public MessageSendSingleResponseDto sendEmailSingle(
@PathVariable Long prjctIdx,
@Valid @RequestBody MessageSendSingleRequestDto request,
RequestUserContext ctx
) {
messageService.sendEmailSingle(prjctIdx, request, ctx);
return messageService.sendEmailSingle(prjctIdx, request, ctx);
}
@Operation(summary = "Email bulk send")
@@ -45,12 +46,12 @@ public class MessageController {
@Operation(summary = "SMS single send")
@PostMapping("/sms/single/{prjctIdx}")
public void sendSmsSingle(
public MessageSendSingleResponseDto sendSmsSingle(
@PathVariable Long prjctIdx,
@Valid @RequestBody MessageSendSingleRequestDto request,
RequestUserContext ctx
) {
messageService.sendSmsSingle(prjctIdx, request, ctx);
return messageService.sendSmsSingle(prjctIdx, request, ctx);
}
@Operation(summary = "SMS bulk send")

View File

@@ -0,0 +1,26 @@
package com.kri.contact.server.dto.message;
import com.kri.contact.server.common.external.notihub.NotiHubSendSingleResponseDto;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Map;
import lombok.Builder;
import lombok.Getter;
@Getter
@Builder
@Schema(description = "Message single send response")
public class MessageSendSingleResponseDto {
@Schema(description = "cmid")
private String cmid;
@Schema(description = "data")
private Map<String, Object> data;
public static MessageSendSingleResponseDto from(NotiHubSendSingleResponseDto response) {
return MessageSendSingleResponseDto.builder()
.cmid(response.getCmid())
.data(response.getData())
.build();
}
}

View File

@@ -13,6 +13,7 @@ import com.kri.contact.server.common.external.notihub.NotiHubBulkSendResponseDto
import com.kri.contact.server.common.external.notihub.NotiHubDestInfoDto;
import com.kri.contact.server.common.external.notihub.NotiHubSendRequestBulkDto;
import com.kri.contact.server.common.external.notihub.NotiHubSendRequestSingleDto;
import com.kri.contact.server.common.external.notihub.NotiHubSendSingleResponseDto;
import com.kri.contact.server.common.external.notihub.NotiHubTemplateDto;
import com.kri.contact.server.dto.list.ListHeaderDto;
import com.kri.contact.server.dto.list.ListSendResultDto;
@@ -20,6 +21,7 @@ import com.kri.contact.server.dto.message.MessageBulkSendResponseDto;
import com.kri.contact.server.dto.message.MessageFailedChunkDto;
import com.kri.contact.server.dto.message.MessageSendBulkRequestDto;
import com.kri.contact.server.dto.message.MessageSendSingleRequestDto;
import com.kri.contact.server.dto.message.MessageSendSingleResponseDto;
import com.kri.contact.server.dto.project.ProjectInfoDto;
import java.util.ArrayList;
import java.util.Collection;
@@ -52,13 +54,21 @@ public class MessageService {
private final NotiHubApiClient notiHubApiClient;
@Transactional(readOnly = true)
public void sendEmailSingle(Long prjctIdx, MessageSendSingleRequestDto request, RequestUserContext ctx) {
sendSingle(prjctIdx, request, ctx, ChannelType.EMAIL);
public MessageSendSingleResponseDto sendEmailSingle(
Long prjctIdx,
MessageSendSingleRequestDto request,
RequestUserContext ctx
) {
return sendSingle(prjctIdx, request, ctx, ChannelType.EMAIL);
}
@Transactional(readOnly = true)
public void sendSmsSingle(Long prjctIdx, MessageSendSingleRequestDto request, RequestUserContext ctx) {
sendSingle(prjctIdx, request, ctx, ChannelType.SMS);
public MessageSendSingleResponseDto sendSmsSingle(
Long prjctIdx,
MessageSendSingleRequestDto request,
RequestUserContext ctx
) {
return sendSingle(prjctIdx, request, ctx, ChannelType.SMS);
}
@Transactional(readOnly = true)
@@ -71,7 +81,7 @@ public class MessageService {
return sendBulk(prjctIdx, request, ctx, ChannelType.SMS);
}
private void sendSingle(
private MessageSendSingleResponseDto sendSingle(
Long prjctIdx,
MessageSendSingleRequestDto request,
RequestUserContext ctx,
@@ -100,6 +110,7 @@ public class MessageService {
throw BusinessException.badRequest("NO_DESTINATION", "발송 대상 이메일 또는 전화번호가 없습니다.");
}
NotiHubSendSingleResponseDto response = null;
for (NotiHubDestInfoDto destInfo : destInfos) {
NotiHubSendRequestSingleDto notiRequest = NotiHubSendRequestSingleDto.builder()
.destInfo(destInfo)
@@ -111,11 +122,12 @@ public class MessageService {
.build();
if (channelType == ChannelType.EMAIL) {
notiHubApiClient.sendEmailSingle(notiRequest, ctx);
response = notiHubApiClient.sendEmailSingle(notiRequest, ctx);
} else {
notiHubApiClient.sendSmsSingle(notiRequest, ctx);
response = notiHubApiClient.sendSmsSingle(notiRequest, ctx);
}
}
return MessageSendSingleResponseDto.from(response);
}
private MessageBulkSendResponseDto sendBulk(