Compare commits
5 Commits
develop
...
6aaf35adf6
| Author | SHA1 | Date | |
|---|---|---|---|
| 6aaf35adf6 | |||
| d05db04a19 | |||
| 47d350d3f5 | |||
| 27dfb4d26f | |||
| 2ea40970cd |
@@ -27,7 +27,6 @@ public final class ContactConstant {
|
|||||||
Locale.ROOT));
|
Locale.ROOT));
|
||||||
|
|
||||||
public static final String LIST_HEADER_ACCEPT_REGEX = "^[가-힣a-zA-Z0-9()_\\-\\[\\] ]+$";
|
public static final String LIST_HEADER_ACCEPT_REGEX = "^[가-힣a-zA-Z0-9()_\\-\\[\\] ]+$";
|
||||||
public static final String LIST_HEADER_COLOR_REGEX = "^#([0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$";
|
|
||||||
|
|
||||||
public static final List<ListHeaderType> DEFAULT_AND_FILE_TYPE = Stream.concat(
|
public static final List<ListHeaderType> DEFAULT_AND_FILE_TYPE = Stream.concat(
|
||||||
Arrays.stream(ListHeaderTypeDefault.values())
|
Arrays.stream(ListHeaderTypeDefault.values())
|
||||||
|
|||||||
@@ -22,18 +22,12 @@ public enum ListHeaderType implements CodeEnum<Short> {
|
|||||||
EMAIL(ListHeaderTypeSpecific.EMAIL), //31 : 이메일
|
EMAIL(ListHeaderTypeSpecific.EMAIL), //31 : 이메일
|
||||||
FILE(ListHeaderTypeSpecific.FILE), //81 : 파일업로드
|
FILE(ListHeaderTypeSpecific.FILE), //81 : 파일업로드
|
||||||
CONTENT_ITEM(ListHeaderTypeSpecific.CONTENT_ITEM), //91 : 목록형
|
CONTENT_ITEM(ListHeaderTypeSpecific.CONTENT_ITEM), //91 : 목록형
|
||||||
MULTILINE_TEXT(ListHeaderTypeSpecific.MULTILINE_TEXT), //98 : 여러 줄 텍스트
|
|
||||||
TEXT((short) 99); //99 : 텍스트
|
TEXT((short) 99); //99 : 텍스트
|
||||||
|
|
||||||
private final Short code;
|
private final Short code;
|
||||||
|
|
||||||
ListHeaderType(CodeEnum<Short> source) { this.code = source.getCode();}
|
ListHeaderType(CodeEnum<Short> source) { this.code = source.getCode();}
|
||||||
|
|
||||||
/** 저장·처리 방식이 일반 텍스트와 동일한 타입 여부 */
|
|
||||||
public boolean isText() {
|
|
||||||
return this == TEXT || this == MULTILINE_TEXT;
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
|
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
|
||||||
public static ListHeaderType fromCode(Short code) {
|
public static ListHeaderType fromCode(Short code) {
|
||||||
if (code == null) {
|
if (code == null) {
|
||||||
|
|||||||
@@ -15,8 +15,7 @@ public enum ListHeaderTypeSpecific implements CodeEnum<Short> {
|
|||||||
TEL_NUM((short) 21), //21 : 전화번호
|
TEL_NUM((short) 21), //21 : 전화번호
|
||||||
EMAIL((short) 31), //31 : 이메일
|
EMAIL((short) 31), //31 : 이메일
|
||||||
FILE((short) 81), //81 : 파일업로드
|
FILE((short) 81), //81 : 파일업로드
|
||||||
CONTENT_ITEM((short) 91), //목록형
|
CONTENT_ITEM((short) 91); //목록형
|
||||||
MULTILINE_TEXT((short) 98); //98 : 여러 줄 텍스트 (텍스트 계열)
|
|
||||||
|
|
||||||
private final Short code;
|
private final Short code;
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import com.kri.contact.server.common.enums.ListHeaderType;
|
|||||||
import com.kri.contact.server.persistence.entity.TListHeaderEntity;
|
import com.kri.contact.server.persistence.entity.TListHeaderEntity;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@@ -45,9 +44,6 @@ public class ListHeaderDto {
|
|||||||
@Schema(description = "헤더 타입")
|
@Schema(description = "헤더 타입")
|
||||||
private ListHeaderType listHderTy;
|
private ListHeaderType listHderTy;
|
||||||
|
|
||||||
@Schema(description = "헤더 색상 hex (#RRGGBB 또는 #RRGGBBAA, null: 기본색)")
|
|
||||||
private String listHderColor;
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Schema(description = "필터 사용 여부")
|
@Schema(description = "필터 사용 여부")
|
||||||
private Boolean useFilter = false;
|
private Boolean useFilter = false;
|
||||||
@@ -72,21 +68,6 @@ public class ListHeaderDto {
|
|||||||
this.listHderNm = listHderNm == null ? null : listHderNm.trim();
|
this.listHderNm = listHderNm == null ? null : listHderNm.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getListHderColor() {
|
|
||||||
return normalizeColor(listHderColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setListHderColor(String listHderColor) {
|
|
||||||
this.listHderColor = normalizeColor(listHderColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String normalizeColor(String color) {
|
|
||||||
if (color == null || color.isBlank()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return color.trim().toUpperCase(Locale.ROOT);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ListHeaderDto fromEntity(TListHeaderEntity entity) {
|
public static ListHeaderDto fromEntity(TListHeaderEntity entity) {
|
||||||
return ListHeaderDto.builder()
|
return ListHeaderDto.builder()
|
||||||
.prjctIdx(entity.getPrjctIdx())
|
.prjctIdx(entity.getPrjctIdx())
|
||||||
@@ -95,7 +76,6 @@ public class ListHeaderDto {
|
|||||||
.listHderGrad(ListHeaderGrade.fromCode(entity.getListHderGrad()))
|
.listHderGrad(ListHeaderGrade.fromCode(entity.getListHderGrad()))
|
||||||
.listHderNm(entity.getListHderNm())
|
.listHderNm(entity.getListHderNm())
|
||||||
.listHderTy(ListHeaderType.fromCode(entity.getListHderTy()))
|
.listHderTy(ListHeaderType.fromCode(entity.getListHderTy()))
|
||||||
.listHderColor(entity.getListHderColor())
|
|
||||||
.useFilter(entity.getUseFilter())
|
.useFilter(entity.getUseFilter())
|
||||||
.useColView(entity.getUseColView())
|
.useColView(entity.getUseColView())
|
||||||
.useIntrvwerView(entity.getUseIntrvwerView())
|
.useIntrvwerView(entity.getUseIntrvwerView())
|
||||||
@@ -111,7 +91,6 @@ public class ListHeaderDto {
|
|||||||
.listHderGrad(src.getListHderGrad())
|
.listHderGrad(src.getListHderGrad())
|
||||||
.listHderNm(src.getListHderNm())
|
.listHderNm(src.getListHderNm())
|
||||||
.listHderTy(src.getListHderTy())
|
.listHderTy(src.getListHderTy())
|
||||||
.listHderColor(src.getListHderColor())
|
|
||||||
.useFilter(src.getUseFilter())
|
.useFilter(src.getUseFilter())
|
||||||
.useColView(src.getUseColView())
|
.useColView(src.getUseColView())
|
||||||
.useIntrvwerView(src.getUseIntrvwerView())
|
.useIntrvwerView(src.getUseIntrvwerView())
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ public class ListHeaderWithFilterContentDto extends ListHeaderDto {
|
|||||||
.listHderGrad(ListHeaderGrade.fromCode(entity.getListHderGrad()))
|
.listHderGrad(ListHeaderGrade.fromCode(entity.getListHderGrad()))
|
||||||
.listHderNm(entity.getListHderNm())
|
.listHderNm(entity.getListHderNm())
|
||||||
.listHderTy(ListHeaderType.fromCode(entity.getListHderTy()))
|
.listHderTy(ListHeaderType.fromCode(entity.getListHderTy()))
|
||||||
.listHderColor(entity.getListHderColor())
|
|
||||||
.useFilter(entity.getUseFilter())
|
.useFilter(entity.getUseFilter())
|
||||||
.useColView(entity.getUseColView())
|
.useColView(entity.getUseColView())
|
||||||
.useIntrvwerView(entity.getUseIntrvwerView())
|
.useIntrvwerView(entity.getUseIntrvwerView())
|
||||||
|
|||||||
@@ -46,10 +46,6 @@ public class TListHeaderEntity {
|
|||||||
@Column(name = "list_hder_ty", nullable = false)
|
@Column(name = "list_hder_ty", nullable = false)
|
||||||
private Short listHderTy;
|
private Short listHderTy;
|
||||||
|
|
||||||
@Size(max = 16)
|
|
||||||
@Column(name = "list_hder_color", length = 16)
|
|
||||||
private String listHderColor;
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@ColumnDefault("0")
|
@ColumnDefault("0")
|
||||||
@Column(name = "use_filter", nullable = false)
|
@Column(name = "use_filter", nullable = false)
|
||||||
@@ -107,7 +103,6 @@ public class TListHeaderEntity {
|
|||||||
.listHderGrad(src.getListHderGrad())
|
.listHderGrad(src.getListHderGrad())
|
||||||
.listHderNm(src.getListHderNm() == null ? null : src.getListHderNm().trim())
|
.listHderNm(src.getListHderNm() == null ? null : src.getListHderNm().trim())
|
||||||
.listHderTy(src.getListHderTy())
|
.listHderTy(src.getListHderTy())
|
||||||
.listHderColor(src.getListHderColor())
|
|
||||||
.useFilter(src.getUseFilter())
|
.useFilter(src.getUseFilter())
|
||||||
.useColView(src.getUseColView())
|
.useColView(src.getUseColView())
|
||||||
.useIntrvwerView(src.getUseIntrvwerView())
|
.useIntrvwerView(src.getUseIntrvwerView())
|
||||||
@@ -124,7 +119,6 @@ public class TListHeaderEntity {
|
|||||||
.listHderGrad(dto.getListHderGrad().getCode())
|
.listHderGrad(dto.getListHderGrad().getCode())
|
||||||
.listHderNm(dto.getListHderNm())
|
.listHderNm(dto.getListHderNm())
|
||||||
.listHderTy(dto.getListHderTy().getCode())
|
.listHderTy(dto.getListHderTy().getCode())
|
||||||
.listHderColor(dto.getListHderColor())
|
|
||||||
.useFilter(dto.getUseFilter())
|
.useFilter(dto.getUseFilter())
|
||||||
.useColView(dto.getUseColView())
|
.useColView(dto.getUseColView())
|
||||||
.useIntrvwerView(dto.getUseIntrvwerView())
|
.useIntrvwerView(dto.getUseIntrvwerView())
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.kri.contact.server.service;
|
|||||||
|
|
||||||
import static com.kri.contact.server.common.consts.ContactConstant.EXACT_MATCH_HEADER_TYPE;
|
import static com.kri.contact.server.common.consts.ContactConstant.EXACT_MATCH_HEADER_TYPE;
|
||||||
import static com.kri.contact.server.common.consts.ContactConstant.LIST_HEADER_ACCEPT_REGEX;
|
import static com.kri.contact.server.common.consts.ContactConstant.LIST_HEADER_ACCEPT_REGEX;
|
||||||
import static com.kri.contact.server.common.consts.ContactConstant.LIST_HEADER_COLOR_REGEX;
|
|
||||||
import static com.kri.contact.server.common.consts.ContactConstant.SYSTEM_USER_NAME;
|
import static com.kri.contact.server.common.consts.ContactConstant.SYSTEM_USER_NAME;
|
||||||
import static com.kri.contact.server.common.consts.ContactConstant.UPPER_CASE_HEADER_OPTIONS;
|
import static com.kri.contact.server.common.consts.ContactConstant.UPPER_CASE_HEADER_OPTIONS;
|
||||||
|
|
||||||
@@ -246,16 +245,6 @@ public class ListHeaderService {
|
|||||||
.with("invalidHeaderList", invalidHeaderList);
|
.with("invalidHeaderList", invalidHeaderList);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> invalidColorHeaderList = headerList.stream()
|
|
||||||
.filter(h -> h.getListHderColor() != null && !h.getListHderColor().matches(LIST_HEADER_COLOR_REGEX))
|
|
||||||
.map(ListHeaderDto::getListHderNm)
|
|
||||||
.toList();
|
|
||||||
|
|
||||||
if (!invalidColorHeaderList.isEmpty()) {
|
|
||||||
throw BusinessException.badRequest("WRONG_HEADER_COLOR", "헤더 색상은 #RRGGBB 또는 #RRGGBBAA 형식이어야 합니다.")
|
|
||||||
.with("invalidHeaderList", invalidColorHeaderList);
|
|
||||||
}
|
|
||||||
|
|
||||||
validateUniqueHeaderNames(headerList);
|
validateUniqueHeaderNames(headerList);
|
||||||
|
|
||||||
// headerList에 없는 헤더는 삭제
|
// headerList에 없는 헤더는 삭제
|
||||||
@@ -414,7 +403,6 @@ public class ListHeaderService {
|
|||||||
case TEL_NUM -> ListHeaderType.TEL_NUM;
|
case TEL_NUM -> ListHeaderType.TEL_NUM;
|
||||||
case FILE -> ListHeaderType.FILE;
|
case FILE -> ListHeaderType.FILE;
|
||||||
case CONTENT_ITEM -> ListHeaderType.CONTENT_ITEM;
|
case CONTENT_ITEM -> ListHeaderType.CONTENT_ITEM;
|
||||||
case MULTILINE_TEXT -> ListHeaderType.MULTILINE_TEXT;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -380,7 +380,7 @@ public class ListUploadService {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (header.getListHderTy() != null && header.getListHderTy().isText()) {
|
if (header.getListHderTy() == ListHeaderType.TEXT) {
|
||||||
raw = escapeUnsafeText(raw);
|
raw = escapeUnsafeText(raw);
|
||||||
}
|
}
|
||||||
if (header.getListHderTy() == ListHeaderType.EMAIL) {
|
if (header.getListHderTy() == ListHeaderType.EMAIL) {
|
||||||
@@ -631,7 +631,7 @@ public class ListUploadService {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (header.getListHderTy() != null && header.getListHderTy().isText()) {
|
if (header.getListHderTy() == ListHeaderType.TEXT) {
|
||||||
raw = escapeUnsafeText(raw);
|
raw = escapeUnsafeText(raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user