작업현황관리 수정

This commit is contained in:
DanielLee
2026-01-05 11:41:50 +09:00
parent 88cf9a4487
commit 67eb99e243
6 changed files with 71 additions and 36 deletions

View File

@@ -57,11 +57,10 @@ public class LabelAllocateCoreService {
public List<WorkerStatistics> findWorkerStatistics(
Long analUid,
String workerType,
String searchName,
String searchEmployeeNo,
String search,
String sortType) {
return labelAllocateRepository.findWorkerStatistics(
analUid, workerType, searchName, searchEmployeeNo, sortType);
analUid, workerType, search, sortType);
}
public WorkProgressInfo findWorkProgressInfo(Long analUid) {

View File

@@ -34,7 +34,7 @@ public interface LabelAllocateRepositoryCustom {
// 작업자 통계 조회
List<WorkerStatistics> findWorkerStatistics(
Long analUid, String workerType, String searchName, String searchEmployeeNo, String sortType);
Long analUid, String workerType, String search, String sortType);
// 작업 진행 현황 조회
WorkProgressInfo findWorkProgressInfo(Long analUid);

View File

@@ -206,8 +206,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
public List<WorkerStatistics> findWorkerStatistics(
Long analUid,
String workerType,
String searchName,
String searchEmployeeNo,
String search,
String sortType) {
// 작업자 유형에 따른 필드 선택
@@ -221,14 +220,11 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
? labelingAssignmentEntity.inspectorUid.isNotNull()
: labelingAssignmentEntity.workerUid.isNotNull();
// 검색 조건
// 검색 조건 (이름 또는 사번으로 검색)
BooleanExpression searchCondition = null;
if (searchName != null && !searchName.isEmpty()) {
searchCondition = memberEntity.name.contains(searchName);
}
if (searchEmployeeNo != null && !searchEmployeeNo.isEmpty()) {
BooleanExpression empCondition = memberEntity.employeeNo.contains(searchEmployeeNo);
searchCondition = searchCondition == null ? empCondition : searchCondition.and(empCondition);
if (search != null && !search.isEmpty()) {
searchCondition = memberEntity.name.contains(search)
.or(memberEntity.employeeNo.contains(search));
}
// 완료, 스킵, 남은 작업 계산
@@ -258,6 +254,8 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
.sum();
// 기본 통계 조회 쿼리
BooleanExpression analUidCondition = analUid != null ? labelingAssignmentEntity.analUid.eq(analUid) : null;
var baseQuery =
queryFactory
.select(
@@ -274,7 +272,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
"REVIEWER".equals(workerType)
? memberEntity.employeeNo.eq(labelingAssignmentEntity.inspectorUid)
: memberEntity.employeeNo.eq(labelingAssignmentEntity.workerUid))
.where(labelingAssignmentEntity.analUid.eq(analUid), workerCondition, searchCondition)
.where(analUidCondition, workerCondition, searchCondition)
.groupBy(workerIdField, memberEntity.name);
// 정렬 조건 적용
@@ -321,12 +319,14 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
@Override
public WorkProgressInfo findWorkProgressInfo(Long analUid) {
BooleanExpression analUidCondition = analUid != null ? labelingAssignmentEntity.analUid.eq(analUid) : null;
// 전체 배정 건수
Long totalAssigned =
queryFactory
.select(labelingAssignmentEntity.count())
.from(labelingAssignmentEntity)
.where(labelingAssignmentEntity.analUid.eq(analUid))
.where(analUidCondition)
.fetchOne();
// 완료 + 스킵 건수
@@ -335,7 +335,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
.select(labelingAssignmentEntity.count())
.from(labelingAssignmentEntity)
.where(
labelingAssignmentEntity.analUid.eq(analUid),
analUidCondition,
labelingAssignmentEntity.workState.in("DONE", "SKIP"))
.fetchOne();
@@ -345,7 +345,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
.select(labelingAssignmentEntity.workerUid.countDistinct())
.from(labelingAssignmentEntity)
.where(
labelingAssignmentEntity.analUid.eq(analUid),
analUidCondition,
labelingAssignmentEntity.workerUid.isNotNull())
.fetchOne();
@@ -355,7 +355,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
.select(labelingAssignmentEntity.count())
.from(labelingAssignmentEntity)
.where(
labelingAssignmentEntity.analUid.eq(analUid),
analUidCondition,
labelingAssignmentEntity.workerUid.isNotNull(),
labelingAssignmentEntity.workState.notIn("DONE", "SKIP"))
.fetchOne();
@@ -366,7 +366,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
.select(labelingAssignmentEntity.inspectorUid.countDistinct())
.from(labelingAssignmentEntity)
.where(
labelingAssignmentEntity.analUid.eq(analUid),
analUidCondition,
labelingAssignmentEntity.inspectorUid.isNotNull())
.fetchOne();
@@ -376,7 +376,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
.select(labelingAssignmentEntity.count())
.from(labelingAssignmentEntity)
.where(
labelingAssignmentEntity.analUid.eq(analUid),
analUidCondition,
labelingAssignmentEntity.inspectorUid.isNotNull(),
labelingAssignmentEntity.workState.notIn("DONE"))
.fetchOne();
@@ -416,12 +416,14 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
? labelingAssignmentEntity.inspectorUid.eq(workerId)
: labelingAssignmentEntity.workerUid.eq(workerId);
BooleanExpression analUidCondition = analUid != null ? labelingAssignmentEntity.analUid.eq(analUid) : null;
Long count =
queryFactory
.select(labelingAssignmentEntity.count())
.from(labelingAssignmentEntity)
.where(
labelingAssignmentEntity.analUid.eq(analUid),
analUidCondition,
workerCondition,
labelingAssignmentEntity.workState.in(
LabelState.DONE.getId(), LabelState.SKIP.getId()),