Compare commits
40 Commits
feat/infer
...
190ba525d5
| Author | SHA1 | Date | |
|---|---|---|---|
| 190ba525d5 | |||
| 70e01a2044 | |||
| 9ee1ec94c0 | |||
| 3683c193d4 | |||
| a2293ad1ab | |||
| 22c3b28237 | |||
| 8d7ddc4c33 | |||
| b859a56ab0 | |||
| 84b2149f78 | |||
| db897268de | |||
| 4dc5c196ca | |||
| 3f1bb8f082 | |||
| 778e87383c | |||
| 38c4fbf4e5 | |||
| fd1ba1ef3b | |||
| 2d2b55efcd | |||
| ac13f36663 | |||
| e15b35943b | |||
| e209eeb826 | |||
| 2c320194b4 | |||
| 0df7d7c5cf | |||
| 9885c19b50 | |||
| 5b09b2e29a | |||
| 4cbd2b8d76 | |||
| 89504e4156 | |||
| 5d33190c31 | |||
| 81b0b55d57 | |||
| 83ef7e36ed | |||
| 0d13e6989f | |||
| 4342df9bf5 | |||
| 8f9585b516 | |||
| 43b5a79031 | |||
| 3ba3b05f2f | |||
| fffc2efd96 | |||
| 82e3250fd4 | |||
| 470f2191b7 | |||
| c127531412 | |||
| 61cfd8240a | |||
| 54b6712273 | |||
| b2141e98c0 |
@@ -1,6 +1,5 @@
|
|||||||
# 1단계에서 만든 로컬 베이스 이미지를 사용
|
# 1단계에서 만든 로컬 베이스 이미지를 사용
|
||||||
FROM 192.168.2.73:18082/kamco-cd/base-java21-gdal:1.0
|
FROM 127.0.0.1:18082/kamco-cd/base-java21-gdal:1.0
|
||||||
FROM 192.168.2.73:18082/kamco-cd/base-java21-gdal:1.0
|
|
||||||
|
|
||||||
# 사용자 설정 (앱 별로 다를 수 있으므로 여기에 유지)
|
# 사용자 설정 (앱 별로 다를 수 있으므로 여기에 유지)
|
||||||
ARG UID=1000
|
ARG UID=1000
|
||||||
|
|||||||
@@ -15,10 +15,6 @@ services:
|
|||||||
- SPRING_PROFILES_ACTIVE=dev
|
- SPRING_PROFILES_ACTIVE=dev
|
||||||
- TZ=Asia/Seoul
|
- TZ=Asia/Seoul
|
||||||
volumes:
|
volumes:
|
||||||
- /mnt/nfs_share/images:/app/original-images
|
|
||||||
- /mnt/nfs_share/model_output:/app/model-outputs
|
|
||||||
- /mnt/nfs_share/train_dataset:/app/train-dataset
|
|
||||||
- /mnt/nfs_share/tmp:/app/tmp
|
|
||||||
- /kamco-nfs:/kamco-nfs
|
- /kamco-nfs:/kamco-nfs
|
||||||
networks:
|
networks:
|
||||||
- kamco-cds
|
- kamco-cds
|
||||||
|
|||||||
@@ -15,11 +15,7 @@ services:
|
|||||||
- SPRING_PROFILES_ACTIVE=dev
|
- SPRING_PROFILES_ACTIVE=dev
|
||||||
- TZ=Asia/Seoul
|
- TZ=Asia/Seoul
|
||||||
volumes:
|
volumes:
|
||||||
- /mnt/nfs_share/images:/app/original-images
|
- /data:/kamco-nfs
|
||||||
- /mnt/nfs_share/model_output:/app/model-outputs
|
|
||||||
- /mnt/nfs_share/train_dataset:/app/train-dataset
|
|
||||||
- /mnt/nfs_share/tmp:/app/tmp
|
|
||||||
- /kamco-nfs:/kamco-nfs
|
|
||||||
networks:
|
networks:
|
||||||
- kamco-cds
|
- kamco-cds
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|||||||
@@ -18,12 +18,13 @@ import org.springframework.web.filter.OncePerRequestFilter;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class JwtAuthenticationFilter extends OncePerRequestFilter {
|
public class JwtAuthenticationFilter extends OncePerRequestFilter {
|
||||||
|
|
||||||
private final JwtTokenProvider jwtTokenProvider;
|
|
||||||
private final UserDetailsService userDetailsService;
|
|
||||||
private static final AntPathMatcher PATH_MATCHER = new AntPathMatcher();
|
private static final AntPathMatcher PATH_MATCHER = new AntPathMatcher();
|
||||||
private static final String[] EXCLUDE_PATHS = {
|
private static final String[] EXCLUDE_PATHS = {
|
||||||
"/api/auth/signin", "/api/auth/refresh", "/api/auth/logout", "/api/members/*/password"
|
// "/api/auth/signin", "/api/auth/refresh", "/api/auth/logout", "/api/members/*/password"
|
||||||
|
"/api/auth/signin", "/api/auth/refresh", "/api/auth/logout"
|
||||||
};
|
};
|
||||||
|
private final JwtTokenProvider jwtTokenProvider;
|
||||||
|
private final UserDetailsService userDetailsService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doFilterInternal(
|
protected void doFilterInternal(
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.kamco.cd.kamcoback.changedetection;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto;
|
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto;
|
||||||
|
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.ChangeDetectionMapDto;
|
||||||
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.DetectSearchType;
|
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.DetectSearchType;
|
||||||
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapScaleType;
|
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapScaleType;
|
||||||
import com.kamco.cd.kamcoback.changedetection.service.ChangeDetectionService;
|
import com.kamco.cd.kamcoback.changedetection.service.ChangeDetectionService;
|
||||||
@@ -146,4 +147,31 @@ public class ChangeDetectionApiController {
|
|||||||
return ApiResponseDto.ok(
|
return ApiResponseDto.ok(
|
||||||
changeDetectionService.getChangeDetectionPointList(type, scale, uuid, mapSheetNum));
|
changeDetectionService.getChangeDetectionPointList(type, scale, uuid, mapSheetNum));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "변화지도 uuid 조회", description = "변화지도 uuid 조회 API")
|
||||||
|
@GetMapping("/map")
|
||||||
|
public ApiResponseDto<UUID> getChangeDetection(
|
||||||
|
@Parameter(description = "기준년도", required = true) @RequestParam(defaultValue = "2022")
|
||||||
|
Integer stddYear,
|
||||||
|
@Parameter(description = "비교년도", required = true) @RequestParam(defaultValue = "2023")
|
||||||
|
Integer cprsnYear,
|
||||||
|
@Parameter(description = "변화탐지 객체 id 32자리") @RequestParam(defaultValue = "", required = false)
|
||||||
|
String cdObjectId,
|
||||||
|
@Parameter(description = "변화탐지 객체 ids 32자리")
|
||||||
|
@RequestParam(defaultValue = "", required = false)
|
||||||
|
List<String> cdObjectIds,
|
||||||
|
@Parameter(description = "변화탐지 회차별 id 32자리")
|
||||||
|
@RequestParam(defaultValue = "", required = false)
|
||||||
|
String chnDtctId,
|
||||||
|
@Parameter(description = "pnu") @RequestParam(defaultValue = "", required = false)
|
||||||
|
String pnu) {
|
||||||
|
ChangeDetectionMapDto req = new ChangeDetectionMapDto();
|
||||||
|
req.setCompareYyyy(stddYear);
|
||||||
|
req.setTargetYyyy(cprsnYear);
|
||||||
|
req.setCdObjectId(cdObjectId);
|
||||||
|
req.setCdObjectIds(cdObjectIds);
|
||||||
|
req.setChnDtctId(chnDtctId);
|
||||||
|
req.setPnu(pnu);
|
||||||
|
return ApiResponseDto.ok(changeDetectionService.getChangeDetectionUuid(req));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -251,4 +251,18 @@ public class ChangeDetectionDto {
|
|||||||
private String afterClass; // 비교 분류
|
private String afterClass; // 비교 분류
|
||||||
private Double cdProb; // 탐지 정확도
|
private Double cdProb; // 탐지 정확도
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Schema(name = "ChangeDetectionMapDto", description = "변화지도 팝업 검색조건")
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class ChangeDetectionMapDto {
|
||||||
|
private Integer compareYyyy;
|
||||||
|
private Integer targetYyyy;
|
||||||
|
private String cdObjectId;
|
||||||
|
private List<String> cdObjectIds;
|
||||||
|
private String chnDtctId;
|
||||||
|
private String pnu;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.kamco.cd.kamcoback.changedetection.service;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto;
|
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto;
|
||||||
|
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.ChangeDetectionMapDto;
|
||||||
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.DetectSearchType;
|
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.DetectSearchType;
|
||||||
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapScaleType;
|
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapScaleType;
|
||||||
import com.kamco.cd.kamcoback.postgres.core.ChangeDetectionCoreService;
|
import com.kamco.cd.kamcoback.postgres.core.ChangeDetectionCoreService;
|
||||||
@@ -89,4 +90,8 @@ public class ChangeDetectionService {
|
|||||||
default -> throw new IllegalArgumentException("Unsupported type: " + type);
|
default -> throw new IllegalArgumentException("Unsupported type: " + type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UUID getChangeDetectionUuid(ChangeDetectionMapDto req) {
|
||||||
|
return changeDetectionCoreService.getChangeDetectionUuid(req);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,92 @@
|
|||||||
|
package com.kamco.cd.kamcoback.common.download;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.kamco.cd.kamcoback.common.download.dto.DownloadAuditEvent;
|
||||||
|
import com.kamco.cd.kamcoback.menu.dto.MenuDto;
|
||||||
|
import com.kamco.cd.kamcoback.menu.service.MenuService;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.AuditLogEntity;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.repository.log.AuditLogRepository;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.context.event.EventListener;
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class DownloadAuditEventListener {
|
||||||
|
|
||||||
|
private final AuditLogRepository auditLogRepository;
|
||||||
|
private final MenuService menuService;
|
||||||
|
private final ObjectMapper objectMapper;
|
||||||
|
|
||||||
|
@Async("auditLogExecutor")
|
||||||
|
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||||
|
@EventListener
|
||||||
|
public void onDownloadAudit(DownloadAuditEvent ev) {
|
||||||
|
try {
|
||||||
|
String menuUid = resolveMenuUid(ev.normalizedUri());
|
||||||
|
if (menuUid == null) {
|
||||||
|
// menuUid null 불가 -> 스킵
|
||||||
|
log.warn(
|
||||||
|
"MenuUid not resolved. skip audit. uri={}, normalized={}",
|
||||||
|
ev.requestUri(),
|
||||||
|
ev.normalizedUri());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
AuditLogEntity logEntity =
|
||||||
|
AuditLogEntity.forFileDownload(
|
||||||
|
ev.userId(), ev.requestUri(), menuUid, ev.ip(), ev.status(), ev.downloadUuid());
|
||||||
|
|
||||||
|
auditLogRepository.save(logEntity);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 본 요청과 분리되어야 함
|
||||||
|
log.warn("Download audit save failed. uri={}, err={}", ev.requestUri(), e.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String resolveMenuUid(String normalizedUri) {
|
||||||
|
try {
|
||||||
|
List<?> list = menuService.getFindAll();
|
||||||
|
|
||||||
|
List<MenuDto.Basic> basics =
|
||||||
|
list.stream()
|
||||||
|
.map(
|
||||||
|
item -> {
|
||||||
|
if (item instanceof LinkedHashMap<?, ?> map) {
|
||||||
|
return objectMapper.convertValue(map, MenuDto.Basic.class);
|
||||||
|
} else if (item instanceof MenuDto.Basic dto) {
|
||||||
|
return dto;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
})
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
MenuDto.Basic basic =
|
||||||
|
basics.stream()
|
||||||
|
.filter(m -> m.getMenuUrl() != null && normalizedUri.startsWith(m.getMenuUrl()))
|
||||||
|
.max(Comparator.comparingInt(m -> m.getMenuUrl().length()))
|
||||||
|
.orElse(null);
|
||||||
|
|
||||||
|
if (basic == null) return null;
|
||||||
|
|
||||||
|
String menuUidStr = basic.getMenuUid(); // ← String
|
||||||
|
if (menuUidStr == null || menuUidStr.isBlank()) return null;
|
||||||
|
|
||||||
|
return menuUidStr; // ← Long 변환
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
package com.kamco.cd.kamcoback.common.download;
|
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.common.download.dto.DownloadSpec;
|
|
||||||
import com.kamco.cd.kamcoback.common.utils.UserUtil;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.http.HttpHeaders;
|
|
||||||
import org.springframework.http.MediaType;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class DownloadExecutor {
|
|
||||||
|
|
||||||
private final UserUtil userUtil;
|
|
||||||
|
|
||||||
public ResponseEntity<StreamingResponseBody> stream(DownloadSpec spec) throws IOException {
|
|
||||||
|
|
||||||
if (!Files.isReadable(spec.filePath())) {
|
|
||||||
return ResponseEntity.notFound().build();
|
|
||||||
}
|
|
||||||
|
|
||||||
StreamingResponseBody body =
|
|
||||||
os -> {
|
|
||||||
try (InputStream in = Files.newInputStream(spec.filePath())) {
|
|
||||||
in.transferTo(os);
|
|
||||||
os.flush();
|
|
||||||
} catch (Exception e) {
|
|
||||||
// 고용량은 중간 끊김 흔하니까 throw 금지
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
String fileName =
|
|
||||||
spec.downloadName() != null
|
|
||||||
? spec.downloadName()
|
|
||||||
: spec.filePath().getFileName().toString();
|
|
||||||
|
|
||||||
return ResponseEntity.ok()
|
|
||||||
.contentType(
|
|
||||||
spec.contentType() != null ? spec.contentType() : MediaType.APPLICATION_OCTET_STREAM)
|
|
||||||
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + fileName + "\"")
|
|
||||||
.body(body);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
package com.kamco.cd.kamcoback.common.download;
|
||||||
|
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.core.io.FileSystemResource;
|
||||||
|
import org.springframework.core.io.Resource;
|
||||||
|
import org.springframework.core.io.support.ResourceRegion;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.http.HttpRange;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class RangeDownloadResponder {
|
||||||
|
|
||||||
|
public ResponseEntity<?> buildZipResponse(
|
||||||
|
Path filePath, String downloadFileName, HttpServletRequest request) throws IOException {
|
||||||
|
|
||||||
|
if (!Files.isRegularFile(filePath)) {
|
||||||
|
return ResponseEntity.notFound().build();
|
||||||
|
}
|
||||||
|
|
||||||
|
long totalSize = Files.size(filePath);
|
||||||
|
Resource resource = new FileSystemResource(filePath);
|
||||||
|
|
||||||
|
String disposition = "attachment; filename=\"" + downloadFileName + "\"";
|
||||||
|
String rangeHeader = request.getHeader(HttpHeaders.RANGE);
|
||||||
|
|
||||||
|
// 🔥 공통 헤더 (여기 고정)
|
||||||
|
ResponseEntity.BodyBuilder base =
|
||||||
|
ResponseEntity.ok()
|
||||||
|
.contentType(MediaType.APPLICATION_OCTET_STREAM)
|
||||||
|
.header(HttpHeaders.CONTENT_DISPOSITION, disposition)
|
||||||
|
.header(HttpHeaders.ACCEPT_RANGES, "bytes")
|
||||||
|
.header("X-Accel-Buffering", "no");
|
||||||
|
|
||||||
|
if (rangeHeader == null || rangeHeader.isBlank()) {
|
||||||
|
return base.contentLength(totalSize).body(resource);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<HttpRange> ranges;
|
||||||
|
try {
|
||||||
|
ranges = HttpRange.parseRanges(rangeHeader);
|
||||||
|
} catch (IllegalArgumentException ex) {
|
||||||
|
return ResponseEntity.status(416)
|
||||||
|
.header(HttpHeaders.CONTENT_RANGE, "bytes */" + totalSize)
|
||||||
|
.header("X-Accel-Buffering", "no")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRange range = ranges.get(0);
|
||||||
|
|
||||||
|
long start = range.getRangeStart(totalSize);
|
||||||
|
long end = range.getRangeEnd(totalSize);
|
||||||
|
|
||||||
|
if (start >= totalSize) {
|
||||||
|
return ResponseEntity.status(416)
|
||||||
|
.header(HttpHeaders.CONTENT_RANGE, "bytes */" + totalSize)
|
||||||
|
.header("X-Accel-Buffering", "no")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
long regionLength = end - start + 1;
|
||||||
|
ResourceRegion region = new ResourceRegion(resource, start, regionLength);
|
||||||
|
|
||||||
|
return ResponseEntity.status(206)
|
||||||
|
.contentType(MediaType.APPLICATION_OCTET_STREAM)
|
||||||
|
.header(HttpHeaders.CONTENT_DISPOSITION, disposition)
|
||||||
|
.header(HttpHeaders.ACCEPT_RANGES, "bytes")
|
||||||
|
.header("X-Accel-Buffering", "no")
|
||||||
|
.header(HttpHeaders.CONTENT_RANGE, "bytes " + start + "-" + end + "/" + totalSize)
|
||||||
|
.contentLength(regionLength)
|
||||||
|
.body(region);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.kamco.cd.kamcoback.common.download.dto;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public record DownloadAuditEvent(
|
||||||
|
Long userId,
|
||||||
|
String requestUri,
|
||||||
|
String normalizedUri,
|
||||||
|
String ip,
|
||||||
|
int status,
|
||||||
|
UUID downloadUuid) {}
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
package com.kamco.cd.kamcoback.common.download.dto;
|
|
||||||
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.util.UUID;
|
|
||||||
import org.springframework.http.MediaType;
|
|
||||||
|
|
||||||
public record DownloadSpec(
|
|
||||||
UUID uuid, // 다운로드 식별(로그/정책용)
|
|
||||||
Path filePath, // 실제 파일 경로
|
|
||||||
String downloadName, // 사용자에게 보일 파일명
|
|
||||||
MediaType contentType // 보통 OCTET_STREAM
|
|
||||||
) {}
|
|
||||||
@@ -27,4 +27,10 @@ public class CustomApiException extends RuntimeException {
|
|||||||
this.codeName = errorCode.getCode();
|
this.codeName = errorCode.getCode();
|
||||||
this.status = errorCode.getStatus();
|
this.status = errorCode.getStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CustomApiException(String codeName, HttpStatus status, Throwable cause) {
|
||||||
|
super(codeName, cause);
|
||||||
|
this.codeName = codeName;
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,11 +7,14 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Log4j2
|
@Log4j2
|
||||||
@Component
|
@Component
|
||||||
public class ExternalJarRunner {
|
public class ExternalJarRunner {
|
||||||
|
@Value("${spring.profiles.active}")
|
||||||
|
private String profile;
|
||||||
|
|
||||||
private static final long TIMEOUT_MINUTES = TimeUnit.DAYS.toMinutes(3);
|
private static final long TIMEOUT_MINUTES = TimeUnit.DAYS.toMinutes(3);
|
||||||
|
|
||||||
@@ -40,7 +43,7 @@ public class ExternalJarRunner {
|
|||||||
if (mode != null && !mode.isEmpty()) {
|
if (mode != null && !mode.isEmpty()) {
|
||||||
addArg(args, "converter.mode", mode);
|
addArg(args, "converter.mode", mode);
|
||||||
}
|
}
|
||||||
|
addArg(args, "spring.profiles.active", profile);
|
||||||
execJar(jarPath, args);
|
execJar(jarPath, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,6 +60,7 @@ public class ExternalJarRunner {
|
|||||||
addArg(args, "upload-shp", register);
|
addArg(args, "upload-shp", register);
|
||||||
// addArg(args, "layer", layer);
|
// addArg(args, "layer", layer);
|
||||||
|
|
||||||
|
addArg(args, "spring.profiles.active", profile);
|
||||||
execJar(jarPath, args);
|
execJar(jarPath, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -300,10 +300,12 @@ public class FIleChecker {
|
|||||||
String parentPath = path.getParent().toString();
|
String parentPath = path.getParent().toString();
|
||||||
String fullPath = path.toAbsolutePath().toString();
|
String fullPath = path.toAbsolutePath().toString();
|
||||||
|
|
||||||
boolean isValid =
|
boolean isShowHide =
|
||||||
!NameValidator.containsKorean(folderNm)
|
!parentFolderNm.equals("kamco-nfs"); // 폴더 리스트에 kamco-nfs 하위만 나오도록 처리
|
||||||
&& !NameValidator.containsWhitespaceRegex(folderNm)
|
// boolean isValid =
|
||||||
&& !parentFolderNm.equals("kamco-nfs");
|
// !NameValidator.containsKorean(folderNm)
|
||||||
|
// && !NameValidator.containsWhitespaceRegex(folderNm)
|
||||||
|
// && !parentFolderNm.equals("kamco-nfs");
|
||||||
|
|
||||||
File file = new File(fullPath);
|
File file = new File(fullPath);
|
||||||
int childCnt = getChildFolderCount(file);
|
int childCnt = getChildFolderCount(file);
|
||||||
@@ -317,7 +319,7 @@ public class FIleChecker {
|
|||||||
depth,
|
depth,
|
||||||
childCnt,
|
childCnt,
|
||||||
lastModified,
|
lastModified,
|
||||||
isValid);
|
isShowHide);
|
||||||
})
|
})
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
|||||||
@@ -1,98 +1,64 @@
|
|||||||
package com.kamco.cd.kamcoback.config;
|
package com.kamco.cd.kamcoback.config;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.kamco.cd.kamcoback.common.download.dto.DownloadAuditEvent;
|
||||||
import com.kamco.cd.kamcoback.common.utils.HeaderUtil;
|
|
||||||
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;
|
||||||
import com.kamco.cd.kamcoback.menu.dto.MenuDto;
|
import jakarta.servlet.DispatcherType;
|
||||||
import com.kamco.cd.kamcoback.menu.service.MenuService;
|
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.AuditLogEntity;
|
|
||||||
import com.kamco.cd.kamcoback.postgres.repository.log.AuditLogRepository;
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.context.ApplicationEventPublisher;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.servlet.HandlerInterceptor;
|
import org.springframework.web.servlet.HandlerInterceptor;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class FileDownloadInteceptor implements HandlerInterceptor {
|
public class FileDownloadInteceptor implements HandlerInterceptor {
|
||||||
|
|
||||||
private final AuditLogRepository auditLogRepository;
|
private final ApplicationEventPublisher publisher;
|
||||||
private final MenuService menuService;
|
|
||||||
private final UserUtil userUtil;
|
private final UserUtil userUtil;
|
||||||
|
|
||||||
@Autowired private ObjectMapper objectMapper;
|
|
||||||
|
|
||||||
public FileDownloadInteceptor(
|
|
||||||
AuditLogRepository auditLogRepository, MenuService menuService, UserUtil userUtil) {
|
|
||||||
this.auditLogRepository = auditLogRepository;
|
|
||||||
this.menuService = menuService;
|
|
||||||
this.userUtil = userUtil;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean preHandle(
|
public void afterCompletion(
|
||||||
HttpServletRequest request, HttpServletResponse response, Object handler) {
|
HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
|
||||||
|
|
||||||
if (!request.getRequestURI().contains("/download")) return true;
|
String uri = request.getRequestURI();
|
||||||
|
if (uri == null || !uri.contains("/download")) return;
|
||||||
|
if (request.getDispatcherType() != DispatcherType.REQUEST) return;
|
||||||
|
|
||||||
if (request.getDispatcherType() != jakarta.servlet.DispatcherType.REQUEST) {
|
Long userId;
|
||||||
return true;
|
try {
|
||||||
}
|
userId = userUtil.getId();
|
||||||
|
if (userId == null) return; // userId null 불가면 스킵
|
||||||
saveLog(request, response);
|
} catch (Exception e) {
|
||||||
|
log.warn("Download audit userId resolve failed. uri={}, err={}", uri, e.toString());
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void saveLog(HttpServletRequest request, HttpServletResponse response) {
|
|
||||||
// 파일 다운로드 API만 필터링
|
|
||||||
if (!request.getRequestURI().contains("/download")) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Long userId = userUtil.getId();
|
|
||||||
String ip = ApiLogFunction.getClientIp(request);
|
String ip = ApiLogFunction.getClientIp(request);
|
||||||
|
int status = response.getStatus();
|
||||||
|
String normalizedUri = uri.replace("/api", "");
|
||||||
|
|
||||||
List<?> list = menuService.getFindAll();
|
UUID downloadUuid = extractUuidFromUri(uri);
|
||||||
List<MenuDto.Basic> result =
|
if (downloadUuid == null) {
|
||||||
list.stream()
|
log.warn("Download UUID parse failed. uri={}", uri);
|
||||||
.map(
|
return; // downloadUuid null 불가 -> 스킵
|
||||||
item -> {
|
}
|
||||||
if (item instanceof LinkedHashMap<?, ?> map) {
|
|
||||||
return objectMapper.convertValue(map, MenuDto.Basic.class);
|
|
||||||
} else if (item instanceof MenuDto.Basic dto) {
|
|
||||||
return dto;
|
|
||||||
} else {
|
|
||||||
throw new IllegalStateException("Unsupported cache type: " + item.getClass());
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.toList();
|
|
||||||
|
|
||||||
String normalizedUri = request.getRequestURI().replace("/api", "");
|
publisher.publishEvent(
|
||||||
MenuDto.Basic basic =
|
new DownloadAuditEvent(userId, uri, normalizedUri, ip, status, downloadUuid));
|
||||||
result.stream()
|
}
|
||||||
.filter(
|
|
||||||
menu -> menu.getMenuUrl() != null && normalizedUri.startsWith(menu.getMenuUrl()))
|
|
||||||
.max(Comparator.comparingInt(m -> m.getMenuUrl().length()))
|
|
||||||
.orElse(null);
|
|
||||||
|
|
||||||
AuditLogEntity log =
|
private UUID extractUuidFromUri(String uri) {
|
||||||
AuditLogEntity.forFileDownload(
|
try {
|
||||||
userId,
|
String[] parts = uri.split("/");
|
||||||
request.getRequestURI(),
|
String last = parts[parts.length - 1];
|
||||||
Objects.requireNonNull(basic).getMenuUid(),
|
return UUID.fromString(last);
|
||||||
ip,
|
} catch (Exception e) {
|
||||||
response.getStatus(),
|
return null;
|
||||||
UUID.fromString(HeaderUtil.get(request, "kamco-download-uuid")));
|
}
|
||||||
|
|
||||||
auditLogRepository.save(log);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,9 +95,9 @@ public class SecurityConfig {
|
|||||||
"/api/auth/refresh",
|
"/api/auth/refresh",
|
||||||
"/api/auth/logout",
|
"/api/auth/logout",
|
||||||
"/swagger-ui/**",
|
"/swagger-ui/**",
|
||||||
"/api/members/*/password",
|
|
||||||
"/v3/api-docs/**",
|
"/v3/api-docs/**",
|
||||||
"/chunk_upload_test.html",
|
"/chunk_upload_test.html",
|
||||||
|
"/download_progress_test.html",
|
||||||
"/api/model/file-chunk-upload",
|
"/api/model/file-chunk-upload",
|
||||||
"/api/upload/file-chunk-upload",
|
"/api/upload/file-chunk-upload",
|
||||||
"/api/upload/chunk-upload-complete",
|
"/api/upload/chunk-upload-complete",
|
||||||
@@ -112,6 +112,7 @@ public class SecurityConfig {
|
|||||||
"/api/user/**",
|
"/api/user/**",
|
||||||
"/api/my/menus",
|
"/api/my/menus",
|
||||||
"/api/common-code/**",
|
"/api/common-code/**",
|
||||||
|
"/api/members/*/password",
|
||||||
"/api/training-data/label/**",
|
"/api/training-data/label/**",
|
||||||
"/api/training-data/review/**")
|
"/api/training-data/review/**")
|
||||||
.authenticated()
|
.authenticated()
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ public class GukYuinApiController {
|
|||||||
})
|
})
|
||||||
public ApiResponseDto<ChngDetectMastDto.ResultDto> selectChangeDetectionDtctIdList(
|
public ApiResponseDto<ChngDetectMastDto.ResultDto> selectChangeDetectionDtctIdList(
|
||||||
@RequestParam(required = false) String chnDtctId) {
|
@RequestParam(required = false) String chnDtctId) {
|
||||||
return ApiResponseDto.ok(gukYuinApiService.listChnDtctId(chnDtctId));
|
return ApiResponseDto.ok(gukYuinApiService.listChnDtctId(chnDtctId, ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "탐지결과 등록목록 조회(1건 조회)", description = "탐지결과 등록목록 조회")
|
@Operation(summary = "탐지결과 등록목록 조회(1건 조회)", description = "탐지결과 등록목록 조회")
|
||||||
@@ -192,7 +192,7 @@ public class GukYuinApiController {
|
|||||||
@PathVariable String chnDtctId,
|
@PathVariable String chnDtctId,
|
||||||
@RequestParam(defaultValue = "0") Integer pageIndex,
|
@RequestParam(defaultValue = "0") Integer pageIndex,
|
||||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||||
return ApiResponseDto.ok(gukYuinApiService.findChnContList(chnDtctId, pageIndex, pageSize));
|
return ApiResponseDto.ok(gukYuinApiService.findChnContList(chnDtctId, pageIndex, pageSize, ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "탐지객체 조회 (탐지객체 1건 조회)", description = "탐지객체 조회 (탐지객체 1건 조회)")
|
@Operation(summary = "탐지객체 조회 (탐지객체 1건 조회)", description = "탐지객체 조회 (탐지객체 1건 조회)")
|
||||||
@@ -272,7 +272,8 @@ public class GukYuinApiController {
|
|||||||
@PostMapping("/rlb/objt/{chnDtctObjtId}/lbl/{lblYn}")
|
@PostMapping("/rlb/objt/{chnDtctObjtId}/lbl/{lblYn}")
|
||||||
public ApiResponseDto<ChngDetectContDto.ResultLabelDto> 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, ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "국유in연동 등록", description = "국유in연동 등록")
|
@Operation(summary = "국유in연동 등록", description = "국유in연동 등록")
|
||||||
@@ -309,7 +310,7 @@ public class GukYuinApiController {
|
|||||||
@PathVariable String chnDtctId,
|
@PathVariable String chnDtctId,
|
||||||
@Parameter(description = "날짜(기본은 어제 날짜)") @RequestParam(defaultValue = "20260205")
|
@Parameter(description = "날짜(기본은 어제 날짜)") @RequestParam(defaultValue = "20260205")
|
||||||
String yyyymmdd) {
|
String yyyymmdd) {
|
||||||
return ApiResponseDto.ok(gukYuinApiService.findRlbDtctList(chnDtctId, yyyymmdd));
|
return ApiResponseDto.ok(gukYuinApiService.findRlbDtctList(chnDtctId, yyyymmdd, ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "탐지객체 적합여부 조회 (객체별 조회)", description = "탐지객체 적합여부 조회 (객체별 조회)")
|
@Operation(summary = "탐지객체 적합여부 조회 (객체별 조회)", description = "탐지객체 적합여부 조회 (객체별 조회)")
|
||||||
|
|||||||
@@ -259,7 +259,8 @@ public class GukYuinApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 탐지객체 리스트 조회
|
// 탐지객체 리스트 조회
|
||||||
public ResultContDto findChnContList(String chnDtctId, Integer pageIndex, Integer pageSize) {
|
public ResultContDto findChnContList(
|
||||||
|
String chnDtctId, Integer pageIndex, Integer pageSize, String batchYn) {
|
||||||
|
|
||||||
String url =
|
String url =
|
||||||
gukyuinCdiUrl
|
gukyuinCdiUrl
|
||||||
@@ -272,7 +273,7 @@ public class GukYuinApiService {
|
|||||||
+ "&reqIp="
|
+ "&reqIp="
|
||||||
+ myip
|
+ myip
|
||||||
+ "&reqEpno="
|
+ "&reqEpno="
|
||||||
+ userUtil.getEmployeeNo();
|
+ ("Y".equals(batchYn) ? "BATCH" : userUtil.getEmployeeNo());
|
||||||
|
|
||||||
ExternalCallResult<ChngDetectContDto.ResultContDto> result =
|
ExternalCallResult<ChngDetectContDto.ResultContDto> result =
|
||||||
externalHttpClient.call(
|
externalHttpClient.call(
|
||||||
@@ -334,12 +335,12 @@ public class GukYuinApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ChngDetectContDto.ResultLabelDto updateChnDtctObjtLabelingYn(
|
public ChngDetectContDto.ResultLabelDto updateChnDtctObjtLabelingYn(
|
||||||
String chnDtctObjtId, String lblYn) {
|
String chnDtctObjtId, String lblYn, String batchYn) {
|
||||||
String url = gukyuinCdiUrl + "/rlb/objt/" + chnDtctObjtId + "/lbl/" + lblYn;
|
String url = gukyuinCdiUrl + "/rlb/objt/" + chnDtctObjtId + "/lbl/" + lblYn;
|
||||||
|
|
||||||
ReqInfo info = new ReqInfo();
|
ReqInfo info = new ReqInfo();
|
||||||
info.setReqIp(myip);
|
info.setReqIp(myip);
|
||||||
info.setReqEpno(userUtil.getEmployeeNo());
|
info.setReqEpno("Y".equals(batchYn) ? "BATCH" : userUtil.getEmployeeNo());
|
||||||
|
|
||||||
ExternalCallResult<ChngDetectContDto.ResultLabelDto> result =
|
ExternalCallResult<ChngDetectContDto.ResultLabelDto> result =
|
||||||
externalHttpClient.call(
|
externalHttpClient.call(
|
||||||
@@ -391,7 +392,7 @@ public class GukYuinApiService {
|
|||||||
return result.body();
|
return result.body();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResultDto listChnDtctId(String chnDtctId) {
|
public ResultDto listChnDtctId(String chnDtctId, String batchYn) {
|
||||||
String url =
|
String url =
|
||||||
gukyuinCdiUrl
|
gukyuinCdiUrl
|
||||||
+ "/chn/mast/"
|
+ "/chn/mast/"
|
||||||
@@ -399,7 +400,7 @@ public class GukYuinApiService {
|
|||||||
+ "?reqIp="
|
+ "?reqIp="
|
||||||
+ myip
|
+ myip
|
||||||
+ "&reqEpno="
|
+ "&reqEpno="
|
||||||
+ userUtil.getEmployeeNo();
|
+ ("Y".equals(batchYn) ? "BATCH" : userUtil.getEmployeeNo());
|
||||||
|
|
||||||
ExternalCallResult<ChngDetectMastDto.ResultDto> result =
|
ExternalCallResult<ChngDetectMastDto.ResultDto> result =
|
||||||
externalHttpClient.call(
|
externalHttpClient.call(
|
||||||
@@ -528,7 +529,8 @@ public class GukYuinApiService {
|
|||||||
return result.body();
|
return result.body();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChngDetectMastDto.RlbDtctDto findRlbDtctList(String chnDtctId, String yyyymmdd) {
|
public ChngDetectMastDto.RlbDtctDto findRlbDtctList(
|
||||||
|
String chnDtctId, String yyyymmdd, String batchYn) {
|
||||||
|
|
||||||
String url =
|
String url =
|
||||||
gukyuinCdiUrl
|
gukyuinCdiUrl
|
||||||
@@ -537,7 +539,7 @@ public class GukYuinApiService {
|
|||||||
+ "?reqIp="
|
+ "?reqIp="
|
||||||
+ myip
|
+ myip
|
||||||
+ "&reqEpno="
|
+ "&reqEpno="
|
||||||
+ userUtil.getEmployeeNo()
|
+ ("Y".equals(batchYn) ? "BATCH" : userUtil.getEmployeeNo())
|
||||||
+ "&yyyymmdd="
|
+ "&yyyymmdd="
|
||||||
+ yyyymmdd;
|
+ yyyymmdd;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.kamco.cd.kamcoback.inference;
|
package com.kamco.cd.kamcoback.inference;
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.common.download.DownloadExecutor;
|
import com.kamco.cd.kamcoback.common.download.RangeDownloadResponder;
|
||||||
import com.kamco.cd.kamcoback.common.download.dto.DownloadSpec;
|
|
||||||
import com.kamco.cd.kamcoback.common.exception.CustomApiException;
|
import com.kamco.cd.kamcoback.common.exception.CustomApiException;
|
||||||
import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
|
import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
|
||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto;
|
||||||
@@ -26,6 +25,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
|||||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
@@ -34,8 +34,8 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.http.MediaType;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@@ -45,9 +45,9 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody;
|
|
||||||
|
|
||||||
@Tag(name = "추론관리", description = "추론관리 API")
|
@Tag(name = "추론관리", description = "추론관리 API")
|
||||||
|
@Log4j2
|
||||||
@RequestMapping("/api/inference")
|
@RequestMapping("/api/inference")
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@RestController
|
@RestController
|
||||||
@@ -56,7 +56,7 @@ public class InferenceResultApiController {
|
|||||||
private final InferenceResultService inferenceResultService;
|
private final InferenceResultService inferenceResultService;
|
||||||
private final MapSheetMngService mapSheetMngService;
|
private final MapSheetMngService mapSheetMngService;
|
||||||
private final ModelMngService modelMngService;
|
private final ModelMngService modelMngService;
|
||||||
private final DownloadExecutor downloadExecutor;
|
private final RangeDownloadResponder rangeDownloadResponder;
|
||||||
|
|
||||||
@Operation(summary = "추론관리 목록", description = "어드민 홈 > 추론관리 > 추론관리 > 추론관리 목록")
|
@Operation(summary = "추론관리 목록", description = "어드민 홈 > 추론관리 > 추론관리 > 추론관리 목록")
|
||||||
@ApiResponses(
|
@ApiResponses(
|
||||||
@@ -195,7 +195,7 @@ public class InferenceResultApiController {
|
|||||||
LocalDate endDttm,
|
LocalDate endDttm,
|
||||||
@Parameter(description = "키워드 (모델버전)", example = "M1.H1.E28") @RequestParam(required = false)
|
@Parameter(description = "키워드 (모델버전)", example = "M1.H1.E28") @RequestParam(required = false)
|
||||||
String searchVal,
|
String searchVal,
|
||||||
@Parameter(description = "타입", example = "M1") @RequestParam(required = false)
|
@Parameter(description = "타입", example = "G1") @RequestParam(required = false)
|
||||||
String modelType,
|
String modelType,
|
||||||
@RequestParam(defaultValue = "0") int page,
|
@RequestParam(defaultValue = "0") int page,
|
||||||
@RequestParam(defaultValue = "20") int size) {
|
@RequestParam(defaultValue = "20") int size) {
|
||||||
@@ -356,9 +356,8 @@ public class InferenceResultApiController {
|
|||||||
@ApiResponse(responseCode = "404", description = "파일 없음", content = @Content),
|
@ApiResponse(responseCode = "404", description = "파일 없음", content = @Content),
|
||||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
})
|
})
|
||||||
@GetMapping(value = "/download/{uuid}")
|
@GetMapping("/download/{uuid}")
|
||||||
public ResponseEntity<StreamingResponseBody> download(
|
public ResponseEntity<?> download(@PathVariable UUID uuid, HttpServletRequest request)
|
||||||
@Parameter(example = "69c4e56c-e0bf-4742-9225-bba9aae39052") @PathVariable UUID uuid)
|
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
|
||||||
String path;
|
String path;
|
||||||
@@ -374,8 +373,8 @@ public class InferenceResultApiController {
|
|||||||
|
|
||||||
Path zipPath = Path.of(path);
|
Path zipPath = Path.of(path);
|
||||||
|
|
||||||
return downloadExecutor.stream(
|
// Range + 200/206/416 공통 처리 (추가 헤더 포함)
|
||||||
new DownloadSpec(uuid, zipPath, uid + ".zip", MediaType.APPLICATION_OCTET_STREAM));
|
return rangeDownloadResponder.buildZipResponse(zipPath, uid + ".zip", request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "shp 파일 다운로드 이력 조회", description = "추론관리 분석결과 shp 파일 다운로드 이력 조회")
|
@Operation(summary = "shp 파일 다운로드 이력 조회", description = "추론관리 분석결과 shp 파일 다운로드 이력 조회")
|
||||||
@@ -415,7 +414,7 @@ public class InferenceResultApiController {
|
|||||||
downloadReq.setStartDate(strtDttm);
|
downloadReq.setStartDate(strtDttm);
|
||||||
downloadReq.setEndDate(endDttm);
|
downloadReq.setEndDate(endDttm);
|
||||||
downloadReq.setSearchValue(searchValue);
|
downloadReq.setSearchValue(searchValue);
|
||||||
downloadReq.setRequestUri("/api/inference/download-audit/download/" + uuid);
|
downloadReq.setRequestUri("/api/inference/download/" + uuid);
|
||||||
|
|
||||||
return ApiResponseDto.ok(inferenceResultService.getDownloadAudit(searchReq, downloadReq));
|
return ApiResponseDto.ok(inferenceResultService.getDownloadAudit(searchReq, downloadReq));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -246,15 +246,15 @@ public class InferenceResultDto {
|
|||||||
@NotBlank
|
@NotBlank
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
@Schema(description = "M1", example = "b40e0f68-c1d8-49fc-93f9-a36270093861")
|
@Schema(description = "G1", example = "b40e0f68-c1d8-49fc-93f9-a36270093861")
|
||||||
@NotNull
|
@NotNull
|
||||||
private UUID model1Uuid;
|
private UUID model1Uuid;
|
||||||
|
|
||||||
@Schema(description = "M2", example = "ec92b7d2-b5a3-4915-9bdf-35fb3ca8ad27")
|
@Schema(description = "G2", example = "ec92b7d2-b5a3-4915-9bdf-35fb3ca8ad27")
|
||||||
@NotNull
|
@NotNull
|
||||||
private UUID model2Uuid;
|
private UUID model2Uuid;
|
||||||
|
|
||||||
@Schema(description = "M3", example = "37f45782-8ccf-4cf6-911c-a055a1510d39")
|
@Schema(description = "G3", example = "37f45782-8ccf-4cf6-911c-a055a1510d39")
|
||||||
@NotNull
|
@NotNull
|
||||||
private UUID model3Uuid;
|
private UUID model3Uuid;
|
||||||
|
|
||||||
@@ -297,6 +297,30 @@ public class InferenceResultDto {
|
|||||||
@Schema(name = "InferenceStatusDetailDto", description = "추론(변화탐지) 진행상태")
|
@Schema(name = "InferenceStatusDetailDto", description = "추론(변화탐지) 진행상태")
|
||||||
public static class InferenceStatusDetailDto {
|
public static class InferenceStatusDetailDto {
|
||||||
|
|
||||||
|
@Schema(description = "모델1 사용시간 시작일시")
|
||||||
|
@JsonFormatDttm
|
||||||
|
ZonedDateTime m1ModelStartDttm;
|
||||||
|
|
||||||
|
@Schema(description = "모델2 사용시간 시작일시")
|
||||||
|
@JsonFormatDttm
|
||||||
|
ZonedDateTime m2ModelStartDttm;
|
||||||
|
|
||||||
|
@Schema(description = "모델3 사용시간 시작일시")
|
||||||
|
@JsonFormatDttm
|
||||||
|
ZonedDateTime m3ModelStartDttm;
|
||||||
|
|
||||||
|
@Schema(description = "모델1 사용시간 종료일시")
|
||||||
|
@JsonFormatDttm
|
||||||
|
ZonedDateTime m1ModelEndDttm;
|
||||||
|
|
||||||
|
@Schema(description = "모델2 사용시간 종료일시")
|
||||||
|
@JsonFormatDttm
|
||||||
|
ZonedDateTime m2ModelEndDttm;
|
||||||
|
|
||||||
|
@Schema(description = "모델3 사용시간 종료일시")
|
||||||
|
@JsonFormatDttm
|
||||||
|
ZonedDateTime m3ModelEndDttm;
|
||||||
|
|
||||||
@Schema(description = "탐지대상 도엽수")
|
@Schema(description = "탐지대상 도엽수")
|
||||||
private Long detectingCnt;
|
private Long detectingCnt;
|
||||||
|
|
||||||
@@ -336,30 +360,6 @@ public class InferenceResultDto {
|
|||||||
@Schema(description = "모델3 분석 실패")
|
@Schema(description = "모델3 분석 실패")
|
||||||
private Integer m3FailedJobs;
|
private Integer m3FailedJobs;
|
||||||
|
|
||||||
@Schema(description = "모델1 사용시간 시작일시")
|
|
||||||
@JsonFormatDttm
|
|
||||||
ZonedDateTime m1ModelStartDttm;
|
|
||||||
|
|
||||||
@Schema(description = "모델2 사용시간 시작일시")
|
|
||||||
@JsonFormatDttm
|
|
||||||
ZonedDateTime m2ModelStartDttm;
|
|
||||||
|
|
||||||
@Schema(description = "모델3 사용시간 시작일시")
|
|
||||||
@JsonFormatDttm
|
|
||||||
ZonedDateTime m3ModelStartDttm;
|
|
||||||
|
|
||||||
@Schema(description = "모델1 사용시간 종료일시")
|
|
||||||
@JsonFormatDttm
|
|
||||||
ZonedDateTime m1ModelEndDttm;
|
|
||||||
|
|
||||||
@Schema(description = "모델2 사용시간 종료일시")
|
|
||||||
@JsonFormatDttm
|
|
||||||
ZonedDateTime m2ModelEndDttm;
|
|
||||||
|
|
||||||
@Schema(description = "모델3 사용시간 종료일시")
|
|
||||||
@JsonFormatDttm
|
|
||||||
ZonedDateTime m3ModelEndDttm;
|
|
||||||
|
|
||||||
@Schema(description = "변화탐지 제목")
|
@Schema(description = "변화탐지 제목")
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
@@ -496,19 +496,19 @@ public class InferenceResultDto {
|
|||||||
return MapSheetScope.getDescByCode(this.mapSheetScope);
|
return MapSheetScope.getDescByCode(this.mapSheetScope);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Schema(description = "M1 사용시간")
|
@Schema(description = "G1 사용시간")
|
||||||
@JsonProperty("m1ElapsedTim")
|
@JsonProperty("m1ElapsedTim")
|
||||||
public String getM1ElapsedTime() {
|
public String getM1ElapsedTime() {
|
||||||
return formatElapsedTime(this.m1ModelStartDttm, this.m1ModelEndDttm);
|
return formatElapsedTime(this.m1ModelStartDttm, this.m1ModelEndDttm);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Schema(description = "M2 사용시간")
|
@Schema(description = "G2 사용시간")
|
||||||
@JsonProperty("m2ElapsedTim")
|
@JsonProperty("m2ElapsedTim")
|
||||||
public String getM2ElapsedTime() {
|
public String getM2ElapsedTime() {
|
||||||
return formatElapsedTime(this.m2ModelStartDttm, this.m2ModelEndDttm);
|
return formatElapsedTime(this.m2ModelStartDttm, this.m2ModelEndDttm);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Schema(description = "M3 사용시간")
|
@Schema(description = "G3 사용시간")
|
||||||
@JsonProperty("m3ElapsedTim")
|
@JsonProperty("m3ElapsedTim")
|
||||||
public String getM3ElapsedTime() {
|
public String getM3ElapsedTime() {
|
||||||
return formatElapsedTime(this.m3ModelStartDttm, this.m3ModelEndDttm);
|
return formatElapsedTime(this.m3ModelStartDttm, this.m3ModelEndDttm);
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ public class InferenceResultService {
|
|||||||
saveInferenceAiDto.setUuid(uuid);
|
saveInferenceAiDto.setUuid(uuid);
|
||||||
saveInferenceAiDto.setBatchId(batchId);
|
saveInferenceAiDto.setBatchId(batchId);
|
||||||
saveInferenceAiDto.setStatus(Status.IN_PROGRESS.getId());
|
saveInferenceAiDto.setStatus(Status.IN_PROGRESS.getId());
|
||||||
saveInferenceAiDto.setType("M1");
|
saveInferenceAiDto.setType(ModelType.G1.getId());
|
||||||
saveInferenceAiDto.setInferStartDttm(ZonedDateTime.now());
|
saveInferenceAiDto.setInferStartDttm(ZonedDateTime.now());
|
||||||
saveInferenceAiDto.setModelComparePath(modelComparePath.getFilePath());
|
saveInferenceAiDto.setModelComparePath(modelComparePath.getFilePath());
|
||||||
saveInferenceAiDto.setModelTargetPath(modelTargetPath.getFilePath());
|
saveInferenceAiDto.setModelTargetPath(modelTargetPath.getFilePath());
|
||||||
@@ -414,12 +414,12 @@ public class InferenceResultService {
|
|||||||
|
|
||||||
String modelType = "";
|
String modelType = "";
|
||||||
|
|
||||||
if (modelInfo.getModelType().equals(ModelType.M1.getId())) {
|
if (modelInfo.getModelType().equals(ModelType.G1.getId())) {
|
||||||
modelType = "G1";
|
modelType = ModelType.G1.getId();
|
||||||
} else if (modelInfo.getModelType().equals(ModelType.M2.getId())) {
|
} else if (modelInfo.getModelType().equals(ModelType.G2.getId())) {
|
||||||
modelType = "G2";
|
modelType = ModelType.G2.getId();
|
||||||
} else {
|
} else {
|
||||||
modelType = "G3";
|
modelType = ModelType.G3.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
InferenceSendDto sendDto = new InferenceSendDto();
|
InferenceSendDto sendDto = new InferenceSendDto();
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.kamco.cd.kamcoback.label;
|
package com.kamco.cd.kamcoback.label;
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.common.download.DownloadExecutor;
|
import com.kamco.cd.kamcoback.common.download.RangeDownloadResponder;
|
||||||
import com.kamco.cd.kamcoback.common.download.dto.DownloadSpec;
|
|
||||||
import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
|
import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InferenceDetail;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InferenceDetail;
|
||||||
@@ -23,10 +22,13 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
|||||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
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.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -34,7 +36,6 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.apache.coyote.BadRequestException;
|
import org.apache.coyote.BadRequestException;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.http.MediaType;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
@@ -43,7 +44,6 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody;
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Tag(name = "라벨링 작업 관리", description = "라벨링 작업 배정 및 통계 조회 API")
|
@Tag(name = "라벨링 작업 관리", description = "라벨링 작업 배정 및 통계 조회 API")
|
||||||
@@ -53,7 +53,7 @@ import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBo
|
|||||||
public class LabelAllocateApiController {
|
public class LabelAllocateApiController {
|
||||||
|
|
||||||
private final LabelAllocateService labelAllocateService;
|
private final LabelAllocateService labelAllocateService;
|
||||||
private final DownloadExecutor downloadExecutor;
|
private final RangeDownloadResponder rangeDownloadResponder;
|
||||||
|
|
||||||
@Value("${file.dataset-response}")
|
@Value("${file.dataset-response}")
|
||||||
private String responsePath;
|
private String responsePath;
|
||||||
@@ -382,19 +382,17 @@ public class LabelAllocateApiController {
|
|||||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
})
|
})
|
||||||
@GetMapping("/download/{uuid}")
|
@GetMapping("/download/{uuid}")
|
||||||
public ResponseEntity<StreamingResponseBody> download(
|
public ResponseEntity<?> download(@PathVariable UUID uuid, HttpServletRequest request)
|
||||||
@Parameter(example = "6d8d49dc-0c9d-4124-adc7-b9ca610cc394") @PathVariable UUID uuid)
|
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
|
||||||
if (!labelAllocateService.isDownloadable(uuid)) {
|
|
||||||
throw new BadRequestException();
|
|
||||||
}
|
|
||||||
|
|
||||||
String uid = labelAllocateService.findLearnUid(uuid);
|
String uid = labelAllocateService.findLearnUid(uuid);
|
||||||
Path zipPath = Paths.get(responsePath).resolve(uid + ".zip");
|
Path zipPath = Paths.get(responsePath).resolve(uid + ".zip");
|
||||||
|
|
||||||
return downloadExecutor.stream(
|
if (!Files.isRegularFile(zipPath)) {
|
||||||
new DownloadSpec(uuid, zipPath, uid + ".zip", MediaType.APPLICATION_OCTET_STREAM));
|
throw new BadRequestException();
|
||||||
|
}
|
||||||
|
|
||||||
|
return rangeDownloadResponder.buildZipResponse(zipPath, uid + ".zip", request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "라벨 파일 다운로드 이력 조회", description = "라벨 파일 다운로드 이력 조회")
|
@Operation(summary = "라벨 파일 다운로드 이력 조회", description = "라벨 파일 다운로드 이력 조회")
|
||||||
@@ -461,4 +459,43 @@ public class LabelAllocateApiController {
|
|||||||
UUID uuid) {
|
UUID uuid) {
|
||||||
return ApiResponseDto.ok(labelAllocateService.isDownloadable(uuid));
|
return ApiResponseDto.ok(labelAllocateService.isDownloadable(uuid));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(
|
||||||
|
summary = "라벨링작업 관리 > 추가 작업 배정(실태조사 추가되면)",
|
||||||
|
description = "라벨링작업 관리 > 추가 작업 배정(실태조사 추가되면)")
|
||||||
|
@ApiResponses(
|
||||||
|
value = {
|
||||||
|
@ApiResponse(
|
||||||
|
responseCode = "201",
|
||||||
|
description = "등록 성공",
|
||||||
|
content =
|
||||||
|
@Content(
|
||||||
|
mediaType = "application/json",
|
||||||
|
schema = @Schema(implementation = Long.class))),
|
||||||
|
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
|
||||||
|
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||||
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
|
})
|
||||||
|
@PostMapping("/allocate-add-stblt")
|
||||||
|
public ApiResponseDto<ApiResponseDto.ResponseObj> labelAllocateAddStblt(
|
||||||
|
@RequestBody @Valid LabelAllocateDto.AllocateAddStbltDto dto) {
|
||||||
|
|
||||||
|
return ApiResponseDto.okObject(
|
||||||
|
labelAllocateService.allocateAddStbltYn(
|
||||||
|
dto.getTotalCnt(), dto.getUuid(), dto.getLabelers(), dto.getBaseDate()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "라벨링 추가 할당 가능한 건수", description = "라벨링 추가 할당 가능한 건수 API")
|
||||||
|
@ApiResponses(
|
||||||
|
value = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "조회 성공"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음"),
|
||||||
|
@ApiResponse(responseCode = "500", description = "서버 오류")
|
||||||
|
})
|
||||||
|
@GetMapping("/allocate-add-cnt")
|
||||||
|
public ApiResponseDto<Long> allocateAddCnt(
|
||||||
|
@RequestParam UUID uuid, @RequestParam LocalDate baseDate) {
|
||||||
|
|
||||||
|
return ApiResponseDto.ok(labelAllocateService.findAllocateAddCnt(uuid, baseDate));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.kamco.cd.kamcoback.label.dto;
|
|||||||
import com.kamco.cd.kamcoback.common.utils.enums.CodeExpose;
|
import com.kamco.cd.kamcoback.common.utils.enums.CodeExpose;
|
||||||
import com.kamco.cd.kamcoback.common.utils.enums.EnumType;
|
import com.kamco.cd.kamcoback.common.utils.enums.EnumType;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@@ -365,9 +366,35 @@ public class LabelAllocateDto {
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public static class InferenceLearnDto {
|
public static class InferenceLearnDto {
|
||||||
|
|
||||||
private UUID analUuid;
|
private UUID analUuid;
|
||||||
private String learnUid;
|
private String learnUid;
|
||||||
private String analState;
|
private String analState;
|
||||||
private Long analId;
|
private Long analId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class AllocateAddStbltDto {
|
||||||
|
|
||||||
|
@Schema(description = "총 잔여 건수", example = "179")
|
||||||
|
private Integer totalCnt;
|
||||||
|
|
||||||
|
@Schema(
|
||||||
|
description = "추가할당할 라벨러",
|
||||||
|
example =
|
||||||
|
"""
|
||||||
|
[
|
||||||
|
"123454", "654321", "222233", "777222"
|
||||||
|
]
|
||||||
|
""")
|
||||||
|
private List<String> labelers;
|
||||||
|
|
||||||
|
@Schema(description = "회차 마스터 key", example = "c0e77cc7-8c28-46ba-9ca4-11e90246ab44")
|
||||||
|
private UUID uuid;
|
||||||
|
|
||||||
|
@Schema(description = "기준일자", example = "2026-02-20")
|
||||||
|
private LocalDate baseDate;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import com.kamco.cd.kamcoback.log.dto.AuditLogDto;
|
|||||||
import com.kamco.cd.kamcoback.log.dto.AuditLogDto.DownloadReq;
|
import com.kamco.cd.kamcoback.log.dto.AuditLogDto.DownloadReq;
|
||||||
import com.kamco.cd.kamcoback.postgres.core.AuditLogCoreService;
|
import com.kamco.cd.kamcoback.postgres.core.AuditLogCoreService;
|
||||||
import com.kamco.cd.kamcoback.postgres.core.LabelAllocateCoreService;
|
import com.kamco.cd.kamcoback.postgres.core.LabelAllocateCoreService;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@@ -27,11 +28,12 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
@Transactional
|
@Transactional(readOnly = true)
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class LabelAllocateService {
|
public class LabelAllocateService {
|
||||||
|
|
||||||
@@ -276,6 +278,7 @@ public class LabelAllocateService {
|
|||||||
return labelAllocateCoreService.findLabelingIngProcessCnt();
|
return labelAllocateCoreService.findLabelingIngProcessCnt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(propagation = Propagation.NOT_SUPPORTED)
|
||||||
public String findLearnUid(UUID uuid) {
|
public String findLearnUid(UUID uuid) {
|
||||||
return labelAllocateCoreService.findLearnUid(uuid);
|
return labelAllocateCoreService.findLearnUid(uuid);
|
||||||
}
|
}
|
||||||
@@ -300,4 +303,52 @@ public class LabelAllocateService {
|
|||||||
public boolean isDownloadable(UUID uuid) {
|
public boolean isDownloadable(UUID uuid) {
|
||||||
return labelAllocateCoreService.isDownloadable(uuid);
|
return labelAllocateCoreService.isDownloadable(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 실태조사가 값 들어온 기간만큼 할당하는 로직 (최초 할당 이후 작업)
|
||||||
|
*
|
||||||
|
* @param uuid
|
||||||
|
* @param targetUsers
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Transactional
|
||||||
|
public ApiResponseDto.ResponseObj allocateAddStbltYn(
|
||||||
|
Integer totalCnt, UUID uuid, List<String> targetUsers, LocalDate baseDate) {
|
||||||
|
|
||||||
|
int userCount = targetUsers.size();
|
||||||
|
if (userCount == 0) {
|
||||||
|
return new ApiResponseDto.ResponseObj(ApiResponseCode.BAD_REQUEST, "추가 할당할 라벨러를 선택해주세요.");
|
||||||
|
}
|
||||||
|
|
||||||
|
int base = totalCnt / userCount;
|
||||||
|
int remainder = totalCnt % userCount;
|
||||||
|
Long lastId = null;
|
||||||
|
List<AllocateInfoDto> allIds =
|
||||||
|
labelAllocateCoreService.fetchNextIdsAddStbltYn(
|
||||||
|
uuid, baseDate, lastId, totalCnt.longValue());
|
||||||
|
|
||||||
|
// MapSheetAnalInferenceEntity analUid 가져오기
|
||||||
|
Long analUid = labelAllocateCoreService.findMapSheetAnalInferenceUid(uuid);
|
||||||
|
|
||||||
|
int index = 0;
|
||||||
|
for (int i = 0; i < userCount; i++) {
|
||||||
|
int assignCount = base;
|
||||||
|
// 마지막 사람에게 나머지 몰아주기
|
||||||
|
if (i == userCount - 1) {
|
||||||
|
assignCount += remainder;
|
||||||
|
}
|
||||||
|
|
||||||
|
int end = index + assignCount;
|
||||||
|
List<AllocateInfoDto> sub = allIds.subList(index, end);
|
||||||
|
|
||||||
|
labelAllocateCoreService.assignOwner(sub, targetUsers.get(i), analUid);
|
||||||
|
index = end;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ApiResponseDto.ResponseObj(ApiResponseCode.OK, "추가 할당이 완료되었습니다.");
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long findAllocateAddCnt(UUID uuid, LocalDate baseDate) {
|
||||||
|
return labelAllocateCoreService.findAllocateAddCnt(uuid, baseDate);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,7 +134,6 @@ public class MapSheetMngService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MngDto mngDto = mapSheetMngCoreService.findMapSheetMng(errDto.getMngYyyy());
|
MngDto mngDto = mapSheetMngCoreService.findMapSheetMng(errDto.getMngYyyy());
|
||||||
String targetYearDir = mngDto.getMngPath();
|
|
||||||
|
|
||||||
// 중복체크 -> 도엽50k/uuid 경로에 업로드 할 거라 overwrite 되지 않음
|
// 중복체크 -> 도엽50k/uuid 경로에 업로드 할 거라 overwrite 되지 않음
|
||||||
// if (!overwrite) {
|
// if (!overwrite) {
|
||||||
|
|||||||
@@ -41,21 +41,6 @@ public class ModelMngApiController {
|
|||||||
|
|
||||||
private final ModelMngService modelMngService;
|
private final ModelMngService modelMngService;
|
||||||
|
|
||||||
@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.dataset-dir}")
|
|
||||||
private String datasetDir;
|
|
||||||
|
|
||||||
@Value("${file.dataset-tmp-dir}")
|
|
||||||
private String datasetTmpDir;
|
|
||||||
|
|
||||||
@Value("${file.model-dir}")
|
@Value("${file.model-dir}")
|
||||||
private String modelDir;
|
private String modelDir;
|
||||||
|
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ public class ModelMngDto {
|
|||||||
@Getter
|
@Getter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum ModelType implements EnumType {
|
public enum ModelType implements EnumType {
|
||||||
M1("모델 M1"),
|
G1("G1"),
|
||||||
M2("모델 M2"),
|
G2("G2"),
|
||||||
M3("모델 M3");
|
G3("G3");
|
||||||
|
|
||||||
private final String desc;
|
private final String desc;
|
||||||
|
|
||||||
|
|||||||
@@ -35,27 +35,6 @@ public class ModelMngService {
|
|||||||
|
|
||||||
private final UploadService uploadService;
|
private final UploadService uploadService;
|
||||||
|
|
||||||
@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.dataset-dir}")
|
|
||||||
private String datasetDir;
|
|
||||||
|
|
||||||
@Value("${file.dataset-tmp-dir}")
|
|
||||||
private String datasetTmpDir;
|
|
||||||
|
|
||||||
@Value("${file.model-dir}")
|
|
||||||
private String modelDir;
|
|
||||||
|
|
||||||
@Value("${file.model-tmp-dir}")
|
|
||||||
private String modelTmpDir;
|
|
||||||
|
|
||||||
@Value("${file.pt-path}")
|
@Value("${file.pt-path}")
|
||||||
private String ptPath;
|
private String ptPath;
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,11 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
|||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto;
|
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto;
|
||||||
|
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.ChangeDetectionMapDto;
|
||||||
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapScaleType;
|
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapScaleType;
|
||||||
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapSheetList;
|
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapSheetList;
|
||||||
import com.kamco.cd.kamcoback.common.enums.DetectionClassification;
|
import com.kamco.cd.kamcoback.common.enums.DetectionClassification;
|
||||||
|
import com.kamco.cd.kamcoback.common.exception.CustomApiException;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataInferenceGeomEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataInferenceGeomEntity;
|
||||||
import com.kamco.cd.kamcoback.postgres.repository.changedetection.ChangeDetectionRepository;
|
import com.kamco.cd.kamcoback.postgres.repository.changedetection.ChangeDetectionRepository;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -15,6 +17,7 @@ import java.util.stream.Collectors;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.locationtech.jts.geom.Geometry;
|
import org.locationtech.jts.geom.Geometry;
|
||||||
import org.locationtech.jts.geom.Point;
|
import org.locationtech.jts.geom.Point;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@@ -96,4 +99,10 @@ public class ChangeDetectionCoreService {
|
|||||||
public List<MapSheetList> getChangeDetectionMapSheet50kList(UUID uuid) {
|
public List<MapSheetList> getChangeDetectionMapSheet50kList(UUID uuid) {
|
||||||
return changeDetectionRepository.getChangeDetectionMapSheet50kList(uuid);
|
return changeDetectionRepository.getChangeDetectionMapSheet50kList(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UUID getChangeDetectionUuid(ChangeDetectionMapDto req) {
|
||||||
|
return changeDetectionRepository
|
||||||
|
.getChangeDetectionUuid(req)
|
||||||
|
.orElseThrow(() -> new CustomApiException("NOT_FOUND_DATA", HttpStatus.NOT_FOUND));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.ResultList;
|
|||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.SaveInferenceAiDto;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.SaveInferenceAiDto;
|
||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultsTestingDto;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultsTestingDto;
|
||||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.MngListDto;
|
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.MngListDto;
|
||||||
|
import com.kamco.cd.kamcoback.model.dto.ModelMngDto.ModelType;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.InferenceResultsTestingEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.InferenceResultsTestingEntity;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.MapInkx5kEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.MapInkx5kEntity;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataInferenceEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataInferenceEntity;
|
||||||
@@ -110,7 +111,7 @@ public class InferenceResultCoreService {
|
|||||||
|
|
||||||
MapSheetLearnEntity mapSheetLearnEntity = new MapSheetLearnEntity();
|
MapSheetLearnEntity mapSheetLearnEntity = new MapSheetLearnEntity();
|
||||||
mapSheetLearnEntity.setTitle(req.getTitle());
|
mapSheetLearnEntity.setTitle(req.getTitle());
|
||||||
mapSheetLearnEntity.setRunningModelType("M1");
|
mapSheetLearnEntity.setRunningModelType(ModelType.G1.getId());
|
||||||
mapSheetLearnEntity.setM1ModelUuid(req.getModel1Uuid());
|
mapSheetLearnEntity.setM1ModelUuid(req.getModel1Uuid());
|
||||||
mapSheetLearnEntity.setM2ModelUuid(req.getModel2Uuid());
|
mapSheetLearnEntity.setM2ModelUuid(req.getModel2Uuid());
|
||||||
mapSheetLearnEntity.setM3ModelUuid(req.getModel3Uuid());
|
mapSheetLearnEntity.setM3ModelUuid(req.getModel3Uuid());
|
||||||
@@ -301,7 +302,7 @@ public class InferenceResultCoreService {
|
|||||||
|
|
||||||
private void applyModelUpdate(MapSheetLearnEntity entity, SaveInferenceAiDto request) {
|
private void applyModelUpdate(MapSheetLearnEntity entity, SaveInferenceAiDto request) {
|
||||||
switch (request.getType()) {
|
switch (request.getType()) {
|
||||||
case "M1" ->
|
case "G1" ->
|
||||||
applyModelFields(
|
applyModelFields(
|
||||||
request,
|
request,
|
||||||
entity::setM1ModelBatchId,
|
entity::setM1ModelBatchId,
|
||||||
@@ -311,7 +312,7 @@ public class InferenceResultCoreService {
|
|||||||
entity::setM1RunningJobs,
|
entity::setM1RunningJobs,
|
||||||
entity::setM1CompletedJobs,
|
entity::setM1CompletedJobs,
|
||||||
entity::setM1FailedJobs);
|
entity::setM1FailedJobs);
|
||||||
case "M2" ->
|
case "G2" ->
|
||||||
applyModelFields(
|
applyModelFields(
|
||||||
request,
|
request,
|
||||||
entity::setM2ModelBatchId,
|
entity::setM2ModelBatchId,
|
||||||
@@ -321,7 +322,7 @@ public class InferenceResultCoreService {
|
|||||||
entity::setM2RunningJobs,
|
entity::setM2RunningJobs,
|
||||||
entity::setM2CompletedJobs,
|
entity::setM2CompletedJobs,
|
||||||
entity::setM2FailedJobs);
|
entity::setM2FailedJobs);
|
||||||
case "M3" ->
|
case "G3" ->
|
||||||
applyModelFields(
|
applyModelFields(
|
||||||
request,
|
request,
|
||||||
entity::setM3ModelBatchId,
|
entity::setM3ModelBatchId,
|
||||||
|
|||||||
@@ -257,16 +257,20 @@ public class LabelAllocateCoreService {
|
|||||||
|
|
||||||
// 파일이 있는지만 확인
|
// 파일이 있는지만 확인
|
||||||
Path path = Paths.get(responsePath).resolve(dto.getLearnUid() + ".zip");
|
Path path = Paths.get(responsePath).resolve(dto.getLearnUid() + ".zip");
|
||||||
|
if (!Files.isRegularFile(path)) {
|
||||||
if (!Files.exists(path) || !Files.isRegularFile(path)) {
|
return false; // exists 포함
|
||||||
// 실제 파일만 true (디렉터리는 제외)
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 다운로드 확인할 학습데이터가 라벨링중인 경우 파일 생성여부가 정상인지 확인
|
String state = dto.getAnalState();
|
||||||
if (dto.getAnalState().equals(LabelMngState.ASSIGNED.getId())
|
boolean isLabelingIng =
|
||||||
|| dto.getAnalState().equals(LabelMngState.ING.getId())) {
|
LabelMngState.ASSIGNED.getId().equals(state) || LabelMngState.ING.getId().equals(state);
|
||||||
return batchStepHistoryRepository.isDownloadable(dto.getAnalId());
|
|
||||||
|
if (isLabelingIng) {
|
||||||
|
Long analId = dto.getAnalId();
|
||||||
|
if (analId == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return batchStepHistoryRepository.isDownloadable(analId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -277,4 +281,13 @@ public class LabelAllocateCoreService {
|
|||||||
.findLearnUid(uuid)
|
.findLearnUid(uuid)
|
||||||
.orElseThrow(() -> new CustomApiException("NOT_FOUND_DATA", HttpStatus.NOT_FOUND));
|
.orElseThrow(() -> new CustomApiException("NOT_FOUND_DATA", HttpStatus.NOT_FOUND));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<AllocateInfoDto> fetchNextIdsAddStbltYn(
|
||||||
|
UUID uuid, LocalDate baseDate, Long lastId, Long totalCnt) {
|
||||||
|
return labelAllocateRepository.fetchNextIdsAddStbltYn(uuid, baseDate, lastId, totalCnt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long findAllocateAddCnt(UUID uuid, LocalDate baseDate) {
|
||||||
|
return labelAllocateRepository.findAllocateAddCnt(uuid, baseDate);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -283,11 +283,19 @@ public class MapSheetMngCoreService {
|
|||||||
|
|
||||||
// 4) 파일 생성
|
// 4) 파일 생성
|
||||||
try {
|
try {
|
||||||
|
log.info("create Directories outputPath: {}", outputPath);
|
||||||
|
log.info(
|
||||||
|
"activeEnv={}, inferenceDir={}, targetDir={}, filename={}",
|
||||||
|
activeEnv,
|
||||||
|
inferenceDir,
|
||||||
|
targetDir,
|
||||||
|
filename);
|
||||||
|
log.info("outputPath={}, parent={}", outputPath.toAbsolutePath(), outputPath.getParent());
|
||||||
Files.createDirectories(outputPath.getParent());
|
Files.createDirectories(outputPath.getParent());
|
||||||
|
|
||||||
new GeoJsonFileWriter()
|
new GeoJsonFileWriter()
|
||||||
.exportToFile(sceneInference, "scene_inference_" + yyyy, 5186, outputPath.toString());
|
.exportToFile(sceneInference, "scene_inference_" + yyyy, 5186, outputPath.toString());
|
||||||
|
log.info("GeoJsonFileWriter: {}", "scene_inference_" + yyyy);
|
||||||
Scene scene = new Scene();
|
Scene scene = new Scene();
|
||||||
scene.setFeatures(sceneInference);
|
scene.setFeatures(sceneInference);
|
||||||
scene.setFilePath(outputPath.toString());
|
scene.setFilePath(outputPath.toString());
|
||||||
@@ -297,7 +305,7 @@ public class MapSheetMngCoreService {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error(
|
log.error(
|
||||||
"FAIL_CREATE_MAP_SHEET_FILE: yyyy={}, isAll={}, path={}", yyyy, isAll, outputPath, e);
|
"FAIL_CREATE_MAP_SHEET_FILE: yyyy={}, isAll={}, path={}", yyyy, isAll, outputPath, e);
|
||||||
throw new CustomApiException("FAIL_CREATE_MAP_SHEET_FILE", HttpStatus.INTERNAL_SERVER_ERROR);
|
throw new CustomApiException("INTERNAL_SERVER_ERROR", HttpStatus.INTERNAL_SERVER_ERROR, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,17 +35,17 @@ public class MapSheetLearn5kRepositoryImpl implements MapSheetLearn5kRepositoryC
|
|||||||
final StringPath errorMsgPath;
|
final StringPath errorMsgPath;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "M1" -> {
|
case "G1" -> {
|
||||||
failPath = mapSheetLearn5kEntity.isM1Fail;
|
failPath = mapSheetLearn5kEntity.isM1Fail;
|
||||||
jobIdPath = mapSheetLearn5kEntity.m1JobId;
|
jobIdPath = mapSheetLearn5kEntity.m1JobId;
|
||||||
errorMsgPath = mapSheetLearn5kEntity.m1ErrorMessage;
|
errorMsgPath = mapSheetLearn5kEntity.m1ErrorMessage;
|
||||||
}
|
}
|
||||||
case "M2" -> {
|
case "G2" -> {
|
||||||
failPath = mapSheetLearn5kEntity.isM2Fail;
|
failPath = mapSheetLearn5kEntity.isM2Fail;
|
||||||
jobIdPath = mapSheetLearn5kEntity.m2JobId;
|
jobIdPath = mapSheetLearn5kEntity.m2JobId;
|
||||||
errorMsgPath = mapSheetLearn5kEntity.m2ErrorMessage;
|
errorMsgPath = mapSheetLearn5kEntity.m2ErrorMessage;
|
||||||
}
|
}
|
||||||
case "M3" -> {
|
case "G3" -> {
|
||||||
failPath = mapSheetLearn5kEntity.isM3Fail;
|
failPath = mapSheetLearn5kEntity.isM3Fail;
|
||||||
jobIdPath = mapSheetLearn5kEntity.m3JobId;
|
jobIdPath = mapSheetLearn5kEntity.m3JobId;
|
||||||
errorMsgPath = mapSheetLearn5kEntity.m3ErrorMessage;
|
errorMsgPath = mapSheetLearn5kEntity.m3ErrorMessage;
|
||||||
@@ -85,15 +85,15 @@ public class MapSheetLearn5kRepositoryImpl implements MapSheetLearn5kRepositoryC
|
|||||||
final StringPath errorMsgPath;
|
final StringPath errorMsgPath;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "M1" -> {
|
case "G1" -> {
|
||||||
failPath = mapSheetLearn5kEntity.isM1Fail;
|
failPath = mapSheetLearn5kEntity.isM1Fail;
|
||||||
jobIdPath = mapSheetLearn5kEntity.m1JobId;
|
jobIdPath = mapSheetLearn5kEntity.m1JobId;
|
||||||
}
|
}
|
||||||
case "M2" -> {
|
case "G2" -> {
|
||||||
failPath = mapSheetLearn5kEntity.isM2Fail;
|
failPath = mapSheetLearn5kEntity.isM2Fail;
|
||||||
jobIdPath = mapSheetLearn5kEntity.m2JobId;
|
jobIdPath = mapSheetLearn5kEntity.m2JobId;
|
||||||
}
|
}
|
||||||
case "M3" -> {
|
case "G3" -> {
|
||||||
failPath = mapSheetLearn5kEntity.isM3Fail;
|
failPath = mapSheetLearn5kEntity.isM3Fail;
|
||||||
jobIdPath = mapSheetLearn5kEntity.m3JobId;
|
jobIdPath = mapSheetLearn5kEntity.m3JobId;
|
||||||
}
|
}
|
||||||
@@ -135,15 +135,15 @@ public class MapSheetLearn5kRepositoryImpl implements MapSheetLearn5kRepositoryC
|
|||||||
BooleanPath failPath;
|
BooleanPath failPath;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "M1" -> {
|
case "G1" -> {
|
||||||
jobIdPath = mapSheetLearn5kEntity.m1JobId;
|
jobIdPath = mapSheetLearn5kEntity.m1JobId;
|
||||||
failPath = mapSheetLearn5kEntity.isM1Fail;
|
failPath = mapSheetLearn5kEntity.isM1Fail;
|
||||||
}
|
}
|
||||||
case "M2" -> {
|
case "G2" -> {
|
||||||
jobIdPath = mapSheetLearn5kEntity.m2JobId;
|
jobIdPath = mapSheetLearn5kEntity.m2JobId;
|
||||||
failPath = mapSheetLearn5kEntity.isM2Fail;
|
failPath = mapSheetLearn5kEntity.isM2Fail;
|
||||||
}
|
}
|
||||||
case "M3" -> {
|
case "G3" -> {
|
||||||
jobIdPath = mapSheetLearn5kEntity.m3JobId;
|
jobIdPath = mapSheetLearn5kEntity.m3JobId;
|
||||||
failPath = mapSheetLearn5kEntity.isM3Fail;
|
failPath = mapSheetLearn5kEntity.isM3Fail;
|
||||||
}
|
}
|
||||||
@@ -180,13 +180,13 @@ public class MapSheetLearn5kRepositoryImpl implements MapSheetLearn5kRepositoryC
|
|||||||
BooleanPath failPath;
|
BooleanPath failPath;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "M1" -> {
|
case "G1" -> {
|
||||||
jobIdPath = mapSheetLearn5kEntity.m1JobId;
|
jobIdPath = mapSheetLearn5kEntity.m1JobId;
|
||||||
}
|
}
|
||||||
case "M2" -> {
|
case "G2" -> {
|
||||||
jobIdPath = mapSheetLearn5kEntity.m2JobId;
|
jobIdPath = mapSheetLearn5kEntity.m2JobId;
|
||||||
}
|
}
|
||||||
case "M3" -> {
|
case "G3" -> {
|
||||||
jobIdPath = mapSheetLearn5kEntity.m3JobId;
|
jobIdPath = mapSheetLearn5kEntity.m3JobId;
|
||||||
}
|
}
|
||||||
default -> {
|
default -> {
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.repository.changedetection;
|
package com.kamco.cd.kamcoback.postgres.repository.changedetection;
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto;
|
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto;
|
||||||
|
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.ChangeDetectionMapDto;
|
||||||
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapScaleType;
|
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapScaleType;
|
||||||
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapSheetList;
|
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapSheetList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public interface ChangeDetectionRepositoryCustom {
|
public interface ChangeDetectionRepositoryCustom {
|
||||||
@@ -28,4 +30,6 @@ public interface ChangeDetectionRepositoryCustom {
|
|||||||
List<ChangeDetectionDto.MapSheetList> getChangeDetectionMapSheetList(UUID uuid);
|
List<ChangeDetectionDto.MapSheetList> getChangeDetectionMapSheetList(UUID uuid);
|
||||||
|
|
||||||
List<MapSheetList> getChangeDetectionMapSheet50kList(UUID uuid);
|
List<MapSheetList> getChangeDetectionMapSheet50kList(UUID uuid);
|
||||||
|
|
||||||
|
Optional<UUID> getChangeDetectionUuid(ChangeDetectionMapDto req);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
|||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto;
|
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto;
|
||||||
|
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.ChangeDetectionMapDto;
|
||||||
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.DetectSearchType;
|
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.DetectSearchType;
|
||||||
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapScaleType;
|
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapScaleType;
|
||||||
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapSheetList;
|
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapSheetList;
|
||||||
@@ -21,6 +22,7 @@ import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataInferenceGeomEntit
|
|||||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceEntity;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalInferenceEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalInferenceEntity;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity;
|
||||||
|
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.CaseBuilder;
|
import com.querydsl.core.types.dsl.CaseBuilder;
|
||||||
@@ -30,10 +32,13 @@ import com.querydsl.jpa.JPAExpressions;
|
|||||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport;
|
import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
|
public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
|
||||||
implements ChangeDetectionRepositoryCustom {
|
implements ChangeDetectionRepositoryCustom {
|
||||||
|
|
||||||
@@ -371,4 +376,24 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
"{0} || {1}", imageryEntity.cogMiddlePath, imageryEntity.cogFilename))
|
"{0} || {1}", imageryEntity.cogMiddlePath, imageryEntity.cogFilename))
|
||||||
.otherwise("");
|
.otherwise("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<UUID> getChangeDetectionUuid(ChangeDetectionMapDto req) {
|
||||||
|
BooleanBuilder builder = new BooleanBuilder();
|
||||||
|
builder.and(mapSheetAnalInferenceEntity.stage.isNotNull());
|
||||||
|
builder.and(mapSheetAnalInferenceEntity.compareYyyy.eq(req.getCompareYyyy()));
|
||||||
|
builder.and(mapSheetAnalInferenceEntity.targetYyyy.eq(req.getTargetYyyy()));
|
||||||
|
|
||||||
|
return Optional.ofNullable(
|
||||||
|
queryFactory
|
||||||
|
.select(mapSheetAnalInferenceEntity.uuid)
|
||||||
|
.from(mapSheetAnalInferenceEntity)
|
||||||
|
.innerJoin(mapSheetAnalDataInferenceEntity)
|
||||||
|
.on(mapSheetAnalInferenceEntity.id.eq(mapSheetAnalDataInferenceEntity.analUid))
|
||||||
|
.where(builder)
|
||||||
|
.groupBy(mapSheetAnalInferenceEntity.uuid, mapSheetAnalInferenceEntity.stage)
|
||||||
|
.orderBy(mapSheetAnalInferenceEntity.stage.desc())
|
||||||
|
.limit(1)
|
||||||
|
.fetchOne());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,4 +110,9 @@ public interface LabelAllocateRepositoryCustom {
|
|||||||
InferenceLearnDto findLabelingIngProcessId(UUID uuid);
|
InferenceLearnDto findLabelingIngProcessId(UUID uuid);
|
||||||
|
|
||||||
Optional<String> findLearnUid(UUID uuid);
|
Optional<String> findLearnUid(UUID uuid);
|
||||||
|
|
||||||
|
List<AllocateInfoDto> fetchNextIdsAddStbltYn(
|
||||||
|
UUID uuid, LocalDate baseDate, Long lastId, Long totalCnt);
|
||||||
|
|
||||||
|
Long findAllocateAddCnt(UUID uuid, LocalDate baseDate);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1856,4 +1856,56 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
.where(mapSheetAnalInferenceEntity.uuid.eq(uuid))
|
.where(mapSheetAnalInferenceEntity.uuid.eq(uuid))
|
||||||
.fetchOne());
|
.fetchOne());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AllocateInfoDto> fetchNextIdsAddStbltYn(
|
||||||
|
UUID uuid, LocalDate baseDate, Long lastId, Long totalCnt) {
|
||||||
|
ZoneId zone = ZoneId.of("Asia/Seoul"); // 기준 타임존 명확히
|
||||||
|
ZonedDateTime nextDayStart = baseDate.plusDays(1).atStartOfDay(zone);
|
||||||
|
|
||||||
|
return queryFactory
|
||||||
|
.select(
|
||||||
|
Projections.constructor(
|
||||||
|
AllocateInfoDto.class,
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.geoUid,
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.mapSheetNum,
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.pnu))
|
||||||
|
.from(mapSheetAnalInferenceEntity)
|
||||||
|
.innerJoin(mapSheetAnalDataInferenceEntity)
|
||||||
|
.on(mapSheetAnalInferenceEntity.id.eq(mapSheetAnalDataInferenceEntity.analUid))
|
||||||
|
.innerJoin(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.on(
|
||||||
|
mapSheetAnalDataInferenceEntity.id.eq(mapSheetAnalDataInferenceGeomEntity.dataUid),
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.pnu.gt(0),
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.fitState.eq(ImageryFitStatus.UNFIT.getId()),
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.fitStateDttm.lt(nextDayStart),
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.labelState.isNull())
|
||||||
|
.where(
|
||||||
|
mapSheetAnalInferenceEntity.uuid.eq(uuid),
|
||||||
|
lastId == null ? null : mapSheetAnalDataInferenceGeomEntity.geoUid.gt(lastId))
|
||||||
|
.orderBy(mapSheetAnalDataInferenceGeomEntity.mapSheetNum.asc())
|
||||||
|
.limit(totalCnt)
|
||||||
|
.fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long findAllocateAddCnt(UUID uuid, LocalDate baseDate) {
|
||||||
|
ZoneId zone = ZoneId.of("Asia/Seoul"); // 기준 타임존 명확히
|
||||||
|
ZonedDateTime nextDayStart = baseDate.plusDays(1).atStartOfDay(zone);
|
||||||
|
|
||||||
|
return queryFactory
|
||||||
|
.select(mapSheetAnalDataInferenceGeomEntity.geoUid.count())
|
||||||
|
.from(mapSheetAnalInferenceEntity)
|
||||||
|
.innerJoin(mapSheetAnalDataInferenceEntity)
|
||||||
|
.on(mapSheetAnalInferenceEntity.id.eq(mapSheetAnalDataInferenceEntity.analUid))
|
||||||
|
.innerJoin(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.on(
|
||||||
|
mapSheetAnalDataInferenceEntity.id.eq(mapSheetAnalDataInferenceGeomEntity.dataUid),
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.pnu.gt(0),
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.fitState.eq(ImageryFitStatus.UNFIT.getId()),
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.fitStateDttm.lt(nextDayStart),
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.labelState.isNull())
|
||||||
|
.where(mapSheetAnalInferenceEntity.uuid.eq(uuid))
|
||||||
|
.fetchOne();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity.mapShe
|
|||||||
|
|
||||||
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.model.dto.ModelMngDto.ModelType;
|
||||||
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;
|
||||||
@@ -58,10 +59,10 @@ public class TrainingDataReviewJobRepositoryImpl extends QuerydslRepositorySuppo
|
|||||||
Properties.class,
|
Properties.class,
|
||||||
new CaseBuilder()
|
new CaseBuilder()
|
||||||
.when(mapSheetLearnDataGeomEntity.classAfterCd.in("building", "container"))
|
.when(mapSheetLearnDataGeomEntity.classAfterCd.in("building", "container"))
|
||||||
.then("M1")
|
.then(ModelType.G1.getId())
|
||||||
.when(mapSheetLearnDataGeomEntity.classAfterCd.eq("waste"))
|
.when(mapSheetLearnDataGeomEntity.classAfterCd.eq("waste"))
|
||||||
.then("M2")
|
.then(ModelType.G2.getId())
|
||||||
.otherwise("M3"),
|
.otherwise(ModelType.G3.getId()),
|
||||||
mapSheetLearnDataGeomEntity.classBeforeCd,
|
mapSheetLearnDataGeomEntity.classBeforeCd,
|
||||||
mapSheetLearnDataGeomEntity.classAfterCd)))
|
mapSheetLearnDataGeomEntity.classAfterCd)))
|
||||||
.from(labelingAssignmentEntity)
|
.from(labelingAssignmentEntity)
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
.orderBy(
|
.orderBy(
|
||||||
mapSheetAnalInferenceEntity.targetYyyy.asc(),
|
mapSheetAnalInferenceEntity.targetYyyy.asc(),
|
||||||
mapSheetAnalInferenceEntity.compareYyyy.asc(),
|
mapSheetAnalInferenceEntity.compareYyyy.asc(),
|
||||||
|
labelingAssignmentEntity.assignGroupId.asc(),
|
||||||
labelingAssignmentEntity.createdDate.asc(),
|
labelingAssignmentEntity.createdDate.asc(),
|
||||||
labelingAssignmentEntity.inferenceGeomUid.asc())
|
labelingAssignmentEntity.inferenceGeomUid.asc())
|
||||||
.fetch();
|
.fetch();
|
||||||
@@ -306,10 +307,6 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
queryFactory
|
queryFactory
|
||||||
.select(labelingAssignmentEntity.count())
|
.select(labelingAssignmentEntity.count())
|
||||||
.from(labelingAssignmentEntity)
|
.from(labelingAssignmentEntity)
|
||||||
.innerJoin(mapSheetAnalInferenceEntity)
|
|
||||||
.on(
|
|
||||||
labelingAssignmentEntity.analUid.eq(mapSheetAnalInferenceEntity.id),
|
|
||||||
mapSheetAnalInferenceEntity.analState.ne(LabelMngState.FINISH.getId()))
|
|
||||||
.where(labelingAssignmentEntity.workerUid.eq(userId))
|
.where(labelingAssignmentEntity.workerUid.eq(userId))
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
@@ -330,10 +327,6 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
queryFactory
|
queryFactory
|
||||||
.select(labelingAssignmentEntity.count())
|
.select(labelingAssignmentEntity.count())
|
||||||
.from(labelingAssignmentEntity)
|
.from(labelingAssignmentEntity)
|
||||||
.innerJoin(mapSheetAnalInferenceEntity)
|
|
||||||
.on(
|
|
||||||
labelingAssignmentEntity.analUid.eq(mapSheetAnalInferenceEntity.id),
|
|
||||||
mapSheetAnalInferenceEntity.analState.ne(LabelMngState.FINISH.getId()))
|
|
||||||
.where(
|
.where(
|
||||||
labelingAssignmentEntity.workerUid.eq(userId),
|
labelingAssignmentEntity.workerUid.eq(userId),
|
||||||
labelingAssignmentEntity.workState.eq("ASSIGNED"))
|
labelingAssignmentEntity.workState.eq("ASSIGNED"))
|
||||||
@@ -362,10 +355,6 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
queryFactory
|
queryFactory
|
||||||
.select(labelingAssignmentEntity.count())
|
.select(labelingAssignmentEntity.count())
|
||||||
.from(labelingAssignmentEntity)
|
.from(labelingAssignmentEntity)
|
||||||
.innerJoin(mapSheetAnalInferenceEntity)
|
|
||||||
.on(
|
|
||||||
labelingAssignmentEntity.analUid.eq(mapSheetAnalInferenceEntity.id),
|
|
||||||
mapSheetAnalInferenceEntity.analState.ne(LabelMngState.FINISH.getId()))
|
|
||||||
.where(
|
.where(
|
||||||
labelingAssignmentEntity.workerUid.eq(userId),
|
labelingAssignmentEntity.workerUid.eq(userId),
|
||||||
labelingAssignmentEntity.workState.in(
|
labelingAssignmentEntity.workState.in(
|
||||||
@@ -653,6 +642,7 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
queryFactory
|
queryFactory
|
||||||
.select(
|
.select(
|
||||||
labelingAssignmentEntity.assignmentUid,
|
labelingAssignmentEntity.assignmentUid,
|
||||||
|
labelingAssignmentEntity.assignGroupId,
|
||||||
labelingAssignmentEntity.createdDate,
|
labelingAssignmentEntity.createdDate,
|
||||||
labelingAssignmentEntity.inferenceGeomUid,
|
labelingAssignmentEntity.inferenceGeomUid,
|
||||||
mapSheetAnalInferenceEntity.targetYyyy,
|
mapSheetAnalInferenceEntity.targetYyyy,
|
||||||
@@ -671,6 +661,7 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
.orderBy(
|
.orderBy(
|
||||||
mapSheetAnalInferenceEntity.targetYyyy.asc(),
|
mapSheetAnalInferenceEntity.targetYyyy.asc(),
|
||||||
mapSheetAnalInferenceEntity.compareYyyy.asc(),
|
mapSheetAnalInferenceEntity.compareYyyy.asc(),
|
||||||
|
labelingAssignmentEntity.assignGroupId.asc(),
|
||||||
labelingAssignmentEntity.createdDate.asc(),
|
labelingAssignmentEntity.createdDate.asc(),
|
||||||
labelingAssignmentEntity.inferenceGeomUid.asc())
|
labelingAssignmentEntity.inferenceGeomUid.asc())
|
||||||
.limit(1)
|
.limit(1)
|
||||||
@@ -685,6 +676,7 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
Long inferenceGeomUid = firstAssigned.get(labelingAssignmentEntity.inferenceGeomUid);
|
Long inferenceGeomUid = firstAssigned.get(labelingAssignmentEntity.inferenceGeomUid);
|
||||||
Integer targetYyyy = firstAssigned.get(mapSheetAnalInferenceEntity.targetYyyy);
|
Integer targetYyyy = firstAssigned.get(mapSheetAnalInferenceEntity.targetYyyy);
|
||||||
Integer compareYyyy = firstAssigned.get(mapSheetAnalInferenceEntity.compareYyyy);
|
Integer compareYyyy = firstAssigned.get(mapSheetAnalInferenceEntity.compareYyyy);
|
||||||
|
String assignGroupId = firstAssigned.get(labelingAssignmentEntity.assignGroupId);
|
||||||
|
|
||||||
BooleanExpression beforeCondition =
|
BooleanExpression beforeCondition =
|
||||||
mapSheetAnalInferenceEntity
|
mapSheetAnalInferenceEntity
|
||||||
@@ -700,12 +692,20 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
.targetYyyy
|
.targetYyyy
|
||||||
.eq(targetYyyy)
|
.eq(targetYyyy)
|
||||||
.and(mapSheetAnalInferenceEntity.compareYyyy.eq(compareYyyy))
|
.and(mapSheetAnalInferenceEntity.compareYyyy.eq(compareYyyy))
|
||||||
|
.and(labelingAssignmentEntity.assignGroupId.lt(assignGroupId)))
|
||||||
|
.or(
|
||||||
|
mapSheetAnalInferenceEntity
|
||||||
|
.targetYyyy
|
||||||
|
.eq(targetYyyy)
|
||||||
|
.and(mapSheetAnalInferenceEntity.compareYyyy.eq(compareYyyy))
|
||||||
|
.and(labelingAssignmentEntity.assignGroupId.eq(assignGroupId))
|
||||||
.and(labelingAssignmentEntity.createdDate.lt(createdDttm)))
|
.and(labelingAssignmentEntity.createdDate.lt(createdDttm)))
|
||||||
.or(
|
.or(
|
||||||
mapSheetAnalInferenceEntity
|
mapSheetAnalInferenceEntity
|
||||||
.targetYyyy
|
.targetYyyy
|
||||||
.eq(targetYyyy)
|
.eq(targetYyyy)
|
||||||
.and(mapSheetAnalInferenceEntity.compareYyyy.eq(compareYyyy))
|
.and(mapSheetAnalInferenceEntity.compareYyyy.eq(compareYyyy))
|
||||||
|
.and(labelingAssignmentEntity.assignGroupId.eq(assignGroupId))
|
||||||
.and(labelingAssignmentEntity.createdDate.eq(createdDttm))
|
.and(labelingAssignmentEntity.createdDate.eq(createdDttm))
|
||||||
.and(labelingAssignmentEntity.inferenceGeomUid.lt(inferenceGeomUid)));
|
.and(labelingAssignmentEntity.inferenceGeomUid.lt(inferenceGeomUid)));
|
||||||
|
|
||||||
|
|||||||
@@ -314,10 +314,6 @@ public class TrainingDataReviewRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
queryFactory
|
queryFactory
|
||||||
.select(labelingAssignmentEntity.count())
|
.select(labelingAssignmentEntity.count())
|
||||||
.from(labelingAssignmentEntity)
|
.from(labelingAssignmentEntity)
|
||||||
.innerJoin(mapSheetAnalInferenceEntity)
|
|
||||||
.on(
|
|
||||||
labelingAssignmentEntity.analUid.eq(mapSheetAnalInferenceEntity.id),
|
|
||||||
mapSheetAnalInferenceEntity.analState.ne(LabelMngState.FINISH.getId()))
|
|
||||||
.where(labelingAssignmentEntity.inspectorUid.eq(userId))
|
.where(labelingAssignmentEntity.inspectorUid.eq(userId))
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
@@ -338,10 +334,6 @@ public class TrainingDataReviewRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
queryFactory
|
queryFactory
|
||||||
.select(labelingAssignmentEntity.count())
|
.select(labelingAssignmentEntity.count())
|
||||||
.from(labelingAssignmentEntity)
|
.from(labelingAssignmentEntity)
|
||||||
.innerJoin(mapSheetAnalInferenceEntity)
|
|
||||||
.on(
|
|
||||||
labelingAssignmentEntity.analUid.eq(mapSheetAnalInferenceEntity.id),
|
|
||||||
mapSheetAnalInferenceEntity.analState.ne(LabelMngState.FINISH.getId()))
|
|
||||||
.where(
|
.where(
|
||||||
labelingAssignmentEntity.inspectorUid.eq(userId),
|
labelingAssignmentEntity.inspectorUid.eq(userId),
|
||||||
labelingAssignmentEntity.inspectState.eq("UNCONFIRM"))
|
labelingAssignmentEntity.inspectState.eq("UNCONFIRM"))
|
||||||
@@ -370,10 +362,6 @@ public class TrainingDataReviewRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
queryFactory
|
queryFactory
|
||||||
.select(labelingAssignmentEntity.count())
|
.select(labelingAssignmentEntity.count())
|
||||||
.from(labelingAssignmentEntity)
|
.from(labelingAssignmentEntity)
|
||||||
.innerJoin(mapSheetAnalInferenceEntity)
|
|
||||||
.on(
|
|
||||||
labelingAssignmentEntity.analUid.eq(mapSheetAnalInferenceEntity.id),
|
|
||||||
mapSheetAnalInferenceEntity.analState.ne(LabelMngState.FINISH.getId()))
|
|
||||||
.where(
|
.where(
|
||||||
labelingAssignmentEntity.inspectorUid.eq(userId),
|
labelingAssignmentEntity.inspectorUid.eq(userId),
|
||||||
labelingAssignmentEntity.inspectState.in("COMPLETE", "EXCEPT"),
|
labelingAssignmentEntity.inspectState.in("COMPLETE", "EXCEPT"),
|
||||||
|
|||||||
@@ -60,10 +60,10 @@ select msldge1_0.geo_uid,
|
|||||||
st_asgeojson(msldge1_0.geom),
|
st_asgeojson(msldge1_0.geom),
|
||||||
case
|
case
|
||||||
when (msldge1_0.class_after_cd in ('building', 'container'))
|
when (msldge1_0.class_after_cd in ('building', 'container'))
|
||||||
then cast('M1' as varchar)
|
then cast('G1' as varchar)
|
||||||
when (msldge1_0.class_after_cd = 'waste')
|
when (msldge1_0.class_after_cd = 'waste')
|
||||||
then cast('M2' as varchar)
|
then cast('G2' as varchar)
|
||||||
else 'M3'
|
else 'G3'
|
||||||
end,
|
end,
|
||||||
msldge1_0.class_before_cd,
|
msldge1_0.class_before_cd,
|
||||||
msldge1_0.class_after_cd
|
msldge1_0.class_after_cd
|
||||||
|
|||||||
@@ -20,4 +20,15 @@ public class AsyncConfig {
|
|||||||
ex.initialize();
|
ex.initialize();
|
||||||
return ex;
|
return ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean(name = "auditLogExecutor")
|
||||||
|
public Executor auditLogExecutor() {
|
||||||
|
ThreadPoolTaskExecutor exec = new ThreadPoolTaskExecutor();
|
||||||
|
exec.setCorePoolSize(2);
|
||||||
|
exec.setMaxPoolSize(8);
|
||||||
|
exec.setQueueCapacity(2000);
|
||||||
|
exec.setThreadNamePrefix("auditlog-");
|
||||||
|
exec.initialize();
|
||||||
|
return exec;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class GukYuinApiLabelJobService {
|
|||||||
|
|
||||||
for (GeomUidDto gto : list) {
|
for (GeomUidDto gto : list) {
|
||||||
ChngDetectContDto.ResultLabelDto dto =
|
ChngDetectContDto.ResultLabelDto dto =
|
||||||
gukYuinApiService.updateChnDtctObjtLabelingYn(gto.getResultUid(), "Y");
|
gukYuinApiService.updateChnDtctObjtLabelingYn(gto.getResultUid(), "Y", "Y");
|
||||||
if (dto.getSuccess()) {
|
if (dto.getSuccess()) {
|
||||||
// inference_geom 에 label_send_dttm 업데이트 하기
|
// inference_geom 에 label_send_dttm 업데이트 하기
|
||||||
gukYuinLabelJobCoreService.updateAnalDataInferenceGeomSendDttm(gto.getGeoUid());
|
gukYuinLabelJobCoreService.updateAnalDataInferenceGeomSendDttm(gto.getGeoUid());
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class GukYuinApiPnuJobService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void processUid(String chnDtctId, String uid) {
|
private void processUid(String chnDtctId, String uid) {
|
||||||
ResultDto result = gukYuinApiService.listChnDtctId(chnDtctId);
|
ResultDto result = gukYuinApiService.listChnDtctId(chnDtctId, "Y");
|
||||||
if (result == null || result.getResult() == null || result.getResult().isEmpty()) {
|
if (result == null || result.getResult() == null || result.getResult().isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -85,7 +85,7 @@ public class GukYuinApiPnuJobService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void processPage(String uid, int page, int pageSize) {
|
private void processPage(String uid, int page, int pageSize) {
|
||||||
ResultContDto resContList = gukYuinApiService.findChnContList(uid, page, pageSize);
|
ResultContDto resContList = gukYuinApiService.findChnContList(uid, page, pageSize, "Y");
|
||||||
|
|
||||||
if (resContList.getResult() == null || resContList.getResult().isEmpty()) {
|
if (resContList.getResult() == null || resContList.getResult().isEmpty()) {
|
||||||
return; // 외부 API 이상 방어
|
return; // 외부 API 이상 방어
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public class GukYuinApiStatusJobService {
|
|||||||
|
|
||||||
for (LearnKeyDto dto : list) {
|
for (LearnKeyDto dto : list) {
|
||||||
try {
|
try {
|
||||||
ChngDetectMastDto.ResultDto result = gukYuinApiService.listChnDtctId(dto.getUid());
|
ChngDetectMastDto.ResultDto result = gukYuinApiService.listChnDtctId(dto.getUid(), "Y");
|
||||||
|
|
||||||
if (result == null || result.getResult() == null || result.getResult().isEmpty()) {
|
if (result == null || result.getResult() == null || result.getResult().isEmpty()) {
|
||||||
log.warn("[GUKYUIN] empty result chnDtctMstId={}", dto.getChnDtctMstId());
|
log.warn("[GUKYUIN] empty result chnDtctMstId={}", dto.getChnDtctMstId());
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public class GukYuinApiStbltJobService {
|
|||||||
LocalDate.now(ZoneId.of("Asia/Seoul"))
|
LocalDate.now(ZoneId.of("Asia/Seoul"))
|
||||||
.minusDays(1)
|
.minusDays(1)
|
||||||
.format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
.format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
||||||
RlbDtctDto result = gukYuinApiService.findRlbDtctList(dto.getUid(), yesterday);
|
RlbDtctDto result = gukYuinApiService.findRlbDtctList(dto.getUid(), yesterday, "Y");
|
||||||
|
|
||||||
if (result == null || result.getResult() == null || result.getResult().isEmpty()) {
|
if (result == null || result.getResult() == null || result.getResult().isEmpty()) {
|
||||||
log.warn("[GUKYUIN] empty result chnDtctMstId={}", dto.getChnDtctMstId());
|
log.warn("[GUKYUIN] empty result chnDtctMstId={}", dto.getChnDtctMstId());
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.kamco.cd.kamcoback.inference.dto.InferenceProgressDto;
|
|||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.SaveInferenceAiDto;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.SaveInferenceAiDto;
|
||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.Status;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.Status;
|
||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceSendDto;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceSendDto;
|
||||||
|
import com.kamco.cd.kamcoback.model.dto.ModelMngDto.ModelType;
|
||||||
import com.kamco.cd.kamcoback.postgres.core.InferenceResultCoreService;
|
import com.kamco.cd.kamcoback.postgres.core.InferenceResultCoreService;
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.BatchStatusDto;
|
import com.kamco.cd.kamcoback.scheduler.dto.BatchStatusDto;
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.JobStatusDto;
|
import com.kamco.cd.kamcoback.scheduler.dto.JobStatusDto;
|
||||||
@@ -122,7 +123,7 @@ public class MapSheetInferenceJobService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private Long resolveBatchId(InferenceBatchSheet sheet) {
|
private Long resolveBatchId(InferenceBatchSheet sheet) {
|
||||||
// M3 > M2 > M1
|
// G3 > G2 > G1
|
||||||
if (sheet.getM3BatchId() != null) {
|
if (sheet.getM3BatchId() != null) {
|
||||||
return sheet.getM3BatchId();
|
return sheet.getM3BatchId();
|
||||||
}
|
}
|
||||||
@@ -216,12 +217,12 @@ public class MapSheetInferenceJobService {
|
|||||||
updateProcessingEndTimeByModel(job, sheet.getUuid(), now, currentType);
|
updateProcessingEndTimeByModel(job, sheet.getUuid(), now, currentType);
|
||||||
|
|
||||||
// M3이면 전체 종료
|
// M3이면 전체 종료
|
||||||
if ("M3".equals(currentType)) {
|
if (ModelType.G3.getId().equals(currentType)) {
|
||||||
endAll(sheet, now);
|
endAll(sheet, now);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 다음 모델 실행 (M1->M2, M2->M3)
|
// 다음 모델 실행 (G1->G2, G2->G3)
|
||||||
String nextType = nextModelType(currentType);
|
String nextType = nextModelType(currentType);
|
||||||
UUID nextModelUuid = resolveModelUuid(sheet, nextType);
|
UUID nextModelUuid = resolveModelUuid(sheet, nextType);
|
||||||
|
|
||||||
@@ -240,7 +241,7 @@ public class MapSheetInferenceJobService {
|
|||||||
save.setUuid(sheet.getUuid());
|
save.setUuid(sheet.getUuid());
|
||||||
save.setStatus(Status.END.getId());
|
save.setStatus(Status.END.getId());
|
||||||
save.setInferEndDttm(now);
|
save.setInferEndDttm(now);
|
||||||
save.setType("M3"); // 마지막 모델 기준
|
save.setType(ModelType.G3.getId()); // 마지막 모델 기준
|
||||||
inferenceResultCoreService.update(save);
|
inferenceResultCoreService.update(save);
|
||||||
|
|
||||||
// 추론 종료일때 geom 데이터 저장
|
// 추론 종료일때 geom 데이터 저장
|
||||||
@@ -266,11 +267,11 @@ public class MapSheetInferenceJobService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private String nextModelType(String currentType) {
|
private String nextModelType(String currentType) {
|
||||||
if ("M1".equals(currentType)) {
|
if (ModelType.G1.getId().equals(currentType)) {
|
||||||
return "M2";
|
return ModelType.G2.getId();
|
||||||
}
|
}
|
||||||
if ("M2".equals(currentType)) {
|
if (ModelType.G2.getId().equals(currentType)) {
|
||||||
return "M3";
|
return ModelType.G3.getId();
|
||||||
}
|
}
|
||||||
throw new IllegalArgumentException("Unknown runningModelType: " + currentType);
|
throw new IllegalArgumentException("Unknown runningModelType: " + currentType);
|
||||||
}
|
}
|
||||||
@@ -283,13 +284,13 @@ public class MapSheetInferenceJobService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private UUID resolveModelUuid(InferenceBatchSheet sheet, String type) {
|
private UUID resolveModelUuid(InferenceBatchSheet sheet, String type) {
|
||||||
if ("M1".equals(type)) {
|
if (ModelType.G1.getId().equals(type)) {
|
||||||
return sheet.getM1ModelUuid();
|
return sheet.getM1ModelUuid();
|
||||||
}
|
}
|
||||||
if ("M2".equals(type)) {
|
if (ModelType.G2.getId().equals(type)) {
|
||||||
return sheet.getM2ModelUuid();
|
return sheet.getM2ModelUuid();
|
||||||
}
|
}
|
||||||
if ("M3".equals(type)) {
|
if (ModelType.G3.getId().equals(type)) {
|
||||||
return sheet.getM3ModelUuid();
|
return sheet.getM3ModelUuid();
|
||||||
}
|
}
|
||||||
throw new IllegalArgumentException("Unknown type: " + type);
|
throw new IllegalArgumentException("Unknown type: " + type);
|
||||||
@@ -332,9 +333,6 @@ public class MapSheetInferenceJobService {
|
|||||||
InferenceProgressDto progressDto =
|
InferenceProgressDto progressDto =
|
||||||
inferenceResultCoreService.getInferenceAiResultById(id, modelUuid);
|
inferenceResultCoreService.getInferenceAiResultById(id, modelUuid);
|
||||||
|
|
||||||
// ai 에 맞는 모델 명으로 변경
|
|
||||||
String inferenceType = modelToInferenceType(type);
|
|
||||||
|
|
||||||
InferenceSendDto.pred_requests_areas predRequestsAreas =
|
InferenceSendDto.pred_requests_areas predRequestsAreas =
|
||||||
new InferenceSendDto.pred_requests_areas();
|
new InferenceSendDto.pred_requests_areas();
|
||||||
predRequestsAreas.setInput1_year(progressDto.getPred_requests_areas().getInput1_year());
|
predRequestsAreas.setInput1_year(progressDto.getPred_requests_areas().getInput1_year());
|
||||||
@@ -355,7 +353,7 @@ public class MapSheetInferenceJobService {
|
|||||||
m.setCls_model_path(
|
m.setCls_model_path(
|
||||||
Paths.get(progressDto.getCdModelClsPath(), progressDto.getCdModelClsFileName()).toString());
|
Paths.get(progressDto.getCdModelClsPath(), progressDto.getCdModelClsFileName()).toString());
|
||||||
m.setCls_model_version(progressDto.getClsModelVersion());
|
m.setCls_model_version(progressDto.getClsModelVersion());
|
||||||
m.setCd_model_type(inferenceType);
|
m.setCd_model_type(type);
|
||||||
m.setPriority(progressDto.getPriority());
|
m.setPriority(progressDto.getPriority());
|
||||||
|
|
||||||
// log.info("InferenceSendDto={}", m);
|
// log.info("InferenceSendDto={}", m);
|
||||||
@@ -372,25 +370,6 @@ public class MapSheetInferenceJobService {
|
|||||||
inferenceResultCoreService.update(saveInferenceAiDto);
|
inferenceResultCoreService.update(saveInferenceAiDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* ai 에 맞는 모델 명으로 변경
|
|
||||||
*
|
|
||||||
* @param type 모델 타입
|
|
||||||
* @return String
|
|
||||||
*/
|
|
||||||
private String modelToInferenceType(String type) {
|
|
||||||
if ("M1".equals(type)) {
|
|
||||||
return "G1";
|
|
||||||
}
|
|
||||||
if ("M2".equals(type)) {
|
|
||||||
return "G2";
|
|
||||||
}
|
|
||||||
if ("M3".equals(type)) {
|
|
||||||
return "G3";
|
|
||||||
}
|
|
||||||
throw new IllegalArgumentException("Unknown type: " + type);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* api 호출
|
* api 호출
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -29,27 +29,12 @@ public class UploadApiController {
|
|||||||
|
|
||||||
private final UploadService uploadService;
|
private final UploadService uploadService;
|
||||||
|
|
||||||
@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.dataset-dir}")
|
@Value("${file.dataset-dir}")
|
||||||
private String datasetDir;
|
private String datasetDir;
|
||||||
|
|
||||||
@Value("${file.dataset-tmp-dir}")
|
@Value("${file.dataset-tmp-dir}")
|
||||||
private String datasetTmpDir;
|
private String datasetTmpDir;
|
||||||
|
|
||||||
@Value("${file.model-dir}")
|
|
||||||
private String modelDir;
|
|
||||||
|
|
||||||
@Value("${file.model-tmp-dir}")
|
|
||||||
private String modelTmpDir;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@Operation(summary = "데이터셋 대용량 업로드 세션 시작", description = "데이터셋 대용량 파일 업로드 세션을 시작합니다.")
|
@Operation(summary = "데이터셋 대용량 업로드 세션 시작", description = "데이터셋 대용량 파일 업로드 세션을 시작합니다.")
|
||||||
@ApiResponses(
|
@ApiResponses(
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ spring:
|
|||||||
format_sql: true # ⚠️ 선택 - SQL 포맷팅 (가독성)
|
format_sql: true # ⚠️ 선택 - SQL 포맷팅 (가독성)
|
||||||
jdbc:
|
jdbc:
|
||||||
batch_size: 1000 # ✅ 추가 (JDBC batch)
|
batch_size: 1000 # ✅ 추가 (JDBC batch)
|
||||||
|
open-in-view: false
|
||||||
|
mvc:
|
||||||
|
async:
|
||||||
|
request-timeout: 300s # 5분 (예: 30s, 120s, 10m 등도 가능)
|
||||||
|
|
||||||
datasource:
|
datasource:
|
||||||
url: jdbc:postgresql://192.168.2.127:15432/kamco_cds
|
url: jdbc:postgresql://192.168.2.127:15432/kamco_cds
|
||||||
@@ -83,24 +87,25 @@ mapsheet:
|
|||||||
upload:
|
upload:
|
||||||
skipGdalValidation: true
|
skipGdalValidation: true
|
||||||
shp:
|
shp:
|
||||||
baseurl: /app/tmp/detect/result
|
baseurl: /app/tmp/detect/result #현재사용안함
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
file:
|
file:
|
||||||
#sync-root-dir: D:/kamco-nfs/images/
|
#sync-root-dir: D:/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: /kamco-nfs/requests/temp # image upload temp dir
|
||||||
|
#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: 2024
|
||||||
sync-auto-exception-before-year-cnt: 3
|
sync-auto-exception-before-year-cnt: 3
|
||||||
|
|
||||||
#dataset-dir: D:/kamco-nfs/dataset/
|
#dataset-dir: D:/kamco-nfs/model_output/
|
||||||
dataset-dir: /kamco-nfs/dataset/export/
|
dataset-dir: /kamco-nfs/model_output/export/ # 마운트경로 AI 추론결과
|
||||||
dataset-tmp-dir: ${file.dataset-dir}tmp/
|
dataset-tmp-dir: ${file.dataset-dir}tmp/
|
||||||
|
|
||||||
#model-dir: D:/kamco-nfs/ckpt/model/
|
#model-dir: D:/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
|
||||||
|
|
||||||
@@ -112,8 +117,8 @@ file:
|
|||||||
inference:
|
inference:
|
||||||
url: http://192.168.2.183:8000/jobs
|
url: http://192.168.2.183:8000/jobs
|
||||||
batch-url: http://192.168.2.183:8000/batches
|
batch-url: http://192.168.2.183:8000/batches
|
||||||
geojson-dir: /kamco-nfs/requests/
|
geojson-dir: /kamco-nfs/requests/ # 추론실행을 위한 파일생성경로
|
||||||
jar-path: /kamco-nfs/dataset/shp/shp-exporter.jar
|
jar-path: /kamco-nfs/repo/jar/shp-exporter.jar
|
||||||
inference-server-name: server1,server2,server3,server4
|
inference-server-name: server1,server2,server3,server4
|
||||||
|
|
||||||
gukyuin:
|
gukyuin:
|
||||||
@@ -122,10 +127,12 @@ gukyuin:
|
|||||||
cdi: ${gukyuin.url}/api/kcd/cdi
|
cdi: ${gukyuin.url}/api/kcd/cdi
|
||||||
|
|
||||||
training-data:
|
training-data:
|
||||||
geojson-dir: /kamco-nfs/model_output/labeling/
|
geojson-dir: /kamco-nfs/dataset/request/
|
||||||
|
|
||||||
layer:
|
layer:
|
||||||
geoserver-url: https://kamco.geo-dev.gs.dabeeo.com
|
geoserver-url: https://kamco.geo-dev.gs.dabeeo.com
|
||||||
wms-path: geoserver/cd
|
wms-path: geoserver/cd
|
||||||
wmts-path: geoserver/cd/gwc/service
|
wmts-path: geoserver/cd/gwc/service
|
||||||
workspace: cd
|
workspace: cd
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,14 +16,44 @@ spring:
|
|||||||
format_sql: true # ⚠️ 선택 - SQL 포맷팅 (가독성)
|
format_sql: true # ⚠️ 선택 - SQL 포맷팅 (가독성)
|
||||||
jdbc:
|
jdbc:
|
||||||
batch_size: 1000 # ✅ 추가 (JDBC batch)
|
batch_size: 1000 # ✅ 추가 (JDBC batch)
|
||||||
|
open-in-view: false
|
||||||
|
mvc:
|
||||||
|
async:
|
||||||
|
request-timeout: 300s # 5분 (예: 30s, 120s, 10m 등도 가능)
|
||||||
|
|
||||||
datasource:
|
datasource:
|
||||||
url: jdbc:postgresql://10.100.0.10:25432/temp
|
url: jdbc:postgresql://127.0.0.1:15432/kamco_cds
|
||||||
username: temp
|
#url: jdbc:postgresql://localhost:15432/kamco_cds
|
||||||
password: temp123!
|
username: kamco_cds
|
||||||
|
password: kamco_cds_Q!W@E#R$
|
||||||
hikari:
|
hikari:
|
||||||
minimum-idle: 10
|
minimum-idle: 10
|
||||||
maximum-pool-size: 20
|
maximum-pool-size: 20
|
||||||
|
connection-timeout: 60000 # 60초 연결 타임아웃
|
||||||
|
idle-timeout: 300000 # 5분 유휴 타임아웃
|
||||||
|
max-lifetime: 1800000 # 30분 최대 수명
|
||||||
|
leak-detection-threshold: 60000 # 연결 누수 감지
|
||||||
|
|
||||||
|
transaction:
|
||||||
|
default-timeout: 300 # 5분 트랜잭션 타임아웃
|
||||||
|
|
||||||
|
data:
|
||||||
|
redis:
|
||||||
|
host: 127.0.0.1
|
||||||
|
port: 16379
|
||||||
|
password: kamco
|
||||||
|
|
||||||
|
servlet:
|
||||||
|
multipart:
|
||||||
|
enabled: true
|
||||||
|
max-file-size: 4GB
|
||||||
|
max-request-size: 4GB
|
||||||
|
file-size-threshold: 10MB
|
||||||
|
|
||||||
|
server:
|
||||||
|
tomcat:
|
||||||
|
max-swallow-size: 4GB
|
||||||
|
max-http-form-post-size: 4GB
|
||||||
|
|
||||||
jwt:
|
jwt:
|
||||||
secret: "kamco_token_9b71e778-19a3-4c1d-97bf-2d687de17d5b"
|
secret: "kamco_token_9b71e778-19a3-4c1d-97bf-2d687de17d5b"
|
||||||
@@ -34,28 +64,39 @@ token:
|
|||||||
refresh-cookie-name: kamco # 개발용 쿠키 이름
|
refresh-cookie-name: kamco # 개발용 쿠키 이름
|
||||||
refresh-cookie-secure: true # 로컬 http 테스트면 false
|
refresh-cookie-secure: true # 로컬 http 테스트면 false
|
||||||
|
|
||||||
|
logging:
|
||||||
|
level:
|
||||||
|
root: INFO
|
||||||
|
org.springframework.web: DEBUG
|
||||||
|
org.springframework.security: DEBUG
|
||||||
|
|
||||||
|
# 헬스체크 노이즈 핵심만 다운
|
||||||
|
org.springframework.security.web.FilterChainProxy: INFO
|
||||||
|
org.springframework.security.web.authentication.AnonymousAuthenticationFilter: INFO
|
||||||
|
org.springframework.security.web.authentication.Http403ForbiddenEntryPoint: INFO
|
||||||
|
org.springframework.web.servlet.DispatcherServlet: INFO
|
||||||
|
|
||||||
|
|
||||||
mapsheet:
|
mapsheet:
|
||||||
upload:
|
upload:
|
||||||
skipGdalValidation: true
|
skipGdalValidation: true
|
||||||
shp:
|
shp:
|
||||||
baseurl: /app/detect/result
|
baseurl: /app/detect/result #현재사용안함
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
file:
|
file:
|
||||||
#sync-root-dir: D:/kamco-nfs/images/
|
#sync-root-dir: D:/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 # image upload temp dir
|
||||||
sync-file-extention: tfw,tif
|
sync-file-extention: tfw,tif
|
||||||
sync-auto-exception-start-year: 2025
|
sync-auto-exception-start-year: 2025
|
||||||
sync-auto-exception-before-year-cnt: 3
|
sync-auto-exception-before-year-cnt: 3
|
||||||
|
|
||||||
#dataset-dir: D:/kamco-nfs/dataset/
|
#dataset-dir: D:/kamco-nfs/model_output/ #변경 model_output
|
||||||
dataset-dir: /kamco-nfs/dataset/export/
|
dataset-dir: /kamco-nfs/model_output/export/ # 마운트경로 AI 추론결과
|
||||||
dataset-tmp-dir: ${file.dataset-dir}tmp/
|
dataset-tmp-dir: ${file.dataset-dir}tmp/
|
||||||
|
|
||||||
#model-dir: D:/kamco-nfs/ckpt/model/
|
#model-dir: D:/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
|
||||||
|
|
||||||
@@ -65,19 +106,18 @@ file:
|
|||||||
dataset-response: /kamco-nfs/dataset/response/
|
dataset-response: /kamco-nfs/dataset/response/
|
||||||
|
|
||||||
inference:
|
inference:
|
||||||
url: http://192.168.2.183:8000/jobs
|
url: http://127.0.0.1:8000/jobs
|
||||||
batch-url: http://192.168.2.183:8000/batches
|
batch-url: http://127.0.0.1:8000/batches
|
||||||
geojson-dir: /kamco-nfs/requests/
|
geojson-dir: /kamco-nfs/requests/ # 학습서버에서 트레이닝한 모델업로드경로
|
||||||
jar-path: /kamco-nfs/dataset/shp/shp-exporter.jar
|
jar-path: /kamco-nfs/repo/jar/shp-exporter.jar # 추론실행을 위한 파일생성경로
|
||||||
inference-server-name: server1,server2,server3,server4
|
inference-server-name: server1,server2,server3,server4
|
||||||
|
|
||||||
gukyuin:
|
gukyuin:
|
||||||
#url: http://localhost:8080
|
url: http://127.0.0.1:5301
|
||||||
url: http://192.168.2.129:5301
|
|
||||||
cdi: ${gukyuin.url}/api/kcd/cdi
|
cdi: ${gukyuin.url}/api/kcd/cdi
|
||||||
|
|
||||||
training-data:
|
training-data:
|
||||||
geojson-dir: /kamco-nfs/model_output/labeling/
|
geojson-dir: /kamco-nfs/dataset/request/
|
||||||
|
|
||||||
layer:
|
layer:
|
||||||
geoserver-url: https://kamco.geo-dev.gs.dabeeo.com
|
geoserver-url: https://kamco.geo-dev.gs.dabeeo.com
|
||||||
|
|||||||
83
src/main/resources/static/download_progress_test.html
Normal file
83
src/main/resources/static/download_progress_test.html
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="ko">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title>라벨 ZIP 다운로드</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h3>라벨 ZIP 다운로드</h3>
|
||||||
|
|
||||||
|
UUID:
|
||||||
|
<input id="uuid" value="6d8d49dc-0c9d-4124-adc7-b9ca610cc394" />
|
||||||
|
<br><br>
|
||||||
|
|
||||||
|
JWT Token:
|
||||||
|
<input id="token" style="width:600px;" placeholder="Bearer 토큰 붙여넣기" />
|
||||||
|
<br><br>
|
||||||
|
|
||||||
|
<button onclick="download()">다운로드</button>
|
||||||
|
|
||||||
|
<br><br>
|
||||||
|
<progress id="bar" value="0" max="100" style="width:400px;"></progress>
|
||||||
|
<div id="status"></div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
async function download() {
|
||||||
|
const uuid = document.getElementById("uuid").value.trim();
|
||||||
|
const token = document.getElementById("token").value.trim();
|
||||||
|
|
||||||
|
if (!uuid) {
|
||||||
|
alert("UUID 입력하세요");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!token) {
|
||||||
|
alert("토큰 입력하세요");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const url = `/api/training-data/stage/download/${uuid}`;
|
||||||
|
|
||||||
|
const res = await fetch(url, {
|
||||||
|
headers: {
|
||||||
|
"Authorization": token.startsWith("Bearer ")
|
||||||
|
? token
|
||||||
|
: `Bearer ${token}`,
|
||||||
|
"kamco-download-uuid": uuid
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!res.ok) {
|
||||||
|
document.getElementById("status").innerText =
|
||||||
|
"실패: " + res.status;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const total = parseInt(res.headers.get("Content-Length") || "0", 10);
|
||||||
|
const reader = res.body.getReader();
|
||||||
|
const chunks = [];
|
||||||
|
let received = 0;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
const { done, value } = await reader.read();
|
||||||
|
if (done) break;
|
||||||
|
chunks.push(value);
|
||||||
|
received += value.length;
|
||||||
|
|
||||||
|
if (total) {
|
||||||
|
document.getElementById("bar").value =
|
||||||
|
(received / total) * 100;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const blob = new Blob(chunks);
|
||||||
|
const a = document.createElement("a");
|
||||||
|
a.href = URL.createObjectURL(blob);
|
||||||
|
a.download = uuid + ".zip";
|
||||||
|
a.click();
|
||||||
|
|
||||||
|
document.getElementById("status").innerText = "완료 ✅";
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user