projectInfo 조회 추가

This commit is contained in:
DanielLee
2026-01-05 15:54:22 +09:00
parent 0129dcacc5
commit 0595f9ad5b
5 changed files with 76 additions and 14 deletions

View File

@@ -28,6 +28,9 @@ public class WorkerStatsDto {
@Schema(description = "작업 시작일 (예: 2026-04-06)")
private String startDate;
@Schema(description = "프로젝트 UUID")
private String uuid;
}
@Getter

View File

@@ -118,8 +118,10 @@ public class LabelAllocateService {
public WorkerListResponse getWorkerStatistics(
Long analUid, String workerType, String search, String sortType) {
// 프로젝트 정보 조회 (analUid가 있을 때만)
var projectInfo = labelAllocateCoreService.findProjectInfo(analUid);
// 프로젝트 정보 조회 (analUid가 없으면 최신 프로젝트 정보 조회)
var projectInfo = analUid != null
? labelAllocateCoreService.findProjectInfo(analUid)
: labelAllocateCoreService.findLatestProjectInfo();
// 작업 진행 현황 조회
var progressInfo = labelAllocateCoreService.findWorkProgressInfo(analUid);

View File

@@ -56,6 +56,10 @@ public class LabelAllocateCoreService {
return labelAllocateRepository.findProjectInfo(analUid);
}
public ProjectInfo findLatestProjectInfo() {
return labelAllocateRepository.findLatestProjectInfo();
}
public List<WorkerStatistics> findWorkerStatistics(
Long analUid, String workerType, String search, String sortType) {
return labelAllocateRepository.findWorkerStatistics(analUid, workerType, search, sortType);

View File

@@ -33,6 +33,9 @@ public interface LabelAllocateRepositoryCustom {
// 프로젝트 정보 조회
ProjectInfo findProjectInfo(Long analUid);
// 최신 프로젝트 정보 조회 (analUid 없이)
ProjectInfo findLatestProjectInfo();
// 작업자 통계 조회
List<WorkerStatistics> findWorkerStatistics(
Long analUid, String workerType, String search, String sortType);

View File

@@ -648,24 +648,26 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
var result =
queryFactory
.select(
mapSheetAnalEntity.compareYyyy,
mapSheetAnalEntity.targetYyyy,
mapSheetAnalEntity.analTitle,
mapSheetAnalEntity.gukyuinApplyDttm,
mapSheetAnalEntity.analStrtDttm)
.from(mapSheetAnalEntity)
.where(mapSheetAnalEntity.id.eq(analUid))
mapSheetAnalInferenceEntity.compareYyyy,
mapSheetAnalInferenceEntity.targetYyyy,
mapSheetAnalInferenceEntity.analTitle,
mapSheetAnalInferenceEntity.gukyuinApplyDttm,
mapSheetAnalInferenceEntity.analStrtDttm,
mapSheetAnalInferenceEntity.uuid)
.from(mapSheetAnalInferenceEntity)
.where(mapSheetAnalInferenceEntity.id.eq(analUid))
.fetchOne();
if (result == null) {
return null;
}
Integer compareYyyy = result.get(mapSheetAnalEntity.compareYyyy);
Integer targetYyyy = result.get(mapSheetAnalEntity.targetYyyy);
String analTitle = result.get(mapSheetAnalEntity.analTitle);
ZonedDateTime gukyuinApplyDttm = result.get(mapSheetAnalEntity.gukyuinApplyDttm);
ZonedDateTime analStrtDttm = result.get(mapSheetAnalEntity.analStrtDttm);
Integer compareYyyy = result.get(mapSheetAnalInferenceEntity.compareYyyy);
Integer targetYyyy = result.get(mapSheetAnalInferenceEntity.targetYyyy);
String analTitle = result.get(mapSheetAnalInferenceEntity.analTitle);
ZonedDateTime gukyuinApplyDttm = result.get(mapSheetAnalInferenceEntity.gukyuinApplyDttm);
ZonedDateTime analStrtDttm = result.get(mapSheetAnalInferenceEntity.analStrtDttm);
UUID uuid = result.get(mapSheetAnalInferenceEntity.uuid);
// 변화탐지년도 생성
String detectionYear =
@@ -679,6 +681,54 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
.round(round)
.reflectionDate(formatDate(gukyuinApplyDttm))
.startDate(formatDate(analStrtDttm))
.uuid(uuid != null ? uuid.toString() : null)
.build();
}
@Override
public ProjectInfo findLatestProjectInfo() {
// 최신 target_yyyy를 기준으로 프로젝트 정보 조회
var result =
queryFactory
.select(
mapSheetAnalInferenceEntity.compareYyyy,
mapSheetAnalInferenceEntity.targetYyyy,
mapSheetAnalInferenceEntity.analTitle,
mapSheetAnalInferenceEntity.gukyuinApplyDttm,
mapSheetAnalInferenceEntity.analStrtDttm,
mapSheetAnalInferenceEntity.uuid)
.from(mapSheetAnalInferenceEntity)
.orderBy(
mapSheetAnalInferenceEntity.targetYyyy.desc(),
mapSheetAnalInferenceEntity.compareYyyy.desc(),
mapSheetAnalInferenceEntity.createdDttm.desc())
.limit(1)
.fetchOne();
if (result == null) {
return null;
}
Integer compareYyyy = result.get(mapSheetAnalInferenceEntity.compareYyyy);
Integer targetYyyy = result.get(mapSheetAnalInferenceEntity.targetYyyy);
String analTitle = result.get(mapSheetAnalInferenceEntity.analTitle);
ZonedDateTime gukyuinApplyDttm = result.get(mapSheetAnalInferenceEntity.gukyuinApplyDttm);
ZonedDateTime analStrtDttm = result.get(mapSheetAnalInferenceEntity.analStrtDttm);
UUID uuid = result.get(mapSheetAnalInferenceEntity.uuid);
// 변화탐지년도 생성
String detectionYear =
(compareYyyy != null && targetYyyy != null) ? compareYyyy + "-" + targetYyyy : null;
// 회차 추출 (예: "8회차" → "8")
String round = extractRoundFromTitle(analTitle);
return ProjectInfo.builder()
.detectionYear(detectionYear)
.round(round)
.reflectionDate(formatDate(gukyuinApplyDttm))
.startDate(formatDate(analStrtDttm))
.uuid(uuid != null ? uuid.toString() : null)
.build();
}