261026_01_ENH: 공연 상세정보에 관리번호(NCAS), 변경 메모 추가 #11

Merged
gitadmin merged 1 commits from develop into master 2026-10-26 16:22:35 +09:00
3 changed files with 133 additions and 48 deletions
Showing only changes of commit 47d741de16 - Show all commits

View File

@@ -15,51 +15,60 @@ import lombok.experimental.SuperBuilder;
@AllArgsConstructor
public class PerformanceDownloadDto extends PerformanceUploadDto {
@ExcelColumn(header = "지자체 평가자", order = 31, width = 16)
@ExcelColumn(header = "지자체 평가자", order = 32, width = 16)
@Schema(description = "지자체 평가자")
private String localReviewUser;
@ExcelColumn(header = "지자체 평가 상태", order = 32, width = 16)
@ExcelColumn(header = "지자체 평가 상태", order = 33, width = 16)
@Schema(description = "지자체 평가 상태")
private String localReviewStatus;
@ExcelColumn(header = "지자체 평가 일시", order = 33, width = 16)
@ExcelColumn(header = "지자체 평가 일시", order = 34, width = 16)
@Schema(description = "지자체 평가 일시")
private String localReviewDt;
@ExcelColumn(header = "모니터링1 평가자", order = 34, width = 16)
@ExcelColumn(header = "모니터링1 평가자", order = 35, width = 16)
@Schema(description = "모니터링1 평가자")
private String monitoringReviewUser1;
@ExcelColumn(header = "모니터링1 평가 상태", order = 35, width = 16)
@ExcelColumn(header = "모니터링1 평가 상태", order = 36, width = 16)
@Schema(description = "모니터링1 평가 상태")
private String monitoringReviewStatus1;
@ExcelColumn(header = "모니터링1 평가 일시", order = 36, width = 16)
@ExcelColumn(header = "모니터링1 평가 일시", order = 37, width = 16)
@Schema(description = "모니터링1 평가 일시")
private String monitoringReviewDt1;
@ExcelColumn(header = "모니터링2 평가자", order = 37, width = 16)
@ExcelColumn(header = "모니터링2 평가자", order = 38, width = 16)
@Schema(description = "모니터링2 평가자")
private String monitoringReviewUser2;
@ExcelColumn(header = "모니터링2 평가 상태", order = 38, width = 16)
@ExcelColumn(header = "모니터링2 평가 상태", order = 39, width = 16)
@Schema(description = "모니터링2 평가 상태")
private String monitoringReviewStatus2;
@ExcelColumn(header = "모니터링2 평가 일시", order = 32, width = 16)
@ExcelColumn(header = "모니터링2 평가 일시", order = 40, width = 16)
@Schema(description = "모니터링2 평가 일시")
private String monitoringReviewDt2;
@ExcelColumn(header = "서면 평가 위원", order = 33, width = 16)
@ExcelColumn(header = "서면 평가 위원", order = 41, width = 16)
@Schema(description = "서면 평가 위원")
private String writtenReviewUser;
@ExcelColumn(header = "서면 평가 상태", order = 34, width = 16)
@ExcelColumn(header = "서면 평가 상태", order = 42, width = 16)
@Schema(description = "서면 평가 상태")
private String writtenReviewStatus;
@ExcelColumn(header = "서면 평가 일시", order = 35, width = 16)
@ExcelColumn(header = "서면 평가 일시", order = 43, width = 16)
@Schema(description = "서면 평가 일시")
private String writtenReviewDt;
@ExcelColumn(header = "변경 사항", order = 44, width = 20)
private String updateNoticeTarget;
@ExcelColumn(header = "변경 내용", order = 45, width = 40)
private String updateNoticeMemo;
@ExcelColumn(header = "변경 일시", order = 46, width = 26)
private String updateNoticeDt;
}

View File

@@ -23,119 +23,123 @@ public class PerformanceUploadDto {
@Schema(description = "연번")
private String performanceId;
@ExcelColumn(header = "사업유형", order = 2, width = 10)
@ExcelColumn(header = "관리번호", order = 2, width = 18)
@Schema(description = "숫자로 구성된 관리번호")
private String ncas;
@ExcelColumn(header = "사업유형", order = 3, width = 10)
@Schema(description = "사업유형")
private String businessType;
@ExcelColumn(header = "분야(장르)", order = 3, width = 10)
@ExcelColumn(header = "분야(장르)", order = 4, width = 10)
@Schema(description = "분야(장르)")
private String genre;
@ExcelColumn(header = "지역", order = 4, width = 10)
@ExcelColumn(header = "지역", order = 5, width = 10)
@Schema(description = "지역")
private String performanceArea;
@ExcelColumn(header = "지역 세부", order = 5, width = 10)
@ExcelColumn(header = "지역 세부", order = 6, width = 10)
@Schema(description = "지역 세부")
private String performanceAreaDetail;
@ExcelColumn(header = "단체(인) 명", order = 6, width = 11)
@ExcelColumn(header = "단체(인) 명", order = 7, width = 11)
@Schema(description = "단체(인) 명")
private String artistName;
@ExcelColumn(header = "사업 명", order = 7, width = 10)
@ExcelColumn(header = "사업 명", order = 8, width = 10)
@Schema(description = "사업 명")
private String performanceName;
@ExcelColumn(header = "사업 수행 월", order = 8, width = 12)
@ExcelColumn(header = "사업 수행 월", order = 9, width = 12)
@Schema(description = "사업 수행 월")
private String performanceStartMonth;
@ExcelColumn(header = "사업 일정", order = 9, width = 10)
@ExcelColumn(header = "사업 일정", order = 10, width = 10)
@Schema(description = "사업 일정")
private String performanceDtInfo;
@ExcelColumn(header = "운영 시간", order = 10, width = 10)
@ExcelColumn(header = "운영 시간", order = 11, width = 10)
@Schema(description = "운영 시간")
private String performanceTimeInfo;
@ExcelColumn(header = "티켓 예약", order = 11, width = 10)
@ExcelColumn(header = "티켓 예약", order = 12, width = 10)
@Schema(description = "티켓 예약")
private String ticketReservationStatus;
@ExcelColumn(header = "티켓 비고", order = 12, width = 10)
@ExcelColumn(header = "티켓 비고", order = 13, width = 10)
@Schema(description = "티켓 비고")
private String ticketReservationMemo;
@ExcelColumn(header = "모니터링 일정", order = 13, width = 14)
@ExcelColumn(header = "모니터링 일정", order = 14, width = 14)
@Schema(description = "모니터링 일정")
private String monitoringDate;
@ExcelColumn(header = "모니터링 시간", order = 14, width = 14)
@ExcelColumn(header = "모니터링 시간", order = 15, width = 14)
@Schema(description = "모니터링 시간")
private String monitoringTimeInfo;
@ExcelColumn(header = "모니터링 필요여부", order = 15, width = 14)
@ExcelColumn(header = "모니터링 필요여부", order = 16, width = 14)
@Schema(description = "모니터링 필요여부")
private String needMonitoring;
@ExcelColumn(header = "서면평가 필요여부", order = 16, width = 14)
@ExcelColumn(header = "서면평가 필요여부", order = 17, width = 14)
@Schema(description = "서면평가 필요여부")
private String needWrittenReview;
@ExcelColumn(header = "교부여부", order = 17, width = 14)
@ExcelColumn(header = "교부여부", order = 18, width = 14)
@Schema(description = "교부여부")
private String checkDeliver;
@ExcelColumn(header = "타임트리 확인일시", order = 18, width = 14)
@ExcelColumn(header = "타임트리 확인일시", order = 19, width = 14)
@Schema(description = "타임트리 확인일시")
private String timeTreeCheckDt;
@ExcelColumn(header = "모니터링 방문 장소", order = 19, width = 18)
@ExcelColumn(header = "모니터링 방문 장소", order = 20, width = 18)
@Schema(description = "모니터링 방문 장소")
private String monitoringAddress;
@ExcelColumn(header = "메모", order = 20, width = 10)
@ExcelColumn(header = "메모", order = 21, width = 10)
@Schema(description = "메모")
private String performanceMemo;
@ExcelColumn(header = "보고서 확인여부", order = 21, width = 10)
@ExcelColumn(header = "보고서 확인여부", order = 22, width = 10)
@Schema(description = "보고서 확인여부")
private String checkReport;
@ExcelColumn(header = "요원 비용지급일", order = 22, width = 16)
@ExcelColumn(header = "요원 비용지급일", order = 23, width = 16)
@Schema(description = "요원 비용지급일")
private String monitoringPaymentDate;
@ExcelColumn(header = "대표자 명", order = 23, width = 10)
@ExcelColumn(header = "대표자 명", order = 24, width = 10)
@Schema(description = "대표자 명")
private String ownStaffName;
@ExcelColumn(header = "대표자 연락처1", order = 24, width = 14)
@ExcelColumn(header = "대표자 연락처1", order = 25, width = 14)
@Schema(description = "대표자 연락처1")
private String ownStaffTel1;
@ExcelColumn(header = "대표자 연락처2", order = 25, width = 14)
@ExcelColumn(header = "대표자 연락처2", order = 26, width = 14)
@Schema(description = "대표자 연락처2")
private String ownStaffTel2;
@ExcelColumn(header = "대표자 이메일", order = 26, width = 14)
@ExcelColumn(header = "대표자 이메일", order = 27, width = 14)
@Schema(description = "대표자 이메일")
private String ownStaffEmail;
@ExcelColumn(header = "실무자 명", order = 27, width = 10)
@ExcelColumn(header = "실무자 명", order = 28, width = 10)
@Schema(description = "실무자 명")
private String contactStaffName;
@ExcelColumn(header = "실무자 연락처1", order = 28, width = 14)
@ExcelColumn(header = "실무자 연락처1", order = 29, width = 14)
@Schema(description = "실무자 연락처1")
private String contactStaffTel1;
@ExcelColumn(header = "실무자 연락처2", order = 29, width = 14)
@ExcelColumn(header = "실무자 연락처2", order = 30, width = 14)
@Schema(description = "실무자 연락처2")
private String contactStaffTel2;
@ExcelColumn(header = "실무자 이메일", order = 30, width = 14)
@ExcelColumn(header = "실무자 이메일", order = 31, width = 14)
@Schema(description = "실무자 이메일")
private String contactStaffEmail;
}

View File

@@ -63,7 +63,7 @@ import org.springframework.web.multipart.MultipartFile;
@RequiredArgsConstructor
public class PerformanceService {
private static final DateTimeFormatter REVIEW_DT_FORMATTER =
private static final DateTimeFormatter EXCEL_DT_FORMATTER =
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
private final KonMapper konMapper;
@@ -247,12 +247,15 @@ public class PerformanceService {
}
public byte[] exportPerformance(String[] performanceIds) {
Map<String, String> updateNoticeTargetLabels = codeService
.findByCodeGroup("update_notice_target").stream()
.collect(toMap(code -> code.getCodeValue().toString(), CodeDto::getCodeLabel));
Set<String> selectedPerformanceIds = performanceIds == null
? Collections.emptySet()
: Arrays.stream(performanceIds).collect(Collectors.toSet());
List<PerformanceDownloadDto> performanceList = getPerformanceList().stream()
.filter(performance -> selectedPerformanceIds.contains(String.valueOf(performance.getId())))
.map(this::toPerformanceDownloadRow)
.map(performance -> toPerformanceDownloadRow(performance, updateNoticeTargetLabels))
.toList();
List<CodeDto> businessTypeList = codeService.findByCodeGroup("business_type");
@@ -279,7 +282,10 @@ public class PerformanceService {
}
}
private PerformanceDownloadDto toPerformanceDownloadRow(PerformanceFullDto performance) {
private PerformanceDownloadDto toPerformanceDownloadRow(
PerformanceFullDto performance,
Map<String, String> updateNoticeTargetLabels
) {
Map<String, String> detail = performance.getPerformanceDetail() == null
? Collections.emptyMap()
: performance.getPerformanceDetail();
@@ -308,6 +314,12 @@ public class PerformanceService {
);
return PerformanceDownloadDto.builder()
.ncas(detail.get("NCAS"))
.updateNoticeTarget(updateNoticeTargetLabels.getOrDefault(
detail.get("UpdateNoticeTarget"),
detail.get("UpdateNoticeTarget")))
.updateNoticeMemo(detail.get("UpdateNoticeMemo"))
.updateNoticeDt(formatUpdateNoticeDt(detail.get("UpdateNoticeDt")))
.performanceId(toStringValue(performance.getId()))
.businessType(toStringValue(performance.getBusinessType()))
.genre(toStringValue(performance.getPerformanceGenre()))
@@ -418,7 +430,13 @@ public class PerformanceService {
private String formatReviewDt(PerformanceReviewDto review) {
return review == null || review.getReviewDt() == null
? null
: review.getReviewDt().format(REVIEW_DT_FORMATTER);
: review.getReviewDt().format(EXCEL_DT_FORMATTER);
}
private String formatUpdateNoticeDt(String value) {
return StringUtil.isNullOrBlank(value)
? null
: LocalDateTime.parse(value).format(EXCEL_DT_FORMATTER);
}
private String toStringValue(Object value) {
@@ -597,6 +615,11 @@ public class PerformanceService {
) {
List<ExcelErrorDto> errors = new ArrayList<>();
String ncas = Objects.toString(row.getNcas(), "");
if (!ncas.matches("[0-9]*") || ncas.length() > 2048) {
errors.add(ExcelErrorDto.of(rowNumber, "관리번호", "관리번호는 2048자 이내의 숫자만 입력할 수 있습니다."));
}
Integer performanceNo = NumericUtil.parseOnlyInteger(row.getPerformanceNo());
if (performanceNo == null) {
errors.add(ExcelErrorDto.of(rowNumber, "No", "No는 숫자여야 합니다."));
@@ -692,6 +715,7 @@ public class PerformanceService {
LocalDateTime regDt
) {
Map<String, String> detail = new LinkedHashMap<>();
detail.put("NCAS", Objects.toString(row.getNcas(), ""));
detail.put("monitoringPaymentDate", Objects.toString(StringUtil.normalizeBlank(row.getMonitoringPaymentDate()), ""));
detail.put("performanceNo", Objects.toString(StringUtil.normalizeBlank(row.getPerformanceNo()), ""));
@@ -883,9 +907,7 @@ public class PerformanceService {
String modUser,
LocalDateTime modDt
) {
Map<String, String> detail = performanceDetail == null
? Collections.emptyMap()
: performanceDetail;
Map<String, String> detail = preparePerformanceDetail(performanceId, performanceDetail, modDt);
List<TPerformanceDetailEntity> detailEntities = detail.entrySet().stream()
.map(entry -> TPerformanceDetailEntity.update(
@@ -900,6 +922,56 @@ public class PerformanceService {
performanceDetailRepository.saveAll(detailEntities);
}
private Map<String, String> preparePerformanceDetail(
Integer performanceId,
Map<String, String> performanceDetail,
LocalDateTime modDt
) {
Map<String, String> detail = performanceDetail == null
? new LinkedHashMap<>() : new LinkedHashMap<>(performanceDetail);
// 변경 일시는 클라이언트 값으로 수정할 수 없다.
detail.remove("UpdateNoticeDt");
if (detail.containsKey("NCAS")) {
String ncas = Objects.toString(detail.get("NCAS"), "");
if (!ncas.matches("[0-9]*") || ncas.length() > 2048) {
throw BusinessException.badRequest("INVALID_NCAS", "관리번호는 2048자 이내의 숫자만 입력할 수 있습니다.");
}
detail.put("NCAS", ncas);
}
if (!detail.containsKey("UpdateNoticeTarget")
&& !detail.containsKey("UpdateNoticeMemo")) {
return detail;
}
Map<String, String> existing = getPerformanceDetailMap(performanceId);
String target = Objects.toString(detail.getOrDefault("UpdateNoticeTarget",
existing.get("UpdateNoticeTarget")), "");
String memo = Objects.toString(detail.getOrDefault("UpdateNoticeMemo",
existing.get("UpdateNoticeMemo")), "");
if (!target.isEmpty()) {
boolean valid = codeService.findByCodeGroup("update_notice_target").stream()
.anyMatch(code -> code.getCodeValue().toString().equals(target));
if (!valid) {
throw BusinessException.badRequest("INVALID_UPDATE_NOTICE_TARGET", "변경 사항 코드가 유효하지 않습니다.");
}
if (memo.isBlank()) {
throw BusinessException.badRequest("EMPTY_UPDATE_NOTICE_MEMO", "변경 사항 저장 시 변경 내용은 필수입니다.");
}
} else if (!memo.isBlank()) {
throw BusinessException.badRequest("EMPTY_UPDATE_NOTICE_TARGET", "변경 내용을 저장하려면 변경 사항을 선택해야 합니다.");
}
if (memo.length() > 2048) {
throw BusinessException.badRequest("INVALID_UPDATE_NOTICE_MEMO", "변경 내용은 2048자 이내로 입력해야 합니다.");
}
detail.put("UpdateNoticeTarget", target);
detail.put("UpdateNoticeMemo", memo);
if (!Objects.equals(target, Objects.toString(existing.get("UpdateNoticeTarget"), ""))
|| !Objects.equals(memo, Objects.toString(existing.get("UpdateNoticeMemo"), ""))) {
detail.put("UpdateNoticeDt", target.isEmpty() ? "" : modDt.toString());
}
return detail;
}
private void updatePerformanceStaff(
Integer performanceId,
List<PerformanceStaffDto> performanceStaff,