라벨링 작업이력 수정
This commit is contained in:
@@ -1466,13 +1466,6 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
|
|
||||||
NumberExpression<Long> totalCnt = labelingAssignmentEntity.assignmentUid.count();
|
NumberExpression<Long> totalCnt = labelingAssignmentEntity.assignmentUid.count();
|
||||||
|
|
||||||
NumberExpression<Long> assignedCnt =
|
|
||||||
new CaseBuilder()
|
|
||||||
.when(labelingAssignmentEntity.workState.eq(LabelState.ASSIGNED.getId()))
|
|
||||||
.then(1L)
|
|
||||||
.otherwise((Long) null)
|
|
||||||
.count();
|
|
||||||
|
|
||||||
NumberExpression<Long> skipCnt =
|
NumberExpression<Long> skipCnt =
|
||||||
new CaseBuilder()
|
new CaseBuilder()
|
||||||
.when(labelingAssignmentEntity.workState.eq(LabelState.SKIP.getId()))
|
.when(labelingAssignmentEntity.workState.eq(LabelState.SKIP.getId()))
|
||||||
@@ -1487,78 +1480,166 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
.otherwise((Long) null)
|
.otherwise((Long) null)
|
||||||
.count();
|
.count();
|
||||||
|
|
||||||
NumberExpression<Double> percent =
|
|
||||||
new CaseBuilder()
|
|
||||||
.when(completeCnt.eq(0L))
|
|
||||||
.then(0.0)
|
|
||||||
.otherwise(
|
|
||||||
Expressions.numberTemplate(
|
|
||||||
Double.class,
|
|
||||||
"round({0} / {1}, 2)",
|
|
||||||
completeCnt,
|
|
||||||
labelingAssignmentEntity.count()));
|
|
||||||
|
|
||||||
Pageable pageable = searchReq.toPageable();
|
Pageable pageable = searchReq.toPageable();
|
||||||
List<WorkHistoryDto> list =
|
List<WorkHistoryDto> list =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(
|
.select(
|
||||||
Projections.constructor(
|
Projections.bean(
|
||||||
WorkHistoryDto.class,
|
WorkHistoryDto.class,
|
||||||
Expressions.numberTemplate(
|
|
||||||
Integer.class,
|
|
||||||
"row_number() over(order by {0} desc)",
|
|
||||||
labelingAssignmentEntity.analUid),
|
|
||||||
Expressions.stringTemplate(
|
Expressions.stringTemplate(
|
||||||
"concat({0}, '-', {1})",
|
"concat({0}, '-', {1})",
|
||||||
mapSheetAnalInferenceEntity.compareYyyy,
|
mapSheetAnalInferenceEntity.compareYyyy,
|
||||||
mapSheetAnalInferenceEntity.targetYyyy),
|
mapSheetAnalInferenceEntity.targetYyyy)
|
||||||
mapSheetAnalInferenceEntity.stage,
|
.as("changeDetectionYear"),
|
||||||
mapSheetAnalInferenceEntity.gukyuinApplyDttm,
|
mapSheetAnalInferenceEntity.stage.longValue().as("stage"),
|
||||||
assignedCnt,
|
mapSheetAnalInferenceEntity.gukyuinApplyDttm.as("gukyuinApplyDttm"),
|
||||||
completeCnt,
|
totalCnt.as("assignedCnt"),
|
||||||
skipCnt,
|
completeCnt.as("completeCnt"),
|
||||||
skipCnt,
|
skipCnt.as("skipCnt"),
|
||||||
// status,
|
mapSheetAnalInferenceEntity.createdDttm.as("createdDttm"),
|
||||||
percent,
|
|
||||||
mapSheetAnalInferenceEntity.createdDttm,
|
|
||||||
new CaseBuilder()
|
new CaseBuilder()
|
||||||
.when(mapSheetAnalInferenceEntity.inspectionClosedYn.eq("Y"))
|
.when(mapSheetAnalInferenceEntity.inspectionClosedYn.eq("Y"))
|
||||||
.then(mapSheetAnalInferenceEntity.updatedDttm)
|
.then(mapSheetAnalInferenceEntity.updatedDttm)
|
||||||
.otherwise((ZonedDateTime) null)))
|
.otherwise((ZonedDateTime) null)
|
||||||
|
.as("projectCloseDttm")))
|
||||||
.from(labelingAssignmentEntity)
|
.from(labelingAssignmentEntity)
|
||||||
.innerJoin(mapSheetAnalInferenceEntity)
|
.innerJoin(mapSheetAnalInferenceEntity)
|
||||||
.on(labelingAssignmentEntity.analUid.eq(mapSheetAnalInferenceEntity.id))
|
.on(labelingAssignmentEntity.analUid.eq(mapSheetAnalInferenceEntity.id))
|
||||||
.where(
|
|
||||||
labelingAssignmentEntity.analUid.in(
|
|
||||||
JPAExpressions.select(labelingAssignmentEntity.analUid)
|
|
||||||
.from(labelingAssignmentEntity)
|
|
||||||
.where(labelingAssignmentEntity.workerUid.eq(userId))
|
.where(labelingAssignmentEntity.workerUid.eq(userId))
|
||||||
.groupBy(labelingAssignmentEntity.analUid)))
|
.groupBy(
|
||||||
.orderBy(percent.desc())
|
mapSheetAnalInferenceEntity.id,
|
||||||
|
mapSheetAnalInferenceEntity.compareYyyy,
|
||||||
|
mapSheetAnalInferenceEntity.targetYyyy,
|
||||||
|
mapSheetAnalInferenceEntity.stage,
|
||||||
|
mapSheetAnalInferenceEntity.gukyuinApplyDttm,
|
||||||
|
mapSheetAnalInferenceEntity.createdDttm,
|
||||||
|
mapSheetAnalInferenceEntity.inspectionClosedYn,
|
||||||
|
mapSheetAnalInferenceEntity.updatedDttm)
|
||||||
|
.orderBy(mapSheetAnalInferenceEntity.id.desc())
|
||||||
.offset(pageable.getOffset())
|
.offset(pageable.getOffset())
|
||||||
.limit(pageable.getPageSize())
|
.limit(pageable.getPageSize())
|
||||||
.fetch();
|
.fetch();
|
||||||
|
|
||||||
|
// rowNum과 remainCnt, percent를 Java에서 계산
|
||||||
|
int startRow = (int) pageable.getOffset() + 1;
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
WorkHistoryDto dto = list.get(i);
|
||||||
|
dto.setRowNum(startRow + i);
|
||||||
|
|
||||||
|
// remainCnt 계산
|
||||||
|
Long assigned = dto.getAssignedCnt() != null ? dto.getAssignedCnt() : 0L;
|
||||||
|
Long complete = dto.getCompleteCnt() != null ? dto.getCompleteCnt() : 0L;
|
||||||
|
Long skip = dto.getSkipCnt() != null ? dto.getSkipCnt() : 0L;
|
||||||
|
dto.setRemainCnt(assigned - complete - skip);
|
||||||
|
|
||||||
|
// percent 계산
|
||||||
|
if (assigned > 0) {
|
||||||
|
dto.setPercent(Math.round((double) complete / assigned * 100.0 * 100.0) / 100.0);
|
||||||
|
} else {
|
||||||
|
dto.setPercent(0.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Long countQuery =
|
Long countQuery =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(mapSheetAnalInferenceEntity.id.count())
|
.select(mapSheetAnalInferenceEntity.id.countDistinct())
|
||||||
.from(labelingAssignmentEntity)
|
.from(labelingAssignmentEntity)
|
||||||
.innerJoin(mapSheetAnalInferenceEntity)
|
.innerJoin(mapSheetAnalInferenceEntity)
|
||||||
.on(labelingAssignmentEntity.analUid.eq(mapSheetAnalInferenceEntity.id))
|
.on(labelingAssignmentEntity.analUid.eq(mapSheetAnalInferenceEntity.id))
|
||||||
.where(
|
|
||||||
labelingAssignmentEntity.analUid.in(
|
|
||||||
JPAExpressions.select(labelingAssignmentEntity.analUid)
|
|
||||||
.from(labelingAssignmentEntity)
|
|
||||||
.where(labelingAssignmentEntity.workerUid.eq(userId))
|
.where(labelingAssignmentEntity.workerUid.eq(userId))
|
||||||
.groupBy(labelingAssignmentEntity.analUid)))
|
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
return new PageImpl<>(list, pageable, countQuery);
|
return new PageImpl<>(list, pageable, countQuery != null ? countQuery : 0L);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<WorkHistoryDto> workReviewerHistoryList(searchReq searchReq, String userId) {
|
public Page<WorkHistoryDto> workReviewerHistoryList(searchReq searchReq, String userId) {
|
||||||
|
|
||||||
return null;
|
NumberExpression<Long> totalCnt = labelingAssignmentEntity.assignmentUid.count();
|
||||||
|
|
||||||
|
NumberExpression<Long> skipCnt =
|
||||||
|
new CaseBuilder()
|
||||||
|
.when(labelingAssignmentEntity.inspectState.eq(InspectState.EXCEPT.getId()))
|
||||||
|
.then(1L)
|
||||||
|
.otherwise((Long) null)
|
||||||
|
.count();
|
||||||
|
|
||||||
|
NumberExpression<Long> completeCnt =
|
||||||
|
new CaseBuilder()
|
||||||
|
.when(labelingAssignmentEntity.inspectState.eq(InspectState.COMPLETE.getId()))
|
||||||
|
.then(1L)
|
||||||
|
.otherwise((Long) null)
|
||||||
|
.count();
|
||||||
|
|
||||||
|
Pageable pageable = searchReq.toPageable();
|
||||||
|
List<WorkHistoryDto> list =
|
||||||
|
queryFactory
|
||||||
|
.select(
|
||||||
|
Projections.bean(
|
||||||
|
WorkHistoryDto.class,
|
||||||
|
Expressions.stringTemplate(
|
||||||
|
"concat({0}, '-', {1})",
|
||||||
|
mapSheetAnalInferenceEntity.compareYyyy,
|
||||||
|
mapSheetAnalInferenceEntity.targetYyyy)
|
||||||
|
.as("changeDetectionYear"),
|
||||||
|
mapSheetAnalInferenceEntity.stage.longValue().as("stage"),
|
||||||
|
mapSheetAnalInferenceEntity.gukyuinApplyDttm.as("gukyuinApplyDttm"),
|
||||||
|
totalCnt.as("assignedCnt"),
|
||||||
|
completeCnt.as("completeCnt"),
|
||||||
|
skipCnt.as("skipCnt"),
|
||||||
|
mapSheetAnalInferenceEntity.createdDttm.as("createdDttm"),
|
||||||
|
new CaseBuilder()
|
||||||
|
.when(mapSheetAnalInferenceEntity.inspectionClosedYn.eq("Y"))
|
||||||
|
.then(mapSheetAnalInferenceEntity.updatedDttm)
|
||||||
|
.otherwise((ZonedDateTime) null)
|
||||||
|
.as("projectCloseDttm")))
|
||||||
|
.from(labelingAssignmentEntity)
|
||||||
|
.innerJoin(mapSheetAnalInferenceEntity)
|
||||||
|
.on(labelingAssignmentEntity.analUid.eq(mapSheetAnalInferenceEntity.id))
|
||||||
|
.where(labelingAssignmentEntity.inspectorUid.eq(userId))
|
||||||
|
.groupBy(
|
||||||
|
mapSheetAnalInferenceEntity.id,
|
||||||
|
mapSheetAnalInferenceEntity.compareYyyy,
|
||||||
|
mapSheetAnalInferenceEntity.targetYyyy,
|
||||||
|
mapSheetAnalInferenceEntity.stage,
|
||||||
|
mapSheetAnalInferenceEntity.gukyuinApplyDttm,
|
||||||
|
mapSheetAnalInferenceEntity.createdDttm,
|
||||||
|
mapSheetAnalInferenceEntity.inspectionClosedYn,
|
||||||
|
mapSheetAnalInferenceEntity.updatedDttm)
|
||||||
|
.orderBy(mapSheetAnalInferenceEntity.id.desc())
|
||||||
|
.offset(pageable.getOffset())
|
||||||
|
.limit(pageable.getPageSize())
|
||||||
|
.fetch();
|
||||||
|
|
||||||
|
// rowNum과 remainCnt, percent를 Java에서 계산
|
||||||
|
int startRow = (int) pageable.getOffset() + 1;
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
WorkHistoryDto dto = list.get(i);
|
||||||
|
dto.setRowNum(startRow + i);
|
||||||
|
|
||||||
|
// remainCnt 계산
|
||||||
|
Long assigned = dto.getAssignedCnt() != null ? dto.getAssignedCnt() : 0L;
|
||||||
|
Long complete = dto.getCompleteCnt() != null ? dto.getCompleteCnt() : 0L;
|
||||||
|
Long skip = dto.getSkipCnt() != null ? dto.getSkipCnt() : 0L;
|
||||||
|
dto.setRemainCnt(assigned - complete - skip);
|
||||||
|
|
||||||
|
// percent 계산
|
||||||
|
if (assigned > 0) {
|
||||||
|
dto.setPercent(Math.round((double) complete / assigned * 100.0 * 100.0) / 100.0);
|
||||||
|
} else {
|
||||||
|
dto.setPercent(0.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Long countQuery =
|
||||||
|
queryFactory
|
||||||
|
.select(mapSheetAnalInferenceEntity.id.countDistinct())
|
||||||
|
.from(labelingAssignmentEntity)
|
||||||
|
.innerJoin(mapSheetAnalInferenceEntity)
|
||||||
|
.on(labelingAssignmentEntity.analUid.eq(mapSheetAnalInferenceEntity.id))
|
||||||
|
.where(labelingAssignmentEntity.inspectorUid.eq(userId))
|
||||||
|
.fetchOne();
|
||||||
|
|
||||||
|
return new PageImpl<>(list, pageable, countQuery != null ? countQuery : 0L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user