spotless
This commit is contained in:
@@ -5,6 +5,7 @@ import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InferenceDetail;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelerDetail;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelingStatDto;
|
||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerListResponse;
|
||||
import com.kamco.cd.kamcoback.label.service.LabelAllocateService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@@ -18,6 +19,7 @@ import jakarta.validation.Valid;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@@ -93,19 +95,16 @@ public class LabelAllocateApiController {
|
||||
defaultValue = "NAME_ASC"))
|
||||
@RequestParam(required = false)
|
||||
String sort,
|
||||
@Parameter(description = "페이지 번호 (0부터 시작)", example = "0")
|
||||
@RequestParam(defaultValue = "0")
|
||||
@Parameter(description = "페이지 번호 (0부터 시작)", example = "0") @RequestParam(defaultValue = "0")
|
||||
Integer page,
|
||||
@Parameter(description = "페이지 크기", example = "20")
|
||||
@RequestParam(defaultValue = "20")
|
||||
@Parameter(description = "페이지 크기", example = "20") @RequestParam(defaultValue = "20")
|
||||
Integer size) {
|
||||
|
||||
// type이 null이면 기본값으로 LABELER 설정
|
||||
String workerType = (type == null || type.isEmpty()) ? RoleType.LABELER.name() : type;
|
||||
|
||||
return ApiResponseDto.ok(
|
||||
labelAllocateService.getWorkerStatistics(
|
||||
null, workerType, search, sort, page, size));
|
||||
labelAllocateService.getWorkerStatistics(null, workerType, search, sort, page, size));
|
||||
}
|
||||
|
||||
@Operation(summary = "라벨링작업 관리 > 작업 배정", description = "라벨링작업 관리 > 작업 배정")
|
||||
@@ -168,10 +167,9 @@ public class LabelAllocateApiController {
|
||||
@Schema(
|
||||
allowableValues = {"LABELER", "REVIEWER"},
|
||||
defaultValue = "LABELER")
|
||||
@Parameter(
|
||||
description = "라벨러/검수자(LABELER/REVIEWER)",
|
||||
required = true) @RequestParam String type
|
||||
) {
|
||||
@Parameter(description = "라벨러/검수자(LABELER/REVIEWER)", required = true)
|
||||
@RequestParam
|
||||
String type) {
|
||||
return ApiResponseDto.ok(labelAllocateService.findUserDetail(userId, uuid, type));
|
||||
}
|
||||
|
||||
@@ -223,18 +221,14 @@ public class LabelAllocateApiController {
|
||||
example = "8584e8d4-53b3-4582-bde2-28a81495a626")
|
||||
@RequestParam
|
||||
String uuid,
|
||||
@Parameter(
|
||||
description = "사번",
|
||||
required = true,
|
||||
example = "123456")
|
||||
@RequestParam String userId,
|
||||
@Parameter(description = "사번", required = true, example = "123456") @RequestParam
|
||||
String userId,
|
||||
@Schema(
|
||||
allowableValues = {"LABELER", "REVIEWER"},
|
||||
defaultValue = "LABELER")
|
||||
@Parameter(
|
||||
description = "라벨러/검수자(LABELER/REVIEWER)",
|
||||
required = true) @RequestParam String type
|
||||
) {
|
||||
@Parameter(description = "라벨러/검수자(LABELER/REVIEWER)", required = true)
|
||||
@RequestParam
|
||||
String type) {
|
||||
LabelAllocateDto.searchReq searchReq = new LabelAllocateDto.searchReq(page, size, "");
|
||||
return ApiResponseDto.ok(labelAllocateService.findDaliyList(searchReq, uuid, userId, type));
|
||||
}
|
||||
|
||||
@@ -301,5 +301,4 @@ public class LabelAllocateDto {
|
||||
return PageRequest.of(page, size);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -67,23 +67,17 @@ public class WorkerStatsDto {
|
||||
private Boolean isStagnated;
|
||||
|
||||
// 레거시 필드 (기존 호환성 유지)
|
||||
@Deprecated
|
||||
private Long doneCnt; // completed로 대체
|
||||
@Deprecated private Long doneCnt; // completed로 대체
|
||||
|
||||
@Deprecated
|
||||
private Long skipCnt; // skipped로 대체
|
||||
@Deprecated private Long skipCnt; // skipped로 대체
|
||||
|
||||
@Deprecated
|
||||
private Long remainingCnt; // remaining으로 대체
|
||||
@Deprecated private Long remainingCnt; // remaining으로 대체
|
||||
|
||||
@Deprecated
|
||||
private Long day3AgoDoneCnt; // history.day3Ago로 대체
|
||||
@Deprecated private Long day3AgoDoneCnt; // history.day3Ago로 대체
|
||||
|
||||
@Deprecated
|
||||
private Long day2AgoDoneCnt; // history.day2Ago로 대체
|
||||
@Deprecated private Long day2AgoDoneCnt; // history.day2Ago로 대체
|
||||
|
||||
@Deprecated
|
||||
private Long day1AgoDoneCnt; // history.day1Ago로 대체
|
||||
@Deprecated private Long day1AgoDoneCnt; // history.day1Ago로 대체
|
||||
}
|
||||
|
||||
@Getter
|
||||
@@ -107,7 +101,6 @@ public class WorkerStatsDto {
|
||||
private Long average;
|
||||
}
|
||||
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
|
||||
@@ -124,12 +124,7 @@ public class LabelAllocateService {
|
||||
* @return 작업자 목록 및 통계
|
||||
*/
|
||||
public WorkerListResponse getWorkerStatistics(
|
||||
Long analUid,
|
||||
String workerType,
|
||||
String search,
|
||||
String sortType,
|
||||
Integer page,
|
||||
Integer size) {
|
||||
Long analUid, String workerType, String search, String sortType, Integer page, Integer size) {
|
||||
|
||||
// 프로젝트 정보 조회 (analUid가 있을 때만)
|
||||
var projectInfo = labelAllocateCoreService.findProjectInfo(analUid);
|
||||
@@ -139,8 +134,7 @@ public class LabelAllocateService {
|
||||
|
||||
// 작업자 통계 조회
|
||||
List<WorkerStatistics> workers =
|
||||
labelAllocateCoreService.findWorkerStatistics(
|
||||
analUid, workerType, search, sortType);
|
||||
labelAllocateCoreService.findWorkerStatistics(analUid, workerType, search, sortType);
|
||||
|
||||
// 각 작업자별 3일치 처리량 조회
|
||||
LocalDate today = LocalDate.now();
|
||||
@@ -234,7 +228,8 @@ public class LabelAllocateService {
|
||||
}
|
||||
}
|
||||
|
||||
public Page<LabelingStatDto> findDaliyList(LabelAllocateDto.searchReq searchReq, String uuid, String userId, String type) {
|
||||
public Page<LabelingStatDto> findDaliyList(
|
||||
LabelAllocateDto.searchReq searchReq, String uuid, String userId, String type) {
|
||||
if (type.equals("LABELER")) {
|
||||
return labelAllocateCoreService.findLabelerDailyStat(searchReq, uuid, userId);
|
||||
} else {
|
||||
|
||||
@@ -57,12 +57,8 @@ public class LabelAllocateCoreService {
|
||||
}
|
||||
|
||||
public List<WorkerStatistics> findWorkerStatistics(
|
||||
Long analUid,
|
||||
String workerType,
|
||||
String search,
|
||||
String sortType) {
|
||||
return labelAllocateRepository.findWorkerStatistics(
|
||||
analUid, workerType, search, sortType);
|
||||
Long analUid, String workerType, String search, String sortType) {
|
||||
return labelAllocateRepository.findWorkerStatistics(analUid, workerType, search, sortType);
|
||||
}
|
||||
|
||||
public WorkProgressInfo findWorkProgressInfo(Long analUid) {
|
||||
@@ -104,11 +100,13 @@ public class LabelAllocateCoreService {
|
||||
labelAllocateRepository.insertInspector(analUid, inspector);
|
||||
}
|
||||
|
||||
public Page<LabelingStatDto> findLabelerDailyStat(searchReq searchReq, String uuid, String userId) {
|
||||
public Page<LabelingStatDto> findLabelerDailyStat(
|
||||
searchReq searchReq, String uuid, String userId) {
|
||||
return labelAllocateRepository.findLabelerDailyStat(searchReq, uuid, userId);
|
||||
}
|
||||
|
||||
public Page<LabelingStatDto> findInspectorDailyStat(searchReq searchReq, String uuid, String userId) {
|
||||
public Page<LabelingStatDto> findInspectorDailyStat(
|
||||
searchReq searchReq, String uuid, String userId) {
|
||||
return labelAllocateRepository.findInspectorDailyStat(searchReq, uuid, userId);
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,6 @@ public class LabelingAssignmentEntity extends CommonDateEntity {
|
||||
super.getModifiedDate(),
|
||||
this.inspectState,
|
||||
this.workStatDttm,
|
||||
this.inspectStatDttm
|
||||
);
|
||||
this.inspectStatDttm);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,9 +58,11 @@ public interface LabelAllocateRepositoryCustom {
|
||||
|
||||
void insertInspector(Long analUid, String inspector);
|
||||
|
||||
Page<LabelingStatDto> findLabelerDailyStat(LabelAllocateDto.searchReq searchReq, String uuid, String userId);
|
||||
Page<LabelingStatDto> findLabelerDailyStat(
|
||||
LabelAllocateDto.searchReq searchReq, String uuid, String userId);
|
||||
|
||||
Page<LabelingStatDto> findInspectorDailyStat(LabelAllocateDto.searchReq searchReq, String uuid, String userId);
|
||||
Page<LabelingStatDto> findInspectorDailyStat(
|
||||
LabelAllocateDto.searchReq searchReq, String uuid, String userId);
|
||||
|
||||
LabelerDetail findInspectorDetail(String userId, String uuid);
|
||||
}
|
||||
|
||||
@@ -197,10 +197,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
|
||||
@Override
|
||||
public List<WorkerStatistics> findWorkerStatistics(
|
||||
Long analUid,
|
||||
String workerType,
|
||||
String search,
|
||||
String sortType) {
|
||||
Long analUid, String workerType, String search, String sortType) {
|
||||
|
||||
// 작업자 유형에 따른 필드 선택
|
||||
StringExpression workerIdField =
|
||||
@@ -216,8 +213,8 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
// 검색 조건 (이름 또는 사번으로 검색)
|
||||
BooleanExpression searchCondition = null;
|
||||
if (search != null && !search.isEmpty()) {
|
||||
searchCondition = memberEntity.name.contains(search)
|
||||
.or(memberEntity.employeeNo.contains(search));
|
||||
searchCondition =
|
||||
memberEntity.name.contains(search).or(memberEntity.employeeNo.contains(search));
|
||||
}
|
||||
|
||||
// 완료, 스킵, 남은 작업 계산
|
||||
@@ -247,7 +244,8 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
.sum();
|
||||
|
||||
// 기본 통계 조회 쿼리
|
||||
BooleanExpression analUidCondition = analUid != null ? labelingAssignmentEntity.analUid.eq(analUid) : null;
|
||||
BooleanExpression analUidCondition =
|
||||
analUid != null ? labelingAssignmentEntity.analUid.eq(analUid) : null;
|
||||
|
||||
var baseQuery =
|
||||
queryFactory
|
||||
@@ -318,7 +316,8 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
|
||||
@Override
|
||||
public WorkProgressInfo findWorkProgressInfo(Long analUid) {
|
||||
BooleanExpression analUidCondition = analUid != null ? labelingAssignmentEntity.analUid.eq(analUid) : null;
|
||||
BooleanExpression analUidCondition =
|
||||
analUid != null ? labelingAssignmentEntity.analUid.eq(analUid) : null;
|
||||
|
||||
// 전체 배정 건수
|
||||
Long totalAssigned =
|
||||
@@ -344,9 +343,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
queryFactory
|
||||
.select(labelingAssignmentEntity.count())
|
||||
.from(labelingAssignmentEntity)
|
||||
.where(
|
||||
analUidCondition,
|
||||
labelingAssignmentEntity.workState.eq("SKIP"))
|
||||
.where(analUidCondition, labelingAssignmentEntity.workState.eq("SKIP"))
|
||||
.fetchOne();
|
||||
|
||||
// 투입된 라벨러 수
|
||||
@@ -354,9 +351,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
queryFactory
|
||||
.select(labelingAssignmentEntity.workerUid.countDistinct())
|
||||
.from(labelingAssignmentEntity)
|
||||
.where(
|
||||
analUidCondition,
|
||||
labelingAssignmentEntity.workerUid.isNotNull())
|
||||
.where(analUidCondition, labelingAssignmentEntity.workerUid.isNotNull())
|
||||
.fetchOne();
|
||||
|
||||
// === 검수 통계 ===
|
||||
@@ -365,9 +360,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
queryFactory
|
||||
.select(labelingAssignmentEntity.count())
|
||||
.from(labelingAssignmentEntity)
|
||||
.where(
|
||||
analUidCondition,
|
||||
labelingAssignmentEntity.workState.eq("DONE"))
|
||||
.where(analUidCondition, labelingAssignmentEntity.workState.eq("DONE"))
|
||||
.fetchOne();
|
||||
|
||||
// 투입된 검수자 수
|
||||
@@ -375,9 +368,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
queryFactory
|
||||
.select(labelingAssignmentEntity.inspectorUid.countDistinct())
|
||||
.from(labelingAssignmentEntity)
|
||||
.where(
|
||||
analUidCondition,
|
||||
labelingAssignmentEntity.inspectorUid.isNotNull())
|
||||
.where(analUidCondition, labelingAssignmentEntity.inspectorUid.isNotNull())
|
||||
.fetchOne();
|
||||
|
||||
// 남은 작업 건수 계산
|
||||
@@ -437,7 +428,8 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
? labelingAssignmentEntity.inspectorUid.eq(workerId)
|
||||
: labelingAssignmentEntity.workerUid.eq(workerId);
|
||||
|
||||
BooleanExpression analUidCondition = analUid != null ? labelingAssignmentEntity.analUid.eq(analUid) : null;
|
||||
BooleanExpression analUidCondition =
|
||||
analUid != null ? labelingAssignmentEntity.analUid.eq(analUid) : null;
|
||||
|
||||
Long count =
|
||||
queryFactory
|
||||
@@ -638,14 +630,14 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
return null;
|
||||
}
|
||||
|
||||
var result = queryFactory
|
||||
var result =
|
||||
queryFactory
|
||||
.select(
|
||||
mapSheetAnalEntity.compareYyyy,
|
||||
mapSheetAnalEntity.targetYyyy,
|
||||
mapSheetAnalEntity.analTitle,
|
||||
mapSheetAnalEntity.gukyuinApplyDttm,
|
||||
mapSheetAnalEntity.analStrtDttm
|
||||
)
|
||||
mapSheetAnalEntity.analStrtDttm)
|
||||
.from(mapSheetAnalEntity)
|
||||
.where(mapSheetAnalEntity.id.eq(analUid))
|
||||
.fetchOne();
|
||||
@@ -661,9 +653,8 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
ZonedDateTime analStrtDttm = result.get(mapSheetAnalEntity.analStrtDttm);
|
||||
|
||||
// 변화탐지년도 생성
|
||||
String detectionYear = (compareYyyy != null && targetYyyy != null)
|
||||
? compareYyyy + "-" + targetYyyy
|
||||
: null;
|
||||
String detectionYear =
|
||||
(compareYyyy != null && targetYyyy != null) ? compareYyyy + "-" + targetYyyy : null;
|
||||
|
||||
// 회차 추출 (예: "8회차" → "8")
|
||||
String round = extractRoundFromTitle(analTitle);
|
||||
@@ -676,10 +667,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 제목에서 회차 숫자 추출
|
||||
* 예: "8회차", "제8회차" → "8"
|
||||
*/
|
||||
/** 제목에서 회차 숫자 추출 예: "8회차", "제8회차" → "8" */
|
||||
private String extractRoundFromTitle(String title) {
|
||||
if (title == null || title.isEmpty()) {
|
||||
return null;
|
||||
@@ -691,9 +679,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
return matcher.find() ? matcher.group(1) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* ZonedDateTime을 "yyyy-MM-dd" 형식으로 변환
|
||||
*/
|
||||
/** ZonedDateTime을 "yyyy-MM-dd" 형식으로 변환 */
|
||||
private String formatDate(ZonedDateTime dateTime) {
|
||||
if (dateTime == null) {
|
||||
return null;
|
||||
@@ -702,58 +688,38 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<LabelingStatDto> findLabelerDailyStat(LabelAllocateDto.searchReq searchReq, String uuid, String userId) {
|
||||
public Page<LabelingStatDto> findLabelerDailyStat(
|
||||
LabelAllocateDto.searchReq searchReq, String uuid, String userId) {
|
||||
// 날짜 포맷
|
||||
Expression<String> workDate =
|
||||
Expressions.stringTemplate(
|
||||
"TO_CHAR({0}, 'YYYY-MM-DD')",
|
||||
labelingAssignmentEntity.workStatDttm
|
||||
);
|
||||
"TO_CHAR({0}, 'YYYY-MM-DD')", labelingAssignmentEntity.workStatDttm);
|
||||
|
||||
// 날짜별 전체 건수
|
||||
Expression<Long> dailyTotalCnt =
|
||||
Expressions.numberTemplate(
|
||||
Long.class,
|
||||
"COUNT(*)"
|
||||
);
|
||||
Expression<Long> dailyTotalCnt = Expressions.numberTemplate(Long.class, "COUNT(*)");
|
||||
|
||||
// ⭐ 전체 기간 총 건수 (윈도우 함수)
|
||||
Expression<Long> totalCnt =
|
||||
Expressions.numberTemplate(
|
||||
Long.class,
|
||||
"SUM(COUNT(*)) OVER ()"
|
||||
);
|
||||
Expression<Long> totalCnt = Expressions.numberTemplate(Long.class, "SUM(COUNT(*)) OVER ()");
|
||||
|
||||
// 상태별 카운트 (Postgres FILTER 사용)
|
||||
Expression<Long> assignedCnt =
|
||||
Expressions.numberTemplate(
|
||||
Long.class,
|
||||
"COUNT(*) FILTER (WHERE {0} = 'ASSIGNED')",
|
||||
labelingAssignmentEntity.workState
|
||||
);
|
||||
labelingAssignmentEntity.workState);
|
||||
|
||||
Expression<Long> skipCnt =
|
||||
Expressions.numberTemplate(
|
||||
Long.class,
|
||||
"COUNT(*) FILTER (WHERE {0} = 'SKIP')",
|
||||
labelingAssignmentEntity.workState
|
||||
);
|
||||
Long.class, "COUNT(*) FILTER (WHERE {0} = 'SKIP')", labelingAssignmentEntity.workState);
|
||||
|
||||
Expression<Long> completeCnt =
|
||||
Expressions.numberTemplate(
|
||||
Long.class,
|
||||
"COUNT(*) FILTER (WHERE {0} = 'COMPLETE')",
|
||||
labelingAssignmentEntity.workState
|
||||
);
|
||||
labelingAssignmentEntity.workState);
|
||||
|
||||
Expression<Long> remainCnt =
|
||||
Expressions.numberTemplate(
|
||||
Long.class,
|
||||
"({0} - {1} - {2})",
|
||||
totalCnt,
|
||||
skipCnt,
|
||||
completeCnt
|
||||
);
|
||||
Expressions.numberTemplate(Long.class, "({0} - {1} - {2})", totalCnt, skipCnt, completeCnt);
|
||||
|
||||
// analUid로 분석 정보 조회
|
||||
MapSheetAnalInferenceEntity analEntity =
|
||||
@@ -767,7 +733,8 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
}
|
||||
|
||||
Pageable pageable = searchReq.toPageable();
|
||||
List<LabelingStatDto> foundContent = queryFactory
|
||||
List<LabelingStatDto> foundContent =
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
LabelingStatDto.class,
|
||||
@@ -777,27 +744,24 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
assignedCnt,
|
||||
skipCnt,
|
||||
completeCnt,
|
||||
remainCnt
|
||||
)
|
||||
)
|
||||
remainCnt))
|
||||
.from(labelingAssignmentEntity)
|
||||
.where(
|
||||
labelingAssignmentEntity.workerUid.eq(userId),
|
||||
labelingAssignmentEntity.analUid.eq(analEntity.getId())
|
||||
)
|
||||
labelingAssignmentEntity.analUid.eq(analEntity.getId()))
|
||||
.groupBy(workDate)
|
||||
.orderBy(labelingAssignmentEntity.workStatDttm.min().asc())
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.fetch();
|
||||
|
||||
Long countQuery = queryFactory
|
||||
Long countQuery =
|
||||
queryFactory
|
||||
.select(workDate)
|
||||
.from(labelingAssignmentEntity)
|
||||
.where(
|
||||
labelingAssignmentEntity.workerUid.eq(userId),
|
||||
labelingAssignmentEntity.analUid.eq(analEntity.getId())
|
||||
)
|
||||
labelingAssignmentEntity.analUid.eq(analEntity.getId()))
|
||||
.distinct()
|
||||
.fetch()
|
||||
.stream()
|
||||
@@ -807,58 +771,40 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<LabelingStatDto> findInspectorDailyStat(searchReq searchReq, String uuid, String userId) {
|
||||
public Page<LabelingStatDto> findInspectorDailyStat(
|
||||
searchReq searchReq, String uuid, String userId) {
|
||||
// 날짜 포맷
|
||||
Expression<String> workDate =
|
||||
Expressions.stringTemplate(
|
||||
"TO_CHAR({0}, 'YYYY-MM-DD')",
|
||||
labelingAssignmentEntity.inspectStatDttm
|
||||
);
|
||||
"TO_CHAR({0}, 'YYYY-MM-DD')", labelingAssignmentEntity.inspectStatDttm);
|
||||
|
||||
// 날짜별 전체 건수
|
||||
Expression<Long> dailyTotalCnt =
|
||||
Expressions.numberTemplate(
|
||||
Long.class,
|
||||
"COUNT(*)"
|
||||
);
|
||||
Expression<Long> dailyTotalCnt = Expressions.numberTemplate(Long.class, "COUNT(*)");
|
||||
|
||||
// ⭐ 전체 기간 총 건수 (윈도우 함수)
|
||||
Expression<Long> totalCnt =
|
||||
Expressions.numberTemplate(
|
||||
Long.class,
|
||||
"SUM(COUNT(*)) OVER ()"
|
||||
);
|
||||
Expression<Long> totalCnt = Expressions.numberTemplate(Long.class, "SUM(COUNT(*)) OVER ()");
|
||||
|
||||
// 상태별 카운트 (Postgres FILTER 사용)
|
||||
Expression<Long> assignedCnt =
|
||||
Expressions.numberTemplate(
|
||||
Long.class,
|
||||
"COUNT(*) FILTER (WHERE {0} = 'UNCONFIRM')",
|
||||
labelingAssignmentEntity.inspectState
|
||||
);
|
||||
labelingAssignmentEntity.inspectState);
|
||||
|
||||
Expression<Long> skipCnt =
|
||||
Expressions.numberTemplate(
|
||||
Long.class,
|
||||
"COUNT(*) FILTER (WHERE {0} = 'EXCEPT')",
|
||||
labelingAssignmentEntity.inspectState
|
||||
);
|
||||
labelingAssignmentEntity.inspectState);
|
||||
|
||||
Expression<Long> completeCnt =
|
||||
Expressions.numberTemplate(
|
||||
Long.class,
|
||||
"COUNT(*) FILTER (WHERE {0} = 'COMPLETE')",
|
||||
labelingAssignmentEntity.inspectState
|
||||
);
|
||||
labelingAssignmentEntity.inspectState);
|
||||
|
||||
Expression<Long> remainCnt =
|
||||
Expressions.numberTemplate(
|
||||
Long.class,
|
||||
"({0} - {1} - {2})",
|
||||
totalCnt,
|
||||
skipCnt,
|
||||
completeCnt
|
||||
);
|
||||
Expressions.numberTemplate(Long.class, "({0} - {1} - {2})", totalCnt, skipCnt, completeCnt);
|
||||
|
||||
// analUid로 분석 정보 조회
|
||||
MapSheetAnalInferenceEntity analEntity =
|
||||
@@ -872,7 +818,8 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
}
|
||||
|
||||
Pageable pageable = searchReq.toPageable();
|
||||
List<LabelingStatDto> foundContent = queryFactory
|
||||
List<LabelingStatDto> foundContent =
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
LabelingStatDto.class,
|
||||
@@ -882,27 +829,24 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
assignedCnt,
|
||||
skipCnt,
|
||||
completeCnt,
|
||||
remainCnt
|
||||
)
|
||||
)
|
||||
remainCnt))
|
||||
.from(labelingAssignmentEntity)
|
||||
.where(
|
||||
labelingAssignmentEntity.inspectorUid.eq(userId),
|
||||
labelingAssignmentEntity.analUid.eq(analEntity.getId())
|
||||
)
|
||||
labelingAssignmentEntity.analUid.eq(analEntity.getId()))
|
||||
.groupBy(workDate)
|
||||
.orderBy(labelingAssignmentEntity.inspectStatDttm.min().asc())
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.fetch();
|
||||
|
||||
Long countQuery = queryFactory
|
||||
Long countQuery =
|
||||
queryFactory
|
||||
.select(workDate)
|
||||
.from(labelingAssignmentEntity)
|
||||
.where(
|
||||
labelingAssignmentEntity.inspectorUid.eq(userId),
|
||||
labelingAssignmentEntity.analUid.eq(analEntity.getId())
|
||||
)
|
||||
labelingAssignmentEntity.analUid.eq(analEntity.getId()))
|
||||
.distinct()
|
||||
.fetch()
|
||||
.stream()
|
||||
|
||||
Reference in New Issue
Block a user