Merge pull request 'feat/dev_251201' (#137) from feat/dev_251201 into develop
Reviewed-on: https://kamco.gitea.gs.dabeeo.com/dabeeo/kamco-dabeeo-backoffice/pulls/137
This commit is contained in:
@@ -63,8 +63,8 @@ public class LabelAllocateApiController {
|
|||||||
})
|
})
|
||||||
@GetMapping("/admin/workers")
|
@GetMapping("/admin/workers")
|
||||||
public ApiResponseDto<WorkerListResponse> getWorkerStatistics(
|
public ApiResponseDto<WorkerListResponse> getWorkerStatistics(
|
||||||
@Parameter(description = "분석 ID (필수)", required = true, example = "3") @RequestParam
|
// @Parameter(description = "분석 ID (선택)", example = "3") @RequestParam(required = false)
|
||||||
Long analUid,
|
// Long analUid,
|
||||||
@Parameter(
|
@Parameter(
|
||||||
description = "작업자 유형 (선택) - 미입력 시 LABELER로 조회",
|
description = "작업자 유형 (선택) - 미입력 시 LABELER로 조회",
|
||||||
example = "LABELER",
|
example = "LABELER",
|
||||||
@@ -74,11 +74,9 @@ public class LabelAllocateApiController {
|
|||||||
defaultValue = "LABELER"))
|
defaultValue = "LABELER"))
|
||||||
@RequestParam(required = false)
|
@RequestParam(required = false)
|
||||||
String type,
|
String type,
|
||||||
@Parameter(description = "작업자 이름 검색 (부분 일치)", example = "김라벨") @RequestParam(required = false)
|
@Parameter(description = "검색어 (작업자 이름 또는 사번으로 검색, 부분 일치)", example = "김라벨")
|
||||||
String searchName,
|
|
||||||
@Parameter(description = "작업자 사번 검색 (부분 일치)", example = "1234567")
|
|
||||||
@RequestParam(required = false)
|
@RequestParam(required = false)
|
||||||
String searchEmployeeNo,
|
String search,
|
||||||
@Parameter(
|
@Parameter(
|
||||||
description = "정렬 조건 (선택) - 미입력 시 이름 오름차순",
|
description = "정렬 조건 (선택) - 미입력 시 이름 오름차순",
|
||||||
example = "REMAINING_DESC",
|
example = "REMAINING_DESC",
|
||||||
@@ -87,6 +85,8 @@ public class LabelAllocateApiController {
|
|||||||
allowableValues = {
|
allowableValues = {
|
||||||
"REMAINING_DESC",
|
"REMAINING_DESC",
|
||||||
"REMAINING_ASC",
|
"REMAINING_ASC",
|
||||||
|
"COMPLETED_DESC",
|
||||||
|
"COMPLETED_ASC",
|
||||||
"NAME_ASC",
|
"NAME_ASC",
|
||||||
"NAME_DESC"
|
"NAME_DESC"
|
||||||
},
|
},
|
||||||
@@ -98,8 +98,7 @@ public class LabelAllocateApiController {
|
|||||||
String workerType = (type == null || type.isEmpty()) ? RoleType.LABELER.name() : type;
|
String workerType = (type == null || type.isEmpty()) ? RoleType.LABELER.name() : type;
|
||||||
|
|
||||||
return ApiResponseDto.ok(
|
return ApiResponseDto.ok(
|
||||||
labelAllocateService.getWorkerStatistics(
|
labelAllocateService.getWorkerStatistics(null, workerType, search, sort));
|
||||||
analUid, workerType, searchName, searchEmployeeNo, sort));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "라벨링작업 관리 > 작업 배정", description = "라벨링작업 관리 > 작업 배정")
|
@Operation(summary = "라벨링작업 관리 > 작업 배정", description = "라벨링작업 관리 > 작업 배정")
|
||||||
@@ -122,8 +121,6 @@ public class LabelAllocateApiController {
|
|||||||
|
|
||||||
return ApiResponseDto.okObject(
|
return ApiResponseDto.okObject(
|
||||||
labelAllocateService.allocateAsc(
|
labelAllocateService.allocateAsc(
|
||||||
dto.getLabelerAutoType(),
|
|
||||||
dto.getInspectorAutoType(),
|
|
||||||
dto.getStage(),
|
dto.getStage(),
|
||||||
dto.getLabelers(),
|
dto.getLabelers(),
|
||||||
dto.getInspectors(),
|
dto.getInspectors(),
|
||||||
@@ -140,13 +137,13 @@ public class LabelAllocateApiController {
|
|||||||
})
|
})
|
||||||
@GetMapping("/stage-detail")
|
@GetMapping("/stage-detail")
|
||||||
public ApiResponseDto<InferenceDetail> findInferenceDetail(
|
public ApiResponseDto<InferenceDetail> findInferenceDetail(
|
||||||
@Parameter(description = "비교년도", required = true, example = "2022") @RequestParam
|
@Parameter(
|
||||||
Integer compareYyyy,
|
description = "회차 마스터 key",
|
||||||
@Parameter(description = "기준년도", required = true, example = "2024") @RequestParam
|
required = true,
|
||||||
Integer targetYyyy,
|
example = "8584e8d4-53b3-4582-bde2-28a81495a626")
|
||||||
@Parameter(description = "회차", required = true, example = "4") @RequestParam Integer stage) {
|
@RequestParam
|
||||||
return ApiResponseDto.ok(
|
String uuid) {
|
||||||
labelAllocateService.findInferenceDetail(compareYyyy, targetYyyy, stage));
|
return ApiResponseDto.ok(labelAllocateService.findInferenceDetail(uuid));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(
|
@Operation(
|
||||||
@@ -154,14 +151,14 @@ public class LabelAllocateApiController {
|
|||||||
description = "작업현황 관리 > 라벨러 상세 정보, 작업이관 팝업 내 라벨러 상세 정보 동일")
|
description = "작업현황 관리 > 라벨러 상세 정보, 작업이관 팝업 내 라벨러 상세 정보 동일")
|
||||||
@GetMapping("/labeler-detail")
|
@GetMapping("/labeler-detail")
|
||||||
public ApiResponseDto<LabelerDetail> findLabelerDetail(
|
public ApiResponseDto<LabelerDetail> findLabelerDetail(
|
||||||
@RequestParam(defaultValue = "01022223333") String userId,
|
@RequestParam(defaultValue = "01022223333", required = true) String userId,
|
||||||
@Parameter(description = "비교년도", required = true, example = "2022") @RequestParam
|
@Parameter(
|
||||||
Integer compareYyyy,
|
description = "회차 마스터 key",
|
||||||
@Parameter(description = "기준년도", required = true, example = "2024") @RequestParam
|
required = true,
|
||||||
Integer targetYyyy,
|
example = "8584e8d4-53b3-4582-bde2-28a81495a626")
|
||||||
@Parameter(description = "회차", required = true, example = "4") @RequestParam Integer stage) {
|
@RequestParam
|
||||||
return ApiResponseDto.ok(
|
String uuid) {
|
||||||
labelAllocateService.findLabelerDetail(userId, compareYyyy, targetYyyy, stage));
|
return ApiResponseDto.ok(labelAllocateService.findLabelerDetail(userId, uuid));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "작업현황 관리 > 상세 > 작업 이관", description = "작업현황 관리 > 상세 > 작업 이관")
|
@Operation(summary = "작업현황 관리 > 상세 > 작업 이관", description = "작업현황 관리 > 상세 > 작업 이관")
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
package com.kamco.cd.kamcoback.label;
|
package com.kamco.cd.kamcoback.label;
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.code.dto.CommonCodeDto;
|
|
||||||
import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
|
import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto;
|
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto;
|
||||||
|
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.ChangeDetectYear;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.LabelWorkMng;
|
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.LabelWorkMng;
|
||||||
|
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.LabelWorkMngDetail;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.LabelWorkMngSearchReq;
|
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.LabelWorkMngSearchReq;
|
||||||
import com.kamco.cd.kamcoback.label.service.LabelWorkService;
|
import com.kamco.cd.kamcoback.label.service.LabelWorkService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
@@ -13,10 +14,13 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
|||||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@@ -30,6 +34,24 @@ public class LabelWorkerApiController {
|
|||||||
|
|
||||||
private final LabelWorkService labelWorkService;
|
private final LabelWorkService labelWorkService;
|
||||||
|
|
||||||
|
@Operation(summary = "변화탐지 년도 셀렉트박스 조회", description = "라벨링작업 관리 > 목록 조회 변화탐지 년도 셀렉트박스 조회")
|
||||||
|
@ApiResponses(
|
||||||
|
value = {
|
||||||
|
@ApiResponse(
|
||||||
|
responseCode = "200",
|
||||||
|
description = "조회 성공",
|
||||||
|
content =
|
||||||
|
@Content(
|
||||||
|
mediaType = "application/json",
|
||||||
|
schema = @Schema(implementation = ChangeDetectYear.class))),
|
||||||
|
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||||
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
|
})
|
||||||
|
@GetMapping("/change-detect-year")
|
||||||
|
public ApiResponseDto<List<ChangeDetectYear>> getChangeDetectYear() {
|
||||||
|
return ApiResponseDto.ok(labelWorkService.getChangeDetectYear());
|
||||||
|
}
|
||||||
|
|
||||||
@Operation(summary = "라벨링작업 관리 > 목록 조회", description = "라벨링작업 관리 > 목록 조회")
|
@Operation(summary = "라벨링작업 관리 > 목록 조회", description = "라벨링작업 관리 > 목록 조회")
|
||||||
@ApiResponses(
|
@ApiResponses(
|
||||||
value = {
|
value = {
|
||||||
@@ -39,25 +61,45 @@ public class LabelWorkerApiController {
|
|||||||
content =
|
content =
|
||||||
@Content(
|
@Content(
|
||||||
mediaType = "application/json",
|
mediaType = "application/json",
|
||||||
schema = @Schema(implementation = CommonCodeDto.Basic.class))),
|
schema = @Schema(implementation = Page.class))),
|
||||||
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
})
|
})
|
||||||
@GetMapping("/label-work-mng-list")
|
@GetMapping("/label-work-mng-list")
|
||||||
public ApiResponseDto<Page<LabelWorkMng>> labelWorkMngList(
|
public ApiResponseDto<Page<LabelWorkMng>> labelWorkMngList(
|
||||||
@Schema(description = "변화탐지년도", example = "2024") Integer detectYyyy,
|
@Parameter(description = "변화탐지년도", example = "2022-2024") @RequestParam(required = false)
|
||||||
@Schema(description = "시작일", example = "20260101") String strtDttm,
|
String detectYear,
|
||||||
@Schema(description = "종료일", example = "20261201") String endDttm,
|
@Parameter(description = "시작일", example = "20220101") @RequestParam String strtDttm,
|
||||||
|
@Parameter(description = "종료일", example = "20261201") @RequestParam String endDttm,
|
||||||
@Parameter(description = "페이지 번호 (0부터 시작)", example = "0") @RequestParam(defaultValue = "0")
|
@Parameter(description = "페이지 번호 (0부터 시작)", example = "0") @RequestParam(defaultValue = "0")
|
||||||
int page,
|
int page,
|
||||||
@Parameter(description = "페이지 크기", example = "20") @RequestParam(defaultValue = "20")
|
@Parameter(description = "페이지 크기", example = "20") @RequestParam(defaultValue = "20")
|
||||||
int size) {
|
int size) {
|
||||||
LabelWorkDto.LabelWorkMngSearchReq searchReq = new LabelWorkMngSearchReq();
|
LabelWorkDto.LabelWorkMngSearchReq searchReq = new LabelWorkMngSearchReq();
|
||||||
searchReq.setDetectYyyy(detectYyyy);
|
searchReq.setDetectYear(detectYear);
|
||||||
searchReq.setStrtDttm(strtDttm);
|
searchReq.setStrtDttm(strtDttm);
|
||||||
searchReq.setEndDttm(endDttm);
|
searchReq.setEndDttm(endDttm);
|
||||||
searchReq.setPage(page);
|
searchReq.setPage(page);
|
||||||
searchReq.setSize(size);
|
searchReq.setSize(size);
|
||||||
return ApiResponseDto.ok(labelWorkService.labelWorkMngList(searchReq));
|
return ApiResponseDto.ok(labelWorkService.labelWorkMngList(searchReq));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "라벨링작업 관리 > 작업 배정 정보조회", description = "작업 배정 정보조회")
|
||||||
|
@ApiResponses(
|
||||||
|
value = {
|
||||||
|
@ApiResponse(
|
||||||
|
responseCode = "200",
|
||||||
|
description = "조회 성공",
|
||||||
|
content =
|
||||||
|
@Content(
|
||||||
|
mediaType = "application/json",
|
||||||
|
schema = @Schema(implementation = LabelWorkMngDetail.class))),
|
||||||
|
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||||
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
|
})
|
||||||
|
@GetMapping("/label-work-mng-detail/{uuid}")
|
||||||
|
public ApiResponseDto<LabelWorkMngDetail> labelWorkMngDetail(
|
||||||
|
@Parameter(description = "uuid") @PathVariable UUID uuid) {
|
||||||
|
return ApiResponseDto.ok(labelWorkService.findLabelWorkMngDetail(uuid));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,11 @@ import java.util.List;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.data.domain.Sort;
|
||||||
|
|
||||||
public class LabelAllocateDto {
|
public class LabelAllocateDto {
|
||||||
|
|
||||||
@@ -87,22 +91,13 @@ public class LabelAllocateDto {
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public static class AllocateDto {
|
public static class AllocateDto {
|
||||||
|
|
||||||
// @Schema(description = "분석 ID", example = "3")
|
|
||||||
// private Long analUid;
|
|
||||||
|
|
||||||
@Schema(description = "비교년도", example = "2022", required = true)
|
@Schema(description = "비교년도", example = "2022", required = true)
|
||||||
private Integer compareYyyy;
|
private Integer compareYyyy;
|
||||||
|
|
||||||
@Schema(description = "기준년도", example = "2024", required = true)
|
@Schema(description = "기준년도", example = "2024", required = true)
|
||||||
private Integer targetYyyy;
|
private Integer targetYyyy;
|
||||||
|
|
||||||
@Schema(description = "라벨러 자동/수동여부(AUTO/MANUAL)", example = "AUTO")
|
@Schema(description = "회차", example = "4", required = true)
|
||||||
private String labelerAutoType;
|
|
||||||
|
|
||||||
@Schema(description = "검수자 자동/수동여부(AUTO/MANUAL)", example = "AUTO")
|
|
||||||
private String inspectorAutoType;
|
|
||||||
|
|
||||||
@Schema(description = "회차", example = "4")
|
|
||||||
private Integer stage;
|
private Integer stage;
|
||||||
|
|
||||||
@Schema(
|
@Schema(
|
||||||
@@ -130,22 +125,12 @@ public class LabelAllocateDto {
|
|||||||
description = "검수자 할당 목록",
|
description = "검수자 할당 목록",
|
||||||
example =
|
example =
|
||||||
"""
|
"""
|
||||||
[
|
["K20251216001",
|
||||||
{
|
"01022225555",
|
||||||
"inspectorUid": "K20251216001",
|
"K20251212001"
|
||||||
"userCount": 1000
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"inspectorUid": "01022225555",
|
|
||||||
"userCount": 340
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"inspectorUid": "K20251212001",
|
|
||||||
"userCount": 500
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
""")
|
""")
|
||||||
private List<TargetInspector> inspectors;
|
private List<String> inspectors;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -190,6 +175,9 @@ public class LabelAllocateDto {
|
|||||||
private Long analUid;
|
private Long analUid;
|
||||||
private ZonedDateTime createdDttm;
|
private ZonedDateTime createdDttm;
|
||||||
private ZonedDateTime updatedDttm;
|
private ZonedDateTime updatedDttm;
|
||||||
|
private String inspectState;
|
||||||
|
private ZonedDateTime workStatDttm;
|
||||||
|
private ZonedDateTime inspectStatDttm;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -229,7 +217,7 @@ public class LabelAllocateDto {
|
|||||||
private Double percent;
|
private Double percent;
|
||||||
private Integer ranking;
|
private Integer ranking;
|
||||||
private ZonedDateTime createdDttm;
|
private ZonedDateTime createdDttm;
|
||||||
private String inspectorName;
|
private String ownerName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -273,6 +261,44 @@ public class LabelAllocateDto {
|
|||||||
public static class AllocateInfoDto {
|
public static class AllocateInfoDto {
|
||||||
|
|
||||||
private Long geoUid;
|
private Long geoUid;
|
||||||
private String mapSheetNum;
|
private Long mapSheetNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class LabelingStatDto {
|
||||||
|
|
||||||
|
private String workDate;
|
||||||
|
private Long dailyTotalCnt;
|
||||||
|
private Long totalCnt;
|
||||||
|
private Long assignedCnt;
|
||||||
|
private Long skipCnt;
|
||||||
|
private Long completeCnt;
|
||||||
|
private Long remainCnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Schema(name = "searchReq", description = "일자별 작업 목록 요청")
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class searchReq {
|
||||||
|
|
||||||
|
// 페이징 파라미터
|
||||||
|
private int page = 0;
|
||||||
|
private int size = 20;
|
||||||
|
private String sort;
|
||||||
|
|
||||||
|
public Pageable toPageable() {
|
||||||
|
if (sort != null && !sort.isEmpty()) {
|
||||||
|
String[] sortParams = sort.split(",");
|
||||||
|
String property = sortParams[0];
|
||||||
|
Sort.Direction direction =
|
||||||
|
sortParams.length > 1 ? Sort.Direction.fromString(sortParams[1]) : Sort.Direction.ASC;
|
||||||
|
return PageRequest.of(page, size, Sort.by(direction, property));
|
||||||
|
}
|
||||||
|
return PageRequest.of(page, size);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.kamco.cd.kamcoback.label.dto;
|
||||||
|
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
import java.util.UUID;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
public class LabelInspectorDto {
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class Basic {
|
||||||
|
|
||||||
|
private UUID operatorUid;
|
||||||
|
private Long analUid;
|
||||||
|
private String inspectorUid;
|
||||||
|
private ZonedDateTime createdDttm;
|
||||||
|
private ZonedDateTime updatedDttm;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,12 @@
|
|||||||
package com.kamco.cd.kamcoback.label.dto;
|
package com.kamco.cd.kamcoback.label.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.kamco.cd.kamcoback.common.utils.enums.Enums;
|
import com.kamco.cd.kamcoback.common.utils.enums.Enums;
|
||||||
import com.kamco.cd.kamcoback.common.utils.interfaces.JsonFormatDttm;
|
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.LabelAllocateDto.LabelMngState;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
|
import java.util.UUID;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -14,6 +16,15 @@ import org.springframework.data.domain.Pageable;
|
|||||||
|
|
||||||
public class LabelWorkDto {
|
public class LabelWorkDto {
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class ChangeDetectYear {
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
private String name;
|
||||||
|
}
|
||||||
|
|
||||||
@Schema(name = "LabelWorkMng", description = "라벨작업관리")
|
@Schema(name = "LabelWorkMng", description = "라벨작업관리")
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@@ -21,8 +32,9 @@ public class LabelWorkDto {
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public static class LabelWorkMng {
|
public static class LabelWorkMng {
|
||||||
|
|
||||||
private int compareYyyy;
|
private UUID uuid;
|
||||||
private int targetYyyy;
|
private Integer compareYyyy;
|
||||||
|
private Integer targetYyyy;
|
||||||
private int stage;
|
private int stage;
|
||||||
@JsonFormatDttm private ZonedDateTime createdDttm;
|
@JsonFormatDttm private ZonedDateTime createdDttm;
|
||||||
private Long detectionTotCnt;
|
private Long detectionTotCnt;
|
||||||
@@ -32,6 +44,14 @@ public class LabelWorkDto {
|
|||||||
private Long labelCompleteTotCnt;
|
private Long labelCompleteTotCnt;
|
||||||
@JsonFormatDttm private ZonedDateTime labelStartDttm;
|
@JsonFormatDttm private ZonedDateTime labelStartDttm;
|
||||||
|
|
||||||
|
@JsonProperty("detectYear")
|
||||||
|
public String getDetectYear() {
|
||||||
|
if (compareYyyy == null || targetYyyy == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return compareYyyy + "-" + targetYyyy;
|
||||||
|
}
|
||||||
|
|
||||||
public String getLabelState() {
|
public String getLabelState() {
|
||||||
|
|
||||||
String mngState = "PENDING";
|
String mngState = "PENDING";
|
||||||
@@ -65,6 +85,20 @@ public class LabelWorkDto {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public static class LabelWorkMngDetail {
|
||||||
|
|
||||||
|
private String detectionYear;
|
||||||
|
private Integer stage;
|
||||||
|
@JsonFormatDttm private ZonedDateTime createdDttm;
|
||||||
|
private Long labelTotCnt;
|
||||||
|
private Long labeler;
|
||||||
|
private Long reviewer;
|
||||||
|
}
|
||||||
|
|
||||||
@Schema(name = "LabelWorkMngSearchReq", description = "라벨작업관리 검색 요청")
|
@Schema(name = "LabelWorkMngSearchReq", description = "라벨작업관리 검색 요청")
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@@ -80,7 +114,7 @@ public class LabelWorkDto {
|
|||||||
private int size = 20;
|
private int size = 20;
|
||||||
|
|
||||||
@Schema(description = "변화탐지년도", example = "2024")
|
@Schema(description = "변화탐지년도", example = "2024")
|
||||||
private Integer detectYyyy;
|
private String detectYear;
|
||||||
|
|
||||||
@Schema(description = "시작일", example = "20260101")
|
@Schema(description = "시작일", example = "20260101")
|
||||||
private String strtDttm;
|
private String strtDttm;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.kamco.cd.kamcoback.label.dto;
|
package com.kamco.cd.kamcoback.label.dto;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import java.util.List;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@@ -10,6 +9,27 @@ import lombok.Setter;
|
|||||||
|
|
||||||
public class WorkerStatsDto {
|
public class WorkerStatsDto {
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Schema(description = "프로젝트 기본 정보 (상단 표시용)")
|
||||||
|
public static class ProjectInfo {
|
||||||
|
|
||||||
|
@Schema(description = "변화탐지년도 (예: 2026-2025)")
|
||||||
|
private String detectionYear;
|
||||||
|
|
||||||
|
@Schema(description = "회차 (예: 8)")
|
||||||
|
private String round;
|
||||||
|
|
||||||
|
@Schema(description = "국유인 반영일 (예: 2026-03-31)")
|
||||||
|
private String reflectionDate;
|
||||||
|
|
||||||
|
@Schema(description = "작업 시작일 (예: 2026-04-06)")
|
||||||
|
private String startDate;
|
||||||
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@Builder
|
@Builder
|
||||||
@@ -44,6 +64,19 @@ public class WorkerStatsDto {
|
|||||||
|
|
||||||
@Schema(description = "작업 정체 여부 (3일간 실적이 저조하면 true)")
|
@Schema(description = "작업 정체 여부 (3일간 실적이 저조하면 true)")
|
||||||
private Boolean isStagnated;
|
private Boolean isStagnated;
|
||||||
|
|
||||||
|
// 레거시 필드 (기존 호환성 유지)
|
||||||
|
@Deprecated private Long doneCnt; // completed로 대체
|
||||||
|
|
||||||
|
@Deprecated private Long skipCnt; // skipped로 대체
|
||||||
|
|
||||||
|
@Deprecated private Long remainingCnt; // remaining으로 대체
|
||||||
|
|
||||||
|
@Deprecated private Long day3AgoDoneCnt; // history.day3Ago로 대체
|
||||||
|
|
||||||
|
@Deprecated private Long day2AgoDoneCnt; // history.day2Ago로 대체
|
||||||
|
|
||||||
|
@Deprecated private Long day1AgoDoneCnt; // history.day1Ago로 대체
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -75,29 +108,74 @@ public class WorkerStatsDto {
|
|||||||
@Schema(description = "작업 진행 현황 정보")
|
@Schema(description = "작업 진행 현황 정보")
|
||||||
public static class WorkProgressInfo {
|
public static class WorkProgressInfo {
|
||||||
|
|
||||||
|
// === 라벨링 관련 ===
|
||||||
@Schema(description = "라벨링 진행률 (완료건+스킵건)/배정건")
|
@Schema(description = "라벨링 진행률 (완료건+스킵건)/배정건")
|
||||||
private Double labelingProgressRate;
|
private Double labelingProgressRate;
|
||||||
|
|
||||||
@Schema(description = "작업 상태 (진행중/종료)")
|
@Schema(description = "라벨링 작업 상태 (진행중/완료)")
|
||||||
private String workStatus;
|
private String labelingStatus;
|
||||||
|
|
||||||
@Schema(description = "진행률 수치 (완료+스킵)")
|
@Schema(description = "라벨링 전체 배정 건수")
|
||||||
private Long completedCount;
|
private Long labelingTotalCount;
|
||||||
|
|
||||||
@Schema(description = "전체 배정 건수")
|
@Schema(description = "라벨링 완료 건수 (LABEL_FIN + TEST_ING + DONE)")
|
||||||
private Long totalAssignedCount;
|
private Long labelingCompletedCount;
|
||||||
|
|
||||||
|
@Schema(description = "라벨링 스킵 건수 (SKIP)")
|
||||||
|
private Long labelingSkipCount;
|
||||||
|
|
||||||
|
@Schema(description = "라벨링 남은 작업 건수")
|
||||||
|
private Long labelingRemainingCount;
|
||||||
|
|
||||||
@Schema(description = "투입된 라벨러 수")
|
@Schema(description = "투입된 라벨러 수")
|
||||||
private Long labelerCount;
|
private Long labelerCount;
|
||||||
|
|
||||||
@Schema(description = "남은 라벨링 작업 데이터 수")
|
// === 검수(Inspection) 관련 (신규 추가) ===
|
||||||
private Long remainingLabelCount;
|
@Schema(description = "검수 진행률 (완료건/대상건)")
|
||||||
|
private Double inspectionProgressRate;
|
||||||
|
|
||||||
|
@Schema(description = "검수 작업 상태 (진행중/완료)")
|
||||||
|
private String inspectionStatus;
|
||||||
|
|
||||||
|
@Schema(description = "검수 전체 대상 건수")
|
||||||
|
private Long inspectionTotalCount;
|
||||||
|
|
||||||
|
@Schema(description = "검수 완료 건수 (DONE)")
|
||||||
|
private Long inspectionCompletedCount;
|
||||||
|
|
||||||
|
@Schema(description = "검수 제외 건수 (라벨링 스킵과 동일)")
|
||||||
|
private Long inspectionSkipCount;
|
||||||
|
|
||||||
|
@Schema(description = "검수 남은 작업 건수")
|
||||||
|
private Long inspectionRemainingCount;
|
||||||
|
|
||||||
@Schema(description = "투입된 검수자 수")
|
@Schema(description = "투입된 검수자 수")
|
||||||
private Long inspectorCount;
|
private Long inspectorCount;
|
||||||
|
|
||||||
@Schema(description = "남은 검수 작업 데이터 수")
|
// === 레거시 호환 필드 (Deprecated) ===
|
||||||
|
@Deprecated
|
||||||
|
@Schema(description = "[Deprecated] labelingProgressRate 사용 권장")
|
||||||
|
private Double progressRate;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
@Schema(description = "[Deprecated] labelingTotalCount 사용 권장")
|
||||||
|
private Long totalAssignedCount;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
@Schema(description = "[Deprecated] labelingCompletedCount 사용 권장")
|
||||||
|
private Long completedCount;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
@Schema(description = "[Deprecated] labelingRemainingCount 사용 권장")
|
||||||
|
private Long remainingLabelCount;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
@Schema(description = "[Deprecated] inspectionRemainingCount 사용 권장")
|
||||||
private Long remainingInspectCount;
|
private Long remainingInspectCount;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
@Schema(description = "[Deprecated] labelingStatus/inspectionStatus 사용 권장")
|
||||||
|
private String workStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -108,10 +186,12 @@ public class WorkerStatsDto {
|
|||||||
@Schema(description = "작업자 목록 응답 (작업 정보 포함)")
|
@Schema(description = "작업자 목록 응답 (작업 정보 포함)")
|
||||||
public static class WorkerListResponse {
|
public static class WorkerListResponse {
|
||||||
|
|
||||||
|
@Schema(description = "프로젝트 기본 정보 (상단 표시용)")
|
||||||
|
private ProjectInfo projectInfo;
|
||||||
|
|
||||||
@Schema(description = "작업 진행 현황 정보")
|
@Schema(description = "작업 진행 현황 정보")
|
||||||
private WorkProgressInfo progressInfo;
|
private WorkProgressInfo progressInfo;
|
||||||
|
|
||||||
@Schema(description = "작업자 목록")
|
// workers 필드는 제거되었습니다 (프로젝트 정보와 진행현황만 반환)
|
||||||
private List<WorkerStatistics> workers;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,17 +6,12 @@ import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto;
|
|||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.AllocateInfoDto;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.AllocateInfoDto;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InferenceDetail;
|
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.LabelerDetail;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.TargetInspector;
|
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.TargetUser;
|
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.UserList;
|
||||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.DailyHistory;
|
|
||||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerListResponse;
|
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerListResponse;
|
||||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerStatistics;
|
|
||||||
import com.kamco.cd.kamcoback.postgres.core.LabelAllocateCoreService;
|
import com.kamco.cd.kamcoback.postgres.core.LabelAllocateCoreService;
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -26,9 +21,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
@Transactional
|
@Transactional
|
||||||
public class LabelAllocateService {
|
public class LabelAllocateService {
|
||||||
|
|
||||||
private static final int STAGNATION_THRESHOLD = 10; // 정체 판단 기준 (3일 평균 처리량)
|
|
||||||
private static final int BATCH_SIZE = 100; // 배정 배치 크기
|
|
||||||
|
|
||||||
private final LabelAllocateCoreService labelAllocateCoreService;
|
private final LabelAllocateCoreService labelAllocateCoreService;
|
||||||
|
|
||||||
public LabelAllocateService(LabelAllocateCoreService labelAllocateCoreService) {
|
public LabelAllocateService(LabelAllocateCoreService labelAllocateCoreService) {
|
||||||
@@ -38,19 +30,15 @@ public class LabelAllocateService {
|
|||||||
/**
|
/**
|
||||||
* 도엽 기준 asc sorting 해서 할당 수만큼 배정하는 로직
|
* 도엽 기준 asc sorting 해서 할당 수만큼 배정하는 로직
|
||||||
*
|
*
|
||||||
* @param labelerAutoType 라벨러 자동/수동 배정 타입
|
|
||||||
* @param inspectorAutoType 검수자 자동/수동 배정 타입
|
|
||||||
* @param stage 회차
|
* @param stage 회차
|
||||||
* @param targetUsers 라벨러 목록
|
* @param targetUsers 라벨러 목록
|
||||||
* @param targetInspectors 검수자 목록
|
* @param targetInspectors 검수자 목록
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
public ApiResponseDto.ResponseObj allocateAsc(
|
public ApiResponseDto.ResponseObj allocateAsc(
|
||||||
String labelerAutoType,
|
|
||||||
String inspectorAutoType,
|
|
||||||
Integer stage,
|
Integer stage,
|
||||||
List<TargetUser> targetUsers,
|
List<TargetUser> targetUsers,
|
||||||
List<TargetInspector> targetInspectors,
|
List<String> targetInspectors,
|
||||||
Integer compareYyyy,
|
Integer compareYyyy,
|
||||||
Integer targetYyyy) {
|
Integer targetYyyy) {
|
||||||
Long lastId = null;
|
Long lastId = null;
|
||||||
@@ -70,35 +58,45 @@ public class LabelAllocateService {
|
|||||||
|
|
||||||
List<AllocateInfoDto> allIds =
|
List<AllocateInfoDto> allIds =
|
||||||
labelAllocateCoreService.fetchNextIds(lastId, chargeCnt, compareYyyy, targetYyyy, stage);
|
labelAllocateCoreService.fetchNextIds(lastId, chargeCnt, compareYyyy, targetYyyy, stage);
|
||||||
|
|
||||||
|
// MapSheetAnalInferenceEntity analUid 가져오기
|
||||||
|
Long analUid =
|
||||||
|
labelAllocateCoreService.findMapSheetAnalInferenceUid(compareYyyy, targetYyyy, stage);
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (TargetUser target : targetUsers) {
|
for (TargetUser target : targetUsers) {
|
||||||
int end = index + target.getDemand();
|
int end = index + target.getDemand();
|
||||||
List<AllocateInfoDto> sub = allIds.subList(index, end);
|
List<AllocateInfoDto> sub = allIds.subList(index, end);
|
||||||
|
|
||||||
labelAllocateCoreService.assignOwner(sub, target.getUserId(), compareYyyy, targetYyyy, stage);
|
labelAllocateCoreService.assignOwner(sub, target.getUserId(), analUid);
|
||||||
index = end;
|
index = end;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 검수자에게 userCount명 만큼 할당
|
// 검수자에게 userCount명 만큼 할당
|
||||||
List<LabelAllocateDto.Basic> list =
|
List<LabelAllocateDto.Basic> list = labelAllocateCoreService.findAssignedLabelerList(analUid);
|
||||||
labelAllocateCoreService.findAssignedLabelerList(compareYyyy, targetYyyy, stage);
|
|
||||||
int from = 0;
|
|
||||||
|
|
||||||
for (TargetInspector inspector : targetInspectors) {
|
for (String inspector : targetInspectors) {
|
||||||
int to = Math.min(from + inspector.getUserCount(), list.size());
|
labelAllocateCoreService.insertInspector(analUid, inspector);
|
||||||
|
|
||||||
if (from >= to) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<UUID> assignmentUids =
|
|
||||||
list.subList(from, to).stream().map(LabelAllocateDto.Basic::getAssignmentUid).toList();
|
|
||||||
|
|
||||||
labelAllocateCoreService.assignInspectorBulk(assignmentUids, inspector.getInspectorUid());
|
|
||||||
|
|
||||||
from = to;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// int from = 0;
|
||||||
|
// for (TargetInspector inspector : targetInspectors) {
|
||||||
|
// int to = Math.min(from + inspector.getUserCount(), list.size());
|
||||||
|
//
|
||||||
|
// if (from >= to) {
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// List<UUID> assignmentUids =
|
||||||
|
// list.subList(from,
|
||||||
|
// to).stream().map(LabelAllocateDto.Basic::getAssignmentUid).toList();
|
||||||
|
//
|
||||||
|
// labelAllocateCoreService.assignInspectorBulk(assignmentUids,
|
||||||
|
// inspector.getInspectorUid());
|
||||||
|
//
|
||||||
|
// from = to;
|
||||||
|
// }
|
||||||
|
|
||||||
return new ApiResponseDto.ResponseObj(ApiResponseCode.OK, "배정이 완료되었습니다.");
|
return new ApiResponseDto.ResponseObj(ApiResponseCode.OK, "배정이 완료되었습니다.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,67 +105,28 @@ public class LabelAllocateService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 작업자 목록 및 3일치 통계 조회
|
* 작업자 통계 조회
|
||||||
*
|
*
|
||||||
* @param analUid 분석 ID
|
* @param analUid 분석 ID
|
||||||
* @param workerType 작업자 유형 (LABELER/INSPECTOR)
|
* @param workerType 작업자 유형 (LABELER/INSPECTOR)
|
||||||
* @param searchName 이름 검색
|
* @param search 검색어 (이름 또는 사번)
|
||||||
* @param searchEmployeeNo 사번 검색
|
|
||||||
* @param sortType 정렬 조건
|
* @param sortType 정렬 조건
|
||||||
* @return 작업자 목록 및 통계
|
* @return 작업자 목록 및 통계
|
||||||
*/
|
*/
|
||||||
public WorkerListResponse getWorkerStatistics(
|
public WorkerListResponse getWorkerStatistics(
|
||||||
Long analUid,
|
Long analUid, String workerType, String search, String sortType) {
|
||||||
String workerType,
|
|
||||||
String searchName,
|
// 프로젝트 정보 조회 (analUid가 있을 때만)
|
||||||
String searchEmployeeNo,
|
var projectInfo = labelAllocateCoreService.findProjectInfo(analUid);
|
||||||
String sortType) {
|
|
||||||
|
|
||||||
// 작업 진행 현황 조회
|
// 작업 진행 현황 조회
|
||||||
var progressInfo = labelAllocateCoreService.findWorkProgressInfo(analUid);
|
var progressInfo = labelAllocateCoreService.findWorkProgressInfo(analUid);
|
||||||
|
|
||||||
// 작업자 통계 조회
|
return WorkerListResponse.builder().projectInfo(projectInfo).progressInfo(progressInfo).build();
|
||||||
List<WorkerStatistics> workers =
|
|
||||||
labelAllocateCoreService.findWorkerStatistics(
|
|
||||||
analUid, workerType, searchName, searchEmployeeNo, sortType);
|
|
||||||
|
|
||||||
// 각 작업자별 3일치 처리량 조회
|
|
||||||
LocalDate today = LocalDate.now();
|
|
||||||
for (WorkerStatistics worker : workers) {
|
|
||||||
Long day1Count =
|
|
||||||
labelAllocateCoreService.findDailyProcessedCount(
|
|
||||||
worker.getWorkerId(), workerType, today.minusDays(1), analUid);
|
|
||||||
Long day2Count =
|
|
||||||
labelAllocateCoreService.findDailyProcessedCount(
|
|
||||||
worker.getWorkerId(), workerType, today.minusDays(2), analUid);
|
|
||||||
Long day3Count =
|
|
||||||
labelAllocateCoreService.findDailyProcessedCount(
|
|
||||||
worker.getWorkerId(), workerType, today.minusDays(3), analUid);
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return WorkerListResponse.builder().progressInfo(progressInfo).workers(workers).build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public InferenceDetail findInferenceDetail(
|
public InferenceDetail findInferenceDetail(String uuid) {
|
||||||
Integer compareYyyy, Integer targetYyyy, Integer stage) {
|
return labelAllocateCoreService.findInferenceDetail(uuid);
|
||||||
return labelAllocateCoreService.findInferenceDetail(compareYyyy, targetYyyy, stage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApiResponseDto.ResponseObj allocateMove(
|
public ApiResponseDto.ResponseObj allocateMove(
|
||||||
@@ -199,8 +158,7 @@ public class LabelAllocateService {
|
|||||||
return new ApiResponseDto.ResponseObj(ApiResponseCode.OK, "이관을 완료하였습니다.");
|
return new ApiResponseDto.ResponseObj(ApiResponseCode.OK, "이관을 완료하였습니다.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public LabelerDetail findLabelerDetail(
|
public LabelerDetail findLabelerDetail(String userId, String uuid) {
|
||||||
String userId, Integer compareYyyy, Integer targetYyyy, Integer stage) {
|
return labelAllocateCoreService.findLabelerDetail(userId, uuid);
|
||||||
return labelAllocateCoreService.findLabelerDetail(userId, compareYyyy, targetYyyy, stage);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +1,52 @@
|
|||||||
package com.kamco.cd.kamcoback.label.service;
|
package com.kamco.cd.kamcoback.label.service;
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto;
|
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto;
|
||||||
|
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.ChangeDetectYear;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.LabelWorkMng;
|
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.LabelWorkMng;
|
||||||
|
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.LabelWorkMngDetail;
|
||||||
import com.kamco.cd.kamcoback.postgres.core.LabelWorkCoreService;
|
import com.kamco.cd.kamcoback.postgres.core.LabelWorkCoreService;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public class LabelWorkService {
|
public class LabelWorkService {
|
||||||
|
|
||||||
private final LabelWorkCoreService labelWorkCoreService;
|
private final LabelWorkCoreService labelWorkCoreService;
|
||||||
|
|
||||||
public LabelWorkService(LabelWorkCoreService labelWorkCoreService) {
|
/**
|
||||||
this.labelWorkCoreService = labelWorkCoreService;
|
* 라벨링작업 관리 목록조회
|
||||||
}
|
*
|
||||||
|
* @param searchReq
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public Page<LabelWorkMng> labelWorkMngList(LabelWorkDto.LabelWorkMngSearchReq searchReq) {
|
public Page<LabelWorkMng> labelWorkMngList(LabelWorkDto.LabelWorkMngSearchReq searchReq) {
|
||||||
|
|
||||||
return labelWorkCoreService.labelWorkMngList(searchReq);
|
return labelWorkCoreService.labelWorkMngList(searchReq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 작업배정 정보 조회
|
||||||
|
*
|
||||||
|
* @param uuid
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public LabelWorkMngDetail findLabelWorkMngDetail(UUID uuid) {
|
||||||
|
return labelWorkCoreService.findLabelWorkMngDetail(uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 변화탐지 셀렉트박스 조회
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<ChangeDetectYear> getChangeDetectYear() {
|
||||||
|
return labelWorkCoreService.getChangeDetectYear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,10 @@ import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto;
|
|||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.AllocateInfoDto;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.AllocateInfoDto;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InferenceDetail;
|
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.LabelerDetail;
|
||||||
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelingStatDto;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.UserList;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.UserList;
|
||||||
|
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.WorkProgressInfo;
|
||||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerStatistics;
|
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerStatistics;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
|
||||||
@@ -13,6 +16,7 @@ import java.time.LocalDate;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@@ -26,18 +30,12 @@ public class LabelAllocateCoreService {
|
|||||||
return labelAllocateRepository.fetchNextIds(lastId, batchSize, compareYyyy, targetYyyy, stage);
|
return labelAllocateRepository.fetchNextIds(lastId, batchSize, compareYyyy, targetYyyy, stage);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void assignOwner(
|
public void assignOwner(List<AllocateInfoDto> ids, String userId, Long analUid) {
|
||||||
List<AllocateInfoDto> ids,
|
labelAllocateRepository.assignOwner(ids, userId, analUid);
|
||||||
String userId,
|
|
||||||
Integer compareYyyy,
|
|
||||||
Integer targetYyyy,
|
|
||||||
Integer stage) {
|
|
||||||
labelAllocateRepository.assignOwner(ids, userId, compareYyyy, targetYyyy, stage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<LabelAllocateDto.Basic> findAssignedLabelerList(
|
public List<LabelAllocateDto.Basic> findAssignedLabelerList(Long analUid) {
|
||||||
Integer compareYyyy, Integer targetYyyy, Integer stage) {
|
return labelAllocateRepository.findAssignedLabelerList(analUid).stream()
|
||||||
return labelAllocateRepository.findAssignedLabelerList(compareYyyy, targetYyyy, stage).stream()
|
|
||||||
.map(LabelingAssignmentEntity::toDto)
|
.map(LabelingAssignmentEntity::toDto)
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
@@ -54,14 +52,13 @@ public class LabelAllocateCoreService {
|
|||||||
return labelAllocateRepository.availUserList(role);
|
return labelAllocateRepository.availUserList(role);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ProjectInfo findProjectInfo(Long analUid) {
|
||||||
|
return labelAllocateRepository.findProjectInfo(analUid);
|
||||||
|
}
|
||||||
|
|
||||||
public List<WorkerStatistics> findWorkerStatistics(
|
public List<WorkerStatistics> findWorkerStatistics(
|
||||||
Long analUid,
|
Long analUid, String workerType, String search, String sortType) {
|
||||||
String workerType,
|
return labelAllocateRepository.findWorkerStatistics(analUid, workerType, search, sortType);
|
||||||
String searchName,
|
|
||||||
String searchEmployeeNo,
|
|
||||||
String sortType) {
|
|
||||||
return labelAllocateRepository.findWorkerStatistics(
|
|
||||||
analUid, workerType, searchName, searchEmployeeNo, sortType);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public WorkProgressInfo findWorkProgressInfo(Long analUid) {
|
public WorkProgressInfo findWorkProgressInfo(Long analUid) {
|
||||||
@@ -77,13 +74,8 @@ public class LabelAllocateCoreService {
|
|||||||
labelAllocateRepository.assignInspectorBulk(assignmentUids, inspectorUid);
|
labelAllocateRepository.assignInspectorBulk(assignmentUids, inspectorUid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public InferenceDetail findInferenceDetail(
|
public InferenceDetail findInferenceDetail(String uuid) {
|
||||||
Integer compareYyyy, Integer targetYyyy, Integer stage) {
|
return labelAllocateRepository.findInferenceDetail(uuid);
|
||||||
return labelAllocateRepository.findInferenceDetail(compareYyyy, targetYyyy, stage);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long findLabelUnCompleteCnt(Long analUid) {
|
|
||||||
return labelAllocateRepository.findLabelUnCompleteCnt(analUid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Long> fetchNextMoveIds(
|
public List<Long> fetchNextMoveIds(
|
||||||
@@ -96,8 +88,29 @@ public class LabelAllocateCoreService {
|
|||||||
labelAllocateRepository.assignOwnerMove(sub, userId);
|
labelAllocateRepository.assignOwnerMove(sub, userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LabelerDetail findLabelerDetail(
|
public LabelerDetail findLabelerDetail(String userId, String uuid) {
|
||||||
String userId, Integer compareYyyy, Integer targetYyyy, Integer stage) {
|
return labelAllocateRepository.findLabelerDetail(userId, uuid);
|
||||||
return labelAllocateRepository.findLabelerDetail(userId, compareYyyy, targetYyyy, stage);
|
}
|
||||||
|
|
||||||
|
public Long findMapSheetAnalInferenceUid(Integer compareYyyy, Integer targetYyyy, Integer stage) {
|
||||||
|
return labelAllocateRepository.findMapSheetAnalInferenceUid(compareYyyy, targetYyyy, stage);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void insertInspector(Long analUid, String inspector) {
|
||||||
|
labelAllocateRepository.insertInspector(analUid, inspector);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Page<LabelingStatDto> findLabelerDailyStat(
|
||||||
|
searchReq searchReq, String uuid, String userId) {
|
||||||
|
return labelAllocateRepository.findLabelerDailyStat(searchReq, uuid, userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Page<LabelingStatDto> findInspectorDailyStat(
|
||||||
|
searchReq searchReq, String uuid, String userId) {
|
||||||
|
return labelAllocateRepository.findInspectorDailyStat(searchReq, uuid, userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LabelerDetail findInspectorDetail(String userId, String uuid) {
|
||||||
|
return labelAllocateRepository.findInspectorDetail(userId, uuid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.core;
|
package com.kamco.cd.kamcoback.postgres.core;
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto;
|
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto;
|
||||||
|
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.ChangeDetectYear;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.LabelWorkMng;
|
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.LabelWorkMng;
|
||||||
|
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.LabelWorkMngDetail;
|
||||||
import com.kamco.cd.kamcoback.postgres.repository.label.LabelWorkRepository;
|
import com.kamco.cd.kamcoback.postgres.repository.label.LabelWorkRepository;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.repository.members.MembersRepository;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -12,8 +17,40 @@ import org.springframework.stereotype.Service;
|
|||||||
public class LabelWorkCoreService {
|
public class LabelWorkCoreService {
|
||||||
|
|
||||||
private final LabelWorkRepository labelWorkRepository;
|
private final LabelWorkRepository labelWorkRepository;
|
||||||
|
private final MembersRepository membersRepository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 변화탐지 년도 셀렉트박스 조회
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<ChangeDetectYear> getChangeDetectYear() {
|
||||||
|
return labelWorkRepository.findChangeDetectYearList().stream()
|
||||||
|
.map(
|
||||||
|
e ->
|
||||||
|
new ChangeDetectYear(
|
||||||
|
e.getCompareYyyy() + "-" + e.getTargetYyyy(),
|
||||||
|
e.getCompareYyyy() + "-" + e.getTargetYyyy()))
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 라벨링작업 관리 목록 조회
|
||||||
|
*
|
||||||
|
* @param searchReq
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public Page<LabelWorkMng> labelWorkMngList(LabelWorkDto.LabelWorkMngSearchReq searchReq) {
|
public Page<LabelWorkMng> labelWorkMngList(LabelWorkDto.LabelWorkMngSearchReq searchReq) {
|
||||||
return labelWorkRepository.labelWorkMngList(searchReq);
|
return labelWorkRepository.labelWorkMngList(searchReq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 작업배정 정보 조회
|
||||||
|
*
|
||||||
|
* @param uuid
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public LabelWorkMngDetail findLabelWorkMngDetail(UUID uuid) {
|
||||||
|
return labelWorkRepository.findLabelWorkMngDetail(uuid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import jakarta.persistence.Column;
|
|||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.Id;
|
import jakarta.persistence.Id;
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@@ -40,6 +41,15 @@ public class LabelingAssignmentEntity extends CommonDateEntity {
|
|||||||
@Column(name = "anal_uid")
|
@Column(name = "anal_uid")
|
||||||
private Long analUid;
|
private Long analUid;
|
||||||
|
|
||||||
|
@Column(name = "inspect_state")
|
||||||
|
private String inspectState;
|
||||||
|
|
||||||
|
@Column(name = "work_stat_dttm")
|
||||||
|
private ZonedDateTime workStatDttm;
|
||||||
|
|
||||||
|
@Column(name = "inspect_stat_dttm")
|
||||||
|
private ZonedDateTime inspectStatDttm;
|
||||||
|
|
||||||
public LabelAllocateDto.Basic toDto() {
|
public LabelAllocateDto.Basic toDto() {
|
||||||
return new LabelAllocateDto.Basic(
|
return new LabelAllocateDto.Basic(
|
||||||
this.assignmentUid,
|
this.assignmentUid,
|
||||||
@@ -52,6 +62,9 @@ public class LabelingAssignmentEntity extends CommonDateEntity {
|
|||||||
this.learnGeomUid,
|
this.learnGeomUid,
|
||||||
this.analUid,
|
this.analUid,
|
||||||
super.getCreatedDate(),
|
super.getCreatedDate(),
|
||||||
super.getModifiedDate());
|
super.getModifiedDate(),
|
||||||
|
this.inspectState,
|
||||||
|
this.workStatDttm,
|
||||||
|
this.inspectStatDttm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.entity;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.label.dto.LabelInspectorDto;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.CommonDateEntity;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "tb_labeling_inspector")
|
||||||
|
public class LabelingInspectorEntity extends CommonDateEntity {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@Column(name = "operator_uid")
|
||||||
|
private UUID operatorUid;
|
||||||
|
|
||||||
|
@Column(name = "anal_uid")
|
||||||
|
private Long analUid;
|
||||||
|
|
||||||
|
@Column(name = "inspector_uid")
|
||||||
|
private String inspectorUid;
|
||||||
|
|
||||||
|
public LabelInspectorDto.Basic toDto() {
|
||||||
|
return new LabelInspectorDto.Basic(
|
||||||
|
this.operatorUid,
|
||||||
|
this.analUid,
|
||||||
|
this.inspectorUid,
|
||||||
|
super.getCreatedDate(),
|
||||||
|
super.getModifiedDate());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -36,18 +36,29 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
|||||||
String sql =
|
String sql =
|
||||||
"""
|
"""
|
||||||
INSERT INTO tb_map_sheet_anal_inference (
|
INSERT INTO tb_map_sheet_anal_inference (
|
||||||
compare_yyyy,
|
stage,
|
||||||
target_yyyy,
|
compare_yyyy,
|
||||||
stage,
|
target_yyyy,
|
||||||
anal_title
|
anal_title,
|
||||||
)
|
detecting_cnt,
|
||||||
SELECT
|
created_dttm,
|
||||||
r.input1 AS compare_yyyy,
|
updated_dttm
|
||||||
r.input2 AS target_yyyy,
|
)
|
||||||
r.stage,
|
SELECT
|
||||||
CONCAT(r.stage ,'_', r.input1 ,'_', r.input2) AS anal_title
|
r.stage,
|
||||||
FROM inference_results r
|
r.input1 AS compare_yyyy,
|
||||||
GROUP BY r.stage, r.input1, r.input2;
|
r.input2 AS target_yyyy,
|
||||||
|
CONCAT(r.stage, '_', r.input1, '_', r.input2) AS anal_title,
|
||||||
|
COUNT(*) AS detecting_cnt,
|
||||||
|
now(),
|
||||||
|
now()
|
||||||
|
FROM inference_results r
|
||||||
|
GROUP BY r.stage, r.input1, r.input2
|
||||||
|
ON CONFLICT (stage, compare_yyyy, target_yyyy)
|
||||||
|
DO UPDATE SET
|
||||||
|
detecting_cnt = EXCLUDED.detecting_cnt,
|
||||||
|
anal_title = EXCLUDED.anal_title,
|
||||||
|
updated_dttm = now()
|
||||||
""";
|
""";
|
||||||
|
|
||||||
return em.createNativeQuery(sql).executeUpdate();
|
return em.createNativeQuery(sql).executeUpdate();
|
||||||
@@ -67,30 +78,42 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
|||||||
String sql =
|
String sql =
|
||||||
"""
|
"""
|
||||||
INSERT INTO tb_map_sheet_anal_data_inference (
|
INSERT INTO tb_map_sheet_anal_data_inference (
|
||||||
|
anal_uid,
|
||||||
stage,
|
stage,
|
||||||
compare_yyyy,
|
compare_yyyy,
|
||||||
target_yyyy,
|
target_yyyy,
|
||||||
map_sheet_num,
|
map_sheet_num,
|
||||||
created_dttm,
|
detecting_cnt,
|
||||||
updated_dttm,
|
|
||||||
file_created_yn,
|
file_created_yn,
|
||||||
detecting_cnt
|
created_dttm,
|
||||||
|
updated_dttm
|
||||||
)
|
)
|
||||||
SELECT
|
SELECT
|
||||||
|
ai.id AS anal_uid,
|
||||||
r.stage,
|
r.stage,
|
||||||
r.input1 AS compare_yyyy,
|
r.input1 AS compare_yyyy,
|
||||||
r.input2 AS target_yyyy,
|
r.input2 AS target_yyyy,
|
||||||
r.map_id AS map_sheet_num,
|
r.map_id AS map_sheet_num,
|
||||||
now() AS created_dttm,
|
COUNT(*) AS detecting_cnt,
|
||||||
now() AS updated_dttm,
|
false AS file_created_yn,
|
||||||
false AS file_created_yn,
|
now(),
|
||||||
count(*) AS detecting_cnt
|
now()
|
||||||
FROM inference_results r
|
FROM inference_results r
|
||||||
GROUP BY r.stage, r.input1, r.input2, r.map_id
|
JOIN tb_map_sheet_anal_inference ai
|
||||||
|
ON ai.stage = r.stage
|
||||||
|
AND ai.compare_yyyy = r.input1
|
||||||
|
AND ai.target_yyyy = r.input2
|
||||||
|
GROUP BY
|
||||||
|
ai.id,
|
||||||
|
r.stage,
|
||||||
|
r.input1,
|
||||||
|
r.input2,
|
||||||
|
r.map_id
|
||||||
ON CONFLICT (stage, compare_yyyy, target_yyyy, map_sheet_num)
|
ON CONFLICT (stage, compare_yyyy, target_yyyy, map_sheet_num)
|
||||||
DO UPDATE SET
|
DO UPDATE SET
|
||||||
updated_dttm = now(),
|
anal_uid = EXCLUDED.anal_uid,
|
||||||
detecting_cnt = EXCLUDED.detecting_cnt
|
detecting_cnt = EXCLUDED.detecting_cnt,
|
||||||
|
updated_dttm = now()
|
||||||
""";
|
""";
|
||||||
|
|
||||||
return em.createNativeQuery(sql).executeUpdate();
|
return em.createNativeQuery(sql).executeUpdate();
|
||||||
@@ -109,46 +132,70 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
|||||||
|
|
||||||
String sql =
|
String sql =
|
||||||
"""
|
"""
|
||||||
INSERT INTO tb_map_sheet_anal_data_inference_geom (
|
INSERT INTO tb_map_sheet_anal_data_inference_geom (
|
||||||
uuid, stage, cd_prob, compare_yyyy, target_yyyy, map_sheet_num,
|
uuid,
|
||||||
class_before_cd, class_before_prob, class_after_cd, class_after_prob,
|
stage,
|
||||||
geom, area, data_uid, created_dttm, updated_dttm,
|
cd_prob,
|
||||||
file_created_yn
|
compare_yyyy,
|
||||||
|
target_yyyy,
|
||||||
|
map_sheet_num,
|
||||||
|
class_before_cd,
|
||||||
|
class_before_prob,
|
||||||
|
class_after_cd,
|
||||||
|
class_after_prob,
|
||||||
|
geom,
|
||||||
|
area,
|
||||||
|
data_uid,
|
||||||
|
file_created_yn,
|
||||||
|
created_dttm,
|
||||||
|
updated_dttm
|
||||||
)
|
)
|
||||||
SELECT
|
SELECT
|
||||||
x.uuid, x.stage, x.cd_prob, x.compare_yyyy, x.target_yyyy, x.map_sheet_num,
|
x.uuid,
|
||||||
x.class_before_cd, x.class_before_prob, x.class_after_cd, x.class_after_prob,
|
x.stage,
|
||||||
x.geom, x.area, x.data_uid, x.created_dttm, x.updated_dttm,
|
x.cd_prob,
|
||||||
false AS file_created_yn
|
x.compare_yyyy,
|
||||||
|
x.target_yyyy,
|
||||||
|
x.map_sheet_num,
|
||||||
|
x.class_before_cd,
|
||||||
|
x.class_before_prob,
|
||||||
|
x.class_after_cd,
|
||||||
|
x.class_after_prob,
|
||||||
|
x.geom,
|
||||||
|
x.area,
|
||||||
|
x.data_uid,
|
||||||
|
false,
|
||||||
|
x.created_dttm,
|
||||||
|
x.updated_dttm
|
||||||
FROM (
|
FROM (
|
||||||
SELECT DISTINCT ON (r.uuid)
|
SELECT DISTINCT ON (r.uuid)
|
||||||
r.uuid,
|
r.uuid,
|
||||||
r.stage,
|
r.stage,
|
||||||
r.cd_prob,
|
r.cd_prob,
|
||||||
r.input1 AS compare_yyyy,
|
r.input1 AS compare_yyyy,
|
||||||
r.input2 AS target_yyyy,
|
r.input2 AS target_yyyy,
|
||||||
r.map_id AS map_sheet_num,
|
r.map_id AS map_sheet_num,
|
||||||
r.before_class AS class_before_cd,
|
r.before_class AS class_before_cd,
|
||||||
r.before_probability AS class_before_prob,
|
r.before_probability AS class_before_prob,
|
||||||
r.after_class AS class_after_cd,
|
r.after_class AS class_after_cd,
|
||||||
r.after_probability AS class_after_prob,
|
r.after_probability AS class_after_prob,
|
||||||
CASE
|
CASE
|
||||||
WHEN r.geometry IS NULL THEN NULL
|
WHEN r.geometry IS NULL THEN NULL
|
||||||
WHEN left(r.geometry, 2) = '01'
|
WHEN LEFT(r.geometry, 2) = '01'
|
||||||
THEN ST_SetSRID(ST_GeomFromWKB(decode(r.geometry, 'hex')), 5186)
|
THEN ST_SetSRID(ST_GeomFromWKB(decode(r.geometry, 'hex')), 5186)
|
||||||
ELSE ST_GeomFromText(r.geometry, 5186)
|
ELSE ST_GeomFromText(r.geometry, 5186)
|
||||||
END AS geom,
|
END AS geom,
|
||||||
r.area,
|
r.area,
|
||||||
di.data_uid,
|
di.data_uid,
|
||||||
r.created_dttm,
|
r.created_dttm,
|
||||||
r.updated_dttm
|
r.updated_dttm
|
||||||
FROM inference_results r
|
FROM inference_results r
|
||||||
JOIN tb_map_sheet_anal_data_inference di
|
JOIN tb_map_sheet_anal_data_inference di
|
||||||
ON di.stage = r.stage
|
ON di.stage = r.stage
|
||||||
AND di.compare_yyyy = r.input1
|
AND di.compare_yyyy = r.input1
|
||||||
AND di.target_yyyy = r.input2
|
AND di.target_yyyy = r.input2
|
||||||
AND di.map_sheet_num = r.map_id
|
AND di.map_sheet_num = r.map_id
|
||||||
ORDER BY r.uuid, r.updated_dttm DESC NULLS LAST, r.uid DESC
|
ORDER BY r.uuid, r.updated_dttm DESC NULLS LAST, r.uid DESC
|
||||||
) x
|
) x
|
||||||
ON CONFLICT (uuid)
|
ON CONFLICT (uuid)
|
||||||
DO UPDATE SET
|
DO UPDATE SET
|
||||||
|
|||||||
@@ -1,30 +1,28 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.repository.label;
|
package com.kamco.cd.kamcoback.postgres.repository.label;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.AllocateInfoDto;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.AllocateInfoDto;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InferenceDetail;
|
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.LabelerDetail;
|
||||||
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelingStatDto;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.UserList;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.UserList;
|
||||||
|
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.WorkProgressInfo;
|
||||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerStatistics;
|
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerStatistics;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
|
||||||
public interface LabelAllocateRepositoryCustom {
|
public interface LabelAllocateRepositoryCustom {
|
||||||
|
|
||||||
List<AllocateInfoDto> fetchNextIds(
|
List<AllocateInfoDto> fetchNextIds(
|
||||||
Long lastId, Long batchSize, Integer compareYyyy, Integer targetYyyy, Integer stage);
|
Long lastId, Long batchSize, Integer compareYyyy, Integer targetYyyy, Integer stage);
|
||||||
|
|
||||||
void assignOwner(
|
void assignOwner(List<AllocateInfoDto> ids, String userId, Long analUid);
|
||||||
List<AllocateInfoDto> ids,
|
|
||||||
String userId,
|
|
||||||
Integer compareYyyy,
|
|
||||||
Integer targetYyyy,
|
|
||||||
Integer stage);
|
|
||||||
|
|
||||||
List<LabelingAssignmentEntity> findAssignedLabelerList(
|
List<LabelingAssignmentEntity> findAssignedLabelerList(Long analUid);
|
||||||
Integer compareYyyy, Integer targetYyyy, Integer stage);
|
|
||||||
|
|
||||||
Long findLabelUnAssignedCnt(Integer stage, Integer compareYyyy, Integer targetYyyy);
|
Long findLabelUnAssignedCnt(Integer stage, Integer compareYyyy, Integer targetYyyy);
|
||||||
|
|
||||||
@@ -32,9 +30,12 @@ public interface LabelAllocateRepositoryCustom {
|
|||||||
|
|
||||||
List<UserList> availUserList(String role);
|
List<UserList> availUserList(String role);
|
||||||
|
|
||||||
|
// 프로젝트 정보 조회
|
||||||
|
ProjectInfo findProjectInfo(Long analUid);
|
||||||
|
|
||||||
// 작업자 통계 조회
|
// 작업자 통계 조회
|
||||||
List<WorkerStatistics> findWorkerStatistics(
|
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);
|
WorkProgressInfo findWorkProgressInfo(Long analUid);
|
||||||
@@ -44,15 +45,24 @@ public interface LabelAllocateRepositoryCustom {
|
|||||||
|
|
||||||
void assignInspectorBulk(List<UUID> assignmentUids, String inspectorUid);
|
void assignInspectorBulk(List<UUID> assignmentUids, String inspectorUid);
|
||||||
|
|
||||||
InferenceDetail findInferenceDetail(Integer compareYyyy, Integer targetYyyy, Integer stage);
|
InferenceDetail findInferenceDetail(String uuid);
|
||||||
|
|
||||||
public List<Long> fetchNextMoveIds(
|
List<Long> fetchNextMoveIds(
|
||||||
Long lastId, Long batchSize, Integer compareYyyy, Integer targetYyyy, Integer stage);
|
Long lastId, Long batchSize, Integer compareYyyy, Integer targetYyyy, Integer stage);
|
||||||
|
|
||||||
Long findLabelUnCompleteCnt(Long analUid);
|
|
||||||
|
|
||||||
void assignOwnerMove(List<Long> sub, String userId);
|
void assignOwnerMove(List<Long> sub, String userId);
|
||||||
|
|
||||||
LabelerDetail findLabelerDetail(
|
LabelerDetail findLabelerDetail(String userId, String uuid);
|
||||||
String userId, Integer compareYyyy, Integer targetYyyy, Integer stage);
|
|
||||||
|
Long findMapSheetAnalInferenceUid(Integer compareYyyy, Integer targetYyyy, Integer stage);
|
||||||
|
|
||||||
|
void insertInspector(Long analUid, String inspector);
|
||||||
|
|
||||||
|
Page<LabelingStatDto> findLabelerDailyStat(
|
||||||
|
LabelAllocateDto.searchReq searchReq, String uuid, String userId);
|
||||||
|
|
||||||
|
Page<LabelingStatDto> findInspectorDailyStat(
|
||||||
|
LabelAllocateDto.searchReq searchReq, String uuid, String userId);
|
||||||
|
|
||||||
|
LabelerDetail findInspectorDetail(String userId, String uuid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.repository.label;
|
package com.kamco.cd.kamcoback.postgres.repository.label;
|
||||||
|
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QLabelingAssignmentEntity.labelingAssignmentEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QLabelingAssignmentEntity.labelingAssignmentEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceEntity.mapSheetAnalDataInferenceEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QLabelingInspectorEntity.labelingInspectorEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalEntity.mapSheetAnalEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalEntity.mapSheetAnalEntity;
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalInferenceEntity.mapSheetAnalInferenceEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMemberEntity.memberEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMemberEntity.memberEntity;
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto;
|
||||||
@@ -12,13 +13,15 @@ import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InferenceDetail;
|
|||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InspectState;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InspectState;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelState;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelState;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelerDetail;
|
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.UserList;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.UserList;
|
||||||
|
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.WorkProgressInfo;
|
||||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerStatistics;
|
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerStatistics;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataInferenceEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalInferenceEntity;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalEntity;
|
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.QMemberEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.QMemberEntity;
|
||||||
|
import com.querydsl.core.types.Expression;
|
||||||
import com.querydsl.core.types.Projections;
|
import com.querydsl.core.types.Projections;
|
||||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||||
import com.querydsl.core.types.dsl.CaseBuilder;
|
import com.querydsl.core.types.dsl.CaseBuilder;
|
||||||
@@ -34,11 +37,17 @@ import java.time.LocalDate;
|
|||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.PageImpl;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -73,27 +82,17 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void assignOwner(
|
public void assignOwner(List<AllocateInfoDto> ids, String userId, Long analUid) {
|
||||||
List<AllocateInfoDto> ids,
|
|
||||||
String userId,
|
|
||||||
Integer compareYyyy,
|
|
||||||
Integer targetYyyy,
|
|
||||||
Integer stage) {
|
|
||||||
|
|
||||||
// analUid로 분석 정보 조회
|
// analUid로 분석 정보 조회
|
||||||
MapSheetAnalDataInferenceEntity analEntity =
|
MapSheetAnalInferenceEntity analEntity =
|
||||||
queryFactory
|
queryFactory
|
||||||
.selectFrom(mapSheetAnalDataInferenceEntity)
|
.selectFrom(mapSheetAnalInferenceEntity)
|
||||||
.where(
|
.where(mapSheetAnalInferenceEntity.id.eq(analUid))
|
||||||
mapSheetAnalDataInferenceEntity.compareYyyy.eq(compareYyyy),
|
|
||||||
mapSheetAnalDataInferenceEntity.targetYyyy.eq(targetYyyy),
|
|
||||||
mapSheetAnalDataInferenceEntity.stage.eq(stage))
|
|
||||||
.orderBy(mapSheetAnalDataInferenceEntity.analUid.asc())
|
|
||||||
.limit(1)
|
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
if (Objects.isNull(analEntity)) {
|
if (Objects.isNull(analEntity)) {
|
||||||
throw new EntityNotFoundException("MapSheetAnalEntity not found for analUid: ");
|
throw new EntityNotFoundException("MapSheetAnalInferenceEntity not found for analUid: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
// data_geom 테이블에 label state 를 ASSIGNED 로 update
|
// data_geom 테이블에 label state 를 ASSIGNED 로 update
|
||||||
@@ -125,7 +124,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
.setParameter(3, userId)
|
.setParameter(3, userId)
|
||||||
.setParameter(4, LabelState.ASSIGNED.getId())
|
.setParameter(4, LabelState.ASSIGNED.getId())
|
||||||
.setParameter(5, info.getMapSheetNum())
|
.setParameter(5, info.getMapSheetNum())
|
||||||
.setParameter(6, analEntity.getAnalUid())
|
.setParameter(6, analEntity.getId())
|
||||||
.executeUpdate();
|
.executeUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,28 +133,22 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<LabelingAssignmentEntity> findAssignedLabelerList(
|
public List<LabelingAssignmentEntity> findAssignedLabelerList(Long analUid) {
|
||||||
Integer compareYyyy, Integer targetYyyy, Integer stage) {
|
|
||||||
// analUid로 분석 정보 조회
|
// analUid로 분석 정보 조회
|
||||||
MapSheetAnalDataInferenceEntity analEntity =
|
MapSheetAnalInferenceEntity analEntity =
|
||||||
queryFactory
|
queryFactory
|
||||||
.selectFrom(mapSheetAnalDataInferenceEntity)
|
.selectFrom(mapSheetAnalInferenceEntity)
|
||||||
.where(
|
.where(mapSheetAnalInferenceEntity.id.eq(analUid))
|
||||||
mapSheetAnalDataInferenceEntity.compareYyyy.eq(compareYyyy),
|
|
||||||
mapSheetAnalDataInferenceEntity.targetYyyy.eq(targetYyyy),
|
|
||||||
mapSheetAnalDataInferenceEntity.stage.eq(stage))
|
|
||||||
.orderBy(mapSheetAnalDataInferenceEntity.analUid.asc())
|
|
||||||
.limit(1)
|
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
if (Objects.isNull(analEntity)) {
|
if (Objects.isNull(analEntity)) {
|
||||||
throw new EntityNotFoundException("MapSheetAnalEntity not found for analUid: ");
|
throw new EntityNotFoundException("mapSheetAnalInferenceEntity not found for analUid: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.selectFrom(labelingAssignmentEntity)
|
.selectFrom(labelingAssignmentEntity)
|
||||||
.where(
|
.where(
|
||||||
labelingAssignmentEntity.analUid.eq(analEntity.getAnalUid()),
|
labelingAssignmentEntity.analUid.eq(analEntity.getId()),
|
||||||
labelingAssignmentEntity.workState.eq(LabelState.ASSIGNED.getId()),
|
labelingAssignmentEntity.workState.eq(LabelState.ASSIGNED.getId()),
|
||||||
labelingAssignmentEntity.inspectorUid.isNull())
|
labelingAssignmentEntity.inspectorUid.isNull())
|
||||||
.orderBy(labelingAssignmentEntity.workerUid.asc())
|
.orderBy(labelingAssignmentEntity.workerUid.asc())
|
||||||
@@ -204,11 +197,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<WorkerStatistics> findWorkerStatistics(
|
public List<WorkerStatistics> findWorkerStatistics(
|
||||||
Long analUid,
|
Long analUid, String workerType, String search, String sortType) {
|
||||||
String workerType,
|
|
||||||
String searchName,
|
|
||||||
String searchEmployeeNo,
|
|
||||||
String sortType) {
|
|
||||||
|
|
||||||
// 작업자 유형에 따른 필드 선택
|
// 작업자 유형에 따른 필드 선택
|
||||||
StringExpression workerIdField =
|
StringExpression workerIdField =
|
||||||
@@ -221,14 +210,11 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
? labelingAssignmentEntity.inspectorUid.isNotNull()
|
? labelingAssignmentEntity.inspectorUid.isNotNull()
|
||||||
: labelingAssignmentEntity.workerUid.isNotNull();
|
: labelingAssignmentEntity.workerUid.isNotNull();
|
||||||
|
|
||||||
// 검색 조건
|
// 검색 조건 (이름 또는 사번으로 검색)
|
||||||
BooleanExpression searchCondition = null;
|
BooleanExpression searchCondition = null;
|
||||||
if (searchName != null && !searchName.isEmpty()) {
|
if (search != null && !search.isEmpty()) {
|
||||||
searchCondition = memberEntity.name.contains(searchName);
|
searchCondition =
|
||||||
}
|
memberEntity.name.contains(search).or(memberEntity.employeeNo.contains(search));
|
||||||
if (searchEmployeeNo != null && !searchEmployeeNo.isEmpty()) {
|
|
||||||
BooleanExpression empCondition = memberEntity.employeeNo.contains(searchEmployeeNo);
|
|
||||||
searchCondition = searchCondition == null ? empCondition : searchCondition.and(empCondition);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 완료, 스킵, 남은 작업 계산
|
// 완료, 스킵, 남은 작업 계산
|
||||||
@@ -258,6 +244,9 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
.sum();
|
.sum();
|
||||||
|
|
||||||
// 기본 통계 조회 쿼리
|
// 기본 통계 조회 쿼리
|
||||||
|
BooleanExpression analUidCondition =
|
||||||
|
analUid != null ? labelingAssignmentEntity.analUid.eq(analUid) : null;
|
||||||
|
|
||||||
var baseQuery =
|
var baseQuery =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(
|
.select(
|
||||||
@@ -274,7 +263,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
"REVIEWER".equals(workerType)
|
"REVIEWER".equals(workerType)
|
||||||
? memberEntity.employeeNo.eq(labelingAssignmentEntity.inspectorUid)
|
? memberEntity.employeeNo.eq(labelingAssignmentEntity.inspectorUid)
|
||||||
: memberEntity.employeeNo.eq(labelingAssignmentEntity.workerUid))
|
: memberEntity.employeeNo.eq(labelingAssignmentEntity.workerUid))
|
||||||
.where(labelingAssignmentEntity.analUid.eq(analUid), workerCondition, searchCondition)
|
.where(analUidCondition, workerCondition, searchCondition)
|
||||||
.groupBy(workerIdField, memberEntity.name);
|
.groupBy(workerIdField, memberEntity.name);
|
||||||
|
|
||||||
// 정렬 조건 적용
|
// 정렬 조건 적용
|
||||||
@@ -286,6 +275,12 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
case "REMAINING_ASC":
|
case "REMAINING_ASC":
|
||||||
baseQuery.orderBy(remainingSum.asc());
|
baseQuery.orderBy(remainingSum.asc());
|
||||||
break;
|
break;
|
||||||
|
case "COMPLETED_DESC":
|
||||||
|
baseQuery.orderBy(completedSum.desc());
|
||||||
|
break;
|
||||||
|
case "COMPLETED_ASC":
|
||||||
|
baseQuery.orderBy(completedSum.asc());
|
||||||
|
break;
|
||||||
case "NAME_ASC":
|
case "NAME_ASC":
|
||||||
baseQuery.orderBy(memberEntity.name.asc());
|
baseQuery.orderBy(memberEntity.name.asc());
|
||||||
break;
|
break;
|
||||||
@@ -321,85 +316,102 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WorkProgressInfo findWorkProgressInfo(Long analUid) {
|
public WorkProgressInfo findWorkProgressInfo(Long analUid) {
|
||||||
|
BooleanExpression analUidCondition =
|
||||||
|
analUid != null ? labelingAssignmentEntity.analUid.eq(analUid) : null;
|
||||||
|
|
||||||
// 전체 배정 건수
|
// 전체 배정 건수
|
||||||
Long totalAssigned =
|
Long totalAssigned =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(labelingAssignmentEntity.count())
|
.select(labelingAssignmentEntity.count())
|
||||||
.from(labelingAssignmentEntity)
|
.from(labelingAssignmentEntity)
|
||||||
.where(labelingAssignmentEntity.analUid.eq(analUid))
|
.where(analUidCondition)
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
// 완료 + 스킵 건수
|
// === 라벨링 통계 ===
|
||||||
Long completedCount =
|
// 라벨링 완료: LABEL_FIN, TEST_ING, DONE (검수 포함)
|
||||||
|
Long labelingCompleted =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(labelingAssignmentEntity.count())
|
.select(labelingAssignmentEntity.count())
|
||||||
.from(labelingAssignmentEntity)
|
.from(labelingAssignmentEntity)
|
||||||
.where(
|
.where(
|
||||||
labelingAssignmentEntity.analUid.eq(analUid),
|
analUidCondition,
|
||||||
labelingAssignmentEntity.workState.in("DONE", "SKIP"))
|
labelingAssignmentEntity.workState.in("LABEL_FIN", "TEST_ING", "DONE"))
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
// 투입된 라벨러 수 (고유한 worker_uid 수)
|
// 스킵 건수
|
||||||
|
Long skipCount =
|
||||||
|
queryFactory
|
||||||
|
.select(labelingAssignmentEntity.count())
|
||||||
|
.from(labelingAssignmentEntity)
|
||||||
|
.where(analUidCondition, labelingAssignmentEntity.workState.eq("SKIP"))
|
||||||
|
.fetchOne();
|
||||||
|
|
||||||
|
// 투입된 라벨러 수
|
||||||
Long labelerCount =
|
Long labelerCount =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(labelingAssignmentEntity.workerUid.countDistinct())
|
.select(labelingAssignmentEntity.workerUid.countDistinct())
|
||||||
.from(labelingAssignmentEntity)
|
.from(labelingAssignmentEntity)
|
||||||
.where(
|
.where(analUidCondition, labelingAssignmentEntity.workerUid.isNotNull())
|
||||||
labelingAssignmentEntity.analUid.eq(analUid),
|
|
||||||
labelingAssignmentEntity.workerUid.isNotNull())
|
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
// 남은 라벨링 작업 데이터 수
|
// === 검수 통계 ===
|
||||||
Long remainingLabelCount =
|
// 검수 완료: DONE만
|
||||||
|
Long inspectionCompleted =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(labelingAssignmentEntity.count())
|
.select(labelingAssignmentEntity.count())
|
||||||
.from(labelingAssignmentEntity)
|
.from(labelingAssignmentEntity)
|
||||||
.where(
|
.where(analUidCondition, labelingAssignmentEntity.workState.eq("DONE"))
|
||||||
labelingAssignmentEntity.analUid.eq(analUid),
|
|
||||||
labelingAssignmentEntity.workerUid.isNotNull(),
|
|
||||||
labelingAssignmentEntity.workState.notIn("DONE", "SKIP"))
|
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
// 투입된 검수자 수 (고유한 inspector_uid 수)
|
// 투입된 검수자 수
|
||||||
Long inspectorCount =
|
Long inspectorCount =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(labelingAssignmentEntity.inspectorUid.countDistinct())
|
.select(labelingAssignmentEntity.inspectorUid.countDistinct())
|
||||||
.from(labelingAssignmentEntity)
|
.from(labelingAssignmentEntity)
|
||||||
.where(
|
.where(analUidCondition, labelingAssignmentEntity.inspectorUid.isNotNull())
|
||||||
labelingAssignmentEntity.analUid.eq(analUid),
|
|
||||||
labelingAssignmentEntity.inspectorUid.isNotNull())
|
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
// 남은 검수 작업 데이터 수
|
// 남은 작업 건수 계산
|
||||||
Long remainingInspectCount =
|
long total = totalAssigned != null ? totalAssigned : 0L;
|
||||||
queryFactory
|
long labelCompleted = labelingCompleted != null ? labelingCompleted : 0L;
|
||||||
.select(labelingAssignmentEntity.count())
|
long inspectCompleted = inspectionCompleted != null ? inspectionCompleted : 0L;
|
||||||
.from(labelingAssignmentEntity)
|
long skipped = skipCount != null ? skipCount : 0L;
|
||||||
.where(
|
|
||||||
labelingAssignmentEntity.analUid.eq(analUid),
|
long labelingRemaining = total - labelCompleted - skipped;
|
||||||
labelingAssignmentEntity.inspectorUid.isNotNull(),
|
long inspectionRemaining = total - inspectCompleted - skipped;
|
||||||
labelingAssignmentEntity.workState.notIn("DONE"))
|
|
||||||
.fetchOne();
|
|
||||||
|
|
||||||
// 진행률 계산
|
// 진행률 계산
|
||||||
double progressRate = 0.0;
|
double labelingRate = total > 0 ? (double) labelCompleted / total * 100 : 0.0;
|
||||||
if (totalAssigned != null && totalAssigned > 0) {
|
double inspectionRate = total > 0 ? (double) inspectCompleted / total * 100 : 0.0;
|
||||||
progressRate =
|
|
||||||
(completedCount != null ? completedCount.doubleValue() : 0.0) / totalAssigned * 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 작업 상태 판단 (간단하게 진행률 100%면 종료, 아니면 진행중)
|
// 상태 판단
|
||||||
String workStatus = (progressRate >= 100.0) ? "종료" : "진행중";
|
String labelingStatus = labelingRemaining > 0 ? "진행중" : "완료";
|
||||||
|
String inspectionStatus = inspectionRemaining > 0 ? "진행중" : "완료";
|
||||||
|
|
||||||
return WorkProgressInfo.builder()
|
return WorkProgressInfo.builder()
|
||||||
.labelingProgressRate(progressRate)
|
// 라벨링
|
||||||
.workStatus(workStatus)
|
.labelingProgressRate(labelingRate)
|
||||||
.completedCount(completedCount != null ? completedCount : 0L)
|
.labelingStatus(labelingStatus)
|
||||||
.totalAssignedCount(totalAssigned != null ? totalAssigned : 0L)
|
.labelingTotalCount(total)
|
||||||
|
.labelingCompletedCount(labelCompleted)
|
||||||
|
.labelingSkipCount(skipped)
|
||||||
|
.labelingRemainingCount(labelingRemaining)
|
||||||
.labelerCount(labelerCount != null ? labelerCount : 0L)
|
.labelerCount(labelerCount != null ? labelerCount : 0L)
|
||||||
.remainingLabelCount(remainingLabelCount != null ? remainingLabelCount : 0L)
|
// 검수
|
||||||
|
.inspectionProgressRate(inspectionRate)
|
||||||
|
.inspectionStatus(inspectionStatus)
|
||||||
|
.inspectionTotalCount(total)
|
||||||
|
.inspectionCompletedCount(inspectCompleted)
|
||||||
|
.inspectionSkipCount(skipped)
|
||||||
|
.inspectionRemainingCount(inspectionRemaining)
|
||||||
.inspectorCount(inspectorCount != null ? inspectorCount : 0L)
|
.inspectorCount(inspectorCount != null ? inspectorCount : 0L)
|
||||||
.remainingInspectCount(remainingInspectCount != null ? remainingInspectCount : 0L)
|
// 레거시 호환 필드 (Deprecated)
|
||||||
|
.progressRate(labelingRate)
|
||||||
|
.totalAssignedCount(total)
|
||||||
|
.completedCount(labelCompleted)
|
||||||
|
.remainingLabelCount(labelingRemaining)
|
||||||
|
.remainingInspectCount(inspectionRemaining)
|
||||||
|
.workStatus(labelingStatus)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -416,12 +428,15 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
? labelingAssignmentEntity.inspectorUid.eq(workerId)
|
? labelingAssignmentEntity.inspectorUid.eq(workerId)
|
||||||
: labelingAssignmentEntity.workerUid.eq(workerId);
|
: labelingAssignmentEntity.workerUid.eq(workerId);
|
||||||
|
|
||||||
|
BooleanExpression analUidCondition =
|
||||||
|
analUid != null ? labelingAssignmentEntity.analUid.eq(analUid) : null;
|
||||||
|
|
||||||
Long count =
|
Long count =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(labelingAssignmentEntity.count())
|
.select(labelingAssignmentEntity.count())
|
||||||
.from(labelingAssignmentEntity)
|
.from(labelingAssignmentEntity)
|
||||||
.where(
|
.where(
|
||||||
labelingAssignmentEntity.analUid.eq(analUid),
|
analUidCondition,
|
||||||
workerCondition,
|
workerCondition,
|
||||||
labelingAssignmentEntity.workState.in(
|
labelingAssignmentEntity.workState.in(
|
||||||
LabelState.DONE.getId(), LabelState.SKIP.getId()),
|
LabelState.DONE.getId(), LabelState.SKIP.getId()),
|
||||||
@@ -443,20 +458,18 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InferenceDetail findInferenceDetail(
|
public InferenceDetail findInferenceDetail(String uuid) {
|
||||||
Integer compareYyyy, Integer targetYyyy, Integer stage) {
|
|
||||||
// analUid로 분석 정보 조회
|
// analUid로 분석 정보 조회
|
||||||
MapSheetAnalDataInferenceEntity analEntity =
|
MapSheetAnalInferenceEntity analEntity =
|
||||||
queryFactory
|
queryFactory
|
||||||
.selectFrom(mapSheetAnalDataInferenceEntity)
|
.selectFrom(mapSheetAnalInferenceEntity)
|
||||||
.where(
|
.where(mapSheetAnalInferenceEntity.uuid.eq(UUID.fromString(uuid)))
|
||||||
mapSheetAnalDataInferenceEntity.compareYyyy.eq(compareYyyy),
|
|
||||||
mapSheetAnalDataInferenceEntity.targetYyyy.eq(targetYyyy),
|
|
||||||
mapSheetAnalDataInferenceEntity.stage.eq(stage))
|
|
||||||
.orderBy(mapSheetAnalDataInferenceEntity.analUid.asc())
|
|
||||||
.limit(1)
|
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
|
if (Objects.isNull(analEntity)) {
|
||||||
|
throw new EntityNotFoundException("MapSheetAnalInferenceEntity not found for analUid: ");
|
||||||
|
}
|
||||||
|
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.select(
|
.select(
|
||||||
Projections.constructor(
|
Projections.constructor(
|
||||||
@@ -470,7 +483,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
.from(mapSheetAnalEntity)
|
.from(mapSheetAnalEntity)
|
||||||
.innerJoin(labelingAssignmentEntity)
|
.innerJoin(labelingAssignmentEntity)
|
||||||
.on(mapSheetAnalEntity.id.eq(labelingAssignmentEntity.analUid))
|
.on(mapSheetAnalEntity.id.eq(labelingAssignmentEntity.analUid))
|
||||||
.where(mapSheetAnalEntity.id.eq(analEntity.getAnalUid()))
|
.where(mapSheetAnalEntity.id.eq(analEntity.getId()))
|
||||||
.groupBy(
|
.groupBy(
|
||||||
mapSheetAnalEntity.analTitle,
|
mapSheetAnalEntity.analTitle,
|
||||||
mapSheetAnalEntity.gukyuinApplyDttm,
|
mapSheetAnalEntity.gukyuinApplyDttm,
|
||||||
@@ -498,30 +511,6 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
.fetch();
|
.fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Long findLabelUnCompleteCnt(Long analUid) {
|
|
||||||
MapSheetAnalEntity entity =
|
|
||||||
queryFactory
|
|
||||||
.selectFrom(mapSheetAnalEntity)
|
|
||||||
.where(mapSheetAnalEntity.id.eq(analUid))
|
|
||||||
.fetchOne();
|
|
||||||
|
|
||||||
if (Objects.isNull(entity)) {
|
|
||||||
throw new EntityNotFoundException();
|
|
||||||
}
|
|
||||||
|
|
||||||
return queryFactory
|
|
||||||
.select(mapSheetAnalDataInferenceGeomEntity.geoUid.count())
|
|
||||||
.from(mapSheetAnalDataInferenceGeomEntity)
|
|
||||||
.where(
|
|
||||||
mapSheetAnalDataInferenceGeomEntity.compareYyyy.eq(entity.getCompareYyyy()),
|
|
||||||
mapSheetAnalDataInferenceGeomEntity.targetYyyy.eq(entity.getTargetYyyy()),
|
|
||||||
mapSheetAnalDataInferenceGeomEntity.stage.eq(4), // TODO: 회차 컬럼을 가져와야 할 듯?
|
|
||||||
mapSheetAnalDataInferenceGeomEntity.labelState.in(
|
|
||||||
LabelState.ASSIGNED.getId(), LabelState.SKIP.getId()))
|
|
||||||
.fetchOne();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public void assignOwnerMove(List<Long> sub, String userId) {
|
public void assignOwnerMove(List<Long> sub, String userId) {
|
||||||
@@ -535,8 +524,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LabelerDetail findLabelerDetail(
|
public LabelerDetail findLabelerDetail(String userId, String uuid) {
|
||||||
String userId, Integer compareYyyy, Integer targetYyyy, Integer stage) {
|
|
||||||
NumberExpression<Long> assignedCnt =
|
NumberExpression<Long> assignedCnt =
|
||||||
new CaseBuilder()
|
new CaseBuilder()
|
||||||
.when(labelingAssignmentEntity.workState.eq(LabelState.ASSIGNED.getId()))
|
.when(labelingAssignmentEntity.workState.eq(LabelState.ASSIGNED.getId()))
|
||||||
@@ -570,19 +558,14 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
completeCnt));
|
completeCnt));
|
||||||
|
|
||||||
// analUid로 분석 정보 조회
|
// analUid로 분석 정보 조회
|
||||||
MapSheetAnalDataInferenceEntity analEntity =
|
MapSheetAnalInferenceEntity analEntity =
|
||||||
queryFactory
|
queryFactory
|
||||||
.selectFrom(mapSheetAnalDataInferenceEntity)
|
.selectFrom(mapSheetAnalInferenceEntity)
|
||||||
.where(
|
.where(mapSheetAnalInferenceEntity.uuid.eq(UUID.fromString(uuid)))
|
||||||
mapSheetAnalDataInferenceEntity.compareYyyy.eq(compareYyyy),
|
|
||||||
mapSheetAnalDataInferenceEntity.targetYyyy.eq(targetYyyy),
|
|
||||||
mapSheetAnalDataInferenceEntity.stage.eq(stage))
|
|
||||||
.orderBy(mapSheetAnalDataInferenceEntity.analUid.asc())
|
|
||||||
.limit(1)
|
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
if (Objects.isNull(analEntity)) {
|
if (Objects.isNull(analEntity)) {
|
||||||
throw new EntityNotFoundException("MapSheetAnalEntity not found for analUid: ");
|
throw new EntityNotFoundException("MapSheetAnalInferenceEntity not found for analUid: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
QMemberEntity worker = QMemberEntity.memberEntity;
|
QMemberEntity worker = QMemberEntity.memberEntity;
|
||||||
@@ -600,17 +583,349 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
completeCnt,
|
completeCnt,
|
||||||
percent,
|
percent,
|
||||||
Expressions.constant(0), // TODO: 순위, 꼭 해야할지?
|
Expressions.constant(0), // TODO: 순위, 꼭 해야할지?
|
||||||
labelingAssignmentEntity.createdDate.min(),
|
labelingAssignmentEntity.workStatDttm.min(),
|
||||||
inspector.name.min()))
|
inspector.name.min()))
|
||||||
.from(worker)
|
.from(worker)
|
||||||
.innerJoin(labelingAssignmentEntity)
|
.innerJoin(labelingAssignmentEntity)
|
||||||
.on(
|
.on(
|
||||||
worker.employeeNo.eq(labelingAssignmentEntity.workerUid),
|
worker.employeeNo.eq(labelingAssignmentEntity.workerUid),
|
||||||
labelingAssignmentEntity.analUid.eq(analEntity.getAnalUid()))
|
labelingAssignmentEntity.analUid.eq(analEntity.getId()))
|
||||||
.leftJoin(inspector)
|
.leftJoin(inspector)
|
||||||
.on(labelingAssignmentEntity.inspectorUid.eq(inspector.employeeNo))
|
.on(labelingAssignmentEntity.inspectorUid.eq(inspector.employeeNo))
|
||||||
.where(worker.employeeNo.eq(userId))
|
.where(worker.employeeNo.eq(userId))
|
||||||
.groupBy(worker.userRole, worker.name, worker.employeeNo)
|
.groupBy(worker.userRole, worker.name, worker.employeeNo)
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long findMapSheetAnalInferenceUid(Integer compareYyyy, Integer targetYyyy, Integer stage) {
|
||||||
|
return queryFactory
|
||||||
|
.select(mapSheetAnalInferenceEntity.id)
|
||||||
|
.from(mapSheetAnalInferenceEntity)
|
||||||
|
.where(
|
||||||
|
mapSheetAnalInferenceEntity.compareYyyy.eq(compareYyyy),
|
||||||
|
mapSheetAnalInferenceEntity.targetYyyy.eq(targetYyyy),
|
||||||
|
mapSheetAnalInferenceEntity.stage.eq(stage))
|
||||||
|
.fetchOne();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insertInspector(Long analUid, String inspector) {
|
||||||
|
queryFactory
|
||||||
|
.insert(labelingInspectorEntity)
|
||||||
|
.columns(
|
||||||
|
labelingInspectorEntity.operatorUid,
|
||||||
|
labelingInspectorEntity.analUid,
|
||||||
|
labelingInspectorEntity.inspectorUid)
|
||||||
|
.values(UUID.randomUUID(), analUid, inspector)
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
em.flush();
|
||||||
|
em.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ProjectInfo findProjectInfo(Long analUid) {
|
||||||
|
if (analUid == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var result =
|
||||||
|
queryFactory
|
||||||
|
.select(
|
||||||
|
mapSheetAnalEntity.compareYyyy,
|
||||||
|
mapSheetAnalEntity.targetYyyy,
|
||||||
|
mapSheetAnalEntity.analTitle,
|
||||||
|
mapSheetAnalEntity.gukyuinApplyDttm,
|
||||||
|
mapSheetAnalEntity.analStrtDttm)
|
||||||
|
.from(mapSheetAnalEntity)
|
||||||
|
.where(mapSheetAnalEntity.id.eq(analUid))
|
||||||
|
.fetchOne();
|
||||||
|
|
||||||
|
if (result == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer compareYyyy = result.get(mapSheetAnalEntity.compareYyyy);
|
||||||
|
Integer targetYyyy = result.get(mapSheetAnalEntity.targetYyyy);
|
||||||
|
String analTitle = result.get(mapSheetAnalEntity.analTitle);
|
||||||
|
ZonedDateTime gukyuinApplyDttm = result.get(mapSheetAnalEntity.gukyuinApplyDttm);
|
||||||
|
ZonedDateTime analStrtDttm = result.get(mapSheetAnalEntity.analStrtDttm);
|
||||||
|
|
||||||
|
// 변화탐지년도 생성
|
||||||
|
String detectionYear =
|
||||||
|
(compareYyyy != null && targetYyyy != null) ? compareYyyy + "-" + targetYyyy : null;
|
||||||
|
|
||||||
|
// 회차 추출 (예: "8회차" → "8")
|
||||||
|
String round = extractRoundFromTitle(analTitle);
|
||||||
|
|
||||||
|
return ProjectInfo.builder()
|
||||||
|
.detectionYear(detectionYear)
|
||||||
|
.round(round)
|
||||||
|
.reflectionDate(formatDate(gukyuinApplyDttm))
|
||||||
|
.startDate(formatDate(analStrtDttm))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 제목에서 회차 숫자 추출 예: "8회차", "제8회차" → "8" */
|
||||||
|
private String extractRoundFromTitle(String title) {
|
||||||
|
if (title == null || title.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Pattern pattern = Pattern.compile("(\\d+)회차");
|
||||||
|
Matcher matcher = pattern.matcher(title);
|
||||||
|
|
||||||
|
return matcher.find() ? matcher.group(1) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** ZonedDateTime을 "yyyy-MM-dd" 형식으로 변환 */
|
||||||
|
private String formatDate(ZonedDateTime dateTime) {
|
||||||
|
if (dateTime == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return dateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<LabelingStatDto> findLabelerDailyStat(
|
||||||
|
LabelAllocateDto.searchReq searchReq, String uuid, String userId) {
|
||||||
|
// 날짜 포맷
|
||||||
|
Expression<String> workDate =
|
||||||
|
Expressions.stringTemplate(
|
||||||
|
"TO_CHAR({0}, 'YYYY-MM-DD')", labelingAssignmentEntity.workStatDttm);
|
||||||
|
|
||||||
|
// 날짜별 전체 건수
|
||||||
|
Expression<Long> dailyTotalCnt = Expressions.numberTemplate(Long.class, "COUNT(*)");
|
||||||
|
|
||||||
|
// ⭐ 전체 기간 총 건수 (윈도우 함수)
|
||||||
|
Expression<Long> totalCnt = Expressions.numberTemplate(Long.class, "SUM(COUNT(*)) OVER ()");
|
||||||
|
|
||||||
|
// 상태별 카운트 (Postgres FILTER 사용)
|
||||||
|
Expression<Long> assignedCnt =
|
||||||
|
Expressions.numberTemplate(
|
||||||
|
Long.class,
|
||||||
|
"COUNT(*) FILTER (WHERE {0} = 'ASSIGNED')",
|
||||||
|
labelingAssignmentEntity.workState);
|
||||||
|
|
||||||
|
Expression<Long> skipCnt =
|
||||||
|
Expressions.numberTemplate(
|
||||||
|
Long.class, "COUNT(*) FILTER (WHERE {0} = 'SKIP')", labelingAssignmentEntity.workState);
|
||||||
|
|
||||||
|
Expression<Long> completeCnt =
|
||||||
|
Expressions.numberTemplate(
|
||||||
|
Long.class,
|
||||||
|
"COUNT(*) FILTER (WHERE {0} = 'COMPLETE')",
|
||||||
|
labelingAssignmentEntity.workState);
|
||||||
|
|
||||||
|
Expression<Long> remainCnt =
|
||||||
|
Expressions.numberTemplate(Long.class, "({0} - {1} - {2})", totalCnt, skipCnt, completeCnt);
|
||||||
|
|
||||||
|
// analUid로 분석 정보 조회
|
||||||
|
MapSheetAnalInferenceEntity analEntity =
|
||||||
|
queryFactory
|
||||||
|
.selectFrom(mapSheetAnalInferenceEntity)
|
||||||
|
.where(mapSheetAnalInferenceEntity.uuid.eq(UUID.fromString(uuid)))
|
||||||
|
.fetchOne();
|
||||||
|
|
||||||
|
if (Objects.isNull(analEntity)) {
|
||||||
|
throw new EntityNotFoundException("MapSheetAnalInferenceEntity not found for analUid: ");
|
||||||
|
}
|
||||||
|
|
||||||
|
Pageable pageable = searchReq.toPageable();
|
||||||
|
List<LabelingStatDto> foundContent =
|
||||||
|
queryFactory
|
||||||
|
.select(
|
||||||
|
Projections.constructor(
|
||||||
|
LabelingStatDto.class,
|
||||||
|
workDate,
|
||||||
|
dailyTotalCnt,
|
||||||
|
totalCnt, // ⭐ 전체 일자 배정 건수
|
||||||
|
assignedCnt,
|
||||||
|
skipCnt,
|
||||||
|
completeCnt,
|
||||||
|
remainCnt))
|
||||||
|
.from(labelingAssignmentEntity)
|
||||||
|
.where(
|
||||||
|
labelingAssignmentEntity.workerUid.eq(userId),
|
||||||
|
labelingAssignmentEntity.analUid.eq(analEntity.getId()))
|
||||||
|
.groupBy(workDate)
|
||||||
|
.orderBy(labelingAssignmentEntity.workStatDttm.min().asc())
|
||||||
|
.offset(pageable.getOffset())
|
||||||
|
.limit(pageable.getPageSize())
|
||||||
|
.fetch();
|
||||||
|
|
||||||
|
Long countQuery =
|
||||||
|
queryFactory
|
||||||
|
.select(workDate)
|
||||||
|
.from(labelingAssignmentEntity)
|
||||||
|
.where(
|
||||||
|
labelingAssignmentEntity.workerUid.eq(userId),
|
||||||
|
labelingAssignmentEntity.analUid.eq(analEntity.getId()))
|
||||||
|
.distinct()
|
||||||
|
.fetch()
|
||||||
|
.stream()
|
||||||
|
.count();
|
||||||
|
|
||||||
|
return new PageImpl<>(foundContent, pageable, countQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<LabelingStatDto> findInspectorDailyStat(
|
||||||
|
LabelAllocateDto.searchReq searchReq, String uuid, String userId) {
|
||||||
|
// 날짜 포맷
|
||||||
|
Expression<String> workDate =
|
||||||
|
Expressions.stringTemplate(
|
||||||
|
"TO_CHAR({0}, 'YYYY-MM-DD')", labelingAssignmentEntity.inspectStatDttm);
|
||||||
|
|
||||||
|
// 날짜별 전체 건수
|
||||||
|
Expression<Long> dailyTotalCnt = Expressions.numberTemplate(Long.class, "COUNT(*)");
|
||||||
|
|
||||||
|
// ⭐ 전체 기간 총 건수 (윈도우 함수)
|
||||||
|
Expression<Long> totalCnt = Expressions.numberTemplate(Long.class, "SUM(COUNT(*)) OVER ()");
|
||||||
|
|
||||||
|
// 상태별 카운트 (Postgres FILTER 사용)
|
||||||
|
Expression<Long> assignedCnt =
|
||||||
|
Expressions.numberTemplate(
|
||||||
|
Long.class,
|
||||||
|
"COUNT(*) FILTER (WHERE {0} = 'UNCONFIRM')",
|
||||||
|
labelingAssignmentEntity.inspectState);
|
||||||
|
|
||||||
|
Expression<Long> skipCnt =
|
||||||
|
Expressions.numberTemplate(
|
||||||
|
Long.class,
|
||||||
|
"COUNT(*) FILTER (WHERE {0} = 'EXCEPT')",
|
||||||
|
labelingAssignmentEntity.inspectState);
|
||||||
|
|
||||||
|
Expression<Long> completeCnt =
|
||||||
|
Expressions.numberTemplate(
|
||||||
|
Long.class,
|
||||||
|
"COUNT(*) FILTER (WHERE {0} = 'COMPLETE')",
|
||||||
|
labelingAssignmentEntity.inspectState);
|
||||||
|
|
||||||
|
Expression<Long> remainCnt =
|
||||||
|
Expressions.numberTemplate(Long.class, "({0} - {1} - {2})", totalCnt, skipCnt, completeCnt);
|
||||||
|
|
||||||
|
// analUid로 분석 정보 조회
|
||||||
|
MapSheetAnalInferenceEntity analEntity =
|
||||||
|
queryFactory
|
||||||
|
.selectFrom(mapSheetAnalInferenceEntity)
|
||||||
|
.where(mapSheetAnalInferenceEntity.uuid.eq(UUID.fromString(uuid)))
|
||||||
|
.fetchOne();
|
||||||
|
|
||||||
|
if (Objects.isNull(analEntity)) {
|
||||||
|
throw new EntityNotFoundException("MapSheetAnalInferenceEntity not found for analUid: ");
|
||||||
|
}
|
||||||
|
|
||||||
|
Pageable pageable = searchReq.toPageable();
|
||||||
|
List<LabelingStatDto> foundContent =
|
||||||
|
queryFactory
|
||||||
|
.select(
|
||||||
|
Projections.constructor(
|
||||||
|
LabelingStatDto.class,
|
||||||
|
workDate,
|
||||||
|
dailyTotalCnt,
|
||||||
|
totalCnt, // ⭐ 전체 일자 배정 건수
|
||||||
|
assignedCnt,
|
||||||
|
skipCnt,
|
||||||
|
completeCnt,
|
||||||
|
remainCnt))
|
||||||
|
.from(labelingAssignmentEntity)
|
||||||
|
.where(
|
||||||
|
labelingAssignmentEntity.inspectorUid.eq(userId),
|
||||||
|
labelingAssignmentEntity.analUid.eq(analEntity.getId()))
|
||||||
|
.groupBy(workDate)
|
||||||
|
.orderBy(labelingAssignmentEntity.inspectStatDttm.min().asc())
|
||||||
|
.offset(pageable.getOffset())
|
||||||
|
.limit(pageable.getPageSize())
|
||||||
|
.fetch();
|
||||||
|
|
||||||
|
Long countQuery =
|
||||||
|
queryFactory
|
||||||
|
.select(workDate)
|
||||||
|
.from(labelingAssignmentEntity)
|
||||||
|
.where(
|
||||||
|
labelingAssignmentEntity.inspectorUid.eq(userId),
|
||||||
|
labelingAssignmentEntity.analUid.eq(analEntity.getId()))
|
||||||
|
.distinct()
|
||||||
|
.fetch()
|
||||||
|
.stream()
|
||||||
|
.count();
|
||||||
|
|
||||||
|
return new PageImpl<>(foundContent, pageable, countQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LabelerDetail findInspectorDetail(String userId, String uuid) {
|
||||||
|
NumberExpression<Long> assignedCnt =
|
||||||
|
new CaseBuilder()
|
||||||
|
.when(labelingAssignmentEntity.inspectState.eq(InspectState.UNCONFIRM.getId()))
|
||||||
|
.then(1L)
|
||||||
|
.otherwise((Long) null)
|
||||||
|
.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();
|
||||||
|
|
||||||
|
NumberExpression<Double> percent =
|
||||||
|
new CaseBuilder()
|
||||||
|
.when(completeCnt.eq(0L))
|
||||||
|
.then(0.0)
|
||||||
|
.otherwise(
|
||||||
|
Expressions.numberTemplate(
|
||||||
|
Double.class,
|
||||||
|
"round({0} / {1}, 2)",
|
||||||
|
labelingAssignmentEntity.count(),
|
||||||
|
completeCnt));
|
||||||
|
|
||||||
|
// analUid로 분석 정보 조회
|
||||||
|
MapSheetAnalInferenceEntity analEntity =
|
||||||
|
queryFactory
|
||||||
|
.selectFrom(mapSheetAnalInferenceEntity)
|
||||||
|
.where(mapSheetAnalInferenceEntity.uuid.eq(UUID.fromString(uuid)))
|
||||||
|
.fetchOne();
|
||||||
|
|
||||||
|
if (Objects.isNull(analEntity)) {
|
||||||
|
throw new EntityNotFoundException("MapSheetAnalInferenceEntity not found for analUid: ");
|
||||||
|
}
|
||||||
|
|
||||||
|
QMemberEntity inspector = QMemberEntity.memberEntity;
|
||||||
|
QMemberEntity worker = new QMemberEntity("worker");
|
||||||
|
|
||||||
|
return queryFactory
|
||||||
|
.select(
|
||||||
|
Projections.constructor(
|
||||||
|
LabelerDetail.class,
|
||||||
|
inspector.userRole,
|
||||||
|
inspector.name,
|
||||||
|
inspector.employeeNo,
|
||||||
|
assignedCnt,
|
||||||
|
skipCnt,
|
||||||
|
completeCnt,
|
||||||
|
percent,
|
||||||
|
Expressions.constant(0), // TODO: 순위, 꼭 해야할지?
|
||||||
|
labelingAssignmentEntity.inspectStatDttm.min(),
|
||||||
|
worker.name.min()))
|
||||||
|
.from(inspector)
|
||||||
|
.innerJoin(labelingAssignmentEntity)
|
||||||
|
.on(
|
||||||
|
inspector.employeeNo.eq(labelingAssignmentEntity.inspectorUid),
|
||||||
|
labelingAssignmentEntity.analUid.eq(analEntity.getId()))
|
||||||
|
.leftJoin(worker)
|
||||||
|
.on(labelingAssignmentEntity.workerUid.eq(worker.employeeNo))
|
||||||
|
.where(inspector.employeeNo.eq(userId))
|
||||||
|
.groupBy(inspector.userRole, inspector.name, inspector.employeeNo)
|
||||||
|
.fetchOne();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,17 @@ package com.kamco.cd.kamcoback.postgres.repository.label;
|
|||||||
|
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto;
|
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.LabelWorkMng;
|
||||||
|
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.LabelWorkMngDetail;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalInferenceEntity;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
|
|
||||||
public interface LabelWorkRepositoryCustom {
|
public interface LabelWorkRepositoryCustom {
|
||||||
|
|
||||||
|
List<MapSheetAnalInferenceEntity> findChangeDetectYearList();
|
||||||
|
|
||||||
public Page<LabelWorkMng> labelWorkMngList(LabelWorkDto.LabelWorkMngSearchReq searchReq);
|
public Page<LabelWorkMng> labelWorkMngList(LabelWorkDto.LabelWorkMngSearchReq searchReq);
|
||||||
|
|
||||||
|
LabelWorkMngDetail findLabelWorkMngDetail(UUID uuid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,29 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.repository.label;
|
package com.kamco.cd.kamcoback.postgres.repository.label;
|
||||||
|
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QLabelingAssignmentEntity.labelingAssignmentEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceEntity.mapSheetAnalDataInferenceEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceEntity.mapSheetAnalDataInferenceEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity;
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalInferenceEntity.mapSheetAnalInferenceEntity;
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto;
|
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.LabelWorkMng;
|
||||||
|
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.LabelWorkMngDetail;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataGeomEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataGeomEntity;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalInferenceEntity;
|
||||||
import com.querydsl.core.BooleanBuilder;
|
import com.querydsl.core.BooleanBuilder;
|
||||||
import com.querydsl.core.types.Projections;
|
import com.querydsl.core.types.Projections;
|
||||||
import com.querydsl.core.types.dsl.CaseBuilder;
|
import com.querydsl.core.types.dsl.CaseBuilder;
|
||||||
import com.querydsl.core.types.dsl.Expressions;
|
import com.querydsl.core.types.dsl.Expressions;
|
||||||
|
import com.querydsl.core.types.dsl.NumberExpression;
|
||||||
import com.querydsl.core.types.dsl.StringExpression;
|
import com.querydsl.core.types.dsl.StringExpression;
|
||||||
|
import com.querydsl.jpa.JPAExpressions;
|
||||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||||
import jakarta.persistence.EntityManager;
|
import jakarta.persistence.EntityManager;
|
||||||
import jakarta.persistence.PersistenceContext;
|
import jakarta.persistence.PersistenceContext;
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.PageImpl;
|
import org.springframework.data.domain.PageImpl;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
@@ -39,20 +46,59 @@ public class LabelWorkRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
this.queryFactory = queryFactory;
|
this.queryFactory = queryFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 변화탐지 년도 셀렉트박스 조회
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<MapSheetAnalInferenceEntity> findChangeDetectYearList() {
|
||||||
|
return queryFactory
|
||||||
|
.selectFrom(mapSheetAnalInferenceEntity)
|
||||||
|
.where(
|
||||||
|
mapSheetAnalInferenceEntity.id.in(
|
||||||
|
JPAExpressions.select(mapSheetAnalInferenceEntity.id.min())
|
||||||
|
.from(mapSheetAnalInferenceEntity)
|
||||||
|
.groupBy(
|
||||||
|
mapSheetAnalInferenceEntity.compareYyyy,
|
||||||
|
mapSheetAnalInferenceEntity.targetYyyy)))
|
||||||
|
.orderBy(
|
||||||
|
mapSheetAnalInferenceEntity.compareYyyy.asc(),
|
||||||
|
mapSheetAnalInferenceEntity.targetYyyy.asc())
|
||||||
|
.fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 라벨링 작업관리 목록 조회
|
||||||
|
*
|
||||||
|
* @param searchReq
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Page<LabelWorkMng> labelWorkMngList(LabelWorkDto.LabelWorkMngSearchReq searchReq) {
|
public Page<LabelWorkMng> labelWorkMngList(LabelWorkDto.LabelWorkMngSearchReq searchReq) {
|
||||||
|
|
||||||
Pageable pageable = PageRequest.of(searchReq.getPage(), searchReq.getSize());
|
Pageable pageable = PageRequest.of(searchReq.getPage(), searchReq.getSize());
|
||||||
BooleanBuilder whereBuilder = new BooleanBuilder();
|
BooleanBuilder whereBuilder = new BooleanBuilder();
|
||||||
|
BooleanBuilder whereSubDataBuilder = new BooleanBuilder();
|
||||||
BooleanBuilder whereSubBuilder = new BooleanBuilder();
|
BooleanBuilder whereSubBuilder = new BooleanBuilder();
|
||||||
|
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
|
if (StringUtils.isNotBlank(searchReq.getDetectYear())) {
|
||||||
|
String[] years = searchReq.getDetectYear().split("-");
|
||||||
|
|
||||||
if (searchReq.getDetectYyyy() != null) {
|
if (years.length == 2) {
|
||||||
whereBuilder.and(mapSheetAnalDataInferenceEntity.targetYyyy.eq(searchReq.getDetectYyyy()));
|
Integer compareYear = Integer.valueOf(years[0]);
|
||||||
|
Integer targetYear = Integer.valueOf(years[1]);
|
||||||
|
|
||||||
|
whereBuilder.and(
|
||||||
|
mapSheetAnalDataInferenceEntity
|
||||||
|
.compareYyyy
|
||||||
|
.eq(compareYear)
|
||||||
|
.and(mapSheetAnalDataInferenceEntity.targetYyyy.eq(targetYear)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// mapSheetAnalDataInferenceGeomEntity.dataUid.eq(mapSheetAnalDataInferenceEntity.id)
|
whereSubDataBuilder.and(
|
||||||
|
mapSheetAnalInferenceEntity.id.eq(mapSheetAnalDataInferenceEntity.analUid));
|
||||||
|
|
||||||
whereSubBuilder.and(
|
whereSubBuilder.and(
|
||||||
mapSheetAnalDataInferenceGeomEntity.dataUid.eq(mapSheetAnalDataInferenceEntity.id));
|
mapSheetAnalDataInferenceGeomEntity.dataUid.eq(mapSheetAnalDataInferenceEntity.id));
|
||||||
@@ -61,15 +107,10 @@ public class LabelWorkRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
&& !searchReq.getStrtDttm().isEmpty()
|
&& !searchReq.getStrtDttm().isEmpty()
|
||||||
&& searchReq.getEndDttm() != null
|
&& searchReq.getEndDttm() != null
|
||||||
&& !searchReq.getEndDttm().isEmpty()) {
|
&& !searchReq.getEndDttm().isEmpty()) {
|
||||||
|
|
||||||
// whereSubBuilder.and(mapSheetAnalDataInferenceGeomEntity.labelStateDttm.isNotNull());
|
|
||||||
whereSubBuilder.and(
|
whereSubBuilder.and(
|
||||||
Expressions.stringTemplate(
|
Expressions.stringTemplate(
|
||||||
"to_char({0}, 'YYYYMMDD')", mapSheetAnalDataInferenceGeomEntity.labelStateDttm)
|
"to_char({0}, 'YYYYMMDD')", mapSheetAnalDataInferenceGeomEntity.labelStateDttm)
|
||||||
.between(searchReq.getStrtDttm(), searchReq.getEndDttm()));
|
.between(searchReq.getStrtDttm(), searchReq.getEndDttm()));
|
||||||
|
|
||||||
// whereBuilder.and(mapSheetAnalDataInferenceGeomEntity.labelStateDttm.min().isNotNull());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<LabelWorkMng> foundContent =
|
List<LabelWorkMng> foundContent =
|
||||||
@@ -77,9 +118,10 @@ public class LabelWorkRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
.select(
|
.select(
|
||||||
Projections.constructor(
|
Projections.constructor(
|
||||||
LabelWorkMng.class,
|
LabelWorkMng.class,
|
||||||
mapSheetAnalDataInferenceEntity.compareYyyy,
|
mapSheetAnalInferenceEntity.uuid,
|
||||||
mapSheetAnalDataInferenceEntity.targetYyyy,
|
mapSheetAnalInferenceEntity.compareYyyy,
|
||||||
mapSheetAnalDataInferenceEntity.stage,
|
mapSheetAnalInferenceEntity.targetYyyy,
|
||||||
|
mapSheetAnalInferenceEntity.stage,
|
||||||
mapSheetAnalDataInferenceEntity.createdDttm.min(),
|
mapSheetAnalDataInferenceEntity.createdDttm.min(),
|
||||||
mapSheetAnalDataInferenceGeomEntity.dataUid.count(),
|
mapSheetAnalDataInferenceGeomEntity.dataUid.count(),
|
||||||
mapSheetAnalDataInferenceGeomEntity.dataUid.count(),
|
mapSheetAnalDataInferenceGeomEntity.dataUid.count(),
|
||||||
@@ -99,17 +141,21 @@ public class LabelWorkRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
.otherwise(0L)
|
.otherwise(0L)
|
||||||
.sum(),
|
.sum(),
|
||||||
mapSheetAnalDataInferenceGeomEntity.labelStateDttm.min()))
|
mapSheetAnalDataInferenceGeomEntity.labelStateDttm.min()))
|
||||||
.from(mapSheetAnalDataInferenceEntity)
|
.from(mapSheetAnalInferenceEntity)
|
||||||
|
.innerJoin(mapSheetAnalDataInferenceEntity)
|
||||||
|
.on(whereSubDataBuilder)
|
||||||
.innerJoin(mapSheetAnalDataInferenceGeomEntity)
|
.innerJoin(mapSheetAnalDataInferenceGeomEntity)
|
||||||
.on(whereSubBuilder)
|
.on(whereSubBuilder)
|
||||||
.where(whereBuilder)
|
.where(whereBuilder)
|
||||||
.groupBy(
|
.groupBy(
|
||||||
mapSheetAnalDataInferenceEntity.compareYyyy,
|
mapSheetAnalInferenceEntity.uuid,
|
||||||
mapSheetAnalDataInferenceEntity.targetYyyy,
|
mapSheetAnalInferenceEntity.compareYyyy,
|
||||||
mapSheetAnalDataInferenceEntity.stage)
|
mapSheetAnalInferenceEntity.targetYyyy,
|
||||||
|
mapSheetAnalInferenceEntity.stage)
|
||||||
.orderBy(
|
.orderBy(
|
||||||
mapSheetAnalDataInferenceEntity.targetYyyy.desc(),
|
mapSheetAnalInferenceEntity.targetYyyy.desc(),
|
||||||
mapSheetAnalDataInferenceEntity.stage.desc())
|
mapSheetAnalInferenceEntity.compareYyyy.desc(),
|
||||||
|
mapSheetAnalInferenceEntity.stage.desc())
|
||||||
.offset(pageable.getOffset())
|
.offset(pageable.getOffset())
|
||||||
.limit(pageable.getPageSize())
|
.limit(pageable.getPageSize())
|
||||||
.fetch();
|
.fetch();
|
||||||
@@ -131,8 +177,62 @@ public class LabelWorkRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Long countQuery = foundContent.stream().count();
|
Long total =
|
||||||
|
queryFactory
|
||||||
|
.select(mapSheetAnalInferenceEntity.uuid.countDistinct())
|
||||||
|
.from(mapSheetAnalInferenceEntity)
|
||||||
|
.innerJoin(mapSheetAnalDataInferenceEntity)
|
||||||
|
.on(whereSubDataBuilder)
|
||||||
|
.innerJoin(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.on(whereSubBuilder)
|
||||||
|
.where(whereBuilder)
|
||||||
|
.fetchOne();
|
||||||
|
|
||||||
return new PageImpl<>(foundContent, pageable, countQuery);
|
return new PageImpl<>(foundContent, pageable, total);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 작업배정 상세조회
|
||||||
|
*
|
||||||
|
* @param uuid
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public LabelWorkMngDetail findLabelWorkMngDetail(UUID uuid) {
|
||||||
|
|
||||||
|
NumberExpression<Long> labelTotCnt = mapSheetAnalDataInferenceGeomEntity.geoUid.count();
|
||||||
|
NumberExpression<Long> labelerCnt = labelingAssignmentEntity.workerUid.count();
|
||||||
|
NumberExpression<Long> reviewerCnt = labelingAssignmentEntity.inspectorUid.count();
|
||||||
|
|
||||||
|
return queryFactory
|
||||||
|
.select(
|
||||||
|
Projections.constructor(
|
||||||
|
LabelWorkMngDetail.class,
|
||||||
|
mapSheetAnalInferenceEntity
|
||||||
|
.compareYyyy
|
||||||
|
.stringValue()
|
||||||
|
.concat("-")
|
||||||
|
.concat(mapSheetAnalInferenceEntity.targetYyyy.stringValue()),
|
||||||
|
mapSheetAnalInferenceEntity.stage,
|
||||||
|
mapSheetAnalInferenceEntity.createdDttm,
|
||||||
|
labelTotCnt,
|
||||||
|
labelerCnt,
|
||||||
|
reviewerCnt))
|
||||||
|
.from(mapSheetAnalInferenceEntity)
|
||||||
|
.leftJoin(mapSheetAnalDataInferenceEntity)
|
||||||
|
.on(mapSheetAnalInferenceEntity.id.eq(mapSheetAnalDataInferenceEntity.analUid))
|
||||||
|
.leftJoin(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.on(mapSheetAnalDataInferenceEntity.id.eq(mapSheetAnalDataInferenceGeomEntity.dataUid))
|
||||||
|
.leftJoin(labelingAssignmentEntity)
|
||||||
|
.on(
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.geoUid.eq(
|
||||||
|
labelingAssignmentEntity.inferenceGeomUid))
|
||||||
|
.where(mapSheetAnalInferenceEntity.uuid.eq(uuid))
|
||||||
|
.groupBy(
|
||||||
|
mapSheetAnalInferenceEntity.compareYyyy,
|
||||||
|
mapSheetAnalInferenceEntity.targetYyyy,
|
||||||
|
mapSheetAnalInferenceEntity.stage,
|
||||||
|
mapSheetAnalInferenceEntity.createdDttm)
|
||||||
|
.fetchOne();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user