develop #1

Merged
gitadmin merged 9 commits from develop into master 2026-07-16 09:14:11 +09:00
42 changed files with 572 additions and 75 deletions
Showing only changes of commit 5e96dded62 - Show all commits

View File

@@ -1,19 +1,30 @@
package com.kri.contact.server.common.external.notihub;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDateTime;
import lombok.Builder;
import lombok.Getter;
@Getter
@Builder
@Schema(description = "NotiHubBulkSendCreateRequestDto")
public class NotiHubBulkSendCreateRequestDto {
@Schema(description = "reqstCmpn")
private String reqstCmpn;
@Schema(description = "reqstUser")
private String reqstUser;
@Schema(description = "reqstSvc")
private String reqstSvc;
@Schema(description = "prjctCd")
private String prjctCd;
@Schema(description = "tmplatIdx")
private Long tmplatIdx;
@Schema(description = "resve")
private Boolean resve;
@Schema(description = "sendDt")
private LocalDateTime sendDt;
@Schema(description = "trgtCnt")
private Integer trgtCnt;
}

View File

@@ -1,5 +1,7 @@
package com.kri.contact.server.common.external.notihub;
import io.swagger.v3.oas.annotations.media.Schema;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter;
import lombok.NoArgsConstructor;
@@ -9,10 +11,15 @@ import lombok.Setter;
@Setter
@NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
@Schema(description = "NotiHubBulkSendResponseDto")
public class NotiHubBulkSendResponseDto {
@Schema(description = "bulkSendKey")
private String bulkSendKey;
@Schema(description = "requestCount")
private Integer requestCount;
@Schema(description = "acceptCount")
private Integer acceptCount;
@Schema(description = "failCount")
private Integer failCount;
}

View File

@@ -1,16 +1,24 @@
package com.kri.contact.server.common.external.notihub;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Map;
import lombok.Builder;
import lombok.Getter;
@Getter
@Builder
@Schema(description = "NotiHubDestInfoDto")
public class NotiHubDestInfoDto {
@Schema(description = "sid")
private String sid;
@Schema(description = "destEml")
private String destEml;
@Schema(description = "destTel")
private String destTel;
@Schema(description = "destNm")
private String destNm;
@Schema(description = "msgParam")
private Map<String, String> msgParam;
}

View File

@@ -1,16 +1,24 @@
package com.kri.contact.server.common.external.notihub;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
import lombok.Builder;
import lombok.Getter;
@Getter
@Builder
@Schema(description = "NotiHubSendRequestBulkDto")
public class NotiHubSendRequestBulkDto {
@Schema(description = "sendEml")
private String sendEml;
@Schema(description = "sendTel")
private String sendTel;
@Schema(description = "sendNm")
private String sendNm;
@Schema(description = "bulkSendKey")
private String bulkSendKey;
@Schema(description = "destInfoList")
private List<NotiHubDestInfoDto> destInfoList;
}

View File

@@ -1,20 +1,32 @@
package com.kri.contact.server.common.external.notihub;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDateTime;
import lombok.Builder;
import lombok.Getter;
@Getter
@Builder
@Schema(description = "NotiHubSendRequestSingleDto")
public class NotiHubSendRequestSingleDto {
@Schema(description = "sendEml")
private String sendEml;
@Schema(description = "sendTel")
private String sendTel;
@Schema(description = "sendNm")
private String sendNm;
@Schema(description = "destInfo")
private NotiHubDestInfoDto destInfo;
@Schema(description = "tmplatIdx")
private Long tmplatIdx;
@Schema(description = "reqstSvc")
private String reqstSvc;
@Schema(description = "prjctCd")
private String prjctCd;
@Schema(description = "resve")
private Boolean resve;
@Schema(description = "sendDt")
private LocalDateTime sendDt;
}

View File

@@ -1,5 +1,7 @@
package com.kri.contact.server.common.external.notihub;
import io.swagger.v3.oas.annotations.media.Schema;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter;
import lombok.NoArgsConstructor;
@@ -9,11 +11,17 @@ import lombok.Setter;
@Setter
@NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
@Schema(description = "NotiHubTemplateDto")
public class NotiHubTemplateDto {
@Schema(description = "tmplatIdx")
private Long tmplatIdx;
@Schema(description = "tmplatBody")
private String tmplatBody;
@Schema(description = "sendTel")
private String sendTel;
@Schema(description = "sendEml")
private String sendEml;
@Schema(description = "sendNm")
private String sendNm;
}

View File

@@ -5,7 +5,6 @@ import static com.kri.contact.server.common.util.ExcelResponseBuilder.buildExcel
import com.kri.common.feature.datetime.DateTimeUtil;
import com.kri.common.feature.web.BusinessException;
import com.kri.common.feature.web.RequestUserContext;
import com.kri.contact.server.common.enums.ResultCodeType;
import com.kri.contact.server.dto.list.ListEventHistDownloadRequestDto;
import com.kri.contact.server.dto.list.ListEventHistFromSurveyDto;
import com.kri.contact.server.dto.list.ListEventHistInsertRequestDto;

View File

@@ -1,5 +1,7 @@
package com.kri.contact.server.dto.excel;
import io.swagger.v3.oas.annotations.media.Schema;
import com.kri.common.feature.excel.ExcelColumn;
import lombok.Getter;
import lombok.Setter;
@@ -8,15 +10,19 @@ import lombok.experimental.SuperBuilder;
@SuperBuilder
@Getter
@Setter
@Schema(description = "ExcelErrorDto")
public class ExcelErrorDto {
@ExcelColumn(header = "행 번호", order = 0)
@Schema(description = "rowNumber")
private int rowNumber;
@ExcelColumn(header = "필드명", order = 1)
@Schema(description = "fieldName")
private String fieldName;
@ExcelColumn(header = "에러 메시지", order = 2)
@Schema(description = "errorMessage")
private String errorMessage;
public static ExcelErrorDto of(int rowNumber, String fieldName, String errorMessage) {

View File

@@ -8,6 +8,7 @@ import lombok.Setter;
@Getter
@Setter
@Builder
@Schema(description = "ExcelUploadResultDto")
public class ExcelUploadResultDto {
@Schema(description = "전체 읽은 행 수 (헤더 제외)")

View File

@@ -1,5 +1,7 @@
package com.kri.contact.server.dto.excel;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.SuperBuilder;
@@ -7,6 +9,7 @@ import lombok.experimental.SuperBuilder;
@SuperBuilder
@Getter
@Setter
@Schema(description = "ListUploadErrorDto")
public class ListUploadErrorDto extends ExcelErrorDto {
public static ListUploadErrorDto of(int rowNumber, String fieldName, String errorMessage) {
return ListUploadErrorDto.builder()

View File

@@ -13,6 +13,7 @@ import lombok.Setter;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "UserUploadDto")
public class UserUploadDto {
@ExcelColumn(header = "사용자 ID", order = 0, width = 11)

View File

@@ -1,5 +1,7 @@
package com.kri.contact.server.dto.excel;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.SuperBuilder;
@@ -7,6 +9,7 @@ import lombok.experimental.SuperBuilder;
@SuperBuilder
@Getter
@Setter
@Schema(description = "UserUploadErrorDto")
public class UserUploadErrorDto extends ExcelErrorDto {
public static UserUploadErrorDto of(int rowNumber, String fieldName, String errorMessage) {

View File

@@ -1,32 +1,54 @@
package com.kri.contact.server.dto.list;
import io.swagger.v3.oas.annotations.media.Schema;
import com.kri.contact.server.persistence.entity.TListCallHistEntity;
import java.time.Instant;
import java.time.LocalDateTime;
import lombok.Builder;
import lombok.Getter;
@Getter
@Builder
@Schema(description = "ListCallHistDto")
public class ListCallHistDto {
@Schema(description = "listCallHistIdx")
private Long listCallHistIdx;
@Schema(description = "prjctIdx")
private Long prjctIdx;
@Schema(description = "sid")
private Integer sid;
@Schema(description = "listHderId")
private Integer listHderId;
@Schema(description = "destNum")
private String destNum;
@Schema(description = "agentNum")
private String agentNum;
@Schema(description = "aniNum")
private String aniNum;
@Schema(description = "agentSessionId")
private String agentSessionId;
@Schema(description = "destSessionId")
private String destSessionId;
@Schema(description = "callTy")
private String callTy;
@Schema(description = "startDt")
private LocalDateTime startDt;
@Schema(description = "endDt")
private LocalDateTime endDt;
@Schema(description = "totalTime")
private Integer totalTime;
@Schema(description = "talkTime")
private Integer talkTime;
@Schema(description = "mediaServerId")
private Integer mediaServerId;
@Schema(description = "mediaServerName")
private String mediaServerName;
@Schema(description = "recordFileName")
private String recordFileName;
@Schema(description = "regUser")
private String regUser;
@Schema(description = "regDt")
private LocalDateTime regDt;
public static ListCallHistDto from(TListCallHistEntity entity) {
@@ -42,6 +64,7 @@ public class ListCallHistDto {
.destSessionId(entity.getDestSessionId())
.callTy(entity.getCallTy())
.startDt(entity.getStartDt())
.endDt(entity.getEndDt())
.totalTime(entity.getTotalTime())
.talkTime(entity.getTalkTime())
.mediaServerId(entity.getMediaServerId())

View File

@@ -1,5 +1,7 @@
package com.kri.contact.server.dto.list;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
@@ -12,52 +14,65 @@ import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
@Schema(description = "ListCallHistRequestDto")
public class ListCallHistRequestDto {
@NotNull
@Schema(description = "listHderId")
private Integer listHderId;
@NotBlank
@Size(max = 64)
@Schema(description = "destNum")
private String destNum;
@NotBlank
@Size(max = 64)
@Schema(description = "agentNum")
private String agentNum;
@NotBlank
@Size(max = 64)
@Schema(description = "aniNum")
private String aniNum;
@NotBlank
@Size(max = 64)
@Schema(description = "agentSessionId")
private String agentSessionId;
@NotBlank
@Size(max = 64)
@Schema(description = "destSessionId")
private String destSessionId;
@NotBlank
@Size(max = 64)
@Schema(description = "callTy")
private String callTy;
@NotNull
@Schema(description = "startDt")
private LocalDateTime startDt;
@NotNull
@Schema(description = "totalTime")
private Integer totalTime;
@NotNull
@Schema(description = "talkTime")
private Integer talkTime;
@NotNull
@Schema(description = "mediaServerId")
private Integer mediaServerId;
@NotBlank
@Size(max = 64)
@Schema(description = "mediaServerName")
private String mediaServerName;
@NotBlank
@Size(max = 256)
@Schema(description = "recordFileName")
private String recordFileName;
}

View File

@@ -31,6 +31,9 @@ public class ListEventHistInsertRequestDto {
@Schema(description = "결과 코드")
private Integer resultCd;
@Schema(description = "전화 이력 id")
private Long listCallHistIdx;
@Valid
@Schema(description = "메타 데이터")
private ListEventHistInternalMetaDto meta;

View File

@@ -10,6 +10,7 @@ import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
@Schema(description = "ListEventHistInternalMetaDto")
public class ListEventHistInternalMetaDto {
@Schema(description = "GPS 위도")

View File

@@ -11,6 +11,7 @@ import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
@Schema(description = "ListEventHistSurveyMetaDto")
public class ListEventHistSurveyMetaDto {
@NotNull
@Schema(description = "진입 유형")

View File

@@ -1,5 +1,7 @@
package com.kri.contact.server.dto.list;
import io.swagger.v3.oas.annotations.media.Schema;
import com.kri.contact.server.persistence.entity.TListEventHistEntity;
import java.time.LocalDateTime;
import lombok.Builder;
@@ -7,17 +9,28 @@ import lombok.Getter;
@Getter
@Builder
@Schema(description = "ListEventHistoryDto")
public class ListEventHistoryDto {
@Schema(description = "listEventHistIdx")
private Long listEventHistIdx;
@Schema(description = "eventTy")
private Short eventTy;
@Schema(description = "prjctIdx")
private Long prjctIdx;
@Schema(description = "sid")
private Integer sid;
@Schema(description = "resultCd")
private Integer resultCd;
@Schema(description = "metaData")
private String metaData;
@Schema(description = "listCallHistIdx")
private Long listCallHistIdx;
@Schema(description = "memo")
private String memo;
@Schema(description = "regUser")
private String regUser;
@Schema(description = "regDt")
private LocalDateTime regDt;
public static ListEventHistoryDto from(TListEventHistEntity entity) {

View File

@@ -18,6 +18,7 @@ import lombok.experimental.SuperBuilder;
@AllArgsConstructor
@Schema(description = "리스트 헤더 (필터 목록 포함)")
public class ListHeaderWithFilterContentDto extends ListHeaderDto {
@Schema(description = "filterContents")
private List<String> filterContents;
public static ListHeaderWithFilterContentDto fromEntity(

View File

@@ -1,5 +1,7 @@
package com.kri.contact.server.dto.list;
import io.swagger.v3.oas.annotations.media.Schema;
import com.kri.contact.server.persistence.entity.TListUpdateHistEntity;
import java.time.LocalDateTime;
import lombok.Builder;
@@ -7,15 +9,24 @@ import lombok.Getter;
@Getter
@Builder
@Schema(description = "ListUpdateHistoryDto")
public class ListUpdateHistoryDto {
@Schema(description = "listUpdateHistIdx")
private Long listUpdateHistIdx;
@Schema(description = "prjctIdx")
private Long prjctIdx;
@Schema(description = "sid")
private Integer sid;
@Schema(description = "listHderId")
private Integer listHderId;
@Schema(description = "beforeVal")
private String beforeVal;
@Schema(description = "afterVal")
private String afterVal;
@Schema(description = "regUser")
private String regUser;
@Schema(description = "regDt")
private LocalDateTime regDt;
public static ListUpdateHistoryDto from(TListUpdateHistEntity entity) {

View File

@@ -1,5 +1,7 @@
package com.kri.contact.server.dto.message;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.ArrayList;
import java.util.List;
import lombok.Builder;
@@ -7,13 +9,20 @@ import lombok.Getter;
@Getter
@Builder
@Schema(description = "MessageBulkSendResponseDto")
public class MessageBulkSendResponseDto {
@Schema(description = "bulkSendKey")
private String bulkSendKey;
@Schema(description = "targetCount")
private int targetCount;
@Schema(description = "requestCount")
private int requestCount;
@Schema(description = "acceptCount")
private int acceptCount;
@Schema(description = "failCount")
private int failCount;
@Builder.Default
@Schema(description = "failedChunks")
private List<MessageFailedChunkDto> failedChunks = new ArrayList<>();
}

View File

@@ -1,15 +1,23 @@
package com.kri.contact.server.dto.message;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Getter;
@Getter
@Builder
@Schema(description = "MessageFailedChunkDto")
public class MessageFailedChunkDto {
@Schema(description = "chunkIndex")
private int chunkIndex;
@Schema(description = "from")
private int from;
@Schema(description = "to")
private int to;
@Schema(description = "targetCount")
private int targetCount;
@Schema(description = "errorMessage")
private String errorMessage;
}

View File

@@ -18,18 +18,27 @@ import lombok.Setter;
public class MessageSendBulkRequestDto {
@NotNull
@Schema(description = "템플릿 고유 번호", requiredMode = Schema.RequiredMode.REQUIRED)
private Long tmplatIdx;
@NotNull
@Schema(description = "예약 발송 여부", requiredMode = Schema.RequiredMode.REQUIRED)
private Boolean resve;
@Schema(description = "예약 발송 일시")
private LocalDateTime sendDt;
@Valid
@Schema(description = "리스트 필터")
private ListFilterDto listFilter;
@NotEmpty
@Schema(description = "수신처로 사용할 리스트 헤더 ID 목록", requiredMode = Schema.RequiredMode.REQUIRED)
private List<Integer> destHeaderIds;
@Schema(description = "수신자 이름으로 사용할 리스트 헤더 ID")
private Integer destNameHeaderId;
@Schema(description = "수신처 중복 제거 여부", defaultValue = "false")
private Boolean dedupe = false;
}

View File

@@ -16,18 +16,24 @@ import lombok.Setter;
public class MessageSendSingleRequestDto {
@NotNull
@Schema(description = "tmplatIdx")
private Long tmplatIdx;
@NotNull
@Schema(description = "resve")
private Boolean resve;
@Schema(description = "sendDt")
private LocalDateTime sendDt;
@NotNull
@Schema(description = "sid")
private Integer sid;
@NotEmpty
@Schema(description = "destHeaderIds")
private List<Integer> destHeaderIds;
@Schema(description = "destNameHeaderId")
private Integer destNameHeaderId;
}

View File

@@ -11,14 +11,19 @@ import lombok.Getter;
@Schema(description = "날짜별 진행 현황")
public class ProgressDateResponseDto {
@Schema(description = "contactDate")
private String contactDate;
@Schema(description = "startTime")
private String startTime;
@Schema(description = "endTime")
private String endTime;
@Schema(description = "totalCount")
private long totalCount;
@Builder.Default
@Schema(description = "resultCodeCountMap")
private Map<Integer, Long> resultCodeCountMap = new LinkedHashMap<>();
}

View File

@@ -11,10 +11,13 @@ import lombok.Getter;
@Schema(description = "사용자별 진행 현황")
public class ProgressUserResponseDto {
@Schema(description = "userId")
private String userId;
@Schema(description = "totalCount")
private long totalCount;
@Builder.Default
@Schema(description = "resultCodeCountMap")
private Map<Integer, Long> resultCodeCountMap = new LinkedHashMap<>();
}

View File

@@ -29,6 +29,7 @@ public class ResultCodeDto {
@Schema(description = "결과 코드 라벨")
private String resultCdLbl;
@Schema(description = "isDefault")
private Boolean isDefault;
public static ResultCodeDto from(TResultCodeEntity entity) {

View File

@@ -1,5 +1,7 @@
package com.kri.contact.server.dto.reserve;
import io.swagger.v3.oas.annotations.media.Schema;
import com.kri.contact.server.persistence.entity.TListResveEntity;
import java.time.LocalDateTime;
import lombok.Builder;
@@ -7,16 +9,26 @@ import lombok.Getter;
@Getter
@Builder
@Schema(description = "ListReserveDto")
public class ListReserveDto {
@Schema(description = "listResveIdx")
private Long listResveIdx;
@Schema(description = "prjctIdx")
private Long prjctIdx;
@Schema(description = "sid")
private Integer sid;
@Schema(description = "memo")
private String memo;
@Schema(description = "cnfirm")
private Boolean cnfirm;
@Schema(description = "resveDt")
private LocalDateTime resveDt;
@Schema(description = "resveUser")
private String resveUser;
@Schema(description = "regUser")
private String regUser;
@Schema(description = "regDt")
private LocalDateTime regDt;
public static ListReserveDto from(TListResveEntity entity) {

View File

@@ -1,5 +1,7 @@
package com.kri.contact.server.dto.reserve;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import java.time.LocalDateTime;
@@ -10,17 +12,22 @@ import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
@Schema(description = "ListReserveRequestDto")
public class ListReserveRequestDto {
@NotNull
@Schema(description = "prjctIdx")
private Long prjctIdx;
@NotNull
@Schema(description = "sid")
private Integer sid;
@NotBlank
@Schema(description = "userId")
private String userId;
@NotNull
@Schema(description = "resveDt")
private LocalDateTime resveDt;
}

View File

@@ -1,5 +1,7 @@
package com.kri.contact.server.dto.systemlog;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
@@ -12,6 +14,7 @@ import org.springframework.web.multipart.MultipartFile;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "UploadContentDto")
public class UploadContentDto {
String fileName;
String fileType;

View File

@@ -1,5 +1,6 @@
package com.kri.contact.server.persistence.entity;
import com.kri.contact.server.dto.list.ListCallHistRequestDto;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
@@ -8,21 +9,26 @@ import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.time.Instant;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
@Builder
@Getter
@Setter
@Entity
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "t_list_call_hist")
public class TListCallHistEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "list_call_hist_idx", nullable = false, insertable = false)
@Column(name = "list_call_hist_idx", nullable = false, insertable = false, updatable = false)
private Long id;
@Column(name = "prjct_idx", columnDefinition = "int UNSIGNED not null")
@@ -53,12 +59,12 @@ public class TListCallHistEntity {
@Size(max = 64)
@NotNull
@Column(name = "agent_session_id", nullable = false, length = 64)
@Column(name = "agent_session_id", nullable = false, length = 64, updatable = false)
private String agentSessionId;
@Size(max = 64)
@NotNull
@Column(name = "dest_session_id", nullable = false, length = 64)
@Column(name = "dest_session_id", nullable = false, length = 64, updatable = false)
private String destSessionId;
@Size(max = 64)
@@ -70,6 +76,9 @@ public class TListCallHistEntity {
@Column(name = "start_dt", nullable = false)
private LocalDateTime startDt;
@Column(name = "end_dt")
private LocalDateTime endDt;
@NotNull
@Column(name = "total_time", nullable = false)
private Integer totalTime;
@@ -88,19 +97,55 @@ public class TListCallHistEntity {
private String mediaServerName;
@Size(max = 256)
@NotNull
@Column(name = "record_file_name", nullable = false, length = 256)
@Column(name = "record_file_name", length = 256)
private String recordFileName;
@Size(max = 32)
@NotNull
@Column(name = "reg_user", nullable = false, length = 32)
@Column(name = "reg_user", nullable = false, length = 32, updatable = false)
private String regUser;
@NotNull
@ColumnDefault("CURRENT_TIMESTAMP")
@Column(name = "reg_dt", nullable = false)
@Column(name = "reg_dt", nullable = false, updatable = false)
private LocalDateTime regDt;
public static TListCallHistEntity from(
Long prjctIdx,
Integer sid,
ListCallHistRequestDto request,
String regUser,
LocalDateTime regDt
) {
return TListCallHistEntity.builder()
.prjctIdx(prjctIdx)
.sid(sid)
.listHderId(request.getListHderId())
.destNum(request.getDestNum())
.agentNum(request.getAgentNum())
.aniNum(request.getAniNum())
.agentSessionId(request.getAgentSessionId())
.destSessionId(request.getDestSessionId())
.callTy(request.getCallTy())
.startDt(request.getStartDt())
.endDt(regDt)
.totalTime(request.getTotalTime())
.talkTime(request.getTalkTime())
.mediaServerId(request.getMediaServerId())
.mediaServerName(request.getMediaServerName())
.recordFileName(request.getRecordFileName())
.regUser(regUser)
.regDt(regDt)
.build();
}
}
public void updateCallResult(ListCallHistRequestDto request, LocalDateTime endDt) {
this.endDt = endDt;
this.totalTime = request.getTotalTime();
this.talkTime = request.getTalkTime();
this.mediaServerId = request.getMediaServerId();
this.mediaServerName = request.getMediaServerName();
this.recordFileName = request.getRecordFileName();
}
}

View File

@@ -101,6 +101,7 @@ public class TListEventHistEntity {
.prjctIdx(request.getPrjctIdx())
.sid(request.getSid())
.resultCd(request.getResultCd())
.listCallHistIdx(request.getListCallHistIdx())
.metaData(metaData)
.memo(request.getMemo())
.regUser(regUser)

View File

@@ -13,23 +13,30 @@ import org.springframework.stereotype.Component;
@RequiredArgsConstructor
public class ListResetJdbcSupport {
private static final String TEMP_SID_TABLE = "tmp_list_reset_sid";
private final EntityManager entityManager;
public DeleteCounts deleteHistories(Long prjctIdx, Collection<Integer> sids, int chunkSize) {
DeleteCounts total = DeleteCounts.empty();
for (List<Integer> sub : chunkSids(sids, chunkSize)) {
int eventHistCount = deleteBySids("t_list_event_hist", prjctIdx, sub);
int eventLatestCount = deleteBySids("t_list_event_latest", prjctIdx, sub);
int updateHistCount = deleteBySids("t_list_update_hist", prjctIdx, sub);
int callHistCount = deleteBySids("t_list_call_hist", prjctIdx, sub);
total = total.plus(DeleteCounts.histories(
if (sids == null || sids.isEmpty()) {
return DeleteCounts.empty();
}
prepareTempSids(sids, chunkSize);
try {
int eventHistCount = deleteByTempSids("t_list_event_hist", prjctIdx);
int eventLatestCount = deleteByTempSids("t_list_event_latest", prjctIdx);
int updateHistCount = deleteByTempSids("t_list_update_hist", prjctIdx);
int callHistCount = deleteByTempSids("t_list_call_hist", prjctIdx);
return DeleteCounts.histories(
eventHistCount,
eventLatestCount,
updateHistCount,
callHistCount
));
);
} finally {
dropTempSids();
}
return total;
}
public DeleteCounts deleteListData(
@@ -39,16 +46,20 @@ public class ListResetJdbcSupport {
boolean includeResve,
int chunkSize
) {
DeleteCounts total = DeleteCounts.empty();
for (List<Integer> sub : chunkSids(sids, chunkSize)) {
int fileCount = includeFile ? deleteBySids("t_list_item_file", prjctIdx, sub) : 0;
int itemCount = deleteBySids("t_list_item", prjctIdx, sub);
int assignUserCount = deleteBySids("t_list_assign_user", prjctIdx, sub);
int assignCmpnCount = deleteBySids("t_list_assign_cmpn", prjctIdx, sub);
int resveCount = includeResve ? deleteBySids("t_list_resve", prjctIdx, sub) : 0;
int listCount = deleteBySids("t_list", prjctIdx, sub);
if (sids == null || sids.isEmpty()) {
return DeleteCounts.empty();
}
total = total.plus(new DeleteCounts(
prepareTempSids(sids, chunkSize);
try {
int fileCount = includeFile ? deleteByTempSids("t_list_item_file", prjctIdx) : 0;
int itemCount = deleteByTempSids("t_list_item", prjctIdx);
int assignUserCount = deleteByTempSids("t_list_assign_user", prjctIdx);
int assignCmpnCount = deleteByTempSids("t_list_assign_cmpn", prjctIdx);
int resveCount = includeResve ? deleteByTempSids("t_list_resve", prjctIdx) : 0;
int listCount = deleteByTempSids("t_list", prjctIdx);
return new DeleteCounts(
fileCount,
0,
0,
@@ -59,26 +70,52 @@ public class ListResetJdbcSupport {
assignUserCount,
assignCmpnCount,
resveCount
));
);
} finally {
dropTempSids();
}
return total;
}
private int deleteBySids(String tableName, Long prjctIdx, List<Integer> sids) {
private void prepareTempSids(Collection<Integer> sids, int chunkSize) {
dropTempSids();
entityManager.createNativeQuery(
"create temporary table " + TEMP_SID_TABLE + " (sid int not null primary key) engine=memory"
).executeUpdate();
List<Integer> sidList = new ArrayList<>(sids);
for (List<Integer> sub : chunkSids(sidList, chunkSize)) {
insertTempSids(sub);
}
}
private void insertTempSids(List<Integer> sids) {
if (sids.isEmpty()) {
return 0;
return;
}
Query query = entityManager.createNativeQuery(
"delete from " + tableName + " where prjct_idx = :prjctIdx and sid in (" + createInSql(sids) + ")"
"insert into " + TEMP_SID_TABLE + " (sid) values " + createValuesSql(sids)
);
query.setParameter("prjctIdx", prjctIdx);
for (int i = 0; i < sids.size(); i++) {
query.setParameter("sid" + i, sids.get(i));
}
query.executeUpdate();
}
private int deleteByTempSids(String tableName, Long prjctIdx) {
Query query = entityManager.createNativeQuery(
"delete target from " + tableName + " target "
+ "join " + TEMP_SID_TABLE + " reset_sid on reset_sid.sid = target.sid "
+ "where target.prjct_idx = :prjctIdx"
);
query.setParameter("prjctIdx", prjctIdx);
return query.executeUpdate();
}
private void dropTempSids() {
entityManager.createNativeQuery("drop temporary table if exists " + TEMP_SID_TABLE).executeUpdate();
}
private List<List<Integer>> chunkSids(Collection<Integer> sids, int chunkSize) {
if (sids == null || sids.isEmpty()) {
return List.of();
@@ -95,10 +132,10 @@ public class ListResetJdbcSupport {
return chunks;
}
private String createInSql(List<Integer> sids) {
private String createValuesSql(List<Integer> sids) {
StringJoiner joiner = new StringJoiner(",");
for (int i = 0; i < sids.size(); i++) {
joiner.add(":sid" + i);
joiner.add("(:sid" + i + ")");
}
return joiner.toString();
}

View File

@@ -1,7 +1,10 @@
package com.kri.contact.server.persistence.repository;
import com.kri.contact.server.persistence.entity.TListCallHistEntity;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
public interface ListCallHistRepository extends JpaRepository<TListCallHistEntity, Long> {
Optional<TListCallHistEntity> findFirstByAgentSessionId(String agentSessionId);
}

View File

@@ -39,24 +39,13 @@ public class ListCallHistService {
.with("listHderId", request.getListHderId());
}
TListCallHistEntity entity = new TListCallHistEntity();
entity.setPrjctIdx(prjctIdx);
entity.setSid(sid);
entity.setListHderId(request.getListHderId());
entity.setDestNum(request.getDestNum());
entity.setAgentNum(request.getAgentNum());
entity.setAniNum(request.getAniNum());
entity.setAgentSessionId(request.getAgentSessionId());
entity.setDestSessionId(request.getDestSessionId());
entity.setCallTy(request.getCallTy());
entity.setStartDt(request.getStartDt());
entity.setTotalTime(request.getTotalTime());
entity.setTalkTime(request.getTalkTime());
entity.setMediaServerId(request.getMediaServerId());
entity.setMediaServerName(request.getMediaServerName());
entity.setRecordFileName(request.getRecordFileName());
entity.setRegUser(regUser);
entity.setRegDt(regDt);
TListCallHistEntity entity = listCallHistRepository.findFirstByAgentSessionId(request.getAgentSessionId())
.map(existing -> {
existing.updateCallResult(request, regDt);
return existing;
})
.orElseGet(() -> TListCallHistEntity.from(prjctIdx, sid, request, regUser, regDt));
return ListCallHistDto.from(listCallHistRepository.save(entity));
}
}

View File

@@ -11,7 +11,9 @@ import com.kri.contact.server.dto.common.DateRangeDto;
import com.kri.contact.server.dto.list.ListFilterDto;
import com.kri.contact.server.dto.list.ListHeaderDto;
import com.kri.contact.server.persistence.entity.TListItemFileEntity;
import com.kri.contact.server.persistence.entity.TResultCodeEntity;
import com.kri.contact.server.persistence.repository.ListItemFileRepository;
import com.kri.contact.server.persistence.repository.ResultCodeRepository;
import com.kri.contact.server.service.file.ListItemFileService;
import java.io.ByteArrayOutputStream;
import java.time.LocalDateTime;
@@ -40,6 +42,7 @@ public class ListDownloadService {
private static final String HEADER_MEMO = "메모";
private static final String HEADER_BEFORE = "변경전";
private static final String HEADER_AFTER = "변경후";
private static final String ZERO_WIDTH_SPACE = String.valueOf(Character.toChars(0x200B));
private static final List<String> EVENT_HISTORY_HEADERS = List.of(
HEADER_TYPE,
@@ -59,6 +62,7 @@ public class ListDownloadService {
private final ListSearchService listSearchService;
private final ListItemFileRepository listItemFileRepository;
private final ListItemFileService listItemFileService;
private final ResultCodeRepository resultCodeRepository;
public byte[] downloadList(Long prjctIdx, ListFilterDto listFilter) {
List<ListHeaderDto> headers = getSortedHeaders(prjctIdx);
@@ -102,6 +106,7 @@ public class ListDownloadService {
validateDateRange(dateRange);
List<ListHeaderDto> headers = getSortedHeaders(prjctIdx);
Map<EventResultKey, String> resultLabelMap = createResultLabelMap(prjctIdx);
int maxHistoryCount = findMaxEventHistoryCount(prjctIdx, listFilter, resultCodeTypes, searchBase, dateRange);
List<String> excelHeaders = new ArrayList<>(toBaseHeaderNames(headers));
appendRepeatedHeaders(excelHeaders, EVENT_HISTORY_HEADERS, maxHistoryCount);
@@ -131,6 +136,7 @@ public class ListDownloadService {
headers,
row,
historyMap.getOrDefault(row.sid(), List.of()),
resultLabelMap,
maxHistoryCount
));
lastSid = row.sid();
@@ -167,12 +173,16 @@ public class ListDownloadService {
listSearchService.findUpdateHistoryGroupsForDownload(prjctIdx, sids);
for (Integer sid : sids) {
lastSid = sid;
List<ListSearchService.UpdateHistoryGroupRow> histories = historyMap.getOrDefault(sid, List.of());
if (histories.isEmpty()) {
continue;
}
writer.append(createUpdateHistoryRow(
sid,
historyMap.getOrDefault(sid, List.of()),
histories,
maxHistoryGroupCount
));
lastSid = sid;
}
}
@@ -319,15 +329,16 @@ public class ListDownloadService {
List<ListHeaderDto> headers,
ListSearchService.DownloadListRow row,
List<ListSearchService.EventHistoryRow> histories,
Map<EventResultKey, String> resultLabelMap,
int maxHistoryCount
) {
Map<String, Object> excelRow = createBaseRow(headers, row);
for (int index = 0; index < maxHistoryCount; index++) {
ListSearchService.EventHistoryRow history = index < histories.size() ? histories.get(index) : null;
excelRow.put(createRepeatedHeaderName(HEADER_TYPE, index), history == null ? "" : defaultString(history.eventTy()));
excelRow.put(createRepeatedHeaderName(HEADER_TYPE, index), history == null ? "" : resolveEventTypeLabel(history.eventTy()));
excelRow.put(createRepeatedHeaderName(HEADER_DATE, index), history == null ? "" : formatDateTime(history.regDt()));
excelRow.put(createRepeatedHeaderName(HEADER_USER, index), history == null ? "" : defaultString(history.regUser()));
excelRow.put(createRepeatedHeaderName(HEADER_RESULT, index), history == null ? "" : defaultString(history.resultCd()));
excelRow.put(createRepeatedHeaderName(HEADER_RESULT, index), history == null ? "" : resolveResultLabel(history, resultLabelMap));
excelRow.put(createRepeatedHeaderName(HEADER_MEMO, index), history == null ? "" : defaultString(history.memo()));
}
return excelRow;
@@ -381,7 +392,7 @@ public class ListDownloadService {
}
private String createRepeatedHeaderName(String headerName, int index) {
return index == 0 ? headerName : headerName + "\u200B".repeat(index);
return index == 0 ? headerName : headerName + ZERO_WIDTH_SPACE.repeat(index);
}
private void validateDateRange(DateRangeDto dateRange) {
@@ -413,6 +424,39 @@ public class ListDownloadService {
return defaultString(isUse);
}
private Map<EventResultKey, String> createResultLabelMap(Long prjctIdx) {
return resultCodeRepository.findByIdPrjctIdx(prjctIdx)
.stream()
.filter(entity -> entity.getResultCdTy() != null && entity.getResultCd() != null)
.collect(Collectors.toMap(
entity -> new EventResultKey(entity.getResultCdTy().getCode(), entity.getResultCd().intValue()),
TResultCodeEntity::getResultCdLbl,
(left, right) -> left,
LinkedHashMap::new
));
}
private String resolveEventTypeLabel(Short eventTy) {
if (Objects.equals(eventTy, ResultCodeType.CONTACT.getCode())) {
return "컨택";
}
if (Objects.equals(eventTy, ResultCodeType.INTERVIEW.getCode())) {
return "면접";
}
if (Objects.equals(eventTy, ResultCodeType.SURVEY.getCode())) {
return "설문";
}
return defaultString(eventTy);
}
private String resolveResultLabel(
ListSearchService.EventHistoryRow history,
Map<EventResultKey, String> resultLabelMap
) {
String label = resultLabelMap.get(new EventResultKey(history.eventTy(), history.resultCd()));
return label == null ? defaultString(history.resultCd()) : label;
}
private String defaultString(Object value) {
return value == null ? "" : String.valueOf(value);
}
@@ -420,4 +464,9 @@ public class ListDownloadService {
private String sanitizeZipEntryName(String fileName) {
return fileName.replace("\\", "_").replace("/", "_");
}
private record EventResultKey(
Short eventTy,
Integer resultCd
) {}
}

View File

@@ -5,8 +5,8 @@ import com.kri.contact.server.common.consts.ContactConstant;
import com.kri.contact.server.common.enums.ListResetMode;
import com.kri.contact.server.dto.list.ListFilterDto;
import com.kri.contact.server.persistence.entity.TListResetLogEntity;
import com.kri.contact.server.persistence.jdbc.ListResetJdbcSupport.DeleteCounts;
import com.kri.contact.server.persistence.jdbc.ListResetJdbcSupport;
import com.kri.contact.server.persistence.jdbc.ListResetJdbcSupport.DeleteCounts;
import com.kri.contact.server.persistence.repository.ListResetLogRepository;
import jakarta.persistence.EntityManager;
import java.time.LocalDateTime;
@@ -49,7 +49,7 @@ public class ListResetService {
return 0;
}
if (mode == null) {
throw BusinessException.badRequest("EMPTY_MODE","mode는 필수 입니다.");
throw BusinessException.badRequest("EMPTY_MODE", "mode는 필수 입니다.");
}
String listResetLogId = createResetLog(prjctIdx, mode, 0, regUser, regDt);

View File

@@ -5,7 +5,9 @@ import com.kri.common.feature.web.page.PageRequestDto;
import com.kri.common.feature.web.page.PageResponseDto;
import com.kri.contact.server.common.consts.ContactConstant;
import com.kri.contact.server.common.enums.ListEventHistoryBase;
import com.kri.contact.server.common.enums.ListHeaderType;
import com.kri.contact.server.common.enums.ListHeaderTypeAssign;
import com.kri.contact.server.common.enums.ListIsUse;
import com.kri.contact.server.common.enums.ListSearchResponseType;
import com.kri.contact.server.common.enums.ResultCodeType;
import com.kri.contact.server.dto.common.DateRangeDto;
@@ -292,9 +294,10 @@ public class ListSearchService {
List<String> beforeValues = new ArrayList<>(groupHistories.size());
List<String> afterValues = new ArrayList<>(groupHistories.size());
for (TListUpdateHistEntity history : groupHistories) {
ListHeaderDto header = headerMap.get(history.getListHderId());
String headerName = resolveHeaderName(headerMap, history.getListHderId());
beforeValues.add(headerName + ": " + defaultString(history.getBeforeVal()));
afterValues.add(headerName + ": " + defaultString(history.getAfterVal()));
beforeValues.add(headerName + ": " + resolveUpdateHistoryValue(header, history.getBeforeVal()));
afterValues.add(headerName + ": " + resolveUpdateHistoryValue(header, history.getAfterVal()));
}
UpdateHistoryGroupKey key = entry.getKey();
@@ -588,6 +591,27 @@ public class ListSearchService {
return header == null ? String.valueOf(headerId) : header.getListHderNm();
}
private String resolveUpdateHistoryValue(ListHeaderDto header, String value) {
if (header != null && Objects.equals(header.getListHderTy(), ListHeaderType.IS_USE)) {
return toUseValue(value);
}
return defaultString(value);
}
private String toUseValue(String value) {
String trimmedValue = defaultString(value).trim();
if (Objects.equals(trimmedValue, String.valueOf(ListIsUse.USABLE.getCode()))) {
return "O";
}
if (Objects.equals(trimmedValue, String.valueOf(ListIsUse.UNUSABLE.getCode()))) {
return "X";
}
if (Objects.equals(trimmedValue, String.valueOf(ListIsUse.TEST.getCode()))) {
return "TEST";
}
return defaultString(value);
}
private String defaultString(String value) {
return value == null ? "" : value;
}

View File

@@ -18,6 +18,7 @@ import com.kri.contact.server.dto.list.ListHeaderDto;
import com.kri.contact.server.dto.list.ListUpdateRequestDto;
import com.kri.contact.server.persistence.entity.TListEventHistEntity;
import com.kri.contact.server.persistence.entity.TListHeaderEntity;
import com.kri.contact.server.persistence.entity.TListItemFileEntity;
import com.kri.contact.server.persistence.jdbc.ListUpdateJdbcSupport;
import com.kri.contact.server.persistence.jdbc.ListUpdateJdbcSupport.ListItemDeleteRow;
import com.kri.contact.server.persistence.jdbc.ListUpdateJdbcSupport.ListItemInsertRow;
@@ -27,7 +28,10 @@ import com.kri.contact.server.persistence.jdbc.ListUpdateJdbcSupport.ListUpdateR
import com.kri.contact.server.persistence.jdbc.ListUpdateJdbcSupport.UpdateHistRow;
import com.kri.contact.server.persistence.repository.ListEventHistRepository;
import com.kri.contact.server.persistence.repository.ListHeaderRepository;
import com.kri.contact.server.persistence.repository.ListItemFileRepository;
import com.kri.contact.server.persistence.repository.ListRepository;
import com.kri.contact.server.service.file.ListItemFileService;
import jakarta.persistence.EntityManager;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collection;
@@ -45,14 +49,19 @@ import org.springframework.transaction.annotation.Transactional;
@RequiredArgsConstructor
public class ListUpdateService {
private static final String FILE_DELETE = "FILE_DELETE";
private final ListHeaderRepository listHeaderRepository;
private final ListSearchService listSearchService;
private final ListContentItemService listContentItemService;
private final ListUpdateJdbcSupport listUpdateJdbcSupport;
private final ListRepository listRepository;
private final ListEventHistRepository listEventHistRepository;
private final ListItemFileRepository listItemFileRepository;
private final ListItemFileService listItemFileService;
private final ResultCodeService resultCodeService;
private final ObjectMapper objectMapper;
private final EntityManager entityManager;
@Transactional
public int updateList(
@@ -240,6 +249,7 @@ public class ListUpdateService {
Map<ListItemKey, ListItemUpdateRow> itemUpdates = new LinkedHashMap<>();
Map<ListItemKey, ListItemInsertRow> itemInserts = new LinkedHashMap<>();
Map<ListItemKey, ListItemDeleteRow> itemDeletes = new LinkedHashMap<>();
Set<ListItemKey> fileDeleteKeys = new LinkedHashSet<>();
for (ListSearchService.ListUpdateTargetRow targetRow : targetRows) {
Short currentIsUse = targetRow.isUse();
@@ -250,7 +260,8 @@ public class ListUpdateService {
Integer headerId = entry.getKey();
Integer sid = targetRow.sid();
TListHeaderEntity header = headerMap.get(headerId);
String newValue = normalizeUpdateValue(header, entry.getValue());
boolean deleteFile = isFileDeleteCommand(header, entry.getValue());
String newValue = deleteFile ? "" : normalizeUpdateValue(header, entry.getValue());
if (Objects.equals(header.getListHderTy(), ListHeaderType.IS_USE.getCode())) {
String beforeVal = String.valueOf(currentIsUse);
@@ -293,6 +304,9 @@ public class ListUpdateService {
}
ListItemKey itemKey = new ListItemKey(sid, headerId);
if (deleteFile) {
fileDeleteKeys.add(itemKey);
}
if (newValue.isEmpty()) {
if (currentValue != null) {
itemDeletes.put(itemKey, new ListItemDeleteRow(prjctIdx, sid, headerId));
@@ -330,7 +344,7 @@ public class ListUpdateService {
}
}
if (updateHistRows.isEmpty()) {
if (updateHistRows.isEmpty() && fileDeleteKeys.isEmpty()) {
return 0;
}
@@ -338,11 +352,65 @@ public class ListUpdateService {
listUpdateJdbcSupport.batchUpdateList(new ArrayList<>(listUpdates.values()), ContactConstant.INSERT_CHUNK_SIZE);
listUpdateJdbcSupport.batchUpdateListItem(new ArrayList<>(itemUpdates.values()), ContactConstant.INSERT_CHUNK_SIZE);
listUpdateJdbcSupport.batchInsertListItem(new ArrayList<>(itemInserts.values()), ContactConstant.INSERT_CHUNK_SIZE);
listUpdateJdbcSupport.batchDeleteListItem(new ArrayList<>(itemDeletes.values()), ContactConstant.INSERT_CHUNK_SIZE);
deleteItemsWithoutBackup(
prjctIdx,
new ArrayList<>(itemDeletes.values()),
fileDeleteKeys
);
return updateHistRows.size();
}
private void deleteItemsWithoutBackup(
Long prjctIdx,
List<ListItemDeleteRow> itemDeletes,
Set<ListItemKey> fileDeleteKeys
) {
if (itemDeletes.isEmpty() && fileDeleteKeys.isEmpty()) {
return;
}
setSkipDeleteBackup();
try {
listUpdateJdbcSupport.batchDeleteListItem(itemDeletes, ContactConstant.INSERT_CHUNK_SIZE);
deleteListItemFiles(prjctIdx, fileDeleteKeys);
} finally {
clearSkipDeleteBackup();
}
}
private void deleteListItemFiles(Long prjctIdx, Set<ListItemKey> fileDeleteKeys) {
if (fileDeleteKeys.isEmpty()) {
return;
}
Set<Integer> sids = fileDeleteKeys.stream()
.map(ListItemKey::sid)
.collect(LinkedHashSet::new, LinkedHashSet::add, LinkedHashSet::addAll);
Set<Integer> headerIds = fileDeleteKeys.stream()
.map(ListItemKey::listHderId)
.collect(LinkedHashSet::new, LinkedHashSet::add, LinkedHashSet::addAll);
List<TListItemFileEntity> fileEntities = listItemFileRepository
.findByIdPrjctIdxAndIdSidInAndIdListHderIdInOrderByIdSidAscIdListHderIdAsc(
prjctIdx,
sids,
headerIds
)
.stream()
.filter(entity -> fileDeleteKeys.contains(new ListItemKey(entity.getSid(), entity.getListHderId())))
.toList();
if (fileEntities.isEmpty()) {
return;
}
listItemFileRepository.deleteAllInBatch(fileEntities);
for (TListItemFileEntity fileEntity : fileEntities) {
listItemFileService.deleteItemFile(fileEntity.getFilePath(), fileEntity.getFileNm());
}
}
private Set<Integer> resolveTargetSids(Long prjctIdx, ListFilterDto listFilter) {
return new LinkedHashSet<>(listSearchService.findTargetSids(prjctIdx, listFilter));
}
@@ -389,6 +457,19 @@ public class ListUpdateService {
return defaultString(normalizeBlank(value));
}
private boolean isFileDeleteCommand(TListHeaderEntity header, String value) {
return Objects.equals(header.getListHderTy(), ListHeaderType.FILE.getCode())
&& Objects.equals(normalizeBlank(value), FILE_DELETE);
}
private void setSkipDeleteBackup() {
entityManager.createNativeQuery("SET @skip_delete_backup = 1").executeUpdate();
}
private void clearSkipDeleteBackup() {
entityManager.createNativeQuery("SET @skip_delete_backup = NULL").executeUpdate();
}
private short parseIsUseCode(String value) {
String normalized = defaultString(normalizeBlank(value)).toUpperCase();
return switch (normalized) {

View File

@@ -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;

View File

@@ -21,6 +21,7 @@ import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import lombok.RequiredArgsConstructor;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
@@ -37,6 +38,8 @@ public class UserService {
private final RoleService roleService;
private final UserRepository userRepository;
private static final int OUTSOURCE_USER_ROLE_END = ContactConstant.OUTSOURCE_USER_ROLE + 1000;
@Transactional
public void createUser(UserInfoDto userInfo, String regUser, LocalDateTime regDt) {
List<RoleInfoDto> roleList = roleService.getRoleList();
@@ -220,7 +223,9 @@ public class UserService {
.with("userId", dto.getUserId())
);
if(entity.getUserRole() != dto.getUserRole()) {
validateUserRoleChange(entity.getUserRole(), dto.getUserRole());
if(!Objects.equals(entity.getUserRole(), dto.getUserRole())) {
assignService.deleteListAssignWithUser(dto.getUserId());
}
@@ -239,6 +244,29 @@ public class UserService {
}
/*******************************private*******************************/
private void validateUserRoleChange(Integer currentRole, Integer newRole) {
if (Objects.equals(currentRole, newRole)) {
return;
}
if ((isOutsourceRole(currentRole) && isFieldworkRole(newRole))
|| (isFieldworkRole(currentRole) && isOutsourceRole(newRole))) {
throw BusinessException.badRequest(
"USER_ROLE_CHANGE_NOT_ALLOWED",
"외주사와 콜센터/컨택원/면접원 간 권한 변경은 할 수 없습니다."
);
}
}
private boolean isOutsourceRole(Integer role) {
return role != null
&& role >= ContactConstant.OUTSOURCE_USER_ROLE
&& role < OUTSOURCE_USER_ROLE_END;
}
private boolean isFieldworkRole(Integer role) {
return role != null && role >= ContactConstant.FIELDWORK_USER_ROLE;
}
private DataVerificationDto verifyUserId(String userId, List<String> intranetUserList) {
if (userId == null || userId.isBlank()) {
return new DataVerificationDto(false, "사용자 ID", "사용자 ID가 비었습니다.");

View File

@@ -55,6 +55,23 @@ public class ListItemFileService extends AbstractFileService {
}
}
public void deleteItemFile(String filePath, String fileName) {
Path baseDir = getBaseDir();
Path dir = baseDir.resolve(filePath == null || filePath.isBlank() ? "" : filePath)
.toAbsolutePath()
.normalize();
if (!dir.startsWith(baseDir)) {
throw BusinessException.badRequest("WRONG_FILE_PATH", "잘못된 파일 경로입니다.");
}
try {
deleteFile(dir, fileName);
} catch (IOException e) {
throw BusinessException.internalError("FAIL_DELETE_LIST_ITEM_FILE", e.getMessage());
}
}
private Path resolveItemFilePath(Path baseDir, String filePath, String fileName) {
String relativePath = filePath == null || filePath.isBlank() ? "" : filePath;
return baseDir.resolve(relativePath).resolve(fileName).toAbsolutePath().normalize();