Compare commits
64 Commits
ba11e4c801
...
feat/dean/
| Author | SHA1 | Date | |
|---|---|---|---|
| 30f0e1a885 | |||
| a63b81008a | |||
| 2309357c0d | |||
| ee76389d6c | |||
| 2508f59a72 | |||
| f2307ff0f4 | |||
| 6f44319d33 | |||
| 4a120ae5fd | |||
| 7c200b057a | |||
| 8ac0a00311 | |||
| 48b46035fd | |||
| 1b9c7faf22 | |||
| fcdba49430 | |||
| 7599c99025 | |||
| 8fd1948d7c | |||
| 2c1047a014 | |||
| 8c54e5c176 | |||
| d3faa87d4f | |||
| 8d8d9d7a9f | |||
| 9c3d6c01f7 | |||
| 02b9a97ee8 | |||
| 438fb3ec9b | |||
| 3105b60759 | |||
| 5dddafbe0c | |||
| c2872c7748 | |||
| 7128eb007e | |||
| 815ee57e06 | |||
| ab52256c05 | |||
| 3ee3cf8425 | |||
| 14248b29e7 | |||
| a4c3fc5185 | |||
| d36703fd84 | |||
| 496f9c562d | |||
| 72778d6996 | |||
| 85834f2221 | |||
| 74e6485930 | |||
| 8cb8632a51 | |||
| fad797eea4 | |||
| 670cedda59 | |||
| 78fe7f013b | |||
| 48fa13615e | |||
| 1f9d6861a0 | |||
| 4b04fb64ec | |||
| df0c689243 | |||
| 827f701186 | |||
| ea74203667 | |||
| 9421df2b9b | |||
| 2a3bf9852d | |||
| 21ac562fd5 | |||
| aac8c91cd0 | |||
| b8fc314bff | |||
| a2bb1b2442 | |||
| 4e2e5c0b1d | |||
| 6b65dbdc75 | |||
| 82f08c4240 | |||
| 8bdccfdce6 | |||
| 3aca011104 | |||
| 3f6737706a | |||
| 3724528ea9 | |||
| 079a899822 | |||
| 58a73de9ab | |||
| f4a890bec8 | |||
| 783609b015 | |||
| 92232e13f1 |
@@ -1,7 +1,12 @@
|
|||||||
# 1단계에서 만든 로컬 베이스 이미지를 사용
|
# Stage 1: Build stage (gradle build는 Jenkins에서 이미 수행)
|
||||||
FROM 127.0.0.1:18082/kamco-cd/base-java21-gdal:1.0
|
FROM eclipse-temurin:21-jre-jammy
|
||||||
|
|
||||||
|
# GDAL 설치
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
gdal-bin \
|
||||||
|
libgdal-dev \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# 사용자 설정 (앱 별로 다를 수 있으므로 여기에 유지)
|
|
||||||
ARG UID=1000
|
ARG UID=1000
|
||||||
ARG GID=1000
|
ARG GID=1000
|
||||||
|
|
||||||
@@ -18,6 +23,7 @@ COPY build/libs/ROOT.jar app.jar
|
|||||||
|
|
||||||
# 포트 노출
|
# 포트 노출
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
# 애플리케이션 실행
|
# 애플리케이션 실행
|
||||||
# dev 프로파일로 실행
|
# dev 프로파일로 실행
|
||||||
ENTRYPOINT ["java", "-jar", "-Dspring.profiles.active=prod", "app.jar"]
|
ENTRYPOINT ["java", "-jar", "-Dspring.profiles.active=prod", "app.jar"]
|
||||||
|
|||||||
23
Dockerfile-prod_bak
Normal file
23
Dockerfile-prod_bak
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# Stage 1: Build stage (gradle build는 Jenkins에서 이미 수행)
|
||||||
|
FROM kamco-java-gdal:21
|
||||||
|
|
||||||
|
ARG UID=1000
|
||||||
|
ARG GID=1000
|
||||||
|
|
||||||
|
RUN groupadd -g ${GID} kcomu \
|
||||||
|
&& useradd -u ${UID} -g ${GID} -m kcomu
|
||||||
|
|
||||||
|
USER kcomu
|
||||||
|
|
||||||
|
# 작업 디렉토리 설정
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# JAR 파일 복사 (Jenkins에서 빌드된 ROOT.jar)
|
||||||
|
COPY build/libs/ROOT.jar app.jar
|
||||||
|
|
||||||
|
# 포트 노출
|
||||||
|
EXPOSE 8080
|
||||||
|
|
||||||
|
# 애플리케이션 실행
|
||||||
|
# dev 프로파일로 실행
|
||||||
|
ENTRYPOINT ["java", "-jar", "-Dspring.profiles.active=prod", "app.jar"]
|
||||||
@@ -15,7 +15,7 @@ services:
|
|||||||
- SPRING_PROFILES_ACTIVE=dev
|
- SPRING_PROFILES_ACTIVE=dev
|
||||||
- TZ=Asia/Seoul
|
- TZ=Asia/Seoul
|
||||||
volumes:
|
volumes:
|
||||||
- /kamco-nfs:/kamco-nfs
|
- /data:/kamco-nfs
|
||||||
networks:
|
networks:
|
||||||
- kamco-cds
|
- kamco-cds
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|||||||
@@ -1,18 +1,31 @@
|
|||||||
services:
|
services:
|
||||||
kamco-changedetection-api:
|
nginx:
|
||||||
build:
|
image: nginx:alpine
|
||||||
context: .
|
container_name: kamco-cd-api-nginx
|
||||||
dockerfile: Dockerfile-prod
|
|
||||||
args:
|
|
||||||
UID: 1000 # manager01 UID
|
|
||||||
GID: 1000 # manager01 GID
|
|
||||||
image: kamco-changedetection-api:${IMAGE_TAG:-latest}
|
|
||||||
container_name: kamco-changedetection-api
|
|
||||||
user: "1000:1000"
|
|
||||||
ports:
|
ports:
|
||||||
- "7100:8080"
|
- "12013:443"
|
||||||
|
volumes:
|
||||||
|
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
|
||||||
|
- ./nginx/conf.d:/etc/nginx/conf.d:ro
|
||||||
|
- /etc/ssl/certs/globalsign:/etc/ssl/certs/globalsign:ro
|
||||||
|
networks:
|
||||||
|
- kamco-cds
|
||||||
|
restart: unless-stopped
|
||||||
|
depends_on:
|
||||||
|
- kamco-cd-api
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost/health"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
start_period: 10s
|
||||||
|
|
||||||
|
kamco-cd-api:
|
||||||
|
image: kamco-api-app:260219
|
||||||
|
container_name: kamco-cd-api
|
||||||
|
user: "1000:1000"
|
||||||
environment:
|
environment:
|
||||||
- SPRING_PROFILES_ACTIVE=dev
|
- SPRING_PROFILES_ACTIVE=prod
|
||||||
- TZ=Asia/Seoul
|
- TZ=Asia/Seoul
|
||||||
volumes:
|
volumes:
|
||||||
- /data:/kamco-nfs
|
- /data:/kamco-nfs
|
||||||
|
|||||||
122
nginx/README.md
Normal file
122
nginx/README.md
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
# Nginx HTTPS Configuration for KAMCO Change Detection API
|
||||||
|
|
||||||
|
## SSL Certificate Setup
|
||||||
|
|
||||||
|
### Required Files
|
||||||
|
GlobalSign SSL 인증서 파일들을 서버의 `/etc/ssl/certs/globalsign/` 디렉토리에 배치해야 합니다:
|
||||||
|
|
||||||
|
```
|
||||||
|
/etc/ssl/certs/globalsign/
|
||||||
|
├── certificate.crt # SSL 인증서 파일
|
||||||
|
├── private.key # 개인 키 파일
|
||||||
|
└── ca-bundle.crt # CA 번들 파일 (중간 인증서)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Certificate Installation Steps
|
||||||
|
|
||||||
|
1. **디렉토리 생성**
|
||||||
|
```bash
|
||||||
|
sudo mkdir -p /etc/ssl/certs/globalsign
|
||||||
|
sudo chmod 755 /etc/ssl/certs/globalsign
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **인증서 파일 복사**
|
||||||
|
```bash
|
||||||
|
sudo cp your-certificate.crt /etc/ssl/certs/globalsign/certificate.crt
|
||||||
|
sudo cp your-private.key /etc/ssl/certs/globalsign/private.key
|
||||||
|
sudo cp ca-bundle.crt /etc/ssl/certs/globalsign/ca-bundle.crt
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **파일 권한 설정**
|
||||||
|
```bash
|
||||||
|
sudo chmod 644 /etc/ssl/certs/globalsign/certificate.crt
|
||||||
|
sudo chmod 600 /etc/ssl/certs/globalsign/private.key
|
||||||
|
sudo chmod 644 /etc/ssl/certs/globalsign/ca-bundle.crt
|
||||||
|
```
|
||||||
|
|
||||||
|
## Configuration Overview
|
||||||
|
|
||||||
|
### Service Architecture
|
||||||
|
```
|
||||||
|
Internet (HTTPS:12013)
|
||||||
|
↓
|
||||||
|
nginx (443 in container)
|
||||||
|
↓
|
||||||
|
kamco-changedetection-api (8080 in container)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Key Features
|
||||||
|
- **HTTPS/TLS**: TLSv1.2, TLSv1.3 지원
|
||||||
|
- **Port**: 외부 12013 → 내부 443 (nginx)
|
||||||
|
- **Domain**: aicd-api.e-kamco.com:12013
|
||||||
|
- **Reverse Proxy**: kamco-changedetection-api:8080으로 프록시
|
||||||
|
- **Security Headers**: HSTS, X-Frame-Options, X-Content-Type-Options 등
|
||||||
|
- **Health Check**: /health 엔드포인트
|
||||||
|
|
||||||
|
## Deployment
|
||||||
|
|
||||||
|
### Start Services
|
||||||
|
```bash
|
||||||
|
docker-compose -f docker-compose-prod.yml up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
### Check Logs
|
||||||
|
```bash
|
||||||
|
# Nginx logs
|
||||||
|
docker logs kamco-cd-nginx
|
||||||
|
|
||||||
|
# API logs
|
||||||
|
docker logs kamco-changedetection-api
|
||||||
|
```
|
||||||
|
|
||||||
|
### Verify Configuration
|
||||||
|
```bash
|
||||||
|
# Test nginx configuration
|
||||||
|
docker exec kamco-cd-nginx nginx -t
|
||||||
|
|
||||||
|
# Check SSL certificate
|
||||||
|
docker exec kamco-cd-nginx openssl s_client -connect localhost:443 -servername aicd-api.e-kamco.com
|
||||||
|
```
|
||||||
|
|
||||||
|
### Access Service
|
||||||
|
```bash
|
||||||
|
# HTTPS Access
|
||||||
|
curl -k https://aicd-api.e-kamco.com:12013/monitor/health
|
||||||
|
|
||||||
|
# Health Check
|
||||||
|
curl -k https://aicd-api.e-kamco.com:12013/health
|
||||||
|
```
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
### Certificate Issues
|
||||||
|
인증서 파일이 제대로 마운트되었는지 확인:
|
||||||
|
```bash
|
||||||
|
docker exec kamco-cd-nginx ls -la /etc/ssl/certs/globalsign/
|
||||||
|
```
|
||||||
|
|
||||||
|
### Nginx Configuration Test
|
||||||
|
```bash
|
||||||
|
docker exec kamco-cd-nginx nginx -t
|
||||||
|
```
|
||||||
|
|
||||||
|
### Connection Test
|
||||||
|
```bash
|
||||||
|
# Check if nginx is listening
|
||||||
|
docker exec kamco-cd-nginx netstat -tlnp | grep 443
|
||||||
|
|
||||||
|
# Check backend connection
|
||||||
|
docker exec kamco-cd-nginx wget --spider http://kamco-changedetection-api:8080/monitor/health
|
||||||
|
```
|
||||||
|
|
||||||
|
## Configuration Files
|
||||||
|
|
||||||
|
- `nginx/nginx.conf`: Main nginx configuration
|
||||||
|
- `nginx/conf.d/default.conf`: Server block with SSL and proxy settings
|
||||||
|
- `docker-compose-prod.yml`: Docker compose with nginx service
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
|
||||||
|
- 인증서 파일명이 다를 경우 `nginx/conf.d/default.conf`에서 경로를 수정하세요
|
||||||
|
- 인증서 갱신 시 nginx 컨테이너를 재시작하세요: `docker restart kamco-cd-nginx`
|
||||||
|
- 포트 12013이 방화벽에서 허용되어 있는지 확인하세요
|
||||||
60
nginx/conf.d/default.conf
Normal file
60
nginx/conf.d/default.conf
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
upstream kamco_api {
|
||||||
|
server kamco-cd-api:8080;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl http2;
|
||||||
|
server_name aicd-api.e-kamco.com;
|
||||||
|
|
||||||
|
# GlobalSign SSL Certificate
|
||||||
|
ssl_certificate /etc/ssl/certs/globalsign/certificate.crt;
|
||||||
|
ssl_certificate_key /etc/ssl/certs/globalsign/private.key;
|
||||||
|
|
||||||
|
# SSL Configuration
|
||||||
|
ssl_protocols TLSv1.2 TLSv1.3;
|
||||||
|
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||||
|
ssl_prefer_server_ciphers on;
|
||||||
|
ssl_session_cache shared:SSL:10m;
|
||||||
|
ssl_session_timeout 10m;
|
||||||
|
|
||||||
|
# Security Headers
|
||||||
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
||||||
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||||
|
add_header X-Content-Type-Options "nosniff" always;
|
||||||
|
add_header X-XSS-Protection "1; mode=block" always;
|
||||||
|
|
||||||
|
# Client Body Size
|
||||||
|
client_max_body_size 100M;
|
||||||
|
|
||||||
|
# Proxy Settings
|
||||||
|
location / {
|
||||||
|
proxy_pass http://kamco_api;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header X-Forwarded-Host $host;
|
||||||
|
proxy_set_header X-Forwarded-Port $server_port;
|
||||||
|
|
||||||
|
# Timeouts
|
||||||
|
proxy_connect_timeout 60s;
|
||||||
|
proxy_send_timeout 60s;
|
||||||
|
proxy_read_timeout 60s;
|
||||||
|
|
||||||
|
# WebSocket Support (if needed)
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Health Check Endpoint
|
||||||
|
location /health {
|
||||||
|
access_log off;
|
||||||
|
return 200 "OK";
|
||||||
|
add_header Content-Type text/plain;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Access and Error Logs
|
||||||
|
access_log /var/log/nginx/kamco-api-access.log;
|
||||||
|
error_log /var/log/nginx/kamco-api-error.log;
|
||||||
|
}
|
||||||
33
nginx/nginx.conf
Normal file
33
nginx/nginx.conf
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
user nginx;
|
||||||
|
worker_processes auto;
|
||||||
|
|
||||||
|
error_log /var/log/nginx/error.log warn;
|
||||||
|
pid /var/run/nginx.pid;
|
||||||
|
|
||||||
|
events {
|
||||||
|
worker_connections 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
|
||||||
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||||
|
'$status $body_bytes_sent "$http_referer" '
|
||||||
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||||
|
|
||||||
|
access_log /var/log/nginx/access.log main;
|
||||||
|
|
||||||
|
sendfile on;
|
||||||
|
tcp_nopush on;
|
||||||
|
tcp_nodelay on;
|
||||||
|
keepalive_timeout 65;
|
||||||
|
types_hash_max_size 2048;
|
||||||
|
|
||||||
|
gzip on;
|
||||||
|
gzip_vary on;
|
||||||
|
gzip_min_length 1024;
|
||||||
|
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml+rss application/json;
|
||||||
|
|
||||||
|
include /etc/nginx/conf.d/*.conf;
|
||||||
|
}
|
||||||
@@ -279,18 +279,28 @@ public class FIleChecker {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Folder> getFolderAll(String dirPath, String sortType, int maxDepth) {
|
// kamco-nfs를 확인하는곳이 있어서 파라미터 추가 사용용도확인후 처리
|
||||||
|
public static List<Folder> getFolderAll(
|
||||||
|
String dirPath, String sortType, int maxDepth, String nfsRootDir) {
|
||||||
|
|
||||||
Path startPath = Paths.get(dirPath);
|
Path startPath = Paths.get(dirPath);
|
||||||
|
|
||||||
List<Folder> folderList = List.of();
|
List<Folder> folderList = List.of();
|
||||||
|
|
||||||
try (Stream<Path> stream = Files.walk(startPath, maxDepth)) {
|
log.info("[FIND_FOLDER] DIR : {} {} {} {}", dirPath, sortType, maxDepth, startPath);
|
||||||
|
|
||||||
|
int childDirCount = getChildFolderCount(startPath.toFile());
|
||||||
|
log.info("[FIND_FOLDER] START_PATH_CHILD_DIR_COUNT : {}", childDirCount);
|
||||||
|
|
||||||
|
try (Stream<Path> stream = Files.walk(startPath, maxDepth)) {
|
||||||
folderList =
|
folderList =
|
||||||
stream
|
stream
|
||||||
.filter(Files::isDirectory)
|
.filter(Files::isDirectory)
|
||||||
.filter(p -> !p.toString().equals(dirPath))
|
.filter(
|
||||||
|
p ->
|
||||||
|
!p.toAbsolutePath()
|
||||||
|
.normalize()
|
||||||
|
.equals(startPath.toAbsolutePath().normalize()))
|
||||||
.map(
|
.map(
|
||||||
path -> {
|
path -> {
|
||||||
int depth = path.getNameCount();
|
int depth = path.getNameCount();
|
||||||
@@ -300,13 +310,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 isShowHide =
|
||||||
|
// !parentFolderNm.equals("kamco-nfs"); // 폴더 리스트에
|
||||||
|
// kamco-nfs 하위만 나오도록 처리
|
||||||
boolean isShowHide =
|
boolean isShowHide =
|
||||||
!parentFolderNm.equals("kamco-nfs"); // 폴더 리스트에 kamco-nfs 하위만 나오도록 처리
|
!parentFolderNm.equals(nfsRootDir); // 폴더 리스트에 nfsRootDir 하위만 나오도록 처리
|
||||||
// boolean isValid =
|
|
||||||
// !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);
|
||||||
String lastModified = getLastModified(file);
|
String lastModified = getLastModified(file);
|
||||||
@@ -354,24 +363,8 @@ public class FIleChecker {
|
|||||||
return folderList;
|
return folderList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Folder> getFolderAll(String dirPath) {
|
public static List<Folder> getFolderAll(String dirPath, String nfsRootDir) {
|
||||||
return getFolderAll(dirPath, "name", 1);
|
return getFolderAll(dirPath, "name", 1, nfsRootDir);
|
||||||
}
|
|
||||||
|
|
||||||
public static List<Folder> getFolderAll(String dirPath, String sortType) {
|
|
||||||
return getFolderAll(dirPath, sortType, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getChildFolderCount(String dirPath) {
|
|
||||||
File directory = new File(dirPath);
|
|
||||||
File[] childFolders = directory.listFiles(File::isDirectory);
|
|
||||||
|
|
||||||
int childCnt = 0;
|
|
||||||
if (childFolders != null) {
|
|
||||||
childCnt = childFolders.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
return childCnt;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getChildFolderCount(File directory) {
|
public static int getChildFolderCount(File directory) {
|
||||||
@@ -385,11 +378,6 @@ public class FIleChecker {
|
|||||||
return childCnt;
|
return childCnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getLastModified(String dirPath) {
|
|
||||||
File file = new File(dirPath);
|
|
||||||
return dttmFormat.format(new Date(file.lastModified()));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getLastModified(File file) {
|
public static String getLastModified(File file) {
|
||||||
return dttmFormat.format(new Date(file.lastModified()));
|
return dttmFormat.format(new Date(file.lastModified()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class OpenApiConfig {
|
|||||||
@Value("${swagger.dev-url:https://kamco.dev-api.gs.dabeeo.com}")
|
@Value("${swagger.dev-url:https://kamco.dev-api.gs.dabeeo.com}")
|
||||||
private String devUrl;
|
private String devUrl;
|
||||||
|
|
||||||
@Value("${swagger.prod-url:https://api.kamco.com}")
|
@Value("${swagger.prod-url:https://aicd-api.e-kamco.com:12013}")
|
||||||
private String prodUrl;
|
private String prodUrl;
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@@ -51,9 +51,9 @@ public class OpenApiConfig {
|
|||||||
servers.add(new Server().url("http://localhost:" + serverPort).description("로컬 서버"));
|
servers.add(new Server().url("http://localhost:" + serverPort).description("로컬 서버"));
|
||||||
// servers.add(new Server().url(prodUrl).description("운영 서버"));
|
// servers.add(new Server().url(prodUrl).description("운영 서버"));
|
||||||
} else if ("prod".equals(profile)) {
|
} else if ("prod".equals(profile)) {
|
||||||
// servers.add(new Server().url(prodUrl).description("운영 서버"));
|
servers.add(new Server().url(prodUrl).description("운영 서버"));
|
||||||
servers.add(new Server().url("http://localhost:" + serverPort).description("로컬 서버"));
|
servers.add(new Server().url("http://localhost:" + serverPort).description("로컬 서버"));
|
||||||
servers.add(new Server().url(devUrl).description("개발 서버"));
|
|
||||||
} else {
|
} else {
|
||||||
servers.add(new Server().url("http://localhost:" + serverPort).description("로컬 서버"));
|
servers.add(new Server().url("http://localhost:" + serverPort).description("로컬 서버"));
|
||||||
servers.add(new Server().url(devUrl).description("개발 서버"));
|
servers.add(new Server().url(devUrl).description("개발 서버"));
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ public class ChngDetectMastDto {
|
|||||||
|
|
||||||
@Schema(
|
@Schema(
|
||||||
description = "탐지결과 절대경로명 /kamco_nas/export/{chnDtctId}",
|
description = "탐지결과 절대경로명 /kamco_nas/export/{chnDtctId}",
|
||||||
example = "/kamco-nfs/dataset/export/D5F192EC76D34F6592035BE63A84F591")
|
example = "{file.nfs}/dataset/export/D5F192EC76D34F6592035BE63A84F591")
|
||||||
private String pathNm;
|
private String pathNm;
|
||||||
|
|
||||||
@Schema(description = "사원번호", example = "123456")
|
@Schema(description = "사원번호", example = "123456")
|
||||||
|
|||||||
@@ -66,8 +66,11 @@ public class GukYuinApiService {
|
|||||||
@Value("${gukyuin.cdi}")
|
@Value("${gukyuin.cdi}")
|
||||||
private String gukyuinCdiUrl;
|
private String gukyuinCdiUrl;
|
||||||
|
|
||||||
@Value("${file.dataset-dir}")
|
@Value("${file.nfs}")
|
||||||
private String datasetDir;
|
private String nfs;
|
||||||
|
|
||||||
|
// @Value("${file.dataset-dir}")
|
||||||
|
// private String datasetDir;
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public ChngDetectMastDto.RegistResDto regist(
|
public ChngDetectMastDto.RegistResDto regist(
|
||||||
@@ -453,7 +456,10 @@ public class GukYuinApiService {
|
|||||||
return new ResponseObj(ApiResponseCode.DUPLICATE_DATA, "이미 국유인 연동을 한 회차입니다.");
|
return new ResponseObj(ApiResponseCode.DUPLICATE_DATA, "이미 국유인 연동을 한 회차입니다.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Files.isDirectory(Path.of("/kamco-nfs/dataset/export/" + info.getUid()))) {
|
// String kamconfsDatasetExportPathfsDatasetExportPath = "/kamco-nfs/dataset/export/";
|
||||||
|
String kamconfsDatasetExportPathfsDatasetExportPath =
|
||||||
|
String.format("%s%s", nfs, "/dataset/export/");
|
||||||
|
if (!Files.isDirectory(Path.of(kamconfsDatasetExportPathfsDatasetExportPath + info.getUid()))) {
|
||||||
return new ResponseObj(
|
return new ResponseObj(
|
||||||
ApiResponseCode.NOT_FOUND_DATA, "파일 경로에 회차 실행 파일이 생성되지 않았습니다. 확인 부탁드립니다.");
|
ApiResponseCode.NOT_FOUND_DATA, "파일 경로에 회차 실행 파일이 생성되지 않았습니다. 확인 부탁드립니다.");
|
||||||
}
|
}
|
||||||
@@ -468,7 +474,7 @@ public class GukYuinApiService {
|
|||||||
reqDto.setCrtrYr(String.valueOf(info.getTargetYyyy()));
|
reqDto.setCrtrYr(String.valueOf(info.getTargetYyyy()));
|
||||||
reqDto.setChnDtctSno(String.valueOf(maxStage + 1));
|
reqDto.setChnDtctSno(String.valueOf(maxStage + 1));
|
||||||
reqDto.setChnDtctId(info.getUid());
|
reqDto.setChnDtctId(info.getUid());
|
||||||
reqDto.setPathNm("/kamco-nfs/dataset/export/" + info.getUid());
|
reqDto.setPathNm(kamconfsDatasetExportPathfsDatasetExportPath + info.getUid());
|
||||||
|
|
||||||
// 1회차를 종료 상태로 처리하고 2회차를 보내야 함
|
// 1회차를 종료 상태로 처리하고 2회차를 보내야 함
|
||||||
// 추론(learn), 학습데이터(inference) 둘 다 종료 처리
|
// 추론(learn), 학습데이터(inference) 둘 다 종료 처리
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ public class InferenceResultApiController {
|
|||||||
@RequestBody
|
@RequestBody
|
||||||
@Valid
|
@Valid
|
||||||
InferenceResultDto.RegReq req) {
|
InferenceResultDto.RegReq req) {
|
||||||
UUID uuid = inferenceResultService.saveInferenceInfo(req);
|
UUID uuid = inferenceResultService.run(req);
|
||||||
return ApiResponseDto.ok(uuid);
|
return ApiResponseDto.ok(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
package com.kamco.cd.kamcoback.inference;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
|
||||||
|
import com.kamco.cd.kamcoback.inference.service.InferenceRunService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Content;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
|
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import java.util.UUID;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@Tag(name = "추론 실행", description = "추론 실행")
|
||||||
|
@Log4j2
|
||||||
|
@RequestMapping("/api/inference/run")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
public class InferenceRunController {
|
||||||
|
|
||||||
|
private final InferenceRunService inferenceRunService;
|
||||||
|
|
||||||
|
@Operation(summary = "추론 진행 여부 확인", description = "어드민 홈 > 추론관리 > 추론관리 > 추론관리 목록")
|
||||||
|
@ApiResponses(
|
||||||
|
value = {
|
||||||
|
@ApiResponse(
|
||||||
|
responseCode = "200",
|
||||||
|
description = "검색 성공",
|
||||||
|
content =
|
||||||
|
@Content(
|
||||||
|
mediaType = "application/json",
|
||||||
|
schema =
|
||||||
|
@Schema(
|
||||||
|
description = "진행 여부 (UUID 있으면 진행중)",
|
||||||
|
type = "UUID",
|
||||||
|
example = "44709877-2e27-4fc5-bacb-8e0328c69b64"))),
|
||||||
|
@ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content),
|
||||||
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
|
})
|
||||||
|
@GetMapping
|
||||||
|
public ApiResponseDto<Void> getProcessing(
|
||||||
|
@Parameter(description = "비교년도", example = "2021") @RequestParam(required = false)
|
||||||
|
Integer compareYear,
|
||||||
|
@Parameter(description = "기준년도", example = "2022") @RequestParam(required = false)
|
||||||
|
Integer targetYear,
|
||||||
|
@Parameter(description = "모델 uuid") @RequestParam(required = false) UUID modelUuid) {
|
||||||
|
|
||||||
|
inferenceRunService.run(compareYear, targetYear, modelUuid);
|
||||||
|
return ApiResponseDto.ok(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,12 @@
|
|||||||
package com.kamco.cd.kamcoback.inference.dto;
|
package com.kamco.cd.kamcoback.inference.dto;
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.InferenceResultsTestingEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.InferenceResultsTestingEntity;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
import org.locationtech.jts.geom.Geometry;
|
||||||
|
|
||||||
public class InferenceResultsTestingDto {
|
public class InferenceResultsTestingDto {
|
||||||
|
|
||||||
@@ -22,4 +24,31 @@ public class InferenceResultsTestingDto {
|
|||||||
return new ShpDto(e.getBatchId(), e.getUid(), e.getMapId());
|
return new ShpDto(e.getBatchId(), e.getUid(), e.getMapId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public static class Basic {
|
||||||
|
private Double probability;
|
||||||
|
private Long beforeYear;
|
||||||
|
private Long afterYear;
|
||||||
|
private String mapId;
|
||||||
|
private String modelVersion;
|
||||||
|
private String clsModelPath;
|
||||||
|
private String clsModelVersion;
|
||||||
|
private String cdModelType;
|
||||||
|
private Long id;
|
||||||
|
private String modelName;
|
||||||
|
private Long batchId;
|
||||||
|
private Double area;
|
||||||
|
private String beforeC;
|
||||||
|
private Double beforeP;
|
||||||
|
private String afterC;
|
||||||
|
private Double afterP;
|
||||||
|
private Long seq;
|
||||||
|
private ZonedDateTime createdDate;
|
||||||
|
private String uid;
|
||||||
|
private Geometry geometry;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,10 @@ import lombok.Getter;
|
|||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
/** AI API 추론 실행 DTO */
|
/** AI API 추론 실행 DTO */
|
||||||
|
@Slf4j
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.kamco.cd.kamcoback.inference.service;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RequestMapping("/api/inference/manual")
|
||||||
|
public class InferenceManualApiController {}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.kamco.cd.kamcoback.inference.service;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultsTestingDto;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.core.InferenceResultCoreService;
|
||||||
|
import java.util.List;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class InferenceManualService {
|
||||||
|
private final InferenceResultCoreService inferenceResultCoreService;
|
||||||
|
|
||||||
|
public void getResultsTesting(List<Long> batchIds) {
|
||||||
|
List<InferenceResultsTestingDto.Basic> resultList =
|
||||||
|
inferenceResultCoreService.getInferenceResults(batchIds);
|
||||||
|
|
||||||
|
if (resultList.isEmpty()) {}
|
||||||
|
|
||||||
|
for (InferenceResultsTestingDto.Basic result : resultList) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -45,6 +45,7 @@ import java.time.ZonedDateTime;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -116,6 +117,124 @@ public class InferenceResultService {
|
|||||||
return dto.getUuid();
|
return dto.getUuid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public UUID run(InferenceResultDto.RegReq req) {
|
||||||
|
List<MngListDto> targetDtoList = mapSheetMngCoreService.getHstMapSheetList(req);
|
||||||
|
List<String> compareList = mapSheetMngCoreService.getMapSheetMngHst(req.getCompareYyyy());
|
||||||
|
List<String> targetList =
|
||||||
|
mapSheetMngCoreService.getHstMapSheetList(req).stream()
|
||||||
|
.map(MngListDto::getMapSheetNum)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
log.info(
|
||||||
|
"hst list count compareList = {}, targetList = {}", compareList.size(), targetList.size());
|
||||||
|
|
||||||
|
Set<String> compareSet = new HashSet<>(compareList);
|
||||||
|
Set<String> targetSet = new HashSet<>(targetList);
|
||||||
|
|
||||||
|
long intersectionCount =
|
||||||
|
targetSet.stream()
|
||||||
|
.distinct()
|
||||||
|
.filter(compareSet::contains)
|
||||||
|
.count(); // compare와 target에 공통으로 존재하는 도협 수
|
||||||
|
|
||||||
|
long excludedTargetCount =
|
||||||
|
targetSet.stream()
|
||||||
|
.distinct()
|
||||||
|
.filter(s -> !compareSet.contains(s))
|
||||||
|
.count(); // target 에만 존재하는 도협 수 (compare 에는 없음)
|
||||||
|
|
||||||
|
long onlyCompareCount =
|
||||||
|
compareSet.stream()
|
||||||
|
.distinct()
|
||||||
|
.filter(s -> !targetSet.contains(s))
|
||||||
|
.count(); // compare 에만 존재하는 도협 수 (target 에는 없음)
|
||||||
|
|
||||||
|
log.info(
|
||||||
|
"""
|
||||||
|
===== MapSheet Year Comparison =====
|
||||||
|
target Total: {}
|
||||||
|
compare Total: {}
|
||||||
|
Intersection: {}
|
||||||
|
target Only (Excluded from compare): {}
|
||||||
|
compare Only: {}
|
||||||
|
====================================
|
||||||
|
""",
|
||||||
|
targetSet.size(),
|
||||||
|
compareSet.size(),
|
||||||
|
intersectionCount,
|
||||||
|
excludedTargetCount,
|
||||||
|
onlyCompareCount);
|
||||||
|
|
||||||
|
List<String> filteredTargetList =
|
||||||
|
targetSet.stream() // target 기준으로
|
||||||
|
.filter(compareSet::contains) // compare에 있는 도협만 남김
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
Scene modelComparePath =
|
||||||
|
getSceneInference(req.getCompareYyyy().toString(), filteredTargetList, "", "");
|
||||||
|
|
||||||
|
Scene modelTargetPath =
|
||||||
|
getSceneInference(req.getTargetYyyy().toString(), filteredTargetList, "", "");
|
||||||
|
|
||||||
|
// 작은 쪽 기준으로 탐지건수/파일생성 리스트 결정
|
||||||
|
List<ImageFeature> imageFeatureList;
|
||||||
|
if (modelComparePath.getFeatures().size() <= modelTargetPath.getFeatures().size()) {
|
||||||
|
imageFeatureList = modelComparePath.getFeatures();
|
||||||
|
} else {
|
||||||
|
imageFeatureList = modelTargetPath.getFeatures();
|
||||||
|
}
|
||||||
|
|
||||||
|
// imageFeatureList 기준 sceneId Set
|
||||||
|
Set<String> sceneIdSet =
|
||||||
|
imageFeatureList.stream()
|
||||||
|
.map(ImageFeature::getSceneId)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
|
// targetList(List<MngListDto>) 리턴용으로 필터링
|
||||||
|
List<MngListDto> newTargetList =
|
||||||
|
targetDtoList.stream()
|
||||||
|
.filter(m -> m.getMapSheetNum() != null)
|
||||||
|
.filter(m -> sceneIdSet.contains(m.getMapSheetNum()))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
// 목록 및 추론 대상 도엽정보 저장
|
||||||
|
UUID uuid = inferenceResultCoreService.saveInferenceInfo(req, newTargetList);
|
||||||
|
|
||||||
|
// ai 서버에 전달할 파라미터 생성
|
||||||
|
pred_requests_areas predRequestsAreas = new pred_requests_areas();
|
||||||
|
predRequestsAreas.setInput1_year(req.getCompareYyyy());
|
||||||
|
predRequestsAreas.setInput2_year(req.getTargetYyyy());
|
||||||
|
predRequestsAreas.setInput1_scene_path(modelComparePath.getFilePath());
|
||||||
|
predRequestsAreas.setInput2_scene_path(modelTargetPath.getFilePath());
|
||||||
|
|
||||||
|
InferenceSendDto m1 = this.getModelInfo(req.getModel1Uuid());
|
||||||
|
m1.setPred_requests_areas(predRequestsAreas);
|
||||||
|
|
||||||
|
log.info("[INFERENCE] Start m1 = {}", m1);
|
||||||
|
m1.setPred_requests_areas(predRequestsAreas);
|
||||||
|
|
||||||
|
// ai 추론 실행 api 호출
|
||||||
|
Long batchId = ensureAccepted(m1);
|
||||||
|
|
||||||
|
// ai 추론 실행후 응답값 update
|
||||||
|
SaveInferenceAiDto saveInferenceAiDto = new SaveInferenceAiDto();
|
||||||
|
saveInferenceAiDto.setUuid(uuid);
|
||||||
|
saveInferenceAiDto.setBatchId(batchId);
|
||||||
|
saveInferenceAiDto.setStatus(Status.IN_PROGRESS.getId());
|
||||||
|
saveInferenceAiDto.setType(ModelType.G1.getId());
|
||||||
|
saveInferenceAiDto.setInferStartDttm(ZonedDateTime.now());
|
||||||
|
saveInferenceAiDto.setModelComparePath(modelComparePath.getFilePath());
|
||||||
|
saveInferenceAiDto.setModelTargetPath(modelTargetPath.getFilePath());
|
||||||
|
saveInferenceAiDto.setModelStartDttm(ZonedDateTime.now());
|
||||||
|
inferenceResultCoreService.update(saveInferenceAiDto);
|
||||||
|
|
||||||
|
return uuid;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 변화탐지 실행 정보 생성
|
* 변화탐지 실행 정보 생성
|
||||||
*
|
*
|
||||||
@@ -146,31 +265,31 @@ public class InferenceResultService {
|
|||||||
|
|
||||||
List<TotalListDto> totalNumList = new ArrayList<>();
|
List<TotalListDto> totalNumList = new ArrayList<>();
|
||||||
|
|
||||||
if (DetectOption.EXCL.getId().equals(req.getDetectOption())) {
|
// if (DetectOption.EXCL.getId().equals(req.getDetectOption())) {
|
||||||
// "추론제외" 일때 전년도 이전 값이 있어도 전년도 도엽이 없으면 비교 안함
|
// // "추론제외" 일때 전년도 이전 값이 있어도 전년도 도엽이 없으면 비교 안함
|
||||||
for (MngListCompareDto dto : compareList) {
|
// for (MngListCompareDto dto : compareList) {
|
||||||
if (Objects.equals(dto.getBeforeYear(), req.getCompareYyyy())) {
|
// if (Objects.equals(dto.getBeforeYear(), req.getCompareYyyy())) {
|
||||||
TotalListDto totalDto = new TotalListDto();
|
// TotalListDto totalDto = new TotalListDto();
|
||||||
totalDto.setBeforeYear(dto.getBeforeYear() == null ? 0 : dto.getBeforeYear());
|
// totalDto.setBeforeYear(dto.getBeforeYear() == null ? 0 : dto.getBeforeYear());
|
||||||
totalDto.setMapSheetNum(dto.getMapSheetNum());
|
// totalDto.setMapSheetNum(dto.getMapSheetNum());
|
||||||
totalNumList.add(totalDto);
|
// totalNumList.add(totalDto);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
} else if (DetectOption.PREV.getId().equals(req.getDetectOption())) {
|
// } else if (DetectOption.PREV.getId().equals(req.getDetectOption())) {
|
||||||
// "이전 년도 도엽 사용" 이면 전년도 이전 도엽도 사용
|
// // "이전 년도 도엽 사용" 이면 전년도 이전 도엽도 사용
|
||||||
for (MngListCompareDto dto : compareList) {
|
// for (MngListCompareDto dto : compareList) {
|
||||||
if (dto.getBeforeYear() != 0) {
|
// if (dto.getBeforeYear() != 0) {
|
||||||
TotalListDto totalDto = new TotalListDto();
|
// TotalListDto totalDto = new TotalListDto();
|
||||||
totalDto.setBeforeYear(dto.getBeforeYear() == null ? 0 : dto.getBeforeYear());
|
// totalDto.setBeforeYear(dto.getBeforeYear() == null ? 0 : dto.getBeforeYear());
|
||||||
totalDto.setMapSheetNum(dto.getMapSheetNum());
|
// totalDto.setMapSheetNum(dto.getMapSheetNum());
|
||||||
totalNumList.add(totalDto);
|
// totalNumList.add(totalDto);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (totalNumList.isEmpty()) {
|
// if (totalNumList.isEmpty()) {
|
||||||
throw new CustomApiException("NOT_FOUND_COMPARE_YEAR", HttpStatus.NOT_FOUND);
|
// throw new CustomApiException("NOT_FOUND_COMPARE_YEAR", HttpStatus.NOT_FOUND);
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 사용할 영상파일 년도 기록 및 추론에 포함되는지 설정
|
// 사용할 영상파일 년도 기록 및 추론에 포함되는지 설정
|
||||||
for (MngListDto target : targetList) {
|
for (MngListDto target : targetList) {
|
||||||
@@ -238,6 +357,8 @@ public class InferenceResultService {
|
|||||||
predRequestsAreas.setInput2_scene_path(modelTargetPath.getFilePath());
|
predRequestsAreas.setInput2_scene_path(modelTargetPath.getFilePath());
|
||||||
|
|
||||||
InferenceSendDto m1 = this.getModelInfo(req.getModel1Uuid());
|
InferenceSendDto m1 = this.getModelInfo(req.getModel1Uuid());
|
||||||
|
|
||||||
|
log.info("[INFERENCE] Start m1 = {}", m1);
|
||||||
m1.setPred_requests_areas(predRequestsAreas);
|
m1.setPred_requests_areas(predRequestsAreas);
|
||||||
|
|
||||||
// ai 추론 실행 api 호출
|
// ai 추론 실행 api 호출
|
||||||
@@ -325,6 +446,7 @@ public class InferenceResultService {
|
|||||||
*
|
*
|
||||||
* @param dto
|
* @param dto
|
||||||
*/
|
*/
|
||||||
|
// 같은함수가 왜 두개지
|
||||||
private Long ensureAccepted(InferenceSendDto dto) {
|
private Long ensureAccepted(InferenceSendDto dto) {
|
||||||
|
|
||||||
if (dto == null) {
|
if (dto == null) {
|
||||||
@@ -332,6 +454,14 @@ public class InferenceResultService {
|
|||||||
throw new CustomApiException("BAD_REQUEST", HttpStatus.BAD_REQUEST);
|
throw new CustomApiException("BAD_REQUEST", HttpStatus.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// [중복]운영환경일때 경로수정 dean 260226
|
||||||
|
if (profile != null && profile.equals("prod")) {
|
||||||
|
log.info("========================================================");
|
||||||
|
log.info("[CHANGE INFERENCE] profile = {} Inforence req", profile);
|
||||||
|
log.info("========================================================");
|
||||||
|
log.info("");
|
||||||
|
}
|
||||||
|
|
||||||
// 1) 요청 로그
|
// 1) 요청 로그
|
||||||
try {
|
try {
|
||||||
log.debug("Inference request dto={}", objectMapper.writeValueAsString(dto));
|
log.debug("Inference request dto={}", objectMapper.writeValueAsString(dto));
|
||||||
@@ -340,13 +470,15 @@ public class InferenceResultService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 2) local 환경 임시 처리
|
// 2) local 환경 임시 처리
|
||||||
if ("local".equals(profile)) {
|
// if ("local".equals(profile)) {
|
||||||
if (dto.getPred_requests_areas() == null) {
|
// if (dto.getPred_requests_areas() == null) {
|
||||||
throw new IllegalStateException("pred_requests_areas is null");
|
// throw new IllegalStateException("pred_requests_areas is null");
|
||||||
}
|
// }
|
||||||
dto.getPred_requests_areas().setInput1_scene_path("/kamco-nfs/requests/2023_local.geojson");
|
//
|
||||||
dto.getPred_requests_areas().setInput2_scene_path("/kamco-nfs/requests/2024_local.geojson");
|
// dto.getPred_requests_areas().setInput1_scene_path("/kamco-nfs/requests/2023_local.geojson");
|
||||||
}
|
//
|
||||||
|
// dto.getPred_requests_areas().setInput2_scene_path("/kamco-nfs/requests/2024_local.geojson");
|
||||||
|
// }
|
||||||
|
|
||||||
// 3) HTTP 호출
|
// 3) HTTP 호출
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
@@ -429,7 +561,8 @@ public class InferenceResultService {
|
|||||||
sendDto.setCls_model_path(cdClsModelPath);
|
sendDto.setCls_model_path(cdClsModelPath);
|
||||||
sendDto.setCls_model_version(modelInfo.getModelVer());
|
sendDto.setCls_model_version(modelInfo.getModelVer());
|
||||||
sendDto.setCd_model_type(modelType);
|
sendDto.setCd_model_type(modelType);
|
||||||
sendDto.setPriority(modelInfo.getPriority());
|
sendDto.setPriority(5d);
|
||||||
|
log.info("[Inference Send]SendDto={}", sendDto);
|
||||||
return sendDto;
|
return sendDto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,224 @@
|
|||||||
|
package com.kamco.cd.kamcoback.inference.service;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.kamco.cd.kamcoback.common.exception.CustomApiException;
|
||||||
|
import com.kamco.cd.kamcoback.common.geometry.GeoJsonFileWriter.Scene;
|
||||||
|
import com.kamco.cd.kamcoback.config.resttemplate.ExternalHttpClient;
|
||||||
|
import com.kamco.cd.kamcoback.config.resttemplate.ExternalHttpClient.ExternalCallResult;
|
||||||
|
import com.kamco.cd.kamcoback.inference.dto.InferenceSendDto;
|
||||||
|
import com.kamco.cd.kamcoback.inference.dto.InferenceSendDto.pred_requests_areas;
|
||||||
|
import com.kamco.cd.kamcoback.model.dto.ModelMngDto.Basic;
|
||||||
|
import com.kamco.cd.kamcoback.model.dto.ModelMngDto.ModelType;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.core.MapSheetMngCoreService;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.core.ModelMngCoreService;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.http.HttpMethod;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Log4j2
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class InferenceRunService {
|
||||||
|
private final ExternalHttpClient externalHttpClient;
|
||||||
|
private final MapSheetMngCoreService mapSheetMngCoreService;
|
||||||
|
private final ModelMngCoreService modelMngCoreService;
|
||||||
|
private final ObjectMapper objectMapper;
|
||||||
|
|
||||||
|
@Value("${spring.profiles.active}")
|
||||||
|
private String profile;
|
||||||
|
|
||||||
|
@Value("${inference.url}")
|
||||||
|
private String inferenceUrl;
|
||||||
|
|
||||||
|
// TODO 이거 쓰는건가?
|
||||||
|
public void run(Integer compareYear, Integer targetYear, UUID modelUuid) {
|
||||||
|
|
||||||
|
List<String> compareList = mapSheetMngCoreService.getMapSheetMngHst(compareYear);
|
||||||
|
List<String> targetList = mapSheetMngCoreService.getMapSheetMngHst(targetYear);
|
||||||
|
|
||||||
|
log.info(
|
||||||
|
"hst list count compareList = {}, targetList = {}", compareList.size(), targetList.size());
|
||||||
|
|
||||||
|
Set<String> compareSet = new HashSet<>(compareList);
|
||||||
|
Set<String> targetSet = new HashSet<>(targetList);
|
||||||
|
|
||||||
|
long intersectionCount =
|
||||||
|
targetSet.stream()
|
||||||
|
.distinct()
|
||||||
|
.filter(compareSet::contains)
|
||||||
|
.count(); // compare와 target에 공통으로 존재하는 도협 수
|
||||||
|
|
||||||
|
long excludedTargetCount =
|
||||||
|
targetSet.stream()
|
||||||
|
.distinct()
|
||||||
|
.filter(s -> !compareSet.contains(s))
|
||||||
|
.count(); // target 에만 존재하는 도협 수 (compare 에는 없음)
|
||||||
|
|
||||||
|
long onlyCompareCount =
|
||||||
|
compareSet.stream()
|
||||||
|
.distinct()
|
||||||
|
.filter(s -> !targetSet.contains(s))
|
||||||
|
.count(); // compare 에만 존재하는 도협 수 (target 에는 없음)
|
||||||
|
|
||||||
|
log.info(
|
||||||
|
"""
|
||||||
|
===== MapSheet Year Comparison =====
|
||||||
|
target Total: {}
|
||||||
|
compare Total: {}
|
||||||
|
Intersection: {}
|
||||||
|
target Only (Excluded from compare): {}
|
||||||
|
compare Only: {}
|
||||||
|
====================================
|
||||||
|
""",
|
||||||
|
targetSet.size(),
|
||||||
|
compareSet.size(),
|
||||||
|
intersectionCount,
|
||||||
|
excludedTargetCount,
|
||||||
|
onlyCompareCount);
|
||||||
|
|
||||||
|
List<String> filteredTargetList =
|
||||||
|
targetSet.stream() // target 기준으로
|
||||||
|
.filter(compareSet::contains) // compare에 있는 도협만 남김
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
Scene modelComparePath = getSceneInference(compareYear.toString(), filteredTargetList, "", "");
|
||||||
|
|
||||||
|
Scene modelTargetPath = getSceneInference(targetYear.toString(), filteredTargetList, "", "");
|
||||||
|
|
||||||
|
// ai 서버에 전달할 파라미터 생성
|
||||||
|
pred_requests_areas predRequestsAreas = new pred_requests_areas();
|
||||||
|
predRequestsAreas.setInput1_year(compareYear);
|
||||||
|
predRequestsAreas.setInput2_year(targetYear);
|
||||||
|
predRequestsAreas.setInput1_scene_path(modelComparePath.getFilePath());
|
||||||
|
predRequestsAreas.setInput2_scene_path(modelTargetPath.getFilePath());
|
||||||
|
|
||||||
|
InferenceSendDto m1 = this.getModelInfo(modelUuid);
|
||||||
|
m1.setPred_requests_areas(predRequestsAreas);
|
||||||
|
|
||||||
|
// ai 추론 실행 api 호출
|
||||||
|
Long batchId = ensureAccepted(m1);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Scene getSceneInference(
|
||||||
|
String yyyy, List<String> mapSheetNums, String mapSheetScope, String detectOption) {
|
||||||
|
return mapSheetMngCoreService.getSceneInference(
|
||||||
|
yyyy, mapSheetNums, mapSheetScope, detectOption);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 추론 AI API 호출
|
||||||
|
*
|
||||||
|
* @param dto
|
||||||
|
*/
|
||||||
|
private Long ensureAccepted(InferenceSendDto dto) {
|
||||||
|
|
||||||
|
if (dto == null) {
|
||||||
|
log.warn("not InferenceSendDto dto");
|
||||||
|
throw new CustomApiException("BAD_REQUEST", HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1) 요청 로그
|
||||||
|
try {
|
||||||
|
log.info("Inference request dto={}", objectMapper.writeValueAsString(dto));
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
log.warn("Failed to serialize inference dto", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3) HTTP 호출
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
headers.setAccept(List.of(MediaType.APPLICATION_JSON));
|
||||||
|
|
||||||
|
ExternalCallResult<String> result =
|
||||||
|
externalHttpClient.call(inferenceUrl, HttpMethod.POST, dto, headers, String.class);
|
||||||
|
|
||||||
|
if (result.statusCode() < 200 || result.statusCode() >= 300) {
|
||||||
|
log.error("Inference API failed. status={}, body={}", result.statusCode(), result.body());
|
||||||
|
throw new CustomApiException("BAD_GATEWAY", HttpStatus.BAD_GATEWAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4) 응답 파싱
|
||||||
|
try {
|
||||||
|
List<Map<String, Object>> list =
|
||||||
|
objectMapper.readValue(result.body(), new TypeReference<>() {});
|
||||||
|
|
||||||
|
if (list.isEmpty()) {
|
||||||
|
throw new IllegalStateException("Inference response is empty");
|
||||||
|
}
|
||||||
|
|
||||||
|
Object batchIdObj = list.get(0).get("batch_id");
|
||||||
|
if (batchIdObj == null) {
|
||||||
|
throw new IllegalStateException("batch_id not found in response");
|
||||||
|
}
|
||||||
|
|
||||||
|
return Long.valueOf(batchIdObj.toString());
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Failed to parse inference response. body={}", result.body(), e);
|
||||||
|
throw new CustomApiException("INVALID_INFERENCE_RESPONSE", HttpStatus.BAD_GATEWAY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 모델정보 조회 dto 생성 후 반환
|
||||||
|
*
|
||||||
|
* @param uuid
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private InferenceSendDto getModelInfo(UUID uuid) {
|
||||||
|
|
||||||
|
Basic modelInfo = modelMngCoreService.findByModelUuid(uuid);
|
||||||
|
|
||||||
|
String cdModelPath = "";
|
||||||
|
String cdModelConfigPath = "";
|
||||||
|
String cdClsModelPath = "";
|
||||||
|
|
||||||
|
if (modelInfo.getCdModelPath() != null && modelInfo.getCdModelFileName() != null) {
|
||||||
|
cdModelPath =
|
||||||
|
Paths.get(modelInfo.getCdModelPath(), modelInfo.getCdModelFileName()).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (modelInfo.getCdModelConfig() != null && modelInfo.getCdModelConfigFileName() != null) {
|
||||||
|
cdModelConfigPath =
|
||||||
|
Paths.get(modelInfo.getCdModelConfig(), modelInfo.getCdModelConfigFileName()).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (modelInfo.getClsModelPath() != null && modelInfo.getClsModelFileName() != null) {
|
||||||
|
cdClsModelPath =
|
||||||
|
Paths.get(modelInfo.getClsModelPath(), modelInfo.getClsModelFileName()).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
String modelType = "";
|
||||||
|
|
||||||
|
if (modelInfo.getModelType().equals(ModelType.G1.getId())) {
|
||||||
|
modelType = ModelType.G1.getId();
|
||||||
|
} else if (modelInfo.getModelType().equals(ModelType.G2.getId())) {
|
||||||
|
modelType = ModelType.G2.getId();
|
||||||
|
} else {
|
||||||
|
modelType = ModelType.G3.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
InferenceSendDto sendDto = new InferenceSendDto();
|
||||||
|
sendDto.setModel_version(modelInfo.getModelVer());
|
||||||
|
sendDto.setCd_model_path(cdModelPath);
|
||||||
|
sendDto.setCd_model_config(cdModelConfigPath);
|
||||||
|
sendDto.setCls_model_path(cdClsModelPath);
|
||||||
|
sendDto.setCls_model_version(modelInfo.getModelVer());
|
||||||
|
sendDto.setCd_model_type(modelType);
|
||||||
|
sendDto.setPriority(5.0);
|
||||||
|
return sendDto;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -47,6 +47,9 @@ public class MapSheetMngService {
|
|||||||
private final UploadService uploadService;
|
private final UploadService uploadService;
|
||||||
private final UserUtil userUtil = new UserUtil();
|
private final UserUtil userUtil = new UserUtil();
|
||||||
|
|
||||||
|
@Value("${file.root}")
|
||||||
|
private String nfsRootDir;
|
||||||
|
|
||||||
@Value("${file.sync-root-dir}")
|
@Value("${file.sync-root-dir}")
|
||||||
private String syncRootDir;
|
private String syncRootDir;
|
||||||
|
|
||||||
@@ -111,7 +114,6 @@ public class MapSheetMngService {
|
|||||||
public DmlReturn uploadPair(
|
public DmlReturn uploadPair(
|
||||||
MultipartFile tfwFile, String tifFile, Long hstUid, Long tifFileSize) {
|
MultipartFile tfwFile, String tifFile, Long hstUid, Long tifFileSize) {
|
||||||
|
|
||||||
String rootPath = syncRootDir;
|
|
||||||
String tmpPath = syncTmpDir;
|
String tmpPath = syncTmpDir;
|
||||||
|
|
||||||
DmlReturn dmlReturn = new DmlReturn("success", "UPLOAD COMPLETE");
|
DmlReturn dmlReturn = new DmlReturn("success", "UPLOAD COMPLETE");
|
||||||
@@ -133,6 +135,7 @@ public class MapSheetMngService {
|
|||||||
return dmlReturn;
|
return dmlReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO 삭제?
|
||||||
MngDto mngDto = mapSheetMngCoreService.findMapSheetMng(errDto.getMngYyyy());
|
MngDto mngDto = mapSheetMngCoreService.findMapSheetMng(errDto.getMngYyyy());
|
||||||
|
|
||||||
// 중복체크 -> 도엽50k/uuid 경로에 업로드 할 거라 overwrite 되지 않음
|
// 중복체크 -> 도엽50k/uuid 경로에 업로드 할 거라 overwrite 되지 않음
|
||||||
@@ -336,12 +339,11 @@ public class MapSheetMngService {
|
|||||||
|
|
||||||
public FoldersDto getFolderAll(SrchFoldersDto srchDto) {
|
public FoldersDto getFolderAll(SrchFoldersDto srchDto) {
|
||||||
|
|
||||||
Path startPath = Paths.get(syncRootDir + srchDto.getDirPath());
|
|
||||||
String dirPath = syncRootDir + srchDto.getDirPath();
|
String dirPath = syncRootDir + srchDto.getDirPath();
|
||||||
String sortType = "name desc";
|
|
||||||
|
|
||||||
|
log.info("[FIND_FOLDER] DIR : {}", dirPath);
|
||||||
List<FIleChecker.Folder> folderList =
|
List<FIleChecker.Folder> folderList =
|
||||||
FIleChecker.getFolderAll(dirPath).stream()
|
FIleChecker.getFolderAll(dirPath, nfsRootDir).stream()
|
||||||
.filter(dir -> dir.getIsValid().equals(true))
|
.filter(dir -> dir.getIsValid().equals(true))
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
|
|||||||
@@ -498,15 +498,16 @@ public class InferenceResultCoreService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 추론 결과 shp파일 생성위해서 조회
|
* 추론 결과 조회
|
||||||
*
|
*
|
||||||
* @param batchIds
|
* @param batchIds
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<InferenceResultsTestingDto.ShpDto> getInferenceResults(List<Long> batchIds) {
|
public List<InferenceResultsTestingDto.Basic> getInferenceResults(List<Long> batchIds) {
|
||||||
List<InferenceResultsTestingEntity> list =
|
List<InferenceResultsTestingEntity> list =
|
||||||
inferenceResultsTestingRepository.getInferenceResultList(batchIds);
|
inferenceResultsTestingRepository.getInferenceResultList(batchIds);
|
||||||
return list.stream().map(InferenceResultsTestingDto.ShpDto::fromEntity).toList();
|
|
||||||
|
return list.stream().map(InferenceResultsTestingEntity::toDto).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getInferenceResultCnt(List<Long> batchIds) {
|
public Long getInferenceResultCnt(List<Long> batchIds) {
|
||||||
|
|||||||
@@ -342,4 +342,9 @@ public class MapSheetMngCoreService {
|
|||||||
public List<MngListCompareDto> getByHstMapSheetCompareList(int mngYyyy, List<String> mapId) {
|
public List<MngListCompareDto> getByHstMapSheetCompareList(int mngYyyy, List<String> mapId) {
|
||||||
return mapSheetMngYearRepository.findByHstMapSheetCompareList(mngYyyy, mapId);
|
return mapSheetMngYearRepository.findByHstMapSheetCompareList(mngYyyy, mapId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getMapSheetMngHst(Integer year) {
|
||||||
|
List<MapSheetMngHstEntity> entity = mapSheetMngRepository.getMapSheetMngHst(year);
|
||||||
|
return entity.stream().map(MapSheetMngHstEntity::getMapSheetNum).toList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.entity;
|
package com.kamco.cd.kamcoback.postgres.entity;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultsTestingDto;
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.Id;
|
import jakarta.persistence.Id;
|
||||||
@@ -84,4 +85,28 @@ public class InferenceResultsTestingEntity {
|
|||||||
|
|
||||||
@Column(name = "geometry", columnDefinition = "geometry")
|
@Column(name = "geometry", columnDefinition = "geometry")
|
||||||
private Geometry geometry;
|
private Geometry geometry;
|
||||||
|
|
||||||
|
public InferenceResultsTestingDto.Basic toDto() {
|
||||||
|
return new InferenceResultsTestingDto.Basic(
|
||||||
|
this.probability,
|
||||||
|
this.beforeYear,
|
||||||
|
this.afterYear,
|
||||||
|
this.mapId,
|
||||||
|
this.modelVersion,
|
||||||
|
this.clsModelPath,
|
||||||
|
this.clsModelVersion,
|
||||||
|
this.cdModelType,
|
||||||
|
this.id,
|
||||||
|
this.modelName,
|
||||||
|
this.batchId,
|
||||||
|
this.area,
|
||||||
|
this.beforeC,
|
||||||
|
this.beforeP,
|
||||||
|
this.afterC,
|
||||||
|
this.afterP,
|
||||||
|
this.seq,
|
||||||
|
this.createdDate,
|
||||||
|
this.uid,
|
||||||
|
this.geometry);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,4 +80,6 @@ public interface MapSheetMngRepositoryCustom {
|
|||||||
void updateMapSheetMngHstUploadId(Long hstUid, UUID uuid, String uploadId);
|
void updateMapSheetMngHstUploadId(Long hstUid, UUID uuid, String uploadId);
|
||||||
|
|
||||||
void insertMapSheetMngTile(@Valid AddReq addReq);
|
void insertMapSheetMngTile(@Valid AddReq addReq);
|
||||||
|
|
||||||
|
List<MapSheetMngHstEntity> getMapSheetMngHst(Integer year);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1099,4 +1099,24 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
"{0} like '%" + searchReq.getSearchValue() + "%'",
|
"{0} like '%" + searchReq.getSearchValue() + "%'",
|
||||||
mapSheetMngHstEntity.mapSheetNum));
|
mapSheetMngHstEntity.mapSheetNum));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MapSheetMngHstEntity> getMapSheetMngHst(Integer year) {
|
||||||
|
return queryFactory
|
||||||
|
.select(mapSheetMngHstEntity)
|
||||||
|
.from(mapSheetMngHstEntity)
|
||||||
|
.innerJoin(mapSheetMngFileEntity)
|
||||||
|
.on(mapSheetMngFileEntity.hstUid.eq(mapSheetMngHstEntity.hstUid))
|
||||||
|
.where(
|
||||||
|
mapSheetMngHstEntity
|
||||||
|
.mngYyyy
|
||||||
|
.eq(year)
|
||||||
|
.and(
|
||||||
|
mapSheetMngHstEntity
|
||||||
|
.syncState
|
||||||
|
.eq("DONE")
|
||||||
|
.or(mapSheetMngHstEntity.syncCheckState.eq("DONE")))
|
||||||
|
.and(mapSheetMngFileEntity.fileExt.eq("tif")))
|
||||||
|
.fetch();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -307,6 +307,10 @@ 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();
|
||||||
|
|
||||||
@@ -327,6 +331,10 @@ 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"))
|
||||||
@@ -355,6 +363,10 @@ 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(
|
||||||
|
|||||||
@@ -314,6 +314,10 @@ 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();
|
||||||
|
|
||||||
@@ -334,6 +338,10 @@ 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"))
|
||||||
@@ -362,6 +370,10 @@ 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"),
|
||||||
|
|||||||
@@ -354,9 +354,8 @@ public class MapSheetInferenceJobService {
|
|||||||
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(type);
|
m.setCd_model_type(type);
|
||||||
m.setPriority(progressDto.getPriority());
|
m.setPriority(5d);
|
||||||
|
log.info("[BEFORE INFERENCE] BEFORE SendDto={}", m);
|
||||||
// log.info("InferenceSendDto={}", m);
|
|
||||||
// 추론 실행 api 호출
|
// 추론 실행 api 호출
|
||||||
Long batchId = ensureAccepted(m);
|
Long batchId = ensureAccepted(m);
|
||||||
|
|
||||||
@@ -376,6 +375,7 @@ public class MapSheetInferenceJobService {
|
|||||||
* @param dto
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
// 같은함수가 왜 두개지
|
||||||
private Long ensureAccepted(InferenceSendDto dto) {
|
private Long ensureAccepted(InferenceSendDto dto) {
|
||||||
if (dto == null) {
|
if (dto == null) {
|
||||||
log.warn("not InferenceSendDto dto");
|
log.warn("not InferenceSendDto dto");
|
||||||
@@ -383,22 +383,28 @@ public class MapSheetInferenceJobService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 1) 요청 로그
|
// 1) 요청 로그
|
||||||
log.info("Inference request dto={}", dto);
|
log.info("");
|
||||||
|
log.info("========================================================");
|
||||||
|
log.info("[SEND INFERENCE] Inference request dto= {}", dto);
|
||||||
|
log.info("========================================================");
|
||||||
|
log.info("");
|
||||||
// 2) local 환경 임시 처리
|
// 2) local 환경 임시 처리
|
||||||
if ("local".equals(profile)) {
|
// if ("local".equals(profile)) {
|
||||||
if (dto.getPred_requests_areas() == null) {
|
// if (dto.getPred_requests_areas() == null) {
|
||||||
throw new IllegalStateException("pred_requests_areas is null");
|
// throw new IllegalStateException("pred_requests_areas is null");
|
||||||
}
|
// }
|
||||||
dto.getPred_requests_areas().setInput1_scene_path("/kamco-nfs/requests/2023_local.geojson");
|
//
|
||||||
dto.getPred_requests_areas().setInput2_scene_path("/kamco-nfs/requests/2024_local.geojson");
|
// dto.getPred_requests_areas().setInput1_scene_path("/kamco-nfs/requests/2023_local.geojson");
|
||||||
}
|
//
|
||||||
|
// dto.getPred_requests_areas().setInput2_scene_path("/kamco-nfs/requests/2024_local.geojson");
|
||||||
|
// }
|
||||||
|
|
||||||
// 3) HTTP 호출
|
// 3) HTTP 호출
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||||
headers.setAccept(List.of(MediaType.APPLICATION_JSON));
|
headers.setAccept(List.of(MediaType.APPLICATION_JSON));
|
||||||
|
|
||||||
|
// TODO 어떤 URL로 어떤파리티러로 요청한 로딩해야지
|
||||||
ExternalCallResult<String> result =
|
ExternalCallResult<String> result =
|
||||||
externalHttpClient.call(inferenceUrl, HttpMethod.POST, dto, headers, String.class);
|
externalHttpClient.call(inferenceUrl, HttpMethod.POST, dto, headers, String.class);
|
||||||
|
|
||||||
@@ -413,6 +419,7 @@ public class MapSheetInferenceJobService {
|
|||||||
objectMapper.readValue(result.body(), new TypeReference<>() {});
|
objectMapper.readValue(result.body(), new TypeReference<>() {});
|
||||||
|
|
||||||
if (list.isEmpty()) {
|
if (list.isEmpty()) {
|
||||||
|
// 어떤 URL로 어떤파리티러로 요청한 정보를 봐야 재현을 할듯하지요
|
||||||
throw new IllegalStateException("Inference response is empty");
|
throw new IllegalStateException("Inference response is empty");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public class TrainingDataReviewJobService {
|
|||||||
@Value("${spring.profiles.active}")
|
@Value("${spring.profiles.active}")
|
||||||
private String profile;
|
private String profile;
|
||||||
|
|
||||||
@Value("${training-data.geojson-dir}")
|
@Value("${file.training-data.geojson-dir}")
|
||||||
private String trainingDataDir;
|
private String trainingDataDir;
|
||||||
|
|
||||||
private boolean isLocalProfile() {
|
private boolean isLocalProfile() {
|
||||||
|
|||||||
@@ -89,36 +89,17 @@ mapsheet:
|
|||||||
shp:
|
shp:
|
||||||
baseurl: /app/tmp/detect/result #현재사용안함
|
baseurl: /app/tmp/detect/result #현재사용안함
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
file:
|
file:
|
||||||
#sync-root-dir: D:/kamco-nfs/images/
|
root: kamco-nfs
|
||||||
sync-root-dir: /kamco-nfs/images/
|
nfs: /kamco-nfs
|
||||||
sync-tmp-dir: /kamco-nfs/requests/temp # image upload temp dir
|
pt-path: ${file.nfs}/ckpt/model/v6-cls-checkpoints/
|
||||||
#sync-tmp-dir: ${file.sync-root-dir}/tmp
|
|
||||||
sync-file-extention: tfw,tif
|
|
||||||
sync-auto-exception-start-year: 2024
|
|
||||||
sync-auto-exception-before-year-cnt: 3
|
|
||||||
|
|
||||||
#dataset-dir: D:/kamco-nfs/model_output/
|
|
||||||
dataset-dir: /kamco-nfs/model_output/export/ # 마운트경로 AI 추론결과
|
|
||||||
dataset-tmp-dir: ${file.dataset-dir}tmp/
|
|
||||||
|
|
||||||
#model-dir: D:/kamco-nfs/ckpt/model/
|
|
||||||
model-dir: /kamco-nfs/ckpt/model/ # 학습서버에서 트레이닝한 모델업로드경로
|
|
||||||
model-tmp-dir: ${file.model-dir}tmp/
|
|
||||||
model-file-extention: pth,json,py
|
|
||||||
|
|
||||||
pt-path: /kamco-nfs/ckpt/model/v6-cls-checkpoints/
|
|
||||||
pt-FileName: yolov8_6th-6m.pt
|
pt-FileName: yolov8_6th-6m.pt
|
||||||
|
|
||||||
dataset-response: /kamco-nfs/dataset/response/
|
|
||||||
|
|
||||||
inference:
|
inference:
|
||||||
|
nfs: /kamco-nfs
|
||||||
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/ # 추론실행을 위한 파일생성경로
|
jar-path: ${inference.nfs}/repo/jar/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:
|
||||||
@@ -126,9 +107,6 @@ gukyuin:
|
|||||||
url: http://192.168.2.129:5301
|
url: http://192.168.2.129:5301
|
||||||
cdi: ${gukyuin.url}/api/kcd/cdi
|
cdi: ${gukyuin.url}/api/kcd/cdi
|
||||||
|
|
||||||
training-data:
|
|
||||||
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
|
||||||
|
|||||||
@@ -67,33 +67,17 @@ mapsheet:
|
|||||||
shp:
|
shp:
|
||||||
baseurl: /Users/bokmin/detect/result
|
baseurl: /Users/bokmin/detect/result
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
file:
|
file:
|
||||||
sync-root-dir: C:/Users/gypark/kamco-nfs/images/
|
root: kamco-nfs
|
||||||
#sync-root-dir: /kamco-nfs/images/
|
nfs: C:/Users/gypark/kamco-nfs
|
||||||
sync-tmp-dir: ${file.sync-root-dir}/tmp/
|
pt-path: ${file.nfs}/ckpt/classification/
|
||||||
sync-file-extention: tfw,tif
|
|
||||||
sync-auto-exception-start-year: 2025
|
|
||||||
sync-auto-exception-before-year-cnt: 3
|
|
||||||
|
|
||||||
dataset-dir: C:/Users/gypark/kamco-nfs/dataset/
|
|
||||||
#dataset-dir: /kamco-nfs/dataset/export/
|
|
||||||
dataset-tmp-dir: ${file.dataset-dir}tmp/
|
|
||||||
|
|
||||||
model-dir: C:/Users/gypark/kamco-nfs/ckpt/model/
|
|
||||||
#model-dir: /kamco-nfs/ckpt/model/
|
|
||||||
model-tmp-dir: ${file.model-dir}tmp/
|
|
||||||
model-file-extention: pth,json,py
|
|
||||||
|
|
||||||
pt-path: /kamco-nfs/ckpt/classification/
|
|
||||||
pt-FileName: v5-best.pt
|
pt-FileName: v5-best.pt
|
||||||
|
|
||||||
inference:
|
inference:
|
||||||
|
nfs: C:/Users/gyparkkamco-nfs
|
||||||
url: http://10.100.0.11:8000/jobs
|
url: http://10.100.0.11:8000/jobs
|
||||||
batch-url: http://10.100.0.11:8000/batches
|
batch-url: http://10.100.0.11:8000/batches
|
||||||
geojson-dir: /kamco-nfs/requests/
|
jar-path: jar/shp-exporter.jar
|
||||||
jar-path: jar/makeshp-1.0.0.jar
|
|
||||||
inference-server-name: server1,server2,server3,server4
|
inference-server-name: server1,server2,server3,server4
|
||||||
|
|
||||||
gukyuin:
|
gukyuin:
|
||||||
@@ -101,10 +85,8 @@ gukyuin:
|
|||||||
url: http://192.168.2.129:5301
|
url: http://192.168.2.129:5301
|
||||||
cdi: ${gukyuin.url}/api/kcd/cdi
|
cdi: ${gukyuin.url}/api/kcd/cdi
|
||||||
|
|
||||||
training-data:
|
|
||||||
geojson-dir: /kamco-nfs/model_output/labeling/
|
|
||||||
|
|
||||||
layer:
|
layer:
|
||||||
geoserver-url: https://kamco.geo-dev.gs.dabeeo.com
|
geoserver-url: https://kamco.geo-dev.gs.dabeeo.com
|
||||||
path: /geoserver/cd/gwc/service/
|
wms-path: geoserver/cd
|
||||||
|
wmts-path: geoserver/cd/gwc/service
|
||||||
workspace: cd
|
workspace: cd
|
||||||
|
|||||||
@@ -16,13 +16,9 @@ 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://127.0.0.1:15432/kamco_cds
|
url: jdbc:postgresql://kamco-cd-postgis:5432/kamco_cds
|
||||||
#url: jdbc:postgresql://localhost:15432/kamco_cds
|
#url: jdbc:postgresql://localhost:15432/kamco_cds
|
||||||
username: kamco_cds
|
username: kamco_cds
|
||||||
password: kamco_cds_Q!W@E#R$
|
password: kamco_cds_Q!W@E#R$
|
||||||
@@ -64,11 +60,15 @@ token:
|
|||||||
refresh-cookie-name: kamco # 개발용 쿠키 이름
|
refresh-cookie-name: kamco # 개발용 쿠키 이름
|
||||||
refresh-cookie-secure: true # 로컬 http 테스트면 false
|
refresh-cookie-secure: true # 로컬 http 테스트면 false
|
||||||
|
|
||||||
|
springdoc:
|
||||||
|
swagger-ui:
|
||||||
|
persist-authorization: true # 스웨거 새로고침해도 토큰 유지, 로컬스토리지에 저장
|
||||||
|
|
||||||
logging:
|
logging:
|
||||||
level:
|
level:
|
||||||
root: INFO
|
root: INFO
|
||||||
org.springframework.web: DEBUG
|
org.springframework.web: INFO
|
||||||
org.springframework.security: DEBUG
|
org.springframework.security: INFO
|
||||||
|
|
||||||
# 헬스체크 노이즈 핵심만 다운
|
# 헬스체크 노이즈 핵심만 다운
|
||||||
org.springframework.security.web.FilterChainProxy: INFO
|
org.springframework.security.web.FilterChainProxy: INFO
|
||||||
@@ -84,40 +84,23 @@ mapsheet:
|
|||||||
baseurl: /app/detect/result #현재사용안함
|
baseurl: /app/detect/result #현재사용안함
|
||||||
|
|
||||||
file:
|
file:
|
||||||
#sync-root-dir: D:/kamco-nfs/images/
|
root: data
|
||||||
sync-root-dir: /kamco-nfs/images/
|
nfs: /data
|
||||||
sync-tmp-dir: ${file.sync-root-dir}/tmp # image upload temp dir
|
pt-path: ${file.nfs}/ckpt/model/v6-cls-checkpoints/
|
||||||
sync-file-extention: tfw,tif
|
|
||||||
sync-auto-exception-start-year: 2025
|
|
||||||
sync-auto-exception-before-year-cnt: 3
|
|
||||||
|
|
||||||
#dataset-dir: D:/kamco-nfs/model_output/ #변경 model_output
|
|
||||||
dataset-dir: /kamco-nfs/model_output/export/ # 마운트경로 AI 추론결과
|
|
||||||
dataset-tmp-dir: ${file.dataset-dir}tmp/
|
|
||||||
|
|
||||||
#model-dir: D:/kamco-nfs/ckpt/model/
|
|
||||||
model-dir: /kamco-nfs/ckpt/model/ # 학습서버에서 트레이닝한 모델업로드경로
|
|
||||||
model-tmp-dir: ${file.model-dir}tmp/
|
|
||||||
model-file-extention: pth,json,py
|
|
||||||
|
|
||||||
pt-path: /kamco-nfs/ckpt/model/v6-cls-checkpoints/
|
|
||||||
pt-FileName: yolov8_6th-6m.pt
|
pt-FileName: yolov8_6th-6m.pt
|
||||||
|
|
||||||
dataset-response: /kamco-nfs/dataset/response/
|
|
||||||
|
|
||||||
inference:
|
inference:
|
||||||
url: http://127.0.0.1:8000/jobs
|
nfs: /data
|
||||||
batch-url: http://127.0.0.1:8000/batches
|
url: http://172.16.4.56:8000/jobs
|
||||||
geojson-dir: /kamco-nfs/requests/ # 학습서버에서 트레이닝한 모델업로드경로
|
batch-url: http://172.16.4.56:8000/batches
|
||||||
jar-path: /kamco-nfs/repo/jar/shp-exporter.jar # 추론실행을 위한 파일생성경로
|
jar-path: ${inference.nfs}/repo/jar/shp-exporter.jar
|
||||||
inference-server-name: server1,server2,server3,server4
|
inference-server-name: server1,server2,server3,server4
|
||||||
|
|
||||||
gukyuin:
|
gukyuin:
|
||||||
url: http://127.0.0.1:5301
|
url: http://127.0.0.1:5301
|
||||||
cdi: ${gukyuin.url}/api/kcd/cdi
|
cdi: ${gukyuin.url}/api/kcd/cdi
|
||||||
|
|
||||||
training-data:
|
|
||||||
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
|
||||||
|
|||||||
120
src/main/resources/application-prod.yml_bak
Normal file
120
src/main/resources/application-prod.yml_bak
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
spring:
|
||||||
|
config:
|
||||||
|
activate:
|
||||||
|
on-profile: prod
|
||||||
|
|
||||||
|
jpa:
|
||||||
|
show-sql: true
|
||||||
|
hibernate:
|
||||||
|
ddl-auto: validate
|
||||||
|
properties:
|
||||||
|
hibernate:
|
||||||
|
default_batch_fetch_size: 100 # ✅ 성능 - N+1 쿼리 방지
|
||||||
|
order_updates: true # ✅ 성능 - 업데이트 순서 정렬로 데드락 방지
|
||||||
|
order_inserts: true
|
||||||
|
use_sql_comments: true # ⚠️ 선택 - SQL에 주석 추가 (디버깅용)
|
||||||
|
format_sql: true # ⚠️ 선택 - SQL 포맷팅 (가독성)
|
||||||
|
jdbc:
|
||||||
|
batch_size: 1000 # ✅ 추가 (JDBC batch)
|
||||||
|
|
||||||
|
datasource:
|
||||||
|
url: jdbc:postgresql://kamco-cd-postgis:5432/kamco_cds
|
||||||
|
#url: jdbc:postgresql://localhost:15432/kamco_cds
|
||||||
|
username: kamco_cds
|
||||||
|
password: kamco_cds_Q!W@E#R$
|
||||||
|
hikari:
|
||||||
|
minimum-idle: 10
|
||||||
|
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:
|
||||||
|
secret: "kamco_token_9b71e778-19a3-4c1d-97bf-2d687de17d5b"
|
||||||
|
access-token-validity-in-ms: 86400000 # 1일
|
||||||
|
refresh-token-validity-in-ms: 604800000 # 7일
|
||||||
|
|
||||||
|
token:
|
||||||
|
refresh-cookie-name: kamco # 개발용 쿠키 이름
|
||||||
|
refresh-cookie-secure: true # 로컬 http 테스트면 false
|
||||||
|
|
||||||
|
logging:
|
||||||
|
level:
|
||||||
|
root: INFO
|
||||||
|
org.springframework.web: INFO
|
||||||
|
org.springframework.security: INFO
|
||||||
|
|
||||||
|
# 헬스체크 노이즈 핵심만 다운
|
||||||
|
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:
|
||||||
|
upload:
|
||||||
|
skipGdalValidation: true
|
||||||
|
shp:
|
||||||
|
baseurl: /app/detect/result #현재사용안함
|
||||||
|
|
||||||
|
file:
|
||||||
|
#sync-root-dir: D:/kamco-nfs/images/
|
||||||
|
sync-root-dir: /kamco-nfs/images/
|
||||||
|
sync-tmp-dir: ${file.sync-root-dir}/tmp # image upload temp dir
|
||||||
|
sync-file-extention: tfw,tif
|
||||||
|
sync-auto-exception-start-year: 2025
|
||||||
|
sync-auto-exception-before-year-cnt: 3
|
||||||
|
|
||||||
|
#dataset-dir: D:/kamco-nfs/model_output/ #변경 model_output
|
||||||
|
dataset-dir: /kamco-nfs/model_output/export/ # 마운트경로 AI 추론결과
|
||||||
|
dataset-tmp-dir: ${file.dataset-dir}tmp/
|
||||||
|
|
||||||
|
#model-dir: D:/kamco-nfs/ckpt/model/
|
||||||
|
model-dir: /kamco-nfs/ckpt/model/ # 학습서버에서 트레이닝한 모델업로드경로
|
||||||
|
model-tmp-dir: ${file.model-dir}tmp/
|
||||||
|
model-file-extention: pth,json,py
|
||||||
|
|
||||||
|
pt-path: /kamco-nfs/ckpt/model/v6-cls-checkpoints/
|
||||||
|
pt-FileName: yolov8_6th-6m.pt
|
||||||
|
|
||||||
|
inference:
|
||||||
|
url: http://127.0.0.1:8000/jobs
|
||||||
|
batch-url: http://127.0.0.1:8000/batches
|
||||||
|
geojson-dir: /kamco-nfs/requests/ # 학습서버에서 트레이닝한 모델업로드경로
|
||||||
|
jar-path: /kamco-nfs/repo/jar/shp-exporter.jar # 추론실행을 위한 파일생성경로
|
||||||
|
inference-server-name: server1,server2,server3,server4
|
||||||
|
|
||||||
|
gukyuin:
|
||||||
|
url: http://127.0.0.1:5301
|
||||||
|
cdi: ${gukyuin.url}/api/kcd/cdi
|
||||||
|
|
||||||
|
training-data:
|
||||||
|
geojson-dir: /kamco-nfs/dataset/request/
|
||||||
|
|
||||||
|
layer:
|
||||||
|
geoserver-url: https://kamco.geo-dev.gs.dabeeo.com
|
||||||
|
wms-path: geoserver/cd
|
||||||
|
wmts-path: geoserver/cd/gwc/service
|
||||||
|
workspace: cd
|
||||||
@@ -67,3 +67,22 @@ management:
|
|||||||
include:
|
include:
|
||||||
- "health"
|
- "health"
|
||||||
|
|
||||||
|
file:
|
||||||
|
root: kamco-nfs
|
||||||
|
nfs: /kamco-nfs
|
||||||
|
sync-root-dir: ${file.nfs}/images/
|
||||||
|
sync-tmp-dir: ${file.nfs}/requests/temp # image upload temp dir
|
||||||
|
sync-file-extention: tfw,tif
|
||||||
|
dataset-dir: ${file.nfs}/model_output/export/ # 마운트경로 AI 추론결과
|
||||||
|
dataset-tmp-dir: ${file.dataset-dir}tmp/
|
||||||
|
model-dir: ${file.nfs}/ckpt/model/ # 학습서버에서 트레이닝한 모델업로드경로
|
||||||
|
model-tmp-dir: ${file.model-dir}tmp/
|
||||||
|
model-file-extention: pth,json,py
|
||||||
|
pt-path: ${file.nfs}/ckpt/model/v6-cls-checkpoints/
|
||||||
|
dataset-response: ${file.nfs}/dataset/response/
|
||||||
|
training-data:
|
||||||
|
geojson-dir: ${file.nfs}/dataset/request/
|
||||||
|
inference:
|
||||||
|
nfs: /kamco-nfs
|
||||||
|
geojson-dir: ${inference.nfs}/requests/ # 추론실행을 위한 파일생성경로
|
||||||
|
jar-path: ${inference.nfs}/repo/jar/shp-exporter.jar
|
||||||
|
|||||||
Reference in New Issue
Block a user