260716_01_ENH: 본 서버에서 기동 후 중간 테스트를 위한 커밋
This commit is contained in:
@@ -25,6 +25,7 @@ import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
@@ -90,7 +91,8 @@ public class MessageService {
|
||||
request.getDestNameHeaderId(),
|
||||
messageContext,
|
||||
channelType,
|
||||
new LinkedHashSet<>()
|
||||
new LinkedHashSet<>(),
|
||||
true
|
||||
);
|
||||
if (destInfos.isEmpty()) {
|
||||
throw BusinessException.badRequest("NO_DESTINATION", "발송 대상 이메일 또는 전화번호가 없습니다.");
|
||||
@@ -127,7 +129,8 @@ public class MessageService {
|
||||
prjctIdx,
|
||||
request,
|
||||
messageContext,
|
||||
channelType
|
||||
channelType,
|
||||
Boolean.TRUE.equals(request.getDedupe())
|
||||
);
|
||||
if (destInfos.isEmpty()) {
|
||||
throw BusinessException.badRequest("NO_DESTINATION", "발송 대상 이메일 또는 전화번호가 없습니다.");
|
||||
@@ -174,7 +177,8 @@ public class MessageService {
|
||||
Long prjctIdx,
|
||||
MessageSendBulkRequestDto request,
|
||||
MessageContext messageContext,
|
||||
ChannelType channelType
|
||||
ChannelType channelType,
|
||||
boolean dedupe
|
||||
) {
|
||||
List<NotiHubDestInfoDto> destInfos = new ArrayList<>();
|
||||
Set<String> dedupeKeys = new LinkedHashSet<>();
|
||||
@@ -196,7 +200,8 @@ public class MessageService {
|
||||
request.getDestNameHeaderId(),
|
||||
messageContext,
|
||||
channelType,
|
||||
dedupeKeys
|
||||
dedupeKeys,
|
||||
dedupe
|
||||
));
|
||||
lastSid = rows.get(rows.size() - 1).sid();
|
||||
}
|
||||
@@ -209,7 +214,8 @@ public class MessageService {
|
||||
Integer destNameHeaderId,
|
||||
MessageContext messageContext,
|
||||
ChannelType channelType,
|
||||
Set<String> dedupeKeys
|
||||
Set<String> dedupeKeys,
|
||||
boolean dedupe
|
||||
) {
|
||||
List<NotiHubDestInfoDto> result = new ArrayList<>();
|
||||
for (ListSearchService.DownloadListRow row : rows) {
|
||||
@@ -219,7 +225,7 @@ public class MessageService {
|
||||
for (Integer destHeaderId : destHeaderIds) {
|
||||
String rawDestination = row.itemMap().get(destHeaderId);
|
||||
String destination = normalizeDestination(rawDestination, channelType);
|
||||
if (destination == null || !dedupeKeys.add(destination)) {
|
||||
if (destination == null || isDuplicateDestination(destination, channelType, dedupeKeys, dedupe)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -399,6 +405,25 @@ public class MessageService {
|
||||
return normalized;
|
||||
}
|
||||
|
||||
private boolean isDuplicateDestination(
|
||||
String destination,
|
||||
ChannelType channelType,
|
||||
Set<String> dedupeKeys,
|
||||
boolean dedupe
|
||||
) {
|
||||
if (!dedupe) {
|
||||
return false;
|
||||
}
|
||||
return !dedupeKeys.add(createDedupeKey(destination, channelType));
|
||||
}
|
||||
|
||||
private String createDedupeKey(String destination, ChannelType channelType) {
|
||||
if (channelType == ChannelType.EMAIL) {
|
||||
return destination.toLowerCase(Locale.ROOT);
|
||||
}
|
||||
return destination;
|
||||
}
|
||||
|
||||
private String normalizeBlank(String value) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user