38 Commits

Author SHA1 Message Date
9ee1ec94c0 국유인 배치일 때 reqEpno BATCH로 하기 2026-02-23 19:29:17 +09:00
3683c193d4 Merge remote-tracking branch 'origin/feat/infer_dev_260211' into feat/infer_dev_260211 2026-02-23 16:35:58 +09:00
a2293ad1ab 추론실행 에러로그 추가 2026-02-23 16:35:52 +09:00
22c3b28237 파일 목록 한글,공백 조건 주석 처리 2026-02-23 15:06:22 +09:00
8d7ddc4c33 라벨링 추가할당 API 추가, 라벨링툴 목록 도엽순으로 소팅 2026-02-20 18:24:40 +09:00
b859a56ab0 Merge remote-tracking branch 'origin/feat/infer_dev_260211' into feat/infer_dev_260211 2026-02-20 12:18:51 +09:00
84b2149f78 M->G 변환 2026-02-20 12:18:20 +09:00
db897268de 비밀번호 변경 API 시큐리티 로직 수정 2026-02-20 11:11:39 +09:00
4dc5c196ca 추론실행 변경 2026-02-20 09:46:47 +09:00
3f1bb8f082 모델 M1,M2,M3를 G1,G2,G3 으로 변경(추론실행 포함) 2026-02-19 16:07:59 +09:00
778e87383c 모델타입 M -> G로 수정 다시 원복 2026-02-18 16:56:37 +09:00
38c4fbf4e5 모델타입 M -> G로 수정 2026-02-18 16:48:56 +09:00
fd1ba1ef3b 대용량 다운로드 테스트 2026-02-11 16:33:21 +09:00
2d2b55efcd 대용량 다운로드 테스트 2026-02-11 16:23:24 +09:00
ac13f36663 대용량 다운로드 테스트 2026-02-11 15:55:27 +09:00
e15b35943b 대용량 다운로드 테스트 2026-02-11 15:52:19 +09:00
e209eeb826 대용량 다운로드 테스트 2026-02-11 15:34:10 +09:00
2c320194b4 대용량 다운로드 테스트 2026-02-11 15:17:43 +09:00
0df7d7c5cf 대용량 다운로드 수정 2026-02-11 13:54:10 +09:00
9885c19b50 대용량 다운로드 수정 2026-02-11 13:46:28 +09:00
5b09b2e29a 대용량 다운로드 수정 2026-02-11 12:34:51 +09:00
4cbd2b8d76 대용량 다운로드 테스트 html 추가 2026-02-11 12:16:32 +09:00
89504e4156 대용량 다운로드 테스트 html 추가 2026-02-11 12:01:18 +09:00
5d33190c31 대용량 다운로드 타임아웃 설정 2026-02-11 11:46:34 +09:00
81b0b55d57 라벨 다운로드 수정 2026-02-11 11:37:36 +09:00
83ef7e36ed shp 생성 profile 파라미터 추가 2026-02-11 10:46:02 +09:00
0d13e6989f Merge pull request '라벨링 다운로드 경로 추가' (#63) from feat/infer_dev_260206 into develop
Reviewed-on: #63
2026-02-11 09:57:36 +09:00
4342df9bf5 대용량 다운로드, 라벨링 다운로드 이력 기능 추가
Reviewed-on: #62
2026-02-11 09:54:57 +09:00
8f9585b516 dd 2026-02-11 06:54:46 +09:00
43b5a79031 Merge pull request 'change prod properties' (#61) from feat/dean/change_point into develop
Reviewed-on: #61
2026-02-11 06:33:02 +09:00
3ba3b05f2f change prod properties 2026-02-11 06:29:30 +09:00
fffc2efd96 change prod properties 2026-02-09 22:42:23 +09:00
82e3250fd4 Merge pull request '라벨링툴 탐지분류 명칭 추가' (#60) from feat/infer_dev_260206 into develop
Reviewed-on: #60
2026-02-06 16:46:28 +09:00
470f2191b7 Merge pull request '국유인 배치 수정, 라벨링툴 적합여부 수정' (#59) from feat/infer_dev_260206 into develop
Reviewed-on: #59
2026-02-06 16:33:56 +09:00
c127531412 Merge pull request '레이어명 추가' (#58) from feat/infer_dev_260206 into develop
Reviewed-on: #58
2026-02-06 16:00:27 +09:00
61cfd8240a Merge pull request '스웨거 로그인 수정' (#57) from feat/infer_dev_260206 into develop
Reviewed-on: #57
2026-02-06 14:54:29 +09:00
54b6712273 Merge pull request '국유인 등록 로직 순서 변경' (#56) from feat/infer_dev_260206 into develop
Reviewed-on: #56
2026-02-06 14:25:51 +09:00
b2141e98c0 Merge pull request '국유인 실태조사 적합여부 업데이트 로직 수정, 라벨링 건수 조건 수정' (#55) from feat/infer_dev_260206 into develop
Reviewed-on: #55
2026-02-06 11:12:56 +09:00
46 changed files with 745 additions and 399 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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(

View File

@@ -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;
}
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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) {}

View File

@@ -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
) {}

View File

@@ -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;
}
} }

View File

@@ -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);
} }

View File

@@ -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());

View File

@@ -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);
} }
} }

View File

@@ -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()

View File

@@ -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 = "탐지객체 적합여부 조회 (객체별 조회)")

View File

@@ -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;

View File

@@ -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));
} }

View File

@@ -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);

View File

@@ -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();

View File

@@ -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));
}
} }

View File

@@ -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;
}
} }

View File

@@ -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);
}
} }

View File

@@ -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) {

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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,

View File

@@ -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);
}
} }

View File

@@ -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);
} }
} }

View File

@@ -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 -> {

View File

@@ -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);
} }

View File

@@ -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();
}
} }

View File

@@ -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)

View File

@@ -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)));

View File

@@ -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"),

View File

@@ -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

View File

@@ -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;
}
} }

View File

@@ -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());

View File

@@ -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 이상 방어

View File

@@ -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());

View File

@@ -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());

View File

@@ -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 호출
* *

View File

@@ -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(

View File

@@ -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

View File

@@ -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

View 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>