학습데이터관리 > 작업이력 진행중
This commit is contained in:
@@ -5,6 +5,7 @@ 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.LabelAllocateDto.WorkHistoryDto;
|
||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.UpdateClosedRequest;
|
||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerListResponse;
|
||||
import com.kamco.cd.kamcoback.label.service.LabelAllocateService;
|
||||
@@ -302,4 +303,21 @@ public class LabelAllocateApiController {
|
||||
return ApiResponseDto.okObject(
|
||||
new ApiResponseDto.ResponseObj(ApiResponseDto.ApiResponseCode.OK, statusMessage));
|
||||
}
|
||||
|
||||
@Operation(summary = "라벨링작업 관리 > 상세 > 작업이력", description = "라벨링작업 관리 > 상세 > 작업이력")
|
||||
@GetMapping("/work-history-list")
|
||||
public ApiResponseDto<Page<WorkHistoryDto>> findWorkHistoryList(
|
||||
@RequestParam(defaultValue = "0", required = true) int page,
|
||||
@RequestParam(defaultValue = "20", required = true) int size,
|
||||
@Parameter(description = "사번", required = true, example = "123456") @RequestParam
|
||||
String userId,
|
||||
@Schema(
|
||||
allowableValues = {"LABELER", "REVIEWER"},
|
||||
defaultValue = "LABELER")
|
||||
@Parameter(description = "라벨러/검수자(LABELER/REVIEWER)", required = true)
|
||||
@RequestParam
|
||||
String type) {
|
||||
LabelAllocateDto.searchReq searchReq = new LabelAllocateDto.searchReq(page, size, "");
|
||||
return ApiResponseDto.ok(labelAllocateService.findWorkHistoryList(searchReq, userId, type));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -314,4 +314,25 @@ public class LabelAllocateDto {
|
||||
private Long totalCnt;
|
||||
private List<MoveUserList> moveUserList;
|
||||
}
|
||||
|
||||
@Schema(name = "WorkHistoryDto", description = "WorkHistoryDto")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class WorkHistoryDto {
|
||||
|
||||
private Integer rowNum;
|
||||
private String changeDetectionYear;
|
||||
private Long stage;
|
||||
private ZonedDateTime gukyuinApplyDttm;
|
||||
private Long assignedCnt;
|
||||
private Long completeCnt;
|
||||
private Long skipCnt;
|
||||
private Long remainCnt;
|
||||
// private String status;
|
||||
private Double percent;
|
||||
private ZonedDateTime createdDttm;
|
||||
private ZonedDateTime projectCloseDttm;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelingStatDto;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.MoveInfo;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.TargetUser;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.UserList;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.WorkHistoryDto;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.searchReq;
|
||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.ProjectInfo;
|
||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkProgressInfo;
|
||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerListResponse;
|
||||
@@ -250,4 +252,12 @@ public class LabelAllocateService {
|
||||
|
||||
labelAllocateCoreService.updateClosedYnByUuid(targetUuid, closedType, closedYn);
|
||||
}
|
||||
|
||||
public Page<WorkHistoryDto> findWorkHistoryList(searchReq searchReq, String userId, String type) {
|
||||
if (type.equals("LABELER")) {
|
||||
return labelAllocateCoreService.workLabelHistoryList(searchReq, userId);
|
||||
} else {
|
||||
return labelAllocateCoreService.workReviewerHistoryList(searchReq, userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ 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.LabelAllocateDto.MoveInfo;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.UserList;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.WorkHistoryDto;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.searchReq;
|
||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.ProjectInfo;
|
||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkProgressInfo;
|
||||
@@ -145,4 +146,13 @@ public class LabelAllocateCoreService {
|
||||
public void updateClosedYnByUuid(String uuid, String closedType, String closedYn) {
|
||||
labelAllocateRepository.updateClosedYnByUuid(uuid, closedType, closedYn);
|
||||
}
|
||||
|
||||
public Page<WorkHistoryDto> workLabelHistoryList(
|
||||
LabelAllocateDto.searchReq searchReq, String userId) {
|
||||
return labelAllocateRepository.workLabelHistoryList(searchReq, userId);
|
||||
}
|
||||
|
||||
public Page<WorkHistoryDto> workReviewerHistoryList(searchReq searchReq, String userId) {
|
||||
return labelAllocateRepository.workReviewerHistoryList(searchReq, userId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ 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.LabelAllocateDto.MoveInfo;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.UserList;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.WorkHistoryDto;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.searchReq;
|
||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.ProjectInfo;
|
||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkProgressInfo;
|
||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerStatistics;
|
||||
@@ -86,4 +88,8 @@ public interface LabelAllocateRepositoryCustom {
|
||||
|
||||
// 프로젝트 종료 여부 업데이트 (uuid 기반)
|
||||
void updateClosedYnByUuid(String uuid, String closedType, String closedYn);
|
||||
|
||||
Page<WorkHistoryDto> workLabelHistoryList(LabelAllocateDto.searchReq searchReq, String userId);
|
||||
|
||||
Page<WorkHistoryDto> workReviewerHistoryList(searchReq searchReq, String userId);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@ import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelingStatDto;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.MoveInfo;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.MoveUserList;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.UserList;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.WorkHistoryDto;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.searchReq;
|
||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.ProjectInfo;
|
||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkProgressInfo;
|
||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerStatistics;
|
||||
@@ -32,6 +34,7 @@ import com.querydsl.core.types.dsl.CaseBuilder;
|
||||
import com.querydsl.core.types.dsl.Expressions;
|
||||
import com.querydsl.core.types.dsl.NumberExpression;
|
||||
import com.querydsl.core.types.dsl.StringExpression;
|
||||
import com.querydsl.jpa.JPAExpressions;
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.EntityNotFoundException;
|
||||
@@ -1457,4 +1460,105 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
em.flush();
|
||||
em.clear();
|
||||
}
|
||||
|
||||
public Page<WorkHistoryDto> workLabelHistoryList(
|
||||
LabelAllocateDto.searchReq searchReq, String userId) {
|
||||
|
||||
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 =
|
||||
new CaseBuilder()
|
||||
.when(labelingAssignmentEntity.workState.eq(LabelState.SKIP.getId()))
|
||||
.then(1L)
|
||||
.otherwise((Long) null)
|
||||
.count();
|
||||
|
||||
NumberExpression<Long> completeCnt =
|
||||
new CaseBuilder()
|
||||
.when(labelingAssignmentEntity.workState.eq(LabelState.DONE.getId()))
|
||||
.then(1L)
|
||||
.otherwise((Long) null)
|
||||
.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();
|
||||
List<WorkHistoryDto> list =
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
WorkHistoryDto.class,
|
||||
Expressions.numberTemplate(
|
||||
Integer.class,
|
||||
"row_number() over(order by {0} desc)",
|
||||
labelingAssignmentEntity.analUid),
|
||||
Expressions.stringTemplate(
|
||||
"concat({0}, '-', {1})",
|
||||
mapSheetAnalInferenceEntity.compareYyyy,
|
||||
mapSheetAnalInferenceEntity.targetYyyy),
|
||||
mapSheetAnalInferenceEntity.stage,
|
||||
mapSheetAnalInferenceEntity.gukyuinApplyDttm,
|
||||
assignedCnt,
|
||||
completeCnt,
|
||||
skipCnt,
|
||||
skipCnt,
|
||||
// status,
|
||||
percent,
|
||||
mapSheetAnalInferenceEntity.createdDttm,
|
||||
new CaseBuilder()
|
||||
.when(mapSheetAnalInferenceEntity.inspectionClosedYn.eq("Y"))
|
||||
.then(mapSheetAnalInferenceEntity.updatedDttm)
|
||||
.otherwise((ZonedDateTime) null)))
|
||||
.from(labelingAssignmentEntity)
|
||||
.innerJoin(mapSheetAnalInferenceEntity)
|
||||
.on(labelingAssignmentEntity.analUid.eq(mapSheetAnalInferenceEntity.id))
|
||||
.where(
|
||||
labelingAssignmentEntity.analUid.in(
|
||||
JPAExpressions.select(labelingAssignmentEntity.analUid)
|
||||
.from(labelingAssignmentEntity)
|
||||
.where(labelingAssignmentEntity.workerUid.eq(userId))
|
||||
.groupBy(labelingAssignmentEntity.analUid)))
|
||||
.orderBy(percent.desc())
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.fetch();
|
||||
|
||||
Long countQuery =
|
||||
queryFactory
|
||||
.select(mapSheetAnalInferenceEntity.id.count())
|
||||
.from(labelingAssignmentEntity)
|
||||
.innerJoin(mapSheetAnalInferenceEntity)
|
||||
.on(labelingAssignmentEntity.analUid.eq(mapSheetAnalInferenceEntity.id))
|
||||
.where(
|
||||
labelingAssignmentEntity.analUid.in(
|
||||
JPAExpressions.select(labelingAssignmentEntity.analUid)
|
||||
.from(labelingAssignmentEntity)
|
||||
.where(labelingAssignmentEntity.workerUid.eq(userId))
|
||||
.groupBy(labelingAssignmentEntity.analUid)))
|
||||
.fetchOne();
|
||||
|
||||
return new PageImpl<>(list, pageable, countQuery);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<WorkHistoryDto> workReviewerHistoryList(searchReq searchReq, String userId) {
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user