인터페이스 다운로드 변경사항 반영

This commit is contained in:
Boram
2026-08-14 11:30:55 +09:00
parent 09cc22e4a4
commit 45e2c148ab
2 changed files with 54 additions and 28 deletions

View File

@@ -11,7 +11,9 @@ import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.regex.Pattern;
import org.apache.poi.ss.usermodel.*;
@@ -45,6 +47,7 @@ public class DtoExcelDownloadController {
private static final String MCI_BASE_PACKAGE = "io.shinhanlife.dap.mcc.infra.itrf.mci";
private static final String INVALID_DTO_MESSAGE =
"dto의 내용이 엑셀파일 양식에 맞지않습니다 파일을 확인해주세요";
private static final Pattern VARIANT_SUFFIX = Pattern.compile("_[IO]$");
private final Map<String, String> dtoClasses;
@@ -54,8 +57,12 @@ public class DtoExcelDownloadController {
@GetMapping("/dto-download/options")
public List<String> options() {
// 클래스패스에서 자동 검색된 DTO 목록을 화면에 제공한다.
return List.copyOf(dtoClasses.keySet());
// DTO는 항상 _I/_O 한 쌍으로 존재하므로 접미사를 제거한 이름 단위로 묶어 화면에 제공한다.
Set<String> baseNames = new TreeSet<>();
for (String simpleName : dtoClasses.keySet()) {
baseNames.add(VARIANT_SUFFIX.matcher(simpleName).replaceFirst(""));
}
return List.copyOf(baseNames);
}
@GetMapping("/dto-download/{dtoName}")
@@ -328,7 +335,9 @@ public class DtoExcelDownloadController {
private Annotation telegramMetadata(Field field) {
for (Annotation annotation : field.getDeclaredAnnotations()) {
if (annotation.annotationType().getSimpleName().equals("GlowTrgmField")) {
String annotationName = annotation.annotationType().getSimpleName();
if (annotationName.equals("GlowTrgmField")
|| annotationName.equals("GlowMciFieldInfo")) {
return annotation;
}
}