Compare commits
3 Commits
develop
...
47d350d3f5
| Author | SHA1 | Date | |
|---|---|---|---|
| 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;
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public class NotiHubTemplateBasicDto extends NotiHubExtensibleDto {
|
|||||||
private Short tmplatPurpose;
|
private Short tmplatPurpose;
|
||||||
|
|
||||||
@NotBlank
|
@NotBlank
|
||||||
@Size(max = 128)
|
@Size(max = 32)
|
||||||
private String tmplatNm;
|
private String tmplatNm;
|
||||||
|
|
||||||
@Size(max = 128)
|
@Size(max = 128)
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
|||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PatchMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
@@ -64,4 +66,27 @@ public class ListCallHistController {
|
|||||||
now
|
now
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "Find list call history by agent session")
|
||||||
|
@GetMapping("/session/{agentSessionId}")
|
||||||
|
public ListCallHistDto findByAgentSessionId(
|
||||||
|
@PathVariable String agentSessionId,
|
||||||
|
RequestUserContext ctx
|
||||||
|
) {
|
||||||
|
return listCallHistService.findByAgentSessionId(
|
||||||
|
agentSessionId,
|
||||||
|
ctx.getUserId(),
|
||||||
|
ctx.getUserCmpn(),
|
||||||
|
ctx.getUserRole()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "Update Call History at Client Hangup")
|
||||||
|
@PatchMapping("hangup/{agentSessionId}")
|
||||||
|
public boolean hangupClient(
|
||||||
|
@PathVariable String agentSessionId,
|
||||||
|
RequestUserContext ctx
|
||||||
|
) {
|
||||||
|
return listCallHistService.hangupClient(agentSessionId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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())
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import jakarta.persistence.Table;
|
|||||||
import jakarta.persistence.UniqueConstraint;
|
import jakarta.persistence.UniqueConstraint;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
|
import java.time.Duration;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
@@ -154,6 +155,19 @@ public class TListCallHistEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean markUserHangup(LocalDateTime endDt) {
|
||||||
|
if (this.callStatus == CallStatus.CALL_CLOSE) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
LocalDateTime resolvedEndDt = this.endDt == null ? endDt : this.endDt;
|
||||||
|
int durationSeconds = durationSeconds(this.startDt, resolvedEndDt);
|
||||||
|
this.endDt = resolvedEndDt;
|
||||||
|
this.totalTime = durationSeconds;
|
||||||
|
this.talkTime = durationSeconds;
|
||||||
|
this.callStatus = CallStatus.USER_HANGUP;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private static LocalDateTime resolveEndDt(ListCallCloseRequestDto request, LocalDateTime now) {
|
private static LocalDateTime resolveEndDt(ListCallCloseRequestDto request, LocalDateTime now) {
|
||||||
return isCompletedRequest(request) ? now : null;
|
return isCompletedRequest(request) ? now : null;
|
||||||
}
|
}
|
||||||
@@ -167,6 +181,14 @@ public class TListCallHistEntity {
|
|||||||
|| isPositive(request.getTalkTime());
|
|| isPositive(request.getTalkTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int durationSeconds(LocalDateTime startDt, LocalDateTime endDt) {
|
||||||
|
if (startDt == null || endDt == null || endDt.isBefore(startDt)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
long seconds = Duration.between(startDt, endDt).getSeconds();
|
||||||
|
return seconds > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) seconds;
|
||||||
|
}
|
||||||
|
|
||||||
private static boolean isPositive(Integer value) {
|
private static boolean isPositive(Integer value) {
|
||||||
return value != null && value > 0;
|
return value != null && value > 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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())
|
||||||
|
|||||||
@@ -102,6 +102,24 @@ public class ListCallHistService {
|
|||||||
return ListCallHistDto.from(entity);
|
return ListCallHistDto.from(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
public ListCallHistDto findByAgentSessionId(
|
||||||
|
String agentSessionId,
|
||||||
|
String userId,
|
||||||
|
String userCmpn,
|
||||||
|
Integer userRole
|
||||||
|
) {
|
||||||
|
validateAgentSessionId(agentSessionId);
|
||||||
|
TListCallHistEntity entity = listCallHistRepository.findByAgentSessionId(agentSessionId)
|
||||||
|
.orElseThrow(() -> BusinessException.notFound(
|
||||||
|
"CALL_HISTORY_NOT_FOUND",
|
||||||
|
"통화 이력을 찾을 수 없습니다."
|
||||||
|
).with("agentSessionId", agentSessionId));
|
||||||
|
|
||||||
|
validateUsableCallHistory(entity, userId, userCmpn, userRole, "CALL_HISTORY_NOT_FOUND");
|
||||||
|
return ListCallHistDto.from(entity);
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
public void validateListCallHistoryForEvent(
|
public void validateListCallHistoryForEvent(
|
||||||
Long listCallHistIdx,
|
Long listCallHistIdx,
|
||||||
@@ -135,6 +153,16 @@ public class ListCallHistService {
|
|||||||
validateUsableCallHistory(entity, userId, userCmpn, userRole, "CALL_HISTORY_FORBIDDEN");
|
validateUsableCallHistory(entity, userId, userCmpn, userRole, "CALL_HISTORY_FORBIDDEN");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public boolean hangupClient(
|
||||||
|
String agentSessionId
|
||||||
|
) {
|
||||||
|
validateAgentSessionId(agentSessionId);
|
||||||
|
return listCallHistRepository.findByAgentSessionId(agentSessionId)
|
||||||
|
.map(entity -> entity.markUserHangup(LocalDateTime.now()))
|
||||||
|
.orElse(false);
|
||||||
|
}
|
||||||
|
|
||||||
private void validateAgentSessionId(String agentSessionId) {
|
private void validateAgentSessionId(String agentSessionId) {
|
||||||
if (!hasText(agentSessionId) || agentSessionId.length() > 64) {
|
if (!hasText(agentSessionId) || agentSessionId.length() > 64) {
|
||||||
throw BusinessException.badRequest(
|
throw BusinessException.badRequest(
|
||||||
|
|||||||
@@ -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