작업현황관리 리스트 API분리
This commit is contained in:
@@ -5,6 +5,9 @@ import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.LabelWorkMng;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.LabelWorkMngSearchReq;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.WorkerState;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.WorkerStateSearchReq;
|
||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerStatistics;
|
||||
import com.kamco.cd.kamcoback.label.service.LabelWorkService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@@ -61,4 +64,34 @@ public class LabelWorkerApiController {
|
||||
searchReq.setSize(size);
|
||||
return ApiResponseDto.ok(labelWorkService.labelWorkMngList(searchReq));
|
||||
}
|
||||
|
||||
@Operation(summary = "작업현황 관리 > 현황 목록 조회", description = "작업현황 관리 > 현황 목록 조회")
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@ApiResponse(
|
||||
responseCode = "200",
|
||||
description = "조회 성공",
|
||||
content =
|
||||
@Content(
|
||||
mediaType = "application/json",
|
||||
schema = @Schema(implementation = CommonCodeDto.Basic.class))),
|
||||
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||
})
|
||||
@GetMapping("/work-state-list")
|
||||
public ApiResponseDto<Page<WorkerState>> findWorkStateList(
|
||||
@Parameter(description = "유형", example = "LABELER") @RequestParam(required = false) String userRole,
|
||||
@Parameter(description = "검색어", example = "20261201") @RequestParam(required = false) String searchVal,
|
||||
@Parameter(description = "페이지 번호 (0부터 시작)", example = "0") @RequestParam(defaultValue = "0")
|
||||
int page,
|
||||
@Parameter(description = "페이지 크기", example = "20") @RequestParam(defaultValue = "20")
|
||||
int size) {
|
||||
|
||||
LabelWorkDto.WorkerStateSearchReq searchReq = new WorkerStateSearchReq();
|
||||
searchReq.setUserRole(userRole);
|
||||
searchReq.setSearchVal(searchVal);
|
||||
searchReq.setPage(page);
|
||||
searchReq.setSize(size);
|
||||
return ApiResponseDto.ok(labelWorkService.findlabelWorkStateList(searchReq));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,11 @@ package com.kamco.cd.kamcoback.label.dto;
|
||||
import com.kamco.cd.kamcoback.common.utils.enums.Enums;
|
||||
import com.kamco.cd.kamcoback.common.utils.interfaces.JsonFormatDttm;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelMngState;
|
||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.DailyHistory;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.time.ZonedDateTime;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
@@ -93,4 +95,86 @@ public class LabelWorkDto {
|
||||
return PageRequest.of(page, size);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(description = "작업자 통계 응답")
|
||||
public static class WorkerState {
|
||||
|
||||
@Schema(description = "작업자 유형 (LABELER/INSPECTOR)")
|
||||
private String userRole;
|
||||
|
||||
@Schema(description = "작업자 ID (사번)")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "작업자 이름")
|
||||
private String userId;
|
||||
|
||||
@Schema(description = "배정개수")
|
||||
private Long assignedCnt;
|
||||
|
||||
@Schema(description = "완료개수")
|
||||
private Long doneCnt;
|
||||
|
||||
@Schema(description = "Skip개수")
|
||||
private Long skipCnt;
|
||||
|
||||
@Schema(description = "Skip개수")
|
||||
private Long day3AgoDoneCnt;
|
||||
|
||||
@Schema(description = "Skip개수")
|
||||
private Long day2AgoDoneCnt;
|
||||
|
||||
@Schema(description = "Skip개수")
|
||||
private Long day1AgoDoneCnt;
|
||||
|
||||
public Long getremindCnt() {
|
||||
return this.assignedCnt - this.doneCnt;
|
||||
}
|
||||
|
||||
public double getDoneRate() {
|
||||
if (this.doneCnt == null || this.assignedCnt == 0) {
|
||||
return 0.0;
|
||||
}
|
||||
return (double) this.doneCnt / this.assignedCnt * 100.0;
|
||||
}
|
||||
|
||||
public String getUserRoleName() {
|
||||
if (this.userRole.equals("LABELER")) {
|
||||
return "라벨러";
|
||||
}
|
||||
return "검수자";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Schema(name = "WorkerStateSearchReq", description = "라벨작업관리 검색 요청")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class WorkerStateSearchReq {
|
||||
|
||||
// 페이징 파라미터
|
||||
@Schema(description = "페이지 번호 (0부터 시작) ", example = "0")
|
||||
private int page = 0;
|
||||
|
||||
@Schema(description = "페이지 크기", example = "20")
|
||||
private int size = 20;
|
||||
|
||||
@Schema(description = "유형", example = "LABELER")
|
||||
private String userRole;
|
||||
|
||||
@Schema(description = "종료일", example = "20261201")
|
||||
private String searchVal;
|
||||
|
||||
public Pageable toPageable() {
|
||||
|
||||
return PageRequest.of(page, size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,6 +135,8 @@ public class LabelAllocateService {
|
||||
// 작업 진행 현황 조회
|
||||
var progressInfo = labelAllocateCoreService.findWorkProgressInfo(analUid);
|
||||
|
||||
|
||||
|
||||
// 작업자 통계 조회
|
||||
List<WorkerStatistics> workers =
|
||||
labelAllocateCoreService.findWorkerStatistics(
|
||||
@@ -155,20 +157,9 @@ public class LabelAllocateService {
|
||||
|
||||
long average = (day1Count + day2Count + day3Count) / 3;
|
||||
|
||||
DailyHistory history =
|
||||
DailyHistory.builder()
|
||||
.day1Ago(day1Count)
|
||||
.day2Ago(day2Count)
|
||||
.day3Ago(day3Count)
|
||||
.average(average)
|
||||
.build();
|
||||
|
||||
worker.setHistory(history);
|
||||
|
||||
// 정체 여부 판단 (3일 평균이 STAGNATION_THRESHOLD 미만일 때)
|
||||
if (average < STAGNATION_THRESHOLD) {
|
||||
worker.setIsStagnated(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 페이징 처리
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.kamco.cd.kamcoback.label.service;
|
||||
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.LabelWorkMng;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.WorkerState;
|
||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerStatistics;
|
||||
import com.kamco.cd.kamcoback.postgres.core.LabelWorkCoreService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -21,4 +23,10 @@ public class LabelWorkService {
|
||||
|
||||
return labelWorkCoreService.labelWorkMngList(searchReq);
|
||||
}
|
||||
|
||||
|
||||
public Page<WorkerState> findlabelWorkStateList(LabelWorkDto.WorkerStateSearchReq searchReq) {
|
||||
|
||||
return labelWorkCoreService.findlabelWorkStateList(searchReq);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user