Merge remote-tracking branch 'origin/feat/dev_251201' into feat/dev_251201
This commit is contained in:
@@ -7,6 +7,7 @@ import com.kamco.cd.kamcoback.Innopam.dto.DetectMastDto.DetectMastSearch;
|
|||||||
import com.kamco.cd.kamcoback.Innopam.dto.DetectMastDto.FeaturePnuDto;
|
import com.kamco.cd.kamcoback.Innopam.dto.DetectMastDto.FeaturePnuDto;
|
||||||
import com.kamco.cd.kamcoback.Innopam.service.DetectMastService;
|
import com.kamco.cd.kamcoback.Innopam.service.DetectMastService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.media.Content;
|
import io.swagger.v3.oas.annotations.media.Content;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
@@ -14,6 +15,7 @@ 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 jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
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.PathVariable;
|
||||||
@@ -123,32 +125,42 @@ public class InnopamApiController {
|
|||||||
content =
|
content =
|
||||||
@Content(
|
@Content(
|
||||||
mediaType = "application/json",
|
mediaType = "application/json",
|
||||||
schema = @Schema(implementation = Basic.class))),
|
schema = @Schema(implementation = FeaturePnuDto.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("/pnu/{cprsBfYr}/{cprsAfYr}/{dtctSno}")
|
@GetMapping("/pnu/{cprsBfYr}/{cprsAfYr}/{dtctSno}")
|
||||||
public List<FeaturePnuDto> selectPnuList(
|
public List<FeaturePnuDto> selectPnuList(
|
||||||
@PathVariable String cprsBfYr, @PathVariable String cprsAfYr, @PathVariable String dtctSno) {
|
@PathVariable String cprsBfYr, @PathVariable String cprsAfYr, @PathVariable Integer dtctSno) {
|
||||||
DetectMastSearch detectMastSearch = new DetectMastSearch();
|
DetectMastSearch detectMastSearch = new DetectMastSearch();
|
||||||
detectMastSearch.setCprsAdYr(cprsAfYr);
|
detectMastSearch.setCprsAdYr(cprsAfYr);
|
||||||
detectMastSearch.setCprsBfYr(cprsBfYr);
|
detectMastSearch.setCprsBfYr(cprsBfYr);
|
||||||
detectMastSearch.setDtctSno(Integer.parseInt(dtctSno));
|
detectMastSearch.setDtctSno(dtctSno);
|
||||||
return detectMastService.findPnuData(detectMastSearch);
|
return detectMastService.findPnuData(detectMastSearch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "탐지객체 랜덤 PNU 상세 조회", description = "탐지객체 PNU 랜덤값을 생성해서 보여준다")
|
||||||
|
@ApiResponses(
|
||||||
|
value = {
|
||||||
|
@ApiResponse(
|
||||||
|
responseCode = "200",
|
||||||
|
description = "목록 성공",
|
||||||
|
content =
|
||||||
|
@Content(
|
||||||
|
mediaType = "application/json",
|
||||||
|
schema = @Schema(implementation = FeaturePnuDto.class))),
|
||||||
|
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||||
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
|
})
|
||||||
@GetMapping("/pnu/{cprsBfYr}/{cprsAfYr}/{dtctSno}/{featureId}")
|
@GetMapping("/pnu/{cprsBfYr}/{cprsAfYr}/{dtctSno}/{featureId}")
|
||||||
public FeaturePnuDto selectPnuDetail(
|
public FeaturePnuDto selectPnuDetail(
|
||||||
@PathVariable String cprsBfYr,
|
@Parameter(description = "이전년도", example = "2022") @PathVariable String cprsBfYr,
|
||||||
@PathVariable String cprsAfYr,
|
@Parameter(description = "기준년도", example = "2024") @PathVariable String cprsAfYr,
|
||||||
@PathVariable String dtctSno,
|
@Parameter(description = "회차", example = "4") @PathVariable Integer dtctSno,
|
||||||
@PathVariable String featureId) {
|
@Parameter(description = "featureId", example = "000e161b-1955-4c89-ad87-0b3b4a91d00f")
|
||||||
DetectMastSearch detectMastSearch = new DetectMastSearch();
|
@PathVariable
|
||||||
detectMastSearch.setCprsAdYr(cprsAfYr);
|
UUID featureId) {
|
||||||
detectMastSearch.setCprsBfYr(cprsBfYr);
|
return detectMastService.selectPnuDetail(featureId);
|
||||||
detectMastSearch.setDtctSno(Integer.parseInt(dtctSno));
|
|
||||||
detectMastSearch.setFeatureId(featureId);
|
|
||||||
return new FeaturePnuDto();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(
|
@Operation(
|
||||||
@@ -168,11 +180,11 @@ public class InnopamApiController {
|
|||||||
})
|
})
|
||||||
@PutMapping("/pnu/{cprsBfYr}/{cprsAfYr}/{dtctSno}")
|
@PutMapping("/pnu/{cprsBfYr}/{cprsAfYr}/{dtctSno}")
|
||||||
public Integer updatePnuList(
|
public Integer updatePnuList(
|
||||||
@PathVariable String cprsBfYr, @PathVariable String cprsAfYr, @PathVariable String dtctSno) {
|
@PathVariable String cprsBfYr, @PathVariable String cprsAfYr, @PathVariable Integer dtctSno) {
|
||||||
DetectMastSearch detectMastSearch = new DetectMastSearch();
|
DetectMastSearch detectMastSearch = new DetectMastSearch();
|
||||||
detectMastSearch.setCprsAdYr(cprsAfYr);
|
detectMastSearch.setCprsAdYr(cprsAfYr);
|
||||||
detectMastSearch.setCprsBfYr(cprsBfYr);
|
detectMastSearch.setCprsBfYr(cprsBfYr);
|
||||||
detectMastSearch.setDtctSno(Integer.parseInt(dtctSno));
|
detectMastSearch.setDtctSno(dtctSno);
|
||||||
return detectMastService.updatePnuData(detectMastSearch);
|
return detectMastService.updatePnuData(detectMastSearch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import java.nio.file.Path;
|
|||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -68,6 +69,13 @@ public class DetectMastService {
|
|||||||
return extractFeaturePnusRandom(dirPath);
|
return extractFeaturePnusRandom(dirPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FeaturePnuDto selectPnuDetail(UUID uuid) {
|
||||||
|
FeaturePnuDto dto = new FeaturePnuDto();
|
||||||
|
dto.setPnu(randomPnu());
|
||||||
|
dto.setFeatureId(uuid.toString());
|
||||||
|
return dto;
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public Integer updatePnuData(DetectMastSearch detectMast) {
|
public Integer updatePnuData(DetectMastSearch detectMast) {
|
||||||
|
|
||||||
|
|||||||
@@ -54,9 +54,7 @@ public class LabelAllocateApiController {
|
|||||||
return ApiResponseDto.ok(labelAllocateService.availUserList(role));
|
return ApiResponseDto.ok(labelAllocateService.availUserList(role));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(
|
@Operation(summary = "작업현황 관리 (라벨링, 검수 진행률 요약정보)", description = "작업현황 관리 (라벨링, 검수 진행률 요약정보)")
|
||||||
summary = "작업현황 관리 (라벨링, 검수 진행률 요약정보)",
|
|
||||||
description = "작업현황 관리 (라벨링, 검수 진행률 요약정보)")
|
|
||||||
@ApiResponses(
|
@ApiResponses(
|
||||||
value = {
|
value = {
|
||||||
@ApiResponse(responseCode = "200", description = "조회 성공"),
|
@ApiResponse(responseCode = "200", description = "조회 성공"),
|
||||||
@@ -121,13 +119,11 @@ public class LabelAllocateApiController {
|
|||||||
public ApiResponseDto<ApiResponseDto.ResponseObj> labelAllocate(
|
public ApiResponseDto<ApiResponseDto.ResponseObj> labelAllocate(
|
||||||
@RequestBody @Valid LabelAllocateDto.AllocateDto dto) {
|
@RequestBody @Valid LabelAllocateDto.AllocateDto dto) {
|
||||||
|
|
||||||
|
int compareYyyy = Integer.parseInt(dto.getYyyy().split("-")[0]);
|
||||||
|
int targetYyyy = Integer.parseInt(dto.getYyyy().split("-")[1]);
|
||||||
return ApiResponseDto.okObject(
|
return ApiResponseDto.okObject(
|
||||||
labelAllocateService.allocateAsc(
|
labelAllocateService.allocateAsc(
|
||||||
dto.getStage(),
|
dto.getStage(), dto.getLabelers(), dto.getInspectors(), compareYyyy, targetYyyy));
|
||||||
dto.getLabelers(),
|
|
||||||
dto.getInspectors(),
|
|
||||||
dto.getCompareYyyy(),
|
|
||||||
dto.getTargetYyyy()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "작업현황 관리 > 변화탐지 회차 정보", description = "작업현황 관리 > 변화탐지 회차 정보")
|
@Operation(summary = "작업현황 관리 > 변화탐지 회차 정보", description = "작업현황 관리 > 변화탐지 회차 정보")
|
||||||
@@ -195,13 +191,12 @@ public class LabelAllocateApiController {
|
|||||||
@RequestBody
|
@RequestBody
|
||||||
LabelAllocateDto.AllocateMoveDto dto) {
|
LabelAllocateDto.AllocateMoveDto dto) {
|
||||||
|
|
||||||
|
int compareYyyy = Integer.parseInt(dto.getYyyy().split("-")[0]);
|
||||||
|
int targetYyyy = Integer.parseInt(dto.getYyyy().split("-")[1]);
|
||||||
|
|
||||||
return ApiResponseDto.okObject(
|
return ApiResponseDto.okObject(
|
||||||
labelAllocateService.allocateMove(
|
labelAllocateService.allocateMove(
|
||||||
dto.getStage(),
|
dto.getStage(), dto.getLabelers(), compareYyyy, targetYyyy, dto.getUserId()));
|
||||||
dto.getLabelers(),
|
|
||||||
dto.getCompareYyyy(),
|
|
||||||
dto.getTargetYyyy(),
|
|
||||||
dto.getUserId()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(
|
@Operation(
|
||||||
|
|||||||
@@ -71,8 +71,10 @@ public class LabelWorkerApiController {
|
|||||||
public ApiResponseDto<Page<LabelWorkMng>> labelWorkMngList(
|
public ApiResponseDto<Page<LabelWorkMng>> labelWorkMngList(
|
||||||
@Parameter(description = "변화탐지년도", example = "2022-2024") @RequestParam(required = false)
|
@Parameter(description = "변화탐지년도", example = "2022-2024") @RequestParam(required = false)
|
||||||
String detectYear,
|
String detectYear,
|
||||||
@Parameter(description = "시작일", example = "20220101") @RequestParam String strtDttm,
|
@Parameter(description = "시작일", example = "20220101") @RequestParam(required = false)
|
||||||
@Parameter(description = "종료일", example = "20261201") @RequestParam String endDttm,
|
String strtDttm,
|
||||||
|
@Parameter(description = "종료일", example = "20261201") @RequestParam(required = false)
|
||||||
|
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")
|
||||||
|
|||||||
@@ -91,11 +91,14 @@ public class LabelAllocateDto {
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public static class AllocateDto {
|
public static class AllocateDto {
|
||||||
|
|
||||||
@Schema(description = "비교년도", example = "2022", required = true)
|
@Schema(description = "비교년도-기준년도", example = "2022-2024", required = true)
|
||||||
private Integer compareYyyy;
|
private String yyyy;
|
||||||
|
|
||||||
@Schema(description = "기준년도", example = "2024", required = true)
|
// @Schema(description = "비교년도", example = "2022", required = true)
|
||||||
private Integer targetYyyy;
|
// private Integer compareYyyy;
|
||||||
|
//
|
||||||
|
// @Schema(description = "기준년도", example = "2024", required = true)
|
||||||
|
// private Integer targetYyyy;
|
||||||
|
|
||||||
@Schema(description = "회차", example = "4", required = true)
|
@Schema(description = "회차", example = "4", required = true)
|
||||||
private Integer stage;
|
private Integer stage;
|
||||||
@@ -218,6 +221,7 @@ public class LabelAllocateDto {
|
|||||||
private Integer ranking;
|
private Integer ranking;
|
||||||
private ZonedDateTime createdDttm;
|
private ZonedDateTime createdDttm;
|
||||||
private String ownerName;
|
private String ownerName;
|
||||||
|
private Long remainCnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -245,11 +249,14 @@ public class LabelAllocateDto {
|
|||||||
""")
|
""")
|
||||||
private List<TargetUser> labelers;
|
private List<TargetUser> labelers;
|
||||||
|
|
||||||
@Schema(description = "비교년도", example = "2022")
|
@Schema(description = "비교년도-기준년도", example = "2022-2024")
|
||||||
private Integer compareYyyy;
|
private String yyyy;
|
||||||
|
|
||||||
@Schema(description = "기준년도", example = "2024")
|
// @Schema(description = "비교년도", example = "2022")
|
||||||
private Integer targetYyyy;
|
// private Integer compareYyyy;
|
||||||
|
//
|
||||||
|
// @Schema(description = "기준년도", example = "2024")
|
||||||
|
// private Integer targetYyyy;
|
||||||
|
|
||||||
@Schema(description = "대상 사번", example = "01022223333")
|
@Schema(description = "대상 사번", example = "01022223333")
|
||||||
private String userId;
|
private String userId;
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ public class LabelWorkDto {
|
|||||||
@JsonFormatDttm private ZonedDateTime createdDttm;
|
@JsonFormatDttm private ZonedDateTime createdDttm;
|
||||||
private Long detectionTotCnt;
|
private Long detectionTotCnt;
|
||||||
private Long labelTotCnt;
|
private Long labelTotCnt;
|
||||||
|
private Long labelAssignCnt;
|
||||||
private Long labelStopTotCnt;
|
private Long labelStopTotCnt;
|
||||||
private Long labelIngTotCnt;
|
private Long labelIngTotCnt;
|
||||||
private Long labelCompleteTotCnt;
|
private Long labelCompleteTotCnt;
|
||||||
@@ -59,7 +60,7 @@ public class LabelWorkDto {
|
|||||||
|
|
||||||
if (this.labelTotCnt == 0) {
|
if (this.labelTotCnt == 0) {
|
||||||
mngState = "PENDING";
|
mngState = "PENDING";
|
||||||
}else if(this.labelTotCnt > 0 && this.labelIngTotCnt == 0 ){
|
} else if (this.labelTotCnt > 0 && this.labelAssignCnt > 0 && this.labelIngTotCnt == 0) {
|
||||||
mngState = "ASSIGNED";
|
mngState = "ASSIGNED";
|
||||||
} else if (this.labelIngTotCnt > 0) {
|
} else if (this.labelIngTotCnt > 0) {
|
||||||
mngState = "LABEL_ING";
|
mngState = "LABEL_ING";
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.kamco.cd.kamcoback.label.dto;
|
package com.kamco.cd.kamcoback.label.dto;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.common.utils.interfaces.JsonFormatDttm;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@@ -21,13 +23,15 @@ public class WorkerStatsDto {
|
|||||||
private String detectionYear;
|
private String detectionYear;
|
||||||
|
|
||||||
@Schema(description = "회차 (예: 8)")
|
@Schema(description = "회차 (예: 8)")
|
||||||
private String round;
|
private String stage;
|
||||||
|
|
||||||
@Schema(description = "국유인 반영일 (예: 2026-03-31)")
|
@Schema(description = "국유인 반영일 (예: 2026-03-31)")
|
||||||
private String reflectionDate;
|
@JsonFormatDttm
|
||||||
|
private ZonedDateTime gukyuinApplyDttm;
|
||||||
|
|
||||||
@Schema(description = "작업 시작일 (예: 2026-04-06)")
|
@Schema(description = "작업 시작일 (예: 2026-04-06)")
|
||||||
private String startDate;
|
@JsonFormatDttm
|
||||||
|
private ZonedDateTime startDttm;
|
||||||
|
|
||||||
@Schema(description = "프로젝트 UUID")
|
@Schema(description = "프로젝트 UUID")
|
||||||
private String uuid;
|
private String uuid;
|
||||||
|
|||||||
@@ -119,7 +119,8 @@ public class LabelAllocateService {
|
|||||||
Long analUid, String workerType, String search, String sortType) {
|
Long analUid, String workerType, String search, String sortType) {
|
||||||
|
|
||||||
// 프로젝트 정보 조회 (analUid가 없으면 최신 프로젝트 정보 조회)
|
// 프로젝트 정보 조회 (analUid가 없으면 최신 프로젝트 정보 조회)
|
||||||
var projectInfo = analUid != null
|
var projectInfo =
|
||||||
|
analUid != null
|
||||||
? labelAllocateCoreService.findProjectInfo(analUid)
|
? labelAllocateCoreService.findProjectInfo(analUid)
|
||||||
: labelAllocateCoreService.findLatestProjectInfo();
|
: labelAllocateCoreService.findLatestProjectInfo();
|
||||||
|
|
||||||
|
|||||||
@@ -60,6 +60,10 @@ public class LabelAllocateCoreService {
|
|||||||
return labelAllocateRepository.findLatestProjectInfo();
|
return labelAllocateRepository.findLatestProjectInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UUID findLastLabelWorkState() {
|
||||||
|
return labelAllocateRepository.findLastLabelWorkState();
|
||||||
|
}
|
||||||
|
|
||||||
public List<WorkerStatistics> findWorkerStatistics(
|
public List<WorkerStatistics> findWorkerStatistics(
|
||||||
Long analUid, String workerType, String search, String sortType) {
|
Long analUid, String workerType, String search, String sortType) {
|
||||||
return labelAllocateRepository.findWorkerStatistics(analUid, workerType, search, sortType);
|
return labelAllocateRepository.findWorkerStatistics(analUid, workerType, search, sortType);
|
||||||
|
|||||||
@@ -36,6 +36,9 @@ public interface LabelAllocateRepositoryCustom {
|
|||||||
// 최신 프로젝트 정보 조회 (analUid 없이)
|
// 최신 프로젝트 정보 조회 (analUid 없이)
|
||||||
ProjectInfo findLatestProjectInfo();
|
ProjectInfo findLatestProjectInfo();
|
||||||
|
|
||||||
|
// 최신 작업 상태의 UUID 조회
|
||||||
|
UUID findLastLabelWorkState();
|
||||||
|
|
||||||
// 작업자 통계 조회
|
// 작업자 통계 조회
|
||||||
List<WorkerStatistics> findWorkerStatistics(
|
List<WorkerStatistics> findWorkerStatistics(
|
||||||
Long analUid, String workerType, String search, String sortType);
|
Long analUid, String workerType, String search, String sortType);
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ 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.MapSheetAnalInferenceEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalInferenceEntity;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.QMemberEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.QMemberEntity;
|
||||||
|
import com.querydsl.core.BooleanBuilder;
|
||||||
import com.querydsl.core.types.Expression;
|
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;
|
||||||
@@ -37,12 +38,9 @@ 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.Page;
|
||||||
@@ -72,6 +70,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
.from(mapSheetAnalDataInferenceGeomEntity)
|
.from(mapSheetAnalDataInferenceGeomEntity)
|
||||||
.where(
|
.where(
|
||||||
lastId == null ? null : mapSheetAnalDataInferenceGeomEntity.geoUid.gt(lastId),
|
lastId == null ? null : mapSheetAnalDataInferenceGeomEntity.geoUid.gt(lastId),
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull(),
|
||||||
mapSheetAnalDataInferenceGeomEntity.compareYyyy.eq(compareYyyy),
|
mapSheetAnalDataInferenceGeomEntity.compareYyyy.eq(compareYyyy),
|
||||||
mapSheetAnalDataInferenceGeomEntity.targetYyyy.eq(targetYyyy),
|
mapSheetAnalDataInferenceGeomEntity.targetYyyy.eq(targetYyyy),
|
||||||
mapSheetAnalDataInferenceGeomEntity.stage.eq(stage),
|
mapSheetAnalDataInferenceGeomEntity.stage.eq(stage),
|
||||||
@@ -160,6 +159,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
.select(mapSheetAnalDataInferenceGeomEntity.geoUid.count())
|
.select(mapSheetAnalDataInferenceGeomEntity.geoUid.count())
|
||||||
.from(mapSheetAnalDataInferenceGeomEntity)
|
.from(mapSheetAnalDataInferenceGeomEntity)
|
||||||
.where(
|
.where(
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull(),
|
||||||
mapSheetAnalDataInferenceGeomEntity.compareYyyy.eq(compareYyyy),
|
mapSheetAnalDataInferenceGeomEntity.compareYyyy.eq(compareYyyy),
|
||||||
mapSheetAnalDataInferenceGeomEntity.targetYyyy.eq(targetYyyy),
|
mapSheetAnalDataInferenceGeomEntity.targetYyyy.eq(targetYyyy),
|
||||||
mapSheetAnalDataInferenceGeomEntity.stage.eq(stage),
|
mapSheetAnalDataInferenceGeomEntity.stage.eq(stage),
|
||||||
@@ -584,6 +584,11 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
QMemberEntity worker = QMemberEntity.memberEntity;
|
QMemberEntity worker = QMemberEntity.memberEntity;
|
||||||
QMemberEntity inspector = new QMemberEntity("inspector");
|
QMemberEntity inspector = new QMemberEntity("inspector");
|
||||||
|
|
||||||
|
// remainCnt
|
||||||
|
Expression<Long> remainCnt =
|
||||||
|
Expressions.numberTemplate(
|
||||||
|
Long.class, "({0} - {1} - {2})", assignedCnt, skipCnt, completeCnt);
|
||||||
|
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.select(
|
.select(
|
||||||
Projections.constructor(
|
Projections.constructor(
|
||||||
@@ -597,7 +602,8 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
percent,
|
percent,
|
||||||
Expressions.constant(0), // TODO: 순위, 꼭 해야할지?
|
Expressions.constant(0), // TODO: 순위, 꼭 해야할지?
|
||||||
labelingAssignmentEntity.workStatDttm.min(),
|
labelingAssignmentEntity.workStatDttm.min(),
|
||||||
inspector.name.min()))
|
inspector.name.min(),
|
||||||
|
remainCnt))
|
||||||
.from(worker)
|
.from(worker)
|
||||||
.innerJoin(labelingAssignmentEntity)
|
.innerJoin(labelingAssignmentEntity)
|
||||||
.on(
|
.on(
|
||||||
@@ -648,9 +654,9 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
.select(
|
.select(
|
||||||
mapSheetAnalInferenceEntity.compareYyyy,
|
mapSheetAnalInferenceEntity.compareYyyy,
|
||||||
mapSheetAnalInferenceEntity.targetYyyy,
|
mapSheetAnalInferenceEntity.targetYyyy,
|
||||||
mapSheetAnalInferenceEntity.analTitle,
|
mapSheetAnalInferenceEntity.stage,
|
||||||
mapSheetAnalInferenceEntity.gukyuinApplyDttm,
|
mapSheetAnalInferenceEntity.gukyuinApplyDttm,
|
||||||
mapSheetAnalInferenceEntity.analStrtDttm,
|
mapSheetAnalInferenceEntity.createdDttm,
|
||||||
mapSheetAnalInferenceEntity.uuid)
|
mapSheetAnalInferenceEntity.uuid)
|
||||||
.from(mapSheetAnalInferenceEntity)
|
.from(mapSheetAnalInferenceEntity)
|
||||||
.where(mapSheetAnalInferenceEntity.id.eq(analUid))
|
.where(mapSheetAnalInferenceEntity.id.eq(analUid))
|
||||||
@@ -662,45 +668,48 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
|
|
||||||
Integer compareYyyy = result.get(mapSheetAnalInferenceEntity.compareYyyy);
|
Integer compareYyyy = result.get(mapSheetAnalInferenceEntity.compareYyyy);
|
||||||
Integer targetYyyy = result.get(mapSheetAnalInferenceEntity.targetYyyy);
|
Integer targetYyyy = result.get(mapSheetAnalInferenceEntity.targetYyyy);
|
||||||
String analTitle = result.get(mapSheetAnalInferenceEntity.analTitle);
|
Integer stage = result.get(mapSheetAnalInferenceEntity.stage);
|
||||||
ZonedDateTime gukyuinApplyDttm = result.get(mapSheetAnalInferenceEntity.gukyuinApplyDttm);
|
ZonedDateTime gukyuinApplyDttm = result.get(mapSheetAnalInferenceEntity.gukyuinApplyDttm);
|
||||||
ZonedDateTime analStrtDttm = result.get(mapSheetAnalInferenceEntity.analStrtDttm);
|
ZonedDateTime createdDttm = result.get(mapSheetAnalInferenceEntity.createdDttm);
|
||||||
UUID uuid = result.get(mapSheetAnalInferenceEntity.uuid);
|
UUID uuid = result.get(mapSheetAnalInferenceEntity.uuid);
|
||||||
|
|
||||||
// 변화탐지년도 생성
|
// 변화탐지년도 생성
|
||||||
String detectionYear =
|
String detectionYear =
|
||||||
(compareYyyy != null && targetYyyy != null) ? compareYyyy + "-" + targetYyyy : null;
|
(compareYyyy != null && targetYyyy != null) ? compareYyyy + "-" + targetYyyy : null;
|
||||||
|
|
||||||
// 회차 추출 (예: "8회차" → "8")
|
// 회차를 stage 컬럼에서 가져옴
|
||||||
String round = extractRoundFromTitle(analTitle);
|
String round = stage != null ? String.valueOf(stage) : null;
|
||||||
|
|
||||||
return ProjectInfo.builder()
|
return ProjectInfo.builder()
|
||||||
.detectionYear(detectionYear)
|
.detectionYear(detectionYear)
|
||||||
.round(round)
|
.stage(round)
|
||||||
.reflectionDate(formatDate(gukyuinApplyDttm))
|
.gukyuinApplyDttm(gukyuinApplyDttm)
|
||||||
.startDate(formatDate(analStrtDttm))
|
.startDttm(createdDttm)
|
||||||
.uuid(uuid != null ? uuid.toString() : null)
|
.uuid(uuid != null ? uuid.toString() : null)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ProjectInfo findLatestProjectInfo() {
|
public ProjectInfo findLatestProjectInfo() {
|
||||||
// 최신 target_yyyy를 기준으로 프로젝트 정보 조회
|
// 최근 집계용 UUID 조회 - 작업이 할당된 최신 프로젝트 우선
|
||||||
|
UUID uuid = findLastLabelWorkState();
|
||||||
|
|
||||||
|
if (uuid == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// UUID로 프로젝트 정보 조회
|
||||||
var result =
|
var result =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(
|
.select(
|
||||||
mapSheetAnalInferenceEntity.compareYyyy,
|
mapSheetAnalInferenceEntity.compareYyyy,
|
||||||
mapSheetAnalInferenceEntity.targetYyyy,
|
mapSheetAnalInferenceEntity.targetYyyy,
|
||||||
mapSheetAnalInferenceEntity.analTitle,
|
mapSheetAnalInferenceEntity.stage,
|
||||||
mapSheetAnalInferenceEntity.gukyuinApplyDttm,
|
mapSheetAnalInferenceEntity.gukyuinApplyDttm,
|
||||||
mapSheetAnalInferenceEntity.analStrtDttm,
|
mapSheetAnalInferenceEntity.createdDttm,
|
||||||
mapSheetAnalInferenceEntity.uuid)
|
mapSheetAnalInferenceEntity.uuid)
|
||||||
.from(mapSheetAnalInferenceEntity)
|
.from(mapSheetAnalInferenceEntity)
|
||||||
.orderBy(
|
.where(mapSheetAnalInferenceEntity.uuid.eq(uuid))
|
||||||
mapSheetAnalInferenceEntity.targetYyyy.desc(),
|
|
||||||
mapSheetAnalInferenceEntity.compareYyyy.desc(),
|
|
||||||
mapSheetAnalInferenceEntity.createdDttm.desc())
|
|
||||||
.limit(1)
|
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
@@ -709,45 +718,59 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
|
|
||||||
Integer compareYyyy = result.get(mapSheetAnalInferenceEntity.compareYyyy);
|
Integer compareYyyy = result.get(mapSheetAnalInferenceEntity.compareYyyy);
|
||||||
Integer targetYyyy = result.get(mapSheetAnalInferenceEntity.targetYyyy);
|
Integer targetYyyy = result.get(mapSheetAnalInferenceEntity.targetYyyy);
|
||||||
String analTitle = result.get(mapSheetAnalInferenceEntity.analTitle);
|
Integer stage = result.get(mapSheetAnalInferenceEntity.stage);
|
||||||
ZonedDateTime gukyuinApplyDttm = result.get(mapSheetAnalInferenceEntity.gukyuinApplyDttm);
|
ZonedDateTime gukyuinApplyDttm = result.get(mapSheetAnalInferenceEntity.gukyuinApplyDttm);
|
||||||
ZonedDateTime analStrtDttm = result.get(mapSheetAnalInferenceEntity.analStrtDttm);
|
ZonedDateTime createdDttm = result.get(mapSheetAnalInferenceEntity.createdDttm);
|
||||||
UUID uuid = result.get(mapSheetAnalInferenceEntity.uuid);
|
|
||||||
|
|
||||||
// 변화탐지년도 생성
|
// 변화탐지년도 생성
|
||||||
String detectionYear =
|
String detectionYear =
|
||||||
(compareYyyy != null && targetYyyy != null) ? compareYyyy + "-" + targetYyyy : null;
|
(compareYyyy != null && targetYyyy != null) ? compareYyyy + "-" + targetYyyy : null;
|
||||||
|
|
||||||
// 회차 추출 (예: "8회차" → "8")
|
// 회차를 stage 컬럼에서 가져옴
|
||||||
String round = extractRoundFromTitle(analTitle);
|
String round = stage != null ? String.valueOf(stage) : null;
|
||||||
|
|
||||||
return ProjectInfo.builder()
|
return ProjectInfo.builder()
|
||||||
.detectionYear(detectionYear)
|
.detectionYear(detectionYear)
|
||||||
.round(round)
|
.stage(round)
|
||||||
.reflectionDate(formatDate(gukyuinApplyDttm))
|
.gukyuinApplyDttm(gukyuinApplyDttm)
|
||||||
.startDate(formatDate(analStrtDttm))
|
.startDttm(createdDttm)
|
||||||
.uuid(uuid != null ? uuid.toString() : null)
|
.uuid(uuid.toString())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 제목에서 회차 숫자 추출 예: "8회차", "제8회차" → "8" */
|
@Override
|
||||||
private String extractRoundFromTitle(String title) {
|
public UUID findLastLabelWorkState() {
|
||||||
if (title == null || title.isEmpty()) {
|
BooleanBuilder whereBuilder = new BooleanBuilder();
|
||||||
return null;
|
|
||||||
|
// 1. 작업이 할당된 프로젝트 중 최신 UUID 조회
|
||||||
|
UUID uuid =
|
||||||
|
queryFactory
|
||||||
|
.select(mapSheetAnalInferenceEntity.uuid)
|
||||||
|
.from(mapSheetAnalInferenceEntity)
|
||||||
|
.innerJoin(labelingAssignmentEntity)
|
||||||
|
.on(mapSheetAnalInferenceEntity.id.eq(labelingAssignmentEntity.analUid))
|
||||||
|
.where(whereBuilder)
|
||||||
|
.orderBy(
|
||||||
|
mapSheetAnalInferenceEntity.compareYyyy.desc(),
|
||||||
|
mapSheetAnalInferenceEntity.targetYyyy.desc(),
|
||||||
|
mapSheetAnalInferenceEntity.stage.desc())
|
||||||
|
.fetchFirst();
|
||||||
|
|
||||||
|
// 2. 작업이 할당된 프로젝트가 없으면 전체 프로젝트 중 최신 UUID 조회
|
||||||
|
if (uuid == null) {
|
||||||
|
uuid =
|
||||||
|
queryFactory
|
||||||
|
.select(mapSheetAnalInferenceEntity.uuid)
|
||||||
|
.from(mapSheetAnalInferenceEntity)
|
||||||
|
.where(whereBuilder)
|
||||||
|
.orderBy(
|
||||||
|
mapSheetAnalInferenceEntity.compareYyyy.desc(),
|
||||||
|
mapSheetAnalInferenceEntity.targetYyyy.desc(),
|
||||||
|
mapSheetAnalInferenceEntity.stage.desc())
|
||||||
|
.fetchFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
Pattern pattern = Pattern.compile("(\\d+)회차");
|
return uuid;
|
||||||
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
|
@Override
|
||||||
@@ -966,6 +989,11 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
QMemberEntity inspector = QMemberEntity.memberEntity;
|
QMemberEntity inspector = QMemberEntity.memberEntity;
|
||||||
QMemberEntity worker = new QMemberEntity("worker");
|
QMemberEntity worker = new QMemberEntity("worker");
|
||||||
|
|
||||||
|
// remainCnt
|
||||||
|
Expression<Long> remainCnt =
|
||||||
|
Expressions.numberTemplate(
|
||||||
|
Long.class, "({0} - {1} - {2})", assignedCnt, skipCnt, completeCnt);
|
||||||
|
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.select(
|
.select(
|
||||||
Projections.constructor(
|
Projections.constructor(
|
||||||
@@ -979,7 +1007,8 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
percent,
|
percent,
|
||||||
Expressions.constant(0), // TODO: 순위, 꼭 해야할지?
|
Expressions.constant(0), // TODO: 순위, 꼭 해야할지?
|
||||||
labelingAssignmentEntity.inspectStatDttm.min(),
|
labelingAssignmentEntity.inspectStatDttm.min(),
|
||||||
worker.name.min()))
|
worker.name.min(),
|
||||||
|
remainCnt))
|
||||||
.from(inspector)
|
.from(inspector)
|
||||||
.innerJoin(labelingAssignmentEntity)
|
.innerJoin(labelingAssignmentEntity)
|
||||||
.on(
|
.on(
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ 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.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@@ -111,10 +113,23 @@ public class LabelWorkRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
&& !searchReq.getStrtDttm().isEmpty()
|
&& !searchReq.getStrtDttm().isEmpty()
|
||||||
&& searchReq.getEndDttm() != null
|
&& searchReq.getEndDttm() != null
|
||||||
&& !searchReq.getEndDttm().isEmpty()) {
|
&& !searchReq.getEndDttm().isEmpty()) {
|
||||||
|
|
||||||
|
ZoneId zoneId = ZoneId.of("Asia/Seoul");
|
||||||
|
|
||||||
|
ZonedDateTime start =
|
||||||
|
LocalDate.parse(searchReq.getStrtDttm(), DateTimeFormatter.BASIC_ISO_DATE)
|
||||||
|
.atStartOfDay(zoneId);
|
||||||
|
|
||||||
|
ZonedDateTime end =
|
||||||
|
LocalDate.parse(searchReq.getEndDttm(), DateTimeFormatter.BASIC_ISO_DATE)
|
||||||
|
.plusDays(1)
|
||||||
|
.atStartOfDay(zoneId);
|
||||||
|
|
||||||
whereSubBuilder.and(
|
whereSubBuilder.and(
|
||||||
Expressions.stringTemplate(
|
mapSheetAnalDataInferenceGeomEntity
|
||||||
"to_char({0}, 'YYYYMMDD')", mapSheetAnalDataInferenceGeomEntity.labelStateDttm)
|
.labelStateDttm
|
||||||
.between(searchReq.getStrtDttm(), searchReq.getEndDttm()));
|
.goe(start)
|
||||||
|
.and(mapSheetAnalDataInferenceGeomEntity.labelStateDttm.lt(end)));
|
||||||
}
|
}
|
||||||
|
|
||||||
List<LabelWorkMng> foundContent =
|
List<LabelWorkMng> foundContent =
|
||||||
@@ -137,6 +152,11 @@ public class LabelWorkRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
.then(1L)
|
.then(1L)
|
||||||
.otherwise(0L)
|
.otherwise(0L)
|
||||||
.sum(),
|
.sum(),
|
||||||
|
new CaseBuilder()
|
||||||
|
.when(mapSheetAnalDataInferenceGeomEntity.labelState.eq("ASSIGNED"))
|
||||||
|
.then(1L)
|
||||||
|
.otherwise(0L)
|
||||||
|
.sum(),
|
||||||
new CaseBuilder()
|
new CaseBuilder()
|
||||||
.when(mapSheetAnalDataInferenceGeomEntity.labelState.eq("STOP"))
|
.when(mapSheetAnalDataInferenceGeomEntity.labelState.eq("STOP"))
|
||||||
.then(1L)
|
.then(1L)
|
||||||
@@ -172,23 +192,6 @@ public class LabelWorkRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
.limit(pageable.getPageSize())
|
.limit(pageable.getPageSize())
|
||||||
.fetch();
|
.fetch();
|
||||||
|
|
||||||
/*
|
|
||||||
Long countQuery =
|
|
||||||
queryFactory
|
|
||||||
.select(mapSheetAnalDataInferenceEntity.count())
|
|
||||||
.from(mapSheetAnalDataInferenceEntity)
|
|
||||||
.leftJoin(mapSheetAnalDataInferenceGeomEntity)
|
|
||||||
.on(whereSubBuilder)
|
|
||||||
.where(whereBuilder)
|
|
||||||
.groupBy(
|
|
||||||
mapSheetAnalDataInferenceEntity.compareYyyy,
|
|
||||||
mapSheetAnalDataInferenceEntity.targetYyyy,
|
|
||||||
mapSheetAnalDataInferenceEntity.stage
|
|
||||||
)
|
|
||||||
.fetchOne();
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
Long total =
|
Long total =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(mapSheetAnalInferenceEntity.uuid.countDistinct())
|
.select(mapSheetAnalInferenceEntity.uuid.countDistinct())
|
||||||
|
|||||||
Reference in New Issue
Block a user