Merge branch 'feat/infer_dev_260107' of https://kamco.gitea.gs.dabeeo.com/dabeeo/kamco-dabeeo-backoffice into feat/infer_dev_260107
This commit is contained in:
@@ -74,11 +74,16 @@ public class ChangeDetectionApiController {
|
|||||||
@Parameter(description = "5k/50k 구분(SCALE_5K/SCALE_50K))", required = true)
|
@Parameter(description = "5k/50k 구분(SCALE_5K/SCALE_50K))", required = true)
|
||||||
@RequestParam(defaultValue = "SCALE_50K")
|
@RequestParam(defaultValue = "SCALE_50K")
|
||||||
MapScaleType scale,
|
MapScaleType scale,
|
||||||
|
@Parameter(
|
||||||
|
description = "변화탐지 년도(차수) /year-list 의 uuid",
|
||||||
|
example = "8584e8d4-53b3-4582-bde2-28a81495a626")
|
||||||
|
@RequestParam
|
||||||
|
UUID uuid,
|
||||||
@Parameter(description = "이전 년도", example = "2023") @RequestParam Integer beforeYear,
|
@Parameter(description = "이전 년도", example = "2023") @RequestParam Integer beforeYear,
|
||||||
@Parameter(description = "이후 년도", example = "2024") @RequestParam Integer afterYear,
|
@Parameter(description = "이후 년도", example = "2024") @RequestParam Integer afterYear,
|
||||||
@Parameter(description = "도엽번호(5k)", example = "35905086") @RequestParam String mapSheetNum) {
|
@Parameter(description = "도엽번호(5k)", example = "35905086") @RequestParam String mapSheetNum) {
|
||||||
ChangeDetectionDto.CogUrlReq req =
|
ChangeDetectionDto.CogUrlReq req =
|
||||||
new ChangeDetectionDto.CogUrlReq(beforeYear, afterYear, mapSheetNum, type, scale);
|
new ChangeDetectionDto.CogUrlReq(uuid, beforeYear, afterYear, mapSheetNum, type, scale);
|
||||||
return ApiResponseDto.ok(changeDetectionService.getChangeDetectionCogUrl(req));
|
return ApiResponseDto.ok(changeDetectionService.getChangeDetectionCogUrl(req));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ public class ChangeDetectionDto {
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public static class CogUrlReq {
|
public static class CogUrlReq {
|
||||||
|
|
||||||
|
private UUID uuid;
|
||||||
private Integer beforeYear;
|
private Integer beforeYear;
|
||||||
private Integer afterYear;
|
private Integer afterYear;
|
||||||
private String mapSheetNum;
|
private String mapSheetNum;
|
||||||
|
|||||||
@@ -6,17 +6,50 @@ import java.nio.charset.StandardCharsets;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Log4j2
|
@Log4j2
|
||||||
@Component
|
@Component
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class ExternalJarRunner {
|
public class ExternalJarRunner {
|
||||||
|
|
||||||
public void run(String jarPath, String batchIds, String inferenceId, String mapIds) {
|
private static final long TIMEOUT_MINUTES = 30;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* shp 파일 생성
|
||||||
|
*
|
||||||
|
* @param jarPath jar 경로
|
||||||
|
* @param batchIds 배치 아이디
|
||||||
|
* @param inferenceId uid
|
||||||
|
* @param mapIds 도엽 Id
|
||||||
|
*/
|
||||||
|
public void run(String jarPath, String batchIds, String inferenceId, String mapIds) {
|
||||||
|
List<String> args = new ArrayList<>();
|
||||||
|
|
||||||
|
addArg(args, "converter.inference-id", inferenceId);
|
||||||
|
addArg(args, "converter.map-ids", mapIds);
|
||||||
|
addArg(args, "converter.batch-ids", batchIds);
|
||||||
|
|
||||||
|
execJar(jarPath, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* geoserver 등록
|
||||||
|
*
|
||||||
|
* @param jarPath jar 파일경로
|
||||||
|
* @param register shp 경로
|
||||||
|
* @param layer geoserver에 등록될 레이어 이름
|
||||||
|
*/
|
||||||
|
public void run(String jarPath, String register, String layer) {
|
||||||
|
List<String> args = new ArrayList<>();
|
||||||
|
|
||||||
|
addArg(args, "register", register);
|
||||||
|
addArg(args, "layer", layer);
|
||||||
|
|
||||||
|
execJar(jarPath, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void execJar(String jarPath, List<String> args) {
|
||||||
StringBuilder out = new StringBuilder();
|
StringBuilder out = new StringBuilder();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -24,16 +57,7 @@ public class ExternalJarRunner {
|
|||||||
cmd.add("java");
|
cmd.add("java");
|
||||||
cmd.add("-jar");
|
cmd.add("-jar");
|
||||||
cmd.add(jarPath);
|
cmd.add(jarPath);
|
||||||
|
cmd.addAll(args);
|
||||||
if (inferenceId != null && !inferenceId.isBlank()) {
|
|
||||||
cmd.add("--converter.inference-id=" + inferenceId);
|
|
||||||
}
|
|
||||||
if (mapIds != null && !mapIds.isBlank()) {
|
|
||||||
cmd.add("--converter.map-ids=" + mapIds);
|
|
||||||
}
|
|
||||||
if (batchIds != null && !batchIds.isBlank()) {
|
|
||||||
cmd.add("--converter.batch-ids=" + batchIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
ProcessBuilder pb = new ProcessBuilder(cmd);
|
ProcessBuilder pb = new ProcessBuilder(cmd);
|
||||||
pb.redirectErrorStream(true);
|
pb.redirectErrorStream(true);
|
||||||
@@ -49,7 +73,7 @@ public class ExternalJarRunner {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean finished = p.waitFor(30, TimeUnit.MINUTES);
|
boolean finished = p.waitFor(TIMEOUT_MINUTES, TimeUnit.MINUTES);
|
||||||
if (!finished) {
|
if (!finished) {
|
||||||
p.destroyForcibly();
|
p.destroyForcibly();
|
||||||
throw new RuntimeException("jar timeout\n" + out);
|
throw new RuntimeException("jar timeout\n" + out);
|
||||||
@@ -66,4 +90,10 @@ public class ExternalJarRunner {
|
|||||||
log.error("jar execution error. output=\n{}", out, e);
|
log.error("jar execution error. output=\n{}", out, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addArg(List<String> args, String key, String value) {
|
||||||
|
if (value != null && !value.isBlank()) {
|
||||||
|
args.add("--" + key + "=" + value);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,10 +25,11 @@ 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.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.core.io.FileSystemResource;
|
import org.springframework.core.io.FileSystemResource;
|
||||||
@@ -45,7 +46,6 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||||||
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;
|
||||||
import org.springframework.web.util.UriUtils;
|
|
||||||
|
|
||||||
@Tag(name = "추론관리", description = "추론관리 API")
|
@Tag(name = "추론관리", description = "추론관리 API")
|
||||||
@RequestMapping("/api/inference")
|
@RequestMapping("/api/inference")
|
||||||
@@ -423,30 +423,32 @@ public class InferenceResultApiController {
|
|||||||
throws IOException {
|
throws IOException {
|
||||||
|
|
||||||
String path;
|
String path;
|
||||||
|
String uid;
|
||||||
try {
|
try {
|
||||||
path = String.valueOf(inferenceResultService.shpDownloadPath(uuid));
|
Map<String, Object> map = inferenceResultService.shpDownloadPath(uuid);
|
||||||
|
path = String.valueOf(map.get("path"));
|
||||||
|
uid = String.valueOf(map.get("uid"));
|
||||||
} catch (CustomApiException e) {
|
} catch (CustomApiException e) {
|
||||||
// 데이터 없음 등 404
|
|
||||||
return ResponseEntity.status(e.getStatus()).build();
|
return ResponseEntity.status(e.getStatus()).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
Path zipPath = Path.of(path);
|
Path zipPath = Path.of(path);
|
||||||
FileSystemResource resource = new FileSystemResource(zipPath);
|
|
||||||
|
|
||||||
if (!resource.exists() || !resource.isReadable()) {
|
if (!Files.exists(zipPath) || !Files.isReadable(zipPath)) {
|
||||||
return ResponseEntity.notFound().build();
|
return ResponseEntity.notFound().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
String filename = zipPath.getFileName().toString();
|
FileSystemResource resource = new FileSystemResource(zipPath);
|
||||||
String encodedFilename = UriUtils.encode(filename, StandardCharsets.UTF_8);
|
|
||||||
|
String filename = uid + ".zip";
|
||||||
|
|
||||||
|
long fileSize = Files.size(zipPath);
|
||||||
|
|
||||||
return ResponseEntity.ok()
|
return ResponseEntity.ok()
|
||||||
.contentType(MediaType.APPLICATION_OCTET_STREAM)
|
.contentType(MediaType.APPLICATION_OCTET_STREAM)
|
||||||
.header(
|
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + filename + "\"")
|
||||||
HttpHeaders.CONTENT_DISPOSITION,
|
.contentLength(fileSize)
|
||||||
"attachment; filename=\"" + filename + "\"; filename*=UTF-8''" + encodedFilename)
|
.body(resource);
|
||||||
.contentLength(resource.contentLength())
|
|
||||||
.body((Resource) resource);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "shp 파일 다운로드 이력", description = "추론관리 분석결과 shp 파일 다운로드 이력")
|
@Operation(summary = "shp 파일 다운로드 이력", description = "추론관리 분석결과 shp 파일 다운로드 이력")
|
||||||
@@ -490,4 +492,24 @@ public class InferenceResultApiController {
|
|||||||
|
|
||||||
return ApiResponseDto.ok(inferenceResultService.getDownloadAudit(searchReq, downloadReq));
|
return ApiResponseDto.ok(inferenceResultService.getDownloadAudit(searchReq, downloadReq));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "추론 실행중인 도엽 목록", description = "추론관리 실행중인 도엽명 5k 목록")
|
||||||
|
@ApiResponses({
|
||||||
|
@ApiResponse(
|
||||||
|
responseCode = "200",
|
||||||
|
description = "검색 성공",
|
||||||
|
content =
|
||||||
|
@Content(
|
||||||
|
mediaType = "application/json",
|
||||||
|
schema = @Schema(implementation = ApiResponseDto.class))),
|
||||||
|
@ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content),
|
||||||
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
|
})
|
||||||
|
@GetMapping(value = "/running-map/{uuid}")
|
||||||
|
public ApiResponseDto<List<String>> getInferenceRunMapName(
|
||||||
|
@Parameter(description = "uuid", example = "9d213416-0e9e-429a-b037-070e6a29946e")
|
||||||
|
@PathVariable
|
||||||
|
UUID uuid) {
|
||||||
|
return ApiResponseDto.ok(inferenceResultService.getInferenceRunMapId(uuid));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ import jakarta.validation.constraints.NotNull;
|
|||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -578,11 +579,16 @@ public class InferenceResultService {
|
|||||||
* @param uuid
|
* @param uuid
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Path shpDownloadPath(UUID uuid) {
|
public Map<String, Object> shpDownloadPath(UUID uuid) {
|
||||||
InferenceLearnDto dto = inferenceResultCoreService.getInferenceUid(uuid);
|
InferenceLearnDto dto = inferenceResultCoreService.getInferenceUid(uuid);
|
||||||
String uid = dto.getUid();
|
String uid = dto.getUid();
|
||||||
|
Path path = Path.of(datasetDir).resolve(uid).resolve("merge").resolve(uid + ".zip");
|
||||||
|
|
||||||
return Path.of(datasetDir).resolve(uid).resolve("merge").resolve(uid + ".zip");
|
Map<String, Object> downloadMap = new HashMap<>();
|
||||||
|
downloadMap.put("uid", uid);
|
||||||
|
downloadMap.put("path", path);
|
||||||
|
|
||||||
|
return downloadMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -595,4 +601,14 @@ public class InferenceResultService {
|
|||||||
AuditLogDto.searchReq searchReq, DownloadReq downloadReq) {
|
AuditLogDto.searchReq searchReq, DownloadReq downloadReq) {
|
||||||
return auditLogCoreService.findLogByAccount(searchReq, downloadReq);
|
return auditLogCoreService.findLogByAccount(searchReq, downloadReq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 실행중인 추론 도엽명 목록
|
||||||
|
*
|
||||||
|
* @param uuid uuid
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<String> getInferenceRunMapId(UUID uuid) {
|
||||||
|
return inferenceResultCoreService.getInferenceRunMapId(uuid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ public class LabelAllocateApiController {
|
|||||||
int targetYyyy = Integer.parseInt(dto.getYyyy().split("-")[1]);
|
int targetYyyy = Integer.parseInt(dto.getYyyy().split("-")[1]);
|
||||||
return ApiResponseDto.okObject(
|
return ApiResponseDto.okObject(
|
||||||
labelAllocateService.allocateAsc(
|
labelAllocateService.allocateAsc(
|
||||||
dto.getStage(), dto.getLabelers(), dto.getInspectors(), compareYyyy, targetYyyy));
|
dto.getUuid(), dto.getLabelers(), dto.getInspectors(), compareYyyy, targetYyyy));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "작업현황 관리 > 변화탐지 회차 정보", description = "작업현황 관리 > 변화탐지 회차 정보")
|
@Operation(summary = "작업현황 관리 > 변화탐지 회차 정보", description = "작업현황 관리 > 변화탐지 회차 정보")
|
||||||
@@ -318,4 +318,16 @@ public class LabelAllocateApiController {
|
|||||||
LabelAllocateDto.searchReq searchReq = new LabelAllocateDto.searchReq(page, size, "");
|
LabelAllocateDto.searchReq searchReq = new LabelAllocateDto.searchReq(page, size, "");
|
||||||
return ApiResponseDto.ok(labelAllocateService.findWorkHistoryList(searchReq, userId, type));
|
return ApiResponseDto.ok(labelAllocateService.findWorkHistoryList(searchReq, userId, type));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "라벨링 작업 중인 회차 있는지 여부", description = "라벨링 작업 중인 회차 있는지 여부")
|
||||||
|
@ApiResponses(
|
||||||
|
value = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "조회 성공"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음"),
|
||||||
|
@ApiResponse(responseCode = "500", description = "서버 오류")
|
||||||
|
})
|
||||||
|
@GetMapping("/ing-process-cnt")
|
||||||
|
public ApiResponseDto<Long> labelingIngProcessCnt() {
|
||||||
|
return ApiResponseDto.ok(labelAllocateService.findLabelingIngProcessCnt());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,6 +86,12 @@ public class LabelAllocateDto {
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public static class AllocateDto {
|
public static class AllocateDto {
|
||||||
|
|
||||||
|
@Schema(
|
||||||
|
description = "회차 마스터 key",
|
||||||
|
example = "f97dc186-e6d3-4645-9737-3173dde8dc64",
|
||||||
|
required = true)
|
||||||
|
private UUID uuid;
|
||||||
|
|
||||||
@Schema(description = "비교년도-기준년도", example = "2022-2024", required = true)
|
@Schema(description = "비교년도-기준년도", example = "2022-2024", required = true)
|
||||||
private String yyyy;
|
private String yyyy;
|
||||||
|
|
||||||
@@ -95,7 +101,7 @@ public class LabelAllocateDto {
|
|||||||
// @Schema(description = "기준년도", example = "2024", required = true)
|
// @Schema(description = "기준년도", example = "2024", required = true)
|
||||||
// private Integer targetYyyy;
|
// private Integer targetYyyy;
|
||||||
|
|
||||||
@Schema(description = "회차", example = "4", required = true)
|
@Schema(description = "회차", example = "4")
|
||||||
private Integer stage;
|
private Integer stage;
|
||||||
|
|
||||||
@Schema(
|
@Schema(
|
||||||
|
|||||||
@@ -46,8 +46,8 @@ public class LabelWorkDto {
|
|||||||
private Long labelCompleteTotCnt;
|
private Long labelCompleteTotCnt;
|
||||||
@JsonFormatDttm private ZonedDateTime labelStartDttm;
|
@JsonFormatDttm private ZonedDateTime labelStartDttm;
|
||||||
|
|
||||||
// tb_map_sheet_anal_inference.anal_state 컬럼 값 -> 미사용
|
// tb_map_sheet_anal_inference.anal_state 컬럼 값
|
||||||
// private String analState;
|
private String analState;
|
||||||
|
|
||||||
// tb_labeling_assignment 테이블에서 stagnation_yn = 'N'인 정상 진행 건수
|
// tb_labeling_assignment 테이블에서 stagnation_yn = 'N'인 정상 진행 건수
|
||||||
private Long normalProgressCnt;
|
private Long normalProgressCnt;
|
||||||
@@ -73,9 +73,9 @@ public class LabelWorkDto {
|
|||||||
/** 라벨링 상태 반환 (tb_map_sheet_anal_inference.anal_state 기준) */
|
/** 라벨링 상태 반환 (tb_map_sheet_anal_inference.anal_state 기준) */
|
||||||
public String getLabelState() {
|
public String getLabelState() {
|
||||||
// anal_state 값이 있으면 해당 값 사용 -> 우선은 미사용
|
// anal_state 값이 있으면 해당 값 사용 -> 우선은 미사용
|
||||||
// if (this.analState != null && !this.analState.isEmpty()) {
|
if (this.analState != null && !this.analState.isEmpty()) {
|
||||||
// return this.analState;
|
return this.analState;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// anal_state 값이 없으면 기존 로직으로 폴백
|
// anal_state 값이 없으면 기존 로직으로 폴백
|
||||||
String mngState = LabelMngState.PENDING.getId();
|
String mngState = LabelMngState.PENDING.getId();
|
||||||
@@ -84,10 +84,10 @@ public class LabelWorkDto {
|
|||||||
mngState = LabelMngState.PENDING.getId();
|
mngState = LabelMngState.PENDING.getId();
|
||||||
} else if (this.labelTotCnt > 0 && this.labelAssignCnt > 0 && this.labelCompleteTotCnt == 0) {
|
} else if (this.labelTotCnt > 0 && this.labelAssignCnt > 0 && this.labelCompleteTotCnt == 0) {
|
||||||
mngState = LabelMngState.ASSIGNED.getId();
|
mngState = LabelMngState.ASSIGNED.getId();
|
||||||
} else if (this.labelCompleteTotCnt > 0) {
|
|
||||||
mngState = LabelMngState.ING.getId();
|
|
||||||
} else if (this.labelingClosedYn.equals("Y") && this.inspectionClosedYn.equals("Y")) {
|
} else if (this.labelingClosedYn.equals("Y") && this.inspectionClosedYn.equals("Y")) {
|
||||||
mngState = LabelMngState.FINISH.getId();
|
mngState = LabelMngState.FINISH.getId();
|
||||||
|
} else if (this.labelCompleteTotCnt > 0) {
|
||||||
|
mngState = LabelMngState.ING.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
return mngState;
|
return mngState;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.kamco.cd.kamcoback.config.api.ApiResponseDto.ApiResponseCode;
|
|||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto;
|
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.LabelMngState;
|
||||||
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.LabelingStatDto;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.MoveInfo;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.MoveInfo;
|
||||||
@@ -18,6 +19,7 @@ import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerListResponse;
|
|||||||
import com.kamco.cd.kamcoback.postgres.core.LabelAllocateCoreService;
|
import com.kamco.cd.kamcoback.postgres.core.LabelAllocateCoreService;
|
||||||
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.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -37,13 +39,13 @@ public class LabelAllocateService {
|
|||||||
/**
|
/**
|
||||||
* 도엽 기준 asc sorting 해서 할당 수만큼 배정하는 로직
|
* 도엽 기준 asc sorting 해서 할당 수만큼 배정하는 로직
|
||||||
*
|
*
|
||||||
* @param stage 회차
|
* @param uuid 회차 key
|
||||||
* @param targetUsers 라벨러 목록
|
* @param targetUsers 라벨러 목록
|
||||||
* @param targetInspectors 검수자 목록
|
* @param targetInspectors 검수자 목록
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
public ApiResponseDto.ResponseObj allocateAsc(
|
public ApiResponseDto.ResponseObj allocateAsc(
|
||||||
Integer stage,
|
UUID uuid,
|
||||||
List<TargetUser> targetUsers,
|
List<TargetUser> targetUsers,
|
||||||
List<String> targetInspectors,
|
List<String> targetInspectors,
|
||||||
Integer compareYyyy,
|
Integer compareYyyy,
|
||||||
@@ -51,8 +53,7 @@ public class LabelAllocateService {
|
|||||||
Long lastId = null;
|
Long lastId = null;
|
||||||
|
|
||||||
// geom 잔여건수 조회
|
// geom 잔여건수 조회
|
||||||
Long chargeCnt =
|
Long chargeCnt = labelAllocateCoreService.findLabelUnAssignedCnt(uuid);
|
||||||
labelAllocateCoreService.findLabelUnAssignedCnt(stage, compareYyyy, targetYyyy);
|
|
||||||
if (chargeCnt <= 0) {
|
if (chargeCnt <= 0) {
|
||||||
return new ApiResponseDto.ResponseObj(ApiResponseCode.DUPLICATE_DATA, "이미 배정완료된 회차 입니다.");
|
return new ApiResponseDto.ResponseObj(ApiResponseCode.DUPLICATE_DATA, "이미 배정완료된 회차 입니다.");
|
||||||
}
|
}
|
||||||
@@ -63,12 +64,10 @@ public class LabelAllocateService {
|
|||||||
ApiResponseCode.BAD_REQUEST, "총 잔여건수와 요청 값의 합계가 맞지 않습니다.");
|
ApiResponseCode.BAD_REQUEST, "총 잔여건수와 요청 값의 합계가 맞지 않습니다.");
|
||||||
}
|
}
|
||||||
|
|
||||||
List<AllocateInfoDto> allIds =
|
List<AllocateInfoDto> allIds = labelAllocateCoreService.fetchNextIds(lastId, chargeCnt, uuid);
|
||||||
labelAllocateCoreService.fetchNextIds(lastId, chargeCnt, compareYyyy, targetYyyy, stage);
|
|
||||||
|
|
||||||
// MapSheetAnalInferenceEntity analUid 가져오기
|
// MapSheetAnalInferenceEntity analUid 가져오기
|
||||||
Long analUid =
|
Long analUid = labelAllocateCoreService.findMapSheetAnalInferenceUid(uuid);
|
||||||
labelAllocateCoreService.findMapSheetAnalInferenceUid(compareYyyy, targetYyyy, stage);
|
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (TargetUser target : targetUsers) {
|
for (TargetUser target : targetUsers) {
|
||||||
@@ -82,11 +81,13 @@ public class LabelAllocateService {
|
|||||||
labelAllocateCoreService.insertLabelerUser(analUid, target.getUserId(), target.getDemand());
|
labelAllocateCoreService.insertLabelerUser(analUid, target.getUserId(), target.getDemand());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 검수자 할당 테이블에 insert. TODO: 익일 배치로 라벨링 완료된 내역을 검수자에게 할당해야 함
|
// 검수자 할당 테이블에 insert.
|
||||||
for (String inspector : targetInspectors) {
|
for (String inspector : targetInspectors) {
|
||||||
labelAllocateCoreService.insertInspector(analUid, inspector);
|
labelAllocateCoreService.insertInspector(analUid, inspector);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
labelAllocateCoreService.updateAnalInferenceMngState(uuid, LabelMngState.ASSIGNED.getId());
|
||||||
|
|
||||||
return new ApiResponseDto.ResponseObj(ApiResponseCode.OK, "배정이 완료되었습니다.");
|
return new ApiResponseDto.ResponseObj(ApiResponseCode.OK, "배정이 완료되었습니다.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -257,6 +258,8 @@ public class LabelAllocateService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
labelAllocateCoreService.updateClosedYnByUuid(targetUuid, closedType, closedYn);
|
labelAllocateCoreService.updateClosedYnByUuid(targetUuid, closedType, closedYn);
|
||||||
|
labelAllocateCoreService.updateAnalInferenceMngState(
|
||||||
|
UUID.fromString(targetUuid), LabelMngState.FINISH.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Page<WorkHistoryDto> findWorkHistoryList(searchReq searchReq, String userId, String type) {
|
public Page<WorkHistoryDto> findWorkHistoryList(searchReq searchReq, String userId, String type) {
|
||||||
@@ -266,4 +269,8 @@ public class LabelAllocateService {
|
|||||||
return labelAllocateCoreService.workReviewerHistoryList(searchReq, userId);
|
return labelAllocateCoreService.workReviewerHistoryList(searchReq, userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long findLabelingIngProcessCnt() {
|
||||||
|
return labelAllocateCoreService.findLabelingIngProcessCnt();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -350,7 +350,8 @@ public class MapSheetMngService {
|
|||||||
List<MngDto> mngList = mapSheetMngCoreService.findMapSheetMngList();
|
List<MngDto> mngList = mapSheetMngCoreService.findMapSheetMngList();
|
||||||
List<MngYyyyDto> yearList =
|
List<MngYyyyDto> yearList =
|
||||||
mngList.stream()
|
mngList.stream()
|
||||||
.filter(dto -> "DONE".equals(dto.getMngState()) || "TAKINGERROR".equals(dto.getMngState()))
|
.filter(
|
||||||
|
dto -> "DONE".equals(dto.getMngState()) || "TAKINGERROR".equals(dto.getMngState()))
|
||||||
.map(dto -> new MngYyyyDto(dto.getMngYyyy(), dto.getMngPath()))
|
.map(dto -> new MngYyyyDto(dto.getMngYyyy(), dto.getMngPath()))
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
|
|||||||
@@ -476,4 +476,14 @@ public class InferenceResultCoreService {
|
|||||||
dto.setUid(entity.getUid());
|
dto.setUid(entity.getUid());
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 실행중인 추론 도엽명 목록
|
||||||
|
*
|
||||||
|
* @param uuid 추론 실행중인 uuid
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<String> getInferenceRunMapId(UUID uuid) {
|
||||||
|
return mapSheetLearn5kRepository.getInferenceRunMapId(uuid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,9 +27,8 @@ public class LabelAllocateCoreService {
|
|||||||
|
|
||||||
private final LabelAllocateRepository labelAllocateRepository;
|
private final LabelAllocateRepository labelAllocateRepository;
|
||||||
|
|
||||||
public List<AllocateInfoDto> fetchNextIds(
|
public List<AllocateInfoDto> fetchNextIds(Long lastId, Long batchSize, UUID uuid) {
|
||||||
Long lastId, Long batchSize, Integer compareYyyy, Integer targetYyyy, Integer stage) {
|
return labelAllocateRepository.fetchNextIds(lastId, batchSize, uuid);
|
||||||
return labelAllocateRepository.fetchNextIds(lastId, batchSize, compareYyyy, targetYyyy, stage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void assignOwner(List<AllocateInfoDto> ids, String userId, Long analUid) {
|
public void assignOwner(List<AllocateInfoDto> ids, String userId, Long analUid) {
|
||||||
@@ -42,8 +41,8 @@ public class LabelAllocateCoreService {
|
|||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long findLabelUnAssignedCnt(Integer stage, Integer compareYyyy, Integer targetYyyy) {
|
public Long findLabelUnAssignedCnt(UUID uuid) {
|
||||||
return labelAllocateRepository.findLabelUnAssignedCnt(stage, compareYyyy, targetYyyy);
|
return labelAllocateRepository.findLabelUnAssignedCnt(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void assignInspector(UUID assignmentUid, String inspectorUid) {
|
public void assignInspector(UUID assignmentUid, String inspectorUid) {
|
||||||
@@ -144,8 +143,8 @@ public class LabelAllocateCoreService {
|
|||||||
return detail;
|
return detail;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long findMapSheetAnalInferenceUid(Integer compareYyyy, Integer targetYyyy, Integer stage) {
|
public Long findMapSheetAnalInferenceUid(UUID uuid) {
|
||||||
return labelAllocateRepository.findMapSheetAnalInferenceUid(compareYyyy, targetYyyy, stage);
|
return labelAllocateRepository.findMapSheetAnalInferenceUid(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void insertInspector(Long analUid, String inspector) {
|
public void insertInspector(Long analUid, String inspector) {
|
||||||
@@ -227,4 +226,12 @@ public class LabelAllocateCoreService {
|
|||||||
public Page<WorkHistoryDto> workReviewerHistoryList(searchReq searchReq, String userId) {
|
public Page<WorkHistoryDto> workReviewerHistoryList(searchReq searchReq, String userId) {
|
||||||
return labelAllocateRepository.workReviewerHistoryList(searchReq, userId);
|
return labelAllocateRepository.workReviewerHistoryList(searchReq, userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateAnalInferenceMngState(UUID uuid, String status) {
|
||||||
|
labelAllocateRepository.updateAnalInferenceMngState(uuid, status);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long findLabelingIngProcessCnt() {
|
||||||
|
return labelAllocateRepository.findLabelingIngProcessCnt();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.kamco.cd.kamcoback.postgres.repository.trainingdata.TrainingDataLabel
|
|||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto;
|
||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.DefaultPaging;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.DefaultPaging;
|
||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.DetailRes;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.DetailRes;
|
||||||
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.InferenceIdInfo;
|
||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.LabelFeatureRequest.LabelProperties;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.LabelFeatureRequest.LabelProperties;
|
||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.LabelingGeometryInfo;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.LabelingGeometryInfo;
|
||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.LabelingListDto;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.LabelingListDto;
|
||||||
@@ -29,7 +30,7 @@ public class TrainingDataLabelCoreService {
|
|||||||
return trainingDataLabelRepository.findLabelingAssignedGeom(assignmentUid);
|
return trainingDataLabelRepository.findLabelingAssignedGeom(assignmentUid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long findLabelingAssignmentGeoUid(String assignmentUid) {
|
public InferenceIdInfo findLabelingAssignmentGeoUid(String assignmentUid) {
|
||||||
return trainingDataLabelRepository.findLabelingAssignmentGeoUid(assignmentUid);
|
return trainingDataLabelRepository.findLabelingAssignmentGeoUid(assignmentUid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,4 +90,8 @@ public class TrainingDataLabelCoreService {
|
|||||||
String mapSheetNum, Integer beforeYear, Integer afterYear) {
|
String mapSheetNum, Integer beforeYear, Integer afterYear) {
|
||||||
return trainingDataLabelRepository.getCogImageUrl(mapSheetNum, beforeYear, afterYear);
|
return trainingDataLabelRepository.getCogImageUrl(mapSheetNum, beforeYear, afterYear);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateAnalInferenceMngState(Long analUid, String status) {
|
||||||
|
trainingDataLabelRepository.updateAnalInferenceMngState(analUid, status);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.core;
|
package com.kamco.cd.kamcoback.postgres.core;
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.postgres.repository.trainingdata.TrainingDataReviewRepository;
|
import com.kamco.cd.kamcoback.postgres.repository.trainingdata.TrainingDataReviewRepository;
|
||||||
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.InferenceIdInfo;
|
||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto;
|
||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto.DefaultPaging;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto.DefaultPaging;
|
||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto.DetailRes;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto.DetailRes;
|
||||||
@@ -29,7 +30,7 @@ public class TrainingDataReviewCoreService {
|
|||||||
return trainingDataReviewRepository.findReviewAssignedGeom(operatorUid);
|
return trainingDataReviewRepository.findReviewAssignedGeom(operatorUid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long findReviewOperatorGeoUid(String operatorUid) {
|
public InferenceIdInfo findReviewOperatorGeoUid(String operatorUid) {
|
||||||
return trainingDataReviewRepository.findReviewOperatorGeoUid(operatorUid);
|
return trainingDataReviewRepository.findReviewOperatorGeoUid(operatorUid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,4 +90,8 @@ public class TrainingDataReviewCoreService {
|
|||||||
String mapSheetNum, Integer beforeYear, Integer afterYear) {
|
String mapSheetNum, Integer beforeYear, Integer afterYear) {
|
||||||
return trainingDataReviewRepository.getCogImageUrl(mapSheetNum, beforeYear, afterYear);
|
return trainingDataReviewRepository.getCogImageUrl(mapSheetNum, beforeYear, afterYear);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateAnalInferenceMngState(Long analUid, String status) {
|
||||||
|
trainingDataReviewRepository.updateAnalInferenceMngState(analUid, status);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,4 +37,8 @@ public class TrainingDataReviewJobCoreService {
|
|||||||
public void lockInspectors(Long analUid, List<String> reviewerIds) {
|
public void lockInspectors(Long analUid, List<String> reviewerIds) {
|
||||||
trainingDataReviewJobRepository.lockInspectors(analUid, reviewerIds);
|
trainingDataReviewJobRepository.lockInspectors(analUid, reviewerIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateGeomUidTestState(List<Long> geomUids) {
|
||||||
|
trainingDataReviewJobRepository.updateGeomUidTestState(geomUids);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,12 +30,6 @@ public class InferenceResultsTestingEntity {
|
|||||||
@Column(name = "map_id", length = Integer.MAX_VALUE)
|
@Column(name = "map_id", length = Integer.MAX_VALUE)
|
||||||
private String mapId;
|
private String mapId;
|
||||||
|
|
||||||
@Column(name = "source_1", length = Integer.MAX_VALUE)
|
|
||||||
private String source1;
|
|
||||||
|
|
||||||
@Column(name = "source_2", length = Integer.MAX_VALUE)
|
|
||||||
private String source2;
|
|
||||||
|
|
||||||
@Column(name = "model_version", length = Integer.MAX_VALUE)
|
@Column(name = "model_version", length = Integer.MAX_VALUE)
|
||||||
private String modelVersion;
|
private String modelVersion;
|
||||||
|
|
||||||
@@ -60,9 +54,6 @@ public class InferenceResultsTestingEntity {
|
|||||||
@Column(name = "area")
|
@Column(name = "area")
|
||||||
private Double area;
|
private Double area;
|
||||||
|
|
||||||
@Column(name = "cd_prob")
|
|
||||||
private Double cdProb;
|
|
||||||
|
|
||||||
@Column(name = "before_c", length = Integer.MAX_VALUE)
|
@Column(name = "before_c", length = Integer.MAX_VALUE)
|
||||||
private String beforeC;
|
private String beforeC;
|
||||||
|
|
||||||
@@ -75,12 +66,6 @@ public class InferenceResultsTestingEntity {
|
|||||||
@Column(name = "after_p")
|
@Column(name = "after_p")
|
||||||
private Double afterP;
|
private Double afterP;
|
||||||
|
|
||||||
@Column(name = "input1")
|
|
||||||
private Long input1;
|
|
||||||
|
|
||||||
@Column(name = "input2")
|
|
||||||
private Long input2;
|
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@NotNull
|
@NotNull
|
||||||
@ColumnDefault("nextval('inference_results_testing_seq_seq')")
|
@ColumnDefault("nextval('inference_results_testing_seq_seq')")
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ public class MapSheetLearnEntity {
|
|||||||
private int m3FailedJobs = 0;
|
private int m3FailedJobs = 0;
|
||||||
|
|
||||||
@Column(name = "uid", nullable = false)
|
@Column(name = "uid", nullable = false)
|
||||||
private String uid = UUID.randomUUID().toString().replace("-", "");
|
private String uid = UUID.randomUUID().toString().replace("-", "").toUpperCase();
|
||||||
|
|
||||||
public InferenceResultDto.ResultList toDto() {
|
public InferenceResultDto.ResultList toDto() {
|
||||||
return new InferenceResultDto.ResultList(
|
return new InferenceResultDto.ResultList(
|
||||||
|
|||||||
@@ -52,7 +52,8 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
|||||||
m1_model_batch_id,
|
m1_model_batch_id,
|
||||||
m2_model_batch_id,
|
m2_model_batch_id,
|
||||||
m3_model_batch_id,
|
m3_model_batch_id,
|
||||||
learn_id
|
learn_id,
|
||||||
|
anal_state
|
||||||
)
|
)
|
||||||
SELECT
|
SELECT
|
||||||
r.stage,
|
r.stage,
|
||||||
@@ -64,7 +65,8 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
|||||||
r.m1_model_batch_id,
|
r.m1_model_batch_id,
|
||||||
r.m2_model_batch_id,
|
r.m2_model_batch_id,
|
||||||
r.m3_model_batch_id,
|
r.m3_model_batch_id,
|
||||||
r.id
|
r.id,
|
||||||
|
LabelMngState.PENDING.getId()
|
||||||
FROM tb_map_sheet_learn r
|
FROM tb_map_sheet_learn r
|
||||||
WHERE r.id = :id
|
WHERE r.id = :id
|
||||||
ON CONFLICT (stage, compare_yyyy, target_yyyy)
|
ON CONFLICT (stage, compare_yyyy, target_yyyy)
|
||||||
@@ -217,11 +219,15 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
|||||||
msl.m2_model_batch_id,
|
msl.m2_model_batch_id,
|
||||||
msl.m3_model_batch_id
|
msl.m3_model_batch_id
|
||||||
)
|
)
|
||||||
inner join tb_map_sheet_anal_data_inference msadi
|
INNER JOIN tb_map_sheet_anal_data_inference msadi
|
||||||
on msadi.anal_uid = msl.anal_uid
|
ON msadi.anal_uid = msl.anal_uid
|
||||||
AND r.map_id ~ '^[0-9]+$'
|
AND r.map_id ~ '^[0-9]+$'
|
||||||
AND r.map_id::bigint = msadi.map_sheet_num
|
AND r.map_id::bigint = msadi.map_sheet_num
|
||||||
where msl.anal_uid = :analUid
|
WHERE msl.anal_uid = :analUid
|
||||||
|
AND r.before_c is not null
|
||||||
|
AND r.before_p is not null
|
||||||
|
AND r.after_c is not null
|
||||||
|
AND r.after_p is not null
|
||||||
ORDER BY r.uid, r.created_date DESC NULLS LAST
|
ORDER BY r.uid, r.created_date DESC NULLS LAST
|
||||||
) x
|
) x
|
||||||
ON CONFLICT (result_uid)
|
ON CONFLICT (result_uid)
|
||||||
|
|||||||
@@ -6,4 +6,6 @@ import java.util.UUID;
|
|||||||
public interface MapSheetLearn5kRepositoryCustom {
|
public interface MapSheetLearn5kRepositoryCustom {
|
||||||
|
|
||||||
void saveFail5k(UUID uuid, List<Long> failMapIds, String type);
|
void saveFail5k(UUID uuid, List<Long> failMapIds, String type);
|
||||||
|
|
||||||
|
List<String> getInferenceRunMapId(UUID uuid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.repository.Inference;
|
package com.kamco.cd.kamcoback.postgres.repository.Inference;
|
||||||
|
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapInkx5kEntity.mapInkx5kEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearn5kEntity.mapSheetLearn5kEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearn5kEntity.mapSheetLearn5kEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity.mapSheetLearnEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity.mapSheetLearnEntity;
|
||||||
|
|
||||||
import com.querydsl.core.types.dsl.BooleanPath;
|
import com.querydsl.core.types.dsl.BooleanPath;
|
||||||
|
import com.querydsl.core.types.dsl.Expressions;
|
||||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@@ -59,4 +61,25 @@ public class MapSheetLearn5kRepositoryImpl implements MapSheetLearn5kRepositoryC
|
|||||||
.and(mapSheetLearn5kEntity.mapSheetNum.in(failMapIds)))
|
.and(mapSheetLearn5kEntity.mapSheetNum.in(failMapIds)))
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getInferenceRunMapId(UUID uuid) {
|
||||||
|
return queryFactory
|
||||||
|
.select(mapInkx5kEntity.mapidNm)
|
||||||
|
.from(mapSheetLearnEntity)
|
||||||
|
.innerJoin(mapSheetLearn5kEntity)
|
||||||
|
.on(mapSheetLearn5kEntity.learn.id.eq(mapSheetLearnEntity.id))
|
||||||
|
.innerJoin(mapInkx5kEntity)
|
||||||
|
.on(
|
||||||
|
Expressions.booleanTemplate(
|
||||||
|
"function('regexp_match', {0}, '^[0-9]+$') is not null",
|
||||||
|
mapInkx5kEntity.mapidcdNo)
|
||||||
|
.and(
|
||||||
|
mapSheetLearn5kEntity.mapSheetNum.eq(
|
||||||
|
Expressions.numberTemplate(
|
||||||
|
Long.class, "cast({0} as long)", mapInkx5kEntity.mapidcdNo))))
|
||||||
|
.where(mapSheetLearnEntity.uuid.eq(uuid))
|
||||||
|
.groupBy(mapInkx5kEntity.mapidNm)
|
||||||
|
.fetch();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import com.kamco.cd.kamcoback.postgres.entity.MapSheetLearnEntity;
|
|||||||
import com.kamco.cd.kamcoback.postgres.entity.QModelMngEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.QModelMngEntity;
|
||||||
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.BooleanExpression;
|
||||||
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.NumberExpression;
|
||||||
@@ -360,42 +361,56 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
|
|||||||
@Override
|
@Override
|
||||||
public Page<Geom> getInferenceGeomList(UUID uuid, SearchGeoReq searchGeoReq) {
|
public Page<Geom> getInferenceGeomList(UUID uuid, SearchGeoReq searchGeoReq) {
|
||||||
Pageable pageable = searchGeoReq.toPageable();
|
Pageable pageable = searchGeoReq.toPageable();
|
||||||
BooleanBuilder builder = new BooleanBuilder();
|
BooleanBuilder where = new BooleanBuilder();
|
||||||
|
|
||||||
// analUid로 분석 정보 조회
|
// 1) 분석 엔티티 조회
|
||||||
MapSheetLearnEntity analEntity =
|
MapSheetLearnEntity analEntity =
|
||||||
queryFactory
|
queryFactory
|
||||||
.selectFrom(mapSheetLearnEntity)
|
.selectFrom(mapSheetLearnEntity)
|
||||||
.where(mapSheetLearnEntity.uuid.eq(uuid))
|
.where(mapSheetLearnEntity.uuid.eq(uuid))
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
if (Objects.isNull(analEntity)) {
|
if (analEntity == null) {
|
||||||
throw new CustomApiException("NOT_FOUND_DATA", HttpStatus.NOT_FOUND);
|
throw new CustomApiException("NOT_FOUND_DATA", HttpStatus.NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 추론결과 id
|
// 2) where 조건
|
||||||
builder.and(mapSheetAnalInferenceEntity.learnId.eq(analEntity.getId()));
|
where.and(mapSheetAnalInferenceEntity.learnId.eq(analEntity.getId()));
|
||||||
|
|
||||||
// 기준년도 분류
|
if (searchGeoReq.getTargetClass() != null && !searchGeoReq.getTargetClass().isBlank()) {
|
||||||
if (searchGeoReq.getTargetClass() != null && !searchGeoReq.getTargetClass().equals("")) {
|
where.and(
|
||||||
builder.and(
|
|
||||||
mapSheetAnalDataInferenceGeomEntity.classAfterCd.eq(
|
mapSheetAnalDataInferenceGeomEntity.classAfterCd.eq(
|
||||||
searchGeoReq.getTargetClass().toLowerCase()));
|
searchGeoReq.getTargetClass().toLowerCase()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 비교년도 분류
|
if (searchGeoReq.getCompareClass() != null && !searchGeoReq.getCompareClass().isBlank()) {
|
||||||
if (searchGeoReq.getCompareClass() != null && !searchGeoReq.getCompareClass().equals("")) {
|
where.and(
|
||||||
builder.and(
|
|
||||||
mapSheetAnalDataInferenceGeomEntity.classBeforeCd.eq(
|
mapSheetAnalDataInferenceGeomEntity.classBeforeCd.eq(
|
||||||
searchGeoReq.getCompareClass().toLowerCase()));
|
searchGeoReq.getCompareClass().toLowerCase()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 분석도엽
|
|
||||||
if (searchGeoReq.getMapSheetNum() != null) {
|
if (searchGeoReq.getMapSheetNum() != null) {
|
||||||
Long mapSheetNum = searchGeoReq.getMapSheetNum();
|
//
|
||||||
builder.and(mapSheetAnalDataInferenceGeomEntity.mapSheetNum.like("%" + mapSheetNum + "%"));
|
// where.and(mapSheetAnalDataInferenceGeomEntity.mapSheetNum.eq(searchGeoReq.getMapSheetNum()));
|
||||||
|
where.and(
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.mapSheetNum.like(
|
||||||
|
"%" + searchGeoReq.getMapSheetNum() + "%"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
where.and(mapSheetAnalDataInferenceGeomEntity.classAfterCd.isNotNull());
|
||||||
|
where.and(mapSheetAnalDataInferenceGeomEntity.classAfterProb.isNotNull());
|
||||||
|
where.and(mapSheetAnalDataInferenceGeomEntity.classBeforeCd.isNotNull());
|
||||||
|
where.and(mapSheetAnalDataInferenceGeomEntity.classBeforeProb.isNotNull());
|
||||||
|
|
||||||
|
// 3) inkx 조인 조건: JPQL/HQL에서 '~' 불가 → function('regexp_match', ...) 사용
|
||||||
|
BooleanExpression inkxIsNumeric =
|
||||||
|
Expressions.booleanTemplate(
|
||||||
|
"function('regexp_match', {0}, '^[0-9]+$') is not null", mapInkx5kEntity.mapidcdNo);
|
||||||
|
|
||||||
|
NumberExpression<Long> inkxNoAsLong =
|
||||||
|
Expressions.numberTemplate(Long.class, "cast({0} as long)", mapInkx5kEntity.mapidcdNo);
|
||||||
|
|
||||||
|
// 4) content
|
||||||
List<Geom> content =
|
List<Geom> content =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(
|
.select(
|
||||||
@@ -411,45 +426,32 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
|
|||||||
mapSheetAnalDataInferenceGeomEntity.classAfterCd,
|
mapSheetAnalDataInferenceGeomEntity.classAfterCd,
|
||||||
mapSheetAnalDataInferenceGeomEntity.classAfterProb,
|
mapSheetAnalDataInferenceGeomEntity.classAfterProb,
|
||||||
mapSheetAnalDataInferenceGeomEntity.mapSheetNum,
|
mapSheetAnalDataInferenceGeomEntity.mapSheetNum,
|
||||||
mapInkx5kEntity.mapidNm
|
mapInkx5kEntity.mapidNm))
|
||||||
// Expressions.stringTemplate(
|
|
||||||
// "ST_AsGeoJSON({0})",
|
|
||||||
// mapSheetAnalDataInferenceGeomEntity.geom),
|
|
||||||
// Expressions.stringTemplate(
|
|
||||||
// "ST_AsGeoJSON({0})",
|
|
||||||
// mapSheetAnalDataInferenceGeomEntity.geomCenter)
|
|
||||||
))
|
|
||||||
.from(mapSheetAnalInferenceEntity)
|
.from(mapSheetAnalInferenceEntity)
|
||||||
.join(mapSheetAnalDataInferenceEntity)
|
.join(mapSheetAnalDataInferenceEntity)
|
||||||
.on(mapSheetAnalDataInferenceEntity.analUid.eq(mapSheetAnalInferenceEntity.id))
|
.on(mapSheetAnalDataInferenceEntity.analUid.eq(mapSheetAnalInferenceEntity.id))
|
||||||
.join(mapSheetAnalDataInferenceGeomEntity)
|
.join(mapSheetAnalDataInferenceGeomEntity)
|
||||||
.on(mapSheetAnalDataInferenceGeomEntity.dataUid.eq(mapSheetAnalDataInferenceEntity.id))
|
.on(mapSheetAnalDataInferenceGeomEntity.dataUid.eq(mapSheetAnalDataInferenceEntity.id))
|
||||||
.join(mapInkx5kEntity)
|
.join(mapInkx5kEntity)
|
||||||
.on(
|
.on(inkxIsNumeric.and(mapSheetAnalDataInferenceGeomEntity.mapSheetNum.eq(inkxNoAsLong)))
|
||||||
mapSheetAnalDataInferenceGeomEntity.mapSheetNum.eq(
|
.where(where)
|
||||||
Expressions.numberTemplate(
|
.orderBy(mapSheetAnalDataInferenceGeomEntity.geoUid.desc())
|
||||||
Long.class, "CAST({0} AS long)", mapInkx5kEntity.mapidcdNo)))
|
|
||||||
.where(builder)
|
|
||||||
.offset(pageable.getOffset())
|
.offset(pageable.getOffset())
|
||||||
.limit(pageable.getPageSize())
|
.limit(pageable.getPageSize())
|
||||||
.fetch();
|
.fetch();
|
||||||
|
|
||||||
long total =
|
// 5) total (조인 최소화 유지)
|
||||||
|
Long total =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(mapSheetAnalDataInferenceGeomEntity.geoUid)
|
.select(mapSheetAnalDataInferenceGeomEntity.geoUid.count())
|
||||||
.from(mapSheetAnalInferenceEntity)
|
.from(mapSheetAnalInferenceEntity)
|
||||||
.join(mapSheetAnalDataInferenceEntity)
|
.join(mapSheetAnalDataInferenceEntity)
|
||||||
.on(mapSheetAnalDataInferenceEntity.analUid.eq(mapSheetAnalInferenceEntity.id))
|
.on(mapSheetAnalDataInferenceEntity.analUid.eq(mapSheetAnalInferenceEntity.id))
|
||||||
.join(mapSheetAnalDataInferenceGeomEntity)
|
.join(mapSheetAnalDataInferenceGeomEntity)
|
||||||
.on(mapSheetAnalDataInferenceGeomEntity.dataUid.eq(mapSheetAnalDataInferenceEntity.id))
|
.on(mapSheetAnalDataInferenceGeomEntity.dataUid.eq(mapSheetAnalDataInferenceEntity.id))
|
||||||
.join(mapInkx5kEntity)
|
.where(where)
|
||||||
.on(
|
.fetchOne();
|
||||||
mapSheetAnalDataInferenceGeomEntity.mapSheetNum.eq(
|
|
||||||
Expressions.numberTemplate(
|
|
||||||
Long.class, "CAST({0} AS long)", mapInkx5kEntity.mapidcdNo)))
|
|
||||||
.where(builder)
|
|
||||||
.fetchCount();
|
|
||||||
|
|
||||||
return new PageImpl<>(content, pageable, total);
|
return new PageImpl<>(content, pageable, total == null ? 0L : total);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
|||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto;
|
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto;
|
||||||
|
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.DetectSearchType;
|
||||||
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapScaleType;
|
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapScaleType;
|
||||||
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapSheetList;
|
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapSheetList;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataInferenceGeomEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataInferenceGeomEntity;
|
||||||
@@ -111,6 +112,26 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChangeDetectionDto.CogUrlDto getChangeDetectionCogUrl(ChangeDetectionDto.CogUrlReq req) {
|
public ChangeDetectionDto.CogUrlDto getChangeDetectionCogUrl(ChangeDetectionDto.CogUrlReq req) {
|
||||||
|
String mapSheetNum = req.getMapSheetNum();
|
||||||
|
|
||||||
|
if (req.getType().equals(DetectSearchType.MAPSHEET)
|
||||||
|
&& req.getScale().equals(MapScaleType.SCALE_50K)) {
|
||||||
|
mapSheetNum =
|
||||||
|
queryFactory
|
||||||
|
.select(mapSheetAnalDataInferenceEntity.mapSheetNum.stringValue())
|
||||||
|
.from(mapSheetAnalInferenceEntity)
|
||||||
|
.innerJoin(mapSheetAnalDataInferenceEntity)
|
||||||
|
.on(mapSheetAnalInferenceEntity.id.eq(mapSheetAnalDataInferenceEntity.analUid))
|
||||||
|
.where(
|
||||||
|
mapSheetAnalInferenceEntity.uuid.eq(req.getUuid()),
|
||||||
|
mapSheetAnalDataInferenceEntity
|
||||||
|
.mapSheetNum
|
||||||
|
.stringValue()
|
||||||
|
.like("%" + req.getMapSheetNum() + "%"))
|
||||||
|
.orderBy(mapSheetAnalDataInferenceEntity.mapSheetNum.asc())
|
||||||
|
.fetchFirst();
|
||||||
|
}
|
||||||
|
|
||||||
ChangeDetectionDto.CogUrlData data =
|
ChangeDetectionDto.CogUrlData data =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(
|
.select(
|
||||||
@@ -128,7 +149,7 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
.year
|
.year
|
||||||
.eq(req.getBeforeYear())
|
.eq(req.getBeforeYear())
|
||||||
.or(imageryEntity.year.eq(req.getAfterYear())),
|
.or(imageryEntity.year.eq(req.getAfterYear())),
|
||||||
imageryEntity.scene5k.eq(req.getMapSheetNum()))
|
imageryEntity.scene5k.eq(mapSheetNum))
|
||||||
.groupBy(mapInkx5kEntity.geom)
|
.groupBy(mapInkx5kEntity.geom)
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
@@ -191,6 +212,7 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
.where(
|
.where(
|
||||||
mapSheetAnalInferenceEntity.uuid.eq(uuid),
|
mapSheetAnalInferenceEntity.uuid.eq(uuid),
|
||||||
mapScaleTypeAnalDataSearchExpression(scale, mapSheetNum))
|
mapScaleTypeAnalDataSearchExpression(scale, mapSheetNum))
|
||||||
|
.orderBy(mapSheetAnalDataInferenceGeomEntity.mapSheetNum.asc())
|
||||||
.fetch();
|
.fetch();
|
||||||
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
@@ -313,7 +335,8 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
.on(mapSheetAnalDataInferenceEntity.mapSheetNum.stringValue().eq(mapInkx5kEntity.mapidcdNo))
|
.on(mapSheetAnalDataInferenceEntity.mapSheetNum.stringValue().eq(mapInkx5kEntity.mapidcdNo))
|
||||||
.innerJoin(mapInkx5kEntity.mapInkx50k, mapInkx50kEntity)
|
.innerJoin(mapInkx5kEntity.mapInkx50k, mapInkx50kEntity)
|
||||||
.where(mapSheetAnalInferenceEntity.uuid.eq(uuid))
|
.where(mapSheetAnalInferenceEntity.uuid.eq(uuid))
|
||||||
.orderBy(mapInkx5kEntity.mapidcdNo.asc())
|
.groupBy(mapInkx50kEntity.mapidcdNo, mapInkx50kEntity.mapidNm)
|
||||||
|
.orderBy(mapInkx50kEntity.mapidcdNo.asc())
|
||||||
.fetch();
|
.fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,14 +20,13 @@ import org.springframework.data.domain.Page;
|
|||||||
|
|
||||||
public interface LabelAllocateRepositoryCustom {
|
public interface LabelAllocateRepositoryCustom {
|
||||||
|
|
||||||
List<AllocateInfoDto> fetchNextIds(
|
List<AllocateInfoDto> fetchNextIds(Long lastId, Long batchSize, UUID uuid);
|
||||||
Long lastId, Long batchSize, Integer compareYyyy, Integer targetYyyy, Integer stage);
|
|
||||||
|
|
||||||
void assignOwner(List<AllocateInfoDto> ids, String userId, Long analUid);
|
void assignOwner(List<AllocateInfoDto> ids, String userId, Long analUid);
|
||||||
|
|
||||||
List<LabelingAssignmentEntity> findAssignedLabelerList(Long analUid);
|
List<LabelingAssignmentEntity> findAssignedLabelerList(Long analUid);
|
||||||
|
|
||||||
Long findLabelUnAssignedCnt(Integer stage, Integer compareYyyy, Integer targetYyyy);
|
Long findLabelUnAssignedCnt(UUID uuid);
|
||||||
|
|
||||||
void assignInspector(UUID assignmentUid, String userId);
|
void assignInspector(UUID assignmentUid, String userId);
|
||||||
|
|
||||||
@@ -74,7 +73,7 @@ public interface LabelAllocateRepositoryCustom {
|
|||||||
/** UUID로 analUid 조회 */
|
/** UUID로 analUid 조회 */
|
||||||
Long findAnalUidByUuid(String uuid);
|
Long findAnalUidByUuid(String uuid);
|
||||||
|
|
||||||
Long findMapSheetAnalInferenceUid(Integer compareYyyy, Integer targetYyyy, Integer stage);
|
Long findMapSheetAnalInferenceUid(UUID uuid);
|
||||||
|
|
||||||
void insertInspector(Long analUid, String inspector);
|
void insertInspector(Long analUid, String inspector);
|
||||||
|
|
||||||
@@ -101,4 +100,8 @@ public interface LabelAllocateRepositoryCustom {
|
|||||||
Page<WorkHistoryDto> workLabelHistoryList(LabelAllocateDto.searchReq searchReq, String userId);
|
Page<WorkHistoryDto> workLabelHistoryList(LabelAllocateDto.searchReq searchReq, String userId);
|
||||||
|
|
||||||
Page<WorkHistoryDto> workReviewerHistoryList(searchReq searchReq, String userId);
|
Page<WorkHistoryDto> workReviewerHistoryList(searchReq searchReq, String userId);
|
||||||
|
|
||||||
|
void updateAnalInferenceMngState(UUID uuid, String status);
|
||||||
|
|
||||||
|
Long findLabelingIngProcessCnt();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ 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.InspectState;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InspectState;
|
||||||
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelMngState;
|
||||||
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.LabelingStatDto;
|
||||||
@@ -66,8 +67,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
@PersistenceContext private EntityManager em;
|
@PersistenceContext private EntityManager em;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AllocateInfoDto> fetchNextIds(
|
public List<AllocateInfoDto> fetchNextIds(Long lastId, Long batchSize, UUID uuid) {
|
||||||
Long lastId, Long batchSize, Integer compareYyyy, Integer targetYyyy, Integer stage) {
|
|
||||||
|
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.select(
|
.select(
|
||||||
@@ -76,14 +76,17 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
mapSheetAnalDataInferenceGeomEntity.geoUid,
|
mapSheetAnalDataInferenceGeomEntity.geoUid,
|
||||||
mapSheetAnalDataInferenceGeomEntity.mapSheetNum,
|
mapSheetAnalDataInferenceGeomEntity.mapSheetNum,
|
||||||
mapSheetAnalDataInferenceGeomEntity.pnu))
|
mapSheetAnalDataInferenceGeomEntity.pnu))
|
||||||
.from(mapSheetAnalDataInferenceGeomEntity)
|
.from(mapSheetAnalInferenceEntity)
|
||||||
.where(
|
.innerJoin(mapSheetAnalDataInferenceEntity)
|
||||||
lastId == null ? null : mapSheetAnalDataInferenceGeomEntity.geoUid.gt(lastId),
|
.on(mapSheetAnalInferenceEntity.id.eq(mapSheetAnalDataInferenceEntity.analUid))
|
||||||
|
.innerJoin(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.on(
|
||||||
|
mapSheetAnalDataInferenceEntity.id.eq(mapSheetAnalDataInferenceGeomEntity.dataUid),
|
||||||
mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull(),
|
mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull(),
|
||||||
mapSheetAnalDataInferenceGeomEntity.compareYyyy.eq(compareYyyy),
|
|
||||||
mapSheetAnalDataInferenceGeomEntity.targetYyyy.eq(targetYyyy),
|
|
||||||
mapSheetAnalDataInferenceGeomEntity.stage.eq(stage),
|
|
||||||
mapSheetAnalDataInferenceGeomEntity.labelState.isNull())
|
mapSheetAnalDataInferenceGeomEntity.labelState.isNull())
|
||||||
|
.where(
|
||||||
|
mapSheetAnalInferenceEntity.uuid.eq(uuid),
|
||||||
|
lastId == null ? null : mapSheetAnalDataInferenceGeomEntity.geoUid.gt(lastId))
|
||||||
.orderBy(mapSheetAnalDataInferenceGeomEntity.mapSheetNum.asc())
|
.orderBy(mapSheetAnalDataInferenceGeomEntity.mapSheetNum.asc())
|
||||||
.limit(batchSize)
|
.limit(batchSize)
|
||||||
.fetch();
|
.fetch();
|
||||||
@@ -177,17 +180,19 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long findLabelUnAssignedCnt(Integer stage, Integer compareYyyy, Integer targetYyyy) {
|
public Long findLabelUnAssignedCnt(UUID uuid) {
|
||||||
|
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.select(mapSheetAnalDataInferenceGeomEntity.geoUid.count())
|
.select(mapSheetAnalDataInferenceGeomEntity.geoUid.count())
|
||||||
.from(mapSheetAnalDataInferenceGeomEntity)
|
.from(mapSheetAnalInferenceEntity)
|
||||||
.where(
|
.innerJoin(mapSheetAnalDataInferenceEntity)
|
||||||
|
.on(mapSheetAnalInferenceEntity.id.eq(mapSheetAnalDataInferenceEntity.analUid))
|
||||||
|
.innerJoin(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.on(
|
||||||
|
mapSheetAnalDataInferenceEntity.id.eq(mapSheetAnalDataInferenceGeomEntity.dataUid),
|
||||||
mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull(),
|
mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull(),
|
||||||
mapSheetAnalDataInferenceGeomEntity.compareYyyy.eq(compareYyyy),
|
|
||||||
mapSheetAnalDataInferenceGeomEntity.targetYyyy.eq(targetYyyy),
|
|
||||||
mapSheetAnalDataInferenceGeomEntity.stage.eq(stage),
|
|
||||||
mapSheetAnalDataInferenceGeomEntity.labelState.isNull())
|
mapSheetAnalDataInferenceGeomEntity.labelState.isNull())
|
||||||
|
.where(mapSheetAnalInferenceEntity.uuid.eq(uuid))
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -912,14 +917,11 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long findMapSheetAnalInferenceUid(Integer compareYyyy, Integer targetYyyy, Integer stage) {
|
public Long findMapSheetAnalInferenceUid(UUID uuid) {
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.select(mapSheetAnalInferenceEntity.id)
|
.select(mapSheetAnalInferenceEntity.id)
|
||||||
.from(mapSheetAnalInferenceEntity)
|
.from(mapSheetAnalInferenceEntity)
|
||||||
.where(
|
.where(mapSheetAnalInferenceEntity.uuid.eq(uuid))
|
||||||
mapSheetAnalInferenceEntity.compareYyyy.eq(compareYyyy),
|
|
||||||
mapSheetAnalInferenceEntity.targetYyyy.eq(targetYyyy),
|
|
||||||
mapSheetAnalInferenceEntity.stage.eq(stage))
|
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1784,4 +1786,23 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
|
|
||||||
return new PageImpl<>(list, pageable, countQuery != null ? countQuery : 0L);
|
return new PageImpl<>(list, pageable, countQuery != null ? countQuery : 0L);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateAnalInferenceMngState(UUID uuid, String status) {
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetAnalInferenceEntity)
|
||||||
|
.set(mapSheetAnalInferenceEntity.analState, status)
|
||||||
|
.set(mapSheetAnalInferenceEntity.updatedDttm, ZonedDateTime.now())
|
||||||
|
.where(mapSheetAnalInferenceEntity.uuid.eq(uuid))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long findLabelingIngProcessCnt() {
|
||||||
|
return queryFactory
|
||||||
|
.select(mapSheetAnalInferenceEntity.id.count())
|
||||||
|
.from(mapSheetAnalInferenceEntity)
|
||||||
|
.where(mapSheetAnalInferenceEntity.analState.eq(LabelMngState.ING.getId()))
|
||||||
|
.fetchOne();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -138,7 +138,9 @@ public class LabelWorkRepositoryImpl implements LabelWorkRepositoryCustom {
|
|||||||
mapSheetAnalDataInferenceGeomEntity
|
mapSheetAnalDataInferenceGeomEntity
|
||||||
.pnu
|
.pnu
|
||||||
.isNotNull()
|
.isNotNull()
|
||||||
.and(mapSheetAnalDataInferenceGeomEntity.pnu.ne(0L))
|
.and(
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.pnu
|
||||||
|
.isNotNull()) // TODO: 이노팸 연동 후 0 이상이라고 해야할 듯
|
||||||
.and(mapSheetAnalDataInferenceGeomEntity.passYn.eq(Boolean.FALSE)))
|
.and(mapSheetAnalDataInferenceGeomEntity.passYn.eq(Boolean.FALSE)))
|
||||||
.then(1L)
|
.then(1L)
|
||||||
.otherwise(0L)
|
.otherwise(0L)
|
||||||
@@ -198,9 +200,8 @@ public class LabelWorkRepositoryImpl implements LabelWorkRepositoryCustom {
|
|||||||
.otherwise(0L)
|
.otherwise(0L)
|
||||||
.sum(),
|
.sum(),
|
||||||
mapSheetAnalDataInferenceGeomEntity.labelStateDttm.min(),
|
mapSheetAnalDataInferenceGeomEntity.labelStateDttm.min(),
|
||||||
// analState: tb_map_sheet_anal_inference.anal_state -> 우선은 미사용, java 단에서 로직화 해서
|
// analState: tb_map_sheet_anal_inference.anal_state
|
||||||
// 내려줌
|
mapSheetAnalInferenceEntity.analState,
|
||||||
// mapSheetAnalInferenceEntity.analState,
|
|
||||||
// normalProgressCnt: stagnation_yn = 'N'인 건수 (서브쿼리)
|
// normalProgressCnt: stagnation_yn = 'N'인 건수 (서브쿼리)
|
||||||
normalProgressCntSubQuery,
|
normalProgressCntSubQuery,
|
||||||
// totalAssignmentCnt: 총 배정 건수 (서브쿼리)
|
// totalAssignmentCnt: 총 배정 건수 (서브쿼리)
|
||||||
|
|||||||
@@ -16,4 +16,6 @@ public interface TrainingDataReviewJobRepositoryCustom {
|
|||||||
void assignReviewerBatch(List<UUID> assignmentUids, String reviewerId);
|
void assignReviewerBatch(List<UUID> assignmentUids, String reviewerId);
|
||||||
|
|
||||||
Tasks findAssignmentTask(String assignmentUid);
|
Tasks findAssignmentTask(String assignmentUid);
|
||||||
|
|
||||||
|
void updateGeomUidTestState(List<Long> geomUids);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.kamco.cd.kamcoback.postgres.repository.scheduler;
|
|||||||
|
|
||||||
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.QLabelingInspectorEntity.labelingInspectorEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QLabelingInspectorEntity.labelingInspectorEntity;
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity;
|
||||||
|
|
||||||
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;
|
||||||
@@ -99,6 +100,7 @@ public class TrainingDataReviewJobRepositoryImpl extends QuerydslRepositorySuppo
|
|||||||
.update(labelingAssignmentEntity)
|
.update(labelingAssignmentEntity)
|
||||||
.set(labelingAssignmentEntity.inspectorUid, reviewerId)
|
.set(labelingAssignmentEntity.inspectorUid, reviewerId)
|
||||||
.set(labelingAssignmentEntity.inspectState, InspectState.UNCONFIRM.getId())
|
.set(labelingAssignmentEntity.inspectState, InspectState.UNCONFIRM.getId())
|
||||||
|
.set(labelingAssignmentEntity.modifiedDate, ZonedDateTime.now())
|
||||||
.where(labelingAssignmentEntity.assignmentUid.eq(assignmentUid))
|
.where(labelingAssignmentEntity.assignmentUid.eq(assignmentUid))
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
@@ -115,6 +117,7 @@ public class TrainingDataReviewJobRepositoryImpl extends QuerydslRepositorySuppo
|
|||||||
.update(labelingAssignmentEntity)
|
.update(labelingAssignmentEntity)
|
||||||
.set(labelingAssignmentEntity.inspectorUid, reviewerId)
|
.set(labelingAssignmentEntity.inspectorUid, reviewerId)
|
||||||
.set(labelingAssignmentEntity.inspectState, InspectState.UNCONFIRM.getId())
|
.set(labelingAssignmentEntity.inspectState, InspectState.UNCONFIRM.getId())
|
||||||
|
.set(labelingAssignmentEntity.modifiedDate, ZonedDateTime.now())
|
||||||
.where(labelingAssignmentEntity.assignmentUid.in(assignmentUids))
|
.where(labelingAssignmentEntity.assignmentUid.in(assignmentUids))
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
@@ -132,4 +135,14 @@ public class TrainingDataReviewJobRepositoryImpl extends QuerydslRepositorySuppo
|
|||||||
.where(labelingAssignmentEntity.assignmentUid.eq(UUID.fromString(assignmentUid)))
|
.where(labelingAssignmentEntity.assignmentUid.eq(UUID.fromString(assignmentUid)))
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateGeomUidTestState(List<Long> geomUids) {
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.set(mapSheetAnalDataInferenceGeomEntity.testState, InspectState.UNCONFIRM.getId())
|
||||||
|
.set(mapSheetAnalDataInferenceGeomEntity.updatedDttm, ZonedDateTime.now())
|
||||||
|
.where(mapSheetAnalDataInferenceGeomEntity.geoUid.in(geomUids))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.kamco.cd.kamcoback.postgres.repository.trainingdata;
|
|||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto;
|
||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.DefaultPaging;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.DefaultPaging;
|
||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.DetailRes;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.DetailRes;
|
||||||
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.InferenceIdInfo;
|
||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.LabelFeatureRequest.LabelProperties;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.LabelFeatureRequest.LabelProperties;
|
||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.LabelingGeometryInfo;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.LabelingGeometryInfo;
|
||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.LabelingListDto;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.LabelingListDto;
|
||||||
@@ -18,7 +19,7 @@ public interface TrainingDataLabelRepositoryCustom {
|
|||||||
|
|
||||||
LabelingGeometryInfo findLabelingAssignedGeom(String assignmentUid);
|
LabelingGeometryInfo findLabelingAssignedGeom(String assignmentUid);
|
||||||
|
|
||||||
Long findLabelingAssignmentGeoUid(String assignmentUid);
|
InferenceIdInfo findLabelingAssignmentGeoUid(String assignmentUid);
|
||||||
|
|
||||||
void updateLabelingStateAssignment(String assignmentUid, String status);
|
void updateLabelingStateAssignment(String assignmentUid, String status);
|
||||||
|
|
||||||
@@ -37,4 +38,6 @@ public interface TrainingDataLabelRepositoryCustom {
|
|||||||
|
|
||||||
TrainingDataLabelDto.CogImageResponse getCogImageUrl(
|
TrainingDataLabelDto.CogImageResponse getCogImageUrl(
|
||||||
String mapSheetNum, Integer beforeYear, Integer afterYear);
|
String mapSheetNum, Integer beforeYear, Integer afterYear);
|
||||||
|
|
||||||
|
void updateAnalInferenceMngState(Long analUid, String status);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import static com.kamco.cd.kamcoback.postgres.entity.QImageryEntity.imageryEntit
|
|||||||
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.QMapInkx5kEntity.mapInkx5kEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapInkx5kEntity.mapInkx5kEntity;
|
||||||
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 static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnDataGeomEntity.mapSheetLearnDataGeomEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnDataGeomEntity.mapSheetLearnDataGeomEntity;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
@@ -19,6 +20,7 @@ import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.DefaultPagin
|
|||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.DetailRes;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.DetailRes;
|
||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.InferenceDataGeometry;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.InferenceDataGeometry;
|
||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.InferenceDataGeometry.InferenceProperties;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.InferenceDataGeometry.InferenceProperties;
|
||||||
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.InferenceIdInfo;
|
||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.InspectionResultInfo;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.InspectionResultInfo;
|
||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.LabelFeatureRequest.LabelProperties;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.LabelFeatureRequest.LabelProperties;
|
||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.LabelingGeometryInfo;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.LabelingGeometryInfo;
|
||||||
@@ -174,9 +176,13 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long findLabelingAssignmentGeoUid(String assignmentUid) {
|
public InferenceIdInfo findLabelingAssignmentGeoUid(String assignmentUid) {
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.select(labelingAssignmentEntity.inferenceGeomUid)
|
.select(
|
||||||
|
Projections.constructor(
|
||||||
|
InferenceIdInfo.class,
|
||||||
|
labelingAssignmentEntity.inferenceGeomUid,
|
||||||
|
labelingAssignmentEntity.analUid))
|
||||||
.from(labelingAssignmentEntity)
|
.from(labelingAssignmentEntity)
|
||||||
.where(labelingAssignmentEntity.assignmentUid.eq(UUID.fromString(assignmentUid)))
|
.where(labelingAssignmentEntity.assignmentUid.eq(UUID.fromString(assignmentUid)))
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
@@ -838,6 +844,16 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateAnalInferenceMngState(Long analUid, String status) {
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetAnalInferenceEntity)
|
||||||
|
.set(mapSheetAnalInferenceEntity.analState, status)
|
||||||
|
.set(mapSheetAnalInferenceEntity.updatedDttm, ZonedDateTime.now())
|
||||||
|
.where(mapSheetAnalInferenceEntity.id.eq(analUid))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
|
||||||
private StringExpression makeCogUrl(NumberPath<Integer> year) {
|
private StringExpression makeCogUrl(NumberPath<Integer> year) {
|
||||||
return new CaseBuilder()
|
return new CaseBuilder()
|
||||||
.when(imageryEntity.year.eq(year))
|
.when(imageryEntity.year.eq(year))
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.repository.trainingdata;
|
package com.kamco.cd.kamcoback.postgres.repository.trainingdata;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.InferenceIdInfo;
|
||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto;
|
||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto.DefaultPaging;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto.DefaultPaging;
|
||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto.DetailRes;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto.DetailRes;
|
||||||
@@ -18,7 +19,7 @@ public interface TrainingDataReviewRepositoryCustom {
|
|||||||
|
|
||||||
ReviewGeometryInfo findReviewAssignedGeom(String operatorUid);
|
ReviewGeometryInfo findReviewAssignedGeom(String operatorUid);
|
||||||
|
|
||||||
Long findReviewOperatorGeoUid(String operatorUid);
|
InferenceIdInfo findReviewOperatorGeoUid(String operatorUid);
|
||||||
|
|
||||||
void updateReviewStateOperator(String operatorUid, String status);
|
void updateReviewStateOperator(String operatorUid, String status);
|
||||||
|
|
||||||
@@ -37,4 +38,6 @@ public interface TrainingDataReviewRepositoryCustom {
|
|||||||
|
|
||||||
TrainingDataReviewDto.CogImageResponse getCogImageUrl(
|
TrainingDataReviewDto.CogImageResponse getCogImageUrl(
|
||||||
String mapSheetNum, Integer beforeYear, Integer afterYear);
|
String mapSheetNum, Integer beforeYear, Integer afterYear);
|
||||||
|
|
||||||
|
void updateAnalInferenceMngState(Long analUid, String status);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import static com.kamco.cd.kamcoback.postgres.entity.QImageryEntity.imageryEntit
|
|||||||
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.QMapInkx5kEntity.mapInkx5kEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapInkx5kEntity.mapInkx5kEntity;
|
||||||
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 static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnDataGeomEntity.mapSheetLearnDataGeomEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnDataGeomEntity.mapSheetLearnDataGeomEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMemberEntity.memberEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMemberEntity.memberEntity;
|
||||||
|
|
||||||
@@ -12,6 +13,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InspectState;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InspectState;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataInferenceGeomEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataInferenceGeomEntity;
|
||||||
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.InferenceIdInfo;
|
||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto;
|
||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto.ChangeDetectionInfo;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto.ChangeDetectionInfo;
|
||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto.ClassificationInfo;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto.ClassificationInfo;
|
||||||
@@ -177,9 +179,13 @@ public class TrainingDataReviewRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long findReviewOperatorGeoUid(String operatorUid) {
|
public InferenceIdInfo findReviewOperatorGeoUid(String operatorUid) {
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.select(labelingAssignmentEntity.inferenceGeomUid)
|
.select(
|
||||||
|
Projections.constructor(
|
||||||
|
InferenceIdInfo.class,
|
||||||
|
labelingAssignmentEntity.inferenceGeomUid,
|
||||||
|
labelingAssignmentEntity.analUid))
|
||||||
.from(labelingAssignmentEntity)
|
.from(labelingAssignmentEntity)
|
||||||
.where(labelingAssignmentEntity.assignmentUid.eq(UUID.fromString(operatorUid)))
|
.where(labelingAssignmentEntity.assignmentUid.eq(UUID.fromString(operatorUid)))
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
@@ -209,6 +215,15 @@ public class TrainingDataReviewRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
@Override
|
@Override
|
||||||
public void updateReviewPolygonClass(
|
public void updateReviewPolygonClass(
|
||||||
Long inferenceGeomUid, Geometry geometry, Properties properties, String status) {
|
Long inferenceGeomUid, Geometry geometry, Properties properties, String status) {
|
||||||
|
|
||||||
|
// inference_geom 테이블에 상태 업데이트
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.set(mapSheetAnalDataInferenceGeomEntity.testStateDttm, ZonedDateTime.now())
|
||||||
|
.set(mapSheetAnalDataInferenceGeomEntity.testState, status)
|
||||||
|
.where(mapSheetAnalDataInferenceGeomEntity.geoUid.eq(inferenceGeomUid))
|
||||||
|
.execute();
|
||||||
|
|
||||||
// inference_geom 테이블 정보 가져오기
|
// inference_geom 테이블 정보 가져오기
|
||||||
MapSheetAnalDataInferenceGeomEntity entity =
|
MapSheetAnalDataInferenceGeomEntity entity =
|
||||||
queryFactory
|
queryFactory
|
||||||
@@ -859,6 +874,16 @@ public class TrainingDataReviewRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateAnalInferenceMngState(Long analUid, String status) {
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetAnalInferenceEntity)
|
||||||
|
.set(mapSheetAnalInferenceEntity.analState, status)
|
||||||
|
.set(mapSheetAnalInferenceEntity.updatedDttm, ZonedDateTime.now())
|
||||||
|
.where(mapSheetAnalInferenceEntity.id.eq(analUid))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
|
||||||
private StringExpression makeCogUrl(NumberPath<Integer> year) {
|
private StringExpression makeCogUrl(NumberPath<Integer> year) {
|
||||||
return new CaseBuilder()
|
return new CaseBuilder()
|
||||||
.when(imageryEntity.year.eq(year))
|
.when(imageryEntity.year.eq(year))
|
||||||
|
|||||||
@@ -53,8 +53,11 @@ public class MapSheetInferenceJobService {
|
|||||||
@Value("${inference.jar-path}")
|
@Value("${inference.jar-path}")
|
||||||
private String jarPath;
|
private String jarPath;
|
||||||
|
|
||||||
/** 추론 진행 배치 1분 */
|
@Value("${file.dataset-dir}")
|
||||||
@Scheduled(fixedDelay = 60_000)
|
private String datasetDir;
|
||||||
|
|
||||||
|
/** 추론 진행 배치 1분 60_000 */
|
||||||
|
@Scheduled(fixedDelay = 30_000)
|
||||||
public void runBatch() {
|
public void runBatch() {
|
||||||
if (isLocalProfile()) {
|
if (isLocalProfile()) {
|
||||||
return;
|
return;
|
||||||
@@ -242,6 +245,10 @@ public class MapSheetInferenceJobService {
|
|||||||
|
|
||||||
// uid 기준 merge shp, geojson 파일 생성
|
// uid 기준 merge shp, geojson 파일 생성
|
||||||
externalJarRunner.run(jarPath, batchId, inferenceId, "");
|
externalJarRunner.run(jarPath, batchId, inferenceId, "");
|
||||||
|
|
||||||
|
// uid 기준 도엽별 shp 파일 geoserver 등록
|
||||||
|
String register = datasetDir + "/" + inferenceId + "/" + "merge" + "/" + inferenceId + ".shp";
|
||||||
|
externalJarRunner.run(jarPath, register, inferenceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -80,8 +80,10 @@ public class TrainingDataReviewJobService {
|
|||||||
|
|
||||||
List<UUID> assignmentUids =
|
List<UUID> assignmentUids =
|
||||||
assignedTasks.stream().map(Tasks::getAssignmentUid).toList();
|
assignedTasks.stream().map(Tasks::getAssignmentUid).toList();
|
||||||
|
|
||||||
trainingDataReviewJobCoreService.assignReviewerBatch(assignmentUids, reviewerId);
|
trainingDataReviewJobCoreService.assignReviewerBatch(assignmentUids, reviewerId);
|
||||||
|
|
||||||
|
List<Long> geomUids = assignedTasks.stream().map(Tasks::getInferenceUid).toList();
|
||||||
|
trainingDataReviewJobCoreService.updateGeomUidTestState(geomUids);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -108,7 +110,7 @@ public class TrainingDataReviewJobService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 라벨러 완료,SKIP 시 호출
|
// 라벨러 완료,SKIP 시 호출 -> 미사용
|
||||||
@Transactional
|
@Transactional
|
||||||
public void assignRealtime(String assignmentUid) {
|
public void assignRealtime(String assignmentUid) {
|
||||||
Tasks task = trainingDataReviewJobCoreService.findAssignmentTask(assignmentUid);
|
Tasks task = trainingDataReviewJobCoreService.findAssignmentTask(assignmentUid);
|
||||||
@@ -127,5 +129,9 @@ public class TrainingDataReviewJobService {
|
|||||||
trainingDataReviewJobCoreService.lockInspectors(analUid, order);
|
trainingDataReviewJobCoreService.lockInspectors(analUid, order);
|
||||||
|
|
||||||
trainingDataReviewJobCoreService.assignReviewer(task.getAssignmentUid(), order.getFirst());
|
trainingDataReviewJobCoreService.assignReviewer(task.getAssignmentUid(), order.getFirst());
|
||||||
|
|
||||||
|
List<Long> geomUids = new ArrayList<>();
|
||||||
|
geomUids.add(task.getInferenceUid());
|
||||||
|
trainingDataReviewJobCoreService.updateGeomUidTestState(geomUids);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -557,7 +557,9 @@ public class TrainingDataReviewApiController {
|
|||||||
trainingDataReviewService.getCogImageUrl(mapSheetNum, beforeYear, afterYear));
|
trainingDataReviewService.getCogImageUrl(mapSheetNum, beforeYear, afterYear));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Hidden
|
@Operation(
|
||||||
|
summary = "검수할당 스케줄링(수동 호출)",
|
||||||
|
description = "스케줄링이 실패한 경우 수동 호출하는 API, 어제 라벨링 완료된 것을 해당 검수자들에게 할당함")
|
||||||
@GetMapping("/run-schedule")
|
@GetMapping("/run-schedule")
|
||||||
public ApiResponseDto<Void> runTrainingReviewSchedule() {
|
public ApiResponseDto<Void> runTrainingReviewSchedule() {
|
||||||
trainingDataReviewJobService.assignReviewerYesterdayLabelComplete();
|
trainingDataReviewJobService.assignReviewerYesterdayLabelComplete();
|
||||||
|
|||||||
@@ -204,6 +204,19 @@ public class TrainingDataLabelDto {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class InferenceIdInfo {
|
||||||
|
|
||||||
|
@Schema(description = "inferenceGeomUid")
|
||||||
|
private Long inferenceGeomUid;
|
||||||
|
|
||||||
|
@Schema(description = "analUid")
|
||||||
|
private Long analUid;
|
||||||
|
}
|
||||||
|
|
||||||
@Schema(name = "LearnDataGeometry", description = "LearnDataGeometry")
|
@Schema(name = "LearnDataGeometry", description = "LearnDataGeometry")
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
|
|||||||
@@ -2,11 +2,13 @@ package com.kamco.cd.kamcoback.trainingdata.service;
|
|||||||
|
|
||||||
import com.kamco.cd.kamcoback.config.api.ApiResponseDto.ApiResponseCode;
|
import com.kamco.cd.kamcoback.config.api.ApiResponseDto.ApiResponseCode;
|
||||||
import com.kamco.cd.kamcoback.config.api.ApiResponseDto.ResponseObj;
|
import com.kamco.cd.kamcoback.config.api.ApiResponseDto.ResponseObj;
|
||||||
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelMngState;
|
||||||
import com.kamco.cd.kamcoback.postgres.core.TrainingDataLabelCoreService;
|
import com.kamco.cd.kamcoback.postgres.core.TrainingDataLabelCoreService;
|
||||||
import com.kamco.cd.kamcoback.scheduler.service.TrainingDataReviewJobService;
|
import com.kamco.cd.kamcoback.scheduler.service.TrainingDataReviewJobService;
|
||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto;
|
||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.DefaultPaging;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.DefaultPaging;
|
||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.DetailRes;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.DetailRes;
|
||||||
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.InferenceIdInfo;
|
||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.LabelFeatureRequest;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.LabelFeatureRequest;
|
||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.LabelingGeometryInfo;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.LabelingGeometryInfo;
|
||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.LabelingListDto;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.LabelingListDto;
|
||||||
@@ -44,8 +46,8 @@ public class TrainingDataLabelService {
|
|||||||
public String saveLabelingFeature(LabelFeatureRequest request) {
|
public String saveLabelingFeature(LabelFeatureRequest request) {
|
||||||
String status = "";
|
String status = "";
|
||||||
String assignmentUid = request.getAssignmentUid();
|
String assignmentUid = request.getAssignmentUid();
|
||||||
Long inferenceGeomUid =
|
InferenceIdInfo info = trainingDataLabelCoreService.findLabelingAssignmentGeoUid(assignmentUid);
|
||||||
trainingDataLabelCoreService.findLabelingAssignmentGeoUid(assignmentUid);
|
Long inferenceGeomUid = info.getInferenceGeomUid();
|
||||||
if (request.getGeometry() == null || request.getGeometry().isEmpty()) {
|
if (request.getGeometry() == null || request.getGeometry().isEmpty()) {
|
||||||
// SKIP 상태만 업데이트
|
// SKIP 상태만 업데이트
|
||||||
status = "SKIP";
|
status = "SKIP";
|
||||||
@@ -58,8 +60,9 @@ public class TrainingDataLabelService {
|
|||||||
inferenceGeomUid, request.getGeometry(), request.getProperties(), status);
|
inferenceGeomUid, request.getGeometry(), request.getProperties(), status);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 라벨링 완료하면 실시간 검수 할당 (1건)
|
// 회차 진행 상태 update
|
||||||
trainingDataReviewJobService.assignRealtime(assignmentUid);
|
trainingDataLabelCoreService.updateAnalInferenceMngState(
|
||||||
|
info.getAnalUid(), LabelMngState.ING.getId());
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ package com.kamco.cd.kamcoback.trainingdata.service;
|
|||||||
|
|
||||||
import com.kamco.cd.kamcoback.config.api.ApiResponseDto.ApiResponseCode;
|
import com.kamco.cd.kamcoback.config.api.ApiResponseDto.ApiResponseCode;
|
||||||
import com.kamco.cd.kamcoback.config.api.ApiResponseDto.ResponseObj;
|
import com.kamco.cd.kamcoback.config.api.ApiResponseDto.ResponseObj;
|
||||||
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelMngState;
|
||||||
import com.kamco.cd.kamcoback.postgres.core.TrainingDataReviewCoreService;
|
import com.kamco.cd.kamcoback.postgres.core.TrainingDataReviewCoreService;
|
||||||
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.InferenceIdInfo;
|
||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto;
|
||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto.DefaultPaging;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto.DefaultPaging;
|
||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto.DetailRes;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto.DetailRes;
|
||||||
@@ -39,7 +41,8 @@ public class TrainingDataReviewService {
|
|||||||
public String saveReviewFeature(GeoFeatureRequest request) {
|
public String saveReviewFeature(GeoFeatureRequest request) {
|
||||||
String status = "";
|
String status = "";
|
||||||
String operatorUid = request.getOperatorUid();
|
String operatorUid = request.getOperatorUid();
|
||||||
Long inferenceGeomUid = trainingDataReviewCoreService.findReviewOperatorGeoUid(operatorUid);
|
InferenceIdInfo info = trainingDataReviewCoreService.findReviewOperatorGeoUid(operatorUid);
|
||||||
|
Long inferenceGeomUid = info.getInferenceGeomUid();
|
||||||
|
|
||||||
if (request.getGeometry() == null || request.getGeometry().isEmpty()) {
|
if (request.getGeometry() == null || request.getGeometry().isEmpty()) {
|
||||||
// EXCEPT 상태만 업데이트
|
// EXCEPT 상태만 업데이트
|
||||||
@@ -52,6 +55,11 @@ public class TrainingDataReviewService {
|
|||||||
trainingDataReviewCoreService.updateReviewPolygonClass(
|
trainingDataReviewCoreService.updateReviewPolygonClass(
|
||||||
inferenceGeomUid, request.getGeometry(), request.getProperties(), status);
|
inferenceGeomUid, request.getGeometry(), request.getProperties(), status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 회차 진행 상태 update
|
||||||
|
trainingDataReviewCoreService.updateAnalInferenceMngState(
|
||||||
|
info.getAnalUid(), LabelMngState.ING.getId());
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user