Merge pull request 'develop' (#2) from develop into master
Reviewed-on: #2
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package com.kri.gwcf.review.back.common.consts;
|
package com.kri.gwcf.review.back.common.consts;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@@ -8,4 +9,8 @@ public final class GwcfConstant {
|
|||||||
public static final String SYSTEM_USER_NAME = "SYSTEM";
|
public static final String SYSTEM_USER_NAME = "SYSTEM";
|
||||||
public static final Integer WRITTEN_USER_ROLE = 2021;
|
public static final Integer WRITTEN_USER_ROLE = 2021;
|
||||||
public static final Integer MONITORING_USER_ROLE = 9003;
|
public static final Integer MONITORING_USER_ROLE = 9003;
|
||||||
|
public static final Short REJECT_ASSIGN_ORDER = 9999;
|
||||||
|
|
||||||
|
public static final List<Integer> REVIEW_TYPE = List.of(1, 3);
|
||||||
|
public static final List<Integer> REVIEW_CLASSIFICATION = List.of(1, 5, 99);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.kri.gwcf.review.back.common.enums;
|
||||||
|
|
||||||
|
import com.kri.common.feature.enums.CodeEnum;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Schema(description = "배정 승인 상태")
|
||||||
|
public enum AssignConfirmStatus implements CodeEnum<Short> {
|
||||||
|
REQUESTED((short) 0), // 요청
|
||||||
|
CONFIRMED((short) 1), // 승인
|
||||||
|
REJECTED((short) 9); // 거절
|
||||||
|
|
||||||
|
private final Short code;
|
||||||
|
}
|
||||||
@@ -25,9 +25,10 @@ public enum SystemEventType implements CodeEnum<Short> {
|
|||||||
|
|
||||||
ASSIGN_PERFORMANCE_REQUEST((short) 1031), //공연 배정 요청
|
ASSIGN_PERFORMANCE_REQUEST((short) 1031), //공연 배정 요청
|
||||||
ASSIGN_PERFORMANCE_CONFIRM((short) 1032), //공연 배정 승인
|
ASSIGN_PERFORMANCE_CONFIRM((short) 1032), //공연 배정 승인
|
||||||
ASSIGN_PERFORMANCE_REJECT((short) 1033), //공연 배정 거절
|
ASSIGN_PERFORMANCE_CANCEL((short) 1033), //공연 배정 거절
|
||||||
ASSIGN_PERFORMANCE_FORCE((short) 1034), //강제 공연 배정
|
ASSIGN_PERFORMANCE_FORCE((short) 1034), //강제 공연 배정
|
||||||
UPLOAD_WRITTEN_ASSIGN((short) 1036),
|
UPLOAD_WRITTEN_ASSIGN((short) 1036),
|
||||||
|
ASSIGN_PERFORMANCE_REJECT((short) 1039), //공연 배정 거절
|
||||||
|
|
||||||
VISIT_START((short) 2011), //모니터링 출발
|
VISIT_START((short) 2011), //모니터링 출발
|
||||||
VISIT_END((short) 2012), //모니터링 도착
|
VISIT_END((short) 2012), //모니터링 도착
|
||||||
|
|||||||
@@ -68,11 +68,24 @@ public class AssignController {
|
|||||||
RequestUserContext ctx
|
RequestUserContext ctx
|
||||||
) {
|
) {
|
||||||
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||||
String result = assignService.confirmMonitoringAssignByUser(performanceId, userId);
|
String result = assignService.confirmMonitoringAssignByUser(performanceId, userId, true);
|
||||||
systemEventLogService.writeAssignConfirmLog(userId, now, ctx.getClientIp(), String.valueOf(performanceId));
|
systemEventLogService.writeAssignConfirmLog(userId, now, ctx.getClientIp(), String.valueOf(performanceId));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "참여 거절")
|
||||||
|
@PostMapping("/reject/{performanceId}/{userId}")
|
||||||
|
public String assignReject(
|
||||||
|
@PathVariable Integer performanceId,
|
||||||
|
@PathVariable String userId,
|
||||||
|
RequestUserContext ctx
|
||||||
|
) {
|
||||||
|
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||||
|
String result = assignService.confirmMonitoringAssignByUser(performanceId, userId, false);
|
||||||
|
systemEventLogService.writeAssignRejectLog(userId, now, ctx.getClientIp(), String.valueOf(performanceId));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
@Operation(summary = "모니터링 배정 저장")
|
@Operation(summary = "모니터링 배정 저장")
|
||||||
@PostMapping("/monitoring")
|
@PostMapping("/monitoring")
|
||||||
public List<PerformanceAssignDto> saveMonitoringAssign(
|
public List<PerformanceAssignDto> saveMonitoringAssign(
|
||||||
|
|||||||
@@ -98,10 +98,16 @@ public class ReviewController {
|
|||||||
@PathVariable Integer reviewType,
|
@PathVariable Integer reviewType,
|
||||||
@PathVariable String userId
|
@PathVariable String userId
|
||||||
) {
|
) {
|
||||||
return download(
|
return download(reviewService.getOriginalFileResource(performanceId, reviewType, userId));
|
||||||
reviewService.getOriginalFileResource(performanceId, reviewType, userId),
|
}
|
||||||
reviewService.getOriginalFileName(performanceId, reviewType, userId)
|
|
||||||
);
|
@Operation(summary = "평가/모니터링 원본 파일 압축 다운로드")
|
||||||
|
@GetMapping("/download/{performanceId}/{reviewType}")
|
||||||
|
public ResponseEntity<Resource> downloadOriginalFileZip(
|
||||||
|
@PathVariable Integer performanceId,
|
||||||
|
@PathVariable Integer reviewType
|
||||||
|
) {
|
||||||
|
return download(reviewService.getOriginalFileZipResource(performanceId, reviewType));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "PDF 변환 파일 조회/다운로드")
|
@Operation(summary = "PDF 변환 파일 조회/다운로드")
|
||||||
@@ -111,35 +117,40 @@ public class ReviewController {
|
|||||||
@PathVariable Integer reviewType,
|
@PathVariable Integer reviewType,
|
||||||
@PathVariable String userId
|
@PathVariable String userId
|
||||||
) {
|
) {
|
||||||
return download(
|
return download(reviewService.getPdfOrOriginalFileResource(performanceId, reviewType, userId));
|
||||||
reviewService.getPdfOrOriginalFileResource(performanceId, reviewType, userId),
|
|
||||||
reviewService.getPdfOrOriginalFileName(performanceId, reviewType, userId)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "평가양식 업로드")
|
@Operation(summary = "평가양식 업로드")
|
||||||
@PostMapping(value = "/template/upload/{reviewType}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
@PostMapping(value = "/template/upload/{reviewType}/{classification}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||||
public String uploadReviewTemplate(
|
public String uploadReviewTemplate(
|
||||||
@PathVariable Integer reviewType,
|
@PathVariable Integer reviewType,
|
||||||
|
@PathVariable Integer classification,
|
||||||
@RequestParam("file") MultipartFile file
|
@RequestParam("file") MultipartFile file
|
||||||
) {
|
) {
|
||||||
return reviewTemplateService.uploadReviewTemplate(reviewType, file);
|
return reviewTemplateService.uploadReviewTemplate(reviewType, classification, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "평가양식 다운로드")
|
@Operation(summary = "평가양식 다운로드")
|
||||||
@GetMapping("/template/download/{reviewType}")
|
@GetMapping("/template/download/{reviewType}/{classification}")
|
||||||
public ResponseEntity<Resource> downloadReviewTemplate(
|
public ResponseEntity<Resource> downloadReviewTemplate(
|
||||||
@PathVariable Integer reviewType
|
@PathVariable Integer reviewType,
|
||||||
|
@PathVariable Integer classification
|
||||||
) {
|
) {
|
||||||
return download(
|
return download(reviewTemplateService.getReviewTemplateResource(reviewType, classification));
|
||||||
reviewTemplateService.getReviewTemplateResource(reviewType),
|
|
||||||
reviewTemplateService.getReviewTemplateFileName(reviewType)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ResponseEntity<Resource> download(Resource resource, String fileName) {
|
@Operation(summary = "평가양식 pdf 다운로드")
|
||||||
|
@GetMapping("/template/pdf/{reviewType}/{classification}")
|
||||||
|
public ResponseEntity<Resource> downloadReviewPdfTemplate(
|
||||||
|
@PathVariable Integer reviewType,
|
||||||
|
@PathVariable Integer classification
|
||||||
|
) {
|
||||||
|
return download(reviewTemplateService.getReviewTemplatePdfResource(reviewType, classification));
|
||||||
|
}
|
||||||
|
|
||||||
|
private ResponseEntity<Resource> download(Resource resource) {
|
||||||
return ResponseEntity.ok()
|
return ResponseEntity.ok()
|
||||||
.header(HttpHeaders.CONTENT_DISPOSITION, attachmentContentDisposition(fileName))
|
.header(HttpHeaders.CONTENT_DISPOSITION, attachmentContentDisposition(resource.getFilename()))
|
||||||
.contentType(MediaType.APPLICATION_OCTET_STREAM)
|
.contentType(MediaType.APPLICATION_OCTET_STREAM)
|
||||||
.body(resource);
|
.body(resource);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,35 +15,35 @@ import lombok.experimental.SuperBuilder;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class PerformanceDownloadDto extends PerformanceUploadDto {
|
public class PerformanceDownloadDto extends PerformanceUploadDto {
|
||||||
|
|
||||||
@ExcelColumn(header = "지자체 평가자", order = 24, width = 16)
|
@ExcelColumn(header = "지자체 평가자", order = 31, width = 16)
|
||||||
@Schema(description = "지자체 평가자")
|
@Schema(description = "지자체 평가자")
|
||||||
private String localReviewUser;
|
private String localReviewUser;
|
||||||
|
|
||||||
@ExcelColumn(header = "지자체 평가 상태", order = 25, width = 16)
|
@ExcelColumn(header = "지자체 평가 상태", order = 32, width = 16)
|
||||||
@Schema(description = "지자체 평가 상태")
|
@Schema(description = "지자체 평가 상태")
|
||||||
private String localReviewStatus;
|
private String localReviewStatus;
|
||||||
|
|
||||||
@ExcelColumn(header = "지자체 평가 일시", order = 26, width = 16)
|
@ExcelColumn(header = "지자체 평가 일시", order = 33, width = 16)
|
||||||
@Schema(description = "지자체 평가 일시")
|
@Schema(description = "지자체 평가 일시")
|
||||||
private String localReviewDt;
|
private String localReviewDt;
|
||||||
|
|
||||||
@ExcelColumn(header = "모니터링1 평가자", order = 27, width = 16)
|
@ExcelColumn(header = "모니터링1 평가자", order = 34, width = 16)
|
||||||
@Schema(description = "모니터링1 평가자")
|
@Schema(description = "모니터링1 평가자")
|
||||||
private String monitoringReviewUser1;
|
private String monitoringReviewUser1;
|
||||||
|
|
||||||
@ExcelColumn(header = "모니터링1 평가 상태", order = 28, width = 16)
|
@ExcelColumn(header = "모니터링1 평가 상태", order = 35, width = 16)
|
||||||
@Schema(description = "모니터링1 평가 상태")
|
@Schema(description = "모니터링1 평가 상태")
|
||||||
private String monitoringReviewStatus1;
|
private String monitoringReviewStatus1;
|
||||||
|
|
||||||
@ExcelColumn(header = "모니터링1 평가 일시", order = 29, width = 16)
|
@ExcelColumn(header = "모니터링1 평가 일시", order = 36, width = 16)
|
||||||
@Schema(description = "모니터링1 평가 일시")
|
@Schema(description = "모니터링1 평가 일시")
|
||||||
private String monitoringReviewDt1;
|
private String monitoringReviewDt1;
|
||||||
|
|
||||||
@ExcelColumn(header = "모니터링2 평가자", order = 30, width = 16)
|
@ExcelColumn(header = "모니터링2 평가자", order = 37, width = 16)
|
||||||
@Schema(description = "모니터링2 평가자")
|
@Schema(description = "모니터링2 평가자")
|
||||||
private String monitoringReviewUser2;
|
private String monitoringReviewUser2;
|
||||||
|
|
||||||
@ExcelColumn(header = "모니터링2 평가 상태", order = 31, width = 16)
|
@ExcelColumn(header = "모니터링2 평가 상태", order = 38, width = 16)
|
||||||
@Schema(description = "모니터링2 평가 상태")
|
@Schema(description = "모니터링2 평가 상태")
|
||||||
private String monitoringReviewStatus2;
|
private String monitoringReviewStatus2;
|
||||||
|
|
||||||
|
|||||||
@@ -15,99 +15,127 @@ import lombok.experimental.SuperBuilder;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class PerformanceUploadDto {
|
public class PerformanceUploadDto {
|
||||||
|
|
||||||
@ExcelColumn(header = "연번", order = 0, width = 10)
|
@ExcelColumn(header = "NO", order = 0, width = 10)
|
||||||
|
@Schema(description = "NO")
|
||||||
|
private String performanceNo;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "연번", order = 1, width = 10)
|
||||||
@Schema(description = "연번")
|
@Schema(description = "연번")
|
||||||
private String performanceId;
|
private String performanceId;
|
||||||
|
|
||||||
@ExcelColumn(header = "사업유형", order = 1, width = 10)
|
@ExcelColumn(header = "사업유형", order = 2, width = 10)
|
||||||
@Schema(description = "사업유형")
|
@Schema(description = "사업유형")
|
||||||
private String businessType;
|
private String businessType;
|
||||||
|
|
||||||
@ExcelColumn(header = "분야(장르)", order = 2, width = 10)
|
@ExcelColumn(header = "분야(장르)", order = 3, width = 10)
|
||||||
@Schema(description = "분야(장르)")
|
@Schema(description = "분야(장르)")
|
||||||
private String genre;
|
private String genre;
|
||||||
|
|
||||||
@ExcelColumn(header = "지역", order = 3, width = 10)
|
@ExcelColumn(header = "지역", order = 4, width = 10)
|
||||||
@Schema(description = "지역")
|
@Schema(description = "지역")
|
||||||
private String performanceArea;
|
private String performanceArea;
|
||||||
|
|
||||||
@ExcelColumn(header = "단체(인) 명", order = 4, width = 11)
|
@ExcelColumn(header = "지역 세부", order = 5, width = 10)
|
||||||
|
@Schema(description = "지역 세부")
|
||||||
|
private String performanceAreaDetail;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "단체(인) 명", order = 6, width = 11)
|
||||||
@Schema(description = "단체(인) 명")
|
@Schema(description = "단체(인) 명")
|
||||||
private String artistName;
|
private String artistName;
|
||||||
|
|
||||||
@ExcelColumn(header = "사업 명", order = 5, width = 10)
|
@ExcelColumn(header = "사업 명", order = 7, width = 10)
|
||||||
@Schema(description = "사업 명")
|
@Schema(description = "사업 명")
|
||||||
private String performanceName;
|
private String performanceName;
|
||||||
|
|
||||||
@ExcelColumn(header = "사업 수행 월", order = 6, width = 12)
|
@ExcelColumn(header = "사업 수행 월", order = 8, width = 12)
|
||||||
@Schema(description = "사업 수행 월")
|
@Schema(description = "사업 수행 월")
|
||||||
private String performanceStartMonth;
|
private String performanceStartMonth;
|
||||||
|
|
||||||
@ExcelColumn(header = "사업 일정", order = 7, width = 10)
|
@ExcelColumn(header = "사업 일정", order = 9, width = 10)
|
||||||
@Schema(description = "사업 일정")
|
@Schema(description = "사업 일정")
|
||||||
private String performanceDtInfo;
|
private String performanceDtInfo;
|
||||||
|
|
||||||
@ExcelColumn(header = "운영 시간", order = 8, width = 10)
|
@ExcelColumn(header = "운영 시간", order = 10, width = 10)
|
||||||
@Schema(description = "운영 시간")
|
@Schema(description = "운영 시간")
|
||||||
private String performanceTimeInfo;
|
private String performanceTimeInfo;
|
||||||
|
|
||||||
@ExcelColumn(header = "티켓 예약", order = 9, width = 10)
|
@ExcelColumn(header = "티켓 예약", order = 11, width = 10)
|
||||||
@Schema(description = "티켓 예약")
|
@Schema(description = "티켓 예약")
|
||||||
private String ticketReservationStatus;
|
private String ticketReservationStatus;
|
||||||
|
|
||||||
@ExcelColumn(header = "티켓 비고", order = 10, width = 10)
|
@ExcelColumn(header = "티켓 비고", order = 12, width = 10)
|
||||||
@Schema(description = "티켓 비고")
|
@Schema(description = "티켓 비고")
|
||||||
private String ticketReservationMemo;
|
private String ticketReservationMemo;
|
||||||
|
|
||||||
@ExcelColumn(header = "모니터링 일정", order = 11, width = 14)
|
@ExcelColumn(header = "모니터링 일정", order = 13, width = 14)
|
||||||
@Schema(description = "모니터링 일정")
|
@Schema(description = "모니터링 일정")
|
||||||
private String monitoringDate;
|
private String monitoringDate;
|
||||||
|
|
||||||
@ExcelColumn(header = "모니터링 시간", order = 12, width = 14)
|
@ExcelColumn(header = "모니터링 시간", order = 14, width = 14)
|
||||||
@Schema(description = "모니터링 시간")
|
@Schema(description = "모니터링 시간")
|
||||||
private String monitoringTimeInfo;
|
private String monitoringTimeInfo;
|
||||||
|
|
||||||
@ExcelColumn(header = "모니터링 방문 장소", order = 13, width = 18)
|
@ExcelColumn(header = "모니터링 필요여부", order = 15, width = 14)
|
||||||
|
@Schema(description = "모니터링 필요여부")
|
||||||
|
private String needMonitoring;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "서면평가 필요여부", order = 16, width = 14)
|
||||||
|
@Schema(description = "서면평가 필요여부")
|
||||||
|
private String needWrittenReview;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "교부여부", order = 17, width = 14)
|
||||||
|
@Schema(description = "교부여부")
|
||||||
|
private String checkDeliver;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "타임트리 확인일시", order = 18, width = 14)
|
||||||
|
@Schema(description = "타임트리 확인일시")
|
||||||
|
private String timeTreeCheckDt;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "모니터링 방문 장소", order = 19, width = 18)
|
||||||
@Schema(description = "모니터링 방문 장소")
|
@Schema(description = "모니터링 방문 장소")
|
||||||
private String monitoringAddress;
|
private String monitoringAddress;
|
||||||
|
|
||||||
@ExcelColumn(header = "대표자 명", order = 14, width = 10)
|
@ExcelColumn(header = "메모", order = 20, width = 10)
|
||||||
@Schema(description = "대표자 명")
|
|
||||||
private String ownStaffName;
|
|
||||||
|
|
||||||
@ExcelColumn(header = "대표자 연락처1", order = 15, width = 14)
|
|
||||||
@Schema(description = "대표자 연락처1")
|
|
||||||
private String ownStaffTel1;
|
|
||||||
|
|
||||||
@ExcelColumn(header = "대표자 연락처2", order = 16, width = 14)
|
|
||||||
@Schema(description = "대표자 연락처2")
|
|
||||||
private String ownStaffTel2;
|
|
||||||
|
|
||||||
@ExcelColumn(header = "대표자 이메일", order = 17, width = 14)
|
|
||||||
@Schema(description = "대표자 이메일")
|
|
||||||
private String ownStaffEmail;
|
|
||||||
|
|
||||||
@ExcelColumn(header = "실무자 명", order = 18, width = 10)
|
|
||||||
@Schema(description = "실무자 명")
|
|
||||||
private String contactStaffName;
|
|
||||||
|
|
||||||
@ExcelColumn(header = "실무자 연락처1", order = 19, width = 14)
|
|
||||||
@Schema(description = "실무자 연락처1")
|
|
||||||
private String contactStaffTel1;
|
|
||||||
|
|
||||||
@ExcelColumn(header = "실무자 연락처2", order = 20, width = 14)
|
|
||||||
@Schema(description = "실무자 연락처2")
|
|
||||||
private String contactStaffTel2;
|
|
||||||
|
|
||||||
@ExcelColumn(header = "실무자 이메일", order = 21, width = 14)
|
|
||||||
@Schema(description = "실무자 이메일")
|
|
||||||
private String contactStaffEmail;
|
|
||||||
|
|
||||||
@ExcelColumn(header = "메모", order = 22, width = 10)
|
|
||||||
@Schema(description = "메모")
|
@Schema(description = "메모")
|
||||||
private String performanceMemo;
|
private String performanceMemo;
|
||||||
|
|
||||||
@ExcelColumn(header = "요원 비용지급일", order = 23, width = 16)
|
@ExcelColumn(header = "보고서 확인여부", order = 21, width = 10)
|
||||||
|
@Schema(description = "보고서 확인여부")
|
||||||
|
private String checkReport;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "요원 비용지급일", order = 22, width = 16)
|
||||||
@Schema(description = "요원 비용지급일")
|
@Schema(description = "요원 비용지급일")
|
||||||
private String monitoringPaymentDate;
|
private String monitoringPaymentDate;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "대표자 명", order = 23, width = 10)
|
||||||
|
@Schema(description = "대표자 명")
|
||||||
|
private String ownStaffName;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "대표자 연락처1", order = 24, width = 14)
|
||||||
|
@Schema(description = "대표자 연락처1")
|
||||||
|
private String ownStaffTel1;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "대표자 연락처2", order = 25, width = 14)
|
||||||
|
@Schema(description = "대표자 연락처2")
|
||||||
|
private String ownStaffTel2;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "대표자 이메일", order = 26, width = 14)
|
||||||
|
@Schema(description = "대표자 이메일")
|
||||||
|
private String ownStaffEmail;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "실무자 명", order = 27, width = 10)
|
||||||
|
@Schema(description = "실무자 명")
|
||||||
|
private String contactStaffName;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "실무자 연락처1", order = 28, width = 14)
|
||||||
|
@Schema(description = "실무자 연락처1")
|
||||||
|
private String contactStaffTel1;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "실무자 연락처2", order = 29, width = 14)
|
||||||
|
@Schema(description = "실무자 연락처2")
|
||||||
|
private String contactStaffTel2;
|
||||||
|
|
||||||
|
@ExcelColumn(header = "실무자 이메일", order = 30, width = 14)
|
||||||
|
@Schema(description = "실무자 이메일")
|
||||||
|
private String contactStaffEmail;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public class PerformanceAssignDto {
|
|||||||
private String assignUser;
|
private String assignUser;
|
||||||
|
|
||||||
@Schema(description = "사용자 컨펌 여부")
|
@Schema(description = "사용자 컨펌 여부")
|
||||||
private Boolean assignConfirm;
|
private Short assignStatus;
|
||||||
|
|
||||||
public static PerformanceAssignDto from(TPerformanceAssignEntity entity) {
|
public static PerformanceAssignDto from(TPerformanceAssignEntity entity) {
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
@@ -45,7 +45,7 @@ public class PerformanceAssignDto {
|
|||||||
.assignType(entity.getAssignType())
|
.assignType(entity.getAssignType())
|
||||||
.assignOrder(entity.getAssignOrder())
|
.assignOrder(entity.getAssignOrder())
|
||||||
.assignUser(entity.getAssignUser())
|
.assignUser(entity.getAssignUser())
|
||||||
.assignConfirm(entity.getAssignConfirm())
|
.assignStatus(entity.getAssignStatus())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,8 +43,8 @@ public class TPerformanceAssignEntity {
|
|||||||
private String assignUser;
|
private String assignUser;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Column(name = "is_assign_confirm", nullable = false)
|
@Column(name = "assign_status", nullable = false)
|
||||||
private Boolean assignConfirm;
|
private Short assignStatus;
|
||||||
|
|
||||||
@Size(max = 32)
|
@Size(max = 32)
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -67,7 +67,7 @@ public class TPerformanceAssignEntity {
|
|||||||
entity.setAssignType(dto.getAssignType());
|
entity.setAssignType(dto.getAssignType());
|
||||||
entity.setAssignOrder(dto.getAssignOrder());
|
entity.setAssignOrder(dto.getAssignOrder());
|
||||||
entity.setAssignUser(dto.getAssignUser());
|
entity.setAssignUser(dto.getAssignUser());
|
||||||
entity.setAssignConfirm(dto.getAssignConfirm());
|
entity.setAssignStatus(dto.getAssignStatus());
|
||||||
|
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,8 +34,7 @@ public class TPerformanceMonitoringScheduleEntity {
|
|||||||
@Column(name = "performance_id", nullable = false)
|
@Column(name = "performance_id", nullable = false)
|
||||||
private Integer performanceId;
|
private Integer performanceId;
|
||||||
|
|
||||||
@NotNull
|
@Column(name = "monitoring_date")
|
||||||
@Column(name = "monitoring_date", nullable = false)
|
|
||||||
private LocalDate monitoringDate;
|
private LocalDate monitoringDate;
|
||||||
|
|
||||||
@Size(max = 256)
|
@Size(max = 256)
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ public interface PerformanceAssignRepository extends JpaRepository<TPerformanceA
|
|||||||
|
|
||||||
long countByPerformanceIdAndAssignType(Integer performanceId, Integer assignType);
|
long countByPerformanceIdAndAssignType(Integer performanceId, Integer assignType);
|
||||||
|
|
||||||
long countByPerformanceIdAndAssignTypeAndAssignConfirm(
|
long countByPerformanceIdAndAssignTypeAndAssignStatus(
|
||||||
Integer performanceId,
|
Integer performanceId,
|
||||||
Integer assignType,
|
Integer assignType,
|
||||||
Boolean assignConfirm
|
Short assignStatus
|
||||||
);
|
);
|
||||||
|
|
||||||
List<TPerformanceAssignEntity> findByPerformanceIdAndAssignUser(
|
List<TPerformanceAssignEntity> findByPerformanceIdAndAssignUser(
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
package com.kri.gwcf.review.back.service;
|
package com.kri.gwcf.review.back.service;
|
||||||
|
|
||||||
|
import static com.kri.gwcf.review.back.common.consts.GwcfConstant.REJECT_ASSIGN_ORDER;
|
||||||
|
|
||||||
import com.kri.common.feature.excel.ExcelMapper;
|
import com.kri.common.feature.excel.ExcelMapper;
|
||||||
import com.kri.common.feature.util.NumericUtil;
|
import com.kri.common.feature.util.NumericUtil;
|
||||||
import com.kri.common.feature.util.StringUtil;
|
import com.kri.common.feature.util.StringUtil;
|
||||||
import com.kri.gwcf.review.back.common.util.ExcelUploadResultUtil;
|
import com.kri.gwcf.review.back.common.util.ExcelUploadResultUtil;
|
||||||
|
import com.kri.gwcf.review.back.common.enums.AssignConfirmStatus;
|
||||||
import com.kri.gwcf.review.back.dto.assign.AssignUserCountDto;
|
import com.kri.gwcf.review.back.dto.assign.AssignUserCountDto;
|
||||||
import com.kri.gwcf.review.back.dto.excel.ExcelErrorDto;
|
import com.kri.gwcf.review.back.dto.excel.ExcelErrorDto;
|
||||||
import com.kri.gwcf.review.back.dto.excel.ExcelUploadResultDto;
|
import com.kri.gwcf.review.back.dto.excel.ExcelUploadResultDto;
|
||||||
@@ -15,6 +18,7 @@ import com.kri.gwcf.review.back.dto.monitoring.MonitoringApplyUserDto;
|
|||||||
import com.kri.gwcf.review.back.dto.performance.PerformanceAssignDto;
|
import com.kri.gwcf.review.back.dto.performance.PerformanceAssignDto;
|
||||||
import com.kri.gwcf.review.back.dto.user.UserCompactDto;
|
import com.kri.gwcf.review.back.dto.user.UserCompactDto;
|
||||||
import com.kri.gwcf.review.back.persistence.entity.TPerformanceAssignEntity;
|
import com.kri.gwcf.review.back.persistence.entity.TPerformanceAssignEntity;
|
||||||
|
import com.kri.gwcf.review.back.persistence.entity.TPerformanceEntity;
|
||||||
import com.kri.gwcf.review.back.persistence.entity.TUserDetailEntity;
|
import com.kri.gwcf.review.back.persistence.entity.TUserDetailEntity;
|
||||||
import com.kri.gwcf.review.back.persistence.entity.TUserEntity;
|
import com.kri.gwcf.review.back.persistence.entity.TUserEntity;
|
||||||
import com.kri.gwcf.review.back.persistence.mapper.kon.KonMapper;
|
import com.kri.gwcf.review.back.persistence.mapper.kon.KonMapper;
|
||||||
@@ -84,22 +88,28 @@ public class AssignService {
|
|||||||
|
|
||||||
public List<MonitoringApplyUserDto> findMonitoringApplyUsers(Integer performanceId) {
|
public List<MonitoringApplyUserDto> findMonitoringApplyUsers(Integer performanceId) {
|
||||||
List<PerformanceApplyUserDto> applyUsers = findKonPerformanceApplyUser(performanceId);
|
List<PerformanceApplyUserDto> applyUsers = findKonPerformanceApplyUser(performanceId);
|
||||||
|
if (applyUsers.isEmpty()) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
List<String> userIds = applyUsers.stream()
|
List<String> userIds = applyUsers.stream()
|
||||||
.map(PerformanceApplyUserDto::getUserId)
|
.map(PerformanceApplyUserDto::getUserId)
|
||||||
.distinct()
|
.distinct()
|
||||||
.toList();
|
.toList();
|
||||||
|
Set<String> userIdSet = Set.copyOf(userIds);
|
||||||
|
|
||||||
Map<String, TUserEntity> userMap = userRepository.findAllById(userIds).stream()
|
Map<String, TUserEntity> userMap = userRepository.findAllById(userIds).stream()
|
||||||
.collect(Collectors.toMap(TUserEntity::getUserId, Function.identity()));
|
.collect(Collectors.toMap(TUserEntity::getUserId, Function.identity()));
|
||||||
|
|
||||||
Map<String, Map<String, String>> userDetailMap = userIds.stream()
|
Map<String, Map<String, String>> userDetailMap = userDetailRepository.findAll().stream()
|
||||||
.collect(Collectors.toMap(
|
.filter(detail -> userIdSet.contains(detail.getUserId()))
|
||||||
Function.identity(),
|
.collect(Collectors.groupingBy(
|
||||||
userId -> userDetailRepository.findByIdUserId(userId).stream()
|
TUserDetailEntity::getUserId,
|
||||||
.collect(Collectors.toMap(
|
Collectors.toMap(
|
||||||
TUserDetailEntity::getUserDetailKey,
|
TUserDetailEntity::getUserDetailKey,
|
||||||
TUserDetailEntity::getUserDetailValue
|
TUserDetailEntity::getUserDetailValue,
|
||||||
))
|
(left, right) -> right
|
||||||
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
return applyUsers.stream()
|
return applyUsers.stream()
|
||||||
@@ -138,7 +148,7 @@ public class AssignService {
|
|||||||
entity.setAssignType(1);
|
entity.setAssignType(1);
|
||||||
entity.setAssignOrder((short) (currentCount + 1));
|
entity.setAssignOrder((short) (currentCount + 1));
|
||||||
entity.setAssignUser(assignUser);
|
entity.setAssignUser(assignUser);
|
||||||
entity.setAssignConfirm(false);
|
entity.setAssignStatus(AssignConfirmStatus.REQUESTED.getCode());
|
||||||
entity.setRegUser(regUser);
|
entity.setRegUser(regUser);
|
||||||
entity.setRegDt(regDt);
|
entity.setRegDt(regDt);
|
||||||
|
|
||||||
@@ -175,7 +185,11 @@ public class AssignService {
|
|||||||
performanceAssignRepository.findByPerformanceIdAndAssignType(performanceId, 1);
|
performanceAssignRepository.findByPerformanceIdAndAssignType(performanceId, 1);
|
||||||
Set<String> requestedUserSet = Set.copyOf(normalizedAssignUsers);
|
Set<String> requestedUserSet = Set.copyOf(normalizedAssignUsers);
|
||||||
List<TPerformanceAssignEntity> deleteTargets = currentAssigns.stream()
|
List<TPerformanceAssignEntity> deleteTargets = currentAssigns.stream()
|
||||||
.filter(assign -> !requestedUserSet.contains(assign.getAssignUser()))
|
.filter(assign -> {
|
||||||
|
boolean requested = requestedUserSet.contains(assign.getAssignUser());
|
||||||
|
boolean rejected = AssignConfirmStatus.REJECTED.getCode().equals(assign.getAssignStatus());
|
||||||
|
return (requested && rejected) || (!requested && !rejected);
|
||||||
|
})
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
for (TPerformanceAssignEntity deleteTarget : deleteTargets) {
|
for (TPerformanceAssignEntity deleteTarget : deleteTargets) {
|
||||||
@@ -185,32 +199,29 @@ public class AssignService {
|
|||||||
|
|
||||||
Set<String> currentUserSet = currentAssigns.stream()
|
Set<String> currentUserSet = currentAssigns.stream()
|
||||||
.filter(assign -> requestedUserSet.contains(assign.getAssignUser()))
|
.filter(assign -> requestedUserSet.contains(assign.getAssignUser()))
|
||||||
|
.filter(assign -> !AssignConfirmStatus.REJECTED.getCode().equals(assign.getAssignStatus()))
|
||||||
.map(TPerformanceAssignEntity::getAssignUser)
|
.map(TPerformanceAssignEntity::getAssignUser)
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
Map<String, TPerformanceAssignEntity> currentAssignMap = currentAssigns.stream()
|
Set<Short> usedAssignOrders = currentAssigns.stream()
|
||||||
.filter(assign -> requestedUserSet.contains(assign.getAssignUser()))
|
.filter(assign -> requestedUserSet.contains(assign.getAssignUser()))
|
||||||
.collect(Collectors.toMap(
|
.filter(assign -> !AssignConfirmStatus.REJECTED.getCode().equals(assign.getAssignStatus()))
|
||||||
TPerformanceAssignEntity::getAssignUser,
|
.map(TPerformanceAssignEntity::getAssignOrder)
|
||||||
Function.identity(),
|
.collect(Collectors.toSet());
|
||||||
(first, second) -> first
|
|
||||||
));
|
|
||||||
|
|
||||||
short assignOrder = 1;
|
|
||||||
for (String assignUser : normalizedAssignUsers) {
|
for (String assignUser : normalizedAssignUsers) {
|
||||||
if (!currentUserSet.contains(assignUser)) {
|
if (!currentUserSet.contains(assignUser)) {
|
||||||
|
short assignOrder = findAvailableAssignOrder(usedAssignOrders);
|
||||||
TPerformanceAssignEntity entity = new TPerformanceAssignEntity();
|
TPerformanceAssignEntity entity = new TPerformanceAssignEntity();
|
||||||
entity.setPerformanceId(performanceId);
|
entity.setPerformanceId(performanceId);
|
||||||
entity.setAssignType(1);
|
entity.setAssignType(1);
|
||||||
entity.setAssignOrder(assignOrder);
|
entity.setAssignOrder(assignOrder);
|
||||||
entity.setAssignUser(assignUser);
|
entity.setAssignUser(assignUser);
|
||||||
entity.setAssignConfirm(false);
|
entity.setAssignStatus(AssignConfirmStatus.REQUESTED.getCode());
|
||||||
entity.setRegUser(regUser);
|
entity.setRegUser(regUser);
|
||||||
entity.setRegDt(regDt);
|
entity.setRegDt(regDt);
|
||||||
performanceAssignRepository.save(entity);
|
performanceAssignRepository.save(entity);
|
||||||
} else {
|
usedAssignOrders.add(assignOrder);
|
||||||
currentAssignMap.get(assignUser).setAssignOrder(assignOrder);
|
|
||||||
}
|
}
|
||||||
assignOrder++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return performanceAssignRepository.findByPerformanceIdAndAssignType(performanceId, 1).stream()
|
return performanceAssignRepository.findByPerformanceIdAndAssignType(performanceId, 1).stream()
|
||||||
@@ -256,28 +267,55 @@ public class AssignService {
|
|||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
List<ExcelErrorDto> errorList = new ArrayList<>();
|
List<ExcelErrorDto> errorList = new ArrayList<>();
|
||||||
Set<Integer> uploadedPerformanceIds = new java.util.HashSet<>();
|
Set<Integer> uploadedPerformanceIds = new java.util.HashSet<>();
|
||||||
|
Set<Integer> existingPerformanceIds = performanceRepository.findAll().stream()
|
||||||
|
.map(TPerformanceEntity::getId)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
Set<String> existingUserIds = userRepository.findAll().stream()
|
||||||
|
.map(TUserEntity::getUserId)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
Map<Integer, List<TPerformanceAssignEntity>> currentWrittenAssignMap =
|
||||||
|
performanceAssignRepository.findAll().stream()
|
||||||
|
.filter(assign -> Objects.equals(assign.getAssignType(), 2))
|
||||||
|
.collect(Collectors.groupingBy(TPerformanceAssignEntity::getPerformanceId));
|
||||||
|
Set<String> reviewedAssignKeys = performanceReviewRepository.findAll().stream()
|
||||||
|
.map(review -> reviewKey(review.getPerformanceId(), review.getReviewType(), review.getRegUser()))
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
for (int i = 0; i < rows.size(); i++) {
|
for (int i = 0; i < rows.size(); i++) {
|
||||||
WrittenUserAssignDto row = rows.get(i);
|
WrittenUserAssignDto row = rows.get(i);
|
||||||
int rowNumber = i + 2;
|
int rowNumber = i + 2;
|
||||||
|
|
||||||
List<ExcelErrorDto> rowErrors = validateWrittenAssignRow(row, rowNumber);
|
List<ExcelErrorDto> rowErrors = validateWrittenAssignRow(
|
||||||
|
row,
|
||||||
|
rowNumber,
|
||||||
|
existingPerformanceIds,
|
||||||
|
existingUserIds
|
||||||
|
);
|
||||||
if (!rowErrors.isEmpty()) {
|
if (!rowErrors.isEmpty()) {
|
||||||
errorList.addAll(rowErrors);
|
errorList.addAll(rowErrors);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Integer performanceId = NumericUtil.parseOnlyInteger(row.getPerformanceId());
|
Integer performanceId = NumericUtil.parseOnlyInteger(row.getPerformanceId());
|
||||||
|
if (performanceId == null) {
|
||||||
|
errorList.add(ExcelErrorDto.of(rowNumber, "사업 연번", "사업 연번은 숫자로 입력해야 합니다."));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (performanceId % 100 != 1) {
|
||||||
|
errorList.add(ExcelErrorDto.of(rowNumber, "사업 연번", "사업 연번의 끝은 01로 끝나야 합니다."));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (!uploadedPerformanceIds.add(performanceId)) {
|
if (!uploadedPerformanceIds.add(performanceId)) {
|
||||||
errorList.add(ExcelErrorDto.of(rowNumber, "사업 연번", "하나의 사업에는 서면평가위원을 1명만 배정할 수 있습니다."));
|
errorList.add(ExcelErrorDto.of(rowNumber, "사업 연번", "하나의 사업에는 서면평가위원을 1명만 배정할 수 있습니다."));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<TPerformanceAssignEntity> currentAssigns =
|
List<TPerformanceAssignEntity> currentAssigns =
|
||||||
performanceAssignRepository.findByPerformanceIdAndAssignType(performanceId, 2);
|
currentWrittenAssignMap.getOrDefault(performanceId, Collections.emptyList());
|
||||||
boolean sameAssignExists = currentAssigns.size() == 1
|
boolean sameAssignExists = currentAssigns.size() == 1
|
||||||
&& Objects.equals(currentAssigns.get(0).getAssignUser(), row.getUserId());
|
&& Objects.equals(currentAssigns.get(0).getAssignUser(), row.getUserId());
|
||||||
if (!sameAssignExists && currentAssigns.stream().anyMatch(this::hasReview)) {
|
if (!sameAssignExists && currentAssigns.stream()
|
||||||
|
.anyMatch(assign -> reviewedAssignKeys.contains(reviewKey(assign)))) {
|
||||||
errorList.add(ExcelErrorDto.of(rowNumber, "사업 연번", "리뷰가 있는 배정은 변경할 수 없습니다."));
|
errorList.add(ExcelErrorDto.of(rowNumber, "사업 연번", "리뷰가 있는 배정은 변경할 수 없습니다."));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -294,7 +332,7 @@ public class AssignService {
|
|||||||
entity.setAssignType(2);
|
entity.setAssignType(2);
|
||||||
entity.setAssignOrder((short) 1);
|
entity.setAssignOrder((short) 1);
|
||||||
entity.setAssignUser(row.getUserId());
|
entity.setAssignUser(row.getUserId());
|
||||||
entity.setAssignConfirm(true);
|
entity.setAssignStatus(AssignConfirmStatus.CONFIRMED.getCode());
|
||||||
entity.setRegUser(regUser);
|
entity.setRegUser(regUser);
|
||||||
entity.setRegDt(regDt);
|
entity.setRegDt(regDt);
|
||||||
performanceAssignRepository.save(entity);
|
performanceAssignRepository.save(entity);
|
||||||
@@ -319,7 +357,9 @@ public class AssignService {
|
|||||||
|
|
||||||
private List<ExcelErrorDto> validateWrittenAssignRow(
|
private List<ExcelErrorDto> validateWrittenAssignRow(
|
||||||
WrittenUserAssignDto row,
|
WrittenUserAssignDto row,
|
||||||
int rowNumber
|
int rowNumber,
|
||||||
|
Set<Integer> existingPerformanceIds,
|
||||||
|
Set<String> existingUserIds
|
||||||
) {
|
) {
|
||||||
List<ExcelErrorDto> errors = new ArrayList<>();
|
List<ExcelErrorDto> errors = new ArrayList<>();
|
||||||
Integer performanceId = NumericUtil.parseOnlyInteger(row.getPerformanceId());
|
Integer performanceId = NumericUtil.parseOnlyInteger(row.getPerformanceId());
|
||||||
@@ -327,13 +367,13 @@ public class AssignService {
|
|||||||
|
|
||||||
if (performanceId == null) {
|
if (performanceId == null) {
|
||||||
errors.add(ExcelErrorDto.of(rowNumber, "사업 연번", "사업 연번은 숫자여야 합니다."));
|
errors.add(ExcelErrorDto.of(rowNumber, "사업 연번", "사업 연번은 숫자여야 합니다."));
|
||||||
} else if (!performanceRepository.existsById(performanceId)) {
|
} else if (!existingPerformanceIds.contains(performanceId)) {
|
||||||
errors.add(ExcelErrorDto.of(rowNumber, "사업 연번", "존재하지 않는 사업 연번입니다."));
|
errors.add(ExcelErrorDto.of(rowNumber, "사업 연번", "존재하지 않는 사업 연번입니다."));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StringUtil.isNullOrBlank(userId)) {
|
if (StringUtil.isNullOrBlank(userId)) {
|
||||||
errors.add(ExcelErrorDto.of(rowNumber, "사용자 ID", "사용자 ID가 비어 있습니다."));
|
errors.add(ExcelErrorDto.of(rowNumber, "사용자 ID", "사용자 ID가 비어 있습니다."));
|
||||||
} else if (!userRepository.existsByUserId(userId)) {
|
} else if (!existingUserIds.contains(userId)) {
|
||||||
errors.add(ExcelErrorDto.of(rowNumber, "사용자 ID", "존재하지 않는 사용자 ID입니다."));
|
errors.add(ExcelErrorDto.of(rowNumber, "사용자 ID", "존재하지 않는 사용자 ID입니다."));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -352,6 +392,14 @@ public class AssignService {
|
|||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private short findAvailableAssignOrder(Set<Short> usedAssignOrders) {
|
||||||
|
short assignOrder = 1;
|
||||||
|
while (usedAssignOrders.contains(assignOrder)) {
|
||||||
|
assignOrder++;
|
||||||
|
}
|
||||||
|
return assignOrder;
|
||||||
|
}
|
||||||
|
|
||||||
private void validateAssignableUser(Integer performanceId, String userId) {
|
private void validateAssignableUser(Integer performanceId, String userId) {
|
||||||
if (StringUtil.isNullOrBlank(userId)) {
|
if (StringUtil.isNullOrBlank(userId)) {
|
||||||
throw BusinessException.badRequest("EMPTY_USER_ID", "사용자 ID가 없습니다.");
|
throw BusinessException.badRequest("EMPTY_USER_ID", "사용자 ID가 없습니다.");
|
||||||
@@ -370,6 +418,14 @@ public class AssignService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String reviewKey(TPerformanceAssignEntity assign) {
|
||||||
|
return reviewKey(assign.getPerformanceId(), assign.getAssignType(), assign.getAssignUser());
|
||||||
|
}
|
||||||
|
|
||||||
|
private String reviewKey(Integer performanceId, Integer reviewType, String regUser) {
|
||||||
|
return performanceId + "|" + reviewType + "|" + regUser;
|
||||||
|
}
|
||||||
|
|
||||||
private void validateNoReviewBeforeAssignRemove(TPerformanceAssignEntity assign) {
|
private void validateNoReviewBeforeAssignRemove(TPerformanceAssignEntity assign) {
|
||||||
if (hasReview(assign)) {
|
if (hasReview(assign)) {
|
||||||
throw BusinessException.conflict("ASSIGN_HAS_REVIEW", "리뷰가 있는 배정은 해제하거나 삭제할 수 없습니다.")
|
throw BusinessException.conflict("ASSIGN_HAS_REVIEW", "리뷰가 있는 배정은 해제하거나 삭제할 수 없습니다.")
|
||||||
@@ -380,7 +436,10 @@ public class AssignService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public String confirmMonitoringAssignByUser(Integer performanceId, String assignUser) {
|
public String confirmMonitoringAssignByUser(Integer performanceId, String assignUser, boolean confirm) {
|
||||||
|
String assignText = confirm ? "승인" : "거절";
|
||||||
|
AssignConfirmStatus assignStatus = confirm ? AssignConfirmStatus.CONFIRMED : AssignConfirmStatus.REJECTED;
|
||||||
|
|
||||||
List<TPerformanceAssignEntity> assigns =
|
List<TPerformanceAssignEntity> assigns =
|
||||||
performanceAssignRepository.findByPerformanceIdAndAssignUserAndAssignType(
|
performanceAssignRepository.findByPerformanceIdAndAssignUserAndAssignType(
|
||||||
performanceId,
|
performanceId,
|
||||||
@@ -388,27 +447,34 @@ public class AssignService {
|
|||||||
1
|
1
|
||||||
);
|
);
|
||||||
|
|
||||||
if (assigns.isEmpty()) {
|
boolean hasRequested = assigns.stream()
|
||||||
return "승인 가능한 내용이 없습니다.";
|
.anyMatch(assign -> AssignConfirmStatus.REQUESTED.getCode().equals(assign.getAssignStatus()));
|
||||||
|
if (!hasRequested) {
|
||||||
|
return assignText + " 가능한 내용이 없습니다.";
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean alreadyConfirmed = assigns.stream()
|
if(confirm){
|
||||||
.anyMatch(assign -> Boolean.TRUE.equals(assign.getAssignConfirm()));
|
long confirmedCount = performanceAssignRepository
|
||||||
if (alreadyConfirmed) {
|
.countByPerformanceIdAndAssignTypeAndAssignStatus(
|
||||||
return "이미 승인된 내용입니다.";
|
performanceId,
|
||||||
}
|
1,
|
||||||
|
AssignConfirmStatus.CONFIRMED.getCode()
|
||||||
long confirmedCount = performanceAssignRepository
|
);
|
||||||
.countByPerformanceIdAndAssignTypeAndAssignConfirm(performanceId, 1, true);
|
if (confirmedCount >= 2) {
|
||||||
if (confirmedCount >= 2) {
|
return "이미 배정이 종료된 공연입니다.";
|
||||||
return "이미 배정이 종료된 공연입니다.";
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assigns.stream()
|
assigns.stream()
|
||||||
.filter(assign -> Boolean.FALSE.equals(assign.getAssignConfirm()))
|
.filter(assign -> AssignConfirmStatus.REQUESTED.getCode().equals(assign.getAssignStatus()))
|
||||||
.forEach(assign -> assign.setAssignConfirm(true));
|
.forEach(assign -> {
|
||||||
|
assign.setAssignStatus(assignStatus.getCode());
|
||||||
|
if(!confirm) {
|
||||||
|
assign.setAssignOrder(REJECT_ASSIGN_ORDER);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return "승인 처리 됐습니다.";
|
return assignText + " 처리 됐습니다.";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@@ -428,15 +494,21 @@ public class AssignService {
|
|||||||
.with("assignType", assign.getAssignType())
|
.with("assignType", assign.getAssignType())
|
||||||
.with("assignUser", assignUser);
|
.with("assignUser", assignUser);
|
||||||
}
|
}
|
||||||
if (confirm && Boolean.FALSE.equals(assign.getAssignConfirm())) {
|
if (confirm && !AssignConfirmStatus.CONFIRMED.getCode().equals(assign.getAssignStatus())) {
|
||||||
long confirmedCount = performanceAssignRepository
|
long confirmedCount = performanceAssignRepository
|
||||||
.countByPerformanceIdAndAssignTypeAndAssignConfirm(performanceId, assign.getAssignType(), true);
|
.countByPerformanceIdAndAssignTypeAndAssignStatus(
|
||||||
|
performanceId,
|
||||||
|
assign.getAssignType(),
|
||||||
|
AssignConfirmStatus.CONFIRMED.getCode()
|
||||||
|
);
|
||||||
if (assign.getAssignType() == 1 && confirmedCount >= 2) {
|
if (assign.getAssignType() == 1 && confirmedCount >= 2) {
|
||||||
throw BusinessException.conflict("MONITORING_ASSIGN_CONFIRM_LIMIT", "확정된 모니터링 요원은 최대 2명입니다.")
|
throw BusinessException.conflict("MONITORING_ASSIGN_CONFIRM_LIMIT", "확정된 모니터링 요원은 최대 2명입니다.")
|
||||||
.with("performanceId", performanceId);
|
.with("performanceId", performanceId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assign.setAssignConfirm(confirm);
|
assign.setAssignStatus(confirm
|
||||||
|
? AssignConfirmStatus.CONFIRMED.getCode()
|
||||||
|
: AssignConfirmStatus.REQUESTED.getCode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,16 +20,23 @@ import com.kri.gwcf.review.back.dto.performance.PerformanceCompactDto;
|
|||||||
import com.kri.gwcf.review.back.dto.performance.PerformanceAssignDto;
|
import com.kri.gwcf.review.back.dto.performance.PerformanceAssignDto;
|
||||||
import com.kri.gwcf.review.back.dto.performance.PerformanceFullDto;
|
import com.kri.gwcf.review.back.dto.performance.PerformanceFullDto;
|
||||||
import com.kri.gwcf.review.back.dto.performance.PerformanceMonitoringScheduleDto;
|
import com.kri.gwcf.review.back.dto.performance.PerformanceMonitoringScheduleDto;
|
||||||
|
import com.kri.gwcf.review.back.dto.performance.PerformanceMonitoringVisitDto;
|
||||||
import com.kri.gwcf.review.back.dto.performance.PerformanceReviewDto;
|
import com.kri.gwcf.review.back.dto.performance.PerformanceReviewDto;
|
||||||
import com.kri.gwcf.review.back.dto.performance.PerformanceStaffDto;
|
import com.kri.gwcf.review.back.dto.performance.PerformanceStaffDto;
|
||||||
|
import com.kri.gwcf.review.back.persistence.entity.TPerformanceAssignEntity;
|
||||||
import com.kri.gwcf.review.back.persistence.entity.TPerformanceDetailEntity;
|
import com.kri.gwcf.review.back.persistence.entity.TPerformanceDetailEntity;
|
||||||
import com.kri.gwcf.review.back.persistence.entity.TPerformanceEntity;
|
import com.kri.gwcf.review.back.persistence.entity.TPerformanceEntity;
|
||||||
import com.kri.gwcf.review.back.persistence.entity.TPerformanceMonitoringScheduleEntity;
|
import com.kri.gwcf.review.back.persistence.entity.TPerformanceMonitoringScheduleEntity;
|
||||||
|
import com.kri.gwcf.review.back.persistence.entity.TPerformanceMonitoringVisitEntity;
|
||||||
|
import com.kri.gwcf.review.back.persistence.entity.TPerformanceReviewEntity;
|
||||||
import com.kri.gwcf.review.back.persistence.entity.TPerformanceStaffEntity;
|
import com.kri.gwcf.review.back.persistence.entity.TPerformanceStaffEntity;
|
||||||
import com.kri.gwcf.review.back.persistence.mapper.kon.KonMapper;
|
import com.kri.gwcf.review.back.persistence.mapper.kon.KonMapper;
|
||||||
|
import com.kri.gwcf.review.back.persistence.repository.PerformanceAssignRepository;
|
||||||
import com.kri.gwcf.review.back.persistence.repository.PerformanceDetailRepository;
|
import com.kri.gwcf.review.back.persistence.repository.PerformanceDetailRepository;
|
||||||
import com.kri.gwcf.review.back.persistence.repository.PerformanceMonitoringScheduleRepository;
|
import com.kri.gwcf.review.back.persistence.repository.PerformanceMonitoringScheduleRepository;
|
||||||
|
import com.kri.gwcf.review.back.persistence.repository.PerformanceMonitoringVisitRepository;
|
||||||
import com.kri.gwcf.review.back.persistence.repository.PerformanceRepository;
|
import com.kri.gwcf.review.back.persistence.repository.PerformanceRepository;
|
||||||
|
import com.kri.gwcf.review.back.persistence.repository.PerformanceReviewRepository;
|
||||||
import com.kri.gwcf.review.back.persistence.repository.PerformanceStaffRepository;
|
import com.kri.gwcf.review.back.persistence.repository.PerformanceStaffRepository;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@@ -37,6 +44,7 @@ import java.time.format.DateTimeFormatter;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -63,6 +71,9 @@ public class PerformanceService {
|
|||||||
private final PerformanceDetailRepository performanceDetailRepository;
|
private final PerformanceDetailRepository performanceDetailRepository;
|
||||||
private final PerformanceStaffRepository performanceStaffRepository;
|
private final PerformanceStaffRepository performanceStaffRepository;
|
||||||
private final PerformanceMonitoringScheduleRepository performanceMonitoringScheduleRepository;
|
private final PerformanceMonitoringScheduleRepository performanceMonitoringScheduleRepository;
|
||||||
|
private final PerformanceAssignRepository performanceAssignRepository;
|
||||||
|
private final PerformanceMonitoringVisitRepository performanceMonitoringVisitRepository;
|
||||||
|
private final PerformanceReviewRepository performanceReviewRepository;
|
||||||
private final CodeService codeService;
|
private final CodeService codeService;
|
||||||
private final AssignService assignService;
|
private final AssignService assignService;
|
||||||
private final ReviewService reviewService;
|
private final ReviewService reviewService;
|
||||||
@@ -77,14 +88,28 @@ public class PerformanceService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<PerformanceFullDto> getPerformanceList() {
|
public List<PerformanceFullDto> getPerformanceList() {
|
||||||
return performanceRepository.findAll().stream()
|
List<TPerformanceEntity> performances = performanceRepository.findAll();
|
||||||
.map(this::toFullDto)
|
PerformanceFullLookup lookup = buildPerformanceFullLookup();
|
||||||
|
|
||||||
|
return performances.stream()
|
||||||
|
.map(performance -> toFullDto(performance, lookup))
|
||||||
|
.sorted(Comparator.comparing(
|
||||||
|
this::getPerformanceNoForSort,
|
||||||
|
Comparator.nullsLast(Integer::compareTo)
|
||||||
|
))
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PerformanceCompactDto> getPerformanceCompactList() {
|
public List<PerformanceCompactDto> getPerformanceCompactList() {
|
||||||
return performanceRepository.findAll().stream()
|
List<TPerformanceEntity> performances = performanceRepository.findAll();
|
||||||
.map(this::toCompactDto)
|
PerformanceCompactLookup lookup = buildPerformanceCompactLookup();
|
||||||
|
|
||||||
|
return performances.stream()
|
||||||
|
.map(performance -> toCompactDto(performance, lookup))
|
||||||
|
.sorted(Comparator.comparing(
|
||||||
|
this::getPerformanceNoForSort,
|
||||||
|
Comparator.nullsLast(Integer::compareTo)
|
||||||
|
))
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,6 +145,9 @@ public class PerformanceService {
|
|||||||
int totalCount = rows.size();
|
int totalCount = rows.size();
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
List<ExcelErrorDto> errorList = new ArrayList<>();
|
List<ExcelErrorDto> errorList = new ArrayList<>();
|
||||||
|
Set<Integer> existingPerformanceIds = performanceRepository.findAll().stream()
|
||||||
|
.map(TPerformanceEntity::getId)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
for (int i = 0; i < rows.size(); i++) {
|
for (int i = 0; i < rows.size(); i++) {
|
||||||
PerformanceUploadDto row = rows.get(i);
|
PerformanceUploadDto row = rows.get(i);
|
||||||
@@ -131,7 +159,8 @@ public class PerformanceService {
|
|||||||
businessTypeList,
|
businessTypeList,
|
||||||
genreList,
|
genreList,
|
||||||
areaList,
|
areaList,
|
||||||
ticketReservationStatusList
|
ticketReservationStatusList,
|
||||||
|
existingPerformanceIds
|
||||||
);
|
);
|
||||||
if (!rowErrors.isEmpty()) {
|
if (!rowErrors.isEmpty()) {
|
||||||
errorList.addAll(rowErrors);
|
errorList.addAll(rowErrors);
|
||||||
@@ -140,6 +169,7 @@ public class PerformanceService {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
createPerformanceInternal(row, regUser, regDt);
|
createPerformanceInternal(row, regUser, regDt);
|
||||||
|
existingPerformanceIds.add(NumericUtil.parseOnlyInteger(row.getPerformanceId()));
|
||||||
successCount++;
|
successCount++;
|
||||||
} catch (BusinessException e) {
|
} catch (BusinessException e) {
|
||||||
errorList.add(ExcelErrorDto.of(rowNumber, "SYSTEM", e.getMessage()));
|
errorList.add(ExcelErrorDto.of(rowNumber, "SYSTEM", e.getMessage()));
|
||||||
@@ -395,6 +425,22 @@ public class PerformanceService {
|
|||||||
return value == null ? null : String.valueOf(value);
|
return value == null ? null : String.valueOf(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Integer getPerformanceNoForSort(PerformanceFullDto performance) {
|
||||||
|
if (performance == null || performance.getPerformanceDetail() == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NumericUtil.parseOnlyInteger(performance.getPerformanceDetail().get("performanceNo"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private Integer getPerformanceNoForSort(PerformanceCompactDto performance) {
|
||||||
|
if (performance == null || performance.getPerformanceDetail() == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NumericUtil.parseOnlyInteger(performance.getPerformanceDetail().get("performanceNo"));
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional(readOnly = true, transactionManager = "konTransactionManager")
|
@Transactional(readOnly = true, transactionManager = "konTransactionManager")
|
||||||
public List<PerformanceApplyCountDto> findPerformanceApplyCount() {
|
public List<PerformanceApplyCountDto> findPerformanceApplyCount() {
|
||||||
return konMapper.findPerformanceApplyCount(surveyType);
|
return konMapper.findPerformanceApplyCount(surveyType);
|
||||||
@@ -414,6 +460,20 @@ public class PerformanceService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private PerformanceFullDto toFullDto(TPerformanceEntity performance, PerformanceFullLookup lookup) {
|
||||||
|
Integer performanceId = performance.getId();
|
||||||
|
|
||||||
|
return PerformanceFullDto.from(
|
||||||
|
performance,
|
||||||
|
lookup.performanceDetailMap().getOrDefault(performanceId, Collections.emptyMap()),
|
||||||
|
lookup.performanceStaffMap().getOrDefault(performanceId, Collections.emptyList()),
|
||||||
|
lookup.performanceMonitoringScheduleMap().get(performanceId),
|
||||||
|
lookup.performanceAssignMap().getOrDefault(performanceId, Collections.emptyList()),
|
||||||
|
lookup.performanceMonitoringVisitMap().getOrDefault(performanceId, Collections.emptyMap()),
|
||||||
|
lookup.performanceReviewMap().getOrDefault(performanceId, Collections.emptyMap())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
private PerformanceCompactDto toCompactDto(TPerformanceEntity performance) {
|
private PerformanceCompactDto toCompactDto(TPerformanceEntity performance) {
|
||||||
Integer performanceId = performance.getId();
|
Integer performanceId = performance.getId();
|
||||||
|
|
||||||
@@ -426,20 +486,126 @@ public class PerformanceService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private PerformanceCompactDto toCompactDto(
|
||||||
|
TPerformanceEntity performance,
|
||||||
|
PerformanceCompactLookup lookup
|
||||||
|
) {
|
||||||
|
Integer performanceId = performance.getId();
|
||||||
|
|
||||||
|
return PerformanceCompactDto.from(
|
||||||
|
performance,
|
||||||
|
lookup.performanceDetailMap().getOrDefault(performanceId, Collections.emptyMap()),
|
||||||
|
lookup.performanceStaffMap().getOrDefault(performanceId, Collections.emptyList()),
|
||||||
|
lookup.performanceMonitoringScheduleMap().get(performanceId)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private PerformanceFullLookup buildPerformanceFullLookup() {
|
||||||
|
PerformanceCompactLookup compactLookup = buildPerformanceCompactLookup();
|
||||||
|
Map<Integer, List<PerformanceAssignDto>> assignMap = performanceAssignRepository.findAll()
|
||||||
|
.stream()
|
||||||
|
.collect(Collectors.groupingBy(
|
||||||
|
TPerformanceAssignEntity::getPerformanceId,
|
||||||
|
Collectors.mapping(PerformanceAssignDto::from, Collectors.toList())
|
||||||
|
));
|
||||||
|
Map<Integer, Map<String, List<PerformanceMonitoringVisitDto>>> visitMap =
|
||||||
|
performanceMonitoringVisitRepository.findAll()
|
||||||
|
.stream()
|
||||||
|
.collect(Collectors.groupingBy(
|
||||||
|
TPerformanceMonitoringVisitEntity::getPerformanceId,
|
||||||
|
Collectors.groupingBy(
|
||||||
|
TPerformanceMonitoringVisitEntity::getRegUser,
|
||||||
|
Collectors.mapping(PerformanceMonitoringVisitDto::from, Collectors.toList())
|
||||||
|
)
|
||||||
|
));
|
||||||
|
Map<Integer, Map<String, List<PerformanceReviewDto>>> reviewMap =
|
||||||
|
performanceReviewRepository.findAll()
|
||||||
|
.stream()
|
||||||
|
.collect(Collectors.groupingBy(
|
||||||
|
TPerformanceReviewEntity::getPerformanceId,
|
||||||
|
Collectors.groupingBy(
|
||||||
|
TPerformanceReviewEntity::getRegUser,
|
||||||
|
Collectors.mapping(PerformanceReviewDto::from, Collectors.toList())
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
return new PerformanceFullLookup(
|
||||||
|
compactLookup.performanceDetailMap(),
|
||||||
|
compactLookup.performanceStaffMap(),
|
||||||
|
compactLookup.performanceMonitoringScheduleMap(),
|
||||||
|
assignMap,
|
||||||
|
visitMap,
|
||||||
|
reviewMap
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private PerformanceCompactLookup buildPerformanceCompactLookup() {
|
||||||
|
Map<Integer, Map<String, String>> detailMap = performanceDetailRepository.findAll()
|
||||||
|
.stream()
|
||||||
|
.collect(Collectors.groupingBy(
|
||||||
|
TPerformanceDetailEntity::getPerformanceId,
|
||||||
|
toMap(
|
||||||
|
TPerformanceDetailEntity::getPerformanceDetailKey,
|
||||||
|
TPerformanceDetailEntity::getPerformanceDetailValue,
|
||||||
|
(left, right) -> right,
|
||||||
|
LinkedHashMap::new
|
||||||
|
)
|
||||||
|
));
|
||||||
|
Map<Integer, List<PerformanceStaffDto>> staffMap = performanceStaffRepository.findAll()
|
||||||
|
.stream()
|
||||||
|
.collect(Collectors.groupingBy(
|
||||||
|
TPerformanceStaffEntity::getPerformanceId,
|
||||||
|
Collectors.mapping(PerformanceStaffDto::from, Collectors.toList())
|
||||||
|
));
|
||||||
|
Map<Integer, PerformanceMonitoringScheduleDto> scheduleMap =
|
||||||
|
performanceMonitoringScheduleRepository.findAll()
|
||||||
|
.stream()
|
||||||
|
.collect(toMap(
|
||||||
|
TPerformanceMonitoringScheduleEntity::getPerformanceId,
|
||||||
|
PerformanceMonitoringScheduleDto::from,
|
||||||
|
(first, ignored) -> first
|
||||||
|
));
|
||||||
|
|
||||||
|
return new PerformanceCompactLookup(detailMap, staffMap, scheduleMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
private record PerformanceCompactLookup(
|
||||||
|
Map<Integer, Map<String, String>> performanceDetailMap,
|
||||||
|
Map<Integer, List<PerformanceStaffDto>> performanceStaffMap,
|
||||||
|
Map<Integer, PerformanceMonitoringScheduleDto> performanceMonitoringScheduleMap
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
private record PerformanceFullLookup(
|
||||||
|
Map<Integer, Map<String, String>> performanceDetailMap,
|
||||||
|
Map<Integer, List<PerformanceStaffDto>> performanceStaffMap,
|
||||||
|
Map<Integer, PerformanceMonitoringScheduleDto> performanceMonitoringScheduleMap,
|
||||||
|
Map<Integer, List<PerformanceAssignDto>> performanceAssignMap,
|
||||||
|
Map<Integer, Map<String, List<PerformanceMonitoringVisitDto>>> performanceMonitoringVisitMap,
|
||||||
|
Map<Integer, Map<String, List<PerformanceReviewDto>>> performanceReviewMap
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
private List<ExcelErrorDto> validatePerformanceUploadRow(
|
private List<ExcelErrorDto> validatePerformanceUploadRow(
|
||||||
PerformanceUploadDto row,
|
PerformanceUploadDto row,
|
||||||
int rowNumber,
|
int rowNumber,
|
||||||
List<CodeDto> businessTypeList,
|
List<CodeDto> businessTypeList,
|
||||||
List<CodeDto> genreList,
|
List<CodeDto> genreList,
|
||||||
List<CodeDto> areaList,
|
List<CodeDto> areaList,
|
||||||
List<CodeDto> ticketReservationStatusList
|
List<CodeDto> ticketReservationStatusList,
|
||||||
|
Set<Integer> existingPerformanceIds
|
||||||
) {
|
) {
|
||||||
List<ExcelErrorDto> errors = new ArrayList<>();
|
List<ExcelErrorDto> errors = new ArrayList<>();
|
||||||
|
|
||||||
|
Integer performanceNo = NumericUtil.parseOnlyInteger(row.getPerformanceNo());
|
||||||
|
if (performanceNo == null) {
|
||||||
|
errors.add(ExcelErrorDto.of(rowNumber, "No", "No는 숫자여야 합니다."));
|
||||||
|
}
|
||||||
|
|
||||||
Integer performanceId = NumericUtil.parseOnlyInteger(row.getPerformanceId());
|
Integer performanceId = NumericUtil.parseOnlyInteger(row.getPerformanceId());
|
||||||
if (performanceId == null) {
|
if (performanceId == null) {
|
||||||
errors.add(ExcelErrorDto.of(rowNumber, "연번", "연번은 숫자여야 합니다."));
|
errors.add(ExcelErrorDto.of(rowNumber, "연번", "연번은 숫자여야 합니다."));
|
||||||
} else if (performanceRepository.existsById(performanceId)) {
|
} else if (existingPerformanceIds.contains(performanceId)) {
|
||||||
errors.add(ExcelErrorDto.of(rowNumber, "연번", "이미 등록된 공연 ID입니다."));
|
errors.add(ExcelErrorDto.of(rowNumber, "연번", "이미 등록된 공연 ID입니다."));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -455,20 +621,25 @@ public class PerformanceService {
|
|||||||
);
|
);
|
||||||
|
|
||||||
Integer performanceStartMonth = NumericUtil.parseOnlyInteger(row.getPerformanceStartMonth());
|
Integer performanceStartMonth = NumericUtil.parseOnlyInteger(row.getPerformanceStartMonth());
|
||||||
if (performanceStartMonth == null || performanceStartMonth < 1 || performanceStartMonth > 12) {
|
if(performanceStartMonth == null){
|
||||||
|
performanceStartMonth = 0;
|
||||||
|
}
|
||||||
|
else if (performanceStartMonth < 1 || performanceStartMonth > 12) {
|
||||||
errors.add(ExcelErrorDto.of(rowNumber, "사업 수행 월", "사업 수행 월은 1~12 사이 숫자여야 합니다."));
|
errors.add(ExcelErrorDto.of(rowNumber, "사업 수행 월", "사업 수행 월은 1~12 사이 숫자여야 합니다."));
|
||||||
}
|
}
|
||||||
|
|
||||||
String md = row.getMonitoringDate();
|
String monitoringDate = row.getMonitoringDate();
|
||||||
if (DateTimeUtil.parseLocalDate(row.getMonitoringDate()) == null) {
|
if (!StringUtil.isNullOrBlank(monitoringDate) && DateTimeUtil.parseLocalDate(monitoringDate) == null) {
|
||||||
errors.add(ExcelErrorDto.of(rowNumber, "모니터링 일정", "모니터링 일정은 yyyy-MM-dd 형식이어야 합니다."));
|
errors.add(ExcelErrorDto.of(rowNumber, "모니터링 일정", "모니터링 일정은 yyyy-MM-dd 형식이어야 합니다."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String timeTreeCheckDt = row.getTimeTreeCheckDt();
|
||||||
|
if (!StringUtil.isNullOrBlank(timeTreeCheckDt) && DateTimeUtil.parseLocalDate(timeTreeCheckDt) == null) {
|
||||||
|
errors.add(ExcelErrorDto.of(rowNumber, "타임트리 확인일시", "타임트리 확인일시는 yyyy-MM-dd 형식이어야 합니다."));
|
||||||
|
}
|
||||||
|
|
||||||
validateRequired(errors, rowNumber, "단체(인) 명", row.getArtistName());
|
validateRequired(errors, rowNumber, "단체(인) 명", row.getArtistName());
|
||||||
validateRequired(errors, rowNumber, "사업 명", row.getPerformanceName());
|
validateRequired(errors, rowNumber, "사업 명", row.getPerformanceName());
|
||||||
validateRequired(errors, rowNumber, "사업 일정", row.getPerformanceDtInfo());
|
|
||||||
validateRequired(errors, rowNumber, "운영 시간", row.getPerformanceTimeInfo());
|
|
||||||
validateRequired(errors, rowNumber, "모니터링 시간", row.getMonitoringTimeInfo());
|
|
||||||
validateRequired(errors, rowNumber, "모니터링 방문 장소", row.getMonitoringAddress());
|
validateRequired(errors, rowNumber, "모니터링 방문 장소", row.getMonitoringAddress());
|
||||||
|
|
||||||
validateStaff(errors, rowNumber, "대표자", row.getOwnStaffName(),
|
validateStaff(errors, rowNumber, "대표자", row.getOwnStaffName(),
|
||||||
@@ -486,6 +657,11 @@ public class PerformanceService {
|
|||||||
) {
|
) {
|
||||||
Integer performanceId = NumericUtil.parseOnlyInteger(row.getPerformanceId());
|
Integer performanceId = NumericUtil.parseOnlyInteger(row.getPerformanceId());
|
||||||
|
|
||||||
|
Integer performanceStartMonth = NumericUtil.parseOnlyInteger(row.getPerformanceStartMonth());
|
||||||
|
if(performanceStartMonth == null){
|
||||||
|
performanceStartMonth = 0;
|
||||||
|
}
|
||||||
|
|
||||||
TPerformanceEntity performance = TPerformanceEntity.builder()
|
TPerformanceEntity performance = TPerformanceEntity.builder()
|
||||||
.id(performanceId)
|
.id(performanceId)
|
||||||
.businessType(NumericUtil.parseOnlyInteger(row.getBusinessType()))
|
.businessType(NumericUtil.parseOnlyInteger(row.getBusinessType()))
|
||||||
@@ -493,7 +669,7 @@ public class PerformanceService {
|
|||||||
.performanceArea(NumericUtil.parseOnlyInteger(row.getPerformanceArea()))
|
.performanceArea(NumericUtil.parseOnlyInteger(row.getPerformanceArea()))
|
||||||
.artistName(Objects.toString(StringUtil.normalizeBlank(row.getArtistName()), ""))
|
.artistName(Objects.toString(StringUtil.normalizeBlank(row.getArtistName()), ""))
|
||||||
.performanceName(Objects.toString(StringUtil.normalizeBlank(row.getPerformanceName()), ""))
|
.performanceName(Objects.toString(StringUtil.normalizeBlank(row.getPerformanceName()), ""))
|
||||||
.performanceStartMonth(NumericUtil.parseOnlyInteger(row.getPerformanceStartMonth()))
|
.performanceStartMonth(performanceStartMonth)
|
||||||
.performanceDtInfo(Objects.toString(StringUtil.normalizeBlank(row.getPerformanceDtInfo()), ""))
|
.performanceDtInfo(Objects.toString(StringUtil.normalizeBlank(row.getPerformanceDtInfo()), ""))
|
||||||
.performanceTimeInfo(Objects.toString(StringUtil.normalizeBlank(row.getPerformanceTimeInfo()), ""))
|
.performanceTimeInfo(Objects.toString(StringUtil.normalizeBlank(row.getPerformanceTimeInfo()), ""))
|
||||||
.ticketReservationStatus(NumericUtil.parseOnlyInteger(row.getTicketReservationStatus()))
|
.ticketReservationStatus(NumericUtil.parseOnlyInteger(row.getTicketReservationStatus()))
|
||||||
@@ -518,6 +694,15 @@ public class PerformanceService {
|
|||||||
Map<String, String> detail = new LinkedHashMap<>();
|
Map<String, String> detail = new LinkedHashMap<>();
|
||||||
detail.put("monitoringPaymentDate", Objects.toString(StringUtil.normalizeBlank(row.getMonitoringPaymentDate()), ""));
|
detail.put("monitoringPaymentDate", Objects.toString(StringUtil.normalizeBlank(row.getMonitoringPaymentDate()), ""));
|
||||||
|
|
||||||
|
detail.put("performanceNo", Objects.toString(StringUtil.normalizeBlank(row.getPerformanceNo()), ""));
|
||||||
|
detail.put("performanceAreaDetail", Objects.toString(StringUtil.normalizeBlank(row.getPerformanceAreaDetail()), ""));
|
||||||
|
detail.put("needMonitoring", Objects.toString(StringUtil.normalizeBlank(row.getNeedMonitoring()), ""));
|
||||||
|
detail.put("needWrittenReview", Objects.toString(StringUtil.normalizeBlank(row.getNeedWrittenReview()), ""));
|
||||||
|
detail.put("checkDeliver", Objects.toString(StringUtil.normalizeBlank(row.getCheckDeliver()), ""));
|
||||||
|
detail.put("timeTreeCheckDt", Objects.toString(StringUtil.normalizeBlank(row.getTimeTreeCheckDt()), ""));
|
||||||
|
detail.put("checkReport", Objects.toString(StringUtil.normalizeBlank(row.getCheckReport()), ""));
|
||||||
|
|
||||||
|
|
||||||
List<TPerformanceDetailEntity> detailEntities = detail.entrySet().stream()
|
List<TPerformanceDetailEntity> detailEntities = detail.entrySet().stream()
|
||||||
.map(entry -> TPerformanceDetailEntity.update(
|
.map(entry -> TPerformanceDetailEntity.update(
|
||||||
performanceId,
|
performanceId,
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.zip.ZipEntry;
|
||||||
|
import java.util.zip.ZipOutputStream;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.core.io.PathResource;
|
import org.springframework.core.io.PathResource;
|
||||||
@@ -180,8 +182,89 @@ public class ReviewService extends AbstractFileService {
|
|||||||
return toResource(reviewDir(performanceId, reviewType).resolve(entity.getUploadFileName()));
|
return toResource(reviewDir(performanceId, reviewType).resolve(entity.getUploadFileName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getOriginalFileName(Integer performanceId, Integer reviewType, String userId) {
|
public PathResource getOriginalFileZipResource(Integer performanceId, Integer reviewType) {
|
||||||
return removeTimestampPrefix(getReviewEntity(performanceId, reviewType, userId).getUploadFileName());
|
List<TPerformanceReviewEntity> reviews = performanceReviewRepository.findAll()
|
||||||
|
.stream()
|
||||||
|
.filter(review -> isSamePerformanceGroup(performanceId, review.getPerformanceId()))
|
||||||
|
.filter(review -> Integer.valueOf(reviewType).equals(review.getReviewType()))
|
||||||
|
.filter(review -> StringUtil.hasText(review.getUploadFileName()))
|
||||||
|
.toList();
|
||||||
|
if (reviews.isEmpty()) {
|
||||||
|
throw BusinessException.notFound("REVIEW_FILE_NOT_FOUND", "평가/모니터링 파일이 없습니다.")
|
||||||
|
.with("performanceId", performanceId)
|
||||||
|
.with("reviewType", reviewType);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Path zip = Files.createTempFile(getOriginalFileZipBaseName(performanceId, reviewType), ".zip");
|
||||||
|
int entryCount = 0;
|
||||||
|
try (ZipOutputStream out = new ZipOutputStream(Files.newOutputStream(zip))) {
|
||||||
|
Set<String> entryNames = new HashSet<>();
|
||||||
|
for (TPerformanceReviewEntity review : reviews) {
|
||||||
|
Path sourceDir = reviewDir(review.getPerformanceId(), reviewType);
|
||||||
|
Path source = sourceDir.resolve(review.getUploadFileName()).normalize();
|
||||||
|
if (!source.startsWith(sourceDir) || !Files.exists(source) || !Files.isRegularFile(source)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
String entryName = buildZipEntryName(review, entryNames);
|
||||||
|
out.putNextEntry(new ZipEntry(entryName));
|
||||||
|
Files.copy(source, out);
|
||||||
|
out.closeEntry();
|
||||||
|
entryCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entryCount == 0) {
|
||||||
|
Files.deleteIfExists(zip);
|
||||||
|
throw BusinessException.notFound("REVIEW_FILE_NOT_FOUND", "평가/모니터링 파일이 없습니다.")
|
||||||
|
.with("performanceId", performanceId)
|
||||||
|
.with("reviewType", reviewType);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new PathResource(zip);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw BusinessException.internalError("REVIEW_FILE_ZIP_FAILED", "평가/모니터링 파일 압축 중 오류가 발생했습니다.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String buildZipEntryName(TPerformanceReviewEntity review, Set<String> entryNames) {
|
||||||
|
String userId = StringUtil.isNullOrBlank(review.getRegUser()) ? "user" : review.getRegUser();
|
||||||
|
String fileName = removeTimestampPrefix(review.getUploadFileName());
|
||||||
|
String entryName = sanitizeZipEntryName(review.getPerformanceId() + "_" + userId + "_" + fileName);
|
||||||
|
if (entryNames.add(entryName)) {
|
||||||
|
return entryName;
|
||||||
|
}
|
||||||
|
|
||||||
|
String baseName = stripExtension(entryName);
|
||||||
|
String extension = extractExtension(entryName);
|
||||||
|
int index = 2;
|
||||||
|
while (true) {
|
||||||
|
String candidate = baseName + "_" + index + extension;
|
||||||
|
if (entryNames.add(candidate)) {
|
||||||
|
return candidate;
|
||||||
|
}
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String sanitizeZipEntryName(String fileName) {
|
||||||
|
String sanitized = Path.of(fileName).getFileName().toString()
|
||||||
|
.replace('\\', '_')
|
||||||
|
.replace('/', '_');
|
||||||
|
return StringUtil.isNullOrBlank(sanitized) ? "review-file" : sanitized;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getOriginalFileZipBaseName(Integer performanceId, Integer reviewType) {
|
||||||
|
return "review_" + performanceId + "_" + reviewType;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isSamePerformanceGroup(Integer requestedPerformanceId, Integer targetPerformanceId) {
|
||||||
|
if (requestedPerformanceId == null || targetPerformanceId == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return requestedPerformanceId / 100 == targetPerformanceId / 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PathResource getPdfOrOriginalFileResource(Integer performanceId, Integer reviewType, String userId) {
|
public PathResource getPdfOrOriginalFileResource(Integer performanceId, Integer reviewType, String userId) {
|
||||||
@@ -192,14 +275,6 @@ public class ReviewService extends AbstractFileService {
|
|||||||
return toResource(reviewDir(performanceId, reviewType).resolve(fileName));
|
return toResource(reviewDir(performanceId, reviewType).resolve(fileName));
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPdfOrOriginalFileName(Integer performanceId, Integer reviewType, String userId) {
|
|
||||||
TPerformanceReviewEntity entity = getReviewEntity(performanceId, reviewType, userId);
|
|
||||||
String fileName = StringUtil.isNullOrBlank(entity.getPdfFileName())
|
|
||||||
? entity.getUploadFileName()
|
|
||||||
: entity.getPdfFileName();
|
|
||||||
return removeTimestampPrefix(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
private TPerformanceReviewEntity getReviewEntity(Integer performanceId, Integer reviewType, String userId) {
|
private TPerformanceReviewEntity getReviewEntity(Integer performanceId, Integer reviewType, String userId) {
|
||||||
return performanceReviewRepository.findByIdPerformanceIdAndIdReviewTypeAndIdRegUser(
|
return performanceReviewRepository.findByIdPerformanceIdAndIdReviewTypeAndIdRegUser(
|
||||||
performanceId,
|
performanceId,
|
||||||
@@ -230,7 +305,7 @@ public class ReviewService extends AbstractFileService {
|
|||||||
|
|
||||||
private String convertToPdfIfPossible(Path source, Path dir) {
|
private String convertToPdfIfPossible(Path source, Path dir) {
|
||||||
String extension = extractExtension(source.getFileName().toString()).toLowerCase();
|
String extension = extractExtension(source.getFileName().toString()).toLowerCase();
|
||||||
Set<String> targets = new HashSet<>(Set.of(".docx", ".hwpx", ".pptx", ".xlsx"));
|
Set<String> targets = new HashSet<>(Set.of(".docx", ".hwpx", ".hwp", ".pptx", ".xlsx"));
|
||||||
if (!targets.contains(extension)) {
|
if (!targets.contains(extension)) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
package com.kri.gwcf.review.back.service;
|
package com.kri.gwcf.review.back.service;
|
||||||
|
|
||||||
|
import static com.kri.gwcf.review.back.common.consts.GwcfConstant.REVIEW_CLASSIFICATION;
|
||||||
|
import static com.kri.gwcf.review.back.common.consts.GwcfConstant.REVIEW_TYPE;
|
||||||
|
|
||||||
import com.kri.common.feature.util.StringUtil;
|
import com.kri.common.feature.util.StringUtil;
|
||||||
import com.kri.common.feature.web.BusinessException;
|
import com.kri.common.feature.web.BusinessException;
|
||||||
import com.kri.gwcf.review.back.config.FileStorageProperties;
|
import com.kri.gwcf.review.back.config.FileStorageProperties;
|
||||||
@@ -7,8 +10,13 @@ import com.kri.gwcf.review.back.service.file.AbstractFileService;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.core.io.PathResource;
|
import org.springframework.core.io.PathResource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
@@ -19,6 +27,9 @@ public class ReviewTemplateService extends AbstractFileService {
|
|||||||
|
|
||||||
private final FileStorageProperties fileStorageProperties;
|
private final FileStorageProperties fileStorageProperties;
|
||||||
|
|
||||||
|
@Value("${kri.file.pdf-converter-command:soffice}")
|
||||||
|
private String pdfConverterCommand;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Path getBaseDir() {
|
protected Path getBaseDir() {
|
||||||
return Path.of(fileStorageProperties.getReviewTemplateBaseDir())
|
return Path.of(fileStorageProperties.getReviewTemplateBaseDir())
|
||||||
@@ -26,36 +37,42 @@ public class ReviewTemplateService extends AbstractFileService {
|
|||||||
.normalize();
|
.normalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String uploadReviewTemplate(Integer reviewType, MultipartFile file) {
|
public String uploadReviewTemplate(Integer reviewType, Integer classification, MultipartFile file) {
|
||||||
validateReviewTemplateType(reviewType);
|
validateReviewTemplateType(reviewType);
|
||||||
|
validateReviewTemplateClassification(classification);
|
||||||
if (file == null || file.isEmpty()) {
|
if (file == null || file.isEmpty()) {
|
||||||
throw BusinessException.badRequest("EMPTY_FILE", "업로드된 파일이 없습니다.");
|
throw BusinessException.badRequest("EMPTY_FILE", "업로드된 파일이 없습니다.");
|
||||||
}
|
}
|
||||||
|
|
||||||
String fileName = sanitizeFileName(file.getOriginalFilename());
|
String fileName = sanitizeFileName(file.getOriginalFilename());
|
||||||
Path dir = templateDir(reviewType);
|
Path dir = templateDir(reviewType, classification);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
deleteExistingFiles(dir);
|
deleteExistingFiles(dir);
|
||||||
saveFile(dir, file, fileName);
|
saveFile(dir, file, fileName);
|
||||||
|
Path uploadPath = dir.resolve(fileName).normalize();
|
||||||
|
convertToPdfIfPossible(uploadPath, dir);
|
||||||
return fileName;
|
return fileName;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw BusinessException.internalError("REVIEW_TEMPLATE_SAVE_FAILED", "평가양식 파일 저장 중 오류가 발생했습니다.");
|
throw BusinessException.internalError("REVIEW_TEMPLATE_SAVE_FAILED", "평가양식 파일 저장 중 오류가 발생했습니다.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public PathResource getReviewTemplateResource(Integer reviewType) {
|
public PathResource getReviewTemplateResource(Integer reviewType, Integer classification) {
|
||||||
Path file = findReviewTemplateFile(reviewType);
|
Path file = findReviewTemplateFile(reviewType, classification, false);
|
||||||
return new PathResource(file);
|
return new PathResource(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getReviewTemplateFileName(Integer reviewType) {
|
public PathResource getReviewTemplatePdfResource(Integer reviewType, Integer classification) {
|
||||||
return findReviewTemplateFile(reviewType).getFileName().toString();
|
Path file = findReviewTemplateFile(reviewType, classification, true);
|
||||||
|
return new PathResource(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Path findReviewTemplateFile(Integer reviewType) {
|
private Path findReviewTemplateFile(Integer reviewType, Integer classification, boolean pdf) {
|
||||||
validateReviewTemplateType(reviewType);
|
validateReviewTemplateType(reviewType);
|
||||||
Path dir = templateDir(reviewType);
|
validateReviewTemplateClassification(classification);
|
||||||
|
|
||||||
|
Path dir = templateDir(reviewType, classification);
|
||||||
if (!Files.isDirectory(dir)) {
|
if (!Files.isDirectory(dir)) {
|
||||||
throw BusinessException.notFound("REVIEW_TEMPLATE_NOT_FOUND", "평가양식 파일이 없습니다.")
|
throw BusinessException.notFound("REVIEW_TEMPLATE_NOT_FOUND", "평가양식 파일이 없습니다.")
|
||||||
.with("reviewType", reviewType);
|
.with("reviewType", reviewType);
|
||||||
@@ -64,6 +81,7 @@ public class ReviewTemplateService extends AbstractFileService {
|
|||||||
try (var files = Files.list(dir)) {
|
try (var files = Files.list(dir)) {
|
||||||
return files
|
return files
|
||||||
.filter(Files::isRegularFile)
|
.filter(Files::isRegularFile)
|
||||||
|
.filter(path -> pdf == isPdf(path.getFileName().toString()))
|
||||||
.sorted(Comparator.comparing(path -> path.getFileName().toString()))
|
.sorted(Comparator.comparing(path -> path.getFileName().toString()))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElseThrow(() -> BusinessException.notFound("REVIEW_TEMPLATE_NOT_FOUND", "평가양식 파일이 없습니다.")
|
.orElseThrow(() -> BusinessException.notFound("REVIEW_TEMPLATE_NOT_FOUND", "평가양식 파일이 없습니다.")
|
||||||
@@ -85,20 +103,69 @@ public class ReviewTemplateService extends AbstractFileService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Path templateDir(Integer reviewType) {
|
private String convertToPdfIfPossible(Path source, Path dir) {
|
||||||
|
String extension = extractExtension(source.getFileName().toString()).toLowerCase();
|
||||||
|
Set<String> targets = new HashSet<>(Set.of(".docx", ".hwpx", ".hwp", ".pptx", ".xlsx"));
|
||||||
|
if (isPdf(source.getFileName().toString()) || !targets.contains(extension)) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Process process = new ProcessBuilder(
|
||||||
|
pdfConverterCommand,
|
||||||
|
"--headless",
|
||||||
|
"--convert-to",
|
||||||
|
"pdf",
|
||||||
|
"--outdir",
|
||||||
|
dir.toString(),
|
||||||
|
source.toString()
|
||||||
|
).redirectErrorStream(true).start();
|
||||||
|
|
||||||
|
boolean finished = process.waitFor(60, TimeUnit.SECONDS);
|
||||||
|
if (!finished || process.exitValue() != 0) {
|
||||||
|
process.destroyForcibly();
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
String baseName = stripExtension(source.getFileName().toString());
|
||||||
|
Path pdf = dir.resolve(baseName + ".pdf").normalize();
|
||||||
|
return Files.exists(pdf) ? pdf.getFileName().toString() : "";
|
||||||
|
} catch (Exception e) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String stripExtension(String fileName) {
|
||||||
|
int dot = fileName.lastIndexOf('.');
|
||||||
|
return dot > 0 ? fileName.substring(0, dot) : fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isPdf(String fileName) {
|
||||||
|
return ".pdf".equalsIgnoreCase(extractExtension(fileName));
|
||||||
|
}
|
||||||
|
|
||||||
|
private Path templateDir(Integer reviewType, Integer classification) {
|
||||||
return getBaseDir()
|
return getBaseDir()
|
||||||
.resolve(String.valueOf(reviewType))
|
.resolve(String.valueOf(reviewType))
|
||||||
|
.resolve(String.valueOf(classification))
|
||||||
.toAbsolutePath()
|
.toAbsolutePath()
|
||||||
.normalize();
|
.normalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateReviewTemplateType(Integer reviewType) {
|
private void validateReviewTemplateType(Integer reviewType) {
|
||||||
if (!Integer.valueOf(1).equals(reviewType) && !Integer.valueOf(3).equals(reviewType)) {
|
if (!REVIEW_TYPE.contains(reviewType)) {
|
||||||
throw BusinessException.badRequest("INVALID_REVIEW_TEMPLATE_TYPE", "유효하지 않은 평가양식 타입입니다.")
|
throw BusinessException.badRequest("INVALID_REVIEW_TEMPLATE_TYPE", "유효하지 않은 평가양식 타입입니다.")
|
||||||
.with("reviewType", reviewType);
|
.with("reviewType", reviewType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void validateReviewTemplateClassification(Integer classification) {
|
||||||
|
if (!REVIEW_CLASSIFICATION.contains(classification)) {
|
||||||
|
throw BusinessException.badRequest("INVALID_REVIEW_TEMPLATE_CLASSIFICATION", "유효하지 않은 평가양식 분류입니다.")
|
||||||
|
.with("classification", classification);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private String sanitizeFileName(String originalFileName) {
|
private String sanitizeFileName(String originalFileName) {
|
||||||
if (StringUtil.isNullOrBlank(originalFileName)) {
|
if (StringUtil.isNullOrBlank(originalFileName)) {
|
||||||
return "review-template";
|
return "review-template";
|
||||||
|
|||||||
@@ -131,6 +131,18 @@ public class SystemEventLogService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void writeAssignRejectLog(String userId, LocalDateTime regDt, String clientIp, String performanceId) {
|
||||||
|
writeSystemLog(
|
||||||
|
SystemEventType.ASSIGN_PERFORMANCE_REJECT,
|
||||||
|
"Assign Reject",
|
||||||
|
userId,
|
||||||
|
regDt,
|
||||||
|
clientIp,
|
||||||
|
"performanceId",
|
||||||
|
performanceId
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public void writeVisitStartLog(String regId, LocalDateTime regDt, String clientIp, Integer performanceId) {
|
public void writeVisitStartLog(String regId, LocalDateTime regDt, String clientIp, Integer performanceId) {
|
||||||
writeSystemLog(
|
writeSystemLog(
|
||||||
SystemEventType.VISIT_START,
|
SystemEventType.VISIT_START,
|
||||||
@@ -287,7 +299,7 @@ public class SystemEventLogService {
|
|||||||
String assignUser
|
String assignUser
|
||||||
) {
|
) {
|
||||||
saveLog(
|
saveLog(
|
||||||
SystemEventType.ASSIGN_PERFORMANCE_REJECT,
|
SystemEventType.ASSIGN_PERFORMANCE_CANCEL,
|
||||||
"Assign Cancel",
|
"Assign Cancel",
|
||||||
regId,
|
regId,
|
||||||
regDt,
|
regDt,
|
||||||
|
|||||||
@@ -53,9 +53,11 @@ kri:
|
|||||||
- /api/v1/auth/login
|
- /api/v1/auth/login
|
||||||
- /api/v1/admin-cache/**
|
- /api/v1/admin-cache/**
|
||||||
- /api/v1/assign/confirm/*/*
|
- /api/v1/assign/confirm/*/*
|
||||||
|
- /api/v1/assign/reject/*/*
|
||||||
- /api/v1/performance/list/compact
|
- /api/v1/performance/list/compact
|
||||||
- /api/v1/review/start/**
|
- /api/v1/review/start/**
|
||||||
- /api/v1/review/end/**
|
- /api/v1/review/end/**
|
||||||
|
- /api/v1/code/*
|
||||||
|
|
||||||
swagger:
|
swagger:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|||||||
Reference in New Issue
Block a user