라벨링 작업이력 수정, 상태 수정

This commit is contained in:
DanielLee
2026-01-14 15:01:38 +09:00
parent 326591c4bd
commit 5599889ac0
2 changed files with 58 additions and 5 deletions

View File

@@ -322,17 +322,40 @@ public class LabelAllocateDto {
@AllArgsConstructor @AllArgsConstructor
public static class WorkHistoryDto { public static class WorkHistoryDto {
@Schema(description = "행 번호")
private Integer rowNum; private Integer rowNum;
@Schema(description = "변화탐지년도", example = "2021-2022")
private String changeDetectionYear; private String changeDetectionYear;
@Schema(description = "국유IN 회차")
private Long stage; private Long stage;
@Schema(description = "반영일")
private ZonedDateTime gukyuinApplyDttm; private ZonedDateTime gukyuinApplyDttm;
@Schema(description = "할당건수")
private Long assignedCnt; private Long assignedCnt;
@Schema(description = "완료건수")
private Long completeCnt; private Long completeCnt;
@Schema(description = "Skip건수")
private Long skipCnt; private Long skipCnt;
@Schema(description = "잔여건수")
private Long remainCnt; private Long remainCnt;
// private String status;
@Schema(description = "상태 (진행중/완료)")
private String status;
@Schema(description = "진행률 (%)")
private Double percent; private Double percent;
@Schema(description = "작업기간 시작일")
private ZonedDateTime createdDttm; private ZonedDateTime createdDttm;
@Schema(description = "작업기간 종료일")
private ZonedDateTime projectCloseDttm; private ZonedDateTime projectCloseDttm;
} }
} }

View File

@@ -1515,12 +1515,20 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
mapSheetAnalInferenceEntity.createdDttm, mapSheetAnalInferenceEntity.createdDttm,
mapSheetAnalInferenceEntity.inspectionClosedYn, mapSheetAnalInferenceEntity.inspectionClosedYn,
mapSheetAnalInferenceEntity.updatedDttm) mapSheetAnalInferenceEntity.updatedDttm)
.orderBy(mapSheetAnalInferenceEntity.id.desc()) .orderBy(
// 진행중인 작업이 최상단 (remainCnt > 0)
new CaseBuilder()
.when(totalCnt.subtract(completeCnt).subtract(skipCnt).gt(0L))
.then(0)
.otherwise(1)
.asc(),
// 최신 작업순 (반영일 기준)
mapSheetAnalInferenceEntity.gukyuinApplyDttm.desc())
.offset(pageable.getOffset()) .offset(pageable.getOffset())
.limit(pageable.getPageSize()) .limit(pageable.getPageSize())
.fetch(); .fetch();
// rowNum remainCnt, percent를 Java에서 계산 // rowNum, remainCnt, percent, status를 Java에서 계산
int startRow = (int) pageable.getOffset() + 1; int startRow = (int) pageable.getOffset() + 1;
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
WorkHistoryDto dto = list.get(i); WorkHistoryDto dto = list.get(i);
@@ -1538,6 +1546,13 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
} else { } else {
dto.setPercent(0.0); dto.setPercent(0.0);
} }
// status 계산 (잔여건수가 0이고 진행률이 100%면 "완료", 아니면 "진행중")
if (dto.getRemainCnt() == 0 && dto.getPercent() >= 100.0) {
dto.setStatus("완료");
} else {
dto.setStatus("진행중");
}
} }
Long countQuery = Long countQuery =
@@ -1606,12 +1621,20 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
mapSheetAnalInferenceEntity.createdDttm, mapSheetAnalInferenceEntity.createdDttm,
mapSheetAnalInferenceEntity.inspectionClosedYn, mapSheetAnalInferenceEntity.inspectionClosedYn,
mapSheetAnalInferenceEntity.updatedDttm) mapSheetAnalInferenceEntity.updatedDttm)
.orderBy(mapSheetAnalInferenceEntity.id.desc()) .orderBy(
// 진행중인 작업이 최상단 (remainCnt > 0)
new CaseBuilder()
.when(totalCnt.subtract(completeCnt).subtract(skipCnt).gt(0L))
.then(0)
.otherwise(1)
.asc(),
// 최신 작업순 (반영일 기준)
mapSheetAnalInferenceEntity.gukyuinApplyDttm.desc())
.offset(pageable.getOffset()) .offset(pageable.getOffset())
.limit(pageable.getPageSize()) .limit(pageable.getPageSize())
.fetch(); .fetch();
// rowNum remainCnt, percent를 Java에서 계산 // rowNum, remainCnt, percent, status를 Java에서 계산
int startRow = (int) pageable.getOffset() + 1; int startRow = (int) pageable.getOffset() + 1;
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
WorkHistoryDto dto = list.get(i); WorkHistoryDto dto = list.get(i);
@@ -1629,6 +1652,13 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
} else { } else {
dto.setPercent(0.0); dto.setPercent(0.0);
} }
// status 계산 (잔여건수가 0이고 진행률이 100%면 "완료", 아니면 "진행중")
if (dto.getRemainCnt() == 0 && dto.getPercent() >= 100.0) {
dto.setStatus("완료");
} else {
dto.setStatus("진행중");
}
} }
Long countQuery = Long countQuery =