Compare commits
51 Commits
ee28edd9d0
...
feat/infer
| Author | SHA1 | Date | |
|---|---|---|---|
| e88ffd1260 | |||
| 533d97a573 | |||
| 3237863542 | |||
| 41b227de3f | |||
| 83e02c4498 | |||
| d8804e7c9a | |||
| f326b5f651 | |||
| c1b6061e3e | |||
| 71a8f27afc | |||
| 299d1b09a0 | |||
| 3461376b35 | |||
| 17bd89fafa | |||
| e5fa99daef | |||
| d563f47abd | |||
| cf4f79f7ca | |||
| 6e9b4196b8 | |||
| a4f66f511e | |||
| 9734a5acb2 | |||
| 9fb4a25955 | |||
| 3af05bbeef | |||
| 1c2e41ced6 | |||
| c52c2ab9bd | |||
| eb8d798714 | |||
| 7e95b53881 | |||
| 74b244981b | |||
| 699d39d402 | |||
| e3ae889152 | |||
| 20a835cf45 | |||
| c0b5dd99ef | |||
| 5015a2a437 | |||
| d8d35c3462 | |||
| b77de057f0 | |||
| 2559b225d5 | |||
| 9a00c38cc7 | |||
| e8fa7411d5 | |||
| 71f1f03b89 | |||
| 96d7ea205c | |||
| 0993ce646a | |||
| 302e1ad957 | |||
| e11f365bf8 | |||
| 9dd439b920 | |||
| a42729a475 | |||
| bc5c5b3dd7 | |||
| 60ff43cd3c | |||
| ff7654baa7 | |||
| 21f922a5f4 | |||
| 5ff72f927c | |||
| e6ef4c2525 | |||
| 86e8408f27 | |||
| d4fb11deb2 | |||
| c2b87ca12a |
@@ -0,0 +1,27 @@
|
|||||||
|
package com.kamco.cd.kamcoback.common.enums;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.common.utils.enums.CodeExpose;
|
||||||
|
import com.kamco.cd.kamcoback.common.utils.enums.EnumType;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@CodeExpose
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum CrsType implements EnumType {
|
||||||
|
EPSG_3857("Web Mercator, 웹지도 미터(EPSG:900913 동일)"),
|
||||||
|
EPSG_4326("WGS84 위경도, GeoJSON/OSM 기본"),
|
||||||
|
EPSG_5186("Korea 2000 중부 TM, 한국 SHP");
|
||||||
|
|
||||||
|
private final String desc;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getId() {
|
||||||
|
return name();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getText() {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,11 +5,9 @@ import java.net.InetAddress;
|
|||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
import org.springframework.http.MediaType;
|
|
||||||
|
|
||||||
public class NetUtils {
|
public class NetUtils {
|
||||||
|
|
||||||
@@ -56,9 +54,8 @@ public class NetUtils {
|
|||||||
|
|
||||||
public HttpHeaders jsonHeaders() {
|
public HttpHeaders jsonHeaders() {
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
headers.set(HttpHeaders.ACCEPT, "application/json;charset=UTF-8");
|
||||||
headers.setAccept(List.of(MediaType.APPLICATION_JSON));
|
headers.set(HttpHeaders.CONTENT_TYPE, "application/json;charset=UTF-8");
|
||||||
|
|
||||||
return headers;
|
return headers;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,7 +86,9 @@ public class SecurityConfig {
|
|||||||
"/api/upload/file-chunk-upload",
|
"/api/upload/file-chunk-upload",
|
||||||
"/api/upload/chunk-upload-complete",
|
"/api/upload/chunk-upload-complete",
|
||||||
"/api/change-detection/**",
|
"/api/change-detection/**",
|
||||||
"/api/layer/map/**")
|
"/api/layer/map/**",
|
||||||
|
"/api/layer/tile-url",
|
||||||
|
"/api/layer/tile-url-year")
|
||||||
.permitAll()
|
.permitAll()
|
||||||
// 로그인한 사용자만 가능 IAM
|
// 로그인한 사용자만 가능 IAM
|
||||||
.requestMatchers(
|
.requestMatchers(
|
||||||
|
|||||||
@@ -1,10 +1,14 @@
|
|||||||
package com.kamco.cd.kamcoback.config.resttemplate;
|
package com.kamco.cd.kamcoback.config.resttemplate;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.List;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.http.HttpEntity;
|
import org.springframework.http.HttpEntity;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
import org.springframework.http.HttpMethod;
|
import org.springframework.http.HttpMethod;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.client.HttpStatusCodeException;
|
import org.springframework.web.client.HttpStatusCodeException;
|
||||||
@@ -16,15 +20,93 @@ import org.springframework.web.client.RestTemplate;
|
|||||||
public class ExternalHttpClient {
|
public class ExternalHttpClient {
|
||||||
|
|
||||||
private final RestTemplate restTemplate;
|
private final RestTemplate restTemplate;
|
||||||
private final com.fasterxml.jackson.databind.ObjectMapper objectMapper;
|
private final ObjectMapper objectMapper;
|
||||||
|
|
||||||
public <T> ExternalCallResult<T> call(
|
public <T> ExternalCallResult<T> call(
|
||||||
String url, HttpMethod method, Object body, HttpHeaders headers, Class<T> responseType) {
|
String url, HttpMethod method, Object body, HttpHeaders headers, Class<T> responseType) {
|
||||||
|
|
||||||
if (headers == null) headers = new HttpHeaders();
|
// responseType 기반으로 Accept 동적 세팅
|
||||||
headers.setContentType(org.springframework.http.MediaType.APPLICATION_JSON);
|
HttpHeaders resolvedHeaders = resolveHeaders(headers, responseType);
|
||||||
headers.setAccept(java.util.List.of(org.springframework.http.MediaType.APPLICATION_JSON));
|
logRequestBody(body);
|
||||||
|
|
||||||
|
HttpEntity<Object> entity = new HttpEntity<>(body, resolvedHeaders);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// String: raw bytes -> UTF-8 string
|
||||||
|
if (responseType == String.class) {
|
||||||
|
ResponseEntity<byte[]> res = restTemplate.exchange(url, method, entity, byte[].class);
|
||||||
|
String raw =
|
||||||
|
(res.getBody() == null) ? null : new String(res.getBody(), StandardCharsets.UTF_8);
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
T casted = (T) raw;
|
||||||
|
return new ExternalCallResult<>(res.getStatusCodeValue(), true, casted, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// byte[]: raw bytes로 받고, JSON이면 에러로 처리
|
||||||
|
if (responseType == byte[].class) {
|
||||||
|
ResponseEntity<byte[]> res = restTemplate.exchange(url, method, entity, byte[].class);
|
||||||
|
|
||||||
|
MediaType ct = res.getHeaders().getContentType();
|
||||||
|
byte[] bytes = res.getBody();
|
||||||
|
|
||||||
|
if (isJsonLike(ct)) {
|
||||||
|
String err = (bytes == null) ? null : new String(bytes, StandardCharsets.UTF_8);
|
||||||
|
return new ExternalCallResult<>(res.getStatusCodeValue(), false, null, err);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
T casted = (T) bytes;
|
||||||
|
return new ExternalCallResult<>(res.getStatusCodeValue(), true, casted, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// DTO 등: 일반 역직렬화
|
||||||
|
ResponseEntity<T> res = restTemplate.exchange(url, method, entity, responseType);
|
||||||
|
return new ExternalCallResult<>(res.getStatusCodeValue(), true, res.getBody(), null);
|
||||||
|
|
||||||
|
} catch (HttpStatusCodeException e) {
|
||||||
|
return new ExternalCallResult<>(
|
||||||
|
e.getStatusCode().value(), false, null, e.getResponseBodyAsString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 기존 resolveJsonHeaders를 "동적"으로 교체
|
||||||
|
private HttpHeaders resolveHeaders(HttpHeaders headers, Class<?> responseType) {
|
||||||
|
// 원본 headers를 그대로 쓰면 외부에서 재사용할 때 사이드이펙트 날 수 있어서 복사 권장
|
||||||
|
HttpHeaders h = (headers == null) ? new HttpHeaders() : new HttpHeaders(headers);
|
||||||
|
|
||||||
|
// 요청 바디 기본은 JSON이라고 가정 (필요하면 호출부에서 덮어쓰기)
|
||||||
|
if (h.getContentType() == null) {
|
||||||
|
h.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 호출부에서 Accept를 명시했으면 존중
|
||||||
|
if (h.getAccept() != null && !h.getAccept().isEmpty()) {
|
||||||
|
return h;
|
||||||
|
}
|
||||||
|
|
||||||
|
// responseType 기반 Accept 자동 지정
|
||||||
|
if (responseType == byte[].class) {
|
||||||
|
h.setAccept(
|
||||||
|
List.of(
|
||||||
|
MediaType.APPLICATION_OCTET_STREAM,
|
||||||
|
MediaType.valueOf("application/zip"),
|
||||||
|
MediaType.APPLICATION_JSON // 실패(JSON 에러 바디) 대비
|
||||||
|
));
|
||||||
|
} else {
|
||||||
|
h.setAccept(List.of(MediaType.APPLICATION_JSON));
|
||||||
|
}
|
||||||
|
|
||||||
|
return h;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isJsonLike(MediaType ct) {
|
||||||
|
if (ct == null) return false;
|
||||||
|
return ct.includes(MediaType.APPLICATION_JSON)
|
||||||
|
|| "application/problem+json".equalsIgnoreCase(ct.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void logRequestBody(Object body) {
|
||||||
try {
|
try {
|
||||||
if (body != null) {
|
if (body != null) {
|
||||||
log.info("[HTTP-REQ-BODY-JSON] {}", objectMapper.writeValueAsString(body));
|
log.info("[HTTP-REQ-BODY-JSON] {}", objectMapper.writeValueAsString(body));
|
||||||
@@ -32,16 +114,6 @@ public class ExternalHttpClient {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.warn("[HTTP-REQ-BODY-JSON] serialize failed: {}", e.getMessage());
|
log.warn("[HTTP-REQ-BODY-JSON] serialize failed: {}", e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpEntity<Object> entity = new HttpEntity<>(body, headers);
|
|
||||||
|
|
||||||
try {
|
|
||||||
ResponseEntity<T> res = restTemplate.exchange(url, method, entity, responseType);
|
|
||||||
return new ExternalCallResult<>(res.getStatusCodeValue(), true, res.getBody(), null);
|
|
||||||
} catch (HttpStatusCodeException e) {
|
|
||||||
return new ExternalCallResult<>(
|
|
||||||
e.getStatusCode().value(), false, null, e.getResponseBodyAsString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public record ExternalCallResult<T>(int statusCode, boolean success, T body, String errBody) {}
|
public record ExternalCallResult<T>(int statusCode, boolean success, T body, String errBody) {}
|
||||||
|
|||||||
@@ -18,9 +18,16 @@ public class RestTemplateConfig {
|
|||||||
baseFactory.setConnectTimeout(2000);
|
baseFactory.setConnectTimeout(2000);
|
||||||
baseFactory.setReadTimeout(3000);
|
baseFactory.setReadTimeout(3000);
|
||||||
|
|
||||||
return builder
|
RestTemplate rt =
|
||||||
.requestFactory(() -> new BufferingClientHttpRequestFactory(baseFactory))
|
builder
|
||||||
.additionalInterceptors(new RetryInterceptor())
|
.requestFactory(() -> new BufferingClientHttpRequestFactory(baseFactory))
|
||||||
.build();
|
.additionalInterceptors(new RetryInterceptor())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// byte[] 응답은 무조건 raw로 읽게 강제 (Jackson이 끼어들 여지 제거)
|
||||||
|
rt.getMessageConverters()
|
||||||
|
.add(0, new org.springframework.http.converter.ByteArrayHttpMessageConverter());
|
||||||
|
|
||||||
|
return rt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
package com.kamco.cd.kamcoback.config.resttemplate;
|
package com.kamco.cd.kamcoback.config.resttemplate;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.http.HttpRequest;
|
import org.springframework.http.HttpRequest;
|
||||||
import org.springframework.http.client.ClientHttpRequestExecution;
|
import org.springframework.http.client.ClientHttpRequestExecution;
|
||||||
import org.springframework.http.client.ClientHttpRequestInterceptor;
|
import org.springframework.http.client.ClientHttpRequestInterceptor;
|
||||||
import org.springframework.http.client.ClientHttpResponse;
|
import org.springframework.http.client.ClientHttpResponse;
|
||||||
|
|
||||||
|
@Log4j2
|
||||||
public class RetryInterceptor implements ClientHttpRequestInterceptor {
|
public class RetryInterceptor implements ClientHttpRequestInterceptor {
|
||||||
|
|
||||||
private static final int MAX_RETRY = 3;
|
private static final int MAX_RETRY = 3;
|
||||||
@@ -20,21 +23,25 @@ public class RetryInterceptor implements ClientHttpRequestInterceptor {
|
|||||||
|
|
||||||
for (int attempt = 1; attempt <= MAX_RETRY; attempt++) {
|
for (int attempt = 1; attempt <= MAX_RETRY; attempt++) {
|
||||||
try {
|
try {
|
||||||
// HTTP 응답을 받으면(2xx/4xx/5xx 포함) 그대로 반환
|
log.info("[WIRE-REQ] {} {}", request.getMethod(), request.getURI());
|
||||||
return execution.execute(request, body);
|
log.info("[WIRE-REQ-HEADERS] {}", request.getHeaders());
|
||||||
|
log.info("[WIRE-REQ-BODY] {}", new String(body, StandardCharsets.UTF_8));
|
||||||
|
|
||||||
|
ClientHttpResponse response = execution.execute(request, body);
|
||||||
|
|
||||||
|
log.info("[WIRE-RES-STATUS] {}", response.getStatusCode());
|
||||||
|
return response;
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// 네트워크/타임아웃 등 I/O 예외만 재시도
|
|
||||||
lastException = e;
|
lastException = e;
|
||||||
|
log.error("[WIRE-IO-ERR] attempt={} msg={}", attempt, e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 마지막 시도가 아니면 대기
|
|
||||||
if (attempt < MAX_RETRY) {
|
if (attempt < MAX_RETRY) {
|
||||||
sleep();
|
sleep();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 마지막 예외를 그대로 던져서 원인이 로그에 남게 함
|
|
||||||
throw lastException;
|
throw lastException;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,11 +6,16 @@ import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto;
|
|||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ChnDetectMastReqDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ChnDetectMastReqDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ChngDetectMastSearchDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ChngDetectMastSearchDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ResReturn;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LabelSendDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.DetectMastDto.Basic;
|
import com.kamco.cd.kamcoback.gukyuin.dto.DetectMastDto.Basic;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.DetectMastDto.DetectMastReq;
|
import com.kamco.cd.kamcoback.gukyuin.dto.DetectMastDto.DetectMastReq;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GukYuinLinkableRes;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GukYuinLinkableRes;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.service.GukYuinApiService;
|
import com.kamco.cd.kamcoback.gukyuin.service.GukYuinApiService;
|
||||||
|
import com.kamco.cd.kamcoback.scheduler.service.GukYuinApiLabelJobService;
|
||||||
|
import com.kamco.cd.kamcoback.scheduler.service.GukYuinApiPnuJobService;
|
||||||
|
import com.kamco.cd.kamcoback.scheduler.service.GukYuinApiStatusJobService;
|
||||||
|
import com.kamco.cd.kamcoback.scheduler.service.GukYuinApiStbltJobService;
|
||||||
|
import io.swagger.v3.oas.annotations.Hidden;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.media.Content;
|
import io.swagger.v3.oas.annotations.media.Content;
|
||||||
@@ -19,6 +24,8 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
|||||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@@ -36,6 +43,10 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
public class GukYuinApiController {
|
public class GukYuinApiController {
|
||||||
|
|
||||||
private final GukYuinApiService gukYuinApiService;
|
private final GukYuinApiService gukYuinApiService;
|
||||||
|
private final GukYuinApiPnuJobService gukYuinApiPnuJobService;
|
||||||
|
private final GukYuinApiStatusJobService gukYuinApiStatusJobService;
|
||||||
|
private final GukYuinApiLabelJobService gukYuinApiLabelJobService;
|
||||||
|
private final GukYuinApiStbltJobService gukYuinApiStbltJobService;
|
||||||
|
|
||||||
/** 탐지결과 등록 */
|
/** 탐지결과 등록 */
|
||||||
@Operation(summary = "탐지결과 등록", description = "탐지결과 등록")
|
@Operation(summary = "탐지결과 등록", description = "탐지결과 등록")
|
||||||
@@ -71,7 +82,7 @@ public class GukYuinApiController {
|
|||||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
})
|
})
|
||||||
@PostMapping("/chn/mast/remove")
|
@PostMapping("/chn/mast/remove")
|
||||||
public ApiResponseDto<ResReturn> remove(
|
public ApiResponseDto<ChngDetectMastDto.RemoveResDto> remove(
|
||||||
@RequestBody @Valid ChngDetectMastDto.ChnDetectMastReqDto chnDetectMastReq) {
|
@RequestBody @Valid ChngDetectMastDto.ChnDetectMastReqDto chnDetectMastReq) {
|
||||||
return ApiResponseDto.ok(gukYuinApiService.remove(chnDetectMastReq));
|
return ApiResponseDto.ok(gukYuinApiService.remove(chnDetectMastReq));
|
||||||
}
|
}
|
||||||
@@ -184,6 +195,29 @@ public class GukYuinApiController {
|
|||||||
return ApiResponseDto.ok(gukYuinApiService.findChnContList(chnDtctId, pageIndex, pageSize));
|
return ApiResponseDto.ok(gukYuinApiService.findChnContList(chnDtctId, pageIndex, pageSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "탐지객체 조회 (탐지객체 1건 조회)", description = "탐지객체 조회 (탐지객체 1건 조회)")
|
||||||
|
@GetMapping("/chn/cont/{chnDtctId}/objt/{chnDtctObjtId}")
|
||||||
|
@ApiResponses(
|
||||||
|
value = {
|
||||||
|
@ApiResponse(
|
||||||
|
responseCode = "200",
|
||||||
|
description = "목록 성공",
|
||||||
|
content =
|
||||||
|
@Content(
|
||||||
|
mediaType = "application/json",
|
||||||
|
schema = @Schema(implementation = Basic.class))),
|
||||||
|
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||||
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
|
})
|
||||||
|
public ApiResponseDto<ChngDetectContDto.ResultContDto> findChnPnuToContObject(
|
||||||
|
@PathVariable String chnDtctId,
|
||||||
|
@PathVariable String chnDtctObjtId,
|
||||||
|
@RequestParam(defaultValue = "0") Integer pageIndex,
|
||||||
|
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||||
|
return ApiResponseDto.ok(
|
||||||
|
gukYuinApiService.findChnPnuToContObject(chnDtctId, chnDtctObjtId, pageIndex, pageSize));
|
||||||
|
}
|
||||||
|
|
||||||
@Operation(summary = "탐지객체 조회 (PNU에 해당하는 탐지객체)", description = "탐지객체 조회 (PNU에 해당하는 탐지객체)")
|
@Operation(summary = "탐지객체 조회 (PNU에 해당하는 탐지객체)", description = "탐지객체 조회 (PNU에 해당하는 탐지객체)")
|
||||||
@GetMapping("/chn/cont/{chnDtctId}/pnu/{pnu}")
|
@GetMapping("/chn/cont/{chnDtctId}/pnu/{pnu}")
|
||||||
@ApiResponses(
|
@ApiResponses(
|
||||||
@@ -236,7 +270,7 @@ public class GukYuinApiController {
|
|||||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
})
|
})
|
||||||
@PostMapping("/rlb/objt/{chnDtctObjtId}/lbl/{lblYn}")
|
@PostMapping("/rlb/objt/{chnDtctObjtId}/lbl/{lblYn}")
|
||||||
public ApiResponseDto<ResReturn> updateChnDtctObjtLabelingYn(
|
public ApiResponseDto<ChngDetectContDto.ResultLabelDto> updateChnDtctObjtLabelingYn(
|
||||||
@PathVariable String chnDtctObjtId, @PathVariable String lblYn) {
|
@PathVariable String chnDtctObjtId, @PathVariable String lblYn) {
|
||||||
return ApiResponseDto.ok(gukYuinApiService.updateChnDtctObjtLabelingYn(chnDtctObjtId, lblYn));
|
return ApiResponseDto.ok(gukYuinApiService.updateChnDtctObjtLabelingYn(chnDtctObjtId, lblYn));
|
||||||
}
|
}
|
||||||
@@ -247,6 +281,85 @@ public class GukYuinApiController {
|
|||||||
@Parameter(description = "uuid", example = "7a593d0e-76a8-4b50-8978-9af1fbe871af")
|
@Parameter(description = "uuid", example = "7a593d0e-76a8-4b50-8978-9af1fbe871af")
|
||||||
@PathVariable
|
@PathVariable
|
||||||
UUID uuid) {
|
UUID uuid) {
|
||||||
return ApiResponseDto.ok(gukYuinApiService.connectChnMastRegist(uuid));
|
return ApiResponseDto.okObject(gukYuinApiService.connectChnMastRegist(uuid));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "라벨 전송 완료 리스트", description = "라벨 전송 완료 리스트")
|
||||||
|
@GetMapping("/label/send-list")
|
||||||
|
public ApiResponseDto<List<LabelSendDto>> findLabelingCompleteSendList(
|
||||||
|
@Parameter(description = "어제 날짜", example = "2026-01-29") LocalDate yesterday) {
|
||||||
|
return ApiResponseDto.ok(gukYuinApiService.findLabelingCompleteSendList(yesterday));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "탐지객체 적합여부 조회 (리스트조회)", description = "탐지객체 적합여부 조회 (리스트조회)")
|
||||||
|
@GetMapping("/rlb/dtct/{chnDtctId}")
|
||||||
|
@ApiResponses(
|
||||||
|
value = {
|
||||||
|
@ApiResponse(
|
||||||
|
responseCode = "200",
|
||||||
|
description = "목록 성공",
|
||||||
|
content =
|
||||||
|
@Content(
|
||||||
|
mediaType = "application/json",
|
||||||
|
schema = @Schema(implementation = Basic.class))),
|
||||||
|
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||||
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
|
})
|
||||||
|
public ApiResponseDto<ChngDetectMastDto.RlbDtctDto> findRlbDtctList(
|
||||||
|
@PathVariable String chnDtctId,
|
||||||
|
@Parameter(description = "날짜(기본은 어제 날짜)") @RequestParam(defaultValue = "20260205")
|
||||||
|
String yyyymmdd) {
|
||||||
|
return ApiResponseDto.ok(gukYuinApiService.findRlbDtctList(chnDtctId, yyyymmdd));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "탐지객체 적합여부 조회 (객체별 조회)", description = "탐지객체 적합여부 조회 (객체별 조회)")
|
||||||
|
@GetMapping("/rlb/objt/{chnDtctObjtId}")
|
||||||
|
@ApiResponses(
|
||||||
|
value = {
|
||||||
|
@ApiResponse(
|
||||||
|
responseCode = "200",
|
||||||
|
description = "목록 성공",
|
||||||
|
content =
|
||||||
|
@Content(
|
||||||
|
mediaType = "application/json",
|
||||||
|
schema = @Schema(implementation = Basic.class))),
|
||||||
|
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||||
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
|
})
|
||||||
|
public ApiResponseDto<ChngDetectMastDto.RlbDtctDto> findRlbDtctObject(
|
||||||
|
@PathVariable String chnDtctObjtId) {
|
||||||
|
return ApiResponseDto.ok(gukYuinApiService.findRlbDtctObject(chnDtctObjtId));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Hidden
|
||||||
|
@Operation(summary = "job test pnu", description = "job test pnu")
|
||||||
|
@GetMapping("/job-test/pnu")
|
||||||
|
public ApiResponseDto<Void> findGukYuinContListPnuUpdate() {
|
||||||
|
gukYuinApiPnuJobService.findGukYuinContListPnuUpdate();
|
||||||
|
return ApiResponseDto.ok(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Hidden
|
||||||
|
@Operation(summary = "job test status", description = "job test status")
|
||||||
|
@GetMapping("/job-test/status")
|
||||||
|
public ApiResponseDto<Void> findGukYuinMastCompleteYn() {
|
||||||
|
gukYuinApiStatusJobService.findGukYuinMastCompleteYn();
|
||||||
|
return ApiResponseDto.ok(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Hidden
|
||||||
|
@Operation(summary = "job test label", description = "job test label")
|
||||||
|
@GetMapping("/job-test/label")
|
||||||
|
public ApiResponseDto<Void> findLabelingCompleteSend() {
|
||||||
|
gukYuinApiLabelJobService.findLabelingCompleteSend();
|
||||||
|
return ApiResponseDto.ok(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Hidden
|
||||||
|
@Operation(summary = "job test stblt", description = "job test stblt")
|
||||||
|
@GetMapping("/job-test/stblt")
|
||||||
|
public ApiResponseDto<Void> findGukYuinEligibleForSurvey() {
|
||||||
|
gukYuinApiStbltJobService.findGukYuinEligibleForSurvey();
|
||||||
|
return ApiResponseDto.ok(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,4 +114,27 @@ public class ChngDetectContDto {
|
|||||||
private List<DtoPnuDetectMpng> result;
|
private List<DtoPnuDetectMpng> result;
|
||||||
private Boolean success;
|
private Boolean success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Schema(name = "ResultLabelDto", description = "ResultLabelDto list 리턴 형태")
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class ResultLabelDto {
|
||||||
|
|
||||||
|
private Integer code;
|
||||||
|
private String message;
|
||||||
|
private DtoPnuDetectMpng result;
|
||||||
|
private Boolean success;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class ReqInfo {
|
||||||
|
|
||||||
|
private String reqIp;
|
||||||
|
private String reqEpno;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.kamco.cd.kamcoback.gukyuin.dto;
|
package com.kamco.cd.kamcoback.gukyuin.dto;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@@ -200,4 +201,104 @@ public class ChngDetectMastDto {
|
|||||||
private String uid;
|
private String uid;
|
||||||
private String chnDtctMstId;
|
private String chnDtctMstId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Schema(name = "LabelSendDto", description = "라벨링 전송한 목록")
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class LabelSendDto {
|
||||||
|
|
||||||
|
private String chnDtctObjtId;
|
||||||
|
private String labelerId;
|
||||||
|
private ZonedDateTime labelerWorkDttm;
|
||||||
|
private String reviewerId;
|
||||||
|
private ZonedDateTime reviewerWorkDttm;
|
||||||
|
private ZonedDateTime labelSendDttm;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class ErrorResDto {
|
||||||
|
|
||||||
|
private String timestamp;
|
||||||
|
private Integer status;
|
||||||
|
private String error;
|
||||||
|
private String path;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class RlbDtctDto {
|
||||||
|
|
||||||
|
private Integer code;
|
||||||
|
private String message;
|
||||||
|
private List<RlbDtctMastDto> result;
|
||||||
|
private Boolean success;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class RlbDtctMastDto {
|
||||||
|
|
||||||
|
private String pnuDtctId;
|
||||||
|
private String pnu;
|
||||||
|
private String lrmSyncYmd;
|
||||||
|
private String pnuSyncYmd;
|
||||||
|
private String mpqdNo; // 도엽번호
|
||||||
|
private String cprsYr; // 비교년도
|
||||||
|
private String crtrYr; // 기준년도
|
||||||
|
private String chnDtctSno; // 회차
|
||||||
|
private String chnDtctId;
|
||||||
|
|
||||||
|
private String chnDtctMstId;
|
||||||
|
private String chnDtctObjtId;
|
||||||
|
private String chnDtctContId;
|
||||||
|
private String chnCd;
|
||||||
|
private String chnDtctProb;
|
||||||
|
|
||||||
|
private String bfClsCd; // 이전분류코드
|
||||||
|
private String bfClsProb; // 이전분류정확도
|
||||||
|
private String afClsCd; // 이후분류코드
|
||||||
|
private String afClsProb; // 이후분류정확도
|
||||||
|
|
||||||
|
private String pnuSqms;
|
||||||
|
private String pnuDtctSqms;
|
||||||
|
private String chnDtctSqms;
|
||||||
|
private String stbltYn;
|
||||||
|
private String incyCd;
|
||||||
|
private String incyRsnCont;
|
||||||
|
private String lockYn;
|
||||||
|
private String lblYn;
|
||||||
|
private String chgYn;
|
||||||
|
private String rsatctNo;
|
||||||
|
private String rmk;
|
||||||
|
|
||||||
|
private String crtDt; // 생성일시
|
||||||
|
private String crtEpno; // 생성사원번호
|
||||||
|
private String crtIp; // 생성사원아이피
|
||||||
|
private String chgDt;
|
||||||
|
private String chgEpno;
|
||||||
|
private String chgIp;
|
||||||
|
private String delYn; // 삭제여부
|
||||||
|
}
|
||||||
|
|
||||||
|
@Schema(name = "RemoveResDto", description = "remove 후 리턴 형태")
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class RemoveResDto {
|
||||||
|
|
||||||
|
private Integer code;
|
||||||
|
private String message;
|
||||||
|
private Boolean result;
|
||||||
|
private Boolean success;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,5 +59,19 @@ public class GukYuinDto {
|
|||||||
private Integer stage;
|
private Integer stage;
|
||||||
private String uid;
|
private String uid;
|
||||||
private String applyStatus;
|
private String applyStatus;
|
||||||
|
private Boolean applyYn;
|
||||||
|
|
||||||
|
public Boolean getApplyYn() {
|
||||||
|
return this.applyYn != null && this.applyYn;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class GeomUidDto {
|
||||||
|
|
||||||
|
private Long geoUid;
|
||||||
|
private String resultUid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ public enum GukYuinStatus implements EnumType {
|
|||||||
GUK_COMPLETED("국유인 매핑 완료"),
|
GUK_COMPLETED("국유인 매핑 완료"),
|
||||||
PNU_COMPLETED("PNU 싱크 완료"),
|
PNU_COMPLETED("PNU 싱크 완료"),
|
||||||
PNU_FAILED("PNU 싱크 중 에러"),
|
PNU_FAILED("PNU 싱크 중 에러"),
|
||||||
|
END("종료"),
|
||||||
CANCELED("취소");
|
CANCELED("취소");
|
||||||
|
|
||||||
private final String desc;
|
private final String desc;
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.kamco.cd.kamcoback.gukyuin.service;
|
package com.kamco.cd.kamcoback.gukyuin.service;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.kamco.cd.kamcoback.common.utils.NetUtils;
|
import com.kamco.cd.kamcoback.common.utils.NetUtils;
|
||||||
import com.kamco.cd.kamcoback.common.utils.UserUtil;
|
import com.kamco.cd.kamcoback.common.utils.UserUtil;
|
||||||
import com.kamco.cd.kamcoback.config.api.ApiLogFunction;
|
import com.kamco.cd.kamcoback.config.api.ApiLogFunction;
|
||||||
@@ -9,12 +11,15 @@ import com.kamco.cd.kamcoback.config.resttemplate.ExternalHttpClient;
|
|||||||
import com.kamco.cd.kamcoback.config.resttemplate.ExternalHttpClient.ExternalCallResult;
|
import com.kamco.cd.kamcoback.config.resttemplate.ExternalHttpClient.ExternalCallResult;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.ContBasic;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.ContBasic;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.ReqInfo;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.ResultContDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.ResultContDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.ResultPnuDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.ResultPnuDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ChnDetectMastReqDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ChnDetectMastReqDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ResReturn;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ErrorResDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LabelSendDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ResultDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ResultDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.RlbDtctDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GukYuinLinkFacts;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GukYuinLinkFacts;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GukYuinLinkFailCode;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GukYuinLinkFailCode;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GukYuinLinkableRes;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GukYuinLinkableRes;
|
||||||
@@ -24,6 +29,9 @@ import com.kamco.cd.kamcoback.log.dto.EventType;
|
|||||||
import com.kamco.cd.kamcoback.postgres.core.GukYuinCoreService;
|
import com.kamco.cd.kamcoback.postgres.core.GukYuinCoreService;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.AuditLogEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.AuditLogEntity;
|
||||||
import com.kamco.cd.kamcoback.postgres.repository.log.AuditLogRepository;
|
import com.kamco.cd.kamcoback.postgres.repository.log.AuditLogRepository;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -46,6 +54,8 @@ public class GukYuinApiService {
|
|||||||
|
|
||||||
private final UserUtil userUtil;
|
private final UserUtil userUtil;
|
||||||
private final AuditLogRepository auditLogRepository;
|
private final AuditLogRepository auditLogRepository;
|
||||||
|
private final ObjectMapper objectMapper;
|
||||||
|
private final String myip = netUtils.getLocalIP();
|
||||||
|
|
||||||
@Value("${spring.profiles.active:local}")
|
@Value("${spring.profiles.active:local}")
|
||||||
private String profile;
|
private String profile;
|
||||||
@@ -56,13 +66,15 @@ public class GukYuinApiService {
|
|||||||
@Value("${gukyuin.cdi}")
|
@Value("${gukyuin.cdi}")
|
||||||
private String gukyuinCdiUrl;
|
private String gukyuinCdiUrl;
|
||||||
|
|
||||||
|
@Value("${file.dataset-dir}")
|
||||||
|
private String datasetDir;
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public ChngDetectMastDto.RegistResDto regist(
|
public ChngDetectMastDto.RegistResDto regist(
|
||||||
ChngDetectMastDto.ChnDetectMastReqDto chnDetectMastReq) {
|
ChngDetectMastDto.ChnDetectMastReqDto chnDetectMastReq) {
|
||||||
|
|
||||||
String url = gukyuinCdiUrl + "/chn/mast/regist";
|
String url = gukyuinCdiUrl + "/chn/mast/regist";
|
||||||
|
|
||||||
String myip = netUtils.getLocalIP();
|
|
||||||
chnDetectMastReq.setReqIp(myip);
|
chnDetectMastReq.setReqIp(myip);
|
||||||
chnDetectMastReq.setReqEpno(userUtil.getEmployeeNo());
|
chnDetectMastReq.setReqEpno(userUtil.getEmployeeNo());
|
||||||
|
|
||||||
@@ -75,15 +87,36 @@ public class GukYuinApiService {
|
|||||||
ChngDetectMastDto.RegistResDto.class);
|
ChngDetectMastDto.RegistResDto.class);
|
||||||
|
|
||||||
ChngDetectMastDto.RegistResDto resultBody = result.body();
|
ChngDetectMastDto.RegistResDto resultBody = result.body();
|
||||||
Boolean success = false;
|
boolean success = false;
|
||||||
if (resultBody != null) {
|
if (resultBody != null && resultBody.getSuccess() != null) {
|
||||||
ChngDetectMastDto.Basic registRes = resultBody.getResult();
|
ChngDetectMastDto.Basic registRes = resultBody.getResult();
|
||||||
|
|
||||||
|
success = resultBody.getSuccess();
|
||||||
|
|
||||||
|
// 이미 등록한 경우에는 result가 없음
|
||||||
|
if (resultBody.getResult() == null) {
|
||||||
|
return resultBody;
|
||||||
|
}
|
||||||
|
|
||||||
// 추론 회차에 applyStatus, applyStatusDttm 업데이트
|
// 추론 회차에 applyStatus, applyStatusDttm 업데이트
|
||||||
gukyuinCoreService.updateGukYuinMastRegResult(registRes);
|
gukyuinCoreService.updateGukYuinMastRegResult(registRes);
|
||||||
|
|
||||||
// anal_inference 에도 국유인 반영여부, applyDttm 업데이트
|
// anal_inference 에도 국유인 반영여부, applyDttm 업데이트
|
||||||
gukyuinCoreService.updateAnalInferenceApplyDttm(registRes);
|
gukyuinCoreService.updateAnalInferenceApplyDttm(registRes);
|
||||||
success = resultBody.getSuccess();
|
} else {
|
||||||
|
String errBody = result.errBody();
|
||||||
|
ErrorResDto error = null;
|
||||||
|
try {
|
||||||
|
error = objectMapper.readValue(errBody, ErrorResDto.class);
|
||||||
|
return new ChngDetectMastDto.RegistResDto(error.getStatus(), error.getError(), null, false);
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
log.error("에러 응답 파싱 실패. rawBody={}", errBody, e);
|
||||||
|
return new ChngDetectMastDto.RegistResDto(
|
||||||
|
result.statusCode(), // HTTP status
|
||||||
|
errBody, // 원문 그대로
|
||||||
|
null,
|
||||||
|
false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.insertGukyuinAuditLog(
|
this.insertGukyuinAuditLog(
|
||||||
@@ -93,27 +126,35 @@ public class GukYuinApiService {
|
|||||||
url.replace(gukyuinUrl, ""),
|
url.replace(gukyuinUrl, ""),
|
||||||
chnDetectMastReq,
|
chnDetectMastReq,
|
||||||
success);
|
success);
|
||||||
|
|
||||||
return resultBody;
|
return resultBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public ResReturn remove(ChngDetectMastDto.ChnDetectMastReqDto chnDetectMastReq) {
|
public ChngDetectMastDto.RemoveResDto remove(
|
||||||
|
ChngDetectMastDto.ChnDetectMastReqDto chnDetectMastReq) {
|
||||||
String url = gukyuinCdiUrl + "/chn/mast/remove";
|
String url = gukyuinCdiUrl + "/chn/mast/remove";
|
||||||
|
|
||||||
String myip = netUtils.getLocalIP();
|
|
||||||
chnDetectMastReq.setReqIp(myip);
|
chnDetectMastReq.setReqIp(myip);
|
||||||
chnDetectMastReq.setReqEpno(userUtil.getEmployeeNo());
|
chnDetectMastReq.setReqEpno(userUtil.getEmployeeNo());
|
||||||
|
|
||||||
ExternalCallResult<ChngDetectMastDto.Basic> result =
|
boolean success = false;
|
||||||
|
ExternalCallResult<ChngDetectMastDto.RemoveResDto> result =
|
||||||
externalHttpClient.call(
|
externalHttpClient.call(
|
||||||
url,
|
url,
|
||||||
HttpMethod.POST,
|
HttpMethod.POST,
|
||||||
chnDetectMastReq,
|
chnDetectMastReq,
|
||||||
netUtils.jsonHeaders(),
|
netUtils.jsonHeaders(),
|
||||||
ChngDetectMastDto.Basic.class);
|
ChngDetectMastDto.RemoveResDto.class);
|
||||||
|
|
||||||
ChngDetectMastDto.Basic resultBody = result.body();
|
ChngDetectMastDto.RemoveResDto resultBody = result.body();
|
||||||
gukyuinCoreService.updateGukYuinMastRegRemove(resultBody);
|
if (resultBody != null && resultBody.getSuccess() != null) {
|
||||||
|
|
||||||
|
success = resultBody.getSuccess();
|
||||||
|
if (resultBody.getSuccess()) {
|
||||||
|
gukyuinCoreService.updateGukYuinMastRegRemove(chnDetectMastReq.getChnDtctId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.insertGukyuinAuditLog(
|
this.insertGukyuinAuditLog(
|
||||||
EventType.REMOVE.getId(),
|
EventType.REMOVE.getId(),
|
||||||
@@ -121,14 +162,22 @@ public class GukYuinApiService {
|
|||||||
userUtil.getId(),
|
userUtil.getId(),
|
||||||
url.replace(gukyuinUrl, ""),
|
url.replace(gukyuinUrl, ""),
|
||||||
chnDetectMastReq,
|
chnDetectMastReq,
|
||||||
true); // TODO : successFail 여부
|
success);
|
||||||
return new ResReturn("success", "탐지결과 삭제 되었습니다.");
|
|
||||||
|
return resultBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 등록목록 1개 확인
|
// 등록목록 1개 확인
|
||||||
public ChngDetectMastDto.ResultDto detail(String chnDtctMstId) {
|
public ChngDetectMastDto.ResultDto detail(String chnDtctMstId) {
|
||||||
|
|
||||||
String url = gukyuinCdiUrl + "/chn/mast/list/" + chnDtctMstId;
|
String url =
|
||||||
|
gukyuinCdiUrl
|
||||||
|
+ "/chn/mast/list/"
|
||||||
|
+ chnDtctMstId
|
||||||
|
+ "?reqIp="
|
||||||
|
+ myip
|
||||||
|
+ "&reqEpno="
|
||||||
|
+ userUtil.getEmployeeNo();
|
||||||
|
|
||||||
ExternalCallResult<ChngDetectMastDto.ResultDto> result =
|
ExternalCallResult<ChngDetectMastDto.ResultDto> result =
|
||||||
externalHttpClient.call(
|
externalHttpClient.call(
|
||||||
@@ -147,9 +196,15 @@ public class GukYuinApiService {
|
|||||||
// 등록목록 비교년도,기준년도,차수 조합해서 n개 확인
|
// 등록목록 비교년도,기준년도,차수 조합해서 n개 확인
|
||||||
public ChngDetectMastDto.ResultDto listYearStage(
|
public ChngDetectMastDto.ResultDto listYearStage(
|
||||||
ChngDetectMastDto.ChngDetectMastSearchDto searchDto) {
|
ChngDetectMastDto.ChngDetectMastSearchDto searchDto) {
|
||||||
|
|
||||||
String queryString = netUtils.dtoToQueryString(searchDto, null);
|
String queryString = netUtils.dtoToQueryString(searchDto, null);
|
||||||
String url = gukyuinCdiUrl + "/chn/mast" + queryString;
|
String url =
|
||||||
|
gukyuinCdiUrl
|
||||||
|
+ "/chn/mast"
|
||||||
|
+ queryString
|
||||||
|
+ "&reqIp="
|
||||||
|
+ myip
|
||||||
|
+ "&reqEpno="
|
||||||
|
+ userUtil.getEmployeeNo();
|
||||||
|
|
||||||
ExternalCallResult<ChngDetectMastDto.ResultDto> result =
|
ExternalCallResult<ChngDetectMastDto.ResultDto> result =
|
||||||
externalHttpClient.call(
|
externalHttpClient.call(
|
||||||
@@ -213,7 +268,11 @@ public class GukYuinApiService {
|
|||||||
+ "?pageIndex="
|
+ "?pageIndex="
|
||||||
+ pageIndex
|
+ pageIndex
|
||||||
+ "&pageSize="
|
+ "&pageSize="
|
||||||
+ pageSize;
|
+ pageSize
|
||||||
|
+ "&reqIp="
|
||||||
|
+ myip
|
||||||
|
+ "&reqEpno="
|
||||||
|
+ userUtil.getEmployeeNo();
|
||||||
|
|
||||||
ExternalCallResult<ChngDetectContDto.ResultContDto> result =
|
ExternalCallResult<ChngDetectContDto.ResultContDto> result =
|
||||||
externalHttpClient.call(
|
externalHttpClient.call(
|
||||||
@@ -225,21 +284,11 @@ public class GukYuinApiService {
|
|||||||
|
|
||||||
List<ContBasic> contList = result.body().getResult();
|
List<ContBasic> contList = result.body().getResult();
|
||||||
if (contList == null || contList.isEmpty()) {
|
if (contList == null || contList.isEmpty()) {
|
||||||
return new ResultContDto();
|
return new ResultContDto(
|
||||||
}
|
result.body().getCode(),
|
||||||
|
result.body().getMessage(),
|
||||||
for (ContBasic cont : contList) {
|
result.body().getResult(),
|
||||||
String[] pnuList = cont.getPnuList();
|
result.body().getSuccess());
|
||||||
long pnuCnt = pnuList == null ? 0 : pnuList.length;
|
|
||||||
if (cont.getChnDtctObjtId() != null) {
|
|
||||||
gukyuinCoreService.updateInferenceGeomDataPnuCnt(cont.getChnDtctObjtId(), pnuCnt);
|
|
||||||
|
|
||||||
if (pnuCnt > 0) {
|
|
||||||
Long geoUid =
|
|
||||||
gukyuinCoreService.findMapSheetAnalDataInferenceGeomUid(cont.getChnDtctObjtId());
|
|
||||||
gukyuinCoreService.insertGeoUidPnuData(geoUid, pnuList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.insertGukyuinAuditLog(
|
this.insertGukyuinAuditLog(
|
||||||
@@ -254,7 +303,16 @@ public class GukYuinApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ResultPnuDto findPnuObjMgmtList(String chnDtctId, String chnDtctObjtId) {
|
public ResultPnuDto findPnuObjMgmtList(String chnDtctId, String chnDtctObjtId) {
|
||||||
String url = gukyuinCdiUrl + "/chn/pnu/" + chnDtctId + "/objt/" + chnDtctObjtId;
|
String url =
|
||||||
|
gukyuinCdiUrl
|
||||||
|
+ "/chn/pnu/"
|
||||||
|
+ chnDtctId
|
||||||
|
+ "/objt/"
|
||||||
|
+ chnDtctObjtId
|
||||||
|
+ "?reqIp="
|
||||||
|
+ myip
|
||||||
|
+ "&reqEpno="
|
||||||
|
+ userUtil.getEmployeeNo();
|
||||||
|
|
||||||
ExternalCallResult<ChngDetectContDto.ResultPnuDto> result =
|
ExternalCallResult<ChngDetectContDto.ResultPnuDto> result =
|
||||||
externalHttpClient.call(
|
externalHttpClient.call(
|
||||||
@@ -275,18 +333,21 @@ public class GukYuinApiService {
|
|||||||
return result.body();
|
return result.body();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResReturn updateChnDtctObjtLabelingYn(String chnDtctObjtId, String lblYn) {
|
public ChngDetectContDto.ResultLabelDto updateChnDtctObjtLabelingYn(
|
||||||
|
String chnDtctObjtId, String lblYn) {
|
||||||
String url = gukyuinCdiUrl + "/rlb/objt/" + chnDtctObjtId + "/lbl/" + lblYn;
|
String url = gukyuinCdiUrl + "/rlb/objt/" + chnDtctObjtId + "/lbl/" + lblYn;
|
||||||
|
|
||||||
ExternalCallResult<ChngDetectContDto.ResultPnuDto> result =
|
ReqInfo info = new ReqInfo();
|
||||||
|
info.setReqIp(myip);
|
||||||
|
info.setReqEpno(userUtil.getEmployeeNo());
|
||||||
|
|
||||||
|
ExternalCallResult<ChngDetectContDto.ResultLabelDto> result =
|
||||||
externalHttpClient.call(
|
externalHttpClient.call(
|
||||||
url,
|
url,
|
||||||
HttpMethod.POST,
|
HttpMethod.POST,
|
||||||
null,
|
info,
|
||||||
netUtils.jsonHeaders(),
|
netUtils.jsonHeaders(),
|
||||||
ChngDetectContDto.ResultPnuDto.class);
|
ChngDetectContDto.ResultLabelDto.class);
|
||||||
|
|
||||||
ChngDetectContDto.ResultPnuDto dto = result.body();
|
|
||||||
|
|
||||||
this.insertGukyuinAuditLog(
|
this.insertGukyuinAuditLog(
|
||||||
EventType.MODIFIED.getId(),
|
EventType.MODIFIED.getId(),
|
||||||
@@ -296,11 +357,21 @@ public class GukYuinApiService {
|
|||||||
null,
|
null,
|
||||||
result.body().getSuccess());
|
result.body().getSuccess());
|
||||||
|
|
||||||
return new ResReturn(dto.getCode() > 200000 ? "fail" : "success", dto.getMessage());
|
return result.body();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResultContDto findChnPnuToContList(String chnDtctId, String pnu) {
|
public ResultContDto findChnPnuToContList(String chnDtctId, String pnu) {
|
||||||
String url = gukyuinCdiUrl + "/chn/cont/" + chnDtctId + "/pnu/" + pnu;
|
|
||||||
|
String url =
|
||||||
|
gukyuinCdiUrl
|
||||||
|
+ "/chn/cont/"
|
||||||
|
+ chnDtctId
|
||||||
|
+ "/pnu/"
|
||||||
|
+ pnu
|
||||||
|
+ "?reqIp="
|
||||||
|
+ myip
|
||||||
|
+ "&reqEpno="
|
||||||
|
+ userUtil.getEmployeeNo();
|
||||||
|
|
||||||
ExternalCallResult<ChngDetectContDto.ResultContDto> result =
|
ExternalCallResult<ChngDetectContDto.ResultContDto> result =
|
||||||
externalHttpClient.call(
|
externalHttpClient.call(
|
||||||
@@ -321,7 +392,14 @@ public class GukYuinApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ResultDto listChnDtctId(String chnDtctId) {
|
public ResultDto listChnDtctId(String chnDtctId) {
|
||||||
String url = gukyuinCdiUrl + "/chn/mast/" + chnDtctId;
|
String url =
|
||||||
|
gukyuinCdiUrl
|
||||||
|
+ "/chn/mast/"
|
||||||
|
+ chnDtctId
|
||||||
|
+ "?reqIp="
|
||||||
|
+ myip
|
||||||
|
+ "&reqEpno="
|
||||||
|
+ userUtil.getEmployeeNo();
|
||||||
|
|
||||||
ExternalCallResult<ChngDetectMastDto.ResultDto> result =
|
ExternalCallResult<ChngDetectMastDto.ResultDto> result =
|
||||||
externalHttpClient.call(
|
externalHttpClient.call(
|
||||||
@@ -370,16 +448,24 @@ public class GukYuinApiService {
|
|||||||
public ResponseObj connectChnMastRegist(UUID uuid) {
|
public ResponseObj connectChnMastRegist(UUID uuid) {
|
||||||
// uuid로 추론 회차 조회
|
// uuid로 추론 회차 조회
|
||||||
LearnInfo info = gukyuinCoreService.findMapSheetLearnInfo(uuid);
|
LearnInfo info = gukyuinCoreService.findMapSheetLearnInfo(uuid);
|
||||||
// if (info.getApplyStatus() != null &&
|
if (info.getApplyYn() != null && info.getApplyYn()) {
|
||||||
// !info.getApplyStatus().equals(GukYuinStatus.PENDING.getId()))
|
return new ResponseObj(ApiResponseCode.DUPLICATE_DATA, "이미 국유인 연동을 한 회차입니다.");
|
||||||
// {
|
}
|
||||||
// return new ResponseObj(ApiResponseCode.DUPLICATE_DATA, "이미 국유인 연동을 한 추론 회차입니다.");
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 비교년도,기준년도로 전송한 데이터 있는지 확인 후 회차 번호 생성
|
// 비교년도,기준년도로 전송한 데이터 있는지 확인 후 회차 번호 생성
|
||||||
Integer maxStage =
|
Integer maxStage =
|
||||||
gukyuinCoreService.findMapSheetLearnYearStage(info.getCompareYyyy(), info.getTargetYyyy());
|
gukyuinCoreService.findMapSheetLearnYearStage(info.getCompareYyyy(), info.getTargetYyyy());
|
||||||
|
|
||||||
|
// 1회차를 종료 상태로 처리하고 2회차를 보내야 함
|
||||||
|
// 추론(learn), 학습데이터(inference) 둘 다 종료 처리
|
||||||
|
if (maxStage > 0) {
|
||||||
|
Long learnId =
|
||||||
|
gukyuinCoreService.findMapSheetLearnInfoByYyyy(
|
||||||
|
info.getCompareYyyy(), info.getTargetYyyy(), maxStage);
|
||||||
|
gukyuinCoreService.updateMapSheetLearnGukyuinEndStatus(learnId);
|
||||||
|
gukyuinCoreService.updateMapSheetInferenceLabelEndStatus(learnId);
|
||||||
|
}
|
||||||
|
|
||||||
// reqDto 셋팅
|
// reqDto 셋팅
|
||||||
ChnDetectMastReqDto reqDto = new ChnDetectMastReqDto();
|
ChnDetectMastReqDto reqDto = new ChnDetectMastReqDto();
|
||||||
reqDto.setCprsYr(String.valueOf(info.getCompareYyyy()));
|
reqDto.setCprsYr(String.valueOf(info.getCompareYyyy()));
|
||||||
@@ -388,9 +474,108 @@ public class GukYuinApiService {
|
|||||||
reqDto.setChnDtctId(info.getUid());
|
reqDto.setChnDtctId(info.getUid());
|
||||||
reqDto.setPathNm("/kamco-nfs/dataset/export/" + info.getUid());
|
reqDto.setPathNm("/kamco-nfs/dataset/export/" + info.getUid());
|
||||||
|
|
||||||
// 국유인 /chn/mast/regist 전송
|
if (!Files.isDirectory(Path.of("/kamco-nfs/dataset/export/" + info.getUid()))) {
|
||||||
this.regist(reqDto);
|
return new ResponseObj(
|
||||||
|
ApiResponseCode.NOT_FOUND_DATA, "파일 경로에 회차 실행 파일이 생성되지 않았습니다. 확인 부탁드립니다.");
|
||||||
|
}
|
||||||
|
|
||||||
return new ResponseObj(ApiResponseCode.OK, "");
|
// 국유인 /chn/mast/regist 전송
|
||||||
|
ChngDetectMastDto.RegistResDto result = this.regist(reqDto);
|
||||||
|
if (result.getSuccess()) {
|
||||||
|
return new ResponseObj(ApiResponseCode.OK, "연동되었습니다.");
|
||||||
|
} else {
|
||||||
|
return new ResponseObj(ApiResponseCode.INTERNAL_SERVER_ERROR, result.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<LabelSendDto> findLabelingCompleteSendList(LocalDate yesterday) {
|
||||||
|
return gukyuinCoreService.findLabelingCompleteSendList(yesterday);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResultContDto findChnPnuToContObject(
|
||||||
|
String chnDtctId, String chnDtctObjtId, Integer pageIndex, Integer pageSize) {
|
||||||
|
|
||||||
|
String url =
|
||||||
|
gukyuinCdiUrl
|
||||||
|
+ "/chn/cont/"
|
||||||
|
+ chnDtctId
|
||||||
|
+ "/chnDtctObjtId/"
|
||||||
|
+ chnDtctObjtId
|
||||||
|
+ "?pageIndex="
|
||||||
|
+ pageIndex
|
||||||
|
+ "&pageSize="
|
||||||
|
+ pageSize
|
||||||
|
+ "&reqIp="
|
||||||
|
+ myip
|
||||||
|
+ "&reqEpno="
|
||||||
|
+ userUtil.getEmployeeNo();
|
||||||
|
|
||||||
|
ExternalCallResult<ChngDetectContDto.ResultContDto> result =
|
||||||
|
externalHttpClient.call(
|
||||||
|
url,
|
||||||
|
HttpMethod.GET,
|
||||||
|
null,
|
||||||
|
netUtils.jsonHeaders(),
|
||||||
|
ChngDetectContDto.ResultContDto.class);
|
||||||
|
|
||||||
|
this.insertGukyuinAuditLog(
|
||||||
|
EventType.DETAIL.getId(),
|
||||||
|
netUtils.getLocalIP(),
|
||||||
|
userUtil.getId(),
|
||||||
|
url.replace(gukyuinUrl, ""),
|
||||||
|
null,
|
||||||
|
result.body() != null && result.body().getSuccess());
|
||||||
|
return result.body();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ChngDetectMastDto.RlbDtctDto findRlbDtctList(String chnDtctId, String yyyymmdd) {
|
||||||
|
|
||||||
|
String url =
|
||||||
|
gukyuinCdiUrl
|
||||||
|
+ "/rlb/dtct/"
|
||||||
|
+ chnDtctId
|
||||||
|
+ "?reqIp="
|
||||||
|
+ myip
|
||||||
|
+ "&reqEpno="
|
||||||
|
+ userUtil.getEmployeeNo()
|
||||||
|
+ "&yyyymmdd="
|
||||||
|
+ yyyymmdd;
|
||||||
|
|
||||||
|
ExternalCallResult<ChngDetectMastDto.RlbDtctDto> result =
|
||||||
|
externalHttpClient.call(
|
||||||
|
url, HttpMethod.GET, null, netUtils.jsonHeaders(), ChngDetectMastDto.RlbDtctDto.class);
|
||||||
|
|
||||||
|
this.insertGukyuinAuditLog(
|
||||||
|
EventType.LIST.getId(),
|
||||||
|
netUtils.getLocalIP(),
|
||||||
|
userUtil.getId(),
|
||||||
|
url.replace(gukyuinUrl, ""),
|
||||||
|
null,
|
||||||
|
result.body() != null && result.body().getSuccess());
|
||||||
|
return result.body();
|
||||||
|
}
|
||||||
|
|
||||||
|
public RlbDtctDto findRlbDtctObject(String chnDtctObjtId) {
|
||||||
|
String url =
|
||||||
|
gukyuinCdiUrl
|
||||||
|
+ "/rlb/objt/"
|
||||||
|
+ chnDtctObjtId
|
||||||
|
+ "?reqIp="
|
||||||
|
+ myip
|
||||||
|
+ "&reqEpno="
|
||||||
|
+ userUtil.getEmployeeNo();
|
||||||
|
|
||||||
|
ExternalCallResult<ChngDetectMastDto.RlbDtctDto> result =
|
||||||
|
externalHttpClient.call(
|
||||||
|
url, HttpMethod.GET, null, netUtils.jsonHeaders(), ChngDetectMastDto.RlbDtctDto.class);
|
||||||
|
|
||||||
|
this.insertGukyuinAuditLog(
|
||||||
|
EventType.DETAIL.getId(),
|
||||||
|
netUtils.getLocalIP(),
|
||||||
|
userUtil.getId(),
|
||||||
|
url.replace(gukyuinUrl, ""),
|
||||||
|
null,
|
||||||
|
result.body() != null && result.body().getSuccess());
|
||||||
|
return result.body();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -534,6 +534,10 @@ public class InferenceDetailDto {
|
|||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getApplyYn() {
|
||||||
|
return this.applyYn != null && this.applyYn;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
|
|||||||
@@ -17,6 +17,11 @@ import lombok.Setter;
|
|||||||
|
|
||||||
public class LayerDto {
|
public class LayerDto {
|
||||||
|
|
||||||
|
public enum MapType {
|
||||||
|
CHANGE_MAP,
|
||||||
|
LABELING_MAP
|
||||||
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@@ -103,6 +108,9 @@ public class LayerDto {
|
|||||||
@JsonFormatDttm
|
@JsonFormatDttm
|
||||||
@Schema(description = "등록일시")
|
@Schema(description = "등록일시")
|
||||||
private ZonedDateTime createdDttm;
|
private ZonedDateTime createdDttm;
|
||||||
|
|
||||||
|
@Schema(description = "좌표계")
|
||||||
|
private String crs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -140,6 +148,9 @@ public class LayerDto {
|
|||||||
|
|
||||||
@Schema(description = "zoom max", example = "18")
|
@Schema(description = "zoom max", example = "18")
|
||||||
private Short max;
|
private Short max;
|
||||||
|
|
||||||
|
@Schema(description = "좌표계", example = "EPSG_3857")
|
||||||
|
private String crs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -253,6 +264,9 @@ public class LayerDto {
|
|||||||
@Schema(description = "rawJson")
|
@Schema(description = "rawJson")
|
||||||
private JsonNode rawJson;
|
private JsonNode rawJson;
|
||||||
|
|
||||||
|
@Schema(description = "crs")
|
||||||
|
private String crs;
|
||||||
|
|
||||||
public LayerMapDto(
|
public LayerMapDto(
|
||||||
String layerType,
|
String layerType,
|
||||||
String tag,
|
String tag,
|
||||||
@@ -266,7 +280,8 @@ public class LayerDto {
|
|||||||
Short maxZoom,
|
Short maxZoom,
|
||||||
String bboxGeometry,
|
String bboxGeometry,
|
||||||
UUID uuid,
|
UUID uuid,
|
||||||
String rawJsonString) {
|
String rawJsonString,
|
||||||
|
String crs) {
|
||||||
this.layerType = layerType;
|
this.layerType = layerType;
|
||||||
this.tag = tag;
|
this.tag = tag;
|
||||||
this.sortOrder = sortOrder;
|
this.sortOrder = sortOrder;
|
||||||
@@ -302,6 +317,7 @@ public class LayerDto {
|
|||||||
|
|
||||||
this.rawJson = rawJson;
|
this.rawJson = rawJson;
|
||||||
this.bbox = geoJson;
|
this.bbox = geoJson;
|
||||||
|
this.crs = crs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonProperty("workspace")
|
@JsonProperty("workspace")
|
||||||
@@ -348,6 +364,8 @@ public class LayerDto {
|
|||||||
|
|
||||||
@JsonIgnore private String bboxGeometry;
|
@JsonIgnore private String bboxGeometry;
|
||||||
|
|
||||||
|
private String crs;
|
||||||
|
|
||||||
public TileUrlDto(
|
public TileUrlDto(
|
||||||
Integer mngYyyy,
|
Integer mngYyyy,
|
||||||
String url,
|
String url,
|
||||||
@@ -358,7 +376,8 @@ public class LayerDto {
|
|||||||
BigDecimal maxLat,
|
BigDecimal maxLat,
|
||||||
Short minZoom,
|
Short minZoom,
|
||||||
Short maxZoom,
|
Short maxZoom,
|
||||||
String bboxGeometry) {
|
String bboxGeometry,
|
||||||
|
String crs) {
|
||||||
this.mngYyyy = mngYyyy;
|
this.mngYyyy = mngYyyy;
|
||||||
this.url = url;
|
this.url = url;
|
||||||
this.tag = tag;
|
this.tag = tag;
|
||||||
@@ -382,6 +401,7 @@ public class LayerDto {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.bbox = geoJson;
|
this.bbox = geoJson;
|
||||||
|
this.crs = crs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -402,15 +422,11 @@ public class LayerDto {
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public static class IsMapYn {
|
public static class IsMapYn {
|
||||||
|
|
||||||
@Schema(description = "CHANGE_MAP(변화지도), LABELING_MAP(라벨링지도)", example = "CHANGE_MAP")
|
@Schema(description = "CHANGE_MAP(변화지도), LABELING_MAP(라벨링지도)", example = "CHANGE_MAP")
|
||||||
private String mapType;
|
private String mapType;
|
||||||
|
|
||||||
@Schema(description = "노출여부 true, false", example = "true")
|
@Schema(description = "노출여부 true, false", example = "true")
|
||||||
private Boolean isMapYn;
|
private Boolean isMapYn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum MapType {
|
|
||||||
CHANGE_MAP,
|
|
||||||
LABELING_MAP
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,17 +18,20 @@ public class WmtsLayerInfo {
|
|||||||
|
|
||||||
private List<String> keywords = new ArrayList<>();
|
private List<String> keywords = new ArrayList<>();
|
||||||
private BoundingBox boundingBox;
|
private BoundingBox boundingBox;
|
||||||
|
|
||||||
private List<String> formats = new ArrayList<>();
|
private List<String> formats = new ArrayList<>();
|
||||||
private List<TileMatrixSetLink> tileMatrixSetLinks = new ArrayList<>();
|
private List<TileMatrixSetLink> tileMatrixSetLinks = new ArrayList<>();
|
||||||
private List<ResourceUrl> resourceUrls = new ArrayList<>();
|
private List<ResourceUrl> resourceUrls = new ArrayList<>();
|
||||||
private List<Style> styles = new ArrayList<>();
|
private List<Style> styles = new ArrayList<>();
|
||||||
|
|
||||||
// add (2025-01-30)
|
private List<String> matrixIds = new ArrayList<>(); // 20250130
|
||||||
private List<String> matrixIds = new ArrayList<>();
|
private String workspace; // 20250130
|
||||||
private String workspace;
|
|
||||||
|
|
||||||
/* ===== convenience methods ===== */
|
private List<TileMatric> tileMatrices = new ArrayList<>();
|
||||||
|
|
||||||
|
// (선택) 기존 add 메서드 유지하고 싶으면 남겨도 됨
|
||||||
|
public void addTileMatric(TileMatric tileMatric) {
|
||||||
|
this.tileMatrices.add(tileMatric);
|
||||||
|
}
|
||||||
|
|
||||||
public void addMatrixId(String matrixId) {
|
public void addMatrixId(String matrixId) {
|
||||||
this.matrixIds.add(matrixId);
|
this.matrixIds.add(matrixId);
|
||||||
@@ -86,6 +89,20 @@ public class WmtsLayerInfo {
|
|||||||
private boolean isDefault;
|
private boolean isDefault;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** TileMatrix 정보를 담는 내부 클래스 */
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class TileMatric {
|
||||||
|
private String identifier;
|
||||||
|
private String scaleDenominator;
|
||||||
|
private String topLeftCorner;
|
||||||
|
// private String tileWidth;
|
||||||
|
// private String tileHeight;
|
||||||
|
// private String matrixWidth;
|
||||||
|
// private String matrixHeight;
|
||||||
|
}
|
||||||
|
|
||||||
/** TileMatrixSetLink 정보를 담는 내부 클래스 */
|
/** TileMatrixSetLink 정보를 담는 내부 클래스 */
|
||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import com.kamco.cd.kamcoback.postgres.core.MapLayerCoreService;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -30,6 +31,15 @@ public class LayerService {
|
|||||||
private final WmtsService wmtsService;
|
private final WmtsService wmtsService;
|
||||||
private final WmsService wmsService;
|
private final WmsService wmsService;
|
||||||
|
|
||||||
|
@Value("${layer.geoserver-url}")
|
||||||
|
private String geoserverUrl;
|
||||||
|
|
||||||
|
@Value("${layer.wms-path}")
|
||||||
|
private String wmsPath;
|
||||||
|
|
||||||
|
@Value("${layer.wmts-path}")
|
||||||
|
private String wmtsPath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 지도 레이어 관리 목록
|
* 지도 레이어 관리 목록
|
||||||
*
|
*
|
||||||
@@ -58,7 +68,7 @@ public class LayerService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case GEOJSON -> {
|
case GEOJSON -> {
|
||||||
mapLayerCoreService.saveGeoJson(dto);
|
return mapLayerCoreService.saveGeoJson(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
case WMTS -> {
|
case WMTS -> {
|
||||||
@@ -84,7 +94,6 @@ public class LayerService {
|
|||||||
|
|
||||||
default -> throw new CustomApiException("BAD_REQUEST", HttpStatus.BAD_REQUEST);
|
default -> throw new CustomApiException("BAD_REQUEST", HttpStatus.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -175,7 +184,31 @@ public class LayerService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<LayerMapDto> findLayerMapList(String type) {
|
public List<LayerMapDto> findLayerMapList(String type) {
|
||||||
return mapLayerCoreService.findLayerMapList(type);
|
List<LayerMapDto> layerMapDtoList = mapLayerCoreService.findLayerMapList(type);
|
||||||
|
layerMapDtoList.forEach(
|
||||||
|
dto -> {
|
||||||
|
if (dto.getLayerType().equals("WMS")) {
|
||||||
|
dto.setUrl(
|
||||||
|
String.format(
|
||||||
|
"%s/%s/%s",
|
||||||
|
trimSlash(geoserverUrl), trimSlash(wmsPath), dto.getLayerType().toLowerCase()));
|
||||||
|
} else if (dto.getLayerType().equals("WMTS")) {
|
||||||
|
dto.setUrl(
|
||||||
|
String.format(
|
||||||
|
"%s/%s/%s",
|
||||||
|
trimSlash(geoserverUrl),
|
||||||
|
trimSlash(wmtsPath),
|
||||||
|
dto.getLayerType().toLowerCase()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return layerMapDtoList;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String trimSlash(String s) {
|
||||||
|
if (s == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return s.replaceAll("/+$", "").replaceAll("^/+", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public LayerDto.YearTileDto getChangeDetectionTileUrl(Integer beforeYear, Integer afterYear) {
|
public LayerDto.YearTileDto getChangeDetectionTileUrl(Integer beforeYear, Integer afterYear) {
|
||||||
|
|||||||
@@ -60,9 +60,9 @@ public class WmtsService {
|
|||||||
public List<WmtsLayerInfo> getAllLayers(String geoserverUrl, String workspace) {
|
public List<WmtsLayerInfo> getAllLayers(String geoserverUrl, String workspace) {
|
||||||
List<WmtsLayerInfo> layers = new ArrayList<>();
|
List<WmtsLayerInfo> layers = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
|
// 1. XML 문서 로드 및 파싱
|
||||||
String capabilitiesUrl =
|
String capabilitiesUrl =
|
||||||
geoserverUrl + WMTS_GEOSERVER_URL + workspace + WMTS_CAPABILITIES_URL;
|
geoserverUrl + WMTS_GEOSERVER_URL + workspace + WMTS_CAPABILITIES_URL;
|
||||||
|
|
||||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||||
factory.setNamespaceAware(true);
|
factory.setNamespaceAware(true);
|
||||||
DocumentBuilder builder = factory.newDocumentBuilder();
|
DocumentBuilder builder = factory.newDocumentBuilder();
|
||||||
@@ -71,16 +71,18 @@ public class WmtsService {
|
|||||||
XPathFactory xPathFactory = XPathFactory.newInstance();
|
XPathFactory xPathFactory = XPathFactory.newInstance();
|
||||||
XPath xpath = xPathFactory.newXPath();
|
XPath xpath = xPathFactory.newXPath();
|
||||||
|
|
||||||
|
// 2. 모든 Layer 노드 검색
|
||||||
String expression = "//*[local-name()='Layer']";
|
String expression = "//*[local-name()='Layer']";
|
||||||
NodeList layerNodes =
|
NodeList layerNodes =
|
||||||
(NodeList) xpath.compile(expression).evaluate(doc, XPathConstants.NODESET);
|
(NodeList) xpath.compile(expression).evaluate(doc, XPathConstants.NODESET);
|
||||||
|
|
||||||
|
// 3. 모든 레이어를 파싱하여 리스트에 추가
|
||||||
for (int i = 0; i < layerNodes.getLength(); i++) {
|
for (int i = 0; i < layerNodes.getLength(); i++) {
|
||||||
Node layerNode = layerNodes.item(i);
|
Node layerNode = layerNodes.item(i);
|
||||||
String title = getChildValue(layerNode, "Title");
|
String title = getChildValue(layerNode, "Title");
|
||||||
|
|
||||||
if (title != null && !title.trim().isEmpty()) {
|
if (title != null && !title.trim().isEmpty()) {
|
||||||
WmtsLayerInfo layerInfo = parseLayerNode(workspace, layerNode, title);
|
WmtsLayerInfo layerInfo = parseLayerNode(workspace, doc, layerNode, title);
|
||||||
layers.add(layerInfo);
|
layers.add(layerInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -94,25 +96,28 @@ public class WmtsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WMTS Capabilities URL에서 특정 타이틀의 레이어 정보를 가져옵니다.
|
* WMTS Capabilities URL에서 특정 타이틀의 레이어 정보를 가져옵니다. // * @param capabilitiesUrl 예:
|
||||||
|
* http://localhost:8080/geoserver/gwc/service/wmts?REQUEST=GetCapabilities
|
||||||
*
|
*
|
||||||
* @param geoserverUrl 예: http://localhost:8080
|
* @param geoserverUrl 예: http://localhost:8080
|
||||||
* @param targetTitle 찾고자 하는 레이어의 Title
|
* @param targetTitle 찾고자 하는 레이어의 Title (예: "My Maps")
|
||||||
*/
|
*/
|
||||||
public WmtsLayerInfo getLayerInfoByTitle(
|
public WmtsLayerInfo getLayerInfoByTitle(
|
||||||
String geoserverUrl, String workspace, String targetTitle) {
|
String geoserverUrl, String workspace, String targetTitle) {
|
||||||
try {
|
try {
|
||||||
|
// 1. XML 문서 로드 및 파싱
|
||||||
String capabilitiesUrl =
|
String capabilitiesUrl =
|
||||||
geoserverUrl + WMTS_GEOSERVER_URL + workspace + WMTS_CAPABILITIES_URL;
|
geoserverUrl + WMTS_GEOSERVER_URL + workspace + WMTS_CAPABILITIES_URL;
|
||||||
|
|
||||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||||
factory.setNamespaceAware(true);
|
factory.setNamespaceAware(true); // 네임스페이스 인식
|
||||||
DocumentBuilder builder = factory.newDocumentBuilder();
|
DocumentBuilder builder = factory.newDocumentBuilder();
|
||||||
Document doc = builder.parse(new URL(capabilitiesUrl).openStream());
|
Document doc = builder.parse(new URL(capabilitiesUrl).openStream());
|
||||||
|
|
||||||
XPathFactory xPathFactory = XPathFactory.newInstance();
|
XPathFactory xPathFactory = XPathFactory.newInstance();
|
||||||
XPath xpath = xPathFactory.newXPath();
|
XPath xpath = xPathFactory.newXPath();
|
||||||
|
|
||||||
|
// 2. 모든 Layer 노드 검색 (네임스페이스 무시하고 local-name으로 검색)
|
||||||
|
// GeoServer WMTS에서 Layer는 <Contents> -> <Layer> 구조임
|
||||||
String expression = "//*[local-name()='Layer']";
|
String expression = "//*[local-name()='Layer']";
|
||||||
NodeList layerNodes =
|
NodeList layerNodes =
|
||||||
(NodeList) xpath.compile(expression).evaluate(doc, XPathConstants.NODESET);
|
(NodeList) xpath.compile(expression).evaluate(doc, XPathConstants.NODESET);
|
||||||
@@ -120,9 +125,12 @@ public class WmtsService {
|
|||||||
for (int i = 0; i < layerNodes.getLength(); i++) {
|
for (int i = 0; i < layerNodes.getLength(); i++) {
|
||||||
Node layerNode = layerNodes.item(i);
|
Node layerNode = layerNodes.item(i);
|
||||||
|
|
||||||
|
// 3. Title 확인
|
||||||
String title = getChildValue(layerNode, "Title");
|
String title = getChildValue(layerNode, "Title");
|
||||||
|
|
||||||
|
// 타이틀이 일치하면 객체 매핑 시작
|
||||||
if (title != null && title.trim().equals(targetTitle)) {
|
if (title != null && title.trim().equals(targetTitle)) {
|
||||||
return parseLayerNode(workspace, layerNode, title);
|
return parseLayerNode(workspace, doc, layerNode, title);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,11 +139,12 @@ public class WmtsService {
|
|||||||
throw new RuntimeException("WMTS 정보 조회 중 오류 발생: " + e.getMessage());
|
throw new RuntimeException("WMTS 정보 조회 중 오류 발생: " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null; // 찾지 못한 경우
|
||||||
}
|
}
|
||||||
|
|
||||||
// 레이어 노드를 Java 객체로 변환 (2025-01-30)
|
// 레이어 노드를 Java 객체로 변환 20250130
|
||||||
private WmtsLayerInfo parseLayerNode(String workspace, Node layerNode, String title) {
|
private WmtsLayerInfo parseLayerNode(
|
||||||
|
String workspace, Document doc, Node layerNode, String title) {
|
||||||
WmtsLayerInfo info = new WmtsLayerInfo();
|
WmtsLayerInfo info = new WmtsLayerInfo();
|
||||||
|
|
||||||
info.setWorkspace(workspace); // 20250130
|
info.setWorkspace(workspace); // 20250130
|
||||||
@@ -155,7 +164,7 @@ public class WmtsService {
|
|||||||
// TileMatrixSetLink 파싱 (TileMatrixSet + Zoom Levels)
|
// TileMatrixSetLink 파싱 (TileMatrixSet + Zoom Levels)
|
||||||
info.setTileMatrixSetLinks(parseTileMatrixSetLinks(layerNode));
|
info.setTileMatrixSetLinks(parseTileMatrixSetLinks(layerNode));
|
||||||
|
|
||||||
// TileMatrixSetLimits에서 줌 레벨 추출
|
// TileMatrixSetLimits에서 줌 레벨 추출 (개별 zoom 리스트)
|
||||||
info.setMatrixIds(parseMatrixIds(layerNode)); // 20260130
|
info.setMatrixIds(parseMatrixIds(layerNode)); // 20260130
|
||||||
|
|
||||||
// ResourceURL 파싱
|
// ResourceURL 파싱
|
||||||
@@ -164,46 +173,59 @@ public class WmtsService {
|
|||||||
// Styles 파싱
|
// Styles 파싱
|
||||||
info.setStyles(parseStyles(layerNode));
|
info.setStyles(parseStyles(layerNode));
|
||||||
|
|
||||||
|
// TileMatrixSet의 TileMatrix 정보 파싱
|
||||||
|
List<String> tileMatrixSetNames = new ArrayList<>();
|
||||||
|
if (info.getTileMatrixSetLinks() != null) {
|
||||||
|
for (WmtsLayerInfo.TileMatrixSetLink link : info.getTileMatrixSetLinks()) {
|
||||||
|
tileMatrixSetNames.add(link.getTileMatrixSet());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
info.setTileMatrices(parseTileMatrices(doc, tileMatrixSetNames));
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Helper Methods ---
|
// --- Helper Methods ---
|
||||||
|
|
||||||
private WmtsLayerInfo.BoundingBox parseBoundingBox(Node layerNode) {
|
private WmtsLayerInfo.BoundingBox parseBoundingBox(Node layerNode) {
|
||||||
|
// 보통 <ows:WGS84BoundingBox>를 찾음
|
||||||
Node bboxNode = findChildNode(layerNode, "WGS84BoundingBox");
|
Node bboxNode = findChildNode(layerNode, "WGS84BoundingBox");
|
||||||
if (bboxNode == null) bboxNode = findChildNode(layerNode, "BoundingBox");
|
if (bboxNode == null) bboxNode = findChildNode(layerNode, "BoundingBox");
|
||||||
|
|
||||||
if (bboxNode == null) return null;
|
if (bboxNode != null) {
|
||||||
|
WmtsLayerInfo.BoundingBox bbox = new WmtsLayerInfo.BoundingBox();
|
||||||
|
|
||||||
WmtsLayerInfo.BoundingBox bbox = new WmtsLayerInfo.BoundingBox();
|
// WGS84는 CRS 속성이 없을 수 있음
|
||||||
|
bbox.setCrs(getAttributeValue(bboxNode, "crs"));
|
||||||
|
|
||||||
bbox.setCrs(getAttributeValue(bboxNode, "crs"));
|
String lowerCorner = getChildValue(bboxNode, "LowerCorner");
|
||||||
|
String upperCorner = getChildValue(bboxNode, "UpperCorner");
|
||||||
|
|
||||||
String lowerCorner = getChildValue(bboxNode, "LowerCorner");
|
if (lowerCorner != null) {
|
||||||
String upperCorner = getChildValue(bboxNode, "UpperCorner");
|
String[] coords = lowerCorner.split(" ");
|
||||||
|
bbox.setLowerCornerX(Double.parseDouble(coords[0]));
|
||||||
|
bbox.setLowerCornerY(Double.parseDouble(coords[1]));
|
||||||
|
}
|
||||||
|
|
||||||
if (lowerCorner != null) {
|
if (upperCorner != null) {
|
||||||
String[] coords = lowerCorner.trim().split("\\s+");
|
String[] coords = upperCorner.split(" ");
|
||||||
bbox.setLowerCornerX(Double.parseDouble(coords[0]));
|
bbox.setUpperCornerX(Double.parseDouble(coords[0]));
|
||||||
bbox.setLowerCornerY(Double.parseDouble(coords[1]));
|
bbox.setUpperCornerY(Double.parseDouble(coords[1]));
|
||||||
|
}
|
||||||
|
|
||||||
|
return bbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (upperCorner != null) {
|
return null;
|
||||||
String[] coords = upperCorner.trim().split("\\s+");
|
|
||||||
bbox.setUpperCornerX(Double.parseDouble(coords[0]));
|
|
||||||
bbox.setUpperCornerY(Double.parseDouble(coords[1]));
|
|
||||||
}
|
|
||||||
|
|
||||||
return bbox;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<WmtsLayerInfo.ResourceUrl> parseResourceUrls(Node layerNode) {
|
private List<WmtsLayerInfo.ResourceUrl> parseResourceUrls(Node layerNode) {
|
||||||
List<WmtsLayerInfo.ResourceUrl> list = new ArrayList<>();
|
List<WmtsLayerInfo.ResourceUrl> list = new ArrayList<>();
|
||||||
NodeList children = layerNode.getChildNodes();
|
NodeList children = layerNode.getChildNodes();
|
||||||
|
|
||||||
for (int i = 0; i < children.getLength(); i++) {
|
for (int i = 0; i < children.getLength(); i++) {
|
||||||
Node node = children.item(i);
|
Node node = children.item(i);
|
||||||
if (node.getNodeName().contains("ResourceURL")) {
|
if (node.getNodeName().contains("ResourceURL")) { // local-name check simplification
|
||||||
WmtsLayerInfo.ResourceUrl url = new WmtsLayerInfo.ResourceUrl();
|
WmtsLayerInfo.ResourceUrl url = new WmtsLayerInfo.ResourceUrl();
|
||||||
url.setFormat(getAttributeValue(node, "format"));
|
url.setFormat(getAttributeValue(node, "format"));
|
||||||
url.setResourceType(getAttributeValue(node, "resourceType"));
|
url.setResourceType(getAttributeValue(node, "resourceType"));
|
||||||
@@ -217,7 +239,6 @@ public class WmtsService {
|
|||||||
private List<WmtsLayerInfo.Style> parseStyles(Node layerNode) {
|
private List<WmtsLayerInfo.Style> parseStyles(Node layerNode) {
|
||||||
List<WmtsLayerInfo.Style> styles = new ArrayList<>();
|
List<WmtsLayerInfo.Style> styles = new ArrayList<>();
|
||||||
NodeList children = layerNode.getChildNodes();
|
NodeList children = layerNode.getChildNodes();
|
||||||
|
|
||||||
for (int i = 0; i < children.getLength(); i++) {
|
for (int i = 0; i < children.getLength(); i++) {
|
||||||
Node node = children.item(i);
|
Node node = children.item(i);
|
||||||
if (node.getNodeName().endsWith("Style")) {
|
if (node.getNodeName().endsWith("Style")) {
|
||||||
@@ -231,23 +252,34 @@ public class WmtsService {
|
|||||||
return styles;
|
return styles;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** TileMatrixSetLimits에서 줌 레벨을 추출합니다. 예: "EPSG:4326:0" → "0" */
|
/**
|
||||||
|
* TileMatrixSetLimits에서 줌 레벨을 추출합니다. 예: "EPSG:4326:0" → "0", "EPSG:4326:1" → "1"
|
||||||
|
*
|
||||||
|
* @param layerNode Layer 노드
|
||||||
|
* @return 줌 레벨 문자열 리스트
|
||||||
|
*/
|
||||||
private List<String> parseMatrixIds(Node layerNode) {
|
private List<String> parseMatrixIds(Node layerNode) {
|
||||||
List<String> matrixIds = new ArrayList<>();
|
List<String> matrixIds = new ArrayList<>();
|
||||||
NodeList children = layerNode.getChildNodes();
|
NodeList children = layerNode.getChildNodes();
|
||||||
|
|
||||||
|
// 모든 TileMatrixSetLink 찾기
|
||||||
for (int i = 0; i < children.getLength(); i++) {
|
for (int i = 0; i < children.getLength(); i++) {
|
||||||
Node node = children.item(i);
|
Node node = children.item(i);
|
||||||
if (node.getNodeName().contains("TileMatrixSetLink")) {
|
if (node.getNodeName().contains("TileMatrixSetLink")) {
|
||||||
|
// TileMatrixSetLimits 찾기
|
||||||
Node limitsNode = findChildNode(node, "TileMatrixSetLimits");
|
Node limitsNode = findChildNode(node, "TileMatrixSetLimits");
|
||||||
if (limitsNode != null) {
|
if (limitsNode != null) {
|
||||||
NodeList limitsList = limitsNode.getChildNodes();
|
NodeList limitsList = limitsNode.getChildNodes();
|
||||||
|
// 각 TileMatrixLimits 처리
|
||||||
for (int j = 0; j < limitsList.getLength(); j++) {
|
for (int j = 0; j < limitsList.getLength(); j++) {
|
||||||
Node limitNode = limitsList.item(j);
|
Node limitNode = limitsList.item(j);
|
||||||
if (limitNode.getNodeName().contains("TileMatrixLimits")) {
|
if (limitNode.getNodeName().contains("TileMatrixLimits")) {
|
||||||
|
// TileMatrix 또는 Identifier 값 추출
|
||||||
String identifier = getChildValue(limitNode, "TileMatrix");
|
String identifier = getChildValue(limitNode, "TileMatrix");
|
||||||
if (identifier == null) identifier = getChildValue(limitNode, "Identifier");
|
if (identifier == null) {
|
||||||
|
identifier = getChildValue(limitNode, "Identifier");
|
||||||
|
}
|
||||||
|
// 마지막 콜론 이후 값(줌 레벨) 추출
|
||||||
if (identifier != null && identifier.contains(":")) {
|
if (identifier != null && identifier.contains(":")) {
|
||||||
String[] parts = identifier.split(":");
|
String[] parts = identifier.split(":");
|
||||||
String zoomLevel = parts[parts.length - 1];
|
String zoomLevel = parts[parts.length - 1];
|
||||||
@@ -262,16 +294,25 @@ public class WmtsService {
|
|||||||
return matrixIds;
|
return matrixIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TileMatrixSetLink 정보를 파싱합니다. 각 TileMatrixSetLink에서 TileMatrixSet 이름과 줌 레벨들을 추출합니다.
|
||||||
|
*
|
||||||
|
* @param layerNode Layer 노드
|
||||||
|
* @return TileMatrixSetLink 객체 리스트
|
||||||
|
*/
|
||||||
private List<WmtsLayerInfo.TileMatrixSetLink> parseTileMatrixSetLinks(Node layerNode) {
|
private List<WmtsLayerInfo.TileMatrixSetLink> parseTileMatrixSetLinks(Node layerNode) {
|
||||||
List<WmtsLayerInfo.TileMatrixSetLink> links = new ArrayList<>();
|
List<WmtsLayerInfo.TileMatrixSetLink> links = new ArrayList<>();
|
||||||
NodeList children = layerNode.getChildNodes();
|
NodeList children = layerNode.getChildNodes();
|
||||||
|
|
||||||
|
// 모든 TileMatrixSetLink 찾기
|
||||||
for (int i = 0; i < children.getLength(); i++) {
|
for (int i = 0; i < children.getLength(); i++) {
|
||||||
Node node = children.item(i);
|
Node node = children.item(i);
|
||||||
if (node.getNodeName().contains("TileMatrixSetLink")) {
|
if (node.getNodeName().contains("TileMatrixSetLink")) {
|
||||||
|
|
||||||
|
// TileMatrixSet 이름 추출
|
||||||
String tileMatrixSet = getChildValue(node, "TileMatrixSet");
|
String tileMatrixSet = getChildValue(node, "TileMatrixSet");
|
||||||
|
|
||||||
|
// 줌 레벨들 추출
|
||||||
List<String> zoomLevels = new ArrayList<>();
|
List<String> zoomLevels = new ArrayList<>();
|
||||||
Node limitsNode = findChildNode(node, "TileMatrixSetLimits");
|
Node limitsNode = findChildNode(node, "TileMatrixSetLimits");
|
||||||
if (limitsNode != null) {
|
if (limitsNode != null) {
|
||||||
@@ -279,9 +320,12 @@ public class WmtsService {
|
|||||||
for (int j = 0; j < limitsList.getLength(); j++) {
|
for (int j = 0; j < limitsList.getLength(); j++) {
|
||||||
Node limitNode = limitsList.item(j);
|
Node limitNode = limitsList.item(j);
|
||||||
if (limitNode.getNodeName().contains("TileMatrixLimits")) {
|
if (limitNode.getNodeName().contains("TileMatrixLimits")) {
|
||||||
|
// TileMatrix 또는 Identifier 값 추출
|
||||||
String identifier = getChildValue(limitNode, "TileMatrix");
|
String identifier = getChildValue(limitNode, "TileMatrix");
|
||||||
if (identifier == null) identifier = getChildValue(limitNode, "Identifier");
|
if (identifier == null) {
|
||||||
|
identifier = getChildValue(limitNode, "Identifier");
|
||||||
|
}
|
||||||
|
// 마지막 콜론 이후 값(줌 레벨) 추출
|
||||||
if (identifier != null && identifier.contains(":")) {
|
if (identifier != null && identifier.contains(":")) {
|
||||||
String[] parts = identifier.split(":");
|
String[] parts = identifier.split(":");
|
||||||
String zoomLevel = parts[parts.length - 1];
|
String zoomLevel = parts[parts.length - 1];
|
||||||
@@ -291,6 +335,7 @@ public class WmtsService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TileMatrixSetLink 객체 생성 및 추가
|
||||||
if (tileMatrixSet != null) {
|
if (tileMatrixSet != null) {
|
||||||
WmtsLayerInfo.TileMatrixSetLink link =
|
WmtsLayerInfo.TileMatrixSetLink link =
|
||||||
new WmtsLayerInfo.TileMatrixSetLink(tileMatrixSet, zoomLevels);
|
new WmtsLayerInfo.TileMatrixSetLink(tileMatrixSet, zoomLevels);
|
||||||
@@ -302,15 +347,76 @@ public class WmtsService {
|
|||||||
return links;
|
return links;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Document에서 TileMatrixSet의 TileMatrix 정보를 파싱합니다.
|
||||||
|
*
|
||||||
|
* @param doc WMTS Capabilities Document
|
||||||
|
* @param tileMatrixSetNames 조회할 TileMatrixSet 이름 리스트
|
||||||
|
* @return TileMatric 객체 리스트
|
||||||
|
*/
|
||||||
|
private List<WmtsLayerInfo.TileMatric> parseTileMatrices(
|
||||||
|
Document doc, List<String> tileMatrixSetNames) {
|
||||||
|
List<WmtsLayerInfo.TileMatric> allMatrices = new ArrayList<>();
|
||||||
|
|
||||||
|
try {
|
||||||
|
XPathFactory xPathFactory = XPathFactory.newInstance();
|
||||||
|
XPath xpath = xPathFactory.newXPath();
|
||||||
|
|
||||||
|
// 각 TileMatrixSet 이름에 대해 TileMatrix 찾기
|
||||||
|
for (String tileMatrixSetName : tileMatrixSetNames) {
|
||||||
|
// TileMatrixSet 찾기
|
||||||
|
String expression = "//*[local-name()='TileMatrixSet']";
|
||||||
|
NodeList tileMatrixSetNodes =
|
||||||
|
(NodeList) xpath.compile(expression).evaluate(doc, XPathConstants.NODESET);
|
||||||
|
|
||||||
|
for (int i = 0; i < tileMatrixSetNodes.getLength(); i++) {
|
||||||
|
Node tileMatrixSetNode = tileMatrixSetNodes.item(i);
|
||||||
|
String identifier = getChildValue(tileMatrixSetNode, "Identifier");
|
||||||
|
|
||||||
|
// 일치하는 TileMatrixSet 찾으면 TileMatrix 파싱
|
||||||
|
if (tileMatrixSetName.equals(identifier)) {
|
||||||
|
NodeList children = tileMatrixSetNode.getChildNodes();
|
||||||
|
for (int j = 0; j < children.getLength(); j++) {
|
||||||
|
Node node = children.item(j);
|
||||||
|
if (node.getNodeName().contains("TileMatrix")) {
|
||||||
|
WmtsLayerInfo.TileMatric tileMatric = new WmtsLayerInfo.TileMatric();
|
||||||
|
|
||||||
|
// TileMatrix 정보 추출
|
||||||
|
tileMatric.setScaleDenominator(getChildValue(node, "ScaleDenominator"));
|
||||||
|
tileMatric.setTopLeftCorner(getChildValue(node, "TopLeftCorner"));
|
||||||
|
tileMatric.setIdentifier(getChildValue(node, "Identifier"));
|
||||||
|
|
||||||
|
/* 미사용 정보 주석처리함
|
||||||
|
tileMatric.setTileWidth(getChildValue(node, "TileWidth"));
|
||||||
|
tileMatric.setTileHeight(getChildValue(node, "TileHeight"));
|
||||||
|
tileMatric.setMatrixWidth(getChildValue(node, "MatrixWidth"));
|
||||||
|
tileMatric.setMatrixHeight(getChildValue(node, "MatrixHeight"));
|
||||||
|
*/
|
||||||
|
|
||||||
|
allMatrices.add(tileMatric);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break; // 일치하는 TileMatrixSet 찾았으므로 다음으로
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return allMatrices;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 특정 노드 아래의 자식 태그 값 추출 (예: <Title>값)
|
||||||
private String getChildValue(Node parent, String childName) {
|
private String getChildValue(Node parent, String childName) {
|
||||||
Node child = findChildNode(parent, childName);
|
Node child = findChildNode(parent, childName);
|
||||||
return (child != null) ? child.getTextContent() : null;
|
return (child != null) ? child.getTextContent() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 특정 노드 아래의 반복되는 자식 구조 값 추출 (예: Keywords -> Keyword)
|
||||||
private List<String> getChildValues(Node parent, String wrapperName, String childName) {
|
private List<String> getChildValues(Node parent, String wrapperName, String childName) {
|
||||||
List<String> results = new ArrayList<>();
|
List<String> results = new ArrayList<>();
|
||||||
Node wrapper = findChildNode(parent, wrapperName);
|
Node wrapper = findChildNode(parent, wrapperName);
|
||||||
|
|
||||||
if (wrapper != null) {
|
if (wrapper != null) {
|
||||||
NodeList children = wrapper.getChildNodes();
|
NodeList children = wrapper.getChildNodes();
|
||||||
for (int i = 0; i < children.getLength(); i++) {
|
for (int i = 0; i < children.getLength(); i++) {
|
||||||
@@ -323,10 +429,10 @@ public class WmtsService {
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Wrapper 없이 바로 반복되는 값 추출 (예: Format)
|
||||||
private List<String> getChildValuesDirect(Node parent, String childName) {
|
private List<String> getChildValuesDirect(Node parent, String childName) {
|
||||||
List<String> results = new ArrayList<>();
|
List<String> results = new ArrayList<>();
|
||||||
NodeList children = parent.getChildNodes();
|
NodeList children = parent.getChildNodes();
|
||||||
|
|
||||||
for (int i = 0; i < children.getLength(); i++) {
|
for (int i = 0; i < children.getLength(); i++) {
|
||||||
Node node = children.item(i);
|
Node node = children.item(i);
|
||||||
if (node.getNodeName().endsWith(childName)) {
|
if (node.getNodeName().endsWith(childName)) {
|
||||||
@@ -336,10 +442,12 @@ public class WmtsService {
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 이름으로 자식 노드 찾기 (Local Name 기준)
|
||||||
private Node findChildNode(Node parent, String localName) {
|
private Node findChildNode(Node parent, String localName) {
|
||||||
NodeList children = parent.getChildNodes();
|
NodeList children = parent.getChildNodes();
|
||||||
for (int i = 0; i < children.getLength(); i++) {
|
for (int i = 0; i < children.getLength(); i++) {
|
||||||
Node node = children.item(i);
|
Node node = children.item(i);
|
||||||
|
// 네임스페이스 접두사(ows:, wmts:)를 무시하고 태그 이름 확인
|
||||||
if (node.getNodeName().endsWith(":" + localName) || node.getNodeName().equals(localName)) {
|
if (node.getNodeName().endsWith(":" + localName) || node.getNodeName().equals(localName)) {
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,6 +103,9 @@ public class MapSheetMngDto {
|
|||||||
@Schema(description = "tag")
|
@Schema(description = "tag")
|
||||||
private String tag;
|
private String tag;
|
||||||
|
|
||||||
|
@Schema(description = "crs 좌표계")
|
||||||
|
private String crs;
|
||||||
|
|
||||||
@JsonIgnore private Long createdUid;
|
@JsonIgnore private Long createdUid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,11 +184,14 @@ public class MapSheetMngDto {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public long getSyncErrorTotCnt() {
|
public long getSyncErrorTotCnt() {
|
||||||
return this.syncNotPaireCnt + this.syncDuplicateCnt + this.syncFaultCnt;
|
return this.syncNotPaireCnt + this.syncDuplicateCnt + this.syncFaultCnt + this.syncNoFileCnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getSyncErrorExecTotCnt() {
|
public long getSyncErrorExecTotCnt() {
|
||||||
return this.syncNotPaireExecCnt + this.syncDuplicateExecCnt + this.syncFaultExecCnt;
|
return this.syncNotPaireExecCnt
|
||||||
|
+ this.syncDuplicateExecCnt
|
||||||
|
+ this.syncFaultExecCnt
|
||||||
|
+ this.syncNoFileExecCnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMngState() {
|
public String getMngState() {
|
||||||
|
|||||||
@@ -111,8 +111,8 @@ public class MembersDto {
|
|||||||
@EnumValid(enumClass = RoleType.class, message = "userRole은 ADMIN, LABELER, REVIEWER 만 가능합니다.")
|
@EnumValid(enumClass = RoleType.class, message = "userRole은 ADMIN, LABELER, REVIEWER 만 가능합니다.")
|
||||||
private String userRole;
|
private String userRole;
|
||||||
|
|
||||||
@Schema(description = "사번", example = "K20251212001")
|
@Schema(description = "사번", example = "123456")
|
||||||
@Size(max = 50)
|
@Size(max = 6)
|
||||||
private String employeeNo;
|
private String employeeNo;
|
||||||
|
|
||||||
@Schema(description = "이름", example = "홍길동")
|
@Schema(description = "이름", example = "홍길동")
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import lombok.ToString;
|
|||||||
@ToString(exclude = "password")
|
@ToString(exclude = "password")
|
||||||
public class SignInRequest {
|
public class SignInRequest {
|
||||||
|
|
||||||
@Schema(description = "사용자 ID", example = "1234567")
|
@Schema(description = "사용자 ID", example = "123456")
|
||||||
private String username;
|
private String username;
|
||||||
|
|
||||||
@Schema(description = "비밀번호", example = "qwe123!@#")
|
@Schema(description = "비밀번호", example = "qwe123!@#")
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.core;
|
package com.kamco.cd.kamcoback.postgres.core;
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.Basic;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.Basic;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LabelSendDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GukYuinLinkFacts;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GukYuinLinkFacts;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.LearnInfo;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.LearnInfo;
|
||||||
import com.kamco.cd.kamcoback.postgres.repository.Inference.MapSheetLearnRepository;
|
import com.kamco.cd.kamcoback.postgres.repository.Inference.MapSheetLearnRepository;
|
||||||
import com.kamco.cd.kamcoback.postgres.repository.gukyuin.GukYuinRepository;
|
import com.kamco.cd.kamcoback.postgres.repository.gukyuin.GukYuinRepository;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -30,8 +33,8 @@ public class GukYuinCoreService {
|
|||||||
gukYuinRepository.updateGukYuinMastRegResult(resultBody);
|
gukYuinRepository.updateGukYuinMastRegResult(resultBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateGukYuinMastRegRemove(Basic resultBody) {
|
public void updateGukYuinMastRegRemove(String chnDtctId) {
|
||||||
gukYuinRepository.updateGukYuinMastRegRemove(resultBody);
|
gukYuinRepository.updateGukYuinMastRegRemove(chnDtctId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateInferenceGeomDataPnuCnt(String chnDtctObjtId, long pnuCnt) {
|
public void updateInferenceGeomDataPnuCnt(String chnDtctObjtId, long pnuCnt) {
|
||||||
@@ -42,8 +45,8 @@ public class GukYuinCoreService {
|
|||||||
return gukYuinRepository.findMapSheetAnalDataInferenceGeomUid(chnDtctObjtId);
|
return gukYuinRepository.findMapSheetAnalDataInferenceGeomUid(chnDtctObjtId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void insertGeoUidPnuData(Long geoUid, String[] pnuList) {
|
public void insertGeoUidPnuData(Long geoUid, String[] pnuList, String chnDtctObjtId) {
|
||||||
gukYuinRepository.insertGeoUidPnuData(geoUid, pnuList);
|
gukYuinRepository.insertGeoUidPnuData(geoUid, pnuList, chnDtctObjtId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LearnInfo findMapSheetLearnInfo(UUID uuid) {
|
public LearnInfo findMapSheetLearnInfo(UUID uuid) {
|
||||||
@@ -57,4 +60,21 @@ public class GukYuinCoreService {
|
|||||||
public void updateAnalInferenceApplyDttm(Basic registRes) {
|
public void updateAnalInferenceApplyDttm(Basic registRes) {
|
||||||
gukYuinRepository.updateAnalInferenceApplyDttm(registRes);
|
gukYuinRepository.updateAnalInferenceApplyDttm(registRes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<LabelSendDto> findLabelingCompleteSendList(LocalDate yesterday) {
|
||||||
|
return gukYuinRepository.findLabelingCompleteSendList(yesterday);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long findMapSheetLearnInfoByYyyy(
|
||||||
|
Integer compareYyyy, Integer targetYyyy, Integer maxStage) {
|
||||||
|
return gukYuinRepository.findMapSheetLearnInfoByYyyy(compareYyyy, targetYyyy, maxStage);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateMapSheetLearnGukyuinEndStatus(Long learnId) {
|
||||||
|
gukYuinRepository.updateMapSheetLearnGukyuinEndStatus(learnId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateMapSheetInferenceLabelEndStatus(Long learnId) {
|
||||||
|
gukYuinRepository.updateMapSheetInferenceLabelEndStatus(learnId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
|||||||
import com.kamco.cd.kamcoback.postgres.repository.gukyuin.GukYuinRepository;
|
import com.kamco.cd.kamcoback.postgres.repository.gukyuin.GukYuinRepository;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class GukYuinJobCoreService {
|
public class GukYuinJobCoreService {
|
||||||
@@ -15,15 +16,12 @@ public class GukYuinJobCoreService {
|
|||||||
this.gukYuinRepository = gukYuinRepository;
|
this.gukYuinRepository = gukYuinRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
public void updateGukYuinApplyStateComplete(Long id, GukYuinStatus status) {
|
public void updateGukYuinApplyStateComplete(Long id, GukYuinStatus status) {
|
||||||
gukYuinRepository.updateGukYuinApplyStateComplete(id, status);
|
gukYuinRepository.updateGukYuinApplyStateComplete(id, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<LearnKeyDto> findGukyuinApplyStatusUidList(GukYuinStatus gukYuinStatus) {
|
public List<LearnKeyDto> findGukyuinApplyStatusUidList(List<String> gukYuinStatus) {
|
||||||
return gukYuinRepository.findGukyuinApplyStatusUidList(gukYuinStatus);
|
return gukYuinRepository.findGukyuinApplyStatusUidList(gukYuinStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void upsertMapSheetDataAnalGeomPnu(String chnDtctObjtId, String[] pnuList) {
|
|
||||||
gukYuinRepository.upsertMapSheetDataAnalGeomPnu(chnDtctObjtId, pnuList);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.core;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GeomUidDto;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.repository.gukyuin.GukYuinLabelJobRepository;
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class GukYuinLabelJobCoreService {
|
||||||
|
|
||||||
|
private final GukYuinLabelJobRepository gukYuinLabelRepository;
|
||||||
|
|
||||||
|
public GukYuinLabelJobCoreService(GukYuinLabelJobRepository gukYuinLabelRepository) {
|
||||||
|
this.gukYuinLabelRepository = gukYuinLabelRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<GeomUidDto> findYesterdayLabelingCompleteList() {
|
||||||
|
return gukYuinLabelRepository.findYesterdayLabelingCompleteList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void updateAnalDataInferenceGeomSendDttm(Long geoUid) {
|
||||||
|
gukYuinLabelRepository.updateAnalDataInferenceGeomSendDttm(geoUid);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.core;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.repository.gukyuin.GukYuinPnuJobRepository;
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class GukYuinPnuJobCoreService {
|
||||||
|
|
||||||
|
private final GukYuinPnuJobRepository gukYuinPnuRepository;
|
||||||
|
|
||||||
|
public GukYuinPnuJobCoreService(GukYuinPnuJobRepository gukYuinPnuRepository) {
|
||||||
|
this.gukYuinPnuRepository = gukYuinPnuRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateGukYuinApplyStateComplete(Long id, GukYuinStatus status) {
|
||||||
|
gukYuinPnuRepository.updateGukYuinApplyStateComplete(id, status);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<LearnKeyDto> findGukyuinApplyStatusUidList(List<String> gukYuinStatus) {
|
||||||
|
return gukYuinPnuRepository.findGukyuinApplyStatusUidList(gukYuinStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long upsertMapSheetDataAnalGeomPnu(String chnDtctObjtId, String[] pnuList) {
|
||||||
|
return gukYuinPnuRepository.upsertMapSheetDataAnalGeomPnu(chnDtctObjtId, pnuList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void updateInferenceGeomDataPnuCnt(String chnDtctObjtId, long pnuCnt) {
|
||||||
|
gukYuinPnuRepository.updateInferenceGeomDataPnuCnt(chnDtctObjtId, pnuCnt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long findMapSheetAnalDataInferenceGeomUid(String chnDtctObjtId) {
|
||||||
|
return gukYuinPnuRepository.findMapSheetAnalDataInferenceGeomUid(chnDtctObjtId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void insertGeoUidPnuData(Long geoUid, String[] pnuList, String chnDtctObjtId) {
|
||||||
|
gukYuinPnuRepository.insertGeoUidPnuData(geoUid, pnuList, chnDtctObjtId);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.core;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.RlbDtctMastDto;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.PnuEntity;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.repository.gukyuin.GukYuinStbltJobRepository;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class GukYuinStbltJobCoreService {
|
||||||
|
|
||||||
|
private final GukYuinStbltJobRepository gukYuinStbltRepository;
|
||||||
|
|
||||||
|
public GukYuinStbltJobCoreService(GukYuinStbltJobRepository gukYuinStbltRepository) {
|
||||||
|
this.gukYuinStbltRepository = gukYuinStbltRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<LearnKeyDto> findGukYuinEligibleForSurveyList(String status) {
|
||||||
|
return gukYuinStbltRepository.findGukYuinEligibleForSurveyList(status);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void updateGukYuinEligibleForSurvey(String resultUid, RlbDtctMastDto stbltDto) {
|
||||||
|
String chnDtctObjtId = "";
|
||||||
|
PnuEntity entity =
|
||||||
|
gukYuinStbltRepository.findPnuEntityByResultUid(resultUid, stbltDto.getPnu());
|
||||||
|
|
||||||
|
if (entity != null) {
|
||||||
|
chnDtctObjtId = resultUid;
|
||||||
|
|
||||||
|
entity.setPnuDtctId(stbltDto.getPnuDtctId());
|
||||||
|
entity.setPnu(stbltDto.getPnu());
|
||||||
|
entity.setLrmSyncYmd(stbltDto.getLrmSyncYmd());
|
||||||
|
entity.setPnuSyncYmd(stbltDto.getPnuSyncYmd());
|
||||||
|
entity.setMpqdNo(stbltDto.getMpqdNo());
|
||||||
|
entity.setCprsYr(stbltDto.getCprsYr());
|
||||||
|
entity.setCrtrYr(stbltDto.getCrtrYr());
|
||||||
|
entity.setChnDtctSno(stbltDto.getChnDtctSno());
|
||||||
|
entity.setChnDtctId(stbltDto.getChnDtctId());
|
||||||
|
entity.setChnDtctMstId(stbltDto.getChnDtctMstId());
|
||||||
|
entity.setChnDtctObjtId(stbltDto.getChnDtctObjtId());
|
||||||
|
entity.setChnDtctContId(stbltDto.getChnDtctContId());
|
||||||
|
entity.setChnCd(stbltDto.getChnCd());
|
||||||
|
entity.setBfClsCd(stbltDto.getBfClsCd());
|
||||||
|
entity.setBfClsProb(stbltDto.getBfClsProb());
|
||||||
|
entity.setAfClsCd(stbltDto.getAfClsCd());
|
||||||
|
entity.setAfClsProb(stbltDto.getAfClsProb());
|
||||||
|
entity.setPnuSqms(stbltDto.getPnuSqms());
|
||||||
|
entity.setPnuDtctSqms(stbltDto.getPnuDtctSqms());
|
||||||
|
entity.setChnDtctSqms(stbltDto.getChnDtctSqms());
|
||||||
|
entity.setStbltYn(stbltDto.getStbltYn());
|
||||||
|
entity.setIncyCd(stbltDto.getIncyCd());
|
||||||
|
entity.setIncyRsnCont(stbltDto.getIncyRsnCont());
|
||||||
|
entity.setLockYn(stbltDto.getLockYn());
|
||||||
|
entity.setLblYn(stbltDto.getLblYn());
|
||||||
|
entity.setChgYn(stbltDto.getChgYn());
|
||||||
|
entity.setRsatctNo(stbltDto.getRsatctNo());
|
||||||
|
entity.setRmk(stbltDto.getRmk());
|
||||||
|
entity.setCrtDt(stbltDto.getCrtDt());
|
||||||
|
entity.setCrtEpno(stbltDto.getCrtEpno());
|
||||||
|
entity.setCrtIp(stbltDto.getCrtIp());
|
||||||
|
entity.setChgDt(stbltDto.getChgDt());
|
||||||
|
entity.setChgIp(stbltDto.getChgIp());
|
||||||
|
entity.setDelYn(stbltDto.getDelYn().equals("Y"));
|
||||||
|
|
||||||
|
entity.setCreatedDttm(ZonedDateTime.now());
|
||||||
|
gukYuinStbltRepository.save(entity);
|
||||||
|
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -37,10 +37,12 @@ import jakarta.persistence.EntityNotFoundException;
|
|||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
@@ -81,23 +83,29 @@ public class InferenceResultCoreService {
|
|||||||
* @param req
|
* @param req
|
||||||
*/
|
*/
|
||||||
public UUID saveInferenceInfo(InferenceResultDto.RegReq req, List<MngListDto> targetList) {
|
public UUID saveInferenceInfo(InferenceResultDto.RegReq req, List<MngListDto> targetList) {
|
||||||
String firstMapSheetName = null;
|
|
||||||
String mapSheetName = "";
|
|
||||||
int detectingCnt = 0;
|
|
||||||
|
|
||||||
for (MngListDto dto : targetList) {
|
List<MngListDto> distinctList =
|
||||||
if (detectingCnt == 0) {
|
targetList.stream()
|
||||||
firstMapSheetName = dto.getMapSheetName();
|
.filter(dto -> dto.getMapSheetName() != null && !dto.getMapSheetName().isBlank())
|
||||||
}
|
.collect(
|
||||||
detectingCnt++;
|
Collectors.toMap(
|
||||||
}
|
MngListDto::getMapSheetName,
|
||||||
|
dto -> dto,
|
||||||
|
(existing, duplicate) -> existing,
|
||||||
|
LinkedHashMap::new))
|
||||||
|
.values()
|
||||||
|
.stream()
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
int detectingCnt = distinctList.size();
|
||||||
|
|
||||||
|
String mapSheetName;
|
||||||
if (detectingCnt == 0) {
|
if (detectingCnt == 0) {
|
||||||
mapSheetName = "";
|
mapSheetName = "";
|
||||||
} else if (detectingCnt == 1) {
|
} else if (detectingCnt == 1) {
|
||||||
mapSheetName = firstMapSheetName + " 1건";
|
mapSheetName = distinctList.get(0).getMapSheetName() + " 1건";
|
||||||
} else {
|
} else {
|
||||||
mapSheetName = firstMapSheetName + " 외 " + (detectingCnt - 1) + "건";
|
mapSheetName = distinctList.get(0).getMapSheetName() + " 외 " + (detectingCnt - 1) + "건";
|
||||||
}
|
}
|
||||||
|
|
||||||
MapSheetLearnEntity mapSheetLearnEntity = new MapSheetLearnEntity();
|
MapSheetLearnEntity mapSheetLearnEntity = new MapSheetLearnEntity();
|
||||||
@@ -113,7 +121,7 @@ public class InferenceResultCoreService {
|
|||||||
mapSheetLearnEntity.setCreatedUid(userUtil.getId());
|
mapSheetLearnEntity.setCreatedUid(userUtil.getId());
|
||||||
mapSheetLearnEntity.setMapSheetCnt(mapSheetName);
|
mapSheetLearnEntity.setMapSheetCnt(mapSheetName);
|
||||||
mapSheetLearnEntity.setDetectingCnt(0L);
|
mapSheetLearnEntity.setDetectingCnt(0L);
|
||||||
mapSheetLearnEntity.setTotalJobs((long) detectingCnt);
|
mapSheetLearnEntity.setTotalJobs((long) targetList.size());
|
||||||
|
|
||||||
// 회차는 국유인 반영할때 update로 변경됨
|
// 회차는 국유인 반영할때 update로 변경됨
|
||||||
// mapSheetLearnEntity.setStage(
|
// mapSheetLearnEntity.setStage(
|
||||||
|
|||||||
@@ -67,10 +67,6 @@ public class MapLayerCoreService {
|
|||||||
.findDetailByUuid(uuid)
|
.findDetailByUuid(uuid)
|
||||||
.orElseThrow(() -> new CustomApiException("NOT_FOUND_DATA", HttpStatus.NOT_FOUND));
|
.orElseThrow(() -> new CustomApiException("NOT_FOUND_DATA", HttpStatus.NOT_FOUND));
|
||||||
|
|
||||||
if (LayerType.TILE.getId().equals(entity.getLayerType())) {
|
|
||||||
throw new CustomApiException("UNPROCESSABLE_ENTITY", HttpStatus.CONFLICT);
|
|
||||||
}
|
|
||||||
|
|
||||||
entity.setIsDeleted(true);
|
entity.setIsDeleted(true);
|
||||||
entity.setUpdatedUid(userUtil.getId());
|
entity.setUpdatedUid(userUtil.getId());
|
||||||
entity.setUpdatedDttm(ZonedDateTime.now());
|
entity.setUpdatedDttm(ZonedDateTime.now());
|
||||||
@@ -131,6 +127,10 @@ public class MapLayerCoreService {
|
|||||||
entity.setIsLabelingMap(dto.getIsLabelingMap());
|
entity.setIsLabelingMap(dto.getIsLabelingMap());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dto.getCrs() != null) {
|
||||||
|
entity.setCrs(dto.getCrs());
|
||||||
|
}
|
||||||
|
|
||||||
entity.setUpdatedUid(userUtil.getId());
|
entity.setUpdatedUid(userUtil.getId());
|
||||||
entity.setUpdatedDttm(ZonedDateTime.now());
|
entity.setUpdatedDttm(ZonedDateTime.now());
|
||||||
}
|
}
|
||||||
@@ -210,13 +210,7 @@ public class MapLayerCoreService {
|
|||||||
* @param dto
|
* @param dto
|
||||||
*/
|
*/
|
||||||
public UUID saveTile(LayerDto.AddReq dto) {
|
public UUID saveTile(LayerDto.AddReq dto) {
|
||||||
LayerDto.SearchReq searchReq = new LayerDto.SearchReq();
|
Long order = mapLayerRepository.findSortOrderDesc();
|
||||||
searchReq.setLayerType(LayerType.TILE.getId());
|
|
||||||
List<LayerDto.Basic> entityList = mapLayerRepository.findAllLayer(searchReq);
|
|
||||||
|
|
||||||
if (!entityList.isEmpty()) {
|
|
||||||
throw new CustomApiException("DUPLICATE_DATA", HttpStatus.CONFLICT);
|
|
||||||
}
|
|
||||||
|
|
||||||
MapLayerEntity mapLayerEntity = new MapLayerEntity();
|
MapLayerEntity mapLayerEntity = new MapLayerEntity();
|
||||||
mapLayerEntity.setDescription(dto.getDescription());
|
mapLayerEntity.setDescription(dto.getDescription());
|
||||||
@@ -228,11 +222,12 @@ public class MapLayerCoreService {
|
|||||||
mapLayerEntity.setMaxLat(dto.getMaxLat());
|
mapLayerEntity.setMaxLat(dto.getMaxLat());
|
||||||
mapLayerEntity.setMinZoom(dto.getMin());
|
mapLayerEntity.setMinZoom(dto.getMin());
|
||||||
mapLayerEntity.setMaxZoom(dto.getMax());
|
mapLayerEntity.setMaxZoom(dto.getMax());
|
||||||
|
mapLayerEntity.setCrs(dto.getCrs());
|
||||||
|
|
||||||
mapLayerEntity.setCreatedUid(userUtil.getId());
|
mapLayerEntity.setCreatedUid(userUtil.getId());
|
||||||
mapLayerEntity.setIsChangeMap(true);
|
mapLayerEntity.setIsChangeMap(true);
|
||||||
mapLayerEntity.setIsLabelingMap(false);
|
mapLayerEntity.setIsLabelingMap(true);
|
||||||
mapLayerEntity.setOrder(1L);
|
mapLayerEntity.setOrder(order + 1);
|
||||||
mapLayerEntity.setLayerType(LayerType.TILE.getId());
|
mapLayerEntity.setLayerType(LayerType.TILE.getId());
|
||||||
mapLayerEntity.setUpdatedDttm(ZonedDateTime.now());
|
mapLayerEntity.setUpdatedDttm(ZonedDateTime.now());
|
||||||
return mapLayerRepository.save(mapLayerEntity).getUuid();
|
return mapLayerRepository.save(mapLayerEntity).getUuid();
|
||||||
@@ -255,6 +250,7 @@ public class MapLayerCoreService {
|
|||||||
mapLayerEntity.setIsChangeMap(true);
|
mapLayerEntity.setIsChangeMap(true);
|
||||||
mapLayerEntity.setIsLabelingMap(true);
|
mapLayerEntity.setIsLabelingMap(true);
|
||||||
mapLayerEntity.setLayerType(LayerType.GEOJSON.getId());
|
mapLayerEntity.setLayerType(LayerType.GEOJSON.getId());
|
||||||
|
mapLayerEntity.setCrs(addDto.getCrs());
|
||||||
mapLayerEntity.setUpdatedDttm(ZonedDateTime.now());
|
mapLayerEntity.setUpdatedDttm(ZonedDateTime.now());
|
||||||
mapLayerEntity.setOrder(order + 1);
|
mapLayerEntity.setOrder(order + 1);
|
||||||
return mapLayerRepository.save(mapLayerEntity).getUuid();
|
return mapLayerRepository.save(mapLayerEntity).getUuid();
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.core;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.postgres.repository.scheduler.TrainingDataLabelJobRepository;
|
||||||
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.InspectorPendingDto;
|
||||||
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.Tasks;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class TrainingDataLabelJobCoreService {
|
||||||
|
|
||||||
|
private final TrainingDataLabelJobRepository trainingDataLabelJobRepository;
|
||||||
|
|
||||||
|
public List<Tasks> findCompletedYesterdayUnassigned() {
|
||||||
|
return trainingDataLabelJobRepository.findCompletedYesterdayUnassigned();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void assignReviewerBatch(List<UUID> assignmentUids, String reviewerId) {
|
||||||
|
trainingDataLabelJobRepository.assignReviewerBatch(assignmentUids, reviewerId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<InspectorPendingDto> findInspectorPendingByRound(Long analUid) {
|
||||||
|
return trainingDataLabelJobRepository.findInspectorPendingByRound(analUid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void lockInspectors(Long analUid, List<String> reviewerIds) {
|
||||||
|
trainingDataLabelJobRepository.lockInspectors(analUid, reviewerIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateGeomUidTestState(List<Long> geomUids) {
|
||||||
|
trainingDataLabelJobRepository.updateGeomUidTestState(geomUids);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,10 +4,7 @@ import com.kamco.cd.kamcoback.postgres.repository.scheduler.TrainingDataReviewJo
|
|||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalCntInfo;
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalCntInfo;
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalMapSheetList;
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalMapSheetList;
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.CompleteLabelData;
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.CompleteLabelData;
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.InspectorPendingDto;
|
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.Tasks;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -17,34 +14,6 @@ public class TrainingDataReviewJobCoreService {
|
|||||||
|
|
||||||
private final TrainingDataReviewJobRepository trainingDataReviewJobRepository;
|
private final TrainingDataReviewJobRepository trainingDataReviewJobRepository;
|
||||||
|
|
||||||
public List<Tasks> findCompletedYesterdayUnassigned() {
|
|
||||||
return trainingDataReviewJobRepository.findCompletedYesterdayUnassigned();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void assignReviewer(UUID assignmentUid, String reviewerId) {
|
|
||||||
trainingDataReviewJobRepository.assignReviewer(assignmentUid, reviewerId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void assignReviewerBatch(List<UUID> assignmentUids, String reviewerId) {
|
|
||||||
trainingDataReviewJobRepository.assignReviewerBatch(assignmentUids, reviewerId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Tasks findAssignmentTask(String assignmentUid) {
|
|
||||||
return trainingDataReviewJobRepository.findAssignmentTask(assignmentUid);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<InspectorPendingDto> findInspectorPendingByRound(Long analUid) {
|
|
||||||
return trainingDataReviewJobRepository.findInspectorPendingByRound(analUid);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void lockInspectors(Long analUid, List<String> reviewerIds) {
|
|
||||||
trainingDataReviewJobRepository.lockInspectors(analUid, reviewerIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateGeomUidTestState(List<Long> geomUids) {
|
|
||||||
trainingDataReviewJobRepository.updateGeomUidTestState(geomUids);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<CompleteLabelData> findCompletedYesterdayLabelingList(
|
public List<CompleteLabelData> findCompletedYesterdayLabelingList(
|
||||||
Long analUid, String mapSheetNum) {
|
Long analUid, String mapSheetNum) {
|
||||||
return trainingDataReviewJobRepository.findCompletedYesterdayLabelingList(analUid, mapSheetNum);
|
return trainingDataReviewJobRepository.findCompletedYesterdayLabelingList(analUid, mapSheetNum);
|
||||||
|
|||||||
@@ -103,6 +103,9 @@ public class MapLayerEntity {
|
|||||||
@Column(name = "is_deleted")
|
@Column(name = "is_deleted")
|
||||||
private Boolean isDeleted = false;
|
private Boolean isDeleted = false;
|
||||||
|
|
||||||
|
@Column(name = "crs")
|
||||||
|
private String crs;
|
||||||
|
|
||||||
public LayerDto.Detail toDto() {
|
public LayerDto.Detail toDto() {
|
||||||
return new LayerDto.Detail(
|
return new LayerDto.Detail(
|
||||||
this.uuid,
|
this.uuid,
|
||||||
@@ -120,6 +123,7 @@ public class MapLayerEntity {
|
|||||||
this.maxLat,
|
this.maxLat,
|
||||||
this.minZoom,
|
this.minZoom,
|
||||||
this.maxZoom,
|
this.maxZoom,
|
||||||
this.createdDttm);
|
this.createdDttm,
|
||||||
|
this.crs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,6 +156,12 @@ public class MapSheetAnalDataInferenceGeomEntity {
|
|||||||
@JoinColumn(name = "map_5k_id", referencedColumnName = "fid")
|
@JoinColumn(name = "map_5k_id", referencedColumnName = "fid")
|
||||||
private MapInkx5kEntity map5k;
|
private MapInkx5kEntity map5k;
|
||||||
|
|
||||||
|
@Column(name = "label_send_dttm")
|
||||||
|
private ZonedDateTime labelSendDttm;
|
||||||
|
|
||||||
|
@Column(name = "lock_yn")
|
||||||
|
private String lockYn;
|
||||||
|
|
||||||
public InferenceDetailDto.DetailListEntity toEntity() {
|
public InferenceDetailDto.DetailListEntity toEntity() {
|
||||||
DetectionClassification classification = DetectionClassification.fromString(classBeforeCd);
|
DetectionClassification classification = DetectionClassification.fromString(classBeforeCd);
|
||||||
Clazzes comparedClazz = new Clazzes(classification, classBeforeProb);
|
Clazzes comparedClazz = new Clazzes(classification, classBeforeProb);
|
||||||
|
|||||||
@@ -45,6 +45,9 @@ public class MapSheetMngTileEntity {
|
|||||||
@Column(name = "tag")
|
@Column(name = "tag")
|
||||||
private String tag;
|
private String tag;
|
||||||
|
|
||||||
|
@Column(name = "crs")
|
||||||
|
private String crs;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@ColumnDefault("now()")
|
@ColumnDefault("now()")
|
||||||
@Column(name = "created_dttm", nullable = false)
|
@Column(name = "created_dttm", nullable = false)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import jakarta.persistence.SequenceGenerator;
|
|||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
import java.time.OffsetDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.hibernate.annotations.ColumnDefault;
|
import org.hibernate.annotations.ColumnDefault;
|
||||||
@@ -39,7 +39,7 @@ public class PnuEntity {
|
|||||||
private String pnu;
|
private String pnu;
|
||||||
|
|
||||||
@Column(name = "created_dttm")
|
@Column(name = "created_dttm")
|
||||||
private OffsetDateTime createdDttm;
|
private ZonedDateTime createdDttm;
|
||||||
|
|
||||||
@Column(name = "created_uid")
|
@Column(name = "created_uid")
|
||||||
private Long createdUid;
|
private Long createdUid;
|
||||||
@@ -47,4 +47,140 @@ public class PnuEntity {
|
|||||||
@ColumnDefault("false")
|
@ColumnDefault("false")
|
||||||
@Column(name = "del_yn")
|
@Column(name = "del_yn")
|
||||||
private Boolean delYn;
|
private Boolean delYn;
|
||||||
|
|
||||||
|
@Size(max = 40)
|
||||||
|
@Column(name = "pnu_dtct_id", length = 40)
|
||||||
|
private String pnuDtctId;
|
||||||
|
|
||||||
|
@Size(max = 10)
|
||||||
|
@Column(name = "lrm_sync_ymd", length = 10)
|
||||||
|
private String lrmSyncYmd;
|
||||||
|
|
||||||
|
@Size(max = 10)
|
||||||
|
@Column(name = "pnu_sync_ymd", length = 10)
|
||||||
|
private String pnuSyncYmd;
|
||||||
|
|
||||||
|
@Size(max = 20)
|
||||||
|
@Column(name = "mpqd_no", length = 20)
|
||||||
|
private String mpqdNo;
|
||||||
|
|
||||||
|
@Size(max = 10)
|
||||||
|
@Column(name = "cprs_yr", length = 10)
|
||||||
|
private String cprsYr;
|
||||||
|
|
||||||
|
@Size(max = 10)
|
||||||
|
@Column(name = "crtr_yr", length = 10)
|
||||||
|
private String crtrYr;
|
||||||
|
|
||||||
|
@Size(max = 255)
|
||||||
|
@Column(name = "chn_dtct_id")
|
||||||
|
private String chnDtctId;
|
||||||
|
|
||||||
|
@Size(max = 10)
|
||||||
|
@Column(name = "chn_dtct_mst_id", length = 10)
|
||||||
|
private String chnDtctMstId;
|
||||||
|
|
||||||
|
@Size(max = 255)
|
||||||
|
@Column(name = "chn_dtct_objt_id")
|
||||||
|
private String chnDtctObjtId;
|
||||||
|
|
||||||
|
@Size(max = 255)
|
||||||
|
@Column(name = "chn_dtct_cont_id")
|
||||||
|
private String chnDtctContId;
|
||||||
|
|
||||||
|
@Size(max = 50)
|
||||||
|
@Column(name = "chn_cd", length = 50)
|
||||||
|
private String chnCd;
|
||||||
|
|
||||||
|
@Size(max = 50)
|
||||||
|
@Column(name = "chn_dtct_prob", length = 50)
|
||||||
|
private String chnDtctProb;
|
||||||
|
|
||||||
|
@Size(max = 50)
|
||||||
|
@Column(name = "bf_cls_cd", length = 50)
|
||||||
|
private String bfClsCd;
|
||||||
|
|
||||||
|
@Size(max = 50)
|
||||||
|
@Column(name = "bf_cls_prob", length = 50)
|
||||||
|
private String bfClsProb;
|
||||||
|
|
||||||
|
@Size(max = 50)
|
||||||
|
@Column(name = "af_cls_cd", length = 50)
|
||||||
|
private String afClsCd;
|
||||||
|
|
||||||
|
@Size(max = 50)
|
||||||
|
@Column(name = "af_cls_prob", length = 50)
|
||||||
|
private String afClsProb;
|
||||||
|
|
||||||
|
@Size(max = 100)
|
||||||
|
@Column(name = "pnu_sqms", length = 100)
|
||||||
|
private String pnuSqms;
|
||||||
|
|
||||||
|
@Size(max = 100)
|
||||||
|
@Column(name = "pnu_dtct_sqms", length = 100)
|
||||||
|
private String pnuDtctSqms;
|
||||||
|
|
||||||
|
@Size(max = 100)
|
||||||
|
@Column(name = "chn_dtct_sqms", length = 100)
|
||||||
|
private String chnDtctSqms;
|
||||||
|
|
||||||
|
@Size(max = 1)
|
||||||
|
@Column(name = "stblt_yn", length = 1)
|
||||||
|
private String stbltYn;
|
||||||
|
|
||||||
|
@Size(max = 30)
|
||||||
|
@Column(name = "incy_cd", length = 30)
|
||||||
|
private String incyCd;
|
||||||
|
|
||||||
|
@Size(max = 255)
|
||||||
|
@Column(name = "incy_rsn_cont")
|
||||||
|
private String incyRsnCont;
|
||||||
|
|
||||||
|
@Size(max = 1)
|
||||||
|
@Column(name = "lock_yn", length = 1)
|
||||||
|
private String lockYn;
|
||||||
|
|
||||||
|
@Size(max = 1)
|
||||||
|
@Column(name = "lbl_yn", length = 1)
|
||||||
|
private String lblYn;
|
||||||
|
|
||||||
|
@Size(max = 1)
|
||||||
|
@Column(name = "chg_yn", length = 1)
|
||||||
|
private String chgYn;
|
||||||
|
|
||||||
|
@Size(max = 50)
|
||||||
|
@Column(name = "rsatct_no", length = 50)
|
||||||
|
private String rsatctNo;
|
||||||
|
|
||||||
|
@Size(max = 100)
|
||||||
|
@Column(name = "rmk", length = 100)
|
||||||
|
private String rmk;
|
||||||
|
|
||||||
|
@Size(max = 20)
|
||||||
|
@Column(name = "crt_dt", length = 20)
|
||||||
|
private String crtDt;
|
||||||
|
|
||||||
|
@Size(max = 20)
|
||||||
|
@Column(name = "crt_epno", length = 20)
|
||||||
|
private String crtEpno;
|
||||||
|
|
||||||
|
@Size(max = 20)
|
||||||
|
@Column(name = "crt_ip", length = 20)
|
||||||
|
private String crtIp;
|
||||||
|
|
||||||
|
@Size(max = 20)
|
||||||
|
@Column(name = "chg_dt", length = 20)
|
||||||
|
private String chgDt;
|
||||||
|
|
||||||
|
@Size(max = 20)
|
||||||
|
@Column(name = "chg_epno", length = 20)
|
||||||
|
private String chgEpno;
|
||||||
|
|
||||||
|
@Size(max = 20)
|
||||||
|
@Column(name = "chg_ip", length = 20)
|
||||||
|
private String chgIp;
|
||||||
|
|
||||||
|
@Size(max = 10)
|
||||||
|
@Column(name = "chn_dtct_sno", length = 10)
|
||||||
|
private String chnDtctSno;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.MapSheetLearnEntity;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
public interface GukYuinLabelJobRepository
|
||||||
|
extends JpaRepository<MapSheetLearnEntity, Long>, GukYuinLabelJobRepositoryCustom {}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GeomUidDto;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface GukYuinLabelJobRepositoryCustom {
|
||||||
|
|
||||||
|
List<GeomUidDto> findYesterdayLabelingCompleteList();
|
||||||
|
|
||||||
|
void updateAnalDataInferenceGeomSendDttm(Long geoUid);
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
||||||
|
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QLabelingAssignmentEntity.labelingAssignmentEntity;
|
||||||
|
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.QMapSheetLearnEntity.mapSheetLearnEntity;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GeomUidDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
||||||
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InspectState;
|
||||||
|
import com.querydsl.core.types.Projections;
|
||||||
|
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||||
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||||
|
import jakarta.persistence.EntityManager;
|
||||||
|
import jakarta.persistence.PersistenceContext;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class GukYuinLabelJobRepositoryImpl implements GukYuinLabelJobRepositoryCustom {
|
||||||
|
|
||||||
|
private final JPAQueryFactory queryFactory;
|
||||||
|
@PersistenceContext private EntityManager em;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<GeomUidDto> findYesterdayLabelingCompleteList() {
|
||||||
|
ZoneId zone = ZoneId.of("Asia/Seoul");
|
||||||
|
ZonedDateTime todayStart = ZonedDateTime.now(zone).toLocalDate().atStartOfDay(zone);
|
||||||
|
ZonedDateTime tomorrowStart = todayStart.plusDays(1);
|
||||||
|
ZonedDateTime yesterdayStart = todayStart.minusDays(1);
|
||||||
|
|
||||||
|
// BooleanExpression isYesterday =
|
||||||
|
// labelingAssignmentEntity
|
||||||
|
// .inspectStatDttm
|
||||||
|
// .goe(yesterdayStart)
|
||||||
|
// .and(labelingAssignmentEntity.inspectStatDttm.lt(todayStart));
|
||||||
|
BooleanExpression isYesterday =
|
||||||
|
labelingAssignmentEntity
|
||||||
|
.inspectStatDttm
|
||||||
|
.goe(todayStart)
|
||||||
|
.and(labelingAssignmentEntity.inspectStatDttm.lt(tomorrowStart));
|
||||||
|
|
||||||
|
return queryFactory
|
||||||
|
.select(
|
||||||
|
Projections.constructor(
|
||||||
|
GeomUidDto.class,
|
||||||
|
labelingAssignmentEntity.inferenceGeomUid,
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.resultUid))
|
||||||
|
.from(labelingAssignmentEntity)
|
||||||
|
.innerJoin(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.on(
|
||||||
|
labelingAssignmentEntity.inferenceGeomUid.eq(
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.geoUid))
|
||||||
|
.innerJoin(mapSheetAnalInferenceEntity)
|
||||||
|
.on(labelingAssignmentEntity.analUid.eq(mapSheetAnalInferenceEntity.id))
|
||||||
|
.innerJoin(mapSheetLearnEntity)
|
||||||
|
.on(
|
||||||
|
mapSheetAnalInferenceEntity.learnId.eq(mapSheetLearnEntity.id),
|
||||||
|
mapSheetLearnEntity.applyStatus.in(
|
||||||
|
GukYuinStatus.GUK_COMPLETED.getId(), GukYuinStatus.PNU_COMPLETED.getId()))
|
||||||
|
.where(labelingAssignmentEntity.inspectState.eq(InspectState.COMPLETE.getId()), isYesterday)
|
||||||
|
.fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateAnalDataInferenceGeomSendDttm(Long geoUid) {
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.set(mapSheetAnalDataInferenceGeomEntity.labelSendDttm, ZonedDateTime.now())
|
||||||
|
.where(mapSheetAnalDataInferenceGeomEntity.geoUid.eq(geoUid))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.MapSheetLearnEntity;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
public interface GukYuinPnuJobRepository
|
||||||
|
extends JpaRepository<MapSheetLearnEntity, Long>, GukYuinPnuJobRepositoryCustom {}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface GukYuinPnuJobRepositoryCustom {
|
||||||
|
|
||||||
|
void updateInferenceGeomDataPnuCnt(String chnDtctObjtId, long pnuCnt);
|
||||||
|
|
||||||
|
Long findMapSheetAnalDataInferenceGeomUid(String chnDtctObjtId);
|
||||||
|
|
||||||
|
void insertGeoUidPnuData(Long geoUid, String[] pnuList, String chnDtctObjtId);
|
||||||
|
|
||||||
|
void updateGukYuinApplyStateComplete(Long id, GukYuinStatus status);
|
||||||
|
|
||||||
|
List<LearnKeyDto> findGukyuinApplyStatusUidList(List<String> gukYuinStatus);
|
||||||
|
|
||||||
|
long upsertMapSheetDataAnalGeomPnu(String uid, String[] pnuList);
|
||||||
|
}
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
||||||
|
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity;
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity.mapSheetLearnEntity;
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QPnuEntity.pnuEntity;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.PnuEntity;
|
||||||
|
import com.querydsl.core.types.Projections;
|
||||||
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||||
|
import jakarta.persistence.EntityManager;
|
||||||
|
import jakarta.persistence.PersistenceContext;
|
||||||
|
import jakarta.transaction.Transactional;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class GukYuinPnuJobRepositoryImpl implements GukYuinPnuJobRepositoryCustom {
|
||||||
|
|
||||||
|
private final JPAQueryFactory queryFactory;
|
||||||
|
@PersistenceContext private EntityManager em;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateInferenceGeomDataPnuCnt(String chnDtctObjtId, long pnuCnt) {
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.set(mapSheetAnalDataInferenceGeomEntity.pnu, pnuCnt)
|
||||||
|
.where(mapSheetAnalDataInferenceGeomEntity.resultUid.eq(chnDtctObjtId))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long findMapSheetAnalDataInferenceGeomUid(String chnDtctObjtId) {
|
||||||
|
return queryFactory
|
||||||
|
.select(mapSheetAnalDataInferenceGeomEntity.geoUid)
|
||||||
|
.from(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.where(mapSheetAnalDataInferenceGeomEntity.resultUid.eq(chnDtctObjtId))
|
||||||
|
.fetchOne();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insertGeoUidPnuData(Long geoUid, String[] pnuList, String chnDtctObjtId) {
|
||||||
|
for (String pnu : pnuList) {
|
||||||
|
PnuEntity entity =
|
||||||
|
queryFactory
|
||||||
|
.selectFrom(pnuEntity)
|
||||||
|
.where(pnuEntity.pnu.eq(pnu), pnuEntity.chnDtctObjtId.eq(chnDtctObjtId))
|
||||||
|
.fetchOne();
|
||||||
|
if (entity == null) {
|
||||||
|
queryFactory
|
||||||
|
.insert(pnuEntity)
|
||||||
|
.columns(
|
||||||
|
pnuEntity.geo.geoUid, pnuEntity.pnu, pnuEntity.createdDttm, pnuEntity.chnDtctObjtId)
|
||||||
|
.values(geoUid, pnu, ZonedDateTime.now(), chnDtctObjtId)
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<LearnKeyDto> findGukyuinApplyStatusUidList(List<String> status) {
|
||||||
|
return queryFactory
|
||||||
|
.select(
|
||||||
|
Projections.constructor(
|
||||||
|
LearnKeyDto.class,
|
||||||
|
mapSheetLearnEntity.id,
|
||||||
|
mapSheetLearnEntity.uid,
|
||||||
|
mapSheetLearnEntity.chnDtctMstId))
|
||||||
|
.from(mapSheetLearnEntity)
|
||||||
|
.where(mapSheetLearnEntity.applyStatus.in(status))
|
||||||
|
.fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long upsertMapSheetDataAnalGeomPnu(String chnDtctObjtId, String[] pnuList) {
|
||||||
|
long length = pnuList.length;
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.set(mapSheetAnalDataInferenceGeomEntity.pnu, length)
|
||||||
|
.where(mapSheetAnalDataInferenceGeomEntity.resultUid.eq(chnDtctObjtId))
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
Long geoUid =
|
||||||
|
queryFactory
|
||||||
|
.select(mapSheetAnalDataInferenceGeomEntity.geoUid)
|
||||||
|
.from(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.where(mapSheetAnalDataInferenceGeomEntity.resultUid.eq(chnDtctObjtId))
|
||||||
|
.fetchOne();
|
||||||
|
|
||||||
|
long succCnt = 0;
|
||||||
|
for (String pnu : pnuList) {
|
||||||
|
long result =
|
||||||
|
queryFactory
|
||||||
|
.insert(pnuEntity)
|
||||||
|
.columns(
|
||||||
|
pnuEntity.geo.geoUid,
|
||||||
|
pnuEntity.pnu,
|
||||||
|
pnuEntity.createdDttm,
|
||||||
|
pnuEntity.chnDtctObjtId)
|
||||||
|
.values(geoUid, pnu, ZonedDateTime.now(), chnDtctObjtId)
|
||||||
|
.execute();
|
||||||
|
if (result > 0) {
|
||||||
|
succCnt++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return succCnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void updateGukYuinApplyStateComplete(Long id, GukYuinStatus status) {
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetLearnEntity)
|
||||||
|
.set(mapSheetLearnEntity.applyStatus, status.getId())
|
||||||
|
.set(mapSheetLearnEntity.applyStatusDttm, ZonedDateTime.now())
|
||||||
|
.where(mapSheetLearnEntity.id.eq(id))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,12 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.Basic;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.Basic;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LabelSendDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GeomUidDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.LearnInfo;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.LearnInfo;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@@ -11,23 +14,35 @@ public interface GukYuinRepositoryCustom {
|
|||||||
|
|
||||||
void updateGukYuinMastRegResult(Basic resultBody);
|
void updateGukYuinMastRegResult(Basic resultBody);
|
||||||
|
|
||||||
void updateGukYuinMastRegRemove(Basic resultBody);
|
void updateGukYuinMastRegRemove(String chnDtctId);
|
||||||
|
|
||||||
void updateInferenceGeomDataPnuCnt(String chnDtctObjtId, long pnuCnt);
|
void updateInferenceGeomDataPnuCnt(String chnDtctObjtId, long pnuCnt);
|
||||||
|
|
||||||
Long findMapSheetAnalDataInferenceGeomUid(String chnDtctObjtId);
|
Long findMapSheetAnalDataInferenceGeomUid(String chnDtctObjtId);
|
||||||
|
|
||||||
void insertGeoUidPnuData(Long geoUid, String[] pnuList);
|
void insertGeoUidPnuData(Long geoUid, String[] pnuList, String chnDtctObjtId);
|
||||||
|
|
||||||
void updateGukYuinApplyStateComplete(Long id, GukYuinStatus status);
|
void updateGukYuinApplyStateComplete(Long id, GukYuinStatus status);
|
||||||
|
|
||||||
List<LearnKeyDto> findGukyuinApplyStatusUidList(GukYuinStatus gukYuinStatus);
|
List<LearnKeyDto> findGukyuinApplyStatusUidList(List<String> gukYuinStatus);
|
||||||
|
|
||||||
void upsertMapSheetDataAnalGeomPnu(String uid, String[] pnuList);
|
long upsertMapSheetDataAnalGeomPnu(String uid, String[] pnuList);
|
||||||
|
|
||||||
LearnInfo findMapSheetLearnInfo(UUID uuid);
|
LearnInfo findMapSheetLearnInfo(UUID uuid);
|
||||||
|
|
||||||
Integer findMapSheetLearnYearStage(Integer compareYyyy, Integer targetYyyy);
|
Integer findMapSheetLearnYearStage(Integer compareYyyy, Integer targetYyyy);
|
||||||
|
|
||||||
void updateAnalInferenceApplyDttm(Basic registRes);
|
void updateAnalInferenceApplyDttm(Basic registRes);
|
||||||
|
|
||||||
|
List<GeomUidDto> findYesterdayLabelingCompleteList();
|
||||||
|
|
||||||
|
void updateAnalDataInferenceGeomSendDttm(Long geoUid);
|
||||||
|
|
||||||
|
List<LabelSendDto> findLabelingCompleteSendList(LocalDate yesterday);
|
||||||
|
|
||||||
|
Long findMapSheetLearnInfoByYyyy(Integer compareYyyy, Integer targetYyyy, Integer maxStage);
|
||||||
|
|
||||||
|
void updateMapSheetLearnGukyuinEndStatus(Long learnId);
|
||||||
|
|
||||||
|
void updateMapSheetInferenceLabelEndStatus(Long learnId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,30 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
||||||
|
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QLabelingAssignmentEntity.labelingAssignmentEntity;
|
||||||
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.QMapSheetAnalInferenceEntity.mapSheetAnalInferenceEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity.mapSheetLearnEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity.mapSheetLearnEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QPnuEntity.pnuEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QPnuEntity.pnuEntity;
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.Basic;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.Basic;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LabelSendDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GeomUidDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.LearnInfo;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.LearnInfo;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
||||||
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InspectState;
|
||||||
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelMngState;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.PnuEntity;
|
||||||
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.Expressions;
|
import com.querydsl.core.types.dsl.Expressions;
|
||||||
import com.querydsl.core.types.dsl.NumberExpression;
|
import com.querydsl.core.types.dsl.NumberExpression;
|
||||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||||
import jakarta.persistence.EntityManager;
|
import jakarta.persistence.EntityManager;
|
||||||
import jakarta.persistence.PersistenceContext;
|
import jakarta.persistence.PersistenceContext;
|
||||||
import jakarta.transaction.Transactional;
|
import jakarta.transaction.Transactional;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.ZoneId;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@@ -45,17 +54,20 @@ public class GukYuinRepositoryImpl implements GukYuinRepositoryCustom {
|
|||||||
.set(mapSheetLearnEntity.applyStatus, status.getId())
|
.set(mapSheetLearnEntity.applyStatus, status.getId())
|
||||||
.set(mapSheetLearnEntity.applyStatusDttm, ZonedDateTime.now())
|
.set(mapSheetLearnEntity.applyStatusDttm, ZonedDateTime.now())
|
||||||
.set(mapSheetLearnEntity.chnDtctMstId, resultBody.getChnDtctMstId())
|
.set(mapSheetLearnEntity.chnDtctMstId, resultBody.getChnDtctMstId())
|
||||||
|
.set(mapSheetLearnEntity.applyYn, true)
|
||||||
|
.set(mapSheetLearnEntity.applyDttm, ZonedDateTime.now())
|
||||||
.where(mapSheetLearnEntity.uid.eq(resultBody.getChnDtctId()))
|
.where(mapSheetLearnEntity.uid.eq(resultBody.getChnDtctId()))
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateGukYuinMastRegRemove(Basic resultBody) {
|
public void updateGukYuinMastRegRemove(String chnDtctId) {
|
||||||
queryFactory
|
queryFactory
|
||||||
.update(mapSheetLearnEntity)
|
.update(mapSheetLearnEntity)
|
||||||
.set(mapSheetLearnEntity.applyStatus, GukYuinStatus.CANCELED.getId())
|
.set(mapSheetLearnEntity.applyStatus, GukYuinStatus.CANCELED.getId())
|
||||||
.set(mapSheetLearnEntity.applyStatusDttm, ZonedDateTime.now())
|
.set(mapSheetLearnEntity.applyStatusDttm, ZonedDateTime.now())
|
||||||
.where(mapSheetLearnEntity.uid.eq(resultBody.getChnDtctId()))
|
.set(mapSheetLearnEntity.applyYn, false)
|
||||||
|
.where(mapSheetLearnEntity.uid.eq(chnDtctId))
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,18 +90,30 @@ public class GukYuinRepositoryImpl implements GukYuinRepositoryCustom {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void insertGeoUidPnuData(Long geoUid, String[] pnuList) {
|
public void insertGeoUidPnuData(Long geoUid, String[] pnuList, String chnDtctObjtId) {
|
||||||
for (String pnu : pnuList) {
|
for (String pnu : pnuList) {
|
||||||
queryFactory
|
PnuEntity entity =
|
||||||
.insert(pnuEntity)
|
queryFactory
|
||||||
.columns(pnuEntity.geo.geoUid, pnuEntity.pnu, pnuEntity.createdDttm)
|
.selectFrom(pnuEntity)
|
||||||
.values(geoUid, pnu, ZonedDateTime.now())
|
.where(
|
||||||
.execute();
|
pnuEntity.geo.geoUid.eq(geoUid),
|
||||||
|
pnuEntity.pnu.eq(pnu),
|
||||||
|
pnuEntity.chnDtctObjtId.eq(chnDtctObjtId))
|
||||||
|
.fetchOne();
|
||||||
|
|
||||||
|
if (entity == null) {
|
||||||
|
queryFactory
|
||||||
|
.insert(pnuEntity)
|
||||||
|
.columns(
|
||||||
|
pnuEntity.geo.geoUid, pnuEntity.pnu, pnuEntity.createdDttm, pnuEntity.chnDtctObjtId)
|
||||||
|
.values(geoUid, pnu, ZonedDateTime.now(), chnDtctObjtId)
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<LearnKeyDto> findGukyuinApplyStatusUidList(GukYuinStatus status) {
|
public List<LearnKeyDto> findGukyuinApplyStatusUidList(List<String> status) {
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.select(
|
.select(
|
||||||
Projections.constructor(
|
Projections.constructor(
|
||||||
@@ -98,12 +122,12 @@ public class GukYuinRepositoryImpl implements GukYuinRepositoryCustom {
|
|||||||
mapSheetLearnEntity.uid,
|
mapSheetLearnEntity.uid,
|
||||||
mapSheetLearnEntity.chnDtctMstId))
|
mapSheetLearnEntity.chnDtctMstId))
|
||||||
.from(mapSheetLearnEntity)
|
.from(mapSheetLearnEntity)
|
||||||
.where(mapSheetLearnEntity.applyStatus.eq(status.getId()))
|
.where(mapSheetLearnEntity.applyStatus.in(status))
|
||||||
.fetch();
|
.fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void upsertMapSheetDataAnalGeomPnu(String chnDtctObjtId, String[] pnuList) {
|
public long upsertMapSheetDataAnalGeomPnu(String chnDtctObjtId, String[] pnuList) {
|
||||||
long length = pnuList.length;
|
long length = pnuList.length;
|
||||||
queryFactory
|
queryFactory
|
||||||
.update(mapSheetAnalDataInferenceGeomEntity)
|
.update(mapSheetAnalDataInferenceGeomEntity)
|
||||||
@@ -118,13 +142,19 @@ public class GukYuinRepositoryImpl implements GukYuinRepositoryCustom {
|
|||||||
.where(mapSheetAnalDataInferenceGeomEntity.resultUid.eq(chnDtctObjtId))
|
.where(mapSheetAnalDataInferenceGeomEntity.resultUid.eq(chnDtctObjtId))
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
for (int i = 0; i < length; i++) {
|
long succCnt = 0;
|
||||||
queryFactory
|
for (String pnu : pnuList) {
|
||||||
.insert(pnuEntity)
|
long result =
|
||||||
.columns(pnuEntity.geo.geoUid, pnuEntity.pnu, pnuEntity.createdDttm)
|
queryFactory
|
||||||
.values(geoUid, pnuList[i], ZonedDateTime.now())
|
.insert(pnuEntity)
|
||||||
.execute();
|
.columns(pnuEntity.geo.geoUid, pnuEntity.pnu, pnuEntity.createdDttm)
|
||||||
|
.values(geoUid, pnu, ZonedDateTime.now())
|
||||||
|
.execute();
|
||||||
|
if (result > 0) {
|
||||||
|
succCnt++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return succCnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -139,7 +169,8 @@ public class GukYuinRepositoryImpl implements GukYuinRepositoryCustom {
|
|||||||
mapSheetLearnEntity.targetYyyy,
|
mapSheetLearnEntity.targetYyyy,
|
||||||
mapSheetLearnEntity.stage,
|
mapSheetLearnEntity.stage,
|
||||||
mapSheetLearnEntity.uid,
|
mapSheetLearnEntity.uid,
|
||||||
mapSheetLearnEntity.applyStatus))
|
mapSheetLearnEntity.applyStatus,
|
||||||
|
mapSheetLearnEntity.applyYn))
|
||||||
.from(mapSheetLearnEntity)
|
.from(mapSheetLearnEntity)
|
||||||
.where(mapSheetLearnEntity.uuid.eq(uuid))
|
.where(mapSheetLearnEntity.uuid.eq(uuid))
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
@@ -151,7 +182,7 @@ public class GukYuinRepositoryImpl implements GukYuinRepositoryCustom {
|
|||||||
Expressions.numberTemplate(Integer.class, "coalesce({0}, 0)", mapSheetLearnEntity.stage);
|
Expressions.numberTemplate(Integer.class, "coalesce({0}, 0)", mapSheetLearnEntity.stage);
|
||||||
|
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.select(stageExpr.max())
|
.select(stageExpr.max().coalesce(0))
|
||||||
.from(mapSheetLearnEntity)
|
.from(mapSheetLearnEntity)
|
||||||
.where(
|
.where(
|
||||||
mapSheetLearnEntity.compareYyyy.eq(compareYyyy),
|
mapSheetLearnEntity.compareYyyy.eq(compareYyyy),
|
||||||
@@ -174,6 +205,115 @@ public class GukYuinRepositoryImpl implements GukYuinRepositoryCustom {
|
|||||||
.update(mapSheetAnalInferenceEntity)
|
.update(mapSheetAnalInferenceEntity)
|
||||||
.set(mapSheetAnalInferenceEntity.gukyuinUsed, "Y")
|
.set(mapSheetAnalInferenceEntity.gukyuinUsed, "Y")
|
||||||
.set(mapSheetAnalInferenceEntity.gukyuinApplyDttm, ZonedDateTime.now())
|
.set(mapSheetAnalInferenceEntity.gukyuinApplyDttm, ZonedDateTime.now())
|
||||||
|
.set(mapSheetAnalInferenceEntity.stage, Integer.parseInt(registRes.getChnDtctSno()))
|
||||||
|
.where(mapSheetAnalInferenceEntity.learnId.eq(learnId))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<GeomUidDto> findYesterdayLabelingCompleteList() {
|
||||||
|
ZoneId zone = ZoneId.of("Asia/Seoul");
|
||||||
|
ZonedDateTime todayStart = ZonedDateTime.now(zone).toLocalDate().atStartOfDay(zone);
|
||||||
|
ZonedDateTime yesterdayStart = todayStart.minusDays(1);
|
||||||
|
|
||||||
|
BooleanExpression isYesterday =
|
||||||
|
labelingAssignmentEntity
|
||||||
|
.inspectStatDttm
|
||||||
|
.goe(yesterdayStart)
|
||||||
|
.and(labelingAssignmentEntity.inspectStatDttm.lt(todayStart));
|
||||||
|
|
||||||
|
return queryFactory
|
||||||
|
.select(
|
||||||
|
Projections.constructor(
|
||||||
|
GeomUidDto.class,
|
||||||
|
labelingAssignmentEntity.inferenceGeomUid,
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.resultUid))
|
||||||
|
.from(labelingAssignmentEntity)
|
||||||
|
.innerJoin(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.on(
|
||||||
|
labelingAssignmentEntity.inferenceGeomUid.eq(
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.geoUid))
|
||||||
|
.innerJoin(mapSheetAnalInferenceEntity)
|
||||||
|
.on(labelingAssignmentEntity.analUid.eq(mapSheetAnalInferenceEntity.id))
|
||||||
|
.innerJoin(mapSheetLearnEntity)
|
||||||
|
.on(
|
||||||
|
mapSheetAnalInferenceEntity.learnId.eq(mapSheetLearnEntity.id),
|
||||||
|
mapSheetLearnEntity.applyStatus.in(
|
||||||
|
GukYuinStatus.GUK_COMPLETED.getId(), GukYuinStatus.PNU_COMPLETED.getId()))
|
||||||
|
.where(labelingAssignmentEntity.inspectState.eq(InspectState.COMPLETE.getId()), isYesterday)
|
||||||
|
.fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateAnalDataInferenceGeomSendDttm(Long geoUid) {
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.set(mapSheetAnalDataInferenceGeomEntity.labelSendDttm, ZonedDateTime.now())
|
||||||
|
.where(mapSheetAnalDataInferenceGeomEntity.geoUid.eq(geoUid))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<LabelSendDto> findLabelingCompleteSendList(LocalDate yesterday) {
|
||||||
|
|
||||||
|
ZoneId zone = ZoneId.of("Asia/Seoul");
|
||||||
|
ZonedDateTime from = yesterday.atStartOfDay(zone);
|
||||||
|
ZonedDateTime to = from.plusDays(1);
|
||||||
|
|
||||||
|
BooleanExpression isYesterday =
|
||||||
|
labelingAssignmentEntity
|
||||||
|
.inspectStatDttm
|
||||||
|
.goe(from)
|
||||||
|
.and(labelingAssignmentEntity.inspectStatDttm.lt(to));
|
||||||
|
|
||||||
|
return queryFactory
|
||||||
|
.select(
|
||||||
|
Projections.constructor(
|
||||||
|
LabelSendDto.class,
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.resultUid,
|
||||||
|
labelingAssignmentEntity.workerUid,
|
||||||
|
labelingAssignmentEntity.workStatDttm,
|
||||||
|
labelingAssignmentEntity.inspectorUid,
|
||||||
|
labelingAssignmentEntity.inspectStatDttm,
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.labelSendDttm))
|
||||||
|
.from(labelingAssignmentEntity)
|
||||||
|
.innerJoin(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.on(
|
||||||
|
labelingAssignmentEntity.inferenceGeomUid.eq(
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.geoUid))
|
||||||
|
.where(labelingAssignmentEntity.inspectState.eq(InspectState.COMPLETE.getId()), isYesterday)
|
||||||
|
.fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long findMapSheetLearnInfoByYyyy(
|
||||||
|
Integer compareYyyy, Integer targetYyyy, Integer maxStage) {
|
||||||
|
return queryFactory
|
||||||
|
.select(mapSheetLearnEntity.id)
|
||||||
|
.from(mapSheetLearnEntity)
|
||||||
|
.where(
|
||||||
|
mapSheetLearnEntity.compareYyyy.eq(compareYyyy),
|
||||||
|
mapSheetLearnEntity.targetYyyy.eq(targetYyyy),
|
||||||
|
mapSheetLearnEntity.stage.eq(maxStage))
|
||||||
|
.fetchOne();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateMapSheetLearnGukyuinEndStatus(Long learnId) {
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetLearnEntity)
|
||||||
|
.set(mapSheetLearnEntity.applyStatus, GukYuinStatus.END.getId())
|
||||||
|
.set(mapSheetLearnEntity.applyStatusDttm, ZonedDateTime.now())
|
||||||
|
.where(mapSheetLearnEntity.id.eq(learnId))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateMapSheetInferenceLabelEndStatus(Long learnId) {
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetAnalInferenceEntity)
|
||||||
|
.set(mapSheetAnalInferenceEntity.analState, LabelMngState.FINISH.getId())
|
||||||
|
.set(mapSheetAnalInferenceEntity.updatedDttm, ZonedDateTime.now())
|
||||||
.where(mapSheetAnalInferenceEntity.learnId.eq(learnId))
|
.where(mapSheetAnalInferenceEntity.learnId.eq(learnId))
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.PnuEntity;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
public interface GukYuinStbltJobRepository
|
||||||
|
extends JpaRepository<PnuEntity, Long>, GukYuinStbltJobRepositoryCustom {}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.RlbDtctMastDto;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.PnuEntity;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface GukYuinStbltJobRepositoryCustom {
|
||||||
|
|
||||||
|
List<LearnKeyDto> findGukYuinEligibleForSurveyList(String status);
|
||||||
|
|
||||||
|
void updateGukYuinEligibleForSurvey(String resultUid, RlbDtctMastDto stbltDto);
|
||||||
|
|
||||||
|
PnuEntity findPnuEntityByResultUid(String resultUid, String pnu);
|
||||||
|
}
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
||||||
|
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceEntity.mapSheetAnalDataInferenceEntity;
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity;
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalInferenceEntity.mapSheetAnalInferenceEntity;
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity.mapSheetLearnEntity;
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QPnuEntity.pnuEntity;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.common.enums.ImageryFitStatus;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.RlbDtctMastDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataInferenceGeomEntity;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.PnuEntity;
|
||||||
|
import com.querydsl.core.types.Projections;
|
||||||
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||||
|
import jakarta.persistence.EntityManager;
|
||||||
|
import jakarta.persistence.PersistenceContext;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class GukYuinStbltJobRepositoryImpl implements GukYuinStbltJobRepositoryCustom {
|
||||||
|
|
||||||
|
private final JPAQueryFactory queryFactory;
|
||||||
|
@PersistenceContext private EntityManager em;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<LearnKeyDto> findGukYuinEligibleForSurveyList(String status) {
|
||||||
|
return queryFactory
|
||||||
|
.select(
|
||||||
|
Projections.constructor(
|
||||||
|
LearnKeyDto.class,
|
||||||
|
mapSheetLearnEntity.id,
|
||||||
|
mapSheetLearnEntity.uid,
|
||||||
|
mapSheetLearnEntity.chnDtctMstId))
|
||||||
|
.from(mapSheetLearnEntity)
|
||||||
|
.innerJoin(mapSheetAnalInferenceEntity)
|
||||||
|
.on(mapSheetLearnEntity.id.eq(mapSheetAnalInferenceEntity.learnId))
|
||||||
|
.innerJoin(mapSheetAnalDataInferenceEntity)
|
||||||
|
.on(mapSheetAnalInferenceEntity.id.eq(mapSheetAnalDataInferenceEntity.analUid))
|
||||||
|
.innerJoin(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.on(mapSheetAnalDataInferenceEntity.id.eq(mapSheetAnalDataInferenceGeomEntity.dataUid))
|
||||||
|
.where(
|
||||||
|
mapSheetLearnEntity.applyStatus.eq(GukYuinStatus.PNU_COMPLETED.getId()),
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.pnu.gt(0),
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.fitState.isNull())
|
||||||
|
.groupBy(mapSheetLearnEntity.id, mapSheetLearnEntity.uid, mapSheetLearnEntity.chnDtctMstId)
|
||||||
|
.having(mapSheetAnalDataInferenceGeomEntity.geoUid.count().gt(1L))
|
||||||
|
.fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateGukYuinEligibleForSurvey(String resultUid, RlbDtctMastDto stbltDto) {
|
||||||
|
|
||||||
|
MapSheetAnalDataInferenceGeomEntity geomEntity =
|
||||||
|
queryFactory
|
||||||
|
.selectFrom(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.where(mapSheetAnalDataInferenceGeomEntity.resultUid.eq(resultUid))
|
||||||
|
.fetchOne();
|
||||||
|
|
||||||
|
if (geomEntity != null) {
|
||||||
|
PnuEntity pnuEt =
|
||||||
|
queryFactory
|
||||||
|
.selectFrom(pnuEntity)
|
||||||
|
.where(pnuEntity.chnDtctObjtId.eq(resultUid))
|
||||||
|
.fetchFirst();
|
||||||
|
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.set(
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.fitState,
|
||||||
|
pnuEt.getStbltYn().equals("Y")
|
||||||
|
? ImageryFitStatus.UNFIT.getId()
|
||||||
|
: ImageryFitStatus.FIT.getId()) // 적합여부가 Y 이면 부적합인 것, N 이면 적합한 것이라고 함
|
||||||
|
.set(mapSheetAnalDataInferenceGeomEntity.fitStateDttm, ZonedDateTime.now())
|
||||||
|
.set(mapSheetAnalDataInferenceGeomEntity.lockYn, stbltDto.getLockYn())
|
||||||
|
.where(mapSheetAnalDataInferenceGeomEntity.resultUid.eq(resultUid))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PnuEntity findPnuEntityByResultUid(String resultUid, String pnu) {
|
||||||
|
return queryFactory
|
||||||
|
.selectFrom(pnuEntity)
|
||||||
|
.where(pnuEntity.pnu.eq(pnu), pnuEntity.chnDtctObjtId.eq(resultUid))
|
||||||
|
.fetchOne();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@ import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceG
|
|||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalInferenceEntity.mapSheetAnalInferenceEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalInferenceEntity.mapSheetAnalInferenceEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMemberEntity.memberEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMemberEntity.memberEntity;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.common.enums.ImageryFitStatus;
|
||||||
import com.kamco.cd.kamcoback.common.enums.StatusType;
|
import com.kamco.cd.kamcoback.common.enums.StatusType;
|
||||||
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;
|
||||||
@@ -82,7 +83,9 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
.innerJoin(mapSheetAnalDataInferenceGeomEntity)
|
.innerJoin(mapSheetAnalDataInferenceGeomEntity)
|
||||||
.on(
|
.on(
|
||||||
mapSheetAnalDataInferenceEntity.id.eq(mapSheetAnalDataInferenceGeomEntity.dataUid),
|
mapSheetAnalDataInferenceEntity.id.eq(mapSheetAnalDataInferenceGeomEntity.dataUid),
|
||||||
mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull(),
|
// mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull(),
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.pnu.gt(0),
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.fitState.eq(ImageryFitStatus.UNFIT.getId()),
|
||||||
mapSheetAnalDataInferenceGeomEntity.labelState.isNull())
|
mapSheetAnalDataInferenceGeomEntity.labelState.isNull())
|
||||||
.where(
|
.where(
|
||||||
mapSheetAnalInferenceEntity.uuid.eq(uuid),
|
mapSheetAnalInferenceEntity.uuid.eq(uuid),
|
||||||
@@ -126,8 +129,8 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
"""
|
"""
|
||||||
insert into tb_labeling_assignment
|
insert into tb_labeling_assignment
|
||||||
(assignment_uid, inference_geom_uid, worker_uid,
|
(assignment_uid, inference_geom_uid, worker_uid,
|
||||||
work_state, assign_group_id, anal_uid, pnu)
|
work_state, assign_group_id, anal_uid)
|
||||||
values (?, ?, ?, ?, ?, ?, ?)
|
values (?, ?, ?, ?, ?, ?)
|
||||||
""";
|
""";
|
||||||
|
|
||||||
try (PreparedStatement ps = connection.prepareStatement(sql)) {
|
try (PreparedStatement ps = connection.prepareStatement(sql)) {
|
||||||
@@ -140,7 +143,6 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
ps.setString(4, LabelState.ASSIGNED.getId());
|
ps.setString(4, LabelState.ASSIGNED.getId());
|
||||||
ps.setString(5, String.valueOf(info.getMapSheetNum()));
|
ps.setString(5, String.valueOf(info.getMapSheetNum()));
|
||||||
ps.setLong(6, analEntity.getId());
|
ps.setLong(6, analEntity.getId());
|
||||||
ps.setLong(7, info.getPnu());
|
|
||||||
|
|
||||||
ps.addBatch();
|
ps.addBatch();
|
||||||
batchSize++;
|
batchSize++;
|
||||||
@@ -190,7 +192,9 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
.innerJoin(mapSheetAnalDataInferenceGeomEntity)
|
.innerJoin(mapSheetAnalDataInferenceGeomEntity)
|
||||||
.on(
|
.on(
|
||||||
mapSheetAnalDataInferenceEntity.id.eq(mapSheetAnalDataInferenceGeomEntity.dataUid),
|
mapSheetAnalDataInferenceEntity.id.eq(mapSheetAnalDataInferenceGeomEntity.dataUid),
|
||||||
mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull(),
|
// mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull(),
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.pnu.gt(0),
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.fitState.eq(ImageryFitStatus.UNFIT.getId()),
|
||||||
mapSheetAnalDataInferenceGeomEntity.labelState.isNull())
|
mapSheetAnalDataInferenceGeomEntity.labelState.isNull())
|
||||||
.where(mapSheetAnalInferenceEntity.uuid.eq(uuid))
|
.where(mapSheetAnalInferenceEntity.uuid.eq(uuid))
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
@@ -381,9 +385,10 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
mapSheetAnalDataInferenceGeomEntity.compareYyyy.eq(analEntity.getCompareYyyy()),
|
mapSheetAnalDataInferenceGeomEntity.compareYyyy.eq(analEntity.getCompareYyyy()),
|
||||||
mapSheetAnalDataInferenceGeomEntity.targetYyyy.eq(analEntity.getTargetYyyy()),
|
mapSheetAnalDataInferenceGeomEntity.targetYyyy.eq(analEntity.getTargetYyyy()),
|
||||||
mapSheetAnalDataInferenceGeomEntity.stage.eq(analEntity.getStage()),
|
mapSheetAnalDataInferenceGeomEntity.stage.eq(analEntity.getStage()),
|
||||||
mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull()
|
// mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull()
|
||||||
// mapSheetAnalDataInferenceGeomEntity.pnu.gt(0L)
|
mapSheetAnalDataInferenceGeomEntity.pnu.gt(0L),
|
||||||
// mapSheetAnalDataInferenceGeomEntity.passYn.isFalse() //TODO:
|
mapSheetAnalDataInferenceGeomEntity.fitState.eq(
|
||||||
|
ImageryFitStatus.UNFIT.getId()) // TODO:
|
||||||
// 추후 라벨링 대상 조건 수정하기
|
// 추후 라벨링 대상 조건 수정하기
|
||||||
)
|
)
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
@@ -555,11 +560,9 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
mapSheetAnalDataInferenceGeomEntity.dataUid))
|
mapSheetAnalDataInferenceGeomEntity.dataUid))
|
||||||
.where(
|
.where(
|
||||||
mapSheetAnalInferenceEntity.uuid.eq(targetUuid),
|
mapSheetAnalInferenceEntity.uuid.eq(targetUuid),
|
||||||
mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull()
|
// mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull()
|
||||||
// mapSheetAnalDataInferenceGeomEntity.pnu.gt(0L),
|
mapSheetAnalDataInferenceGeomEntity.pnu.gt(0L),
|
||||||
// mapSheetAnalDataInferenceGeomEntity.passYn.isFalse() //TODO: 추후 라벨링
|
mapSheetAnalDataInferenceGeomEntity.fitState.eq(ImageryFitStatus.UNFIT.getId()))
|
||||||
// 대상 조건 수정하기
|
|
||||||
)
|
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -576,8 +579,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
queryFactory
|
queryFactory
|
||||||
.select(labelingAssignmentEntity.count())
|
.select(labelingAssignmentEntity.count())
|
||||||
.from(labelingAssignmentEntity)
|
.from(labelingAssignmentEntity)
|
||||||
.where(
|
.where(analUidCondition, labelingAssignmentEntity.workState.in("SKIP", "DONE"))
|
||||||
analUidCondition, labelingAssignmentEntity.workState.in("ASSIGNED", "SKIP", "DONE"))
|
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
Long skipCount =
|
Long skipCount =
|
||||||
@@ -602,6 +604,13 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
.where(analUidCondition, labelingAssignmentEntity.inspectState.eq("COMPLETE"))
|
.where(analUidCondition, labelingAssignmentEntity.inspectState.eq("COMPLETE"))
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
|
Long inspectionExcept =
|
||||||
|
queryFactory
|
||||||
|
.select(labelingAssignmentEntity.count())
|
||||||
|
.from(labelingAssignmentEntity)
|
||||||
|
.where(analUidCondition, labelingAssignmentEntity.inspectState.eq("EXCEPT"))
|
||||||
|
.fetchOne();
|
||||||
|
|
||||||
Long inspectorCount =
|
Long inspectorCount =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(labelingAssignmentEntity.inspectorUid.countDistinct())
|
.select(labelingAssignmentEntity.inspectorUid.countDistinct())
|
||||||
@@ -614,6 +623,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
long labelCompleted = labelingCompleted != null ? labelingCompleted : 0L;
|
long labelCompleted = labelingCompleted != null ? labelingCompleted : 0L;
|
||||||
long inspectCompleted = inspectionCompleted != null ? inspectionCompleted : 0L;
|
long inspectCompleted = inspectionCompleted != null ? inspectionCompleted : 0L;
|
||||||
long skipped = skipCount != null ? skipCount : 0L;
|
long skipped = skipCount != null ? skipCount : 0L;
|
||||||
|
long inspectExcepted = inspectionExcept != null ? inspectionExcept : 0L;
|
||||||
|
|
||||||
long labelingRemaining = labelingTotal - labelCompleted - skipped;
|
long labelingRemaining = labelingTotal - labelCompleted - skipped;
|
||||||
if (labelingRemaining < 0) {
|
if (labelingRemaining < 0) {
|
||||||
@@ -621,7 +631,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
}
|
}
|
||||||
|
|
||||||
long inspectionTotal = labelingTotal;
|
long inspectionTotal = labelingTotal;
|
||||||
long inspectionRemaining = inspectionTotal - inspectCompleted - skipped;
|
long inspectionRemaining = inspectionTotal - inspectCompleted - inspectExcepted;
|
||||||
if (inspectionRemaining < 0) {
|
if (inspectionRemaining < 0) {
|
||||||
inspectionRemaining = 0;
|
inspectionRemaining = 0;
|
||||||
}
|
}
|
||||||
@@ -658,7 +668,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
.inspectionStatus(inspectionStatus)
|
.inspectionStatus(inspectionStatus)
|
||||||
.inspectionTotalCount(inspectionTotal)
|
.inspectionTotalCount(inspectionTotal)
|
||||||
.inspectionCompletedCount(inspectCompleted)
|
.inspectionCompletedCount(inspectCompleted)
|
||||||
.inspectionSkipCount(skipped) // TODO
|
.inspectionSkipCount(inspectExcepted)
|
||||||
.inspectionRemainingCount(inspectionRemaining)
|
.inspectionRemainingCount(inspectionRemaining)
|
||||||
.inspectorCount(inspectorCount != null ? inspectorCount : 0L)
|
.inspectorCount(inspectorCount != null ? inspectorCount : 0L)
|
||||||
.progressRate(labelingRate)
|
.progressRate(labelingRate)
|
||||||
@@ -740,11 +750,9 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
mapSheetAnalInferenceEntity.targetYyyy.eq(
|
mapSheetAnalInferenceEntity.targetYyyy.eq(
|
||||||
mapSheetAnalDataInferenceGeomEntity.targetYyyy),
|
mapSheetAnalDataInferenceGeomEntity.targetYyyy),
|
||||||
mapSheetAnalInferenceEntity.stage.eq(mapSheetAnalDataInferenceGeomEntity.stage),
|
mapSheetAnalInferenceEntity.stage.eq(mapSheetAnalDataInferenceGeomEntity.stage),
|
||||||
mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull()
|
// mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull()
|
||||||
// mapSheetAnalDataInferenceGeomEntity.pnu.gt(0),
|
mapSheetAnalDataInferenceGeomEntity.pnu.gt(0),
|
||||||
// mapSheetAnalDataInferenceGeomEntity.passYn.isFalse() //TODO: 추후 라벨링 대상 조건
|
mapSheetAnalDataInferenceGeomEntity.fitState.eq(ImageryFitStatus.UNFIT.getId()))
|
||||||
// 수정하기
|
|
||||||
)
|
|
||||||
.where(mapSheetAnalInferenceEntity.id.eq(analEntity.getId()))
|
.where(mapSheetAnalInferenceEntity.id.eq(analEntity.getId()))
|
||||||
.groupBy(
|
.groupBy(
|
||||||
mapSheetAnalInferenceEntity.analTitle,
|
mapSheetAnalInferenceEntity.analTitle,
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.kamco.cd.kamcoback.postgres.repository.label;
|
|||||||
|
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity.mapSheetLearnEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity.mapSheetLearnEntity;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.common.enums.ImageryFitStatus;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InspectState;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InspectState;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelState;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelState;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto;
|
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto;
|
||||||
@@ -294,14 +295,14 @@ public class LabelWorkRepositoryImpl implements LabelWorkRepositoryCustom {
|
|||||||
|
|
||||||
if (searchReq.getSearchVal() != null && !searchReq.getSearchVal().isEmpty()) {
|
if (searchReq.getSearchVal() != null && !searchReq.getSearchVal().isEmpty()) {
|
||||||
whereSubBuilder.and(
|
whereSubBuilder.and(
|
||||||
Expressions.stringTemplate("{0}", memberEntity.userId)
|
Expressions.stringTemplate("{0}", memberEntity.employeeNo)
|
||||||
.likeIgnoreCase("%" + searchReq.getSearchVal() + "%")
|
.likeIgnoreCase("%" + searchReq.getSearchVal() + "%")
|
||||||
.or(
|
.or(
|
||||||
Expressions.stringTemplate("{0}", memberEntity.name)
|
Expressions.stringTemplate("{0}", memberEntity.name)
|
||||||
.likeIgnoreCase("%" + searchReq.getSearchVal() + "%")));
|
.likeIgnoreCase("%" + searchReq.getSearchVal() + "%")));
|
||||||
}
|
}
|
||||||
|
|
||||||
whereSubBuilder.and(labelingAssignmentEntity.workerUid.eq(memberEntity.userId));
|
whereSubBuilder.and(labelingAssignmentEntity.workerUid.eq(memberEntity.employeeNo));
|
||||||
|
|
||||||
// 공통 조건 추출
|
// 공통 조건 추출
|
||||||
BooleanExpression doneStateCondition =
|
BooleanExpression doneStateCondition =
|
||||||
@@ -344,7 +345,7 @@ public class LabelWorkRepositoryImpl implements LabelWorkRepositoryCustom {
|
|||||||
WorkerState.class,
|
WorkerState.class,
|
||||||
memberEntity.userRole,
|
memberEntity.userRole,
|
||||||
memberEntity.name,
|
memberEntity.name,
|
||||||
memberEntity.userId,
|
memberEntity.employeeNo,
|
||||||
assignedCnt.as("assignedCnt"),
|
assignedCnt.as("assignedCnt"),
|
||||||
doneCnt.as("doneCnt"),
|
doneCnt.as("doneCnt"),
|
||||||
skipCnt.as("skipCnt"),
|
skipCnt.as("skipCnt"),
|
||||||
@@ -363,7 +364,10 @@ public class LabelWorkRepositoryImpl implements LabelWorkRepositoryCustom {
|
|||||||
.on(whereSubBuilder)
|
.on(whereSubBuilder)
|
||||||
.where(whereBuilder)
|
.where(whereBuilder)
|
||||||
.groupBy(
|
.groupBy(
|
||||||
memberEntity.userRole, memberEntity.name, memberEntity.userId, memberEntity.status)
|
memberEntity.userRole,
|
||||||
|
memberEntity.name,
|
||||||
|
memberEntity.employeeNo,
|
||||||
|
memberEntity.status)
|
||||||
.orderBy(orderSpecifiers.toArray(new OrderSpecifier[0]))
|
.orderBy(orderSpecifiers.toArray(new OrderSpecifier[0]))
|
||||||
.offset(pageable.getOffset())
|
.offset(pageable.getOffset())
|
||||||
.limit(pageable.getPageSize())
|
.limit(pageable.getPageSize())
|
||||||
@@ -441,14 +445,14 @@ public class LabelWorkRepositoryImpl implements LabelWorkRepositoryCustom {
|
|||||||
|
|
||||||
if (searchReq.getSearchVal() != null && !searchReq.getSearchVal().isEmpty()) {
|
if (searchReq.getSearchVal() != null && !searchReq.getSearchVal().isEmpty()) {
|
||||||
whereSubBuilder.and(
|
whereSubBuilder.and(
|
||||||
Expressions.stringTemplate("{0}", memberEntity.userId)
|
Expressions.stringTemplate("{0}", memberEntity.employeeNo)
|
||||||
.likeIgnoreCase("%" + searchReq.getSearchVal() + "%")
|
.likeIgnoreCase("%" + searchReq.getSearchVal() + "%")
|
||||||
.or(
|
.or(
|
||||||
Expressions.stringTemplate("{0}", memberEntity.name)
|
Expressions.stringTemplate("{0}", memberEntity.name)
|
||||||
.likeIgnoreCase("%" + searchReq.getSearchVal() + "%")));
|
.likeIgnoreCase("%" + searchReq.getSearchVal() + "%")));
|
||||||
}
|
}
|
||||||
|
|
||||||
whereSubBuilder.and(labelingAssignmentEntity.inspectorUid.eq(memberEntity.userId));
|
whereSubBuilder.and(labelingAssignmentEntity.inspectorUid.eq(memberEntity.employeeNo));
|
||||||
|
|
||||||
// 공통 조건 추출
|
// 공통 조건 추출
|
||||||
BooleanExpression doneStateCondition =
|
BooleanExpression doneStateCondition =
|
||||||
@@ -492,7 +496,7 @@ public class LabelWorkRepositoryImpl implements LabelWorkRepositoryCustom {
|
|||||||
WorkerState.class,
|
WorkerState.class,
|
||||||
memberEntity.userRole,
|
memberEntity.userRole,
|
||||||
memberEntity.name,
|
memberEntity.name,
|
||||||
memberEntity.userId,
|
memberEntity.employeeNo,
|
||||||
assignedCnt.as("assignedCnt"),
|
assignedCnt.as("assignedCnt"),
|
||||||
doneCnt.as("doneCnt"),
|
doneCnt.as("doneCnt"),
|
||||||
skipCnt.as("skipCnt"),
|
skipCnt.as("skipCnt"),
|
||||||
@@ -511,7 +515,10 @@ public class LabelWorkRepositoryImpl implements LabelWorkRepositoryCustom {
|
|||||||
.on(whereSubBuilder)
|
.on(whereSubBuilder)
|
||||||
.where(whereBuilder)
|
.where(whereBuilder)
|
||||||
.groupBy(
|
.groupBy(
|
||||||
memberEntity.userRole, memberEntity.name, memberEntity.userId, memberEntity.status)
|
memberEntity.userRole,
|
||||||
|
memberEntity.name,
|
||||||
|
memberEntity.employeeNo,
|
||||||
|
memberEntity.status)
|
||||||
.orderBy(orderSpecifiers.toArray(new OrderSpecifier[0]))
|
.orderBy(orderSpecifiers.toArray(new OrderSpecifier[0]))
|
||||||
.offset(pageable.getOffset())
|
.offset(pageable.getOffset())
|
||||||
.limit(pageable.getPageSize())
|
.limit(pageable.getPageSize())
|
||||||
@@ -549,7 +556,19 @@ public class LabelWorkRepositoryImpl implements LabelWorkRepositoryCustom {
|
|||||||
@Override
|
@Override
|
||||||
public LabelWorkMngDetail findLabelWorkMngDetail(UUID uuid) {
|
public LabelWorkMngDetail findLabelWorkMngDetail(UUID uuid) {
|
||||||
|
|
||||||
NumberExpression<Long> labelTotCnt = mapSheetAnalDataInferenceGeomEntity.geoUid.count();
|
NumberExpression<Long> labelTotCnt =
|
||||||
|
new CaseBuilder()
|
||||||
|
// .when(mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull())
|
||||||
|
.when(
|
||||||
|
mapSheetAnalDataInferenceGeomEntity
|
||||||
|
.pnu
|
||||||
|
.gt(0)
|
||||||
|
.and(
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.fitState.eq(
|
||||||
|
ImageryFitStatus.UNFIT.getId())))
|
||||||
|
.then(1L)
|
||||||
|
.otherwise(0L)
|
||||||
|
.sum();
|
||||||
NumberExpression<Long> labelerCnt = labelingAssignmentEntity.workerUid.count();
|
NumberExpression<Long> labelerCnt = labelingAssignmentEntity.workerUid.count();
|
||||||
NumberExpression<Long> reviewerCnt = labelingAssignmentEntity.inspectorUid.count();
|
NumberExpression<Long> reviewerCnt = labelingAssignmentEntity.inspectorUid.count();
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ 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.BooleanExpression;
|
||||||
import com.querydsl.core.types.dsl.Expressions;
|
import com.querydsl.core.types.dsl.Expressions;
|
||||||
|
import com.querydsl.core.types.dsl.NumberExpression;
|
||||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -92,6 +93,10 @@ public class MapLayerRepositoryImpl implements MapLayerRepositoryCustom {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<LayerMapDto> findLayerMapList(String type) {
|
public List<LayerMapDto> findLayerMapList(String type) {
|
||||||
|
NumberExpression<Integer> crsInt =
|
||||||
|
Expressions.numberTemplate(
|
||||||
|
Integer.class, "cast(replace({0}, 'EPSG_', '') as integer)", mapLayerEntity.crs);
|
||||||
|
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.select(
|
.select(
|
||||||
Projections.constructor(
|
Projections.constructor(
|
||||||
@@ -107,13 +112,15 @@ public class MapLayerRepositoryImpl implements MapLayerRepositoryCustom {
|
|||||||
mapLayerEntity.minZoom,
|
mapLayerEntity.minZoom,
|
||||||
mapLayerEntity.maxZoom,
|
mapLayerEntity.maxZoom,
|
||||||
Expressions.stringTemplate(
|
Expressions.stringTemplate(
|
||||||
"ST_AsGeoJSON(ST_MakeEnvelope({0}, {1}, {2}, {3}, 4326))",
|
"ST_AsGeoJSON(ST_Transform(ST_MakeEnvelope({0}, {1}, {2}, {3}, 4326), {4}))",
|
||||||
mapLayerEntity.minLon,
|
mapLayerEntity.minLon,
|
||||||
mapLayerEntity.minLat,
|
mapLayerEntity.minLat,
|
||||||
mapLayerEntity.maxLon,
|
mapLayerEntity.maxLon,
|
||||||
mapLayerEntity.maxLat),
|
mapLayerEntity.maxLat,
|
||||||
|
crsInt),
|
||||||
mapLayerEntity.uuid,
|
mapLayerEntity.uuid,
|
||||||
Expressions.stringTemplate("cast({0} as text)", mapLayerEntity.rawJson)))
|
Expressions.stringTemplate("cast({0} as text)", mapLayerEntity.rawJson),
|
||||||
|
mapLayerEntity.crs))
|
||||||
.from(mapLayerEntity)
|
.from(mapLayerEntity)
|
||||||
.where(layerTypeCondition(type), mapLayerEntity.isDeleted.isFalse())
|
.where(layerTypeCondition(type), mapLayerEntity.isDeleted.isFalse())
|
||||||
.orderBy(mapLayerEntity.order.asc())
|
.orderBy(mapLayerEntity.order.asc())
|
||||||
@@ -122,6 +129,10 @@ public class MapLayerRepositoryImpl implements MapLayerRepositoryCustom {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LayerDto.YearTileDto getChangeDetectionTileUrl(Integer beforeYear, Integer afterYear) {
|
public LayerDto.YearTileDto getChangeDetectionTileUrl(Integer beforeYear, Integer afterYear) {
|
||||||
|
NumberExpression<Integer> crsInt =
|
||||||
|
Expressions.numberTemplate(
|
||||||
|
Integer.class, "cast(replace({0}, 'EPSG_', '') as integer)", mapSheetMngTileEntity.crs);
|
||||||
|
|
||||||
LayerDto.TileUrlDto before =
|
LayerDto.TileUrlDto before =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(
|
.select(
|
||||||
@@ -137,11 +148,13 @@ public class MapLayerRepositoryImpl implements MapLayerRepositoryCustom {
|
|||||||
mapSheetMngTileEntity.minZoom,
|
mapSheetMngTileEntity.minZoom,
|
||||||
mapSheetMngTileEntity.maxZoom,
|
mapSheetMngTileEntity.maxZoom,
|
||||||
Expressions.stringTemplate(
|
Expressions.stringTemplate(
|
||||||
"ST_AsGeoJSON(ST_MakeEnvelope({0}, {1}, {2}, {3}, 4326))",
|
"ST_AsGeoJSON(ST_Transform(ST_MakeEnvelope({0}, {1}, {2}, {3}, 4326), {4}))",
|
||||||
mapSheetMngTileEntity.minLon,
|
mapSheetMngTileEntity.minLon,
|
||||||
mapSheetMngTileEntity.minLat,
|
mapSheetMngTileEntity.minLat,
|
||||||
mapSheetMngTileEntity.maxLon,
|
mapSheetMngTileEntity.maxLon,
|
||||||
mapSheetMngTileEntity.maxLat)))
|
mapSheetMngTileEntity.maxLat,
|
||||||
|
crsInt),
|
||||||
|
mapSheetMngTileEntity.crs))
|
||||||
.from(mapSheetMngTileEntity)
|
.from(mapSheetMngTileEntity)
|
||||||
.where(mapSheetMngTileEntity.mngYyyy.eq(beforeYear))
|
.where(mapSheetMngTileEntity.mngYyyy.eq(beforeYear))
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
@@ -161,11 +174,13 @@ public class MapLayerRepositoryImpl implements MapLayerRepositoryCustom {
|
|||||||
mapSheetMngTileEntity.minZoom,
|
mapSheetMngTileEntity.minZoom,
|
||||||
mapSheetMngTileEntity.maxZoom,
|
mapSheetMngTileEntity.maxZoom,
|
||||||
Expressions.stringTemplate(
|
Expressions.stringTemplate(
|
||||||
"ST_AsGeoJSON(ST_MakeEnvelope({0}, {1}, {2}, {3}, 4326))",
|
"ST_AsGeoJSON(ST_Transform(ST_MakeEnvelope({0}, {1}, {2}, {3}, 4326), {4}))",
|
||||||
mapSheetMngTileEntity.minLon,
|
mapSheetMngTileEntity.minLon,
|
||||||
mapSheetMngTileEntity.minLat,
|
mapSheetMngTileEntity.minLat,
|
||||||
mapSheetMngTileEntity.maxLon,
|
mapSheetMngTileEntity.maxLon,
|
||||||
mapSheetMngTileEntity.maxLat)))
|
mapSheetMngTileEntity.maxLat,
|
||||||
|
crsInt),
|
||||||
|
mapSheetMngTileEntity.crs))
|
||||||
.from(mapSheetMngTileEntity)
|
.from(mapSheetMngTileEntity)
|
||||||
.where(mapSheetMngTileEntity.mngYyyy.eq(afterYear))
|
.where(mapSheetMngTileEntity.mngYyyy.eq(afterYear))
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
@@ -175,6 +190,10 @@ public class MapLayerRepositoryImpl implements MapLayerRepositoryCustom {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileUrlDto getChangeDetectionTileOneYearUrl(Integer year) {
|
public TileUrlDto getChangeDetectionTileOneYearUrl(Integer year) {
|
||||||
|
NumberExpression<Integer> crsInt =
|
||||||
|
Expressions.numberTemplate(
|
||||||
|
Integer.class, "cast(replace({0}, 'EPSG_', '') as integer)", mapSheetMngTileEntity.crs);
|
||||||
|
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.select(
|
.select(
|
||||||
Projections.constructor(
|
Projections.constructor(
|
||||||
@@ -189,11 +208,13 @@ public class MapLayerRepositoryImpl implements MapLayerRepositoryCustom {
|
|||||||
mapSheetMngTileEntity.minZoom,
|
mapSheetMngTileEntity.minZoom,
|
||||||
mapSheetMngTileEntity.maxZoom,
|
mapSheetMngTileEntity.maxZoom,
|
||||||
Expressions.stringTemplate(
|
Expressions.stringTemplate(
|
||||||
"ST_AsGeoJSON(ST_MakeEnvelope({0}, {1}, {2}, {3}, 4326))",
|
"ST_AsGeoJSON(ST_Transform(ST_MakeEnvelope({0}, {1}, {2}, {3}, 4326), {4}))",
|
||||||
mapSheetMngTileEntity.minLon,
|
mapSheetMngTileEntity.minLon,
|
||||||
mapSheetMngTileEntity.minLat,
|
mapSheetMngTileEntity.minLat,
|
||||||
mapSheetMngTileEntity.maxLon,
|
mapSheetMngTileEntity.maxLon,
|
||||||
mapSheetMngTileEntity.maxLat)))
|
mapSheetMngTileEntity.maxLat,
|
||||||
|
crsInt),
|
||||||
|
mapSheetMngTileEntity.crs))
|
||||||
.from(mapSheetMngTileEntity)
|
.from(mapSheetMngTileEntity)
|
||||||
.where(mapSheetMngTileEntity.mngYyyy.eq(year))
|
.where(mapSheetMngTileEntity.mngYyyy.eq(year))
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
.on(mapSheetMngEntity.mngYyyy.eq(mapSheetMngHstEntity.mngYyyy))
|
.on(mapSheetMngEntity.mngYyyy.eq(mapSheetMngHstEntity.mngYyyy))
|
||||||
.leftJoin(mapInkx5kEntity)
|
.leftJoin(mapInkx5kEntity)
|
||||||
.on(mapSheetMngHstEntity.mapSheetNum.eq(mapInkx5kEntity.mapidcdNo))
|
.on(mapSheetMngHstEntity.mapSheetNum.eq(mapInkx5kEntity.mapidcdNo))
|
||||||
.where(whereBuilder)
|
.where(mapInkx5kEntity.useInference.eq(CommonUseStatus.USE))
|
||||||
// .offset(pageable.getOffset())
|
// .offset(pageable.getOffset())
|
||||||
// .limit(pageable.getPageSize())
|
// .limit(pageable.getPageSize())
|
||||||
.orderBy(mapSheetMngEntity.mngYyyy.desc())
|
.orderBy(mapSheetMngEntity.mngYyyy.desc())
|
||||||
@@ -254,7 +254,9 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
public MapSheetMngDto.MngDto findMapSheetMng(int mngYyyy) {
|
public MapSheetMngDto.MngDto findMapSheetMng(int mngYyyy) {
|
||||||
|
|
||||||
BooleanBuilder whereBuilder = new BooleanBuilder();
|
BooleanBuilder whereBuilder = new BooleanBuilder();
|
||||||
whereBuilder.and(mapSheetMngEntity.mngYyyy.eq(mngYyyy));
|
whereBuilder
|
||||||
|
.and(mapSheetMngEntity.mngYyyy.eq(mngYyyy))
|
||||||
|
.and(mapInkx5kEntity.useInference.eq(CommonUseStatus.USE));
|
||||||
|
|
||||||
MapSheetMngDto.MngDto foundContent =
|
MapSheetMngDto.MngDto foundContent =
|
||||||
queryFactory
|
queryFactory
|
||||||
@@ -1056,7 +1058,8 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
mapSheetMngTileEntity.maxLat,
|
mapSheetMngTileEntity.maxLat,
|
||||||
mapSheetMngTileEntity.minZoom,
|
mapSheetMngTileEntity.minZoom,
|
||||||
mapSheetMngTileEntity.maxZoom,
|
mapSheetMngTileEntity.maxZoom,
|
||||||
mapSheetMngTileEntity.tag)
|
mapSheetMngTileEntity.tag,
|
||||||
|
mapSheetMngTileEntity.crs)
|
||||||
.values(
|
.values(
|
||||||
addReq.getMngYyyy(),
|
addReq.getMngYyyy(),
|
||||||
addReq.getUrl(),
|
addReq.getUrl(),
|
||||||
@@ -1066,7 +1069,8 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
addReq.getMaxLat(),
|
addReq.getMaxLat(),
|
||||||
addReq.getMinZoom(),
|
addReq.getMinZoom(),
|
||||||
addReq.getMaxZoom(),
|
addReq.getMaxZoom(),
|
||||||
addReq.getTag())
|
addReq.getTag(),
|
||||||
|
addReq.getCrs())
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.repository.scheduler;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.LabelingInspectorEntity;
|
||||||
|
import jakarta.persistence.LockModeType;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.Lock;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
|
||||||
|
public interface TrainingDataLabelJobRepository
|
||||||
|
extends JpaRepository<LabelingInspectorEntity, UUID>, TrainingDataLabelJobRepositoryCustom {
|
||||||
|
|
||||||
|
@Lock(LockModeType.PESSIMISTIC_WRITE)
|
||||||
|
@Query(
|
||||||
|
"""
|
||||||
|
select r
|
||||||
|
from LabelingInspectorEntity r
|
||||||
|
where r.analUid = :analUid
|
||||||
|
and r.inspectorUid in :inspectorUids
|
||||||
|
""")
|
||||||
|
List<LabelingInspectorEntity> lockInspectors(Long analUid, List<String> inspectorUids);
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.repository.scheduler;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.InspectorPendingDto;
|
||||||
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.Tasks;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public interface TrainingDataLabelJobRepositoryCustom {
|
||||||
|
|
||||||
|
List<Tasks> findCompletedYesterdayUnassigned();
|
||||||
|
|
||||||
|
List<InspectorPendingDto> findInspectorPendingByRound(Long analUid);
|
||||||
|
|
||||||
|
void assignReviewerBatch(List<UUID> assignmentUids, String reviewerId);
|
||||||
|
|
||||||
|
void updateGeomUidTestState(List<Long> geomUids);
|
||||||
|
}
|
||||||
@@ -0,0 +1,119 @@
|
|||||||
|
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.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.LabelState;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
|
||||||
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.InspectorPendingDto;
|
||||||
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.Tasks;
|
||||||
|
import com.querydsl.core.types.Projections;
|
||||||
|
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||||
|
import com.querydsl.core.types.dsl.Expressions;
|
||||||
|
import com.querydsl.core.types.dsl.StringExpression;
|
||||||
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public class TrainingDataLabelJobRepositoryImpl extends QuerydslRepositorySupport
|
||||||
|
implements TrainingDataLabelJobRepositoryCustom {
|
||||||
|
|
||||||
|
private final JPAQueryFactory queryFactory;
|
||||||
|
private final StringExpression NULL_STRING = Expressions.stringTemplate("cast(null as text)");
|
||||||
|
|
||||||
|
public TrainingDataLabelJobRepositoryImpl(JPAQueryFactory queryFactory) {
|
||||||
|
super(LabelingAssignmentEntity.class);
|
||||||
|
this.queryFactory = queryFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Tasks> findCompletedYesterdayUnassigned() {
|
||||||
|
ZoneId zone = ZoneId.of("Asia/Seoul");
|
||||||
|
ZonedDateTime todayStart = ZonedDateTime.now(zone).toLocalDate().atStartOfDay(zone);
|
||||||
|
ZonedDateTime yesterdayStart = todayStart.minusDays(1);
|
||||||
|
|
||||||
|
BooleanExpression isYesterday =
|
||||||
|
labelingAssignmentEntity
|
||||||
|
.workStatDttm
|
||||||
|
.goe(yesterdayStart)
|
||||||
|
.and(labelingAssignmentEntity.workStatDttm.lt(todayStart));
|
||||||
|
|
||||||
|
return queryFactory
|
||||||
|
.select(
|
||||||
|
Projections.constructor(
|
||||||
|
Tasks.class,
|
||||||
|
labelingAssignmentEntity.assignmentUid,
|
||||||
|
labelingAssignmentEntity.inferenceGeomUid,
|
||||||
|
labelingAssignmentEntity.analUid))
|
||||||
|
.from(labelingAssignmentEntity)
|
||||||
|
.where(
|
||||||
|
labelingAssignmentEntity.workState.in(LabelState.SKIP.getId(), LabelState.DONE.getId()),
|
||||||
|
labelingAssignmentEntity.inspectorUid.isNull(),
|
||||||
|
isYesterday)
|
||||||
|
.orderBy(
|
||||||
|
labelingAssignmentEntity.analUid.asc(),
|
||||||
|
labelingAssignmentEntity.assignGroupId.asc(),
|
||||||
|
labelingAssignmentEntity.inferenceGeomUid.asc())
|
||||||
|
.fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 해당 회차에 라벨링 할당받은 검수자별 완료 건수 count(), 완료한 게 적은 순으로 해야 일이 한 사람에게 몰리지 않음
|
||||||
|
*
|
||||||
|
* @param analUid
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<InspectorPendingDto> findInspectorPendingByRound(Long analUid) {
|
||||||
|
return queryFactory
|
||||||
|
.select(
|
||||||
|
Projections.constructor(
|
||||||
|
InspectorPendingDto.class,
|
||||||
|
labelingInspectorEntity.inspectorUid,
|
||||||
|
labelingAssignmentEntity.assignmentUid.count()))
|
||||||
|
.from(labelingInspectorEntity)
|
||||||
|
.leftJoin(labelingAssignmentEntity)
|
||||||
|
.on(
|
||||||
|
labelingInspectorEntity.inspectorUid.eq(labelingAssignmentEntity.inspectorUid),
|
||||||
|
labelingAssignmentEntity.inspectState.in(
|
||||||
|
InspectState.EXCEPT.getId(), InspectState.COMPLETE.getId()))
|
||||||
|
.where(labelingInspectorEntity.analUid.eq(analUid))
|
||||||
|
.groupBy(labelingInspectorEntity.inspectorUid)
|
||||||
|
.orderBy(labelingAssignmentEntity.assignmentUid.count().asc())
|
||||||
|
.fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 배치용 여러 건 update
|
||||||
|
*
|
||||||
|
* @param assignmentUids
|
||||||
|
* @param reviewerId
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void assignReviewerBatch(List<UUID> assignmentUids, String reviewerId) {
|
||||||
|
queryFactory
|
||||||
|
.update(labelingAssignmentEntity)
|
||||||
|
.set(labelingAssignmentEntity.inspectorUid, reviewerId)
|
||||||
|
.set(labelingAssignmentEntity.inspectState, InspectState.UNCONFIRM.getId())
|
||||||
|
.set(labelingAssignmentEntity.modifiedDate, ZonedDateTime.now())
|
||||||
|
.where(labelingAssignmentEntity.assignmentUid.in(assignmentUids))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
@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,25 +3,10 @@ package com.kamco.cd.kamcoback.postgres.repository.scheduler;
|
|||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalCntInfo;
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalCntInfo;
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalMapSheetList;
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalMapSheetList;
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.CompleteLabelData;
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.CompleteLabelData;
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.InspectorPendingDto;
|
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.Tasks;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public interface TrainingDataReviewJobRepositoryCustom {
|
public interface TrainingDataReviewJobRepositoryCustom {
|
||||||
|
|
||||||
List<Tasks> findCompletedYesterdayUnassigned();
|
|
||||||
|
|
||||||
List<InspectorPendingDto> findInspectorPendingByRound(Long analUid);
|
|
||||||
|
|
||||||
void assignReviewer(UUID assignmentUid, String reviewerId);
|
|
||||||
|
|
||||||
void assignReviewerBatch(List<UUID> assignmentUids, String reviewerId);
|
|
||||||
|
|
||||||
Tasks findAssignmentTask(String assignmentUid);
|
|
||||||
|
|
||||||
void updateGeomUidTestState(List<Long> geomUids);
|
|
||||||
|
|
||||||
List<CompleteLabelData> findCompletedYesterdayLabelingList(Long analUid, String mapSheetNum);
|
List<CompleteLabelData> findCompletedYesterdayLabelingList(Long analUid, String mapSheetNum);
|
||||||
|
|
||||||
List<AnalMapSheetList> findCompletedAnalMapSheetList(Long analUid);
|
List<AnalMapSheetList> findCompletedAnalMapSheetList(Long analUid);
|
||||||
|
|||||||
@@ -1,24 +1,18 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.repository.scheduler;
|
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.QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity;
|
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalInferenceEntity.mapSheetAnalInferenceEntity;
|
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.QMapSheetLearnEntity.mapSheetLearnEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity.mapSheetLearnEntity;
|
||||||
|
|
||||||
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.LabelMngState;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelState;
|
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalCntInfo;
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalCntInfo;
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalMapSheetList;
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalMapSheetList;
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.CompleteLabelData;
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.CompleteLabelData;
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.CompleteLabelData.Properties;
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.CompleteLabelData.Properties;
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.InspectorPendingDto;
|
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.Tasks;
|
|
||||||
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;
|
||||||
@@ -29,9 +23,10 @@ import java.time.LocalDate;
|
|||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
|
||||||
import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport;
|
import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
public class TrainingDataReviewJobRepositoryImpl extends QuerydslRepositorySupport
|
public class TrainingDataReviewJobRepositoryImpl extends QuerydslRepositorySupport
|
||||||
implements TrainingDataReviewJobRepositoryCustom {
|
implements TrainingDataReviewJobRepositoryCustom {
|
||||||
|
|
||||||
@@ -43,121 +38,6 @@ public class TrainingDataReviewJobRepositoryImpl extends QuerydslRepositorySuppo
|
|||||||
this.queryFactory = queryFactory;
|
this.queryFactory = queryFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Tasks> findCompletedYesterdayUnassigned() {
|
|
||||||
ZoneId zone = ZoneId.of("Asia/Seoul");
|
|
||||||
ZonedDateTime todayStart = ZonedDateTime.now(zone).toLocalDate().atStartOfDay(zone);
|
|
||||||
ZonedDateTime yesterdayStart = todayStart.minusDays(1);
|
|
||||||
|
|
||||||
BooleanExpression isYesterday =
|
|
||||||
labelingAssignmentEntity
|
|
||||||
.workStatDttm
|
|
||||||
.goe(yesterdayStart)
|
|
||||||
.and(labelingAssignmentEntity.workStatDttm.lt(todayStart));
|
|
||||||
|
|
||||||
return queryFactory
|
|
||||||
.select(
|
|
||||||
Projections.constructor(
|
|
||||||
Tasks.class,
|
|
||||||
labelingAssignmentEntity.assignmentUid,
|
|
||||||
labelingAssignmentEntity.inferenceGeomUid,
|
|
||||||
labelingAssignmentEntity.analUid))
|
|
||||||
.from(labelingAssignmentEntity)
|
|
||||||
.where(
|
|
||||||
labelingAssignmentEntity.workState.in(LabelState.SKIP.getId(), LabelState.DONE.getId()),
|
|
||||||
labelingAssignmentEntity.inspectorUid.isNull(),
|
|
||||||
isYesterday)
|
|
||||||
.orderBy(
|
|
||||||
labelingAssignmentEntity.analUid.asc(),
|
|
||||||
labelingAssignmentEntity.assignGroupId.asc(),
|
|
||||||
labelingAssignmentEntity.inferenceGeomUid.asc())
|
|
||||||
.fetch();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 해당 회차에 라벨링 할당받은 검수자별 완료 건수 count(), 완료한 게 적은 순으로 해야 일이 한 사람에게 몰리지 않음
|
|
||||||
*
|
|
||||||
* @param analUid
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<InspectorPendingDto> findInspectorPendingByRound(Long analUid) {
|
|
||||||
return queryFactory
|
|
||||||
.select(
|
|
||||||
Projections.constructor(
|
|
||||||
InspectorPendingDto.class,
|
|
||||||
labelingInspectorEntity.inspectorUid,
|
|
||||||
labelingAssignmentEntity.assignmentUid.count()))
|
|
||||||
.from(labelingInspectorEntity)
|
|
||||||
.leftJoin(labelingAssignmentEntity)
|
|
||||||
.on(
|
|
||||||
labelingInspectorEntity.inspectorUid.eq(labelingAssignmentEntity.inspectorUid),
|
|
||||||
labelingAssignmentEntity.inspectState.in(
|
|
||||||
InspectState.EXCEPT.getId(), InspectState.COMPLETE.getId()))
|
|
||||||
.where(labelingInspectorEntity.analUid.eq(analUid))
|
|
||||||
.groupBy(labelingInspectorEntity.inspectorUid)
|
|
||||||
.orderBy(labelingAssignmentEntity.assignmentUid.count().asc())
|
|
||||||
.fetch();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 실시간 분배용 1건 update
|
|
||||||
*
|
|
||||||
* @param assignmentUid
|
|
||||||
* @param reviewerId
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void assignReviewer(UUID assignmentUid, String reviewerId) {
|
|
||||||
queryFactory
|
|
||||||
.update(labelingAssignmentEntity)
|
|
||||||
.set(labelingAssignmentEntity.inspectorUid, reviewerId)
|
|
||||||
.set(labelingAssignmentEntity.inspectState, InspectState.UNCONFIRM.getId())
|
|
||||||
.set(labelingAssignmentEntity.modifiedDate, ZonedDateTime.now())
|
|
||||||
.where(labelingAssignmentEntity.assignmentUid.eq(assignmentUid))
|
|
||||||
.execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 배치용 여러 건 update
|
|
||||||
*
|
|
||||||
* @param assignmentUids
|
|
||||||
* @param reviewerId
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void assignReviewerBatch(List<UUID> assignmentUids, String reviewerId) {
|
|
||||||
queryFactory
|
|
||||||
.update(labelingAssignmentEntity)
|
|
||||||
.set(labelingAssignmentEntity.inspectorUid, reviewerId)
|
|
||||||
.set(labelingAssignmentEntity.inspectState, InspectState.UNCONFIRM.getId())
|
|
||||||
.set(labelingAssignmentEntity.modifiedDate, ZonedDateTime.now())
|
|
||||||
.where(labelingAssignmentEntity.assignmentUid.in(assignmentUids))
|
|
||||||
.execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Tasks findAssignmentTask(String assignmentUid) {
|
|
||||||
return queryFactory
|
|
||||||
.select(
|
|
||||||
Projections.constructor(
|
|
||||||
Tasks.class,
|
|
||||||
labelingAssignmentEntity.assignmentUid,
|
|
||||||
labelingAssignmentEntity.inferenceGeomUid,
|
|
||||||
labelingAssignmentEntity.analUid))
|
|
||||||
.from(labelingAssignmentEntity)
|
|
||||||
.where(labelingAssignmentEntity.assignmentUid.eq(UUID.fromString(assignmentUid)))
|
|
||||||
.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();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CompleteLabelData> findCompletedYesterdayLabelingList(
|
public List<CompleteLabelData> findCompletedYesterdayLabelingList(
|
||||||
Long analUid, String mapSheetNum) {
|
Long analUid, String mapSheetNum) {
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package com.kamco.cd.kamcoback.scheduler.service;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GeomUidDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.service.GukYuinApiService;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.core.GukYuinLabelJobCoreService;
|
||||||
|
import java.util.List;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Log4j2
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class GukYuinApiLabelJobService {
|
||||||
|
|
||||||
|
private final GukYuinLabelJobCoreService gukYuinLabelJobCoreService;
|
||||||
|
private final GukYuinApiService gukYuinApiService;
|
||||||
|
|
||||||
|
@Value("${spring.profiles.active}")
|
||||||
|
private String profile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 실행중인 profile
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private boolean isLocalProfile() {
|
||||||
|
return "local".equalsIgnoreCase(profile);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 어제 라벨링 검수 완료된 것 -> 국유인에 전송 */
|
||||||
|
@Scheduled(cron = "0 0 2 * * *")
|
||||||
|
public void findLabelingCompleteSend() {
|
||||||
|
if (isLocalProfile()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<GeomUidDto> list = gukYuinLabelJobCoreService.findYesterdayLabelingCompleteList();
|
||||||
|
if (list.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (GeomUidDto gto : list) {
|
||||||
|
ChngDetectContDto.ResultLabelDto dto =
|
||||||
|
gukYuinApiService.updateChnDtctObjtLabelingYn(gto.getResultUid(), "Y");
|
||||||
|
if (dto.getSuccess()) {
|
||||||
|
// inference_geom 에 label_send_dttm 업데이트 하기
|
||||||
|
gukYuinLabelJobCoreService.updateAnalDataInferenceGeomSendDttm(gto.getGeoUid());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
package com.kamco.cd.kamcoback.scheduler.service;
|
package com.kamco.cd.kamcoback.scheduler.service;
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.ContBasic;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.ResultContDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.ResultContDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ResultDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ResultDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.service.GukYuinApiService;
|
import com.kamco.cd.kamcoback.gukyuin.service.GukYuinApiService;
|
||||||
import com.kamco.cd.kamcoback.postgres.core.GukYuinJobCoreService;
|
import com.kamco.cd.kamcoback.postgres.core.GukYuinPnuJobCoreService;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
@@ -18,10 +18,10 @@ import org.springframework.stereotype.Service;
|
|||||||
@Log4j2
|
@Log4j2
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class GukYuinApiJobService {
|
public class GukYuinApiPnuJobService {
|
||||||
|
|
||||||
|
private final GukYuinPnuJobCoreService gukYuinPnuJobCoreService;
|
||||||
private final GukYuinApiService gukYuinApiService;
|
private final GukYuinApiService gukYuinApiService;
|
||||||
private final GukYuinJobCoreService gukYuinJobCoreService;
|
|
||||||
|
|
||||||
@Value("${spring.profiles.active}")
|
@Value("${spring.profiles.active}")
|
||||||
private String profile;
|
private String profile;
|
||||||
@@ -35,41 +35,7 @@ public class GukYuinApiJobService {
|
|||||||
return "local".equalsIgnoreCase(profile);
|
return "local".equalsIgnoreCase(profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Scheduled(cron = "0 * * * * *") // 0 0/10 * * * *
|
/** 국유인 등록 완료 후, 탐지객체 조회해서 PNU 업데이트 하는 스케줄링 하루 1번 새벽 1시에 실행 */
|
||||||
public void findGukYuinMastCompleteYn() {
|
|
||||||
// if (isLocalProfile()) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
List<LearnKeyDto> list =
|
|
||||||
gukYuinJobCoreService.findGukyuinApplyStatusUidList(GukYuinStatus.IN_PROGRESS);
|
|
||||||
if (list.isEmpty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (LearnKeyDto dto : list) {
|
|
||||||
try {
|
|
||||||
ResultDto result = gukYuinApiService.detail(dto.getChnDtctMstId());
|
|
||||||
|
|
||||||
if (result == null || result.getResult() == null || result.getResult().isEmpty()) {
|
|
||||||
log.warn("[GUKYUIN] empty result chnDtctMstId={}", dto.getChnDtctMstId());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
ChngDetectMastDto.Basic basic = result.getResult().get(0);
|
|
||||||
|
|
||||||
Integer progress =
|
|
||||||
basic.getExcnPgrt() == null ? null : Integer.parseInt(basic.getExcnPgrt().trim());
|
|
||||||
if (progress != null && progress == 100) {
|
|
||||||
gukYuinJobCoreService.updateGukYuinApplyStateComplete(
|
|
||||||
dto.getId(), GukYuinStatus.GUK_COMPLETED);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("[GUKYUIN] failed uid={}", dto.getChnDtctMstId(), e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Scheduled(cron = "0 0 1 * * *")
|
@Scheduled(cron = "0 0 1 * * *")
|
||||||
public void findGukYuinContListPnuUpdate() {
|
public void findGukYuinContListPnuUpdate() {
|
||||||
if (isLocalProfile()) {
|
if (isLocalProfile()) {
|
||||||
@@ -77,26 +43,27 @@ public class GukYuinApiJobService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<LearnKeyDto> list =
|
List<LearnKeyDto> list =
|
||||||
gukYuinJobCoreService.findGukyuinApplyStatusUidList(GukYuinStatus.GUK_COMPLETED);
|
gukYuinPnuJobCoreService.findGukyuinApplyStatusUidList(
|
||||||
|
List.of(GukYuinStatus.GUK_COMPLETED.getId(), GukYuinStatus.PNU_FAILED.getId()));
|
||||||
if (list.isEmpty()) {
|
if (list.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (LearnKeyDto dto : list) {
|
for (LearnKeyDto dto : list) {
|
||||||
try {
|
try {
|
||||||
processUid(dto.getChnDtctMstId(), dto.getUid());
|
processUid(dto.getUid(), dto.getUid());
|
||||||
gukYuinJobCoreService.updateGukYuinApplyStateComplete(
|
gukYuinPnuJobCoreService.updateGukYuinApplyStateComplete(
|
||||||
dto.getId(), GukYuinStatus.PNU_COMPLETED);
|
dto.getId(), GukYuinStatus.PNU_COMPLETED);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("[GUKYUIN] failed uid={}", dto.getUid(), e);
|
log.error("[GUKYUIN] failed uid={}", dto.getUid(), e);
|
||||||
gukYuinJobCoreService.updateGukYuinApplyStateComplete(
|
gukYuinPnuJobCoreService.updateGukYuinApplyStateComplete(
|
||||||
dto.getId(), GukYuinStatus.PNU_FAILED);
|
dto.getId(), GukYuinStatus.PNU_FAILED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processUid(String chnDtctMstId, String uid) {
|
private void processUid(String chnDtctId, String uid) {
|
||||||
ResultDto result = gukYuinApiService.detail(chnDtctMstId);
|
ResultDto result = gukYuinApiService.listChnDtctId(chnDtctId);
|
||||||
if (result == null || result.getResult() == null || result.getResult().isEmpty()) {
|
if (result == null || result.getResult() == null || result.getResult().isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -118,19 +85,26 @@ public class GukYuinApiJobService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void processPage(String uid, int page, int pageSize) {
|
private void processPage(String uid, int page, int pageSize) {
|
||||||
ResultContDto cont = gukYuinApiService.findChnContList(uid, page, pageSize);
|
ResultContDto resContList = gukYuinApiService.findChnContList(uid, page, pageSize);
|
||||||
if (cont == null || cont.getResult().isEmpty()) {
|
|
||||||
|
if (resContList.getResult() == null || resContList.getResult().isEmpty()) {
|
||||||
return; // 외부 API 이상 방어
|
return; // 외부 API 이상 방어
|
||||||
}
|
}
|
||||||
|
|
||||||
// pnuList 업데이트
|
List<ContBasic> contList = resContList.getResult();
|
||||||
for (ChngDetectContDto.ContBasic contBasic : cont.getResult()) {
|
for (ContBasic cont : contList) {
|
||||||
if (contBasic.getPnuList() == null) {
|
String[] pnuList = cont.getPnuList();
|
||||||
return;
|
long pnuCnt = pnuList == null ? 0 : pnuList.length;
|
||||||
}
|
if (cont.getChnDtctObjtId() != null) {
|
||||||
|
gukYuinPnuJobCoreService.updateInferenceGeomDataPnuCnt(cont.getChnDtctObjtId(), pnuCnt);
|
||||||
|
|
||||||
gukYuinJobCoreService.upsertMapSheetDataAnalGeomPnu(
|
if (pnuCnt > 0) {
|
||||||
contBasic.getChnDtctObjtId(), contBasic.getPnuList());
|
Long geoUid =
|
||||||
|
gukYuinPnuJobCoreService.findMapSheetAnalDataInferenceGeomUid(
|
||||||
|
cont.getChnDtctObjtId());
|
||||||
|
gukYuinPnuJobCoreService.insertGeoUidPnuData(geoUid, pnuList, cont.getChnDtctObjtId());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
package com.kamco.cd.kamcoback.scheduler.service;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.service.GukYuinApiService;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.core.GukYuinJobCoreService;
|
||||||
|
import java.util.List;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Log4j2
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class GukYuinApiStatusJobService {
|
||||||
|
|
||||||
|
private final GukYuinJobCoreService gukYuinJobCoreService;
|
||||||
|
private final GukYuinApiService gukYuinApiService;
|
||||||
|
|
||||||
|
@Value("${spring.profiles.active}")
|
||||||
|
private String profile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 실행중인 profile
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private boolean isLocalProfile() {
|
||||||
|
return "local".equalsIgnoreCase(profile);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 국유인 연동 후, 100% 되었는지 확인하는 스케줄링 매 10분마다 호출 */
|
||||||
|
@Scheduled(cron = "0 0/10 * * * *")
|
||||||
|
public void findGukYuinMastCompleteYn() {
|
||||||
|
if (isLocalProfile()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<LearnKeyDto> list =
|
||||||
|
gukYuinJobCoreService.findGukyuinApplyStatusUidList(
|
||||||
|
List.of(GukYuinStatus.IN_PROGRESS.getId()));
|
||||||
|
if (list.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (LearnKeyDto dto : list) {
|
||||||
|
try {
|
||||||
|
ChngDetectMastDto.ResultDto result = gukYuinApiService.listChnDtctId(dto.getUid());
|
||||||
|
|
||||||
|
if (result == null || result.getResult() == null || result.getResult().isEmpty()) {
|
||||||
|
log.warn("[GUKYUIN] empty result chnDtctMstId={}", dto.getChnDtctMstId());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
ChngDetectMastDto.Basic basic = result.getResult().getFirst();
|
||||||
|
|
||||||
|
Integer progress =
|
||||||
|
basic.getExcnPgrt() == null ? null : Integer.parseInt(basic.getExcnPgrt().trim());
|
||||||
|
if (progress != null && progress == 100) {
|
||||||
|
gukYuinJobCoreService.updateGukYuinApplyStateComplete(
|
||||||
|
dto.getId(), GukYuinStatus.GUK_COMPLETED);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("[GUKYUIN] failed uid={}", dto.getChnDtctMstId(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
package com.kamco.cd.kamcoback.scheduler.service;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.RlbDtctDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.RlbDtctMastDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.service.GukYuinApiService;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.core.GukYuinStbltJobCoreService;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.List;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Log4j2
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class GukYuinApiStbltJobService {
|
||||||
|
|
||||||
|
private final GukYuinStbltJobCoreService gukYuinStbltJobCoreService;
|
||||||
|
private final GukYuinApiService gukYuinApiService;
|
||||||
|
|
||||||
|
@Value("${spring.profiles.active}")
|
||||||
|
private String profile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 실행중인 profile
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private boolean isLocalProfile() {
|
||||||
|
return "local".equalsIgnoreCase(profile);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 국유인 연동 후, 실태조사 적합여부 확인하여 update */
|
||||||
|
@Scheduled(cron = "0 0 3 * * *") // 0 0 3 * * *
|
||||||
|
public void findGukYuinEligibleForSurvey() {
|
||||||
|
if (isLocalProfile()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<LearnKeyDto> list =
|
||||||
|
gukYuinStbltJobCoreService.findGukYuinEligibleForSurveyList(
|
||||||
|
GukYuinStatus.PNU_COMPLETED.getId());
|
||||||
|
if (list.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (LearnKeyDto dto : list) {
|
||||||
|
try {
|
||||||
|
String yesterday =
|
||||||
|
LocalDate.now(ZoneId.of("Asia/Seoul"))
|
||||||
|
.minusDays(1)
|
||||||
|
.format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
||||||
|
RlbDtctDto result = gukYuinApiService.findRlbDtctList(dto.getUid(), yesterday);
|
||||||
|
|
||||||
|
if (result == null || result.getResult() == null || result.getResult().isEmpty()) {
|
||||||
|
log.warn("[GUKYUIN] empty result chnDtctMstId={}", dto.getChnDtctMstId());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (RlbDtctMastDto stbltDto : result.getResult()) {
|
||||||
|
String resultUid = stbltDto.getChnDtctObjtId();
|
||||||
|
gukYuinStbltJobCoreService.updateGukYuinEligibleForSurvey(resultUid, stbltDto);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("[GUKYUIN] failed uid={}", dto.getChnDtctMstId(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -28,7 +28,6 @@ import java.util.stream.Collectors;
|
|||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.commons.io.FilenameUtils;
|
import org.apache.commons.io.FilenameUtils;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@@ -39,21 +38,6 @@ public class MapSheetMngFileJobService {
|
|||||||
|
|
||||||
private final MapSheetMngFileJobCoreService mapSheetMngFileJobCoreService;
|
private final MapSheetMngFileJobCoreService mapSheetMngFileJobCoreService;
|
||||||
|
|
||||||
@Value("${file.sync-root-dir}")
|
|
||||||
private String syncRootDir;
|
|
||||||
|
|
||||||
@Value("${file.sync-tmp-dir}")
|
|
||||||
private String syncTmpDir;
|
|
||||||
|
|
||||||
@Value("${file.sync-file-extention}")
|
|
||||||
private String syncFileExtention;
|
|
||||||
|
|
||||||
@Value("${file.sync-auto-exception-start-year}")
|
|
||||||
private int syncAutoExceptionStartYear;
|
|
||||||
|
|
||||||
@Value("${file.sync-auto-exception-before-year-cnt}")
|
|
||||||
private int syncAutoExceptionBeforeYearCnt;
|
|
||||||
|
|
||||||
public Integer checkMngFileSync() {
|
public Integer checkMngFileSync() {
|
||||||
return mapSheetMngFileJobCoreService.findNotYetMapSheetMng();
|
return mapSheetMngFileJobCoreService.findNotYetMapSheetMng();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,112 @@
|
|||||||
|
package com.kamco.cd.kamcoback.scheduler.service;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.postgres.core.TrainingDataLabelJobCoreService;
|
||||||
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.InspectorPendingDto;
|
||||||
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.Tasks;
|
||||||
|
import jakarta.transaction.Transactional;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Log4j2
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class TrainingDataLabelJobService {
|
||||||
|
|
||||||
|
private final TrainingDataLabelJobCoreService trainingDataLabelJobCoreService;
|
||||||
|
|
||||||
|
@Value("${spring.profiles.active}")
|
||||||
|
private String profile;
|
||||||
|
|
||||||
|
private boolean isLocalProfile() {
|
||||||
|
return "local".equalsIgnoreCase(profile);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
@Scheduled(cron = "0 0 0 * * *")
|
||||||
|
public void assignReviewerYesterdayLabelComplete() {
|
||||||
|
|
||||||
|
if (isLocalProfile()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
List<Tasks> tasks = trainingDataLabelJobCoreService.findCompletedYesterdayUnassigned();
|
||||||
|
|
||||||
|
if (tasks.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 회차별로 그룹핑
|
||||||
|
Map<Long, List<Tasks>> taskByRound =
|
||||||
|
tasks.stream().collect(Collectors.groupingBy(Tasks::getAnalUid));
|
||||||
|
|
||||||
|
// 회차별 분배
|
||||||
|
for (Map.Entry<Long, List<Tasks>> entry : taskByRound.entrySet()) {
|
||||||
|
Long analUid = entry.getKey();
|
||||||
|
List<Tasks> analTasks = entry.getValue();
|
||||||
|
|
||||||
|
// pending 계산
|
||||||
|
List<InspectorPendingDto> pendings =
|
||||||
|
trainingDataLabelJobCoreService.findInspectorPendingByRound(analUid);
|
||||||
|
|
||||||
|
if (pendings.isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> reviewerIds =
|
||||||
|
pendings.stream().map(InspectorPendingDto::getInspectorUid).toList();
|
||||||
|
|
||||||
|
// Lock 걸릴 수 있기 때문에 엔티티 조회하는 Repository 에서 구현
|
||||||
|
trainingDataLabelJobCoreService.lockInspectors(analUid, reviewerIds);
|
||||||
|
|
||||||
|
// 균등 분배
|
||||||
|
Map<String, List<Tasks>> assignMap = distributeByLeastPending(analTasks, reviewerIds);
|
||||||
|
|
||||||
|
// reviewer별 batch update
|
||||||
|
assignMap.forEach(
|
||||||
|
(reviewerId, assignedTasks) -> {
|
||||||
|
if (assignedTasks.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<UUID> assignmentUids =
|
||||||
|
assignedTasks.stream().map(Tasks::getAssignmentUid).toList();
|
||||||
|
trainingDataLabelJobCoreService.assignReviewerBatch(assignmentUids, reviewerId);
|
||||||
|
|
||||||
|
List<Long> geomUids = assignedTasks.stream().map(Tasks::getInferenceUid).toList();
|
||||||
|
trainingDataLabelJobCoreService.updateGeomUidTestState(geomUids);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("배치 처리 중 예외", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, List<Tasks>> distributeByLeastPending(
|
||||||
|
List<Tasks> tasks, List<String> reviewerIds) {
|
||||||
|
Map<String, List<Tasks>> result = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
// 순서 유지 중요 (ASC 정렬된 상태)
|
||||||
|
for (String reviewerId : reviewerIds) {
|
||||||
|
result.put(reviewerId, new ArrayList<>());
|
||||||
|
}
|
||||||
|
|
||||||
|
int reviewerCount = reviewerIds.size();
|
||||||
|
|
||||||
|
for (int i = 0; i < tasks.size(); i++) {
|
||||||
|
String reviewerId = reviewerIds.get(i % reviewerCount);
|
||||||
|
result.get(reviewerId).add(tasks.get(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,20 +8,13 @@ import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalMapShee
|
|||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.CompleteLabelData;
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.CompleteLabelData;
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.CompleteLabelData.GeoJsonFeature;
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.CompleteLabelData.GeoJsonFeature;
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.FeatureCollection;
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.FeatureCollection;
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.InspectorPendingDto;
|
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.Tasks;
|
|
||||||
import jakarta.transaction.Transactional;
|
import jakarta.transaction.Transactional;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
@@ -46,89 +39,13 @@ public class TrainingDataReviewJobService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Scheduled(cron = "0 0 0 * * *")
|
@Scheduled(cron = "0 0 2 * * *")
|
||||||
public void assignReviewerYesterdayLabelComplete() {
|
public void exportGeojsonLabelingGeom() {
|
||||||
|
|
||||||
if (isLocalProfile()) {
|
if (isLocalProfile()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
List<Tasks> tasks = trainingDataReviewJobCoreService.findCompletedYesterdayUnassigned();
|
|
||||||
|
|
||||||
if (tasks.isEmpty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 회차별로 그룹핑
|
|
||||||
Map<Long, List<Tasks>> taskByRound =
|
|
||||||
tasks.stream().collect(Collectors.groupingBy(Tasks::getAnalUid));
|
|
||||||
|
|
||||||
// 회차별 분배
|
|
||||||
for (Map.Entry<Long, List<Tasks>> entry : taskByRound.entrySet()) {
|
|
||||||
Long analUid = entry.getKey();
|
|
||||||
List<Tasks> analTasks = entry.getValue();
|
|
||||||
|
|
||||||
// pending 계산
|
|
||||||
List<InspectorPendingDto> pendings =
|
|
||||||
trainingDataReviewJobCoreService.findInspectorPendingByRound(analUid);
|
|
||||||
|
|
||||||
if (pendings.isEmpty()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<String> reviewerIds =
|
|
||||||
pendings.stream().map(InspectorPendingDto::getInspectorUid).toList();
|
|
||||||
|
|
||||||
// Lock 걸릴 수 있기 때문에 엔티티 조회하는 Repository 에서 구현
|
|
||||||
trainingDataReviewJobCoreService.lockInspectors(analUid, reviewerIds);
|
|
||||||
|
|
||||||
// 균등 분배
|
|
||||||
Map<String, List<Tasks>> assignMap = distributeByLeastPending(analTasks, reviewerIds);
|
|
||||||
|
|
||||||
// reviewer별 batch update
|
|
||||||
assignMap.forEach(
|
|
||||||
(reviewerId, assignedTasks) -> {
|
|
||||||
if (assignedTasks.isEmpty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<UUID> assignmentUids =
|
|
||||||
assignedTasks.stream().map(Tasks::getAssignmentUid).toList();
|
|
||||||
trainingDataReviewJobCoreService.assignReviewerBatch(assignmentUids, reviewerId);
|
|
||||||
|
|
||||||
List<Long> geomUids = assignedTasks.stream().map(Tasks::getInferenceUid).toList();
|
|
||||||
trainingDataReviewJobCoreService.updateGeomUidTestState(geomUids);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("배치 처리 중 예외", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Map<String, List<Tasks>> distributeByLeastPending(
|
|
||||||
List<Tasks> tasks, List<String> reviewerIds) {
|
|
||||||
Map<String, List<Tasks>> result = new LinkedHashMap<>();
|
|
||||||
|
|
||||||
// 순서 유지 중요 (ASC 정렬된 상태)
|
|
||||||
for (String reviewerId : reviewerIds) {
|
|
||||||
result.put(reviewerId, new ArrayList<>());
|
|
||||||
}
|
|
||||||
|
|
||||||
int reviewerCount = reviewerIds.size();
|
|
||||||
|
|
||||||
for (int i = 0; i < tasks.size(); i++) {
|
|
||||||
String reviewerId = reviewerIds.get(i % reviewerCount);
|
|
||||||
result.get(reviewerId).add(tasks.get(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional
|
|
||||||
@Scheduled(cron = "0 0 2 * * *")
|
|
||||||
public void exportGeojsonLabelingGeom() {
|
|
||||||
|
|
||||||
// 1) 경로/파일명 결정
|
// 1) 경로/파일명 결정
|
||||||
String targetDir =
|
String targetDir =
|
||||||
"local".equals(profile) ? System.getProperty("user.home") + "/geojson" : trainingDataDir;
|
"local".equals(profile) ? System.getProperty("user.home") + "/geojson" : trainingDataDir;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.kamco.cd.kamcoback.trainingdata;
|
|||||||
import com.kamco.cd.kamcoback.code.dto.CommonCodeDto;
|
import com.kamco.cd.kamcoback.code.dto.CommonCodeDto;
|
||||||
import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
|
import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
|
||||||
import com.kamco.cd.kamcoback.config.api.ApiResponseDto.ResponseObj;
|
import com.kamco.cd.kamcoback.config.api.ApiResponseDto.ResponseObj;
|
||||||
|
import com.kamco.cd.kamcoback.scheduler.service.TrainingDataLabelJobService;
|
||||||
import com.kamco.cd.kamcoback.scheduler.service.TrainingDataReviewJobService;
|
import com.kamco.cd.kamcoback.scheduler.service.TrainingDataReviewJobService;
|
||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto;
|
||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto.ReviewGeometryInfo;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto.ReviewGeometryInfo;
|
||||||
@@ -32,6 +33,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
public class TrainingDataReviewApiController {
|
public class TrainingDataReviewApiController {
|
||||||
|
|
||||||
private final TrainingDataReviewService trainingDataReviewService;
|
private final TrainingDataReviewService trainingDataReviewService;
|
||||||
|
private final TrainingDataLabelJobService trainingDataLabelJobService;
|
||||||
private final TrainingDataReviewJobService trainingDataReviewJobService;
|
private final TrainingDataReviewJobService trainingDataReviewJobService;
|
||||||
|
|
||||||
@Operation(summary = "목록 조회", description = "검수 할당 목록 조회")
|
@Operation(summary = "목록 조회", description = "검수 할당 목록 조회")
|
||||||
@@ -562,7 +564,7 @@ public class TrainingDataReviewApiController {
|
|||||||
description = "스케줄링이 실패한 경우 수동 호출하는 API, 어제 라벨링 완료된 것을 해당 검수자들에게 할당함")
|
description = "스케줄링이 실패한 경우 수동 호출하는 API, 어제 라벨링 완료된 것을 해당 검수자들에게 할당함")
|
||||||
@GetMapping("/run-schedule")
|
@GetMapping("/run-schedule")
|
||||||
public ApiResponseDto<Void> runTrainingReviewSchedule() {
|
public ApiResponseDto<Void> runTrainingReviewSchedule() {
|
||||||
trainingDataReviewJobService.assignReviewerYesterdayLabelComplete();
|
trainingDataLabelJobService.assignReviewerYesterdayLabelComplete();
|
||||||
return ApiResponseDto.ok(null);
|
return ApiResponseDto.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -123,5 +123,7 @@ training-data:
|
|||||||
geojson-dir: /kamco-nfs/model_output/labeling/
|
geojson-dir: /kamco-nfs/model_output/labeling/
|
||||||
|
|
||||||
layer:
|
layer:
|
||||||
geoserver-url: http://label-tile.gs.dabeeo.com
|
geoserver-url: https://kamco.geo-dev.gs.dabeeo.com
|
||||||
|
wms-path: geoserver/cd
|
||||||
|
wmts-path: geoserver/cd/gwc/service
|
||||||
workspace: cd
|
workspace: cd
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ spring:
|
|||||||
jpa:
|
jpa:
|
||||||
show-sql: false
|
show-sql: false
|
||||||
hibernate:
|
hibernate:
|
||||||
ddl-auto: update # 로컬만 완화(시킬려면 update으로 변경)
|
ddl-auto: validate # 로컬만 완화(시킬려면 update으로 변경)
|
||||||
properties:
|
properties:
|
||||||
hibernate:
|
hibernate:
|
||||||
default_batch_fetch_size: 100 # ✅ 성능 - N+1 쿼리 방지
|
default_batch_fetch_size: 100 # ✅ 성능 - N+1 쿼리 방지
|
||||||
@@ -16,9 +16,11 @@ spring:
|
|||||||
|
|
||||||
datasource:
|
datasource:
|
||||||
url: jdbc:postgresql://192.168.2.127:15432/kamco_cds
|
url: jdbc:postgresql://192.168.2.127:15432/kamco_cds
|
||||||
#url: jdbc:postgresql://localhost:5432/kamco_cds # 로컬호스트
|
# url: jdbc:postgresql://localhost:5432/local_0128
|
||||||
username: kamco_cds
|
username: kamco_cds
|
||||||
password: kamco_cds_Q!W@E#R$
|
password: kamco_cds_Q!W@E#R$
|
||||||
|
# username: postgres
|
||||||
|
# password: 1234
|
||||||
hikari:
|
hikari:
|
||||||
minimum-idle: 1
|
minimum-idle: 1
|
||||||
maximum-pool-size: 5
|
maximum-pool-size: 5
|
||||||
@@ -68,30 +70,30 @@ mapsheet:
|
|||||||
|
|
||||||
|
|
||||||
file:
|
file:
|
||||||
sync-root-dir: /Users/bokmin/kamco-nfs/images/
|
sync-root-dir: C:/Users/gypark/kamco-nfs/images/
|
||||||
#sync-root-dir: /kamco-nfs/images/
|
#sync-root-dir: /kamco-nfs/images/
|
||||||
sync-tmp-dir: ${file.sync-root-dir}/tmp
|
sync-tmp-dir: ${file.sync-root-dir}/tmp/
|
||||||
sync-file-extention: tfw,tif
|
sync-file-extention: tfw,tif
|
||||||
sync-auto-exception-start-year: 2024
|
sync-auto-exception-start-year: 2025
|
||||||
sync-auto-exception-before-year-cnt: 3
|
sync-auto-exception-before-year-cnt: 3
|
||||||
|
|
||||||
dataset-dir: /Users/bokmin/kamco-nfs/dataset/export/
|
dataset-dir: C:/Users/gypark/kamco-nfs/dataset/
|
||||||
#dataset-dir: /kamco-nfs/dataset/export/
|
#dataset-dir: /kamco-nfs/dataset/export/
|
||||||
dataset-tmp-dir: ${file.dataset-dir}tmp/
|
dataset-tmp-dir: ${file.dataset-dir}tmp/
|
||||||
|
|
||||||
model-dir: /Users/bokmin/kamco-nfs/ckpt/model/
|
model-dir: C:/Users/gypark/kamco-nfs/ckpt/model/
|
||||||
#model-dir: /kamco-nfs/ckpt/model/
|
#model-dir: /kamco-nfs/ckpt/model/
|
||||||
model-tmp-dir: ${file.model-dir}tmp/
|
model-tmp-dir: ${file.model-dir}tmp/
|
||||||
model-file-extention: pth,json,py
|
model-file-extention: pth,json,py
|
||||||
|
|
||||||
pt-path: /kamco-nfs/ckpt/model/v6-cls-checkpoints/
|
pt-path: /kamco-nfs/ckpt/classification/
|
||||||
pt-FileName: yolov8_6th-6m.pt
|
pt-FileName: v5-best.pt
|
||||||
|
|
||||||
inference:
|
inference:
|
||||||
url: http://192.168.2.183:8000/jobs
|
url: http://10.100.0.11:8000/jobs
|
||||||
batch-url: http://192.168.2.183:8000/batches
|
batch-url: http://10.100.0.11:8000/batches
|
||||||
geojson-dir: /Users/bokmin/kamco-nfs/requests/
|
geojson-dir: /kamco-nfs/requests/
|
||||||
jar-path: /Users/bokmin/kamco-nfs/dataset/shp/shp-exporter.jar
|
jar-path: jar/makeshp-1.0.0.jar
|
||||||
inference-server-name: server1,server2,server3,server4
|
inference-server-name: server1,server2,server3,server4
|
||||||
|
|
||||||
gukyuin:
|
gukyuin:
|
||||||
@@ -100,8 +102,9 @@ gukyuin:
|
|||||||
cdi: ${gukyuin.url}/api/kcd/cdi
|
cdi: ${gukyuin.url}/api/kcd/cdi
|
||||||
|
|
||||||
training-data:
|
training-data:
|
||||||
geojson-dir: /Users/bokmin/kamco-nfs/model_output/labeling/
|
geojson-dir: /kamco-nfs/model_output/labeling/
|
||||||
|
|
||||||
layer:
|
layer:
|
||||||
geoserver-url: http://localhost:9080
|
geoserver-url: https://kamco.geo-dev.gs.dabeeo.com
|
||||||
|
path: /geoserver/cd/gwc/service/
|
||||||
workspace: cd
|
workspace: cd
|
||||||
|
|||||||
@@ -78,5 +78,7 @@ training-data:
|
|||||||
geojson-dir: /kamco-nfs/model_output/labeling/
|
geojson-dir: /kamco-nfs/model_output/labeling/
|
||||||
|
|
||||||
layer:
|
layer:
|
||||||
geoserver-url: http://label-tile.gs.dabeeo.com
|
geoserver-url: https://kamco.geo-dev.gs.dabeeo.com
|
||||||
|
wms-path: geoserver/cd
|
||||||
|
wmts-path: geoserver/cd/gwc/service
|
||||||
workspace: cd
|
workspace: cd
|
||||||
|
|||||||
Reference in New Issue
Block a user