Compare commits
216 Commits
9d7bbc1b63
...
feat/dean/
| Author | SHA1 | Date | |
|---|---|---|---|
| 32d56cf8fe | |||
| c3b7daebb7 | |||
| 2188d426d4 | |||
| 5c2ee0974b | |||
| 7980fe1d42 | |||
| c10141e915 | |||
| 97565c5369 | |||
| 30f0e1a885 | |||
| ba562261c3 | |||
| a084c80715 | |||
| a44e93c234 | |||
| a63b81008a | |||
| 2309357c0d | |||
| ee76389d6c | |||
| 7b15e5bb8c | |||
| 001ad73de7 | |||
| 2508f59a72 | |||
| f2307ff0f4 | |||
| 6f44319d33 | |||
| cefacb291b | |||
| 744cbb55a9 | |||
| 4a120ae5fd | |||
| 7c200b057a | |||
| 8ac0a00311 | |||
| 4863091406 | |||
| 70c28e0b54 | |||
| 9197819340 | |||
| f2500c33e6 | |||
| 18dc831b05 | |||
| 48b46035fd | |||
| 1b9c7faf22 | |||
| fcdba49430 | |||
| 7599c99025 | |||
| 8fd1948d7c | |||
| 2c1047a014 | |||
| 8c54e5c176 | |||
| d3faa87d4f | |||
| 8d8d9d7a9f | |||
| 9c3d6c01f7 | |||
| 02b9a97ee8 | |||
| 438fb3ec9b | |||
| 3105b60759 | |||
| 5dddafbe0c | |||
| c2872c7748 | |||
| 7128eb007e | |||
| 815ee57e06 | |||
| ab52256c05 | |||
| 3ee3cf8425 | |||
| ba11e4c801 | |||
| 14248b29e7 | |||
| e95bea7d29 | |||
| a4c3fc5185 | |||
| d391a73197 | |||
| fdbda7d945 | |||
| d36703fd84 | |||
| 9ffab423c8 | |||
| 496f9c562d | |||
| 2720cc3766 | |||
| 72778d6996 | |||
| 514b07356e | |||
| 85834f2221 | |||
| c93d40f3f3 | |||
| 74e6485930 | |||
| 8cb8632a51 | |||
| 190ba525d5 | |||
| 70e01a2044 | |||
| fad797eea4 | |||
| 9ee1ec94c0 | |||
| 670cedda59 | |||
| 3683c193d4 | |||
| a2293ad1ab | |||
| 78fe7f013b | |||
| 22c3b28237 | |||
| 48fa13615e | |||
| 8d7ddc4c33 | |||
| 1f9d6861a0 | |||
| b859a56ab0 | |||
| 84b2149f78 | |||
| 4b04fb64ec | |||
| df0c689243 | |||
| 827f701186 | |||
| db897268de | |||
| 4dc5c196ca | |||
| ea74203667 | |||
| 9421df2b9b | |||
| 2a3bf9852d | |||
| 3f1bb8f082 | |||
| 21ac562fd5 | |||
| 778e87383c | |||
| aac8c91cd0 | |||
| 38c4fbf4e5 | |||
| b8fc314bff | |||
| a2bb1b2442 | |||
| 4e2e5c0b1d | |||
| fd1ba1ef3b | |||
| 6b65dbdc75 | |||
| 2d2b55efcd | |||
| ac13f36663 | |||
| 82f08c4240 | |||
| e15b35943b | |||
| 8bdccfdce6 | |||
| e209eeb826 | |||
| 3aca011104 | |||
| 2c320194b4 | |||
| 3f6737706a | |||
| 0df7d7c5cf | |||
| 3724528ea9 | |||
| 9885c19b50 | |||
| 079a899822 | |||
| 5b09b2e29a | |||
| 58a73de9ab | |||
| 4cbd2b8d76 | |||
| f4a890bec8 | |||
| 89504e4156 | |||
| 783609b015 | |||
| 5d33190c31 | |||
| 92232e13f1 | |||
| 81b0b55d57 | |||
| 83ef7e36ed | |||
| 0d13e6989f | |||
| 80b037a9cb | |||
| 4342df9bf5 | |||
| 8f9585b516 | |||
| 43b5a79031 | |||
| 3ba3b05f2f | |||
| 298b90a289 | |||
| 985e1789d2 | |||
| fffc2efd96 | |||
| 2d86fab030 | |||
| 82e3250fd4 | |||
| cf6b1323d8 | |||
| 470f2191b7 | |||
| 5377294e6e | |||
| c127531412 | |||
| 4e3e2a0181 | |||
| 61cfd8240a | |||
| 57a2ec8367 | |||
| 54b6712273 | |||
| fe6edbb19f | |||
| b2141e98c0 | |||
| 0e45adc52e | |||
| 581b8c968e | |||
| e88ffd1260 | |||
| bdce18119f | |||
| 533d97a573 | |||
| 3b5536a57e | |||
| 3237863542 | |||
| 9dd03f3c52 | |||
| 41b227de3f | |||
| 796591eca6 | |||
| 83e02c4498 | |||
| 825e393e05 | |||
| d8804e7c9a | |||
| 1410333829 | |||
| f326b5f651 | |||
| d63980476f | |||
| c1b6061e3e | |||
| ae1693a33c | |||
| 71a8f27afc | |||
| 8dfae65bcc | |||
| 299d1b09a0 | |||
| 3461376b35 | |||
| 872df11844 | |||
| 17bd89fafa | |||
| f992bbe9ca | |||
| e5fa99daef | |||
| 643ea5cf9a | |||
| d563f47abd | |||
| bc4b2dbac1 | |||
| cf4f79f7ca | |||
| 6e9b4196b8 | |||
| a4f66f511e | |||
| 9734a5acb2 | |||
| 9fb4a25955 | |||
| 694b2fc31e | |||
| 3af05bbeef | |||
| fbdda6477c | |||
| 1c2e41ced6 | |||
| a572089dff | |||
| c52c2ab9bd | |||
| c6abf7a935 | |||
| eb8d798714 | |||
| 7e95b53881 | |||
| 74b244981b | |||
| a9348d9a66 | |||
| 699d39d402 | |||
| b877d2a8c9 | |||
| e3ae889152 | |||
| 20a835cf45 | |||
| 151012ea28 | |||
| c0b5dd99ef | |||
| 5015a2a437 | |||
| 68c68082cf | |||
| 4ce96b72aa | |||
| 0a5c5dfd7d | |||
| d8d35c3462 | |||
| 7442e4ee09 | |||
| b77de057f0 | |||
| 2559b225d5 | |||
| d278baed96 | |||
| 9a00c38cc7 | |||
| e8fa7411d5 | |||
| 71f1f03b89 | |||
| 6b0074316f | |||
| 96d7ea205c | |||
| 0993ce646a | |||
| f921ef5d0d | |||
| 302e1ad957 | |||
| 7667620395 | |||
| e11f365bf8 | |||
| 527acc9839 | |||
| 9dd439b920 | |||
| 407f14d230 | |||
| a42729a475 | |||
| 4a91d61b7d | |||
| bc5c5b3dd7 |
29
Dockerfile-prod
Normal file
29
Dockerfile-prod
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
# Stage 1: Build stage (gradle build는 Jenkins에서 이미 수행)
|
||||||
|
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 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"]
|
||||||
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,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
|
||||||
|
|||||||
44
docker-compose-prod.yml
Normal file
44
docker-compose-prod.yml
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
services:
|
||||||
|
nginx:
|
||||||
|
image: nginx:alpine
|
||||||
|
container_name: kamco-cd-api-nginx
|
||||||
|
ports:
|
||||||
|
- "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:
|
||||||
|
- SPRING_PROFILES_ACTIVE=prod
|
||||||
|
- TZ=Asia/Seoul
|
||||||
|
volumes:
|
||||||
|
- /data:/kamco-nfs
|
||||||
|
networks:
|
||||||
|
- kamco-cds
|
||||||
|
restart: unless-stopped
|
||||||
|
healthcheck:
|
||||||
|
test: [ "CMD", "curl", "-f", "http://localhost:8080/monitor/health" ]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
start_period: 40s
|
||||||
|
|
||||||
|
networks:
|
||||||
|
kamco-cds:
|
||||||
|
external: true
|
||||||
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;
|
||||||
|
}
|
||||||
@@ -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(
|
||||||
|
|||||||
@@ -146,4 +146,53 @@ public class ChangeDetectionApiController {
|
|||||||
return ApiResponseDto.ok(
|
return ApiResponseDto.ok(
|
||||||
changeDetectionService.getChangeDetectionPointList(type, scale, uuid, mapSheetNum));
|
changeDetectionService.getChangeDetectionPointList(type, scale, uuid, mapSheetNum));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "선택 변화탐지 결과 uuid 조회", description = "선택 변화탐지 결과 uuid 조회")
|
||||||
|
@GetMapping("/selected/uuid")
|
||||||
|
public ApiResponseDto<UUID> getChnDtctIdUuid(
|
||||||
|
@Parameter(description = "회차 32자 uid", example = "98ABAA1FC4394F11885C302C19AE5E81")
|
||||||
|
@RequestParam
|
||||||
|
String chnDtctId) {
|
||||||
|
return ApiResponseDto.ok(changeDetectionService.getLearnUuid(chnDtctId));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "선택 변화탐지 결과 Polygon", description = "선택 변화탐지 결과 Polygon")
|
||||||
|
@GetMapping("/selected/polygon")
|
||||||
|
public ApiResponseDto<ChangeDetectionDto.PolygonFeatureList> getCdPolygonList(
|
||||||
|
@Parameter(description = "회차 32자 uid", example = "98ABAA1FC4394F11885C302C19AE5E81")
|
||||||
|
@RequestParam
|
||||||
|
String chnDtctId,
|
||||||
|
@Parameter(description = "polygon 32자 uid", example = "3B1A7E5F895A4D9698489540EE1BBE1E")
|
||||||
|
@RequestParam
|
||||||
|
String cdObjectId,
|
||||||
|
@Parameter(
|
||||||
|
description = "polygon 32자 uids",
|
||||||
|
example =
|
||||||
|
"3B1A7E5F895A4D9698489540EE1BBE1E,3B221A2AF9614647A0903A972D56C574,3B22686A7ACE44FC9CB20F1B4FA6DEFD,3B376D94A183479BB5FBE3D7166E6E1A")
|
||||||
|
@RequestParam
|
||||||
|
List<String> cdObjectIds,
|
||||||
|
@Parameter(description = "pnu") @RequestParam(required = false) String pnu) {
|
||||||
|
return ApiResponseDto.ok(
|
||||||
|
changeDetectionService.getPolygonListByCd(chnDtctId, cdObjectId, cdObjectIds, pnu));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "선택 변화탐지 결과 Point", description = "선택 변화탐지 결과 Point")
|
||||||
|
@GetMapping("/selected/point")
|
||||||
|
public ApiResponseDto<ChangeDetectionDto.PointFeatureList> getCdPointList(
|
||||||
|
@Parameter(description = "회차 32자 uid", example = "98ABAA1FC4394F11885C302C19AE5E81")
|
||||||
|
@RequestParam
|
||||||
|
String chnDtctId,
|
||||||
|
@Parameter(description = "polygon 32자 uid", example = "3B1A7E5F895A4D9698489540EE1BBE1E")
|
||||||
|
@RequestParam
|
||||||
|
String cdObjectId,
|
||||||
|
@Parameter(
|
||||||
|
description = "polygon 32자 uids",
|
||||||
|
example =
|
||||||
|
"3B1A7E5F895A4D9698489540EE1BBE1E,3B221A2AF9614647A0903A972D56C574,3B22686A7ACE44FC9CB20F1B4FA6DEFD,3B376D94A183479BB5FBE3D7166E6E1A")
|
||||||
|
@RequestParam
|
||||||
|
List<String> cdObjectIds,
|
||||||
|
@Parameter(description = "pnu") @RequestParam(required = false) String pnu) {
|
||||||
|
return ApiResponseDto.ok(
|
||||||
|
changeDetectionService.getPointListByCd(chnDtctId, cdObjectId, cdObjectIds, pnu));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -197,6 +197,8 @@ public class ChangeDetectionDto {
|
|||||||
private Double afterConfidence; // 비교 신뢰도(확률)
|
private Double afterConfidence; // 비교 신뢰도(확률)
|
||||||
private String afterClass;
|
private String afterClass;
|
||||||
private Double cdProb; // 탐지정확도
|
private Double cdProb; // 탐지정확도
|
||||||
|
private UUID uuid;
|
||||||
|
private String resultUid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Schema(name = "PointFeature", description = "Geometry 리턴 객체")
|
@Schema(name = "PointFeature", description = "Geometry 리턴 객체")
|
||||||
@@ -250,5 +252,21 @@ public class ChangeDetectionDto {
|
|||||||
private Double afterConfidence; // 비교 신뢰도(확률)
|
private Double afterConfidence; // 비교 신뢰도(확률)
|
||||||
private String afterClass; // 비교 분류
|
private String afterClass; // 비교 분류
|
||||||
private Double cdProb; // 탐지 정확도
|
private Double cdProb; // 탐지 정확도
|
||||||
|
private UUID uuid;
|
||||||
|
private String uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Schema(name = "ChangeDetectionMapDto", description = "변화지도 팝업 검색조건")
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class ChangeDetectionMapDto {
|
||||||
|
private Integer compareYyyy;
|
||||||
|
private Integer targetYyyy;
|
||||||
|
private String cdObjectId;
|
||||||
|
private List<String> cdObjectIds;
|
||||||
|
private String chnDtctId;
|
||||||
|
private String pnu;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,4 +89,42 @@ public class ChangeDetectionService {
|
|||||||
default -> throw new IllegalArgumentException("Unsupported type: " + type);
|
default -> throw new IllegalArgumentException("Unsupported type: " + type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 선택 폴리곤 정보 조회
|
||||||
|
*
|
||||||
|
* @param chnDtctId
|
||||||
|
* @param cdObjectId
|
||||||
|
* @param cdObjectIds
|
||||||
|
* @param pnu
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public ChangeDetectionDto.PolygonFeatureList getPolygonListByCd(
|
||||||
|
String chnDtctId, String cdObjectId, List<String> cdObjectIds, String pnu) {
|
||||||
|
return changeDetectionCoreService.getPolygonListByCd(chnDtctId, cdObjectId, cdObjectIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 선택 Point 조회
|
||||||
|
*
|
||||||
|
* @param chnDtctId
|
||||||
|
* @param cdObjectId
|
||||||
|
* @param cdObjectIds
|
||||||
|
* @param pnu
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public ChangeDetectionDto.PointFeatureList getPointListByCd(
|
||||||
|
String chnDtctId, String cdObjectId, List<String> cdObjectIds, String pnu) {
|
||||||
|
return changeDetectionCoreService.getPointListByCd(chnDtctId, cdObjectId, cdObjectIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Learn uuid 조회
|
||||||
|
*
|
||||||
|
* @param chnDtctId
|
||||||
|
* @return uuid
|
||||||
|
*/
|
||||||
|
public UUID getLearnUuid(String chnDtctId) {
|
||||||
|
return changeDetectionCoreService.getLearnUuid(chnDtctId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.kamco.cd.kamcoback.common.download;
|
||||||
|
|
||||||
|
import org.springframework.util.AntPathMatcher;
|
||||||
|
|
||||||
|
public final class DownloadPaths {
|
||||||
|
private DownloadPaths() {}
|
||||||
|
|
||||||
|
public static final String[] PATTERNS = {
|
||||||
|
"/api/inference/download/**", "/api/training-data/stage/download/**"
|
||||||
|
};
|
||||||
|
|
||||||
|
public static boolean matches(String uri) {
|
||||||
|
AntPathMatcher m = new AntPathMatcher();
|
||||||
|
for (String p : PATTERNS) {
|
||||||
|
if (m.match(p, uri)) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
package com.kamco.cd.kamcoback.common.download;
|
||||||
|
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.core.io.FileSystemResource;
|
||||||
|
import org.springframework.core.io.Resource;
|
||||||
|
import org.springframework.core.io.support.ResourceRegion;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.http.HttpRange;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class RangeDownloadResponder {
|
||||||
|
|
||||||
|
public ResponseEntity<?> buildZipResponse(
|
||||||
|
Path filePath, String downloadFileName, HttpServletRequest request) throws IOException {
|
||||||
|
|
||||||
|
if (!Files.isRegularFile(filePath)) {
|
||||||
|
return ResponseEntity.notFound().build();
|
||||||
|
}
|
||||||
|
|
||||||
|
long totalSize = Files.size(filePath);
|
||||||
|
Resource resource = new FileSystemResource(filePath);
|
||||||
|
|
||||||
|
String disposition = "attachment; filename=\"" + downloadFileName + "\"";
|
||||||
|
String rangeHeader = request.getHeader(HttpHeaders.RANGE);
|
||||||
|
|
||||||
|
// 🔥 공통 헤더 (여기 고정)
|
||||||
|
ResponseEntity.BodyBuilder base =
|
||||||
|
ResponseEntity.ok()
|
||||||
|
.contentType(MediaType.APPLICATION_OCTET_STREAM)
|
||||||
|
.header(HttpHeaders.CONTENT_DISPOSITION, disposition)
|
||||||
|
.header(HttpHeaders.ACCEPT_RANGES, "bytes")
|
||||||
|
.header("X-Accel-Buffering", "no");
|
||||||
|
|
||||||
|
if (rangeHeader == null || rangeHeader.isBlank()) {
|
||||||
|
return base.contentLength(totalSize).body(resource);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<HttpRange> ranges;
|
||||||
|
try {
|
||||||
|
ranges = HttpRange.parseRanges(rangeHeader);
|
||||||
|
} catch (IllegalArgumentException ex) {
|
||||||
|
return ResponseEntity.status(416)
|
||||||
|
.header(HttpHeaders.CONTENT_RANGE, "bytes */" + totalSize)
|
||||||
|
.header("X-Accel-Buffering", "no")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRange range = ranges.get(0);
|
||||||
|
|
||||||
|
long start = range.getRangeStart(totalSize);
|
||||||
|
long end = range.getRangeEnd(totalSize);
|
||||||
|
|
||||||
|
if (start >= totalSize) {
|
||||||
|
return ResponseEntity.status(416)
|
||||||
|
.header(HttpHeaders.CONTENT_RANGE, "bytes */" + totalSize)
|
||||||
|
.header("X-Accel-Buffering", "no")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
long regionLength = end - start + 1;
|
||||||
|
ResourceRegion region = new ResourceRegion(resource, start, regionLength);
|
||||||
|
|
||||||
|
return ResponseEntity.status(206)
|
||||||
|
.contentType(MediaType.APPLICATION_OCTET_STREAM)
|
||||||
|
.header(HttpHeaders.CONTENT_DISPOSITION, disposition)
|
||||||
|
.header(HttpHeaders.ACCEPT_RANGES, "bytes")
|
||||||
|
.header("X-Accel-Buffering", "no")
|
||||||
|
.header(HttpHeaders.CONTENT_RANGE, "bytes " + start + "-" + end + "/" + totalSize)
|
||||||
|
.contentLength(regionLength)
|
||||||
|
.body(region);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.kamco.cd.kamcoback.common.download.dto;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public record DownloadAuditEvent(
|
||||||
|
Long userId,
|
||||||
|
String requestUri,
|
||||||
|
String normalizedUri,
|
||||||
|
String ip,
|
||||||
|
int status,
|
||||||
|
UUID downloadUuid) {}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.kamco.cd.kamcoback.common.enums;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.common.utils.enums.CodeExpose;
|
||||||
|
import com.kamco.cd.kamcoback.common.utils.enums.EnumType;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@CodeExpose
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum CrsType implements EnumType {
|
||||||
|
EPSG_3857("Web Mercator, 웹지도 미터(EPSG:900913 동일)"),
|
||||||
|
EPSG_4326("WGS84 위경도, GeoJSON/OSM 기본"),
|
||||||
|
EPSG_5186("Korea 2000 중부 TM, 한국 SHP");
|
||||||
|
|
||||||
|
private final String desc;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getId() {
|
||||||
|
return name();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getText() {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -27,4 +27,10 @@ public class CustomApiException extends RuntimeException {
|
|||||||
this.codeName = errorCode.getCode();
|
this.codeName = errorCode.getCode();
|
||||||
this.status = errorCode.getStatus();
|
this.status = errorCode.getStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CustomApiException(String codeName, HttpStatus status, Throwable cause) {
|
||||||
|
super(codeName, cause);
|
||||||
|
this.codeName = codeName;
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,11 +7,14 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Log4j2
|
@Log4j2
|
||||||
@Component
|
@Component
|
||||||
public class ExternalJarRunner {
|
public class ExternalJarRunner {
|
||||||
|
@Value("${spring.profiles.active}")
|
||||||
|
private String profile;
|
||||||
|
|
||||||
private static final long TIMEOUT_MINUTES = TimeUnit.DAYS.toMinutes(3);
|
private static final long TIMEOUT_MINUTES = TimeUnit.DAYS.toMinutes(3);
|
||||||
|
|
||||||
@@ -40,7 +43,7 @@ public class ExternalJarRunner {
|
|||||||
if (mode != null && !mode.isEmpty()) {
|
if (mode != null && !mode.isEmpty()) {
|
||||||
addArg(args, "converter.mode", mode);
|
addArg(args, "converter.mode", mode);
|
||||||
}
|
}
|
||||||
|
addArg(args, "spring.profiles.active", profile);
|
||||||
execJar(jarPath, args);
|
execJar(jarPath, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,6 +60,7 @@ public class ExternalJarRunner {
|
|||||||
addArg(args, "upload-shp", register);
|
addArg(args, "upload-shp", register);
|
||||||
// addArg(args, "layer", layer);
|
// addArg(args, "layer", layer);
|
||||||
|
|
||||||
|
addArg(args, "spring.profiles.active", profile);
|
||||||
execJar(jarPath, args);
|
execJar(jarPath, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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,11 +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 isValid =
|
// 이것이 필요한건가?
|
||||||
!NameValidator.containsKorean(folderNm)
|
// boolean isShowHide =
|
||||||
&& !NameValidator.containsWhitespaceRegex(folderNm)
|
// !parentFolderNm.equals("kamco-nfs"); // 폴더 리스트에
|
||||||
&& !parentFolderNm.equals("kamco-nfs");
|
// kamco-nfs 하위만 나오도록 처리
|
||||||
|
boolean isShowHide =
|
||||||
|
!parentFolderNm.equals(nfsRootDir); // 폴더 리스트에 nfsRootDir 하위만 나오도록 처리
|
||||||
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);
|
||||||
@@ -317,7 +328,7 @@ public class FIleChecker {
|
|||||||
depth,
|
depth,
|
||||||
childCnt,
|
childCnt,
|
||||||
lastModified,
|
lastModified,
|
||||||
isValid);
|
isShowHide);
|
||||||
})
|
})
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
@@ -352,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) {
|
||||||
@@ -383,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()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,92 +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.auth.CustomUserDetails;
|
import com.kamco.cd.kamcoback.common.utils.UserUtil;
|
||||||
import com.kamco.cd.kamcoback.common.utils.HeaderUtil;
|
|
||||||
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.security.authentication.UsernamePasswordAuthenticationToken;
|
|
||||||
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;
|
||||||
|
|
||||||
@Autowired private ObjectMapper objectMapper;
|
|
||||||
|
|
||||||
public FileDownloadInteceptor(AuditLogRepository auditLogRepository, MenuService menuService) {
|
|
||||||
this.auditLogRepository = auditLogRepository;
|
|
||||||
this.menuService = menuService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterCompletion(
|
public void afterCompletion(
|
||||||
HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
|
HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
|
||||||
|
|
||||||
// 파일 다운로드 API만 필터링
|
String uri = request.getRequestURI();
|
||||||
if (!request.getRequestURI().contains("/download")) {
|
if (uri == null || !uri.contains("/download")) return;
|
||||||
|
if (request.getDispatcherType() != DispatcherType.REQUEST) return;
|
||||||
|
|
||||||
|
Long userId;
|
||||||
|
try {
|
||||||
|
userId = userUtil.getId();
|
||||||
|
if (userId == null) return; // userId null 불가면 스킵
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("Download audit userId resolve failed. uri={}, err={}", uri, e.toString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Long userId = extractUserId(request);
|
|
||||||
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 =
|
|
||||||
AuditLogEntity.forFileDownload(
|
|
||||||
userId,
|
|
||||||
request.getRequestURI(),
|
|
||||||
Objects.requireNonNull(basic).getMenuUid(),
|
|
||||||
ip,
|
|
||||||
response.getStatus(),
|
|
||||||
UUID.fromString(HeaderUtil.get(request, "kamco-download-uuid")));
|
|
||||||
|
|
||||||
auditLogRepository.save(log);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Long extractUserId(HttpServletRequest request) {
|
private UUID extractUuidFromUri(String uri) {
|
||||||
if (request.getUserPrincipal() instanceof UsernamePasswordAuthenticationToken auth
|
try {
|
||||||
&& auth.getPrincipal() instanceof CustomUserDetails userDetails) {
|
String[] parts = uri.split("/");
|
||||||
return userDetails.getMember().getId();
|
String last = parts[parts.length - 1];
|
||||||
|
return UUID.fromString(last);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.kamco.cd.kamcoback.config;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Component
|
||||||
|
@ConfigurationProperties(prefix = "file")
|
||||||
|
public class FileProperties {
|
||||||
|
|
||||||
|
private String root;
|
||||||
|
private String nfs;
|
||||||
|
private String syncRootDir;
|
||||||
|
private String syncTmpDir;
|
||||||
|
private String syncFileExtention;
|
||||||
|
private String datasetDir;
|
||||||
|
private String datasetTmpDir;
|
||||||
|
private String modelDir;
|
||||||
|
private String modelTmpDir;
|
||||||
|
private String modelFileExtention;
|
||||||
|
private String ptPath;
|
||||||
|
private String datasetResponse;
|
||||||
|
private TrainingData trainingData;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public static class TrainingData {
|
||||||
|
private String geojsonDir;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.kamco.cd.kamcoback.config;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Component
|
||||||
|
@ConfigurationProperties(prefix = "inference")
|
||||||
|
public class InferenceProperties {
|
||||||
|
|
||||||
|
private String nfs;
|
||||||
|
private String url;
|
||||||
|
private String batchUrl;
|
||||||
|
private String geojsonDir;
|
||||||
|
private String jarPath;
|
||||||
|
private String inferenceServerName;
|
||||||
|
}
|
||||||
@@ -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("개발 서버"));
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package com.kamco.cd.kamcoback.config;
|
|||||||
import com.kamco.cd.kamcoback.auth.CustomAuthenticationProvider;
|
import com.kamco.cd.kamcoback.auth.CustomAuthenticationProvider;
|
||||||
import com.kamco.cd.kamcoback.auth.JwtAuthenticationFilter;
|
import com.kamco.cd.kamcoback.auth.JwtAuthenticationFilter;
|
||||||
import com.kamco.cd.kamcoback.auth.MenuAuthorizationManager;
|
import com.kamco.cd.kamcoback.auth.MenuAuthorizationManager;
|
||||||
|
import com.kamco.cd.kamcoback.common.download.DownloadPaths;
|
||||||
|
import jakarta.servlet.DispatcherType;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
@@ -44,9 +46,11 @@ public class SecurityConfig {
|
|||||||
.authorizeHttpRequests(
|
.authorizeHttpRequests(
|
||||||
auth ->
|
auth ->
|
||||||
auth
|
auth
|
||||||
|
|
||||||
// .requestMatchers("/chunk_upload_test.html").authenticated()
|
// .requestMatchers("/chunk_upload_test.html").authenticated()
|
||||||
.requestMatchers("/monitor/health", "/monitor/health/**")
|
.requestMatchers("/monitor/health", "/monitor/health/**")
|
||||||
.permitAll()
|
.permitAll()
|
||||||
|
|
||||||
// 맵시트 영역 전체 허용 (우선순위 최상단)
|
// 맵시트 영역 전체 허용 (우선순위 최상단)
|
||||||
.requestMatchers("/api/mapsheet/**")
|
.requestMatchers("/api/mapsheet/**")
|
||||||
.permitAll()
|
.permitAll()
|
||||||
@@ -67,45 +71,56 @@ public class SecurityConfig {
|
|||||||
.requestMatchers("/api/test/review")
|
.requestMatchers("/api/test/review")
|
||||||
.hasAnyRole("ADMIN", "REVIEWER")
|
.hasAnyRole("ADMIN", "REVIEWER")
|
||||||
|
|
||||||
|
// ASYNC/ERROR 재디스패치는 막지 않기 (다운로드/스트리밍에서 필수)
|
||||||
|
.dispatcherTypeMatchers(DispatcherType.ASYNC, DispatcherType.ERROR)
|
||||||
|
.permitAll()
|
||||||
|
|
||||||
|
// 다운로드는 인증 필요
|
||||||
|
.requestMatchers(HttpMethod.GET, DownloadPaths.PATTERNS)
|
||||||
|
.authenticated()
|
||||||
|
|
||||||
// 메뉴 등록 ADMIN만 가능
|
// 메뉴 등록 ADMIN만 가능
|
||||||
.requestMatchers(HttpMethod.POST, "/api/menu/auth")
|
.requestMatchers(HttpMethod.POST, "/api/menu/auth")
|
||||||
.hasAnyRole("ADMIN")
|
.hasAnyRole("ADMIN")
|
||||||
|
|
||||||
|
// 에러 경로는 항상 허용 (이미 있지만 유지)
|
||||||
.requestMatchers("/error")
|
.requestMatchers("/error")
|
||||||
.permitAll()
|
.permitAll()
|
||||||
|
|
||||||
|
// preflight 허용
|
||||||
.requestMatchers(HttpMethod.OPTIONS, "/**")
|
.requestMatchers(HttpMethod.OPTIONS, "/**")
|
||||||
.permitAll() // preflight 허용
|
.permitAll()
|
||||||
.requestMatchers(
|
.requestMatchers(
|
||||||
"/api/auth/signin",
|
"/api/auth/signin",
|
||||||
"/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",
|
||||||
"/api/change-detection/**",
|
"/api/change-detection/**",
|
||||||
"/api/layer/map/**")
|
"/api/layer/map/**",
|
||||||
|
"/api/layer/tile-url",
|
||||||
|
"/api/layer/tile-url-year",
|
||||||
|
"/api/common-code/clazz",
|
||||||
|
"/api/inference/download/**")
|
||||||
.permitAll()
|
.permitAll()
|
||||||
// 로그인한 사용자만 가능 IAM
|
// 로그인한 사용자만 가능 IAM
|
||||||
.requestMatchers(
|
.requestMatchers(
|
||||||
"/api/user/**",
|
"/api/user/**",
|
||||||
"/api/my/menus",
|
"/api/my/menus",
|
||||||
"/api/common-code/**",
|
"/api/members/*/password",
|
||||||
"/api/training-data/label/**",
|
"/api/training-data/label/**",
|
||||||
"/api/training-data/review/**")
|
"/api/training-data/review/**")
|
||||||
.authenticated()
|
.authenticated()
|
||||||
.anyRequest()
|
|
||||||
.access(menuAuthorizationManager)
|
|
||||||
|
|
||||||
// .authenticated()
|
// 나머지는 메뉴권한
|
||||||
)
|
.anyRequest()
|
||||||
.addFilterBefore(
|
.access(menuAuthorizationManager))
|
||||||
jwtAuthenticationFilter,
|
.addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class);
|
||||||
UsernamePasswordAuthenticationFilter
|
|
||||||
.class) // 요청 들어오면 먼저 JWT 토큰 검사 후 security context 에 사용자 정보 저장.
|
|
||||||
;
|
|
||||||
|
|
||||||
return http.build();
|
return http.build();
|
||||||
}
|
}
|
||||||
@@ -116,23 +131,18 @@ public class SecurityConfig {
|
|||||||
return configuration.getAuthenticationManager();
|
return configuration.getAuthenticationManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** CORS 설정 */
|
||||||
* CORS 설정
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Bean
|
@Bean
|
||||||
public CorsConfigurationSource corsConfigurationSource() {
|
public CorsConfigurationSource corsConfigurationSource() {
|
||||||
CorsConfiguration config = new CorsConfiguration(); // CORS 객체 생성
|
CorsConfiguration config = new CorsConfiguration();
|
||||||
config.setAllowedOriginPatterns(List.of("*")); // 도메인 허용
|
config.setAllowedOriginPatterns(List.of("*"));
|
||||||
config.setAllowedMethods(List.of("GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"));
|
config.setAllowedMethods(List.of("GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"));
|
||||||
config.setAllowedHeaders(List.of("*")); // 헤더요청 Authorization, Content-Type, X-Custom-Header
|
config.setAllowedHeaders(List.of("*"));
|
||||||
config.setAllowCredentials(true); // 쿠키, Authorization 헤더, Bearer Token 등 자격증명 포함 요청을 허용할지 설정
|
config.setAllowCredentials(true);
|
||||||
config.setExposedHeaders(List.of("Content-Disposition"));
|
config.setExposedHeaders(List.of("Content-Disposition"));
|
||||||
|
|
||||||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||||
/** "/**" → 모든 API 경로에 대해 이 CORS 규칙을 적용 /api/** 같이 특정 경로만 지정 가능. */
|
source.registerCorsConfiguration("/**", config);
|
||||||
source.registerCorsConfiguration("/**", config); // CORS 정책을 등록
|
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ public class StartupLogger {
|
|||||||
|
|
||||||
private final Environment environment;
|
private final Environment environment;
|
||||||
private final DataSource dataSource;
|
private final DataSource dataSource;
|
||||||
|
private final FileProperties fileProperties;
|
||||||
|
private final InferenceProperties inferenceProperties;
|
||||||
|
|
||||||
@EventListener(ApplicationReadyEvent.class)
|
@EventListener(ApplicationReadyEvent.class)
|
||||||
public void logStartupInfo() {
|
public void logStartupInfo() {
|
||||||
@@ -79,6 +81,25 @@ public class StartupLogger {
|
|||||||
│ DDL Auto : %s
|
│ DDL Auto : %s
|
||||||
│ JDBC Batch Size : %s
|
│ JDBC Batch Size : %s
|
||||||
│ Fetch Batch Size : %s
|
│ Fetch Batch Size : %s
|
||||||
|
╠════════════════════════════════════════════════════════════════════════════════╣
|
||||||
|
║ FILE CONFIGURATION ║
|
||||||
|
╠────────────────────────────────────────────────────────────────────────────────╣
|
||||||
|
│ Root Directory : %s
|
||||||
|
│ NFS Mount Path : %s
|
||||||
|
│ Sync Root Dir : %s
|
||||||
|
│ Sync Tmp Dir : %s
|
||||||
|
│ Dataset Dir : %s
|
||||||
|
│ Model Dir : %s
|
||||||
|
│ PT Path : %s
|
||||||
|
╠════════════════════════════════════════════════════════════════════════════════╣
|
||||||
|
║ INFERENCE CONFIGURATION ║
|
||||||
|
╠────────────────────────────────────────────────────────────────────────────────╣
|
||||||
|
│ NFS Mount Path : %s
|
||||||
|
│ Inference URL : %s
|
||||||
|
│ Batch URL : %s
|
||||||
|
│ GeoJSON Dir : %s
|
||||||
|
│ JAR Path : %s
|
||||||
|
│ Server Names : %s
|
||||||
╚════════════════════════════════════════════════════════════════════════════════╝
|
╚════════════════════════════════════════════════════════════════════════════════╝
|
||||||
""",
|
""",
|
||||||
profileInfo,
|
profileInfo,
|
||||||
@@ -89,7 +110,24 @@ public class StartupLogger {
|
|||||||
showSql,
|
showSql,
|
||||||
ddlAuto,
|
ddlAuto,
|
||||||
batchSize,
|
batchSize,
|
||||||
batchFetchSize);
|
batchFetchSize,
|
||||||
|
fileProperties.getRoot() != null ? fileProperties.getRoot() : "N/A",
|
||||||
|
fileProperties.getNfs() != null ? fileProperties.getNfs() : "N/A",
|
||||||
|
fileProperties.getSyncRootDir() != null ? fileProperties.getSyncRootDir() : "N/A",
|
||||||
|
fileProperties.getSyncTmpDir() != null ? fileProperties.getSyncTmpDir() : "N/A",
|
||||||
|
fileProperties.getDatasetDir() != null ? fileProperties.getDatasetDir() : "N/A",
|
||||||
|
fileProperties.getModelDir() != null ? fileProperties.getModelDir() : "N/A",
|
||||||
|
fileProperties.getPtPath() != null ? fileProperties.getPtPath() : "N/A",
|
||||||
|
inferenceProperties.getNfs() != null ? inferenceProperties.getNfs() : "N/A",
|
||||||
|
inferenceProperties.getUrl() != null ? inferenceProperties.getUrl() : "N/A",
|
||||||
|
inferenceProperties.getBatchUrl() != null ? inferenceProperties.getBatchUrl() : "N/A",
|
||||||
|
inferenceProperties.getGeojsonDir() != null
|
||||||
|
? inferenceProperties.getGeojsonDir()
|
||||||
|
: "N/A",
|
||||||
|
inferenceProperties.getJarPath() != null ? inferenceProperties.getJarPath() : "N/A",
|
||||||
|
inferenceProperties.getInferenceServerName() != null
|
||||||
|
? inferenceProperties.getInferenceServerName()
|
||||||
|
: "N/A");
|
||||||
|
|
||||||
log.info(startupMessage);
|
log.info(startupMessage);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.kamco.cd.kamcoback.config;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||||
|
import com.kamco.cd.kamcoback.common.download.DownloadPaths;
|
||||||
import com.kamco.cd.kamcoback.common.utils.geometry.GeometryDeserializer;
|
import com.kamco.cd.kamcoback.common.utils.geometry.GeometryDeserializer;
|
||||||
import com.kamco.cd.kamcoback.common.utils.geometry.GeometrySerializer;
|
import com.kamco.cd.kamcoback.common.utils.geometry.GeometrySerializer;
|
||||||
import org.locationtech.jts.geom.Geometry;
|
import org.locationtech.jts.geom.Geometry;
|
||||||
@@ -39,9 +40,6 @@ public class WebConfig implements WebMvcConfigurer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInterceptors(InterceptorRegistry registry) {
|
public void addInterceptors(InterceptorRegistry registry) {
|
||||||
registry
|
registry.addInterceptor(fileDownloadInteceptor).addPathPatterns(DownloadPaths.PATTERNS);
|
||||||
.addInterceptor(fileDownloadInteceptor)
|
|
||||||
.addPathPatterns("/api/inference/download/**") // 추론 파일 다운로드
|
|
||||||
.addPathPatterns("/api/training-data/stage/download/**"); // 학습데이터 다운로드
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.kamco.cd.kamcoback.config.api;
|
package com.kamco.cd.kamcoback.config.api;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.common.download.DownloadPaths;
|
||||||
import jakarta.servlet.FilterChain;
|
import jakarta.servlet.FilterChain;
|
||||||
import jakarta.servlet.ServletException;
|
import jakarta.servlet.ServletException;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
@@ -16,6 +17,14 @@ public class ApiLogFilter extends OncePerRequestFilter {
|
|||||||
protected void doFilterInternal(
|
protected void doFilterInternal(
|
||||||
HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
|
HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
|
||||||
throws ServletException, IOException {
|
throws ServletException, IOException {
|
||||||
|
|
||||||
|
String uri = request.getRequestURI();
|
||||||
|
|
||||||
|
if (DownloadPaths.matches(uri)) {
|
||||||
|
filterChain.doFilter(request, response);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ContentCachingRequestWrapper wrappedRequest = new ContentCachingRequestWrapper(request);
|
ContentCachingRequestWrapper wrappedRequest = new ContentCachingRequestWrapper(request);
|
||||||
|
|
||||||
ContentCachingResponseWrapper wrappedResponse = new ContentCachingResponseWrapper(response);
|
ContentCachingResponseWrapper wrappedResponse = new ContentCachingResponseWrapper(response);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.kamco.cd.kamcoback.config;
|
package com.kamco.cd.kamcoback.config.swagger;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.enums.SecuritySchemeType;
|
import io.swagger.v3.oas.annotations.enums.SecuritySchemeType;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityScheme;
|
import io.swagger.v3.oas.annotations.security.SecurityScheme;
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
package com.kamco.cd.kamcoback.config.swagger;
|
||||||
|
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import org.springdoc.core.properties.SwaggerUiConfigProperties;
|
||||||
|
import org.springdoc.core.properties.SwaggerUiOAuthProperties;
|
||||||
|
import org.springdoc.core.providers.ObjectMapperProvider;
|
||||||
|
import org.springdoc.webmvc.ui.SwaggerIndexPageTransformer;
|
||||||
|
import org.springdoc.webmvc.ui.SwaggerIndexTransformer;
|
||||||
|
import org.springdoc.webmvc.ui.SwaggerWelcomeCommon;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.Primary;
|
||||||
|
import org.springframework.context.annotation.Profile;
|
||||||
|
import org.springframework.core.io.Resource;
|
||||||
|
import org.springframework.web.servlet.resource.ResourceTransformerChain;
|
||||||
|
import org.springframework.web.servlet.resource.TransformedResource;
|
||||||
|
|
||||||
|
@Profile({"local", "dev"})
|
||||||
|
@Configuration
|
||||||
|
public class SwaggerUiAutoAuthConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@Primary
|
||||||
|
public SwaggerIndexTransformer swaggerIndexTransformer(
|
||||||
|
SwaggerUiConfigProperties swaggerUiConfigProperties,
|
||||||
|
SwaggerUiOAuthProperties swaggerUiOAuthProperties,
|
||||||
|
SwaggerWelcomeCommon swaggerWelcomeCommon,
|
||||||
|
ObjectMapperProvider objectMapperProvider) {
|
||||||
|
|
||||||
|
SwaggerIndexPageTransformer delegate =
|
||||||
|
new SwaggerIndexPageTransformer(
|
||||||
|
swaggerUiConfigProperties,
|
||||||
|
swaggerUiOAuthProperties,
|
||||||
|
swaggerWelcomeCommon,
|
||||||
|
objectMapperProvider);
|
||||||
|
|
||||||
|
return new SwaggerIndexTransformer() {
|
||||||
|
private static final String TOKEN_KEY = "SWAGGER_ACCESS_TOKEN";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Resource transform(
|
||||||
|
HttpServletRequest request, Resource resource, ResourceTransformerChain chain) {
|
||||||
|
try {
|
||||||
|
// 1) springdoc 기본 변환 먼저 적용
|
||||||
|
Resource transformed = delegate.transform(request, resource, chain);
|
||||||
|
|
||||||
|
String html =
|
||||||
|
new String(transformed.getInputStream().readAllBytes(), StandardCharsets.UTF_8);
|
||||||
|
|
||||||
|
String loginPathContains = "/api/auth/signin";
|
||||||
|
|
||||||
|
String inject =
|
||||||
|
"""
|
||||||
|
tagsSorter: (a, b) => {
|
||||||
|
const TOP = '인증(Auth)';
|
||||||
|
if (a === TOP && b !== TOP) return -1;
|
||||||
|
if (b === TOP && a !== TOP) return 1;
|
||||||
|
return a.localeCompare(b);
|
||||||
|
},
|
||||||
|
requestInterceptor: (req) => {
|
||||||
|
const token = localStorage.getItem('%s');
|
||||||
|
if (token) {
|
||||||
|
req.headers = req.headers || {};
|
||||||
|
req.headers['Authorization'] = 'Bearer ' + token;
|
||||||
|
}
|
||||||
|
return req;
|
||||||
|
},
|
||||||
|
responseInterceptor: async (res) => {
|
||||||
|
try {
|
||||||
|
const isLogin = (res?.url?.includes('%s') && res?.status === 200);
|
||||||
|
if (isLogin) {
|
||||||
|
const text = (typeof res.data === 'string') ? res.data : JSON.stringify(res.data);
|
||||||
|
const json = JSON.parse(text);
|
||||||
|
const token = json?.data?.accessToken;
|
||||||
|
|
||||||
|
if (token) {
|
||||||
|
localStorage.setItem('%s', token);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
return res;
|
||||||
|
},
|
||||||
|
"""
|
||||||
|
.formatted(TOKEN_KEY, loginPathContains, TOKEN_KEY);
|
||||||
|
|
||||||
|
html = html.replace("SwaggerUIBundle({", "SwaggerUIBundle({\n" + inject);
|
||||||
|
|
||||||
|
return new TransformedResource(transformed, html.getBytes(StandardCharsets.UTF_8));
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 실패 시 원본 반환(문서 깨짐 방지)
|
||||||
|
return resource;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,7 +7,6 @@ import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto;
|
|||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ChnDetectMastReqDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ChnDetectMastReqDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ChngDetectMastSearchDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ChngDetectMastSearchDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LabelSendDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LabelSendDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ResReturn;
|
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.DetectMastDto.Basic;
|
import com.kamco.cd.kamcoback.gukyuin.dto.DetectMastDto.Basic;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.DetectMastDto.DetectMastReq;
|
import com.kamco.cd.kamcoback.gukyuin.dto.DetectMastDto.DetectMastReq;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GukYuinLinkableRes;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GukYuinLinkableRes;
|
||||||
@@ -74,7 +73,7 @@ public class GukYuinApiController {
|
|||||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
})
|
})
|
||||||
@PostMapping("/chn/mast/remove")
|
@PostMapping("/chn/mast/remove")
|
||||||
public ApiResponseDto<ResReturn> remove(
|
public ApiResponseDto<ChngDetectMastDto.RemoveResDto> remove(
|
||||||
@RequestBody @Valid ChngDetectMastDto.ChnDetectMastReqDto chnDetectMastReq) {
|
@RequestBody @Valid ChngDetectMastDto.ChnDetectMastReqDto chnDetectMastReq) {
|
||||||
return ApiResponseDto.ok(gukYuinApiService.remove(chnDetectMastReq));
|
return ApiResponseDto.ok(gukYuinApiService.remove(chnDetectMastReq));
|
||||||
}
|
}
|
||||||
@@ -120,7 +119,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 = "탐지결과 등록목록 조회")
|
||||||
@@ -184,7 +183,30 @@ 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건 조회)")
|
||||||
|
@GetMapping("/chn/cont/{chnDtctId}/objt/{chnDtctObjtId}")
|
||||||
|
@ApiResponses(
|
||||||
|
value = {
|
||||||
|
@ApiResponse(
|
||||||
|
responseCode = "200",
|
||||||
|
description = "목록 성공",
|
||||||
|
content =
|
||||||
|
@Content(
|
||||||
|
mediaType = "application/json",
|
||||||
|
schema = @Schema(implementation = Basic.class))),
|
||||||
|
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||||
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
|
})
|
||||||
|
public ApiResponseDto<ChngDetectContDto.ResultContDto> findChnPnuToContObject(
|
||||||
|
@PathVariable String chnDtctId,
|
||||||
|
@PathVariable String chnDtctObjtId,
|
||||||
|
@RequestParam(defaultValue = "0") Integer pageIndex,
|
||||||
|
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||||
|
return ApiResponseDto.ok(
|
||||||
|
gukYuinApiService.findChnPnuToContObject(chnDtctId, chnDtctObjtId, pageIndex, pageSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "탐지객체 조회 (PNU에 해당하는 탐지객체)", description = "탐지객체 조회 (PNU에 해당하는 탐지객체)")
|
@Operation(summary = "탐지객체 조회 (PNU에 해당하는 탐지객체)", description = "탐지객체 조회 (PNU에 해당하는 탐지객체)")
|
||||||
@@ -239,9 +261,10 @@ public class GukYuinApiController {
|
|||||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
})
|
})
|
||||||
@PostMapping("/rlb/objt/{chnDtctObjtId}/lbl/{lblYn}")
|
@PostMapping("/rlb/objt/{chnDtctObjtId}/lbl/{lblYn}")
|
||||||
public ApiResponseDto<ResReturn> updateChnDtctObjtLabelingYn(
|
public ApiResponseDto<ChngDetectContDto.ResultLabelDto> updateChnDtctObjtLabelingYn(
|
||||||
@PathVariable String chnDtctObjtId, @PathVariable String lblYn) {
|
@PathVariable String chnDtctObjtId, @PathVariable String lblYn) {
|
||||||
return ApiResponseDto.ok(gukYuinApiService.updateChnDtctObjtLabelingYn(chnDtctObjtId, lblYn));
|
return ApiResponseDto.ok(
|
||||||
|
gukYuinApiService.updateChnDtctObjtLabelingYn(chnDtctObjtId, lblYn, ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "국유in연동 등록", description = "국유in연동 등록")
|
@Operation(summary = "국유in연동 등록", description = "국유in연동 등록")
|
||||||
@@ -250,7 +273,7 @@ public class GukYuinApiController {
|
|||||||
@Parameter(description = "uuid", example = "7a593d0e-76a8-4b50-8978-9af1fbe871af")
|
@Parameter(description = "uuid", example = "7a593d0e-76a8-4b50-8978-9af1fbe871af")
|
||||||
@PathVariable
|
@PathVariable
|
||||||
UUID uuid) {
|
UUID uuid) {
|
||||||
return ApiResponseDto.ok(gukYuinApiService.connectChnMastRegist(uuid));
|
return ApiResponseDto.okObject(gukYuinApiService.connectChnMastRegist(uuid));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "라벨 전송 완료 리스트", description = "라벨 전송 완료 리스트")
|
@Operation(summary = "라벨 전송 완료 리스트", description = "라벨 전송 완료 리스트")
|
||||||
@@ -259,4 +282,44 @@ public class GukYuinApiController {
|
|||||||
@Parameter(description = "어제 날짜", example = "2026-01-29") LocalDate yesterday) {
|
@Parameter(description = "어제 날짜", example = "2026-01-29") LocalDate yesterday) {
|
||||||
return ApiResponseDto.ok(gukYuinApiService.findLabelingCompleteSendList(yesterday));
|
return ApiResponseDto.ok(gukYuinApiService.findLabelingCompleteSendList(yesterday));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "탐지객체 적합여부 조회 (리스트조회)", description = "탐지객체 적합여부 조회 (리스트조회)")
|
||||||
|
@GetMapping("/rlb/dtct/{chnDtctId}")
|
||||||
|
@ApiResponses(
|
||||||
|
value = {
|
||||||
|
@ApiResponse(
|
||||||
|
responseCode = "200",
|
||||||
|
description = "목록 성공",
|
||||||
|
content =
|
||||||
|
@Content(
|
||||||
|
mediaType = "application/json",
|
||||||
|
schema = @Schema(implementation = Basic.class))),
|
||||||
|
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||||
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
|
})
|
||||||
|
public ApiResponseDto<ChngDetectMastDto.RlbDtctDto> findRlbDtctList(
|
||||||
|
@PathVariable String chnDtctId,
|
||||||
|
@Parameter(description = "날짜(기본은 어제 날짜)") @RequestParam(defaultValue = "20260205")
|
||||||
|
String yyyymmdd) {
|
||||||
|
return ApiResponseDto.ok(gukYuinApiService.findRlbDtctList(chnDtctId, yyyymmdd, ""));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "탐지객체 적합여부 조회 (객체별 조회)", description = "탐지객체 적합여부 조회 (객체별 조회)")
|
||||||
|
@GetMapping("/rlb/objt/{chnDtctObjtId}")
|
||||||
|
@ApiResponses(
|
||||||
|
value = {
|
||||||
|
@ApiResponse(
|
||||||
|
responseCode = "200",
|
||||||
|
description = "목록 성공",
|
||||||
|
content =
|
||||||
|
@Content(
|
||||||
|
mediaType = "application/json",
|
||||||
|
schema = @Schema(implementation = Basic.class))),
|
||||||
|
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||||
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
|
})
|
||||||
|
public ApiResponseDto<ChngDetectMastDto.RlbDtctDto> findRlbDtctObject(
|
||||||
|
@PathVariable String chnDtctObjtId) {
|
||||||
|
return ApiResponseDto.ok(gukYuinApiService.findRlbDtctObject(chnDtctObjtId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,4 +114,38 @@ public class ChngDetectContDto {
|
|||||||
private List<DtoPnuDetectMpng> result;
|
private List<DtoPnuDetectMpng> result;
|
||||||
private Boolean success;
|
private Boolean success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Schema(name = "ResultLabelDto", description = "ResultLabelDto list 리턴 형태")
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class ResultLabelDto {
|
||||||
|
|
||||||
|
private Integer code;
|
||||||
|
private String message;
|
||||||
|
private DtoPnuDetectMpng result;
|
||||||
|
private Boolean success;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class ReqInfo {
|
||||||
|
|
||||||
|
private String reqIp;
|
||||||
|
private String reqEpno;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class StbltResult {
|
||||||
|
|
||||||
|
private String stbltYn;
|
||||||
|
private String incyCd;
|
||||||
|
private String incyCmnt;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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")
|
||||||
@@ -216,4 +216,89 @@ public class ChngDetectMastDto {
|
|||||||
private ZonedDateTime reviewerWorkDttm;
|
private ZonedDateTime reviewerWorkDttm;
|
||||||
private ZonedDateTime labelSendDttm;
|
private ZonedDateTime labelSendDttm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class ErrorResDto {
|
||||||
|
|
||||||
|
private String timestamp;
|
||||||
|
private Integer status;
|
||||||
|
private String error;
|
||||||
|
private String path;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class RlbDtctDto {
|
||||||
|
|
||||||
|
private Integer code;
|
||||||
|
private String message;
|
||||||
|
private List<RlbDtctMastDto> result;
|
||||||
|
private Boolean success;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class RlbDtctMastDto {
|
||||||
|
|
||||||
|
private String pnuDtctId; // PNU탐지ID
|
||||||
|
private String pnu; // PNU코드(19자리)
|
||||||
|
private String lrmSyncYmd; // 지적도동기화일자(YYYYMMDD)
|
||||||
|
private String pnuSyncYmd; // PNU동기화일자(YYYYMMDD)
|
||||||
|
private String mpqdNo; // 도곽번호
|
||||||
|
private String cprsYr; // 비교년도
|
||||||
|
private String crtrYr; // 기준년도
|
||||||
|
private String chnDtctSno; // 회차, 변화탐지순번
|
||||||
|
private String chnDtctId; // 변화탐지ID(UUID)
|
||||||
|
|
||||||
|
private String chnDtctMstId; // 변화탐지마스터ID
|
||||||
|
private String chnDtctObjtId; // 변화탐지객체ID
|
||||||
|
private String chnDtctContId; // 변화탐지내용ID
|
||||||
|
private String chnCd; // 변화코드
|
||||||
|
private String chnDtctProb; // 변화탐지정확도(0~1)
|
||||||
|
|
||||||
|
private String bfClsCd; // 이전분류코드
|
||||||
|
private String bfClsProb; // 이전분류정확도(0~1)
|
||||||
|
private String afClsCd; // 이후분류코드
|
||||||
|
private String afClsProb; // 이후분류정확도(0~1)
|
||||||
|
|
||||||
|
private String pnuSqms; // PNU면적(㎡)
|
||||||
|
private String pnuDtctSqms; // PNU탐지면적(㎡)
|
||||||
|
private String chnDtctSqms; // 변화탐지면적(㎡)
|
||||||
|
private String stbltYn; // 적합여부(Y/N) - 안정성 (Y:부적합, N:적합)
|
||||||
|
private String incyCd; // 부적합코드
|
||||||
|
private String incyRsnCont; // 부적합사유내용
|
||||||
|
private String lockYn; // 잠금여부(Y/N)
|
||||||
|
private String lblYn; // 라벨여부(Y/N)
|
||||||
|
private String chgYn; // 변경여부(Y/N)
|
||||||
|
private String rsatctNo; // 부동산등기번호
|
||||||
|
private String rmk; // 비고
|
||||||
|
|
||||||
|
private String crtDt; // 생성일시
|
||||||
|
private String crtEpno; // 생성사원번호
|
||||||
|
private String crtIp; // 생성사원아이피
|
||||||
|
private String chgDt; // 변경일시
|
||||||
|
private String chgEpno; // 변경자사번
|
||||||
|
private String chgIp; // 변경자IP
|
||||||
|
private String delYn; // 삭제여부
|
||||||
|
}
|
||||||
|
|
||||||
|
@Schema(name = "RemoveResDto", description = "remove 후 리턴 형태")
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class RemoveResDto {
|
||||||
|
|
||||||
|
private Integer code;
|
||||||
|
private String message;
|
||||||
|
private Boolean result;
|
||||||
|
private Boolean success;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,6 +59,11 @@ public class GukYuinDto {
|
|||||||
private Integer stage;
|
private Integer stage;
|
||||||
private String uid;
|
private String uid;
|
||||||
private String applyStatus;
|
private String applyStatus;
|
||||||
|
private Boolean applyYn;
|
||||||
|
|
||||||
|
public Boolean getApplyYn() {
|
||||||
|
return this.applyYn != null && this.applyYn;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ public enum GukYuinStatus implements EnumType {
|
|||||||
GUK_COMPLETED("국유인 매핑 완료"),
|
GUK_COMPLETED("국유인 매핑 완료"),
|
||||||
PNU_COMPLETED("PNU 싱크 완료"),
|
PNU_COMPLETED("PNU 싱크 완료"),
|
||||||
PNU_FAILED("PNU 싱크 중 에러"),
|
PNU_FAILED("PNU 싱크 중 에러"),
|
||||||
|
END("종료"),
|
||||||
CANCELED("취소");
|
CANCELED("취소");
|
||||||
|
|
||||||
private final String desc;
|
private final String desc;
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.kamco.cd.kamcoback.gukyuin.service;
|
package com.kamco.cd.kamcoback.gukyuin.service;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.kamco.cd.kamcoback.common.utils.NetUtils;
|
import com.kamco.cd.kamcoback.common.utils.NetUtils;
|
||||||
import com.kamco.cd.kamcoback.common.utils.UserUtil;
|
import com.kamco.cd.kamcoback.common.utils.UserUtil;
|
||||||
import com.kamco.cd.kamcoback.config.api.ApiLogFunction;
|
import com.kamco.cd.kamcoback.config.api.ApiLogFunction;
|
||||||
@@ -9,13 +11,15 @@ import com.kamco.cd.kamcoback.config.resttemplate.ExternalHttpClient;
|
|||||||
import com.kamco.cd.kamcoback.config.resttemplate.ExternalHttpClient.ExternalCallResult;
|
import com.kamco.cd.kamcoback.config.resttemplate.ExternalHttpClient.ExternalCallResult;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.ContBasic;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.ContBasic;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.ReqInfo;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.ResultContDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.ResultContDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.ResultPnuDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.ResultPnuDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ChnDetectMastReqDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ChnDetectMastReqDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ErrorResDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LabelSendDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LabelSendDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ResReturn;
|
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ResultDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ResultDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.RlbDtctDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GukYuinLinkFacts;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GukYuinLinkFacts;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GukYuinLinkFailCode;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GukYuinLinkFailCode;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GukYuinLinkableRes;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GukYuinLinkableRes;
|
||||||
@@ -25,6 +29,8 @@ import com.kamco.cd.kamcoback.log.dto.EventType;
|
|||||||
import com.kamco.cd.kamcoback.postgres.core.GukYuinCoreService;
|
import com.kamco.cd.kamcoback.postgres.core.GukYuinCoreService;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.AuditLogEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.AuditLogEntity;
|
||||||
import com.kamco.cd.kamcoback.postgres.repository.log.AuditLogRepository;
|
import com.kamco.cd.kamcoback.postgres.repository.log.AuditLogRepository;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@@ -48,6 +54,8 @@ public class GukYuinApiService {
|
|||||||
|
|
||||||
private final UserUtil userUtil;
|
private final UserUtil userUtil;
|
||||||
private final AuditLogRepository auditLogRepository;
|
private final AuditLogRepository auditLogRepository;
|
||||||
|
private final ObjectMapper objectMapper;
|
||||||
|
private final String myip = netUtils.getLocalIP();
|
||||||
|
|
||||||
@Value("${spring.profiles.active:local}")
|
@Value("${spring.profiles.active:local}")
|
||||||
private String profile;
|
private String profile;
|
||||||
@@ -58,13 +66,18 @@ public class GukYuinApiService {
|
|||||||
@Value("${gukyuin.cdi}")
|
@Value("${gukyuin.cdi}")
|
||||||
private String gukyuinCdiUrl;
|
private String gukyuinCdiUrl;
|
||||||
|
|
||||||
|
@Value("${file.nfs}")
|
||||||
|
private String nfs;
|
||||||
|
|
||||||
|
// @Value("${file.dataset-dir}")
|
||||||
|
// private String datasetDir;
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public ChngDetectMastDto.RegistResDto regist(
|
public ChngDetectMastDto.RegistResDto regist(
|
||||||
ChngDetectMastDto.ChnDetectMastReqDto chnDetectMastReq) {
|
ChngDetectMastDto.ChnDetectMastReqDto chnDetectMastReq) {
|
||||||
|
|
||||||
String url = gukyuinCdiUrl + "/chn/mast/regist";
|
String url = gukyuinCdiUrl + "/chn/mast/regist";
|
||||||
|
|
||||||
String myip = netUtils.getLocalIP();
|
|
||||||
chnDetectMastReq.setReqIp(myip);
|
chnDetectMastReq.setReqIp(myip);
|
||||||
chnDetectMastReq.setReqEpno(userUtil.getEmployeeNo());
|
chnDetectMastReq.setReqEpno(userUtil.getEmployeeNo());
|
||||||
|
|
||||||
@@ -77,15 +90,36 @@ public class GukYuinApiService {
|
|||||||
ChngDetectMastDto.RegistResDto.class);
|
ChngDetectMastDto.RegistResDto.class);
|
||||||
|
|
||||||
ChngDetectMastDto.RegistResDto resultBody = result.body();
|
ChngDetectMastDto.RegistResDto resultBody = result.body();
|
||||||
Boolean success = false;
|
boolean success = false;
|
||||||
if (resultBody != null) {
|
if (resultBody != null && resultBody.getSuccess() != null) {
|
||||||
ChngDetectMastDto.Basic registRes = resultBody.getResult();
|
ChngDetectMastDto.Basic registRes = resultBody.getResult();
|
||||||
|
|
||||||
|
success = resultBody.getSuccess();
|
||||||
|
|
||||||
|
// 이미 등록한 경우에는 result가 없음
|
||||||
|
if (resultBody.getResult() == null) {
|
||||||
|
return resultBody;
|
||||||
|
}
|
||||||
|
|
||||||
// 추론 회차에 applyStatus, applyStatusDttm 업데이트
|
// 추론 회차에 applyStatus, applyStatusDttm 업데이트
|
||||||
gukyuinCoreService.updateGukYuinMastRegResult(registRes);
|
gukyuinCoreService.updateGukYuinMastRegResult(registRes);
|
||||||
|
|
||||||
// anal_inference 에도 국유인 반영여부, applyDttm 업데이트
|
// anal_inference 에도 국유인 반영여부, applyDttm 업데이트
|
||||||
gukyuinCoreService.updateAnalInferenceApplyDttm(registRes);
|
gukyuinCoreService.updateAnalInferenceApplyDttm(registRes);
|
||||||
success = resultBody.getSuccess();
|
} else {
|
||||||
|
String errBody = result.errBody();
|
||||||
|
ErrorResDto error = null;
|
||||||
|
try {
|
||||||
|
error = objectMapper.readValue(errBody, ErrorResDto.class);
|
||||||
|
return new ChngDetectMastDto.RegistResDto(error.getStatus(), error.getError(), null, false);
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
log.error("에러 응답 파싱 실패. rawBody={}", errBody, e);
|
||||||
|
return new ChngDetectMastDto.RegistResDto(
|
||||||
|
result.statusCode(), // HTTP status
|
||||||
|
errBody, // 원문 그대로
|
||||||
|
null,
|
||||||
|
false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.insertGukyuinAuditLog(
|
this.insertGukyuinAuditLog(
|
||||||
@@ -95,27 +129,35 @@ public class GukYuinApiService {
|
|||||||
url.replace(gukyuinUrl, ""),
|
url.replace(gukyuinUrl, ""),
|
||||||
chnDetectMastReq,
|
chnDetectMastReq,
|
||||||
success);
|
success);
|
||||||
|
|
||||||
return resultBody;
|
return resultBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public ResReturn remove(ChngDetectMastDto.ChnDetectMastReqDto chnDetectMastReq) {
|
public ChngDetectMastDto.RemoveResDto remove(
|
||||||
|
ChngDetectMastDto.ChnDetectMastReqDto chnDetectMastReq) {
|
||||||
String url = gukyuinCdiUrl + "/chn/mast/remove";
|
String url = gukyuinCdiUrl + "/chn/mast/remove";
|
||||||
|
|
||||||
String myip = netUtils.getLocalIP();
|
|
||||||
chnDetectMastReq.setReqIp(myip);
|
chnDetectMastReq.setReqIp(myip);
|
||||||
chnDetectMastReq.setReqEpno(userUtil.getEmployeeNo());
|
chnDetectMastReq.setReqEpno(userUtil.getEmployeeNo());
|
||||||
|
|
||||||
ExternalCallResult<ChngDetectMastDto.Basic> result =
|
boolean success = false;
|
||||||
|
ExternalCallResult<ChngDetectMastDto.RemoveResDto> result =
|
||||||
externalHttpClient.call(
|
externalHttpClient.call(
|
||||||
url,
|
url,
|
||||||
HttpMethod.POST,
|
HttpMethod.POST,
|
||||||
chnDetectMastReq,
|
chnDetectMastReq,
|
||||||
netUtils.jsonHeaders(),
|
netUtils.jsonHeaders(),
|
||||||
ChngDetectMastDto.Basic.class);
|
ChngDetectMastDto.RemoveResDto.class);
|
||||||
|
|
||||||
ChngDetectMastDto.Basic resultBody = result.body();
|
ChngDetectMastDto.RemoveResDto resultBody = result.body();
|
||||||
gukyuinCoreService.updateGukYuinMastRegRemove(resultBody);
|
if (resultBody != null && resultBody.getSuccess() != null) {
|
||||||
|
|
||||||
|
success = resultBody.getSuccess();
|
||||||
|
if (resultBody.getSuccess()) {
|
||||||
|
gukyuinCoreService.updateGukYuinMastRegRemove(chnDetectMastReq.getChnDtctId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.insertGukyuinAuditLog(
|
this.insertGukyuinAuditLog(
|
||||||
EventType.REMOVE.getId(),
|
EventType.REMOVE.getId(),
|
||||||
@@ -123,14 +165,22 @@ public class GukYuinApiService {
|
|||||||
userUtil.getId(),
|
userUtil.getId(),
|
||||||
url.replace(gukyuinUrl, ""),
|
url.replace(gukyuinUrl, ""),
|
||||||
chnDetectMastReq,
|
chnDetectMastReq,
|
||||||
true); // TODO : successFail 여부
|
success);
|
||||||
return new ResReturn("success", "탐지결과 삭제 되었습니다.");
|
|
||||||
|
return resultBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 등록목록 1개 확인
|
// 등록목록 1개 확인
|
||||||
public ChngDetectMastDto.ResultDto detail(String chnDtctMstId) {
|
public ChngDetectMastDto.ResultDto detail(String chnDtctMstId) {
|
||||||
|
|
||||||
String url = gukyuinCdiUrl + "/chn/mast/list/" + chnDtctMstId;
|
String url =
|
||||||
|
gukyuinCdiUrl
|
||||||
|
+ "/chn/mast/list/"
|
||||||
|
+ chnDtctMstId
|
||||||
|
+ "?reqIp="
|
||||||
|
+ myip
|
||||||
|
+ "&reqEpno="
|
||||||
|
+ userUtil.getEmployeeNo();
|
||||||
|
|
||||||
ExternalCallResult<ChngDetectMastDto.ResultDto> result =
|
ExternalCallResult<ChngDetectMastDto.ResultDto> result =
|
||||||
externalHttpClient.call(
|
externalHttpClient.call(
|
||||||
@@ -149,9 +199,15 @@ public class GukYuinApiService {
|
|||||||
// 등록목록 비교년도,기준년도,차수 조합해서 n개 확인
|
// 등록목록 비교년도,기준년도,차수 조합해서 n개 확인
|
||||||
public ChngDetectMastDto.ResultDto listYearStage(
|
public ChngDetectMastDto.ResultDto listYearStage(
|
||||||
ChngDetectMastDto.ChngDetectMastSearchDto searchDto) {
|
ChngDetectMastDto.ChngDetectMastSearchDto searchDto) {
|
||||||
|
|
||||||
String queryString = netUtils.dtoToQueryString(searchDto, null);
|
String queryString = netUtils.dtoToQueryString(searchDto, null);
|
||||||
String url = gukyuinCdiUrl + "/chn/mast" + queryString;
|
String url =
|
||||||
|
gukyuinCdiUrl
|
||||||
|
+ "/chn/mast"
|
||||||
|
+ queryString
|
||||||
|
+ "&reqIp="
|
||||||
|
+ myip
|
||||||
|
+ "&reqEpno="
|
||||||
|
+ userUtil.getEmployeeNo();
|
||||||
|
|
||||||
ExternalCallResult<ChngDetectMastDto.ResultDto> result =
|
ExternalCallResult<ChngDetectMastDto.ResultDto> result =
|
||||||
externalHttpClient.call(
|
externalHttpClient.call(
|
||||||
@@ -206,7 +262,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
|
||||||
@@ -215,7 +272,11 @@ public class GukYuinApiService {
|
|||||||
+ "?pageIndex="
|
+ "?pageIndex="
|
||||||
+ pageIndex
|
+ pageIndex
|
||||||
+ "&pageSize="
|
+ "&pageSize="
|
||||||
+ pageSize;
|
+ pageSize
|
||||||
|
+ "&reqIp="
|
||||||
|
+ myip
|
||||||
|
+ "&reqEpno="
|
||||||
|
+ ("Y".equals(batchYn) ? "BATCH" : userUtil.getEmployeeNo());
|
||||||
|
|
||||||
ExternalCallResult<ChngDetectContDto.ResultContDto> result =
|
ExternalCallResult<ChngDetectContDto.ResultContDto> result =
|
||||||
externalHttpClient.call(
|
externalHttpClient.call(
|
||||||
@@ -227,21 +288,11 @@ public class GukYuinApiService {
|
|||||||
|
|
||||||
List<ContBasic> contList = result.body().getResult();
|
List<ContBasic> contList = result.body().getResult();
|
||||||
if (contList == null || contList.isEmpty()) {
|
if (contList == null || contList.isEmpty()) {
|
||||||
return new ResultContDto();
|
return new ResultContDto(
|
||||||
}
|
result.body().getCode(),
|
||||||
|
result.body().getMessage(),
|
||||||
for (ContBasic cont : contList) {
|
result.body().getResult(),
|
||||||
String[] pnuList = cont.getPnuList();
|
result.body().getSuccess());
|
||||||
long pnuCnt = pnuList == null ? 0 : pnuList.length;
|
|
||||||
if (cont.getChnDtctObjtId() != null) {
|
|
||||||
gukyuinCoreService.updateInferenceGeomDataPnuCnt(cont.getChnDtctObjtId(), pnuCnt);
|
|
||||||
|
|
||||||
if (pnuCnt > 0) {
|
|
||||||
Long geoUid =
|
|
||||||
gukyuinCoreService.findMapSheetAnalDataInferenceGeomUid(cont.getChnDtctObjtId());
|
|
||||||
gukyuinCoreService.insertGeoUidPnuData(geoUid, pnuList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.insertGukyuinAuditLog(
|
this.insertGukyuinAuditLog(
|
||||||
@@ -256,7 +307,16 @@ public class GukYuinApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ResultPnuDto findPnuObjMgmtList(String chnDtctId, String chnDtctObjtId) {
|
public ResultPnuDto findPnuObjMgmtList(String chnDtctId, String chnDtctObjtId) {
|
||||||
String url = gukyuinCdiUrl + "/chn/pnu/" + chnDtctId + "/objt/" + chnDtctObjtId;
|
String url =
|
||||||
|
gukyuinCdiUrl
|
||||||
|
+ "/chn/pnu/"
|
||||||
|
+ chnDtctId
|
||||||
|
+ "/objt/"
|
||||||
|
+ chnDtctObjtId
|
||||||
|
+ "?reqIp="
|
||||||
|
+ myip
|
||||||
|
+ "&reqEpno="
|
||||||
|
+ userUtil.getEmployeeNo();
|
||||||
|
|
||||||
ExternalCallResult<ChngDetectContDto.ResultPnuDto> result =
|
ExternalCallResult<ChngDetectContDto.ResultPnuDto> result =
|
||||||
externalHttpClient.call(
|
externalHttpClient.call(
|
||||||
@@ -277,18 +337,21 @@ public class GukYuinApiService {
|
|||||||
return result.body();
|
return result.body();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResReturn updateChnDtctObjtLabelingYn(String chnDtctObjtId, String lblYn) {
|
public ChngDetectContDto.ResultLabelDto updateChnDtctObjtLabelingYn(
|
||||||
|
String chnDtctObjtId, String lblYn, String batchYn) {
|
||||||
String url = gukyuinCdiUrl + "/rlb/objt/" + chnDtctObjtId + "/lbl/" + lblYn;
|
String url = gukyuinCdiUrl + "/rlb/objt/" + chnDtctObjtId + "/lbl/" + lblYn;
|
||||||
|
|
||||||
ExternalCallResult<ChngDetectContDto.ResultPnuDto> result =
|
ReqInfo info = new ReqInfo();
|
||||||
|
info.setReqIp(myip);
|
||||||
|
info.setReqEpno("Y".equals(batchYn) ? "BATCH" : userUtil.getEmployeeNo());
|
||||||
|
|
||||||
|
ExternalCallResult<ChngDetectContDto.ResultLabelDto> result =
|
||||||
externalHttpClient.call(
|
externalHttpClient.call(
|
||||||
url,
|
url,
|
||||||
HttpMethod.POST,
|
HttpMethod.POST,
|
||||||
null,
|
info,
|
||||||
netUtils.jsonHeaders(),
|
netUtils.jsonHeaders(),
|
||||||
ChngDetectContDto.ResultPnuDto.class);
|
ChngDetectContDto.ResultLabelDto.class);
|
||||||
|
|
||||||
ChngDetectContDto.ResultPnuDto dto = result.body();
|
|
||||||
|
|
||||||
this.insertGukyuinAuditLog(
|
this.insertGukyuinAuditLog(
|
||||||
EventType.MODIFIED.getId(),
|
EventType.MODIFIED.getId(),
|
||||||
@@ -298,11 +361,21 @@ public class GukYuinApiService {
|
|||||||
null,
|
null,
|
||||||
result.body().getSuccess());
|
result.body().getSuccess());
|
||||||
|
|
||||||
return new ResReturn(dto.getCode() > 200000 ? "fail" : "success", dto.getMessage());
|
return result.body();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResultContDto findChnPnuToContList(String chnDtctId, String pnu) {
|
public ResultContDto findChnPnuToContList(String chnDtctId, String pnu) {
|
||||||
String url = gukyuinCdiUrl + "/chn/cont/" + chnDtctId + "/pnu/" + pnu;
|
|
||||||
|
String url =
|
||||||
|
gukyuinCdiUrl
|
||||||
|
+ "/chn/cont/"
|
||||||
|
+ chnDtctId
|
||||||
|
+ "/pnu/"
|
||||||
|
+ pnu
|
||||||
|
+ "?reqIp="
|
||||||
|
+ myip
|
||||||
|
+ "&reqEpno="
|
||||||
|
+ userUtil.getEmployeeNo();
|
||||||
|
|
||||||
ExternalCallResult<ChngDetectContDto.ResultContDto> result =
|
ExternalCallResult<ChngDetectContDto.ResultContDto> result =
|
||||||
externalHttpClient.call(
|
externalHttpClient.call(
|
||||||
@@ -322,8 +395,15 @@ public class GukYuinApiService {
|
|||||||
return result.body();
|
return result.body();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResultDto listChnDtctId(String chnDtctId) {
|
public ResultDto listChnDtctId(String chnDtctId, String batchYn) {
|
||||||
String url = gukyuinCdiUrl + "/chn/mast/" + chnDtctId;
|
String url =
|
||||||
|
gukyuinCdiUrl
|
||||||
|
+ "/chn/mast/"
|
||||||
|
+ chnDtctId
|
||||||
|
+ "?reqIp="
|
||||||
|
+ myip
|
||||||
|
+ "&reqEpno="
|
||||||
|
+ ("Y".equals(batchYn) ? "BATCH" : userUtil.getEmployeeNo());
|
||||||
|
|
||||||
ExternalCallResult<ChngDetectMastDto.ResultDto> result =
|
ExternalCallResult<ChngDetectMastDto.ResultDto> result =
|
||||||
externalHttpClient.call(
|
externalHttpClient.call(
|
||||||
@@ -372,11 +452,17 @@ public class GukYuinApiService {
|
|||||||
public ResponseObj connectChnMastRegist(UUID uuid) {
|
public ResponseObj connectChnMastRegist(UUID uuid) {
|
||||||
// uuid로 추론 회차 조회
|
// uuid로 추론 회차 조회
|
||||||
LearnInfo info = gukyuinCoreService.findMapSheetLearnInfo(uuid);
|
LearnInfo info = gukyuinCoreService.findMapSheetLearnInfo(uuid);
|
||||||
// if (info.getApplyStatus() != null &&
|
if (info.getApplyYn() != null && info.getApplyYn()) {
|
||||||
// !info.getApplyStatus().equals(GukYuinStatus.PENDING.getId()))
|
return new ResponseObj(ApiResponseCode.DUPLICATE_DATA, "이미 국유인 연동을 한 회차입니다.");
|
||||||
// {
|
}
|
||||||
// return new ResponseObj(ApiResponseCode.DUPLICATE_DATA, "이미 국유인 연동을 한 추론 회차입니다.");
|
|
||||||
// }
|
// 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(
|
||||||
|
ApiResponseCode.NOT_FOUND_DATA, "파일 경로에 회차 실행 파일이 생성되지 않았습니다. 확인 부탁드립니다.");
|
||||||
|
}
|
||||||
|
|
||||||
// 비교년도,기준년도로 전송한 데이터 있는지 확인 후 회차 번호 생성
|
// 비교년도,기준년도로 전송한 데이터 있는지 확인 후 회차 번호 생성
|
||||||
Integer maxStage =
|
Integer maxStage =
|
||||||
@@ -388,15 +474,116 @@ 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회차를 보내야 함
|
||||||
|
// 추론(learn), 학습데이터(inference) 둘 다 종료 처리
|
||||||
|
if (maxStage > 0) {
|
||||||
|
Long learnId =
|
||||||
|
gukyuinCoreService.findMapSheetLearnInfoByYyyy(
|
||||||
|
info.getCompareYyyy(), info.getTargetYyyy(), maxStage);
|
||||||
|
gukyuinCoreService.updateMapSheetLearnGukyuinEndStatus(learnId);
|
||||||
|
gukyuinCoreService.updateMapSheetInferenceLabelEndStatus(learnId);
|
||||||
|
}
|
||||||
|
|
||||||
// 국유인 /chn/mast/regist 전송
|
// 국유인 /chn/mast/regist 전송
|
||||||
this.regist(reqDto);
|
ChngDetectMastDto.RegistResDto result = this.regist(reqDto);
|
||||||
|
if (result.getSuccess()) {
|
||||||
return new ResponseObj(ApiResponseCode.OK, "");
|
return new ResponseObj(ApiResponseCode.OK, "연동되었습니다.");
|
||||||
|
} else {
|
||||||
|
return new ResponseObj(ApiResponseCode.INTERNAL_SERVER_ERROR, result.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<LabelSendDto> findLabelingCompleteSendList(LocalDate yesterday) {
|
public List<LabelSendDto> findLabelingCompleteSendList(LocalDate yesterday) {
|
||||||
return gukyuinCoreService.findLabelingCompleteSendList(yesterday);
|
return gukyuinCoreService.findLabelingCompleteSendList(yesterday);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ResultContDto findChnPnuToContObject(
|
||||||
|
String chnDtctId, String chnDtctObjtId, Integer pageIndex, Integer pageSize) {
|
||||||
|
|
||||||
|
String url =
|
||||||
|
gukyuinCdiUrl
|
||||||
|
+ "/chn/cont/"
|
||||||
|
+ chnDtctId
|
||||||
|
+ "/chnDtctObjtId/"
|
||||||
|
+ chnDtctObjtId
|
||||||
|
+ "?pageIndex="
|
||||||
|
+ pageIndex
|
||||||
|
+ "&pageSize="
|
||||||
|
+ pageSize
|
||||||
|
+ "&reqIp="
|
||||||
|
+ myip
|
||||||
|
+ "&reqEpno="
|
||||||
|
+ userUtil.getEmployeeNo();
|
||||||
|
|
||||||
|
ExternalCallResult<ChngDetectContDto.ResultContDto> result =
|
||||||
|
externalHttpClient.call(
|
||||||
|
url,
|
||||||
|
HttpMethod.GET,
|
||||||
|
null,
|
||||||
|
netUtils.jsonHeaders(),
|
||||||
|
ChngDetectContDto.ResultContDto.class);
|
||||||
|
|
||||||
|
this.insertGukyuinAuditLog(
|
||||||
|
EventType.DETAIL.getId(),
|
||||||
|
netUtils.getLocalIP(),
|
||||||
|
userUtil.getId(),
|
||||||
|
url.replace(gukyuinUrl, ""),
|
||||||
|
null,
|
||||||
|
result.body() != null && result.body().getSuccess());
|
||||||
|
return result.body();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ChngDetectMastDto.RlbDtctDto findRlbDtctList(
|
||||||
|
String chnDtctId, String yyyymmdd, String batchYn) {
|
||||||
|
|
||||||
|
String url =
|
||||||
|
gukyuinCdiUrl
|
||||||
|
+ "/rlb/dtct/"
|
||||||
|
+ chnDtctId
|
||||||
|
+ "?reqIp="
|
||||||
|
+ myip
|
||||||
|
+ "&reqEpno="
|
||||||
|
+ ("Y".equals(batchYn) ? "BATCH" : userUtil.getEmployeeNo())
|
||||||
|
+ "&yyyymmdd="
|
||||||
|
+ yyyymmdd;
|
||||||
|
|
||||||
|
ExternalCallResult<ChngDetectMastDto.RlbDtctDto> result =
|
||||||
|
externalHttpClient.call(
|
||||||
|
url, HttpMethod.GET, null, netUtils.jsonHeaders(), ChngDetectMastDto.RlbDtctDto.class);
|
||||||
|
|
||||||
|
this.insertGukyuinAuditLog(
|
||||||
|
EventType.LIST.getId(),
|
||||||
|
netUtils.getLocalIP(),
|
||||||
|
userUtil.getId(),
|
||||||
|
url.replace(gukyuinUrl, ""),
|
||||||
|
null,
|
||||||
|
result.body() != null && result.body().getSuccess());
|
||||||
|
return result.body();
|
||||||
|
}
|
||||||
|
|
||||||
|
public RlbDtctDto findRlbDtctObject(String chnDtctObjtId) {
|
||||||
|
String url =
|
||||||
|
gukyuinCdiUrl
|
||||||
|
+ "/rlb/objt/"
|
||||||
|
+ chnDtctObjtId
|
||||||
|
+ "?reqIp="
|
||||||
|
+ myip
|
||||||
|
+ "&reqEpno="
|
||||||
|
+ userUtil.getEmployeeNo();
|
||||||
|
|
||||||
|
ExternalCallResult<ChngDetectMastDto.RlbDtctDto> result =
|
||||||
|
externalHttpClient.call(
|
||||||
|
url, HttpMethod.GET, null, netUtils.jsonHeaders(), ChngDetectMastDto.RlbDtctDto.class);
|
||||||
|
|
||||||
|
this.insertGukyuinAuditLog(
|
||||||
|
EventType.DETAIL.getId(),
|
||||||
|
netUtils.getLocalIP(),
|
||||||
|
userUtil.getId(),
|
||||||
|
url.replace(gukyuinUrl, ""),
|
||||||
|
null,
|
||||||
|
result.body() != null && result.body().getSuccess());
|
||||||
|
return result.body();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.kamco.cd.kamcoback.inference;
|
package com.kamco.cd.kamcoback.inference;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.common.download.RangeDownloadResponder;
|
||||||
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;
|
||||||
@@ -17,26 +18,24 @@ import com.kamco.cd.kamcoback.model.dto.ModelMngDto;
|
|||||||
import com.kamco.cd.kamcoback.model.service.ModelMngService;
|
import com.kamco.cd.kamcoback.model.service.ModelMngService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.enums.ParameterIn;
|
||||||
import io.swagger.v3.oas.annotations.media.ArraySchema;
|
import io.swagger.v3.oas.annotations.media.ArraySchema;
|
||||||
import io.swagger.v3.oas.annotations.media.Content;
|
import io.swagger.v3.oas.annotations.media.Content;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
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.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
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 org.springframework.core.io.FileSystemResource;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.core.io.Resource;
|
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.http.HttpHeaders;
|
|
||||||
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;
|
||||||
@@ -48,6 +47,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@Tag(name = "추론관리", description = "추론관리 API")
|
@Tag(name = "추론관리", description = "추론관리 API")
|
||||||
|
@Log4j2
|
||||||
@RequestMapping("/api/inference")
|
@RequestMapping("/api/inference")
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@RestController
|
@RestController
|
||||||
@@ -56,6 +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 RangeDownloadResponder rangeDownloadResponder;
|
||||||
|
|
||||||
@Operation(summary = "추론관리 목록", description = "어드민 홈 > 추론관리 > 추론관리 > 추론관리 목록")
|
@Operation(summary = "추론관리 목록", description = "어드민 홈 > 추론관리 > 추론관리 > 추론관리 목록")
|
||||||
@ApiResponses(
|
@ApiResponses(
|
||||||
@@ -150,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,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) {
|
||||||
@@ -328,7 +329,21 @@ public class InferenceResultApiController {
|
|||||||
return ApiResponseDto.ok(geomList);
|
return ApiResponseDto.ok(geomList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "shp 파일 다운로드", description = "추론관리 분석결과 shp 파일 다운로드")
|
@Operation(
|
||||||
|
summary = "shp 파일 다운로드",
|
||||||
|
description = "추론관리 분석결과 shp 파일 다운로드",
|
||||||
|
parameters = {
|
||||||
|
@Parameter(
|
||||||
|
name = "kamco-download-uuid",
|
||||||
|
in = ParameterIn.HEADER,
|
||||||
|
required = true,
|
||||||
|
description = "다운로드 요청 UUID",
|
||||||
|
schema =
|
||||||
|
@Schema(
|
||||||
|
type = "string",
|
||||||
|
format = "uuid",
|
||||||
|
example = "69c4e56c-e0bf-4742-9225-bba9aae39052"))
|
||||||
|
})
|
||||||
@ApiResponses(
|
@ApiResponses(
|
||||||
value = {
|
value = {
|
||||||
@ApiResponse(
|
@ApiResponse(
|
||||||
@@ -341,15 +356,13 @@ 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}", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
|
@GetMapping("/download/{uuid}")
|
||||||
public ResponseEntity<Resource> downloadShp(
|
public ResponseEntity<?> download(@PathVariable UUID uuid, HttpServletRequest request)
|
||||||
@Parameter(description = "uuid", example = "0192efc6-9ec2-43ee-9a90-5b73e763c09f")
|
|
||||||
@PathVariable
|
|
||||||
UUID uuid)
|
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
|
||||||
String path;
|
String path;
|
||||||
String uid;
|
String uid;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Map<String, Object> map = inferenceResultService.shpDownloadPath(uuid);
|
Map<String, Object> map = inferenceResultService.shpDownloadPath(uuid);
|
||||||
path = String.valueOf(map.get("path"));
|
path = String.valueOf(map.get("path"));
|
||||||
@@ -360,24 +373,11 @@ public class InferenceResultApiController {
|
|||||||
|
|
||||||
Path zipPath = Path.of(path);
|
Path zipPath = Path.of(path);
|
||||||
|
|
||||||
if (!Files.exists(zipPath) || !Files.isReadable(zipPath)) {
|
// Range + 200/206/416 공통 처리 (추가 헤더 포함)
|
||||||
return ResponseEntity.notFound().build();
|
return rangeDownloadResponder.buildZipResponse(zipPath, uid + ".zip", request);
|
||||||
}
|
|
||||||
|
|
||||||
FileSystemResource resource = new FileSystemResource(zipPath);
|
|
||||||
|
|
||||||
String filename = uid + ".zip";
|
|
||||||
|
|
||||||
long fileSize = Files.size(zipPath);
|
|
||||||
|
|
||||||
return ResponseEntity.ok()
|
|
||||||
.contentType(MediaType.APPLICATION_OCTET_STREAM)
|
|
||||||
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + filename + "\"")
|
|
||||||
.contentLength(fileSize)
|
|
||||||
.body(resource);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "shp 파일 다운로드 이력", description = "추론관리 분석결과 shp 파일 다운로드 이력")
|
@Operation(summary = "shp 파일 다운로드 이력 조회", description = "추론관리 분석결과 shp 파일 다운로드 이력 조회")
|
||||||
@GetMapping(value = "/download-audit/{uuid}")
|
@GetMapping(value = "/download-audit/{uuid}")
|
||||||
@ApiResponses(
|
@ApiResponses(
|
||||||
value = {
|
value = {
|
||||||
@@ -392,19 +392,20 @@ public class InferenceResultApiController {
|
|||||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
})
|
})
|
||||||
public ApiResponseDto<Page<AuditLogDto.DownloadRes>> downloadAudit(
|
public ApiResponseDto<Page<AuditLogDto.DownloadRes>> downloadAudit(
|
||||||
@Parameter(description = "UUID", example = "0192efc6-9ec2-43ee-9a90-5b73e763c09f")
|
@Parameter(description = "UUID", example = "69c4e56c-e0bf-4742-9225-bba9aae39052")
|
||||||
@PathVariable
|
@PathVariable
|
||||||
UUID uuid,
|
UUID uuid,
|
||||||
@Parameter(description = "다운로드일 시작", example = "2025-01-01") @RequestParam(required = false)
|
@Parameter(description = "다운로드일 시작", example = "2025-01-01") @RequestParam(required = false)
|
||||||
LocalDate strtDttm,
|
LocalDate strtDttm,
|
||||||
@Parameter(description = "다운로드일 종료", example = "2026-01-01") @RequestParam(required = false)
|
@Parameter(description = "다운로드일 종료", example = "2026-04-01") @RequestParam(required = false)
|
||||||
LocalDate endDttm,
|
LocalDate endDttm,
|
||||||
@Parameter(description = "키워드", example = "관리자") @RequestParam(required = false)
|
@Parameter(description = "키워드", example = "") @RequestParam(required = false)
|
||||||
String searchValue,
|
String searchValue,
|
||||||
@Parameter(description = "페이지 번호 (0부터 시작)", example = "0") @RequestParam(defaultValue = "0")
|
@Parameter(description = "페이지 번호 (0부터 시작)", example = "0") @RequestParam(defaultValue = "0")
|
||||||
int page,
|
int page,
|
||||||
@Parameter(description = "페이지 크기", example = "20") @RequestParam(defaultValue = "20")
|
@Parameter(description = "페이지 크기", example = "20") @RequestParam(defaultValue = "20")
|
||||||
int size) {
|
int size) {
|
||||||
|
|
||||||
AuditLogDto.searchReq searchReq = new searchReq();
|
AuditLogDto.searchReq searchReq = new searchReq();
|
||||||
searchReq.setPage(page);
|
searchReq.setPage(page);
|
||||||
searchReq.setSize(size);
|
searchReq.setSize(size);
|
||||||
@@ -413,8 +414,7 @@ public class InferenceResultApiController {
|
|||||||
downloadReq.setStartDate(strtDttm);
|
downloadReq.setStartDate(strtDttm);
|
||||||
downloadReq.setEndDate(endDttm);
|
downloadReq.setEndDate(endDttm);
|
||||||
downloadReq.setSearchValue(searchValue);
|
downloadReq.setSearchValue(searchValue);
|
||||||
downloadReq.setMenuId("22");
|
downloadReq.setRequestUri("/api/inference/download/" + uuid);
|
||||||
downloadReq.setRequestUri("/api/inference/download-audit");
|
|
||||||
|
|
||||||
return ApiResponseDto.ok(inferenceResultService.getDownloadAudit(searchReq, downloadReq));
|
return ApiResponseDto.ok(inferenceResultService.getDownloadAudit(searchReq, downloadReq));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -534,6 +534,10 @@ public class InferenceDetailDto {
|
|||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getApplyYn() {
|
||||||
|
return this.applyYn != null && this.applyYn;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
|
|||||||
@@ -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 = "643adead-f3d2-4f10-9037-862bee919399")
|
||||||
@NotNull
|
@NotNull
|
||||||
private UUID model1Uuid;
|
private UUID model1Uuid;
|
||||||
|
|
||||||
@Schema(description = "M2", example = "ec92b7d2-b5a3-4915-9bdf-35fb3ca8ad27")
|
@Schema(description = "G2", example = "dd86b4ef-28e3-4e3d-9ee4-f60d9cb54e13")
|
||||||
@NotNull
|
@NotNull
|
||||||
private UUID model2Uuid;
|
private UUID model2Uuid;
|
||||||
|
|
||||||
@Schema(description = "M3", example = "37f45782-8ccf-4cf6-911c-a055a1510d39")
|
@Schema(description = "G3", example = "58c1153e-dec6-4424-82a1-189083a9d9dc")
|
||||||
@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);
|
||||||
@@ -676,4 +676,13 @@ public class InferenceResultDto {
|
|||||||
private Long m2ModelBatchId;
|
private Long m2ModelBatchId;
|
||||||
private Long m3ModelBatchId;
|
private Long m3ModelBatchId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class MapSheetFallbackYearDto {
|
||||||
|
private String mapSheetNum;
|
||||||
|
private Integer mngYyyy;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,24 @@
|
|||||||
|
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) {
|
||||||
|
System.out.println(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -21,6 +21,7 @@ import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.DetectOption;
|
|||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.InferenceLearnDto;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.InferenceLearnDto;
|
||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.InferenceServerStatusDto;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.InferenceServerStatusDto;
|
||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.InferenceStatusDetailDto;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.InferenceStatusDetailDto;
|
||||||
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.MapSheetFallbackYearDto;
|
||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.MapSheetNumDto;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.MapSheetNumDto;
|
||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.ResultList;
|
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;
|
||||||
@@ -45,6 +46,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;
|
||||||
@@ -63,6 +65,7 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
/** 추론 관리 */
|
||||||
@Service
|
@Service
|
||||||
@Log4j2
|
@Log4j2
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@@ -116,6 +119,273 @@ public class InferenceResultService {
|
|||||||
return dto.getUuid();
|
return dto.getUuid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 추론 실행 - 추론제외, 이전년도 도엽 사용 분기
|
||||||
|
*
|
||||||
|
* @param req
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Transactional
|
||||||
|
public UUID run(InferenceResultDto.RegReq req) {
|
||||||
|
if (req.getDetectOption().equals(DetectOption.EXCL.getId())) {
|
||||||
|
return runExcl(req);
|
||||||
|
}
|
||||||
|
return runPrev(req);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 변화탐지 옵션 추론제외 실행
|
||||||
|
*
|
||||||
|
* @param req
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public UUID runExcl(InferenceResultDto.RegReq req) {
|
||||||
|
// target 도엽 조회
|
||||||
|
List<MngListDto> targetDtoList = mapSheetMngCoreService.getHstMapSheetList(req);
|
||||||
|
|
||||||
|
// target 리스트 추출 (null 제거 + 중복 제거)
|
||||||
|
List<String> targetList =
|
||||||
|
targetDtoList.stream()
|
||||||
|
.map(MngListDto::getMapSheetNum)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
// compare 도엽번호 리스트 조회 (null 제거 + 중복 제거)
|
||||||
|
List<String> compareList =
|
||||||
|
mapSheetMngCoreService.getMapSheetNumByHst(req.getCompareYyyy()).stream()
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
// compare 기준
|
||||||
|
Set<String> compareSet = new HashSet<>(compareList);
|
||||||
|
|
||||||
|
// target 기준으로 compare에 존재하는 도엽만 필터링
|
||||||
|
List<String> filteredTargetList = targetList.stream().filter(compareSet::contains).toList();
|
||||||
|
|
||||||
|
// 도엽 비교 로그 출력
|
||||||
|
logYearComparison(targetList, compareList, filteredTargetList);
|
||||||
|
|
||||||
|
// compare geojson 파일 생성
|
||||||
|
Scene compareScene =
|
||||||
|
getSceneInference(
|
||||||
|
req.getCompareYyyy().toString(), // 기준년도
|
||||||
|
filteredTargetList, // 교집합 도엽
|
||||||
|
req.getMapSheetScope(), // ALL / 부분
|
||||||
|
req.getDetectOption()); // EXCL / PREV
|
||||||
|
|
||||||
|
// target geojson 파일 생성
|
||||||
|
Scene targetScene =
|
||||||
|
getSceneInference(
|
||||||
|
req.getTargetYyyy().toString(), // 대상년도
|
||||||
|
filteredTargetList, // 교집합 도엽
|
||||||
|
req.getMapSheetScope(),
|
||||||
|
req.getDetectOption());
|
||||||
|
|
||||||
|
// 추론 실행
|
||||||
|
return executeInference(
|
||||||
|
req,
|
||||||
|
targetDtoList, // 전체 target 목록
|
||||||
|
filteredTargetList, // 최종 추론 대상
|
||||||
|
compareScene, // compare geojson
|
||||||
|
targetScene // target geojson
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 변화탐지 옵션 이전 년도 도엽 사용 실행
|
||||||
|
*
|
||||||
|
* @param req
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Transactional
|
||||||
|
public UUID runPrev(InferenceResultDto.RegReq req) {
|
||||||
|
// target 목록 조회
|
||||||
|
List<MngListDto> targetDtoList = mapSheetMngCoreService.getHstMapSheetList(req);
|
||||||
|
|
||||||
|
// target 도엽번호 리스트 추출 중복 제거
|
||||||
|
List<String> targetList =
|
||||||
|
targetDtoList.stream()
|
||||||
|
.map(MngListDto::getMapSheetNum)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
// compare 목록 조회
|
||||||
|
List<MapSheetFallbackYearDto> compareDtoList =
|
||||||
|
new ArrayList<>(mapSheetMngCoreService.getMapSheetNumDtoByHst(req.getCompareYyyy()));
|
||||||
|
|
||||||
|
// compare 도엽번호 Set 구성
|
||||||
|
Set<String> compareSet =
|
||||||
|
compareDtoList.stream()
|
||||||
|
.map(MapSheetFallbackYearDto::getMapSheetNum)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
|
// target에는 있으나 compare에는 없는 도엽 추출
|
||||||
|
List<String> remainingTargetList =
|
||||||
|
targetList.stream().filter(s -> !compareSet.contains(s)).toList();
|
||||||
|
|
||||||
|
// compare에 없을때 이전 년도 사용 가능여부 조회
|
||||||
|
List<MapSheetFallbackYearDto> fallbackYearDtoList =
|
||||||
|
mapSheetMngCoreService.findFallbackCompareYearByMapSheets(
|
||||||
|
req.getTargetYyyy(), // 대상년도 기준
|
||||||
|
remainingTargetList // compare에 없는 도엽들
|
||||||
|
);
|
||||||
|
|
||||||
|
// 기존 compare , 사용가능 이전년도 정보 합치기
|
||||||
|
compareDtoList.addAll(fallbackYearDtoList);
|
||||||
|
|
||||||
|
// 중복제거하여 사용할 compare 도엽 목록
|
||||||
|
Set<String> availableCompareSheets =
|
||||||
|
compareDtoList.stream()
|
||||||
|
.map(MapSheetFallbackYearDto::getMapSheetNum)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
|
// 최종 추론 대상 도엽
|
||||||
|
// target 기준으로 compare 에 존재하는 도엽만 추출
|
||||||
|
List<String> filteredTargetList =
|
||||||
|
targetList.stream().filter(availableCompareSheets::contains).toList();
|
||||||
|
|
||||||
|
// compareDtoList도 최종 기준으로 필터
|
||||||
|
Set<String> filteredTargetSet = new HashSet<>(filteredTargetList);
|
||||||
|
|
||||||
|
List<MapSheetFallbackYearDto> filteredCompareDtoList =
|
||||||
|
compareDtoList.stream()
|
||||||
|
.filter(d -> d.getMapSheetNum() != null)
|
||||||
|
.filter(d -> filteredTargetSet.contains(d.getMapSheetNum()))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
// compare only 계산 (target에는 없는 compare 도엽 수) log 용
|
||||||
|
long compareOnlyCount =
|
||||||
|
compareDtoList.stream()
|
||||||
|
.map(MapSheetFallbackYearDto::getMapSheetNum)
|
||||||
|
.filter(s -> s != null && !targetList.contains(s))
|
||||||
|
.count();
|
||||||
|
|
||||||
|
// 연도별 도엽 비교 로그 출력
|
||||||
|
log.info(
|
||||||
|
"""
|
||||||
|
===== MapSheet Year Comparison =====
|
||||||
|
target Total: {}
|
||||||
|
compare Total: {}
|
||||||
|
Intersection: {}
|
||||||
|
target Only (Excluded): {}
|
||||||
|
compare Only: {}
|
||||||
|
====================================
|
||||||
|
""",
|
||||||
|
targetList.size(), // target count
|
||||||
|
compareDtoList.size(), // compare count
|
||||||
|
filteredTargetList.size(), // target 기준으로 compare 비교하여 최종 추론할 도엽 count
|
||||||
|
targetList.size() - filteredTargetList.size(), // compare에 존재하지 않는 target 도엽 수
|
||||||
|
compareOnlyCount); // target 에 존재하지 않는 compare 도엽수
|
||||||
|
|
||||||
|
// compare 기준 geojson 생성 (년도 fallback 반영)
|
||||||
|
Scene compareScene =
|
||||||
|
getSceneInference(
|
||||||
|
filteredCompareDtoList,
|
||||||
|
req.getCompareYyyy().toString(),
|
||||||
|
req.getMapSheetScope(),
|
||||||
|
req.getDetectOption());
|
||||||
|
|
||||||
|
// target 기준 geojson 생성
|
||||||
|
Scene targetScene =
|
||||||
|
getSceneInference(
|
||||||
|
req.getTargetYyyy().toString(),
|
||||||
|
filteredTargetList,
|
||||||
|
req.getMapSheetScope(),
|
||||||
|
req.getDetectOption());
|
||||||
|
|
||||||
|
// AI 추론 실행
|
||||||
|
return executeInference(req, targetDtoList, filteredTargetList, compareScene, targetScene);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* learn 테이블 저장 및 AI 추론 API 호출
|
||||||
|
*
|
||||||
|
* @param req
|
||||||
|
* @param targetDtoList
|
||||||
|
* @param filteredTargetList
|
||||||
|
* @param modelComparePath
|
||||||
|
* @param modelTargetPath
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private UUID executeInference(
|
||||||
|
InferenceResultDto.RegReq req,
|
||||||
|
List<MngListDto> targetDtoList,
|
||||||
|
List<String> filteredTargetList,
|
||||||
|
Scene modelComparePath,
|
||||||
|
Scene modelTargetPath) {
|
||||||
|
Set<String> filteredSet = new HashSet<>(filteredTargetList);
|
||||||
|
|
||||||
|
List<MngListDto> newTargetList =
|
||||||
|
targetDtoList.stream()
|
||||||
|
.filter(m -> m.getMapSheetNum() != null)
|
||||||
|
.filter(m -> filteredSet.contains(m.getMapSheetNum()))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
UUID uuid = inferenceResultCoreService.saveInferenceInfo(req, newTargetList);
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
Long batchId = ensureAccepted(m1);
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EXCL 로그
|
||||||
|
*
|
||||||
|
* @param targetList
|
||||||
|
* @param compareList
|
||||||
|
* @param filteredTargetList
|
||||||
|
*/
|
||||||
|
private void logYearComparison(
|
||||||
|
List<String> targetList, List<String> compareList, List<String> filteredTargetList) {
|
||||||
|
Set<String> targetSet = new HashSet<>(targetList);
|
||||||
|
|
||||||
|
long compareOnlyCount = compareList.stream().filter(s -> !targetSet.contains(s)).count();
|
||||||
|
|
||||||
|
log.info(
|
||||||
|
"""
|
||||||
|
===== MapSheet Year Comparison =====
|
||||||
|
target Total: {}
|
||||||
|
compare Total: {}
|
||||||
|
Intersection: {}
|
||||||
|
target Only (Excluded): {}
|
||||||
|
compare Only: {}
|
||||||
|
====================================
|
||||||
|
""",
|
||||||
|
targetList.size(), // target count
|
||||||
|
compareList.size(), // compare count
|
||||||
|
filteredTargetList.size(), // target 기준으로 compare 비교하여 최종 추론할 도엽 count
|
||||||
|
targetList.size() - filteredTargetList.size(), // compare에 존재하지 않는 target 도엽 수
|
||||||
|
compareOnlyCount); // target 에 존재하지 않는 compare 도엽수
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 변화탐지 실행 정보 생성
|
* 변화탐지 실행 정보 생성
|
||||||
*
|
*
|
||||||
@@ -238,6 +508,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 호출
|
||||||
@@ -248,7 +520,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());
|
||||||
@@ -321,10 +593,11 @@ public class InferenceResultService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 추론 AI API 호출
|
* 추론 AI API 호출 batch id를 리턴
|
||||||
*
|
*
|
||||||
* @param dto
|
* @param dto
|
||||||
*/
|
*/
|
||||||
|
// 같은함수가 왜 두개지
|
||||||
private Long ensureAccepted(InferenceSendDto dto) {
|
private Long ensureAccepted(InferenceSendDto dto) {
|
||||||
|
|
||||||
if (dto == null) {
|
if (dto == null) {
|
||||||
@@ -332,6 +605,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,19 +621,22 @@ 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();
|
||||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||||
headers.setAccept(List.of(MediaType.APPLICATION_JSON));
|
headers.setAccept(List.of(MediaType.APPLICATION_JSON));
|
||||||
|
|
||||||
|
// 추론 실행 API 호출
|
||||||
ExternalCallResult<String> result =
|
ExternalCallResult<String> result =
|
||||||
externalHttpClient.call(inferenceUrl, HttpMethod.POST, dto, headers, String.class);
|
externalHttpClient.call(inferenceUrl, HttpMethod.POST, dto, headers, String.class);
|
||||||
|
|
||||||
@@ -367,12 +651,14 @@ public class InferenceResultService {
|
|||||||
objectMapper.readValue(result.body(), new TypeReference<>() {});
|
objectMapper.readValue(result.body(), new TypeReference<>() {});
|
||||||
|
|
||||||
if (list.isEmpty()) {
|
if (list.isEmpty()) {
|
||||||
throw new IllegalStateException("Inference response is empty");
|
throw new CustomApiException(
|
||||||
|
"NOT_FOUND", HttpStatus.NOT_FOUND, "Inference response is empty");
|
||||||
}
|
}
|
||||||
|
|
||||||
Object batchIdObj = list.get(0).get("batch_id");
|
Object batchIdObj = list.get(0).get("batch_id");
|
||||||
if (batchIdObj == null) {
|
if (batchIdObj == null) {
|
||||||
throw new IllegalStateException("batch_id not found in response");
|
throw new CustomApiException(
|
||||||
|
"NOT_FOUND", HttpStatus.NOT_FOUND, "batch_id not found in response");
|
||||||
}
|
}
|
||||||
|
|
||||||
return Long.valueOf(batchIdObj.toString());
|
return Long.valueOf(batchIdObj.toString());
|
||||||
@@ -391,6 +677,7 @@ public class InferenceResultService {
|
|||||||
*/
|
*/
|
||||||
private InferenceSendDto getModelInfo(UUID uuid) {
|
private InferenceSendDto getModelInfo(UUID uuid) {
|
||||||
|
|
||||||
|
// 모델정보 조회
|
||||||
Basic modelInfo = modelMngCoreService.findByModelUuid(uuid);
|
Basic modelInfo = modelMngCoreService.findByModelUuid(uuid);
|
||||||
|
|
||||||
String cdModelPath = "";
|
String cdModelPath = "";
|
||||||
@@ -414,12 +701,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();
|
||||||
@@ -429,7 +716,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -447,6 +735,23 @@ public class InferenceResultService {
|
|||||||
yyyy, mapSheetNums, mapSheetScope, detectOption);
|
yyyy, mapSheetNums, mapSheetScope, detectOption);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 년도 별로 조회하여 geojson 파일 생성
|
||||||
|
*
|
||||||
|
* @param yearDtos
|
||||||
|
* @param year
|
||||||
|
* @param mapSheetScope
|
||||||
|
* @param detectOption
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private Scene getSceneInference(
|
||||||
|
List<MapSheetFallbackYearDto> yearDtos,
|
||||||
|
String year,
|
||||||
|
String mapSheetScope,
|
||||||
|
String detectOption) {
|
||||||
|
return mapSheetMngCoreService.getSceneInference(yearDtos, year, mapSheetScope, detectOption);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 분석결과 요약정보
|
* 분석결과 요약정보
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.kamco.cd.kamcoback.label;
|
package com.kamco.cd.kamcoback.label;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.common.download.RangeDownloadResponder;
|
||||||
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;
|
||||||
@@ -9,20 +10,35 @@ import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.WorkHistoryDto;
|
|||||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.UpdateClosedRequest;
|
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.UpdateClosedRequest;
|
||||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerListResponse;
|
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerListResponse;
|
||||||
import com.kamco.cd.kamcoback.label.service.LabelAllocateService;
|
import com.kamco.cd.kamcoback.label.service.LabelAllocateService;
|
||||||
|
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.searchReq;
|
||||||
import io.swagger.v3.oas.annotations.Hidden;
|
import io.swagger.v3.oas.annotations.Hidden;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.enums.ParameterIn;
|
||||||
import io.swagger.v3.oas.annotations.media.Content;
|
import io.swagger.v3.oas.annotations.media.Content;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
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.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.coyote.BadRequestException;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
|
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.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
@@ -37,6 +53,10 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
public class LabelAllocateApiController {
|
public class LabelAllocateApiController {
|
||||||
|
|
||||||
private final LabelAllocateService labelAllocateService;
|
private final LabelAllocateService labelAllocateService;
|
||||||
|
private final RangeDownloadResponder rangeDownloadResponder;
|
||||||
|
|
||||||
|
@Value("${file.dataset-response}")
|
||||||
|
private String responsePath;
|
||||||
|
|
||||||
@Operation(summary = "배정 가능한 사용자 목록 조회", description = "라벨링 작업 배정을 위한 활성 상태의 사용자 목록을 조회합니다.")
|
@Operation(summary = "배정 가능한 사용자 목록 조회", description = "라벨링 작업 배정을 위한 활성 상태의 사용자 목록을 조회합니다.")
|
||||||
@ApiResponses(
|
@ApiResponses(
|
||||||
@@ -333,4 +353,149 @@ public class LabelAllocateApiController {
|
|||||||
public ApiResponseDto<Long> labelingIngProcessCnt() {
|
public ApiResponseDto<Long> labelingIngProcessCnt() {
|
||||||
return ApiResponseDto.ok(labelAllocateService.findLabelingIngProcessCnt());
|
return ApiResponseDto.ok(labelAllocateService.findLabelingIngProcessCnt());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(
|
||||||
|
summary = "라벨 파일 다운로드",
|
||||||
|
description = "라벨 파일 다운로드",
|
||||||
|
parameters = {
|
||||||
|
@Parameter(
|
||||||
|
name = "kamco-download-uuid",
|
||||||
|
in = ParameterIn.HEADER,
|
||||||
|
required = true,
|
||||||
|
description = "다운로드 요청 UUID",
|
||||||
|
schema =
|
||||||
|
@Schema(
|
||||||
|
type = "string",
|
||||||
|
format = "uuid",
|
||||||
|
example = "6d8d49dc-0c9d-4124-adc7-b9ca610cc394"))
|
||||||
|
})
|
||||||
|
@ApiResponses(
|
||||||
|
value = {
|
||||||
|
@ApiResponse(
|
||||||
|
responseCode = "200",
|
||||||
|
description = "라벨 zip파일 다운로드",
|
||||||
|
content =
|
||||||
|
@Content(
|
||||||
|
mediaType = "application/octet-stream",
|
||||||
|
schema = @Schema(type = "string", format = "binary"))),
|
||||||
|
@ApiResponse(responseCode = "404", description = "파일 없음", content = @Content),
|
||||||
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
|
})
|
||||||
|
@GetMapping("/download/{uuid}")
|
||||||
|
public ResponseEntity<?> download(@PathVariable UUID uuid, HttpServletRequest request)
|
||||||
|
throws IOException {
|
||||||
|
|
||||||
|
String uid = labelAllocateService.findLearnUid(uuid);
|
||||||
|
Path zipPath = Paths.get(responsePath).resolve(uid + ".zip");
|
||||||
|
|
||||||
|
if (!Files.isRegularFile(zipPath)) {
|
||||||
|
throw new BadRequestException();
|
||||||
|
}
|
||||||
|
|
||||||
|
return rangeDownloadResponder.buildZipResponse(zipPath, uid + ".zip", request);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "라벨 파일 다운로드 이력 조회", description = "라벨 파일 다운로드 이력 조회")
|
||||||
|
@GetMapping(value = "/download-audit/{uuid}")
|
||||||
|
@ApiResponses(
|
||||||
|
value = {
|
||||||
|
@ApiResponse(
|
||||||
|
responseCode = "200",
|
||||||
|
description = "검색 성공",
|
||||||
|
content =
|
||||||
|
@Content(
|
||||||
|
mediaType = "application/json",
|
||||||
|
schema = @Schema(implementation = Page.class))),
|
||||||
|
@ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content),
|
||||||
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
|
})
|
||||||
|
public ApiResponseDto<Page<AuditLogDto.DownloadRes>> downloadAudit(
|
||||||
|
@Parameter(description = "UUID", example = "6d8d49dc-0c9d-4124-adc7-b9ca610cc394")
|
||||||
|
@PathVariable
|
||||||
|
UUID uuid,
|
||||||
|
// @Parameter(description = "다운로드일 시작", example = "2025-01-01") @RequestParam(required =
|
||||||
|
// false)
|
||||||
|
// LocalDate strtDttm,
|
||||||
|
// @Parameter(description = "다운로드일 종료", example = "2026-04-01") @RequestParam(required =
|
||||||
|
// false)
|
||||||
|
// LocalDate endDttm,
|
||||||
|
// @Parameter(description = "키워드", example = "") @RequestParam(required = false)
|
||||||
|
// String searchValue,
|
||||||
|
@Parameter(description = "페이지 번호 (0부터 시작)", example = "0") @RequestParam(defaultValue = "0")
|
||||||
|
int page,
|
||||||
|
@Parameter(description = "페이지 크기", example = "20") @RequestParam(defaultValue = "20")
|
||||||
|
int size) {
|
||||||
|
|
||||||
|
AuditLogDto.searchReq searchReq = new searchReq();
|
||||||
|
searchReq.setPage(page);
|
||||||
|
searchReq.setSize(size);
|
||||||
|
DownloadReq downloadReq = new DownloadReq();
|
||||||
|
downloadReq.setUuid(uuid);
|
||||||
|
// downloadReq.setStartDate(strtDttm);
|
||||||
|
// downloadReq.setEndDate(endDttm);
|
||||||
|
// downloadReq.setSearchValue(searchValue);
|
||||||
|
downloadReq.setRequestUri("/api/training-data/stage/download/" + uuid);
|
||||||
|
|
||||||
|
return ApiResponseDto.ok(labelAllocateService.getDownloadAudit(searchReq, downloadReq));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "다운로드 가능여부 조회", description = "다운로드 가능여부 조회 API")
|
||||||
|
@GetMapping(value = "/download-check/{uuid}")
|
||||||
|
@ApiResponses(
|
||||||
|
value = {
|
||||||
|
@ApiResponse(
|
||||||
|
responseCode = "200",
|
||||||
|
description = "검색 성공",
|
||||||
|
content =
|
||||||
|
@Content(
|
||||||
|
mediaType = "application/json",
|
||||||
|
schema = @Schema(implementation = Page.class))),
|
||||||
|
@ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content),
|
||||||
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
|
})
|
||||||
|
public ApiResponseDto<Boolean> isDownloadable(
|
||||||
|
@Parameter(description = "UUID", example = "6d8d49dc-0c9d-4124-adc7-b9ca610cc394")
|
||||||
|
@PathVariable
|
||||||
|
UUID uuid) {
|
||||||
|
return ApiResponseDto.ok(labelAllocateService.isDownloadable(uuid));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(
|
||||||
|
summary = "라벨링작업 관리 > 추가 작업 배정(실태조사 추가되면)",
|
||||||
|
description = "라벨링작업 관리 > 추가 작업 배정(실태조사 추가되면)")
|
||||||
|
@ApiResponses(
|
||||||
|
value = {
|
||||||
|
@ApiResponse(
|
||||||
|
responseCode = "201",
|
||||||
|
description = "등록 성공",
|
||||||
|
content =
|
||||||
|
@Content(
|
||||||
|
mediaType = "application/json",
|
||||||
|
schema = @Schema(implementation = Long.class))),
|
||||||
|
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
|
||||||
|
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||||
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
|
})
|
||||||
|
@PostMapping("/allocate-add-stblt")
|
||||||
|
public ApiResponseDto<ApiResponseDto.ResponseObj> labelAllocateAddStblt(
|
||||||
|
@RequestBody @Valid LabelAllocateDto.AllocateAddStbltDto dto) {
|
||||||
|
|
||||||
|
return ApiResponseDto.okObject(
|
||||||
|
labelAllocateService.allocateAddStbltYn(
|
||||||
|
dto.getTotalCnt(), dto.getUuid(), dto.getLabelers(), dto.getBaseDate()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "라벨링 추가 할당 가능한 건수", description = "라벨링 추가 할당 가능한 건수 API")
|
||||||
|
@ApiResponses(
|
||||||
|
value = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "조회 성공"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음"),
|
||||||
|
@ApiResponse(responseCode = "500", description = "서버 오류")
|
||||||
|
})
|
||||||
|
@GetMapping("/allocate-add-cnt")
|
||||||
|
public ApiResponseDto<Long> allocateAddCnt(
|
||||||
|
@RequestParam UUID uuid, @RequestParam LocalDate baseDate) {
|
||||||
|
|
||||||
|
return ApiResponseDto.ok(labelAllocateService.findAllocateAddCnt(uuid, baseDate));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.kamco.cd.kamcoback.label.dto;
|
|||||||
import com.kamco.cd.kamcoback.common.utils.enums.CodeExpose;
|
import com.kamco.cd.kamcoback.common.utils.enums.CodeExpose;
|
||||||
import com.kamco.cd.kamcoback.common.utils.enums.EnumType;
|
import com.kamco.cd.kamcoback.common.utils.enums.EnumType;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@@ -359,4 +360,41 @@ public class LabelAllocateDto {
|
|||||||
@Schema(description = "작업기간 종료일")
|
@Schema(description = "작업기간 종료일")
|
||||||
private ZonedDateTime projectCloseDttm;
|
private ZonedDateTime projectCloseDttm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public static class InferenceLearnDto {
|
||||||
|
|
||||||
|
private UUID analUuid;
|
||||||
|
private String learnUid;
|
||||||
|
private String analState;
|
||||||
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,25 +16,29 @@ import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.searchReq;
|
|||||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.ProjectInfo;
|
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.ProjectInfo;
|
||||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkProgressInfo;
|
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkProgressInfo;
|
||||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerListResponse;
|
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerListResponse;
|
||||||
|
import com.kamco.cd.kamcoback.log.dto.AuditLogDto;
|
||||||
|
import com.kamco.cd.kamcoback.log.dto.AuditLogDto.DownloadReq;
|
||||||
|
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;
|
||||||
|
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
|
||||||
public class LabelAllocateService {
|
public class LabelAllocateService {
|
||||||
|
|
||||||
private final LabelAllocateCoreService labelAllocateCoreService;
|
private final LabelAllocateCoreService labelAllocateCoreService;
|
||||||
|
private final AuditLogCoreService auditLogCoreService;
|
||||||
public LabelAllocateService(LabelAllocateCoreService labelAllocateCoreService) {
|
|
||||||
this.labelAllocateCoreService = labelAllocateCoreService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 도엽 기준 asc sorting 해서 할당 수만큼 배정하는 로직
|
* 도엽 기준 asc sorting 해서 할당 수만큼 배정하는 로직
|
||||||
@@ -273,4 +277,78 @@ public class LabelAllocateService {
|
|||||||
public Long findLabelingIngProcessCnt() {
|
public Long findLabelingIngProcessCnt() {
|
||||||
return labelAllocateCoreService.findLabelingIngProcessCnt();
|
return labelAllocateCoreService.findLabelingIngProcessCnt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(propagation = Propagation.NOT_SUPPORTED)
|
||||||
|
public String findLearnUid(UUID uuid) {
|
||||||
|
return labelAllocateCoreService.findLearnUid(uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 다운로드 이력 조회
|
||||||
|
*
|
||||||
|
* @param searchReq 페이징
|
||||||
|
* @param downloadReq 조회조건
|
||||||
|
*/
|
||||||
|
public Page<AuditLogDto.DownloadRes> getDownloadAudit(
|
||||||
|
AuditLogDto.searchReq searchReq, DownloadReq downloadReq) {
|
||||||
|
return auditLogCoreService.findLogByAccount(searchReq, downloadReq);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 다운로드 가능 여부 조회
|
||||||
|
*
|
||||||
|
* @param uuid
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean isDownloadable(UUID 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,11 @@ import lombok.Setter;
|
|||||||
|
|
||||||
public class LayerDto {
|
public class LayerDto {
|
||||||
|
|
||||||
|
public enum MapType {
|
||||||
|
CHANGE_MAP,
|
||||||
|
LABELING_MAP
|
||||||
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@@ -26,6 +31,9 @@ public class LayerDto {
|
|||||||
@Schema(description = "uuid")
|
@Schema(description = "uuid")
|
||||||
private UUID uuid;
|
private UUID uuid;
|
||||||
|
|
||||||
|
@Schema(description = "레이어명")
|
||||||
|
private String layerName;
|
||||||
|
|
||||||
@Schema(example = "WMTS", description = "유형 (TILE/GEOJSON/WMTS/WMS)")
|
@Schema(example = "WMTS", description = "유형 (TILE/GEOJSON/WMTS/WMS)")
|
||||||
private String layerType;
|
private String layerType;
|
||||||
|
|
||||||
@@ -58,6 +66,9 @@ public class LayerDto {
|
|||||||
@Schema(description = "uuid")
|
@Schema(description = "uuid")
|
||||||
private UUID uuid;
|
private UUID uuid;
|
||||||
|
|
||||||
|
@Schema(description = "레이어명")
|
||||||
|
private String layerName;
|
||||||
|
|
||||||
@Schema(description = "유형 (TILE/GEOJSON/WMTS/WMS)")
|
@Schema(description = "유형 (TILE/GEOJSON/WMTS/WMS)")
|
||||||
private String layerType;
|
private String layerType;
|
||||||
|
|
||||||
@@ -103,6 +114,9 @@ public class LayerDto {
|
|||||||
@JsonFormatDttm
|
@JsonFormatDttm
|
||||||
@Schema(description = "등록일시")
|
@Schema(description = "등록일시")
|
||||||
private ZonedDateTime createdDttm;
|
private ZonedDateTime createdDttm;
|
||||||
|
|
||||||
|
@Schema(description = "좌표계")
|
||||||
|
private String crs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -111,6 +125,9 @@ public class LayerDto {
|
|||||||
@Schema(name = "LayerAddReq")
|
@Schema(name = "LayerAddReq")
|
||||||
public static class AddReq {
|
public static class AddReq {
|
||||||
|
|
||||||
|
@Schema(description = "레이어명")
|
||||||
|
private String layerName;
|
||||||
|
|
||||||
@Schema(description = "title WMS, WMTS 선택한 tile")
|
@Schema(description = "title WMS, WMTS 선택한 tile")
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
@@ -140,6 +157,9 @@ public class LayerDto {
|
|||||||
|
|
||||||
@Schema(description = "zoom max", example = "18")
|
@Schema(description = "zoom max", example = "18")
|
||||||
private Short max;
|
private Short max;
|
||||||
|
|
||||||
|
@Schema(description = "좌표계", example = "EPSG_3857")
|
||||||
|
private String crs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -204,6 +224,9 @@ public class LayerDto {
|
|||||||
@Schema(name = "LayerMapDto")
|
@Schema(name = "LayerMapDto")
|
||||||
public static class LayerMapDto {
|
public static class LayerMapDto {
|
||||||
|
|
||||||
|
@Schema(description = "레이어명")
|
||||||
|
private String layerName;
|
||||||
|
|
||||||
@Schema(example = "WMTS", description = "유형 (TILE/GEOJSON/WMTS/WMS)")
|
@Schema(example = "WMTS", description = "유형 (TILE/GEOJSON/WMTS/WMS)")
|
||||||
private String layerType;
|
private String layerType;
|
||||||
|
|
||||||
@@ -253,7 +276,11 @@ public class LayerDto {
|
|||||||
@Schema(description = "rawJson")
|
@Schema(description = "rawJson")
|
||||||
private JsonNode rawJson;
|
private JsonNode rawJson;
|
||||||
|
|
||||||
|
@Schema(description = "crs")
|
||||||
|
private String crs;
|
||||||
|
|
||||||
public LayerMapDto(
|
public LayerMapDto(
|
||||||
|
String layerName,
|
||||||
String layerType,
|
String layerType,
|
||||||
String tag,
|
String tag,
|
||||||
Long sortOrder,
|
Long sortOrder,
|
||||||
@@ -266,7 +293,9 @@ public class LayerDto {
|
|||||||
Short maxZoom,
|
Short maxZoom,
|
||||||
String bboxGeometry,
|
String bboxGeometry,
|
||||||
UUID uuid,
|
UUID uuid,
|
||||||
String rawJsonString) {
|
String rawJsonString,
|
||||||
|
String crs) {
|
||||||
|
this.layerName = layerName;
|
||||||
this.layerType = layerType;
|
this.layerType = layerType;
|
||||||
this.tag = tag;
|
this.tag = tag;
|
||||||
this.sortOrder = sortOrder;
|
this.sortOrder = sortOrder;
|
||||||
@@ -302,6 +331,7 @@ public class LayerDto {
|
|||||||
|
|
||||||
this.rawJson = rawJson;
|
this.rawJson = rawJson;
|
||||||
this.bbox = geoJson;
|
this.bbox = geoJson;
|
||||||
|
this.crs = crs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonProperty("workspace")
|
@JsonProperty("workspace")
|
||||||
@@ -348,6 +378,8 @@ public class LayerDto {
|
|||||||
|
|
||||||
@JsonIgnore private String bboxGeometry;
|
@JsonIgnore private String bboxGeometry;
|
||||||
|
|
||||||
|
private String crs;
|
||||||
|
|
||||||
public TileUrlDto(
|
public TileUrlDto(
|
||||||
Integer mngYyyy,
|
Integer mngYyyy,
|
||||||
String url,
|
String url,
|
||||||
@@ -358,7 +390,8 @@ public class LayerDto {
|
|||||||
BigDecimal maxLat,
|
BigDecimal maxLat,
|
||||||
Short minZoom,
|
Short minZoom,
|
||||||
Short maxZoom,
|
Short maxZoom,
|
||||||
String bboxGeometry) {
|
String bboxGeometry,
|
||||||
|
String crs) {
|
||||||
this.mngYyyy = mngYyyy;
|
this.mngYyyy = mngYyyy;
|
||||||
this.url = url;
|
this.url = url;
|
||||||
this.tag = tag;
|
this.tag = tag;
|
||||||
@@ -382,6 +415,7 @@ public class LayerDto {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.bbox = geoJson;
|
this.bbox = geoJson;
|
||||||
|
this.crs = crs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -402,15 +436,11 @@ public class LayerDto {
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public static class IsMapYn {
|
public static class IsMapYn {
|
||||||
|
|
||||||
@Schema(description = "CHANGE_MAP(변화지도), LABELING_MAP(라벨링지도)", example = "CHANGE_MAP")
|
@Schema(description = "CHANGE_MAP(변화지도), LABELING_MAP(라벨링지도)", example = "CHANGE_MAP")
|
||||||
private String mapType;
|
private String mapType;
|
||||||
|
|
||||||
@Schema(description = "노출여부 true, false", example = "true")
|
@Schema(description = "노출여부 true, false", example = "true")
|
||||||
private Boolean isMapYn;
|
private Boolean isMapYn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum MapType {
|
|
||||||
CHANGE_MAP,
|
|
||||||
LABELING_MAP
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,5 +26,6 @@ public class WmsDto {
|
|||||||
private String title;
|
private String title;
|
||||||
private String description;
|
private String description;
|
||||||
private String tag;
|
private String tag;
|
||||||
|
private String layerName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,5 +26,6 @@ public class WmtsDto {
|
|||||||
private String title;
|
private String title;
|
||||||
private String description;
|
private String description;
|
||||||
private String tag;
|
private String tag;
|
||||||
|
private String layerName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,10 +97,10 @@ public class WmtsLayerInfo {
|
|||||||
private String identifier;
|
private String identifier;
|
||||||
private String scaleDenominator;
|
private String scaleDenominator;
|
||||||
private String topLeftCorner;
|
private String topLeftCorner;
|
||||||
private String tileWidth;
|
// private String tileWidth;
|
||||||
private String tileHeight;
|
// private String tileHeight;
|
||||||
private String matrixWidth;
|
// private String matrixWidth;
|
||||||
private String matrixHeight;
|
// private String matrixHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** TileMatrixSetLink 정보를 담는 내부 클래스 */
|
/** TileMatrixSetLink 정보를 담는 내부 클래스 */
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import com.kamco.cd.kamcoback.layer.dto.LayerDto.LayerMapDto;
|
|||||||
import com.kamco.cd.kamcoback.layer.dto.LayerDto.OrderReq;
|
import com.kamco.cd.kamcoback.layer.dto.LayerDto.OrderReq;
|
||||||
import com.kamco.cd.kamcoback.layer.dto.LayerDto.TileUrlDto;
|
import com.kamco.cd.kamcoback.layer.dto.LayerDto.TileUrlDto;
|
||||||
import com.kamco.cd.kamcoback.layer.dto.WmsDto.WmsAddDto;
|
import com.kamco.cd.kamcoback.layer.dto.WmsDto.WmsAddDto;
|
||||||
import com.kamco.cd.kamcoback.layer.dto.WmsDto.WmsAddReqDto;
|
|
||||||
import com.kamco.cd.kamcoback.layer.dto.WmsLayerInfo;
|
import com.kamco.cd.kamcoback.layer.dto.WmsLayerInfo;
|
||||||
import com.kamco.cd.kamcoback.layer.dto.WmtsDto.WmtsAddDto;
|
import com.kamco.cd.kamcoback.layer.dto.WmtsDto.WmtsAddDto;
|
||||||
import com.kamco.cd.kamcoback.layer.dto.WmtsLayerInfo;
|
import com.kamco.cd.kamcoback.layer.dto.WmtsLayerInfo;
|
||||||
@@ -17,6 +16,7 @@ import com.kamco.cd.kamcoback.postgres.core.MapLayerCoreService;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -30,6 +30,15 @@ public class LayerService {
|
|||||||
private final WmtsService wmtsService;
|
private final WmtsService wmtsService;
|
||||||
private final WmsService wmsService;
|
private final WmsService wmsService;
|
||||||
|
|
||||||
|
@Value("${layer.geoserver-url}")
|
||||||
|
private String geoserverUrl;
|
||||||
|
|
||||||
|
@Value("${layer.wms-path}")
|
||||||
|
private String wmsPath;
|
||||||
|
|
||||||
|
@Value("${layer.wmts-path}")
|
||||||
|
private String wmtsPath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 지도 레이어 관리 목록
|
* 지도 레이어 관리 목록
|
||||||
*
|
*
|
||||||
@@ -58,7 +67,7 @@ public class LayerService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case GEOJSON -> {
|
case GEOJSON -> {
|
||||||
mapLayerCoreService.saveGeoJson(dto);
|
return mapLayerCoreService.saveGeoJson(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
case WMTS -> {
|
case WMTS -> {
|
||||||
@@ -69,6 +78,7 @@ public class LayerService {
|
|||||||
addDto.setDescription(dto.getDescription());
|
addDto.setDescription(dto.getDescription());
|
||||||
addDto.setTitle(dto.getTitle());
|
addDto.setTitle(dto.getTitle());
|
||||||
addDto.setTag(dto.getTag());
|
addDto.setTag(dto.getTag());
|
||||||
|
addDto.setLayerName(dto.getLayerName());
|
||||||
return mapLayerCoreService.saveWmts(addDto);
|
return mapLayerCoreService.saveWmts(addDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,12 +89,12 @@ public class LayerService {
|
|||||||
addDto.setDescription(dto.getDescription());
|
addDto.setDescription(dto.getDescription());
|
||||||
addDto.setTitle(dto.getTitle());
|
addDto.setTitle(dto.getTitle());
|
||||||
addDto.setTag(dto.getTag());
|
addDto.setTag(dto.getTag());
|
||||||
|
addDto.setLayerName(dto.getLayerName());
|
||||||
return mapLayerCoreService.saveWms(addDto);
|
return mapLayerCoreService.saveWms(addDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
default -> throw new CustomApiException("BAD_REQUEST", HttpStatus.BAD_REQUEST);
|
default -> throw new CustomApiException("BAD_REQUEST", HttpStatus.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -156,26 +166,32 @@ public class LayerService {
|
|||||||
return wmsService.getTile();
|
return wmsService.getTile();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public List<LayerMapDto> findLayerMapList(String type) {
|
||||||
* wms 저장
|
List<LayerMapDto> layerMapDtoList = mapLayerCoreService.findLayerMapList(type);
|
||||||
*
|
layerMapDtoList.forEach(
|
||||||
* @param dto
|
dto -> {
|
||||||
* @return
|
if (dto.getLayerType().equals("WMS")) {
|
||||||
*/
|
dto.setUrl(
|
||||||
@Transactional
|
String.format(
|
||||||
public UUID saveWms(WmsAddReqDto dto) {
|
"%s/%s/%s",
|
||||||
// 선택한 tile 상세정보 조회
|
trimSlash(geoserverUrl), trimSlash(wmsPath), dto.getLayerType().toLowerCase()));
|
||||||
WmsLayerInfo info = wmsService.getDetail(dto.getTitle());
|
} else if (dto.getLayerType().equals("WMTS")) {
|
||||||
WmsAddDto addDto = new WmsAddDto();
|
dto.setUrl(
|
||||||
addDto.setWmsLayerInfo(info);
|
String.format(
|
||||||
addDto.setDescription(dto.getDescription());
|
"%s/%s/%s",
|
||||||
addDto.setTitle(dto.getTitle());
|
trimSlash(geoserverUrl),
|
||||||
addDto.setTag(dto.getTag());
|
trimSlash(wmtsPath),
|
||||||
return mapLayerCoreService.saveWms(addDto);
|
dto.getLayerType().toLowerCase()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return layerMapDtoList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<LayerMapDto> findLayerMapList(String type) {
|
private String trimSlash(String s) {
|
||||||
return mapLayerCoreService.findLayerMapList(type);
|
if (s == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return s.replaceAll("/+$", "").replaceAll("^/+", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public LayerDto.YearTileDto getChangeDetectionTileUrl(Integer beforeYear, Integer afterYear) {
|
public LayerDto.YearTileDto getChangeDetectionTileUrl(Integer beforeYear, Integer afterYear) {
|
||||||
|
|||||||
@@ -103,6 +103,9 @@ public class MapSheetMngDto {
|
|||||||
@Schema(description = "tag")
|
@Schema(description = "tag")
|
||||||
private String tag;
|
private String tag;
|
||||||
|
|
||||||
|
@Schema(description = "crs 좌표계")
|
||||||
|
private String crs;
|
||||||
|
|
||||||
@JsonIgnore private Long createdUid;
|
@JsonIgnore private Long createdUid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,11 +184,14 @@ public class MapSheetMngDto {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public long getSyncErrorTotCnt() {
|
public long getSyncErrorTotCnt() {
|
||||||
return this.syncNotPaireCnt + this.syncDuplicateCnt + this.syncFaultCnt;
|
return this.syncNotPaireCnt + this.syncDuplicateCnt + this.syncFaultCnt + this.syncNoFileCnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getSyncErrorExecTotCnt() {
|
public long getSyncErrorExecTotCnt() {
|
||||||
return this.syncNotPaireExecCnt + this.syncDuplicateExecCnt + this.syncFaultExecCnt;
|
return this.syncNotPaireExecCnt
|
||||||
|
+ this.syncDuplicateExecCnt
|
||||||
|
+ this.syncFaultExecCnt
|
||||||
|
+ this.syncNoFileExecCnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMngState() {
|
public String getMngState() {
|
||||||
|
|||||||
@@ -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,8 +135,8 @@ public class MapSheetMngService {
|
|||||||
return dmlReturn;
|
return dmlReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO 삭제?
|
||||||
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) {
|
||||||
@@ -337,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();
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import com.kamco.cd.kamcoback.members.dto.MembersDto;
|
|||||||
import com.kamco.cd.kamcoback.members.dto.MembersDto.Basic;
|
import com.kamco.cd.kamcoback.members.dto.MembersDto.Basic;
|
||||||
import com.kamco.cd.kamcoback.members.service.AdminService;
|
import com.kamco.cd.kamcoback.members.service.AdminService;
|
||||||
import com.kamco.cd.kamcoback.members.service.MembersService;
|
import com.kamco.cd.kamcoback.members.service.MembersService;
|
||||||
import com.kamco.cd.kamcoback.scheduler.service.MemberInactiveJobService;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.media.Content;
|
import io.swagger.v3.oas.annotations.media.Content;
|
||||||
@@ -35,7 +34,6 @@ public class MembersApiController {
|
|||||||
|
|
||||||
private final MembersService membersService;
|
private final MembersService membersService;
|
||||||
private final AdminService adminService;
|
private final AdminService adminService;
|
||||||
private final MemberInactiveJobService memberInactiveJobService;
|
|
||||||
|
|
||||||
@Operation(summary = "회원정보 목록", description = "회원정보 조회")
|
@Operation(summary = "회원정보 목록", description = "회원정보 조회")
|
||||||
@ApiResponses(
|
@ApiResponses(
|
||||||
@@ -159,13 +157,4 @@ public class MembersApiController {
|
|||||||
String employeeNo) {
|
String employeeNo) {
|
||||||
return ApiResponseDto.ok(adminService.existsByEmployeeNo(employeeNo));
|
return ApiResponseDto.ok(adminService.existsByEmployeeNo(employeeNo));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(
|
|
||||||
summary = "라벨러/검수자 최종로그인 28일 경과 이후 사용중지(스케줄링 실행)",
|
|
||||||
description = "라벨러/검수자 최종로그인 28일 경과 이후 사용중지 처리")
|
|
||||||
@GetMapping("/member-inactive-job")
|
|
||||||
public ApiResponseDto<Void> memberInactiveJob() {
|
|
||||||
memberInactiveJobService.memberActive28daysToInactive();
|
|
||||||
return ApiResponseDto.ok(null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,8 +111,8 @@ public class MembersDto {
|
|||||||
@EnumValid(enumClass = RoleType.class, message = "userRole은 ADMIN, LABELER, REVIEWER 만 가능합니다.")
|
@EnumValid(enumClass = RoleType.class, message = "userRole은 ADMIN, LABELER, REVIEWER 만 가능합니다.")
|
||||||
private String userRole;
|
private String userRole;
|
||||||
|
|
||||||
@Schema(description = "사번", example = "K20251212001")
|
@Schema(description = "사번", example = "123456")
|
||||||
@Size(max = 50)
|
@Size(max = 6)
|
||||||
private String employeeNo;
|
private String employeeNo;
|
||||||
|
|
||||||
@Schema(description = "이름", example = "홍길동")
|
@Schema(description = "이름", example = "홍길동")
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import lombok.ToString;
|
|||||||
@ToString(exclude = "password")
|
@ToString(exclude = "password")
|
||||||
public class SignInRequest {
|
public class SignInRequest {
|
||||||
|
|
||||||
@Schema(description = "사용자 ID", example = "1234567")
|
@Schema(description = "사용자 ID", example = "123456")
|
||||||
private String username;
|
private String username;
|
||||||
|
|
||||||
@Schema(description = "비밀번호", example = "qwe123!@#")
|
@Schema(description = "비밀번호", example = "qwe123!@#")
|
||||||
|
|||||||
@@ -9,8 +9,10 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
@Transactional(readOnly = true)
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class MenuService {
|
public class MenuService {
|
||||||
|
|
||||||
|
|||||||
@@ -41,21 +41,6 @@ public class ModelMngApiController {
|
|||||||
|
|
||||||
private final ModelMngService modelMngService;
|
private final ModelMngService modelMngService;
|
||||||
|
|
||||||
@Value("${file.sync-root-dir}")
|
|
||||||
private String syncRootDir;
|
|
||||||
|
|
||||||
@Value("${file.sync-tmp-dir}")
|
|
||||||
private String syncTmpDir;
|
|
||||||
|
|
||||||
@Value("${file.sync-file-extention}")
|
|
||||||
private String syncFileExtention;
|
|
||||||
|
|
||||||
@Value("${file.dataset-dir}")
|
|
||||||
private String datasetDir;
|
|
||||||
|
|
||||||
@Value("${file.dataset-tmp-dir}")
|
|
||||||
private String datasetTmpDir;
|
|
||||||
|
|
||||||
@Value("${file.model-dir}")
|
@Value("${file.model-dir}")
|
||||||
private String modelDir;
|
private String modelDir;
|
||||||
|
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ public class ModelMngDto {
|
|||||||
@Getter
|
@Getter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum ModelType implements EnumType {
|
public enum ModelType implements EnumType {
|
||||||
M1("모델 M1"),
|
G1("G1"),
|
||||||
M2("모델 M2"),
|
G2("G2"),
|
||||||
M3("모델 M3");
|
G3("G3");
|
||||||
|
|
||||||
private final String desc;
|
private final String desc;
|
||||||
|
|
||||||
|
|||||||
@@ -35,27 +35,6 @@ public class ModelMngService {
|
|||||||
|
|
||||||
private final UploadService uploadService;
|
private final UploadService uploadService;
|
||||||
|
|
||||||
@Value("${file.sync-root-dir}")
|
|
||||||
private String syncRootDir;
|
|
||||||
|
|
||||||
@Value("${file.sync-tmp-dir}")
|
|
||||||
private String syncTmpDir;
|
|
||||||
|
|
||||||
@Value("${file.sync-file-extention}")
|
|
||||||
private String syncFileExtention;
|
|
||||||
|
|
||||||
@Value("${file.dataset-dir}")
|
|
||||||
private String datasetDir;
|
|
||||||
|
|
||||||
@Value("${file.dataset-tmp-dir}")
|
|
||||||
private String datasetTmpDir;
|
|
||||||
|
|
||||||
@Value("${file.model-dir}")
|
|
||||||
private String modelDir;
|
|
||||||
|
|
||||||
@Value("${file.model-tmp-dir}")
|
|
||||||
private String modelTmpDir;
|
|
||||||
|
|
||||||
@Value("${file.pt-path}")
|
@Value("${file.pt-path}")
|
||||||
private String ptPath;
|
private String ptPath;
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto;
|
|||||||
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapScaleType;
|
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapScaleType;
|
||||||
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapSheetList;
|
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapSheetList;
|
||||||
import com.kamco.cd.kamcoback.common.enums.DetectionClassification;
|
import com.kamco.cd.kamcoback.common.enums.DetectionClassification;
|
||||||
|
import com.kamco.cd.kamcoback.common.exception.CustomApiException;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataInferenceGeomEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataInferenceGeomEntity;
|
||||||
import com.kamco.cd.kamcoback.postgres.repository.changedetection.ChangeDetectionRepository;
|
import com.kamco.cd.kamcoback.postgres.repository.changedetection.ChangeDetectionRepository;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -15,6 +16,7 @@ import java.util.stream.Collectors;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.locationtech.jts.geom.Geometry;
|
import org.locationtech.jts.geom.Geometry;
|
||||||
import org.locationtech.jts.geom.Point;
|
import org.locationtech.jts.geom.Point;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@@ -96,4 +98,42 @@ public class ChangeDetectionCoreService {
|
|||||||
public List<MapSheetList> getChangeDetectionMapSheet50kList(UUID uuid) {
|
public List<MapSheetList> getChangeDetectionMapSheet50kList(UUID uuid) {
|
||||||
return changeDetectionRepository.getChangeDetectionMapSheet50kList(uuid);
|
return changeDetectionRepository.getChangeDetectionMapSheet50kList(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 선택 폴리곤 조회 by object id
|
||||||
|
*
|
||||||
|
* @param chnDtctId 회차 uid 32자
|
||||||
|
* @param cdObjectId geo object uid 32자
|
||||||
|
* @param cdObjectIds geo object uids 32자
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public ChangeDetectionDto.PolygonFeatureList getPolygonListByCd(
|
||||||
|
String chnDtctId, String cdObjectId, List<String> cdObjectIds) {
|
||||||
|
return changeDetectionRepository.getPolygonListByCd(chnDtctId, cdObjectId, cdObjectIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 선택 Point 조회 by object id
|
||||||
|
*
|
||||||
|
* @param chnDtctId 회차 uid 32자
|
||||||
|
* @param cdObjectId geo object uid 32자
|
||||||
|
* @param cdObjectIds geo object uids 32자
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public ChangeDetectionDto.PointFeatureList getPointListByCd(
|
||||||
|
String chnDtctId, String cdObjectId, List<String> cdObjectIds) {
|
||||||
|
return changeDetectionRepository.getPointListByCd(chnDtctId, cdObjectId, cdObjectIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* learn uuid 조회
|
||||||
|
*
|
||||||
|
* @param chnDtctId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public UUID getLearnUuid(String chnDtctId) {
|
||||||
|
return changeDetectionRepository
|
||||||
|
.getLearnUuid(chnDtctId)
|
||||||
|
.orElseThrow(() -> new CustomApiException("NOT_FOUND_DATA", HttpStatus.NOT_FOUND));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ public class GukYuinCoreService {
|
|||||||
gukYuinRepository.updateGukYuinMastRegResult(resultBody);
|
gukYuinRepository.updateGukYuinMastRegResult(resultBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateGukYuinMastRegRemove(Basic resultBody) {
|
public void updateGukYuinMastRegRemove(String chnDtctId) {
|
||||||
gukYuinRepository.updateGukYuinMastRegRemove(resultBody);
|
gukYuinRepository.updateGukYuinMastRegRemove(chnDtctId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateInferenceGeomDataPnuCnt(String chnDtctObjtId, long pnuCnt) {
|
public void updateInferenceGeomDataPnuCnt(String chnDtctObjtId, long pnuCnt) {
|
||||||
@@ -45,8 +45,8 @@ public class GukYuinCoreService {
|
|||||||
return gukYuinRepository.findMapSheetAnalDataInferenceGeomUid(chnDtctObjtId);
|
return gukYuinRepository.findMapSheetAnalDataInferenceGeomUid(chnDtctObjtId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void insertGeoUidPnuData(Long geoUid, String[] pnuList) {
|
public void insertGeoUidPnuData(Long geoUid, String[] pnuList, String chnDtctObjtId) {
|
||||||
gukYuinRepository.insertGeoUidPnuData(geoUid, pnuList);
|
gukYuinRepository.insertGeoUidPnuData(geoUid, pnuList, chnDtctObjtId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LearnInfo findMapSheetLearnInfo(UUID uuid) {
|
public LearnInfo findMapSheetLearnInfo(UUID uuid) {
|
||||||
@@ -64,4 +64,17 @@ public class GukYuinCoreService {
|
|||||||
public List<LabelSendDto> findLabelingCompleteSendList(LocalDate yesterday) {
|
public List<LabelSendDto> findLabelingCompleteSendList(LocalDate yesterday) {
|
||||||
return gukYuinRepository.findLabelingCompleteSendList(yesterday);
|
return gukYuinRepository.findLabelingCompleteSendList(yesterday);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long findMapSheetLearnInfoByYyyy(
|
||||||
|
Integer compareYyyy, Integer targetYyyy, Integer maxStage) {
|
||||||
|
return gukYuinRepository.findMapSheetLearnInfoByYyyy(compareYyyy, targetYyyy, maxStage);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateMapSheetLearnGukyuinEndStatus(Long learnId) {
|
||||||
|
gukYuinRepository.updateMapSheetLearnGukyuinEndStatus(learnId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateMapSheetInferenceLabelEndStatus(Long learnId) {
|
||||||
|
gukYuinRepository.updateMapSheetInferenceLabelEndStatus(learnId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.core;
|
package com.kamco.cd.kamcoback.postgres.core;
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GeomUidDto;
|
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
||||||
import com.kamco.cd.kamcoback.postgres.repository.gukyuin.GukYuinRepository;
|
import com.kamco.cd.kamcoback.postgres.repository.gukyuin.GukYuinRepository;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class GukYuinJobCoreService {
|
public class GukYuinJobCoreService {
|
||||||
@@ -16,6 +16,7 @@ public class GukYuinJobCoreService {
|
|||||||
this.gukYuinRepository = gukYuinRepository;
|
this.gukYuinRepository = gukYuinRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
public void updateGukYuinApplyStateComplete(Long id, GukYuinStatus status) {
|
public void updateGukYuinApplyStateComplete(Long id, GukYuinStatus status) {
|
||||||
gukYuinRepository.updateGukYuinApplyStateComplete(id, status);
|
gukYuinRepository.updateGukYuinApplyStateComplete(id, status);
|
||||||
}
|
}
|
||||||
@@ -23,16 +24,4 @@ public class GukYuinJobCoreService {
|
|||||||
public List<LearnKeyDto> findGukyuinApplyStatusUidList(List<String> gukYuinStatus) {
|
public List<LearnKeyDto> findGukyuinApplyStatusUidList(List<String> gukYuinStatus) {
|
||||||
return gukYuinRepository.findGukyuinApplyStatusUidList(gukYuinStatus);
|
return gukYuinRepository.findGukyuinApplyStatusUidList(gukYuinStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long upsertMapSheetDataAnalGeomPnu(String chnDtctObjtId, String[] pnuList) {
|
|
||||||
return gukYuinRepository.upsertMapSheetDataAnalGeomPnu(chnDtctObjtId, pnuList);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<GeomUidDto> findYesterdayLabelingCompleteList() {
|
|
||||||
return gukYuinRepository.findYesterdayLabelingCompleteList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateAnalDataInferenceGeomSendDttm(Long geoUid) {
|
|
||||||
gukYuinRepository.updateAnalDataInferenceGeomSendDttm(geoUid);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.core;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GeomUidDto;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.repository.gukyuin.GukYuinLabelJobRepository;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class GukYuinLabelJobCoreService {
|
||||||
|
|
||||||
|
private final GukYuinLabelJobRepository gukYuinLabelRepository;
|
||||||
|
|
||||||
|
public GukYuinLabelJobCoreService(GukYuinLabelJobRepository gukYuinLabelRepository) {
|
||||||
|
this.gukYuinLabelRepository = gukYuinLabelRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<GeomUidDto> findYesterdayLabelingCompleteList(LocalDate baseDate) {
|
||||||
|
return gukYuinLabelRepository.findYesterdayLabelingCompleteList(baseDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void updateAnalDataInferenceGeomSendDttm(Long geoUid) {
|
||||||
|
gukYuinLabelRepository.updateAnalDataInferenceGeomSendDttm(geoUid);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.core;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.repository.gukyuin.GukYuinPnuJobRepository;
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class GukYuinPnuJobCoreService {
|
||||||
|
|
||||||
|
private final GukYuinPnuJobRepository gukYuinPnuRepository;
|
||||||
|
|
||||||
|
public GukYuinPnuJobCoreService(GukYuinPnuJobRepository gukYuinPnuRepository) {
|
||||||
|
this.gukYuinPnuRepository = gukYuinPnuRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateGukYuinApplyStateComplete(Long id, GukYuinStatus status) {
|
||||||
|
gukYuinPnuRepository.updateGukYuinApplyStateComplete(id, status);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<LearnKeyDto> findGukyuinApplyStatusUidList(List<String> gukYuinStatus) {
|
||||||
|
return gukYuinPnuRepository.findGukyuinApplyStatusUidList(gukYuinStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long upsertMapSheetDataAnalGeomPnu(String chnDtctObjtId, String[] pnuList) {
|
||||||
|
return gukYuinPnuRepository.upsertMapSheetDataAnalGeomPnu(chnDtctObjtId, pnuList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void updateInferenceGeomDataPnuCnt(String chnDtctObjtId, long pnuCnt) {
|
||||||
|
gukYuinPnuRepository.updateInferenceGeomDataPnuCnt(chnDtctObjtId, pnuCnt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long findMapSheetAnalDataInferenceGeomUid(String chnDtctObjtId) {
|
||||||
|
return gukYuinPnuRepository.findMapSheetAnalDataInferenceGeomUid(chnDtctObjtId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void insertGeoUidPnuData(Long geoUid, String[] pnuList, String chnDtctObjtId) {
|
||||||
|
gukYuinPnuRepository.insertGeoUidPnuData(geoUid, pnuList, chnDtctObjtId);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.core;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.StbltResult;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.RlbDtctMastDto;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.PnuEntity;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.repository.gukyuin.GukYuinStbltJobRepository;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class GukYuinStbltJobCoreService {
|
||||||
|
|
||||||
|
private final GukYuinStbltJobRepository gukYuinStbltRepository;
|
||||||
|
|
||||||
|
public GukYuinStbltJobCoreService(GukYuinStbltJobRepository gukYuinStbltRepository) {
|
||||||
|
this.gukYuinStbltRepository = gukYuinStbltRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<LearnKeyDto> findGukYuinEligibleForSurveyList(String status) {
|
||||||
|
return gukYuinStbltRepository.findGukYuinEligibleForSurveyList(status);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void updateGukYuinEligibleForSurvey(String resultUid, RlbDtctMastDto stbltDto) {
|
||||||
|
PnuEntity entity =
|
||||||
|
gukYuinStbltRepository.findPnuEntityByResultUid(resultUid, stbltDto.getPnu());
|
||||||
|
|
||||||
|
if (entity != null) {
|
||||||
|
entity.setPnuDtctId(stbltDto.getPnuDtctId());
|
||||||
|
entity.setPnu(stbltDto.getPnu());
|
||||||
|
entity.setLrmSyncYmd(stbltDto.getLrmSyncYmd());
|
||||||
|
entity.setPnuSyncYmd(stbltDto.getPnuSyncYmd());
|
||||||
|
entity.setMpqdNo(stbltDto.getMpqdNo());
|
||||||
|
entity.setCprsYr(stbltDto.getCprsYr());
|
||||||
|
entity.setCrtrYr(stbltDto.getCrtrYr());
|
||||||
|
entity.setChnDtctSno(stbltDto.getChnDtctSno());
|
||||||
|
entity.setChnDtctId(stbltDto.getChnDtctId());
|
||||||
|
entity.setChnDtctMstId(stbltDto.getChnDtctMstId());
|
||||||
|
entity.setChnDtctObjtId(stbltDto.getChnDtctObjtId());
|
||||||
|
entity.setChnDtctContId(stbltDto.getChnDtctContId());
|
||||||
|
entity.setChnCd(stbltDto.getChnCd());
|
||||||
|
entity.setBfClsCd(stbltDto.getBfClsCd());
|
||||||
|
entity.setBfClsProb(stbltDto.getBfClsProb());
|
||||||
|
entity.setAfClsCd(stbltDto.getAfClsCd());
|
||||||
|
entity.setAfClsProb(stbltDto.getAfClsProb());
|
||||||
|
entity.setPnuSqms(stbltDto.getPnuSqms());
|
||||||
|
entity.setPnuDtctSqms(stbltDto.getPnuDtctSqms());
|
||||||
|
entity.setChnDtctSqms(stbltDto.getChnDtctSqms());
|
||||||
|
entity.setStbltYn(stbltDto.getStbltYn());
|
||||||
|
entity.setIncyCd(stbltDto.getIncyCd());
|
||||||
|
entity.setIncyRsnCont(stbltDto.getIncyRsnCont());
|
||||||
|
entity.setLockYn(stbltDto.getLockYn());
|
||||||
|
entity.setLblYn(stbltDto.getLblYn());
|
||||||
|
entity.setChgYn(stbltDto.getChgYn());
|
||||||
|
entity.setRsatctNo(stbltDto.getRsatctNo());
|
||||||
|
entity.setRmk(stbltDto.getRmk());
|
||||||
|
entity.setCrtDt(stbltDto.getCrtDt());
|
||||||
|
entity.setCrtEpno(stbltDto.getCrtEpno());
|
||||||
|
entity.setCrtIp(stbltDto.getCrtIp());
|
||||||
|
entity.setChgDt(stbltDto.getChgDt());
|
||||||
|
entity.setChgIp(stbltDto.getChgIp());
|
||||||
|
entity.setDelYn(stbltDto.getDelYn().equals("Y"));
|
||||||
|
|
||||||
|
entity.setCreatedDttm(ZonedDateTime.now());
|
||||||
|
gukYuinStbltRepository.save(entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void updateGukYuinObjectStbltYn(String resultUid, StbltResult stbResult) {
|
||||||
|
gukYuinStbltRepository.updateGukYuinObjectStbltYn(resultUid, stbResult);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
@@ -83,6 +84,7 @@ public class InferenceResultCoreService {
|
|||||||
* @param req
|
* @param req
|
||||||
*/
|
*/
|
||||||
public UUID saveInferenceInfo(InferenceResultDto.RegReq req, List<MngListDto> targetList) {
|
public UUID saveInferenceInfo(InferenceResultDto.RegReq req, List<MngListDto> targetList) {
|
||||||
|
|
||||||
List<MngListDto> distinctList =
|
List<MngListDto> distinctList =
|
||||||
targetList.stream()
|
targetList.stream()
|
||||||
.filter(dto -> dto.getMapSheetName() != null && !dto.getMapSheetName().isBlank())
|
.filter(dto -> dto.getMapSheetName() != null && !dto.getMapSheetName().isBlank())
|
||||||
@@ -109,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());
|
||||||
@@ -120,7 +122,7 @@ public class InferenceResultCoreService {
|
|||||||
mapSheetLearnEntity.setCreatedUid(userUtil.getId());
|
mapSheetLearnEntity.setCreatedUid(userUtil.getId());
|
||||||
mapSheetLearnEntity.setMapSheetCnt(mapSheetName);
|
mapSheetLearnEntity.setMapSheetCnt(mapSheetName);
|
||||||
mapSheetLearnEntity.setDetectingCnt(0L);
|
mapSheetLearnEntity.setDetectingCnt(0L);
|
||||||
mapSheetLearnEntity.setTotalJobs((long) detectingCnt);
|
mapSheetLearnEntity.setTotalJobs((long) targetList.size());
|
||||||
|
|
||||||
// 회차는 국유인 반영할때 update로 변경됨
|
// 회차는 국유인 반영할때 update로 변경됨
|
||||||
// mapSheetLearnEntity.setStage(
|
// mapSheetLearnEntity.setStage(
|
||||||
@@ -300,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,
|
||||||
@@ -310,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,
|
||||||
@@ -320,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,
|
||||||
@@ -367,6 +369,12 @@ public class InferenceResultCoreService {
|
|||||||
return mapSheetLearnRepository.getInferenceServerStatusList();
|
return mapSheetLearnRepository.getInferenceServerStatusList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 진행중 배치 조회
|
||||||
|
*
|
||||||
|
* @param status
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public InferenceBatchSheet getInferenceResultByStatus(String status) {
|
public InferenceBatchSheet getInferenceResultByStatus(String status) {
|
||||||
MapSheetLearnEntity entity =
|
MapSheetLearnEntity entity =
|
||||||
mapSheetLearnRepository.getInferenceResultByStatus(status).orElse(null);
|
mapSheetLearnRepository.getInferenceResultByStatus(status).orElse(null);
|
||||||
@@ -401,6 +409,12 @@ public class InferenceResultCoreService {
|
|||||||
return mapSheetLearnRepository.getInferenceAiResultById(id, modelUuid);
|
return mapSheetLearnRepository.getInferenceAiResultById(id, modelUuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 추론 진행 현황 상세
|
||||||
|
*
|
||||||
|
* @param uuid
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public InferenceStatusDetailDto getInferenceStatus(UUID uuid) {
|
public InferenceStatusDetailDto getInferenceStatus(UUID uuid) {
|
||||||
return mapSheetLearnRepository.getInferenceStatus(uuid);
|
return mapSheetLearnRepository.getInferenceStatus(uuid);
|
||||||
}
|
}
|
||||||
@@ -496,15 +510,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) {
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.core;
|
package com.kamco.cd.kamcoback.postgres.core;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.common.exception.CustomApiException;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.AllocateInfoDto;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.AllocateInfoDto;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InferenceDetail;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InferenceDetail;
|
||||||
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InferenceLearnDto;
|
||||||
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelMngState;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelerDetail;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelerDetail;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelingStatDto;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelingStatDto;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.MoveInfo;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.MoveInfo;
|
||||||
@@ -13,12 +16,18 @@ import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.ProjectInfo;
|
|||||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkProgressInfo;
|
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkProgressInfo;
|
||||||
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerStatistics;
|
import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerStatistics;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.repository.batch.BatchStepHistoryRepository;
|
||||||
import com.kamco.cd.kamcoback.postgres.repository.label.LabelAllocateRepository;
|
import com.kamco.cd.kamcoback.postgres.repository.label.LabelAllocateRepository;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
import java.time.LocalDate;
|
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;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@@ -26,6 +35,10 @@ import org.springframework.stereotype.Service;
|
|||||||
public class LabelAllocateCoreService {
|
public class LabelAllocateCoreService {
|
||||||
|
|
||||||
private final LabelAllocateRepository labelAllocateRepository;
|
private final LabelAllocateRepository labelAllocateRepository;
|
||||||
|
private final BatchStepHistoryRepository batchStepHistoryRepository;
|
||||||
|
|
||||||
|
@Value("${file.dataset-response}")
|
||||||
|
private String responsePath;
|
||||||
|
|
||||||
public List<AllocateInfoDto> fetchNextIds(Long lastId, Long batchSize, UUID uuid) {
|
public List<AllocateInfoDto> fetchNextIds(Long lastId, Long batchSize, UUID uuid) {
|
||||||
return labelAllocateRepository.fetchNextIds(lastId, batchSize, uuid);
|
return labelAllocateRepository.fetchNextIds(lastId, batchSize, uuid);
|
||||||
@@ -234,4 +247,47 @@ public class LabelAllocateCoreService {
|
|||||||
public Long findLabelingIngProcessCnt() {
|
public Long findLabelingIngProcessCnt() {
|
||||||
return labelAllocateRepository.findLabelingIngProcessCnt();
|
return labelAllocateRepository.findLabelingIngProcessCnt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isDownloadable(UUID uuid) {
|
||||||
|
InferenceLearnDto dto = labelAllocateRepository.findLabelingIngProcessId(uuid);
|
||||||
|
|
||||||
|
if (dto == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 파일이 있는지만 확인
|
||||||
|
Path path = Paths.get(responsePath).resolve(dto.getLearnUid() + ".zip");
|
||||||
|
if (!Files.isRegularFile(path)) {
|
||||||
|
return false; // exists 포함
|
||||||
|
}
|
||||||
|
|
||||||
|
String state = dto.getAnalState();
|
||||||
|
boolean isLabelingIng =
|
||||||
|
LabelMngState.ASSIGNED.getId().equals(state) || LabelMngState.ING.getId().equals(state);
|
||||||
|
|
||||||
|
if (isLabelingIng) {
|
||||||
|
Long analId = dto.getAnalId();
|
||||||
|
if (analId == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return batchStepHistoryRepository.isDownloadable(analId);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String findLearnUid(UUID uuid) {
|
||||||
|
return labelAllocateRepository
|
||||||
|
.findLearnUid(uuid)
|
||||||
|
.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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,10 +67,6 @@ public class MapLayerCoreService {
|
|||||||
.findDetailByUuid(uuid)
|
.findDetailByUuid(uuid)
|
||||||
.orElseThrow(() -> new CustomApiException("NOT_FOUND_DATA", HttpStatus.NOT_FOUND));
|
.orElseThrow(() -> new CustomApiException("NOT_FOUND_DATA", HttpStatus.NOT_FOUND));
|
||||||
|
|
||||||
if (LayerType.TILE.getId().equals(entity.getLayerType())) {
|
|
||||||
throw new CustomApiException("UNPROCESSABLE_ENTITY", HttpStatus.CONFLICT);
|
|
||||||
}
|
|
||||||
|
|
||||||
entity.setIsDeleted(true);
|
entity.setIsDeleted(true);
|
||||||
entity.setUpdatedUid(userUtil.getId());
|
entity.setUpdatedUid(userUtil.getId());
|
||||||
entity.setUpdatedDttm(ZonedDateTime.now());
|
entity.setUpdatedDttm(ZonedDateTime.now());
|
||||||
@@ -91,6 +87,10 @@ public class MapLayerCoreService {
|
|||||||
entity.setDescription(dto.getDescription());
|
entity.setDescription(dto.getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dto.getLayerName() != null) {
|
||||||
|
entity.setLayerName(dto.getLayerName());
|
||||||
|
}
|
||||||
|
|
||||||
if (dto.getUrl() != null) {
|
if (dto.getUrl() != null) {
|
||||||
entity.setUrl(dto.getUrl());
|
entity.setUrl(dto.getUrl());
|
||||||
}
|
}
|
||||||
@@ -131,6 +131,10 @@ public class MapLayerCoreService {
|
|||||||
entity.setIsLabelingMap(dto.getIsLabelingMap());
|
entity.setIsLabelingMap(dto.getIsLabelingMap());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dto.getCrs() != null) {
|
||||||
|
entity.setCrs(dto.getCrs());
|
||||||
|
}
|
||||||
|
|
||||||
entity.setUpdatedUid(userUtil.getId());
|
entity.setUpdatedUid(userUtil.getId());
|
||||||
entity.setUpdatedDttm(ZonedDateTime.now());
|
entity.setUpdatedDttm(ZonedDateTime.now());
|
||||||
}
|
}
|
||||||
@@ -210,15 +214,10 @@ public class MapLayerCoreService {
|
|||||||
* @param dto
|
* @param dto
|
||||||
*/
|
*/
|
||||||
public UUID saveTile(LayerDto.AddReq dto) {
|
public UUID saveTile(LayerDto.AddReq dto) {
|
||||||
LayerDto.SearchReq searchReq = new LayerDto.SearchReq();
|
Long order = mapLayerRepository.findSortOrderDesc();
|
||||||
searchReq.setLayerType(LayerType.TILE.getId());
|
|
||||||
List<LayerDto.Basic> entityList = mapLayerRepository.findAllLayer(searchReq);
|
|
||||||
|
|
||||||
if (!entityList.isEmpty()) {
|
|
||||||
throw new CustomApiException("DUPLICATE_DATA", HttpStatus.CONFLICT);
|
|
||||||
}
|
|
||||||
|
|
||||||
MapLayerEntity mapLayerEntity = new MapLayerEntity();
|
MapLayerEntity mapLayerEntity = new MapLayerEntity();
|
||||||
|
mapLayerEntity.setLayerName(dto.getLayerName());
|
||||||
mapLayerEntity.setDescription(dto.getDescription());
|
mapLayerEntity.setDescription(dto.getDescription());
|
||||||
mapLayerEntity.setUrl(dto.getUrl());
|
mapLayerEntity.setUrl(dto.getUrl());
|
||||||
mapLayerEntity.setTag(dto.getTag());
|
mapLayerEntity.setTag(dto.getTag());
|
||||||
@@ -228,11 +227,12 @@ public class MapLayerCoreService {
|
|||||||
mapLayerEntity.setMaxLat(dto.getMaxLat());
|
mapLayerEntity.setMaxLat(dto.getMaxLat());
|
||||||
mapLayerEntity.setMinZoom(dto.getMin());
|
mapLayerEntity.setMinZoom(dto.getMin());
|
||||||
mapLayerEntity.setMaxZoom(dto.getMax());
|
mapLayerEntity.setMaxZoom(dto.getMax());
|
||||||
|
mapLayerEntity.setCrs(dto.getCrs());
|
||||||
|
|
||||||
mapLayerEntity.setCreatedUid(userUtil.getId());
|
mapLayerEntity.setCreatedUid(userUtil.getId());
|
||||||
mapLayerEntity.setIsChangeMap(true);
|
mapLayerEntity.setIsChangeMap(true);
|
||||||
mapLayerEntity.setIsLabelingMap(false);
|
mapLayerEntity.setIsLabelingMap(true);
|
||||||
mapLayerEntity.setOrder(1L);
|
mapLayerEntity.setOrder(order + 1);
|
||||||
mapLayerEntity.setLayerType(LayerType.TILE.getId());
|
mapLayerEntity.setLayerType(LayerType.TILE.getId());
|
||||||
mapLayerEntity.setUpdatedDttm(ZonedDateTime.now());
|
mapLayerEntity.setUpdatedDttm(ZonedDateTime.now());
|
||||||
return mapLayerRepository.save(mapLayerEntity).getUuid();
|
return mapLayerRepository.save(mapLayerEntity).getUuid();
|
||||||
@@ -248,6 +248,7 @@ public class MapLayerCoreService {
|
|||||||
Long order = mapLayerRepository.findSortOrderDesc();
|
Long order = mapLayerRepository.findSortOrderDesc();
|
||||||
|
|
||||||
MapLayerEntity mapLayerEntity = new MapLayerEntity();
|
MapLayerEntity mapLayerEntity = new MapLayerEntity();
|
||||||
|
mapLayerEntity.setLayerName(addDto.getLayerName());
|
||||||
mapLayerEntity.setDescription(addDto.getDescription());
|
mapLayerEntity.setDescription(addDto.getDescription());
|
||||||
mapLayerEntity.setUrl(addDto.getUrl());
|
mapLayerEntity.setUrl(addDto.getUrl());
|
||||||
mapLayerEntity.setTag(addDto.getTag());
|
mapLayerEntity.setTag(addDto.getTag());
|
||||||
@@ -255,6 +256,7 @@ public class MapLayerCoreService {
|
|||||||
mapLayerEntity.setIsChangeMap(true);
|
mapLayerEntity.setIsChangeMap(true);
|
||||||
mapLayerEntity.setIsLabelingMap(true);
|
mapLayerEntity.setIsLabelingMap(true);
|
||||||
mapLayerEntity.setLayerType(LayerType.GEOJSON.getId());
|
mapLayerEntity.setLayerType(LayerType.GEOJSON.getId());
|
||||||
|
mapLayerEntity.setCrs(addDto.getCrs());
|
||||||
mapLayerEntity.setUpdatedDttm(ZonedDateTime.now());
|
mapLayerEntity.setUpdatedDttm(ZonedDateTime.now());
|
||||||
mapLayerEntity.setOrder(order + 1);
|
mapLayerEntity.setOrder(order + 1);
|
||||||
return mapLayerRepository.save(mapLayerEntity).getUuid();
|
return mapLayerRepository.save(mapLayerEntity).getUuid();
|
||||||
@@ -277,6 +279,7 @@ public class MapLayerCoreService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MapLayerEntity mapLayerEntity = new MapLayerEntity();
|
MapLayerEntity mapLayerEntity = new MapLayerEntity();
|
||||||
|
mapLayerEntity.setLayerName(addDto.getLayerName());
|
||||||
mapLayerEntity.setTitle(addDto.getTitle());
|
mapLayerEntity.setTitle(addDto.getTitle());
|
||||||
mapLayerEntity.setDescription(addDto.getDescription());
|
mapLayerEntity.setDescription(addDto.getDescription());
|
||||||
mapLayerEntity.setCreatedUid(userUtil.getId());
|
mapLayerEntity.setCreatedUid(userUtil.getId());
|
||||||
@@ -309,6 +312,7 @@ public class MapLayerCoreService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MapLayerEntity mapLayerEntity = new MapLayerEntity();
|
MapLayerEntity mapLayerEntity = new MapLayerEntity();
|
||||||
|
mapLayerEntity.setLayerName(addDto.getLayerName());
|
||||||
mapLayerEntity.setTitle(addDto.getTitle());
|
mapLayerEntity.setTitle(addDto.getTitle());
|
||||||
mapLayerEntity.setDescription(addDto.getDescription());
|
mapLayerEntity.setDescription(addDto.getDescription());
|
||||||
mapLayerEntity.setCreatedUid(userUtil.getId());
|
mapLayerEntity.setCreatedUid(userUtil.getId());
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.kamco.cd.kamcoback.common.geometry.GeoJsonFileWriter.ImageFeature;
|
|||||||
import com.kamco.cd.kamcoback.common.geometry.GeoJsonFileWriter.Scene;
|
import com.kamco.cd.kamcoback.common.geometry.GeoJsonFileWriter.Scene;
|
||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.DetectOption;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.DetectOption;
|
||||||
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.MapSheetFallbackYearDto;
|
||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.MapSheetScope;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.MapSheetScope;
|
||||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
|
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
|
||||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.MngListCompareDto;
|
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.MngListCompareDto;
|
||||||
@@ -24,13 +25,14 @@ 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.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
@@ -233,27 +235,52 @@ public class MapSheetMngCoreService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 추론 실행에 필요한 geojson 파일 생성
|
* geojson 생성
|
||||||
*
|
*
|
||||||
* @param yyyy 영상관리 파일별 년도
|
* @param yyyy
|
||||||
* @param scenes 5k 도엽 번호 리스트
|
* @param scenes
|
||||||
* @param mapSheetScope EXCL : 추론제외, PREV 이전 년도 도엽 사용
|
* @param mapSheetScope
|
||||||
|
* @param detectOption
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Scene getSceneInference(
|
public Scene getSceneInference(
|
||||||
String yyyy, List<String> scenes, String mapSheetScope, String detectOption) {
|
String yyyy, List<String> scenes, String mapSheetScope, String detectOption) {
|
||||||
|
List<ImageFeature> features = loadSceneInferenceBySheets(yyyy, scenes);
|
||||||
|
return writeSceneGeoJson(yyyy, mapSheetScope, detectOption, features);
|
||||||
|
}
|
||||||
|
|
||||||
Map<String, Object> result = new HashMap<>();
|
/**
|
||||||
|
* geojson 생성
|
||||||
|
*
|
||||||
|
* @param yearDtos
|
||||||
|
* @param yyyy
|
||||||
|
* @param mapSheetScope
|
||||||
|
* @param detectOption
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Scene getSceneInference(
|
||||||
|
List<MapSheetFallbackYearDto> yearDtos,
|
||||||
|
String yyyy,
|
||||||
|
String mapSheetScope,
|
||||||
|
String detectOption) {
|
||||||
|
List<ImageFeature> features = loadSceneInferenceByFallbackYears(yearDtos);
|
||||||
|
return writeSceneGeoJson(yyyy, mapSheetScope, detectOption, features);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 파일 경로/이름 , 파일 생성 , 도엽번호 반환
|
||||||
|
*
|
||||||
|
* @param yyyy
|
||||||
|
* @param mapSheetScope
|
||||||
|
* @param detectOption
|
||||||
|
* @param sceneInference
|
||||||
|
* @return Scene
|
||||||
|
*/
|
||||||
|
private Scene writeSceneGeoJson(
|
||||||
|
String yyyy, String mapSheetScope, String detectOption, List<ImageFeature> sceneInference) {
|
||||||
boolean isAll = MapSheetScope.ALL.getId().equals(mapSheetScope);
|
boolean isAll = MapSheetScope.ALL.getId().equals(mapSheetScope);
|
||||||
|
String optionSuffix = buildOptionSuffix(detectOption);
|
||||||
|
|
||||||
String optionSuffix = "";
|
|
||||||
if (DetectOption.EXCL.getId().equals(detectOption)) {
|
|
||||||
optionSuffix = "_EXCL";
|
|
||||||
} else if (DetectOption.PREV.getId().equals(detectOption)) {
|
|
||||||
optionSuffix = "_PREV";
|
|
||||||
}
|
|
||||||
|
|
||||||
// 1) 경로/파일명 결정
|
|
||||||
String targetDir =
|
String targetDir =
|
||||||
"local".equals(activeEnv) ? System.getProperty("user.home") + "/geojson" : inferenceDir;
|
"local".equals(activeEnv) ? System.getProperty("user.home") + "/geojson" : inferenceDir;
|
||||||
|
|
||||||
@@ -264,25 +291,21 @@ public class MapSheetMngCoreService {
|
|||||||
|
|
||||||
Path outputPath = Paths.get(targetDir, filename);
|
Path outputPath = Paths.get(targetDir, filename);
|
||||||
|
|
||||||
// 2) ALL일 때만 재사용
|
|
||||||
// if (isAll && Files.exists(outputPath)) {
|
|
||||||
// return outputPath.toString();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 3) 데이터 조회
|
|
||||||
List<ImageFeature> sceneInference = mapSheetMngRepository.getSceneInference(yyyy, scenes);
|
|
||||||
|
|
||||||
if (sceneInference == null || sceneInference.isEmpty()) {
|
if (sceneInference == null || sceneInference.isEmpty()) {
|
||||||
log.warn(
|
log.warn("NOT_FOUND_TARGET_YEAR: yyyy={}, isAll={}, featuresSize={}", yyyy, isAll, 0);
|
||||||
"NOT_FOUND_TARGET_YEAR: yyyy={}, isAll={}, scenesSize={}",
|
|
||||||
yyyy,
|
|
||||||
isAll,
|
|
||||||
scenes == null ? 0 : scenes.size());
|
|
||||||
throw new CustomApiException("NOT_FOUND_TARGET_YEAR", HttpStatus.NOT_FOUND);
|
throw new CustomApiException("NOT_FOUND_TARGET_YEAR", HttpStatus.NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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()
|
||||||
@@ -291,16 +314,89 @@ public class MapSheetMngCoreService {
|
|||||||
Scene scene = new Scene();
|
Scene scene = new Scene();
|
||||||
scene.setFeatures(sceneInference);
|
scene.setFeatures(sceneInference);
|
||||||
scene.setFilePath(outputPath.toString());
|
scene.setFilePath(outputPath.toString());
|
||||||
|
|
||||||
return scene;
|
return scene;
|
||||||
|
|
||||||
} 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* geojson 파일명 Suffix
|
||||||
|
*
|
||||||
|
* @param detectOption
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String buildOptionSuffix(String detectOption) {
|
||||||
|
if (DetectOption.EXCL.getId().equals(detectOption)) return "_EXCL";
|
||||||
|
if (DetectOption.PREV.getId().equals(detectOption)) return "_PREV";
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 년도, 도엽번호로 조회
|
||||||
|
*
|
||||||
|
* @param yyyy
|
||||||
|
* @param scenes
|
||||||
|
* @return ImageFeature
|
||||||
|
*/
|
||||||
|
private List<ImageFeature> loadSceneInferenceBySheets(String yyyy, List<String> scenes) {
|
||||||
|
List<ImageFeature> sceneInference = mapSheetMngRepository.getSceneInference(yyyy, scenes);
|
||||||
|
|
||||||
|
if (sceneInference == null || sceneInference.isEmpty()) {
|
||||||
|
log.warn(
|
||||||
|
"NOT_FOUND_TARGET_YEAR: yyyy={}, scenesSize={}",
|
||||||
|
yyyy,
|
||||||
|
scenes == null ? 0 : scenes.size());
|
||||||
|
throw new CustomApiException("NOT_FOUND_TARGET_YEAR", HttpStatus.NOT_FOUND);
|
||||||
|
}
|
||||||
|
return sceneInference;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 년도별로 나눠 조회
|
||||||
|
*
|
||||||
|
* @param yearDtos
|
||||||
|
* @return ImageFeature
|
||||||
|
*/
|
||||||
|
private List<ImageFeature> loadSceneInferenceByFallbackYears(
|
||||||
|
List<MapSheetFallbackYearDto> yearDtos) {
|
||||||
|
if (yearDtos == null || yearDtos.isEmpty()) {
|
||||||
|
return List.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 년도 별로 루프를 돌리기위해 년도별 정리
|
||||||
|
Map<Integer, List<MapSheetFallbackYearDto>> groupedByYear =
|
||||||
|
yearDtos.stream()
|
||||||
|
.filter(d -> d.getMngYyyy() != null && d.getMapSheetNum() != null)
|
||||||
|
.collect(Collectors.groupingBy(MapSheetFallbackYearDto::getMngYyyy));
|
||||||
|
|
||||||
|
List<ImageFeature> sceneInference = new ArrayList<>();
|
||||||
|
|
||||||
|
for (Map.Entry<Integer, List<MapSheetFallbackYearDto>> entry : groupedByYear.entrySet()) {
|
||||||
|
Integer year = entry.getKey();
|
||||||
|
|
||||||
|
// 년도별 mapSheetNum 만들기
|
||||||
|
List<String> sheetNums =
|
||||||
|
entry.getValue().stream()
|
||||||
|
.map(MapSheetFallbackYearDto::getMapSheetNum)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
// tif파일 정보 조회
|
||||||
|
List<ImageFeature> temp = mapSheetMngRepository.getSceneInference(year.toString(), sheetNums);
|
||||||
|
|
||||||
|
if (temp != null && !temp.isEmpty()) {
|
||||||
|
sceneInference.addAll(temp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return sceneInference;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 변화탐지 실행 가능 기준 년도 조회
|
* 변화탐지 실행 가능 기준 년도 조회
|
||||||
*
|
*
|
||||||
@@ -334,4 +430,31 @@ 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> getMapSheetNumByHst(Integer year) {
|
||||||
|
List<MapSheetMngHstEntity> entity = mapSheetMngRepository.getMapSheetMngHst(year);
|
||||||
|
return entity.stream().map(MapSheetMngHstEntity::getMapSheetNum).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 특정 연도의 도엽 이력 데이터를 조회
|
||||||
|
*
|
||||||
|
* @param year
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<MapSheetFallbackYearDto> getMapSheetNumDtoByHst(Integer year) {
|
||||||
|
List<MapSheetMngHstEntity> entity = mapSheetMngRepository.getMapSheetMngHst(year);
|
||||||
|
return entity.stream()
|
||||||
|
.map(
|
||||||
|
e ->
|
||||||
|
new MapSheetFallbackYearDto(
|
||||||
|
e.getMapSheetNum(), e.getMngYyyy() // 조회 기준 연도
|
||||||
|
))
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MapSheetFallbackYearDto> findFallbackCompareYearByMapSheets(
|
||||||
|
Integer year, List<String> mapIds) {
|
||||||
|
return mapSheetMngRepository.findFallbackCompareYearByMapSheets(year, mapIds);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.kamco.cd.kamcoback.postgres.repository.mapsheet.MapSheetMngYearReposi
|
|||||||
import com.kamco.cd.kamcoback.postgres.repository.scheduler.MapSheetMngFileJobRepository;
|
import com.kamco.cd.kamcoback.postgres.repository.scheduler.MapSheetMngFileJobRepository;
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.MapSheetMngDto;
|
import com.kamco.cd.kamcoback.scheduler.dto.MapSheetMngDto;
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.MapSheetMngDto.MngHstDto;
|
import com.kamco.cd.kamcoback.scheduler.dto.MapSheetMngDto.MngHstDto;
|
||||||
|
import com.kamco.cd.kamcoback.scheduler.dto.MapSheetMngDto.YearMinMax;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -67,9 +68,10 @@ public class MapSheetMngFileJobCoreService {
|
|||||||
return mapSheetMngFileJobRepository.findNotYetMapSheetMng();
|
return mapSheetMngFileJobRepository.findNotYetMapSheetMng();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long findByHstMapSheetBeforeYyyyListCount(int strtYyyy, int endYyyy, String mapSheetNum) {
|
public Long findByHstMapSheetBeforeYyyyListCount(
|
||||||
|
int mngYyyy, int strtYyyy, int endYyyy, String mapSheetNum) {
|
||||||
return mapSheetMngFileJobRepository.findByHstMapSheetBeforeYyyyListCount(
|
return mapSheetMngFileJobRepository.findByHstMapSheetBeforeYyyyListCount(
|
||||||
strtYyyy, endYyyy, mapSheetNum);
|
mngYyyy, strtYyyy, endYyyy, mapSheetNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateException5kMapSheet(String mapSheetNum, CommonUseStatus commonUseStatus) {
|
public void updateException5kMapSheet(String mapSheetNum, CommonUseStatus commonUseStatus) {
|
||||||
@@ -79,4 +81,16 @@ public class MapSheetMngFileJobCoreService {
|
|||||||
public void saveSheetMngYear() {
|
public void saveSheetMngYear() {
|
||||||
mapSheetMngYearRepository.saveFileInfo();
|
mapSheetMngYearRepository.saveFileInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public YearMinMax findYearMinMaxInfo() {
|
||||||
|
return mapSheetMngYearRepository.findYearMinMaxInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long findMngYyyyCnt(Integer mngYyyy) {
|
||||||
|
return mapSheetMngFileJobRepository.findMngYyyyCnt(mngYyyy);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long findMapSheetUseExceptCnt(String mapSheetNum) {
|
||||||
|
return mapSheetMngFileJobRepository.findMapSheetUseExceptCnt(mapSheetNum);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.core;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.postgres.repository.scheduler.TrainingDataLabelJobRepository;
|
||||||
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.InspectorPendingDto;
|
||||||
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.Tasks;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class TrainingDataLabelJobCoreService {
|
||||||
|
|
||||||
|
private final TrainingDataLabelJobRepository trainingDataLabelJobRepository;
|
||||||
|
|
||||||
|
public List<Tasks> findCompletedYesterdayUnassigned(LocalDate baseDate) {
|
||||||
|
return trainingDataLabelJobRepository.findCompletedYesterdayUnassigned(baseDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void assignReviewerBatch(List<UUID> assignmentUids, String reviewerId) {
|
||||||
|
trainingDataLabelJobRepository.assignReviewerBatch(assignmentUids, reviewerId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<InspectorPendingDto> findInspectorPendingByRound(Long analUid) {
|
||||||
|
return trainingDataLabelJobRepository.findInspectorPendingByRound(analUid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void lockInspectors(Long analUid, List<String> reviewerIds) {
|
||||||
|
trainingDataLabelJobRepository.lockInspectors(analUid, reviewerIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateGeomUidTestState(List<Long> geomUids) {
|
||||||
|
trainingDataLabelJobRepository.updateGeomUidTestState(geomUids);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,10 +4,8 @@ import com.kamco.cd.kamcoback.postgres.repository.scheduler.TrainingDataReviewJo
|
|||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalCntInfo;
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalCntInfo;
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalMapSheetList;
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalMapSheetList;
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.CompleteLabelData;
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.CompleteLabelData;
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.InspectorPendingDto;
|
import java.time.LocalDate;
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.Tasks;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -17,41 +15,14 @@ public class TrainingDataReviewJobCoreService {
|
|||||||
|
|
||||||
private final TrainingDataReviewJobRepository trainingDataReviewJobRepository;
|
private final TrainingDataReviewJobRepository trainingDataReviewJobRepository;
|
||||||
|
|
||||||
public List<Tasks> findCompletedYesterdayUnassigned() {
|
|
||||||
return trainingDataReviewJobRepository.findCompletedYesterdayUnassigned();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void assignReviewer(UUID assignmentUid, String reviewerId) {
|
|
||||||
trainingDataReviewJobRepository.assignReviewer(assignmentUid, reviewerId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void assignReviewerBatch(List<UUID> assignmentUids, String reviewerId) {
|
|
||||||
trainingDataReviewJobRepository.assignReviewerBatch(assignmentUids, reviewerId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Tasks findAssignmentTask(String assignmentUid) {
|
|
||||||
return trainingDataReviewJobRepository.findAssignmentTask(assignmentUid);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<InspectorPendingDto> findInspectorPendingByRound(Long analUid) {
|
|
||||||
return trainingDataReviewJobRepository.findInspectorPendingByRound(analUid);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void lockInspectors(Long analUid, List<String> reviewerIds) {
|
|
||||||
trainingDataReviewJobRepository.lockInspectors(analUid, reviewerIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateGeomUidTestState(List<Long> geomUids) {
|
|
||||||
trainingDataReviewJobRepository.updateGeomUidTestState(geomUids);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<CompleteLabelData> findCompletedYesterdayLabelingList(
|
public List<CompleteLabelData> findCompletedYesterdayLabelingList(
|
||||||
Long analUid, String mapSheetNum) {
|
Long analUid, String mapSheetNum, LocalDate baseDate) {
|
||||||
return trainingDataReviewJobRepository.findCompletedYesterdayLabelingList(analUid, mapSheetNum);
|
return trainingDataReviewJobRepository.findCompletedYesterdayLabelingList(
|
||||||
|
analUid, mapSheetNum, baseDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AnalMapSheetList> findCompletedAnalMapSheetList(Long analUid) {
|
public List<AnalMapSheetList> findCompletedAnalMapSheetList(Long analUid, LocalDate baseDate) {
|
||||||
return trainingDataReviewJobRepository.findCompletedAnalMapSheetList(analUid);
|
return trainingDataReviewJobRepository.findCompletedAnalMapSheetList(analUid, baseDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AnalCntInfo> findAnalCntInfoList() {
|
public List<AnalCntInfo> findAnalCntInfoList() {
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.entity;
|
||||||
|
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import jakarta.validation.constraints.Size;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Entity
|
||||||
|
@Table(name = "batch_step_history")
|
||||||
|
public class BatchStepHistoryEntity {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "id", nullable = false)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Column(name = "anal_uid", nullable = false)
|
||||||
|
private Long analUid;
|
||||||
|
|
||||||
|
@Size(max = 255)
|
||||||
|
@NotNull
|
||||||
|
@Column(name = "result_uid", nullable = false)
|
||||||
|
private String resultUid;
|
||||||
|
|
||||||
|
@Size(max = 100)
|
||||||
|
@NotNull
|
||||||
|
@Column(name = "step_name", nullable = false, length = 100)
|
||||||
|
private String stepName;
|
||||||
|
|
||||||
|
@Size(max = 50)
|
||||||
|
@NotNull
|
||||||
|
@Column(name = "status", nullable = false, length = 50)
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
@Column(name = "error_message", length = Integer.MAX_VALUE)
|
||||||
|
private String errorMessage;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Column(name = "started_dttm", nullable = false)
|
||||||
|
private LocalDateTime startedDttm;
|
||||||
|
|
||||||
|
@Column(name = "completed_dttm")
|
||||||
|
private LocalDateTime completedDttm;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Column(name = "created_dttm", nullable = false)
|
||||||
|
private LocalDateTime createdDttm;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Column(name = "updated_dttm", nullable = false)
|
||||||
|
private LocalDateTime updatedDttm;
|
||||||
|
}
|
||||||
@@ -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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,10 @@ public class MapLayerEntity {
|
|||||||
@Column(name = "title", length = 200)
|
@Column(name = "title", length = 200)
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
|
@Size(max = 255)
|
||||||
|
@Column(name = "layer_name")
|
||||||
|
private String layerName;
|
||||||
|
|
||||||
@Column(name = "description", length = Integer.MAX_VALUE)
|
@Column(name = "description", length = Integer.MAX_VALUE)
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
@@ -103,9 +107,13 @@ public class MapLayerEntity {
|
|||||||
@Column(name = "is_deleted")
|
@Column(name = "is_deleted")
|
||||||
private Boolean isDeleted = false;
|
private Boolean isDeleted = false;
|
||||||
|
|
||||||
|
@Column(name = "crs")
|
||||||
|
private String crs;
|
||||||
|
|
||||||
public LayerDto.Detail toDto() {
|
public LayerDto.Detail toDto() {
|
||||||
return new LayerDto.Detail(
|
return new LayerDto.Detail(
|
||||||
this.uuid,
|
this.uuid,
|
||||||
|
this.layerName,
|
||||||
this.layerType,
|
this.layerType,
|
||||||
this.title,
|
this.title,
|
||||||
this.description,
|
this.description,
|
||||||
@@ -120,6 +128,7 @@ public class MapLayerEntity {
|
|||||||
this.maxLat,
|
this.maxLat,
|
||||||
this.minZoom,
|
this.minZoom,
|
||||||
this.maxZoom,
|
this.maxZoom,
|
||||||
this.createdDttm);
|
this.createdDttm,
|
||||||
|
this.crs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,6 +159,9 @@ public class MapSheetAnalDataInferenceGeomEntity {
|
|||||||
@Column(name = "label_send_dttm")
|
@Column(name = "label_send_dttm")
|
||||||
private ZonedDateTime labelSendDttm;
|
private ZonedDateTime labelSendDttm;
|
||||||
|
|
||||||
|
@Column(name = "lock_yn")
|
||||||
|
private String lockYn;
|
||||||
|
|
||||||
public InferenceDetailDto.DetailListEntity toEntity() {
|
public InferenceDetailDto.DetailListEntity toEntity() {
|
||||||
DetectionClassification classification = DetectionClassification.fromString(classBeforeCd);
|
DetectionClassification classification = DetectionClassification.fromString(classBeforeCd);
|
||||||
Clazzes comparedClazz = new Clazzes(classification, classBeforeProb);
|
Clazzes comparedClazz = new Clazzes(classification, classBeforeProb);
|
||||||
|
|||||||
@@ -45,6 +45,9 @@ public class MapSheetMngTileEntity {
|
|||||||
@Column(name = "tag")
|
@Column(name = "tag")
|
||||||
private String tag;
|
private String tag;
|
||||||
|
|
||||||
|
@Column(name = "crs")
|
||||||
|
private String crs;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@ColumnDefault("now()")
|
@ColumnDefault("now()")
|
||||||
@Column(name = "created_dttm", nullable = false)
|
@Column(name = "created_dttm", nullable = false)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import jakarta.persistence.SequenceGenerator;
|
|||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
import java.time.OffsetDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.hibernate.annotations.ColumnDefault;
|
import org.hibernate.annotations.ColumnDefault;
|
||||||
@@ -39,7 +39,7 @@ public class PnuEntity {
|
|||||||
private String pnu;
|
private String pnu;
|
||||||
|
|
||||||
@Column(name = "created_dttm")
|
@Column(name = "created_dttm")
|
||||||
private OffsetDateTime createdDttm;
|
private ZonedDateTime createdDttm;
|
||||||
|
|
||||||
@Column(name = "created_uid")
|
@Column(name = "created_uid")
|
||||||
private Long createdUid;
|
private Long createdUid;
|
||||||
@@ -47,4 +47,140 @@ public class PnuEntity {
|
|||||||
@ColumnDefault("false")
|
@ColumnDefault("false")
|
||||||
@Column(name = "del_yn")
|
@Column(name = "del_yn")
|
||||||
private Boolean delYn;
|
private Boolean delYn;
|
||||||
|
|
||||||
|
@Size(max = 40)
|
||||||
|
@Column(name = "pnu_dtct_id", length = 40)
|
||||||
|
private String pnuDtctId;
|
||||||
|
|
||||||
|
@Size(max = 10)
|
||||||
|
@Column(name = "lrm_sync_ymd", length = 10)
|
||||||
|
private String lrmSyncYmd;
|
||||||
|
|
||||||
|
@Size(max = 10)
|
||||||
|
@Column(name = "pnu_sync_ymd", length = 10)
|
||||||
|
private String pnuSyncYmd;
|
||||||
|
|
||||||
|
@Size(max = 20)
|
||||||
|
@Column(name = "mpqd_no", length = 20)
|
||||||
|
private String mpqdNo;
|
||||||
|
|
||||||
|
@Size(max = 10)
|
||||||
|
@Column(name = "cprs_yr", length = 10)
|
||||||
|
private String cprsYr;
|
||||||
|
|
||||||
|
@Size(max = 10)
|
||||||
|
@Column(name = "crtr_yr", length = 10)
|
||||||
|
private String crtrYr;
|
||||||
|
|
||||||
|
@Size(max = 255)
|
||||||
|
@Column(name = "chn_dtct_id")
|
||||||
|
private String chnDtctId;
|
||||||
|
|
||||||
|
@Size(max = 10)
|
||||||
|
@Column(name = "chn_dtct_mst_id", length = 10)
|
||||||
|
private String chnDtctMstId;
|
||||||
|
|
||||||
|
@Size(max = 255)
|
||||||
|
@Column(name = "chn_dtct_objt_id")
|
||||||
|
private String chnDtctObjtId;
|
||||||
|
|
||||||
|
@Size(max = 255)
|
||||||
|
@Column(name = "chn_dtct_cont_id")
|
||||||
|
private String chnDtctContId;
|
||||||
|
|
||||||
|
@Size(max = 50)
|
||||||
|
@Column(name = "chn_cd", length = 50)
|
||||||
|
private String chnCd;
|
||||||
|
|
||||||
|
@Size(max = 50)
|
||||||
|
@Column(name = "chn_dtct_prob", length = 50)
|
||||||
|
private String chnDtctProb;
|
||||||
|
|
||||||
|
@Size(max = 50)
|
||||||
|
@Column(name = "bf_cls_cd", length = 50)
|
||||||
|
private String bfClsCd;
|
||||||
|
|
||||||
|
@Size(max = 50)
|
||||||
|
@Column(name = "bf_cls_prob", length = 50)
|
||||||
|
private String bfClsProb;
|
||||||
|
|
||||||
|
@Size(max = 50)
|
||||||
|
@Column(name = "af_cls_cd", length = 50)
|
||||||
|
private String afClsCd;
|
||||||
|
|
||||||
|
@Size(max = 50)
|
||||||
|
@Column(name = "af_cls_prob", length = 50)
|
||||||
|
private String afClsProb;
|
||||||
|
|
||||||
|
@Size(max = 100)
|
||||||
|
@Column(name = "pnu_sqms", length = 100)
|
||||||
|
private String pnuSqms;
|
||||||
|
|
||||||
|
@Size(max = 100)
|
||||||
|
@Column(name = "pnu_dtct_sqms", length = 100)
|
||||||
|
private String pnuDtctSqms;
|
||||||
|
|
||||||
|
@Size(max = 100)
|
||||||
|
@Column(name = "chn_dtct_sqms", length = 100)
|
||||||
|
private String chnDtctSqms;
|
||||||
|
|
||||||
|
@Size(max = 1)
|
||||||
|
@Column(name = "stblt_yn", length = 1)
|
||||||
|
private String stbltYn;
|
||||||
|
|
||||||
|
@Size(max = 30)
|
||||||
|
@Column(name = "incy_cd", length = 30)
|
||||||
|
private String incyCd;
|
||||||
|
|
||||||
|
@Size(max = 255)
|
||||||
|
@Column(name = "incy_rsn_cont")
|
||||||
|
private String incyRsnCont;
|
||||||
|
|
||||||
|
@Size(max = 1)
|
||||||
|
@Column(name = "lock_yn", length = 1)
|
||||||
|
private String lockYn;
|
||||||
|
|
||||||
|
@Size(max = 1)
|
||||||
|
@Column(name = "lbl_yn", length = 1)
|
||||||
|
private String lblYn;
|
||||||
|
|
||||||
|
@Size(max = 1)
|
||||||
|
@Column(name = "chg_yn", length = 1)
|
||||||
|
private String chgYn;
|
||||||
|
|
||||||
|
@Size(max = 50)
|
||||||
|
@Column(name = "rsatct_no", length = 50)
|
||||||
|
private String rsatctNo;
|
||||||
|
|
||||||
|
@Size(max = 100)
|
||||||
|
@Column(name = "rmk", length = 100)
|
||||||
|
private String rmk;
|
||||||
|
|
||||||
|
@Size(max = 20)
|
||||||
|
@Column(name = "crt_dt", length = 20)
|
||||||
|
private String crtDt;
|
||||||
|
|
||||||
|
@Size(max = 20)
|
||||||
|
@Column(name = "crt_epno", length = 20)
|
||||||
|
private String crtEpno;
|
||||||
|
|
||||||
|
@Size(max = 20)
|
||||||
|
@Column(name = "crt_ip", length = 20)
|
||||||
|
private String crtIp;
|
||||||
|
|
||||||
|
@Size(max = 20)
|
||||||
|
@Column(name = "chg_dt", length = 20)
|
||||||
|
private String chgDt;
|
||||||
|
|
||||||
|
@Size(max = 20)
|
||||||
|
@Column(name = "chg_epno", length = 20)
|
||||||
|
private String chgEpno;
|
||||||
|
|
||||||
|
@Size(max = 20)
|
||||||
|
@Column(name = "chg_ip", length = 20)
|
||||||
|
private String chgIp;
|
||||||
|
|
||||||
|
@Size(max = 10)
|
||||||
|
@Column(name = "chn_dtct_sno", length = 10)
|
||||||
|
private String chnDtctSno;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 -> {
|
||||||
|
|||||||
@@ -18,29 +18,99 @@ import org.springframework.data.domain.Page;
|
|||||||
|
|
||||||
public interface MapSheetLearnRepositoryCustom {
|
public interface MapSheetLearnRepositoryCustom {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 추론 관리 목록 조회
|
||||||
|
*
|
||||||
|
* @param req 추론관리 목록 화면 조회 조건
|
||||||
|
* @return 추론 관리 목록
|
||||||
|
*/
|
||||||
Page<MapSheetLearnEntity> getInferenceMgnResultList(InferenceResultDto.SearchListReq req);
|
Page<MapSheetLearnEntity> getInferenceMgnResultList(InferenceResultDto.SearchListReq req);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* uuid 조건으로 추론 실행 정보 조회
|
||||||
|
*
|
||||||
|
* @param uuid uuid
|
||||||
|
* @return 추론 실행 정보
|
||||||
|
*/
|
||||||
Optional<MapSheetLearnEntity> getInferenceResultByUuid(UUID uuid);
|
Optional<MapSheetLearnEntity> getInferenceResultByUuid(UUID uuid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 추론 실행중 서버정보 조회 cpu, gpu
|
||||||
|
*
|
||||||
|
* @return cpu, gpu 정보
|
||||||
|
*/
|
||||||
List<InferenceServerStatusDto> getInferenceServerStatusList();
|
List<InferenceServerStatusDto> getInferenceServerStatusList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 추론 실행 목록 진행 상태별 조회
|
||||||
|
*
|
||||||
|
* @param status 추론 진행 상태
|
||||||
|
* @return 추론 실행 정보
|
||||||
|
*/
|
||||||
Optional<MapSheetLearnEntity> getInferenceResultByStatus(String status);
|
Optional<MapSheetLearnEntity> getInferenceResultByStatus(String status);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 등록된 추론 실행목록 및 등록된 모델 정보 조회
|
||||||
|
*
|
||||||
|
* @param id 추론 실행 테이블 id
|
||||||
|
* @param modelUuid 모델 uuid
|
||||||
|
* @return 모델 정보
|
||||||
|
*/
|
||||||
InferenceProgressDto getInferenceAiResultById(Long id, UUID modelUuid);
|
InferenceProgressDto getInferenceAiResultById(Long id, UUID modelUuid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 진행중인 추론 정보 상세 조회
|
||||||
|
*
|
||||||
|
* @param uuid 추론진행 uuid
|
||||||
|
* @return 진행중인 추론정보 상세 정보
|
||||||
|
*/
|
||||||
InferenceStatusDetailDto getInferenceStatus(UUID uuid);
|
InferenceStatusDetailDto getInferenceStatus(UUID uuid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 진행중인 추론이 있는지 조회
|
||||||
|
*
|
||||||
|
* @return 진행중인 추론 정보
|
||||||
|
*/
|
||||||
MapSheetLearnEntity getProcessing();
|
MapSheetLearnEntity getProcessing();
|
||||||
|
|
||||||
Integer getLearnStage(Integer compareYear, Integer targetYear);
|
/**
|
||||||
|
* 추론 결과 정보 조회
|
||||||
|
*
|
||||||
|
* @param uuid 추론 uuid
|
||||||
|
* @return 추론 결과 및 사용 모델 정보
|
||||||
|
*/
|
||||||
AnalResultInfo getInferenceResultInfo(UUID uuid);
|
AnalResultInfo getInferenceResultInfo(UUID uuid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 추론 결과 bbox, point 조회
|
||||||
|
*
|
||||||
|
* @param uuid 추론 uuid
|
||||||
|
* @return bbox, pont 정보
|
||||||
|
*/
|
||||||
BboxPointDto getBboxPoint(UUID uuid);
|
BboxPointDto getBboxPoint(UUID uuid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 분류별 탐지건수 조회
|
||||||
|
*
|
||||||
|
* @param uuid 추론 uuid
|
||||||
|
* @return 분류별 탐지건수 정보
|
||||||
|
*/
|
||||||
List<Dashboard> getInferenceClassCountList(UUID uuid);
|
List<Dashboard> getInferenceClassCountList(UUID uuid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 추론 결과 상세 geom 목록 조회
|
||||||
|
*
|
||||||
|
* @param uuid 추론 uuid
|
||||||
|
* @param searchGeoReq 추론 결과 상세화면 geom 조회 조건
|
||||||
|
* @return geom 목록 정보
|
||||||
|
*/
|
||||||
Page<Geom> getInferenceGeomList(UUID uuid, SearchGeoReq searchGeoReq);
|
Page<Geom> getInferenceGeomList(UUID uuid, SearchGeoReq searchGeoReq);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 국유in연동 가능여부 확인 조회
|
||||||
|
*
|
||||||
|
* @param uuid 추론 uuid
|
||||||
|
* @return 추론 존재여부, 부분도엽 여부, 추론 진행중 여부, 국유인 작업 진행중 여부
|
||||||
|
*/
|
||||||
GukYuinLinkFacts findLinkFacts(UUID uuid);
|
GukYuinLinkFacts findLinkFacts(UUID uuid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -291,24 +291,6 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
|
|||||||
.fetchOne();
|
.fetchOne();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Integer getLearnStage(Integer compareYear, Integer targetYear) {
|
|
||||||
Integer stage =
|
|
||||||
queryFactory
|
|
||||||
.select(mapSheetLearnEntity.stage)
|
|
||||||
.from(mapSheetLearnEntity)
|
|
||||||
.where(
|
|
||||||
mapSheetLearnEntity
|
|
||||||
.compareYyyy
|
|
||||||
.eq(compareYear)
|
|
||||||
.and(mapSheetLearnEntity.targetYyyy.eq(targetYear)))
|
|
||||||
.orderBy(mapSheetLearnEntity.id.desc())
|
|
||||||
.limit(1)
|
|
||||||
.fetchOne();
|
|
||||||
|
|
||||||
return stage == null ? 1 : stage + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AnalResultInfo getInferenceResultInfo(UUID uuid) {
|
public AnalResultInfo getInferenceResultInfo(UUID uuid) {
|
||||||
QModelMngEntity m1 = new QModelMngEntity("m1");
|
QModelMngEntity m1 = new QModelMngEntity("m1");
|
||||||
@@ -528,6 +510,7 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
|
|||||||
@Override
|
@Override
|
||||||
public GukYuinLinkFacts findLinkFacts(UUID uuid) {
|
public GukYuinLinkFacts findLinkFacts(UUID uuid) {
|
||||||
|
|
||||||
|
// 해당 추론 있는지 확인
|
||||||
MapSheetLearnEntity learn =
|
MapSheetLearnEntity learn =
|
||||||
queryFactory
|
queryFactory
|
||||||
.selectFrom(QMapSheetLearnEntity.mapSheetLearnEntity)
|
.selectFrom(QMapSheetLearnEntity.mapSheetLearnEntity)
|
||||||
@@ -538,12 +521,14 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
|
|||||||
return new GukYuinLinkFacts(false, false, false, false);
|
return new GukYuinLinkFacts(false, false, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 부분 도엽 실행인지 확인
|
||||||
boolean isPartScope = MapSheetScope.PART.getId().equals(learn.getMapSheetScope());
|
boolean isPartScope = MapSheetScope.PART.getId().equals(learn.getMapSheetScope());
|
||||||
|
|
||||||
QMapSheetAnalInferenceEntity inf = QMapSheetAnalInferenceEntity.mapSheetAnalInferenceEntity;
|
QMapSheetAnalInferenceEntity inf = QMapSheetAnalInferenceEntity.mapSheetAnalInferenceEntity;
|
||||||
QMapSheetLearnEntity learn2 = new QMapSheetLearnEntity("learn2");
|
QMapSheetLearnEntity learn2 = new QMapSheetLearnEntity("learn2");
|
||||||
QMapSheetLearnEntity learnQ = QMapSheetLearnEntity.mapSheetLearnEntity;
|
QMapSheetLearnEntity learnQ = QMapSheetLearnEntity.mapSheetLearnEntity;
|
||||||
|
|
||||||
|
// 실행중인 추론 있는지 확인
|
||||||
boolean hasRunningInference =
|
boolean hasRunningInference =
|
||||||
queryFactory
|
queryFactory
|
||||||
.selectOne()
|
.selectOne()
|
||||||
@@ -557,6 +542,7 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
|
|||||||
.fetchFirst()
|
.fetchFirst()
|
||||||
!= null;
|
!= null;
|
||||||
|
|
||||||
|
// 국유인 작업 진행중 있는지 확인
|
||||||
boolean hasOtherUnfinishedGukYuin =
|
boolean hasOtherUnfinishedGukYuin =
|
||||||
queryFactory
|
queryFactory
|
||||||
.selectOne()
|
.selectOne()
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.repository.batch;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.BatchStepHistoryEntity;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
public interface BatchStepHistoryRepository
|
||||||
|
extends JpaRepository<BatchStepHistoryEntity, Long>, BatchStepHistoryRepositoryCustom {}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.repository.batch;
|
||||||
|
|
||||||
|
public interface BatchStepHistoryRepositoryCustom {
|
||||||
|
boolean isDownloadable(Long analUid);
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.repository.batch;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.QBatchStepHistoryEntity;
|
||||||
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class BatchStepHistoryRepositoryImpl implements BatchStepHistoryRepositoryCustom {
|
||||||
|
private final JPAQueryFactory queryFactory;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDownloadable(Long analUid) {
|
||||||
|
QBatchStepHistoryEntity h = QBatchStepHistoryEntity.batchStepHistoryEntity;
|
||||||
|
|
||||||
|
boolean startedExists =
|
||||||
|
queryFactory
|
||||||
|
.selectOne()
|
||||||
|
.from(h)
|
||||||
|
.where(
|
||||||
|
h.analUid.eq(analUid), h.stepName.eq("zipResponseStep"), h.status.eq("STARTED"))
|
||||||
|
.fetchFirst()
|
||||||
|
!= null;
|
||||||
|
|
||||||
|
boolean successExists =
|
||||||
|
queryFactory
|
||||||
|
.selectOne()
|
||||||
|
.from(h)
|
||||||
|
.where(
|
||||||
|
h.analUid.eq(analUid), h.stepName.eq("zipResponseStep"), h.status.eq("SUCCESS"))
|
||||||
|
.fetchFirst()
|
||||||
|
!= null;
|
||||||
|
|
||||||
|
return successExists && !startedExists;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto;
|
|||||||
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapScaleType;
|
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapScaleType;
|
||||||
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapSheetList;
|
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapSheetList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public interface ChangeDetectionRepositoryCustom {
|
public interface ChangeDetectionRepositoryCustom {
|
||||||
@@ -28,4 +29,18 @@ public interface ChangeDetectionRepositoryCustom {
|
|||||||
List<ChangeDetectionDto.MapSheetList> getChangeDetectionMapSheetList(UUID uuid);
|
List<ChangeDetectionDto.MapSheetList> getChangeDetectionMapSheetList(UUID uuid);
|
||||||
|
|
||||||
List<MapSheetList> getChangeDetectionMapSheet50kList(UUID uuid);
|
List<MapSheetList> getChangeDetectionMapSheet50kList(UUID uuid);
|
||||||
|
|
||||||
|
ChangeDetectionDto.PolygonFeatureList getPolygonListByCd(
|
||||||
|
String chnDtctId, String cdObjectId, List<String> cdObjectIds);
|
||||||
|
|
||||||
|
ChangeDetectionDto.PointFeatureList getPointListByCd(
|
||||||
|
String chnDtctId, String cdObjectId, List<String> cdObjectIds);
|
||||||
|
|
||||||
|
ChangeDetectionDto.PolygonFeatureList getSelectedChangeDetectionPolygonListByPnu(
|
||||||
|
String chnDtctId, String pnu);
|
||||||
|
|
||||||
|
ChangeDetectionDto.PointFeatureList getSelectedChangeDetectionPointListByPnu(
|
||||||
|
String chnDtctId, String pnu);
|
||||||
|
|
||||||
|
Optional<UUID> getLearnUuid(String chnDtctId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceG
|
|||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalInferenceEntity.mapSheetAnalInferenceEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalInferenceEntity.mapSheetAnalInferenceEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalSttcEntity.mapSheetAnalSttcEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalSttcEntity.mapSheetAnalSttcEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity.mapSheetLearnEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity.mapSheetLearnEntity;
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QPnuEntity.pnuEntity;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
@@ -16,11 +17,14 @@ import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto;
|
|||||||
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.DetectSearchType;
|
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.DetectSearchType;
|
||||||
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapScaleType;
|
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapScaleType;
|
||||||
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapSheetList;
|
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapSheetList;
|
||||||
|
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.PointFeatureList;
|
||||||
|
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.PolygonFeatureList;
|
||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.Status;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.Status;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataInferenceGeomEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataInferenceGeomEntity;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceEntity;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalInferenceEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalInferenceEntity;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity;
|
||||||
|
import com.querydsl.core.BooleanBuilder;
|
||||||
import com.querydsl.core.types.Projections;
|
import com.querydsl.core.types.Projections;
|
||||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||||
import com.querydsl.core.types.dsl.CaseBuilder;
|
import com.querydsl.core.types.dsl.CaseBuilder;
|
||||||
@@ -30,10 +34,13 @@ import com.querydsl.jpa.JPAExpressions;
|
|||||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport;
|
import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
|
public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
|
||||||
implements ChangeDetectionRepositoryCustom {
|
implements ChangeDetectionRepositoryCustom {
|
||||||
|
|
||||||
@@ -226,7 +233,9 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
mapSheetAnalDataInferenceGeomEntity.targetYyyy,
|
mapSheetAnalDataInferenceGeomEntity.targetYyyy,
|
||||||
mapSheetAnalDataInferenceGeomEntity.classAfterProb,
|
mapSheetAnalDataInferenceGeomEntity.classAfterProb,
|
||||||
mapSheetAnalDataInferenceGeomEntity.classAfterCd.toUpperCase(),
|
mapSheetAnalDataInferenceGeomEntity.classAfterCd.toUpperCase(),
|
||||||
mapSheetAnalDataInferenceGeomEntity.cdProb))
|
mapSheetAnalDataInferenceGeomEntity.cdProb,
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.uuid,
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.resultUid))
|
||||||
.from(mapSheetAnalDataInferenceGeomEntity)
|
.from(mapSheetAnalDataInferenceGeomEntity)
|
||||||
.innerJoin(mapSheetAnalDataInferenceEntity)
|
.innerJoin(mapSheetAnalDataInferenceEntity)
|
||||||
.on(mapSheetAnalDataInferenceGeomEntity.dataUid.eq(mapSheetAnalDataInferenceEntity.id))
|
.on(mapSheetAnalDataInferenceGeomEntity.dataUid.eq(mapSheetAnalDataInferenceEntity.id))
|
||||||
@@ -261,7 +270,9 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
data.getAfterYear(),
|
data.getAfterYear(),
|
||||||
data.getAfterConfidence(),
|
data.getAfterConfidence(),
|
||||||
data.getAfterClass(),
|
data.getAfterClass(),
|
||||||
data.getCdProb());
|
data.getCdProb(),
|
||||||
|
data.getUuid(),
|
||||||
|
data.getResultUid());
|
||||||
|
|
||||||
return new ChangeDetectionDto.PolygonFeature(
|
return new ChangeDetectionDto.PolygonFeature(
|
||||||
data.getType(), jsonNode, properties);
|
data.getType(), jsonNode, properties);
|
||||||
@@ -371,4 +382,275 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
"{0} || {1}", imageryEntity.cogMiddlePath, imageryEntity.cogFilename))
|
"{0} || {1}", imageryEntity.cogMiddlePath, imageryEntity.cogFilename))
|
||||||
.otherwise("");
|
.otherwise("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PolygonFeatureList getPolygonListByCd(
|
||||||
|
String chnDtctId, String cdObjectId, List<String> cdObjectIds) {
|
||||||
|
BooleanBuilder builder = new BooleanBuilder();
|
||||||
|
builder.and(mapSheetLearnEntity.uid.eq(chnDtctId));
|
||||||
|
builder.and(
|
||||||
|
mapSheetAnalDataInferenceGeomEntity
|
||||||
|
.resultUid
|
||||||
|
.eq(chnDtctId)
|
||||||
|
.or(mapSheetAnalDataInferenceGeomEntity.resultUid.in(cdObjectIds)));
|
||||||
|
|
||||||
|
List<ChangeDetectionDto.PolygonQueryData> list =
|
||||||
|
queryFactory
|
||||||
|
.select(
|
||||||
|
Projections.constructor(
|
||||||
|
ChangeDetectionDto.PolygonQueryData.class,
|
||||||
|
Expressions.stringTemplate("{0}", "Feature"),
|
||||||
|
Expressions.stringTemplate(
|
||||||
|
"ST_AsGeoJSON({0})", mapSheetAnalDataInferenceGeomEntity.geom),
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.geoUid,
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.area,
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.compareYyyy,
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.classBeforeProb,
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.classBeforeCd.toUpperCase(),
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.targetYyyy,
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.classAfterProb,
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.classAfterCd.toUpperCase(),
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.cdProb,
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.uuid,
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.resultUid))
|
||||||
|
.from(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.innerJoin(mapSheetAnalDataInferenceEntity)
|
||||||
|
.on(mapSheetAnalDataInferenceGeomEntity.dataUid.eq(mapSheetAnalDataInferenceEntity.id))
|
||||||
|
.innerJoin(mapSheetAnalInferenceEntity)
|
||||||
|
.on(mapSheetAnalInferenceEntity.id.eq(mapSheetAnalDataInferenceEntity.analUid))
|
||||||
|
.innerJoin(mapSheetLearnEntity)
|
||||||
|
.on(mapSheetLearnEntity.id.eq(mapSheetAnalInferenceEntity.learnId))
|
||||||
|
.where(builder)
|
||||||
|
.orderBy(mapSheetAnalDataInferenceGeomEntity.mapSheetNum.asc())
|
||||||
|
.fetch();
|
||||||
|
|
||||||
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
List<ChangeDetectionDto.PolygonFeature> result =
|
||||||
|
list.stream()
|
||||||
|
.map(
|
||||||
|
data -> {
|
||||||
|
String geoJson = data.getGeometry();
|
||||||
|
JsonNode jsonNode;
|
||||||
|
try {
|
||||||
|
jsonNode = mapper.readTree(geoJson);
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
ChangeDetectionDto.PolygonProperties properties =
|
||||||
|
new ChangeDetectionDto.PolygonProperties(
|
||||||
|
data.getGeoUid(),
|
||||||
|
data.getArea(),
|
||||||
|
data.getBeforeYear(),
|
||||||
|
data.getBeforeConfidence(),
|
||||||
|
data.getBeforeClass(),
|
||||||
|
data.getAfterYear(),
|
||||||
|
data.getAfterConfidence(),
|
||||||
|
data.getAfterClass(),
|
||||||
|
data.getCdProb(),
|
||||||
|
data.getUuid(),
|
||||||
|
data.getResultUid());
|
||||||
|
|
||||||
|
return new ChangeDetectionDto.PolygonFeature(
|
||||||
|
data.getType(), jsonNode, properties);
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
ChangeDetectionDto.PolygonFeatureList polygonList = new ChangeDetectionDto.PolygonFeatureList();
|
||||||
|
polygonList.setType("FeatureCollection");
|
||||||
|
polygonList.setFeatures(result);
|
||||||
|
return polygonList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PointFeatureList getPointListByCd(
|
||||||
|
String chnDtctId, String cdObjectId, List<String> cdObjectIds) {
|
||||||
|
BooleanBuilder builder = new BooleanBuilder();
|
||||||
|
builder.and(mapSheetLearnEntity.uid.eq(chnDtctId));
|
||||||
|
builder.and(
|
||||||
|
mapSheetAnalDataInferenceGeomEntity
|
||||||
|
.resultUid
|
||||||
|
.eq(chnDtctId)
|
||||||
|
.or(mapSheetAnalDataInferenceGeomEntity.resultUid.in(cdObjectIds)));
|
||||||
|
|
||||||
|
List<ChangeDetectionDto.PointQueryData> list =
|
||||||
|
queryFactory
|
||||||
|
.select(
|
||||||
|
Projections.constructor(
|
||||||
|
ChangeDetectionDto.PointQueryData.class,
|
||||||
|
Expressions.stringTemplate("{0}", "Feature"),
|
||||||
|
Expressions.stringTemplate(
|
||||||
|
"ST_AsGeoJSON({0})",
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.geomCenter), // point
|
||||||
|
Projections.constructor(
|
||||||
|
ChangeDetectionDto.PointProperties.class,
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.geoUid,
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.classAfterCd.toUpperCase())))
|
||||||
|
.from(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.innerJoin(mapSheetAnalDataInferenceEntity)
|
||||||
|
.on(mapSheetAnalDataInferenceGeomEntity.dataUid.eq(mapSheetAnalDataInferenceEntity.id))
|
||||||
|
.innerJoin(mapSheetAnalInferenceEntity)
|
||||||
|
.on(mapSheetAnalInferenceEntity.id.eq(mapSheetAnalDataInferenceEntity.analUid))
|
||||||
|
.innerJoin(mapSheetLearnEntity)
|
||||||
|
.on(mapSheetLearnEntity.id.eq(mapSheetAnalInferenceEntity.learnId))
|
||||||
|
.where(builder)
|
||||||
|
.fetch();
|
||||||
|
|
||||||
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
List<ChangeDetectionDto.PointFeature> result =
|
||||||
|
list.stream()
|
||||||
|
.map(
|
||||||
|
data -> {
|
||||||
|
String geoJson = data.getGeometry();
|
||||||
|
JsonNode jsonNode;
|
||||||
|
try {
|
||||||
|
jsonNode = mapper.readTree(geoJson);
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ChangeDetectionDto.PointFeature(
|
||||||
|
data.getType(), jsonNode, data.getProperties());
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
return new ChangeDetectionDto.PointFeatureList("FeatureCollection", result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PolygonFeatureList getSelectedChangeDetectionPolygonListByPnu(
|
||||||
|
String chnDtctId, String pnu) {
|
||||||
|
BooleanBuilder builder = new BooleanBuilder();
|
||||||
|
builder.and(mapSheetLearnEntity.uid.eq(chnDtctId));
|
||||||
|
builder.and(pnuEntity.pnu.eq(pnu));
|
||||||
|
|
||||||
|
List<ChangeDetectionDto.PolygonQueryData> list =
|
||||||
|
queryFactory
|
||||||
|
.select(
|
||||||
|
Projections.constructor(
|
||||||
|
ChangeDetectionDto.PolygonQueryData.class,
|
||||||
|
Expressions.stringTemplate("{0}", "Feature"),
|
||||||
|
Expressions.stringTemplate(
|
||||||
|
"ST_AsGeoJSON({0})", mapSheetAnalDataInferenceGeomEntity.geom),
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.geoUid,
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.area,
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.compareYyyy,
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.classBeforeProb,
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.classBeforeCd.toUpperCase(),
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.targetYyyy,
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.classAfterProb,
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.classAfterCd.toUpperCase(),
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.cdProb))
|
||||||
|
.from(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.innerJoin(mapSheetAnalDataInferenceEntity)
|
||||||
|
.on(mapSheetAnalDataInferenceGeomEntity.dataUid.eq(mapSheetAnalDataInferenceEntity.id))
|
||||||
|
.innerJoin(mapSheetAnalInferenceEntity)
|
||||||
|
.on(mapSheetAnalInferenceEntity.id.eq(mapSheetAnalDataInferenceEntity.analUid))
|
||||||
|
.innerJoin(mapSheetLearnEntity)
|
||||||
|
.on(mapSheetLearnEntity.id.eq(mapSheetAnalInferenceEntity.learnId))
|
||||||
|
.innerJoin(pnuEntity.geo, mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.where(builder)
|
||||||
|
.orderBy(mapSheetAnalDataInferenceGeomEntity.mapSheetNum.asc())
|
||||||
|
.fetch();
|
||||||
|
|
||||||
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
List<ChangeDetectionDto.PolygonFeature> result =
|
||||||
|
list.stream()
|
||||||
|
.map(
|
||||||
|
data -> {
|
||||||
|
String geoJson = data.getGeometry();
|
||||||
|
JsonNode jsonNode;
|
||||||
|
try {
|
||||||
|
jsonNode = mapper.readTree(geoJson);
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
ChangeDetectionDto.PolygonProperties properties =
|
||||||
|
new ChangeDetectionDto.PolygonProperties(
|
||||||
|
data.getGeoUid(),
|
||||||
|
data.getArea(),
|
||||||
|
data.getBeforeYear(),
|
||||||
|
data.getBeforeConfidence(),
|
||||||
|
data.getBeforeClass(),
|
||||||
|
data.getAfterYear(),
|
||||||
|
data.getAfterConfidence(),
|
||||||
|
data.getAfterClass(),
|
||||||
|
data.getCdProb(),
|
||||||
|
data.getUuid(),
|
||||||
|
data.getResultUid());
|
||||||
|
|
||||||
|
return new ChangeDetectionDto.PolygonFeature(
|
||||||
|
data.getType(), jsonNode, properties);
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
ChangeDetectionDto.PolygonFeatureList polygonList = new ChangeDetectionDto.PolygonFeatureList();
|
||||||
|
polygonList.setType("FeatureCollection");
|
||||||
|
polygonList.setFeatures(result);
|
||||||
|
return polygonList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PointFeatureList getSelectedChangeDetectionPointListByPnu(String chnDtctId, String pnu) {
|
||||||
|
BooleanBuilder builder = new BooleanBuilder();
|
||||||
|
builder.and(mapSheetLearnEntity.uid.eq(chnDtctId));
|
||||||
|
builder.and(pnuEntity.pnu.eq(pnu));
|
||||||
|
|
||||||
|
List<ChangeDetectionDto.PointQueryData> list =
|
||||||
|
queryFactory
|
||||||
|
.select(
|
||||||
|
Projections.constructor(
|
||||||
|
ChangeDetectionDto.PointQueryData.class,
|
||||||
|
Expressions.stringTemplate("{0}", "Feature"),
|
||||||
|
Expressions.stringTemplate(
|
||||||
|
"ST_AsGeoJSON({0})",
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.geomCenter), // point
|
||||||
|
Projections.constructor(
|
||||||
|
ChangeDetectionDto.PointProperties.class,
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.geoUid,
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.classAfterCd.toUpperCase())))
|
||||||
|
.from(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.innerJoin(mapSheetAnalDataInferenceEntity)
|
||||||
|
.on(mapSheetAnalDataInferenceGeomEntity.dataUid.eq(mapSheetAnalDataInferenceEntity.id))
|
||||||
|
.innerJoin(mapSheetAnalInferenceEntity)
|
||||||
|
.on(mapSheetAnalInferenceEntity.id.eq(mapSheetAnalDataInferenceEntity.analUid))
|
||||||
|
.innerJoin(mapSheetLearnEntity)
|
||||||
|
.on(mapSheetLearnEntity.id.eq(mapSheetAnalInferenceEntity.learnId))
|
||||||
|
.innerJoin(pnuEntity.geo, mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.where(builder)
|
||||||
|
.fetch();
|
||||||
|
|
||||||
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
List<ChangeDetectionDto.PointFeature> result =
|
||||||
|
list.stream()
|
||||||
|
.map(
|
||||||
|
data -> {
|
||||||
|
String geoJson = data.getGeometry();
|
||||||
|
JsonNode jsonNode;
|
||||||
|
try {
|
||||||
|
jsonNode = mapper.readTree(geoJson);
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ChangeDetectionDto.PointFeature(
|
||||||
|
data.getType(), jsonNode, data.getProperties());
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
return new ChangeDetectionDto.PointFeatureList("FeatureCollection", result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<UUID> getLearnUuid(String chnDtctId) {
|
||||||
|
return Optional.ofNullable(
|
||||||
|
queryFactory
|
||||||
|
.select(mapSheetAnalInferenceEntity.uuid)
|
||||||
|
.from(mapSheetLearnEntity)
|
||||||
|
.innerJoin(mapSheetAnalInferenceEntity)
|
||||||
|
.on(mapSheetAnalInferenceEntity.learnId.eq(mapSheetLearnEntity.id))
|
||||||
|
.where(mapSheetLearnEntity.uid.eq(chnDtctId))
|
||||||
|
.fetchOne());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.MapSheetLearnEntity;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
public interface GukYuinLabelJobRepository
|
||||||
|
extends JpaRepository<MapSheetLearnEntity, Long>, GukYuinLabelJobRepositoryCustom {}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GeomUidDto;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface GukYuinLabelJobRepositoryCustom {
|
||||||
|
|
||||||
|
List<GeomUidDto> findYesterdayLabelingCompleteList(LocalDate baseDate);
|
||||||
|
|
||||||
|
void updateAnalDataInferenceGeomSendDttm(Long geoUid);
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
||||||
|
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QLabelingAssignmentEntity.labelingAssignmentEntity;
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity;
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalInferenceEntity.mapSheetAnalInferenceEntity;
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity.mapSheetLearnEntity;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GeomUidDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
||||||
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InspectState;
|
||||||
|
import com.querydsl.core.types.Projections;
|
||||||
|
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||||
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||||
|
import jakarta.persistence.EntityManager;
|
||||||
|
import jakarta.persistence.PersistenceContext;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class GukYuinLabelJobRepositoryImpl implements GukYuinLabelJobRepositoryCustom {
|
||||||
|
|
||||||
|
private final JPAQueryFactory queryFactory;
|
||||||
|
@PersistenceContext private EntityManager em;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<GeomUidDto> findYesterdayLabelingCompleteList(LocalDate baseDate) {
|
||||||
|
ZoneId zone = ZoneId.of("Asia/Seoul");
|
||||||
|
|
||||||
|
// baseDate가 null이면 기존처럼 "어제"로 처리
|
||||||
|
LocalDate targetDate =
|
||||||
|
(baseDate != null) ? baseDate : ZonedDateTime.now(zone).toLocalDate().minusDays(1);
|
||||||
|
|
||||||
|
ZonedDateTime targetStart = targetDate.atStartOfDay(zone);
|
||||||
|
ZonedDateTime nextStart = targetStart.plusDays(1);
|
||||||
|
|
||||||
|
BooleanExpression inTargetDay =
|
||||||
|
labelingAssignmentEntity
|
||||||
|
.inspectStatDttm
|
||||||
|
.goe(targetStart)
|
||||||
|
.and(labelingAssignmentEntity.inspectStatDttm.lt(nextStart));
|
||||||
|
|
||||||
|
return queryFactory
|
||||||
|
.select(
|
||||||
|
Projections.constructor(
|
||||||
|
GeomUidDto.class,
|
||||||
|
labelingAssignmentEntity.inferenceGeomUid,
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.resultUid))
|
||||||
|
.from(labelingAssignmentEntity)
|
||||||
|
.innerJoin(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.on(
|
||||||
|
labelingAssignmentEntity.inferenceGeomUid.eq(
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.geoUid))
|
||||||
|
.innerJoin(mapSheetAnalInferenceEntity)
|
||||||
|
.on(labelingAssignmentEntity.analUid.eq(mapSheetAnalInferenceEntity.id))
|
||||||
|
.innerJoin(mapSheetLearnEntity)
|
||||||
|
.on(
|
||||||
|
mapSheetAnalInferenceEntity.learnId.eq(mapSheetLearnEntity.id),
|
||||||
|
mapSheetLearnEntity.applyStatus.in(
|
||||||
|
GukYuinStatus.GUK_COMPLETED.getId(), GukYuinStatus.PNU_COMPLETED.getId()))
|
||||||
|
.where(labelingAssignmentEntity.inspectState.eq(InspectState.COMPLETE.getId()), inTargetDay)
|
||||||
|
.fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateAnalDataInferenceGeomSendDttm(Long geoUid) {
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.set(mapSheetAnalDataInferenceGeomEntity.labelSendDttm, ZonedDateTime.now())
|
||||||
|
.where(mapSheetAnalDataInferenceGeomEntity.geoUid.eq(geoUid))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.MapSheetLearnEntity;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
public interface GukYuinPnuJobRepository
|
||||||
|
extends JpaRepository<MapSheetLearnEntity, Long>, GukYuinPnuJobRepositoryCustom {}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface GukYuinPnuJobRepositoryCustom {
|
||||||
|
|
||||||
|
void updateInferenceGeomDataPnuCnt(String chnDtctObjtId, long pnuCnt);
|
||||||
|
|
||||||
|
Long findMapSheetAnalDataInferenceGeomUid(String chnDtctObjtId);
|
||||||
|
|
||||||
|
void insertGeoUidPnuData(Long geoUid, String[] pnuList, String chnDtctObjtId);
|
||||||
|
|
||||||
|
void updateGukYuinApplyStateComplete(Long id, GukYuinStatus status);
|
||||||
|
|
||||||
|
List<LearnKeyDto> findGukyuinApplyStatusUidList(List<String> gukYuinStatus);
|
||||||
|
|
||||||
|
long upsertMapSheetDataAnalGeomPnu(String uid, String[] pnuList);
|
||||||
|
}
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
||||||
|
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity;
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity.mapSheetLearnEntity;
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QPnuEntity.pnuEntity;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.PnuEntity;
|
||||||
|
import com.querydsl.core.types.Projections;
|
||||||
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||||
|
import jakarta.persistence.EntityManager;
|
||||||
|
import jakarta.persistence.PersistenceContext;
|
||||||
|
import jakarta.transaction.Transactional;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class GukYuinPnuJobRepositoryImpl implements GukYuinPnuJobRepositoryCustom {
|
||||||
|
|
||||||
|
private final JPAQueryFactory queryFactory;
|
||||||
|
@PersistenceContext private EntityManager em;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateInferenceGeomDataPnuCnt(String chnDtctObjtId, long pnuCnt) {
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.set(mapSheetAnalDataInferenceGeomEntity.pnu, pnuCnt)
|
||||||
|
.where(mapSheetAnalDataInferenceGeomEntity.resultUid.eq(chnDtctObjtId))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long findMapSheetAnalDataInferenceGeomUid(String chnDtctObjtId) {
|
||||||
|
return queryFactory
|
||||||
|
.select(mapSheetAnalDataInferenceGeomEntity.geoUid)
|
||||||
|
.from(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.where(mapSheetAnalDataInferenceGeomEntity.resultUid.eq(chnDtctObjtId))
|
||||||
|
.fetchOne();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insertGeoUidPnuData(Long geoUid, String[] pnuList, String chnDtctObjtId) {
|
||||||
|
for (String pnu : pnuList) {
|
||||||
|
PnuEntity entity =
|
||||||
|
queryFactory
|
||||||
|
.selectFrom(pnuEntity)
|
||||||
|
.where(pnuEntity.pnu.eq(pnu), pnuEntity.chnDtctObjtId.eq(chnDtctObjtId))
|
||||||
|
.fetchOne();
|
||||||
|
if (entity == null) {
|
||||||
|
queryFactory
|
||||||
|
.insert(pnuEntity)
|
||||||
|
.columns(
|
||||||
|
pnuEntity.geo.geoUid, pnuEntity.pnu, pnuEntity.createdDttm, pnuEntity.chnDtctObjtId)
|
||||||
|
.values(geoUid, pnu, ZonedDateTime.now(), chnDtctObjtId)
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<LearnKeyDto> findGukyuinApplyStatusUidList(List<String> status) {
|
||||||
|
return queryFactory
|
||||||
|
.select(
|
||||||
|
Projections.constructor(
|
||||||
|
LearnKeyDto.class,
|
||||||
|
mapSheetLearnEntity.id,
|
||||||
|
mapSheetLearnEntity.uid,
|
||||||
|
mapSheetLearnEntity.chnDtctMstId))
|
||||||
|
.from(mapSheetLearnEntity)
|
||||||
|
.where(mapSheetLearnEntity.applyStatus.in(status))
|
||||||
|
.fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long upsertMapSheetDataAnalGeomPnu(String chnDtctObjtId, String[] pnuList) {
|
||||||
|
long length = pnuList.length;
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.set(mapSheetAnalDataInferenceGeomEntity.pnu, length)
|
||||||
|
.where(mapSheetAnalDataInferenceGeomEntity.resultUid.eq(chnDtctObjtId))
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
Long geoUid =
|
||||||
|
queryFactory
|
||||||
|
.select(mapSheetAnalDataInferenceGeomEntity.geoUid)
|
||||||
|
.from(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.where(mapSheetAnalDataInferenceGeomEntity.resultUid.eq(chnDtctObjtId))
|
||||||
|
.fetchOne();
|
||||||
|
|
||||||
|
long succCnt = 0;
|
||||||
|
for (String pnu : pnuList) {
|
||||||
|
long result =
|
||||||
|
queryFactory
|
||||||
|
.insert(pnuEntity)
|
||||||
|
.columns(
|
||||||
|
pnuEntity.geo.geoUid,
|
||||||
|
pnuEntity.pnu,
|
||||||
|
pnuEntity.createdDttm,
|
||||||
|
pnuEntity.chnDtctObjtId)
|
||||||
|
.values(geoUid, pnu, ZonedDateTime.now(), chnDtctObjtId)
|
||||||
|
.execute();
|
||||||
|
if (result > 0) {
|
||||||
|
succCnt++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return succCnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void updateGukYuinApplyStateComplete(Long id, GukYuinStatus status) {
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetLearnEntity)
|
||||||
|
.set(mapSheetLearnEntity.applyStatus, status.getId())
|
||||||
|
.set(mapSheetLearnEntity.applyStatusDttm, ZonedDateTime.now())
|
||||||
|
.where(mapSheetLearnEntity.id.eq(id))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,13 +14,13 @@ public interface GukYuinRepositoryCustom {
|
|||||||
|
|
||||||
void updateGukYuinMastRegResult(Basic resultBody);
|
void updateGukYuinMastRegResult(Basic resultBody);
|
||||||
|
|
||||||
void updateGukYuinMastRegRemove(Basic resultBody);
|
void updateGukYuinMastRegRemove(String chnDtctId);
|
||||||
|
|
||||||
void updateInferenceGeomDataPnuCnt(String chnDtctObjtId, long pnuCnt);
|
void updateInferenceGeomDataPnuCnt(String chnDtctObjtId, long pnuCnt);
|
||||||
|
|
||||||
Long findMapSheetAnalDataInferenceGeomUid(String chnDtctObjtId);
|
Long findMapSheetAnalDataInferenceGeomUid(String chnDtctObjtId);
|
||||||
|
|
||||||
void insertGeoUidPnuData(Long geoUid, String[] pnuList);
|
void insertGeoUidPnuData(Long geoUid, String[] pnuList, String chnDtctObjtId);
|
||||||
|
|
||||||
void updateGukYuinApplyStateComplete(Long id, GukYuinStatus status);
|
void updateGukYuinApplyStateComplete(Long id, GukYuinStatus status);
|
||||||
|
|
||||||
@@ -39,4 +39,10 @@ public interface GukYuinRepositoryCustom {
|
|||||||
void updateAnalDataInferenceGeomSendDttm(Long geoUid);
|
void updateAnalDataInferenceGeomSendDttm(Long geoUid);
|
||||||
|
|
||||||
List<LabelSendDto> findLabelingCompleteSendList(LocalDate yesterday);
|
List<LabelSendDto> findLabelingCompleteSendList(LocalDate yesterday);
|
||||||
|
|
||||||
|
Long findMapSheetLearnInfoByYyyy(Integer compareYyyy, Integer targetYyyy, Integer maxStage);
|
||||||
|
|
||||||
|
void updateMapSheetLearnGukyuinEndStatus(Long learnId);
|
||||||
|
|
||||||
|
void updateMapSheetInferenceLabelEndStatus(Long learnId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GeomUidDto;
|
|||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.LearnInfo;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.LearnInfo;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InspectState;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InspectState;
|
||||||
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelMngState;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.PnuEntity;
|
||||||
import com.querydsl.core.types.Projections;
|
import com.querydsl.core.types.Projections;
|
||||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||||
import com.querydsl.core.types.dsl.Expressions;
|
import com.querydsl.core.types.dsl.Expressions;
|
||||||
@@ -52,17 +54,20 @@ public class GukYuinRepositoryImpl implements GukYuinRepositoryCustom {
|
|||||||
.set(mapSheetLearnEntity.applyStatus, status.getId())
|
.set(mapSheetLearnEntity.applyStatus, status.getId())
|
||||||
.set(mapSheetLearnEntity.applyStatusDttm, ZonedDateTime.now())
|
.set(mapSheetLearnEntity.applyStatusDttm, ZonedDateTime.now())
|
||||||
.set(mapSheetLearnEntity.chnDtctMstId, resultBody.getChnDtctMstId())
|
.set(mapSheetLearnEntity.chnDtctMstId, resultBody.getChnDtctMstId())
|
||||||
|
.set(mapSheetLearnEntity.applyYn, true)
|
||||||
|
.set(mapSheetLearnEntity.applyDttm, ZonedDateTime.now())
|
||||||
.where(mapSheetLearnEntity.uid.eq(resultBody.getChnDtctId()))
|
.where(mapSheetLearnEntity.uid.eq(resultBody.getChnDtctId()))
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateGukYuinMastRegRemove(Basic resultBody) {
|
public void updateGukYuinMastRegRemove(String chnDtctId) {
|
||||||
queryFactory
|
queryFactory
|
||||||
.update(mapSheetLearnEntity)
|
.update(mapSheetLearnEntity)
|
||||||
.set(mapSheetLearnEntity.applyStatus, GukYuinStatus.CANCELED.getId())
|
.set(mapSheetLearnEntity.applyStatus, GukYuinStatus.CANCELED.getId())
|
||||||
.set(mapSheetLearnEntity.applyStatusDttm, ZonedDateTime.now())
|
.set(mapSheetLearnEntity.applyStatusDttm, ZonedDateTime.now())
|
||||||
.where(mapSheetLearnEntity.uid.eq(resultBody.getChnDtctId()))
|
.set(mapSheetLearnEntity.applyYn, false)
|
||||||
|
.where(mapSheetLearnEntity.uid.eq(chnDtctId))
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,13 +90,25 @@ public class GukYuinRepositoryImpl implements GukYuinRepositoryCustom {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void insertGeoUidPnuData(Long geoUid, String[] pnuList) {
|
public void insertGeoUidPnuData(Long geoUid, String[] pnuList, String chnDtctObjtId) {
|
||||||
for (String pnu : pnuList) {
|
for (String pnu : pnuList) {
|
||||||
queryFactory
|
PnuEntity entity =
|
||||||
.insert(pnuEntity)
|
queryFactory
|
||||||
.columns(pnuEntity.geo.geoUid, pnuEntity.pnu, pnuEntity.createdDttm)
|
.selectFrom(pnuEntity)
|
||||||
.values(geoUid, pnu, ZonedDateTime.now())
|
.where(
|
||||||
.execute();
|
pnuEntity.geo.geoUid.eq(geoUid),
|
||||||
|
pnuEntity.pnu.eq(pnu),
|
||||||
|
pnuEntity.chnDtctObjtId.eq(chnDtctObjtId))
|
||||||
|
.fetchOne();
|
||||||
|
|
||||||
|
if (entity == null) {
|
||||||
|
queryFactory
|
||||||
|
.insert(pnuEntity)
|
||||||
|
.columns(
|
||||||
|
pnuEntity.geo.geoUid, pnuEntity.pnu, pnuEntity.createdDttm, pnuEntity.chnDtctObjtId)
|
||||||
|
.values(geoUid, pnu, ZonedDateTime.now(), chnDtctObjtId)
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,7 +169,8 @@ public class GukYuinRepositoryImpl implements GukYuinRepositoryCustom {
|
|||||||
mapSheetLearnEntity.targetYyyy,
|
mapSheetLearnEntity.targetYyyy,
|
||||||
mapSheetLearnEntity.stage,
|
mapSheetLearnEntity.stage,
|
||||||
mapSheetLearnEntity.uid,
|
mapSheetLearnEntity.uid,
|
||||||
mapSheetLearnEntity.applyStatus))
|
mapSheetLearnEntity.applyStatus,
|
||||||
|
mapSheetLearnEntity.applyYn))
|
||||||
.from(mapSheetLearnEntity)
|
.from(mapSheetLearnEntity)
|
||||||
.where(mapSheetLearnEntity.uuid.eq(uuid))
|
.where(mapSheetLearnEntity.uuid.eq(uuid))
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
@@ -164,7 +182,7 @@ public class GukYuinRepositoryImpl implements GukYuinRepositoryCustom {
|
|||||||
Expressions.numberTemplate(Integer.class, "coalesce({0}, 0)", mapSheetLearnEntity.stage);
|
Expressions.numberTemplate(Integer.class, "coalesce({0}, 0)", mapSheetLearnEntity.stage);
|
||||||
|
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.select(stageExpr.max())
|
.select(stageExpr.max().coalesce(0))
|
||||||
.from(mapSheetLearnEntity)
|
.from(mapSheetLearnEntity)
|
||||||
.where(
|
.where(
|
||||||
mapSheetLearnEntity.compareYyyy.eq(compareYyyy),
|
mapSheetLearnEntity.compareYyyy.eq(compareYyyy),
|
||||||
@@ -187,6 +205,7 @@ public class GukYuinRepositoryImpl implements GukYuinRepositoryCustom {
|
|||||||
.update(mapSheetAnalInferenceEntity)
|
.update(mapSheetAnalInferenceEntity)
|
||||||
.set(mapSheetAnalInferenceEntity.gukyuinUsed, "Y")
|
.set(mapSheetAnalInferenceEntity.gukyuinUsed, "Y")
|
||||||
.set(mapSheetAnalInferenceEntity.gukyuinApplyDttm, ZonedDateTime.now())
|
.set(mapSheetAnalInferenceEntity.gukyuinApplyDttm, ZonedDateTime.now())
|
||||||
|
.set(mapSheetAnalInferenceEntity.stage, Integer.parseInt(registRes.getChnDtctSno()))
|
||||||
.where(mapSheetAnalInferenceEntity.learnId.eq(learnId))
|
.where(mapSheetAnalInferenceEntity.learnId.eq(learnId))
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
@@ -266,6 +285,39 @@ public class GukYuinRepositoryImpl implements GukYuinRepositoryCustom {
|
|||||||
.fetch();
|
.fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long findMapSheetLearnInfoByYyyy(
|
||||||
|
Integer compareYyyy, Integer targetYyyy, Integer maxStage) {
|
||||||
|
return queryFactory
|
||||||
|
.select(mapSheetLearnEntity.id)
|
||||||
|
.from(mapSheetLearnEntity)
|
||||||
|
.where(
|
||||||
|
mapSheetLearnEntity.compareYyyy.eq(compareYyyy),
|
||||||
|
mapSheetLearnEntity.targetYyyy.eq(targetYyyy),
|
||||||
|
mapSheetLearnEntity.stage.eq(maxStage))
|
||||||
|
.fetchOne();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateMapSheetLearnGukyuinEndStatus(Long learnId) {
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetLearnEntity)
|
||||||
|
.set(mapSheetLearnEntity.applyStatus, GukYuinStatus.END.getId())
|
||||||
|
.set(mapSheetLearnEntity.applyStatusDttm, ZonedDateTime.now())
|
||||||
|
.where(mapSheetLearnEntity.id.eq(learnId))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateMapSheetInferenceLabelEndStatus(Long learnId) {
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetAnalInferenceEntity)
|
||||||
|
.set(mapSheetAnalInferenceEntity.analState, LabelMngState.FINISH.getId())
|
||||||
|
.set(mapSheetAnalInferenceEntity.updatedDttm, ZonedDateTime.now())
|
||||||
|
.where(mapSheetAnalInferenceEntity.learnId.eq(learnId))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void updateGukYuinApplyStateComplete(Long id, GukYuinStatus status) {
|
public void updateGukYuinApplyStateComplete(Long id, GukYuinStatus status) {
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.PnuEntity;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
public interface GukYuinStbltJobRepository
|
||||||
|
extends JpaRepository<PnuEntity, Long>, GukYuinStbltJobRepositoryCustom {}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.StbltResult;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.RlbDtctMastDto;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.PnuEntity;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface GukYuinStbltJobRepositoryCustom {
|
||||||
|
|
||||||
|
List<LearnKeyDto> findGukYuinEligibleForSurveyList(String status);
|
||||||
|
|
||||||
|
void updateGukYuinEligibleForSurvey(String resultUid, RlbDtctMastDto stbltDto);
|
||||||
|
|
||||||
|
PnuEntity findPnuEntityByResultUid(String resultUid, String pnu);
|
||||||
|
|
||||||
|
void updateGukYuinObjectStbltYn(String resultUid, StbltResult stbResult);
|
||||||
|
}
|
||||||
@@ -0,0 +1,109 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
||||||
|
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceEntity.mapSheetAnalDataInferenceEntity;
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity;
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalInferenceEntity.mapSheetAnalInferenceEntity;
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity.mapSheetLearnEntity;
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QPnuEntity.pnuEntity;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.common.enums.ImageryFitStatus;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.StbltResult;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.RlbDtctMastDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataInferenceGeomEntity;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.PnuEntity;
|
||||||
|
import com.querydsl.core.types.Projections;
|
||||||
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||||
|
import jakarta.persistence.EntityManager;
|
||||||
|
import jakarta.persistence.PersistenceContext;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class GukYuinStbltJobRepositoryImpl implements GukYuinStbltJobRepositoryCustom {
|
||||||
|
|
||||||
|
private final JPAQueryFactory queryFactory;
|
||||||
|
@PersistenceContext private EntityManager em;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<LearnKeyDto> findGukYuinEligibleForSurveyList(String status) {
|
||||||
|
return queryFactory
|
||||||
|
.select(
|
||||||
|
Projections.constructor(
|
||||||
|
LearnKeyDto.class,
|
||||||
|
mapSheetLearnEntity.id,
|
||||||
|
mapSheetLearnEntity.uid,
|
||||||
|
mapSheetLearnEntity.chnDtctMstId))
|
||||||
|
.from(mapSheetLearnEntity)
|
||||||
|
.innerJoin(mapSheetAnalInferenceEntity)
|
||||||
|
.on(mapSheetLearnEntity.id.eq(mapSheetAnalInferenceEntity.learnId))
|
||||||
|
.innerJoin(mapSheetAnalDataInferenceEntity)
|
||||||
|
.on(mapSheetAnalInferenceEntity.id.eq(mapSheetAnalDataInferenceEntity.analUid))
|
||||||
|
.innerJoin(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.on(mapSheetAnalDataInferenceEntity.id.eq(mapSheetAnalDataInferenceGeomEntity.dataUid))
|
||||||
|
.where(
|
||||||
|
mapSheetLearnEntity.applyStatus.eq(GukYuinStatus.PNU_COMPLETED.getId()),
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.pnu.gt(0),
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.fitState.isNull())
|
||||||
|
.groupBy(mapSheetLearnEntity.id, mapSheetLearnEntity.uid, mapSheetLearnEntity.chnDtctMstId)
|
||||||
|
.having(mapSheetAnalDataInferenceGeomEntity.geoUid.count().gt(1L))
|
||||||
|
.fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateGukYuinEligibleForSurvey(String resultUid, RlbDtctMastDto stbltDto) {
|
||||||
|
|
||||||
|
MapSheetAnalDataInferenceGeomEntity geomEntity =
|
||||||
|
queryFactory
|
||||||
|
.selectFrom(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.where(mapSheetAnalDataInferenceGeomEntity.resultUid.eq(resultUid))
|
||||||
|
.fetchOne();
|
||||||
|
|
||||||
|
if (geomEntity != null) {
|
||||||
|
PnuEntity pnuEt =
|
||||||
|
queryFactory
|
||||||
|
.selectFrom(pnuEntity)
|
||||||
|
.where(pnuEntity.chnDtctObjtId.eq(resultUid))
|
||||||
|
.fetchFirst();
|
||||||
|
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.set(
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.fitState,
|
||||||
|
pnuEt.getStbltYn().equals("Y")
|
||||||
|
? ImageryFitStatus.UNFIT.getId()
|
||||||
|
: ImageryFitStatus.FIT.getId()) // 적합여부가 Y 이면 부적합인 것, N 이면 적합한 것이라고 함
|
||||||
|
.set(mapSheetAnalDataInferenceGeomEntity.fitStateDttm, ZonedDateTime.now())
|
||||||
|
.set(mapSheetAnalDataInferenceGeomEntity.lockYn, stbltDto.getLockYn())
|
||||||
|
.where(mapSheetAnalDataInferenceGeomEntity.resultUid.eq(resultUid))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PnuEntity findPnuEntityByResultUid(String resultUid, String pnu) {
|
||||||
|
return queryFactory
|
||||||
|
.selectFrom(pnuEntity)
|
||||||
|
.where(pnuEntity.pnu.eq(pnu), pnuEntity.chnDtctObjtId.eq(resultUid))
|
||||||
|
.fetchOne();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateGukYuinObjectStbltYn(String resultUid, StbltResult stbResult) {
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.set(
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.fitState,
|
||||||
|
stbResult.getStbltYn().equals("Y")
|
||||||
|
? ImageryFitStatus.UNFIT.getId()
|
||||||
|
: ImageryFitStatus.FIT.getId()) // 적합여부가 Y 이면 부적합인 것, N 이면 적합한 것이라고 함
|
||||||
|
.set(mapSheetAnalDataInferenceGeomEntity.fitStateDttm, ZonedDateTime.now())
|
||||||
|
.set(mapSheetAnalDataInferenceGeomEntity.fitStateCmmnt, stbResult.getIncyCmnt())
|
||||||
|
.where(mapSheetAnalDataInferenceGeomEntity.resultUid.eq(resultUid))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ package com.kamco.cd.kamcoback.postgres.repository.label;
|
|||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.AllocateInfoDto;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.AllocateInfoDto;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InferenceDetail;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InferenceDetail;
|
||||||
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InferenceLearnDto;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelerDetail;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelerDetail;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelingStatDto;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelingStatDto;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.MoveInfo;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.MoveInfo;
|
||||||
@@ -15,6 +16,7 @@ import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerStatistics;
|
|||||||
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
|
|
||||||
@@ -104,4 +106,13 @@ public interface LabelAllocateRepositoryCustom {
|
|||||||
void updateAnalInferenceMngState(UUID uuid, String status);
|
void updateAnalInferenceMngState(UUID uuid, String status);
|
||||||
|
|
||||||
Long findLabelingIngProcessCnt();
|
Long findLabelingIngProcessCnt();
|
||||||
|
|
||||||
|
InferenceLearnDto findLabelingIngProcessId(UUID uuid);
|
||||||
|
|
||||||
|
Optional<String> findLearnUid(UUID uuid);
|
||||||
|
|
||||||
|
List<AllocateInfoDto> fetchNextIdsAddStbltYn(
|
||||||
|
UUID uuid, LocalDate baseDate, Long lastId, Long totalCnt);
|
||||||
|
|
||||||
|
Long findAllocateAddCnt(UUID uuid, LocalDate baseDate);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,12 +6,15 @@ import static com.kamco.cd.kamcoback.postgres.entity.QLabelingLabelerEntity.labe
|
|||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceEntity.mapSheetAnalDataInferenceEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceEntity.mapSheetAnalDataInferenceEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalInferenceEntity.mapSheetAnalInferenceEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalInferenceEntity.mapSheetAnalInferenceEntity;
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity.mapSheetLearnEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMemberEntity.memberEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMemberEntity.memberEntity;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.common.enums.ImageryFitStatus;
|
||||||
import com.kamco.cd.kamcoback.common.enums.StatusType;
|
import com.kamco.cd.kamcoback.common.enums.StatusType;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.AllocateInfoDto;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.AllocateInfoDto;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InferenceDetail;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InferenceDetail;
|
||||||
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InferenceLearnDto;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InspectState;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InspectState;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelMngState;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelMngState;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelState;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelState;
|
||||||
@@ -48,6 +51,7 @@ import java.time.ZoneId;
|
|||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -82,7 +86,9 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
.innerJoin(mapSheetAnalDataInferenceGeomEntity)
|
.innerJoin(mapSheetAnalDataInferenceGeomEntity)
|
||||||
.on(
|
.on(
|
||||||
mapSheetAnalDataInferenceEntity.id.eq(mapSheetAnalDataInferenceGeomEntity.dataUid),
|
mapSheetAnalDataInferenceEntity.id.eq(mapSheetAnalDataInferenceGeomEntity.dataUid),
|
||||||
mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull(),
|
// mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull(),
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.pnu.gt(0),
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.fitState.eq(ImageryFitStatus.UNFIT.getId()),
|
||||||
mapSheetAnalDataInferenceGeomEntity.labelState.isNull())
|
mapSheetAnalDataInferenceGeomEntity.labelState.isNull())
|
||||||
.where(
|
.where(
|
||||||
mapSheetAnalInferenceEntity.uuid.eq(uuid),
|
mapSheetAnalInferenceEntity.uuid.eq(uuid),
|
||||||
@@ -126,8 +132,8 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
"""
|
"""
|
||||||
insert into tb_labeling_assignment
|
insert into tb_labeling_assignment
|
||||||
(assignment_uid, inference_geom_uid, worker_uid,
|
(assignment_uid, inference_geom_uid, worker_uid,
|
||||||
work_state, assign_group_id, anal_uid, pnu)
|
work_state, assign_group_id, anal_uid)
|
||||||
values (?, ?, ?, ?, ?, ?, ?)
|
values (?, ?, ?, ?, ?, ?)
|
||||||
""";
|
""";
|
||||||
|
|
||||||
try (PreparedStatement ps = connection.prepareStatement(sql)) {
|
try (PreparedStatement ps = connection.prepareStatement(sql)) {
|
||||||
@@ -140,7 +146,6 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
ps.setString(4, LabelState.ASSIGNED.getId());
|
ps.setString(4, LabelState.ASSIGNED.getId());
|
||||||
ps.setString(5, String.valueOf(info.getMapSheetNum()));
|
ps.setString(5, String.valueOf(info.getMapSheetNum()));
|
||||||
ps.setLong(6, analEntity.getId());
|
ps.setLong(6, analEntity.getId());
|
||||||
ps.setLong(7, info.getPnu());
|
|
||||||
|
|
||||||
ps.addBatch();
|
ps.addBatch();
|
||||||
batchSize++;
|
batchSize++;
|
||||||
@@ -190,7 +195,9 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
.innerJoin(mapSheetAnalDataInferenceGeomEntity)
|
.innerJoin(mapSheetAnalDataInferenceGeomEntity)
|
||||||
.on(
|
.on(
|
||||||
mapSheetAnalDataInferenceEntity.id.eq(mapSheetAnalDataInferenceGeomEntity.dataUid),
|
mapSheetAnalDataInferenceEntity.id.eq(mapSheetAnalDataInferenceGeomEntity.dataUid),
|
||||||
mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull(),
|
// mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull(),
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.pnu.gt(0),
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.fitState.eq(ImageryFitStatus.UNFIT.getId()),
|
||||||
mapSheetAnalDataInferenceGeomEntity.labelState.isNull())
|
mapSheetAnalDataInferenceGeomEntity.labelState.isNull())
|
||||||
.where(mapSheetAnalInferenceEntity.uuid.eq(uuid))
|
.where(mapSheetAnalInferenceEntity.uuid.eq(uuid))
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
@@ -381,9 +388,10 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
mapSheetAnalDataInferenceGeomEntity.compareYyyy.eq(analEntity.getCompareYyyy()),
|
mapSheetAnalDataInferenceGeomEntity.compareYyyy.eq(analEntity.getCompareYyyy()),
|
||||||
mapSheetAnalDataInferenceGeomEntity.targetYyyy.eq(analEntity.getTargetYyyy()),
|
mapSheetAnalDataInferenceGeomEntity.targetYyyy.eq(analEntity.getTargetYyyy()),
|
||||||
mapSheetAnalDataInferenceGeomEntity.stage.eq(analEntity.getStage()),
|
mapSheetAnalDataInferenceGeomEntity.stage.eq(analEntity.getStage()),
|
||||||
mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull()
|
// mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull()
|
||||||
// mapSheetAnalDataInferenceGeomEntity.pnu.gt(0L)
|
mapSheetAnalDataInferenceGeomEntity.pnu.gt(0L),
|
||||||
// mapSheetAnalDataInferenceGeomEntity.passYn.isFalse() //TODO:
|
mapSheetAnalDataInferenceGeomEntity.fitState.eq(
|
||||||
|
ImageryFitStatus.UNFIT.getId()) // TODO:
|
||||||
// 추후 라벨링 대상 조건 수정하기
|
// 추후 라벨링 대상 조건 수정하기
|
||||||
)
|
)
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
@@ -555,11 +563,9 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
mapSheetAnalDataInferenceGeomEntity.dataUid))
|
mapSheetAnalDataInferenceGeomEntity.dataUid))
|
||||||
.where(
|
.where(
|
||||||
mapSheetAnalInferenceEntity.uuid.eq(targetUuid),
|
mapSheetAnalInferenceEntity.uuid.eq(targetUuid),
|
||||||
mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull()
|
// mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull()
|
||||||
// mapSheetAnalDataInferenceGeomEntity.pnu.gt(0L),
|
mapSheetAnalDataInferenceGeomEntity.pnu.gt(0L),
|
||||||
// mapSheetAnalDataInferenceGeomEntity.passYn.isFalse() //TODO: 추후 라벨링
|
mapSheetAnalDataInferenceGeomEntity.fitState.eq(ImageryFitStatus.UNFIT.getId()))
|
||||||
// 대상 조건 수정하기
|
|
||||||
)
|
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -576,8 +582,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
queryFactory
|
queryFactory
|
||||||
.select(labelingAssignmentEntity.count())
|
.select(labelingAssignmentEntity.count())
|
||||||
.from(labelingAssignmentEntity)
|
.from(labelingAssignmentEntity)
|
||||||
.where(
|
.where(analUidCondition, labelingAssignmentEntity.workState.in("SKIP", "DONE"))
|
||||||
analUidCondition, labelingAssignmentEntity.workState.in("ASSIGNED", "SKIP", "DONE"))
|
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
Long skipCount =
|
Long skipCount =
|
||||||
@@ -602,6 +607,13 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
.where(analUidCondition, labelingAssignmentEntity.inspectState.eq("COMPLETE"))
|
.where(analUidCondition, labelingAssignmentEntity.inspectState.eq("COMPLETE"))
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
|
Long inspectionExcept =
|
||||||
|
queryFactory
|
||||||
|
.select(labelingAssignmentEntity.count())
|
||||||
|
.from(labelingAssignmentEntity)
|
||||||
|
.where(analUidCondition, labelingAssignmentEntity.inspectState.eq("EXCEPT"))
|
||||||
|
.fetchOne();
|
||||||
|
|
||||||
Long inspectorCount =
|
Long inspectorCount =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(labelingAssignmentEntity.inspectorUid.countDistinct())
|
.select(labelingAssignmentEntity.inspectorUid.countDistinct())
|
||||||
@@ -614,6 +626,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
long labelCompleted = labelingCompleted != null ? labelingCompleted : 0L;
|
long labelCompleted = labelingCompleted != null ? labelingCompleted : 0L;
|
||||||
long inspectCompleted = inspectionCompleted != null ? inspectionCompleted : 0L;
|
long inspectCompleted = inspectionCompleted != null ? inspectionCompleted : 0L;
|
||||||
long skipped = skipCount != null ? skipCount : 0L;
|
long skipped = skipCount != null ? skipCount : 0L;
|
||||||
|
long inspectExcepted = inspectionExcept != null ? inspectionExcept : 0L;
|
||||||
|
|
||||||
long labelingRemaining = labelingTotal - labelCompleted - skipped;
|
long labelingRemaining = labelingTotal - labelCompleted - skipped;
|
||||||
if (labelingRemaining < 0) {
|
if (labelingRemaining < 0) {
|
||||||
@@ -621,7 +634,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
}
|
}
|
||||||
|
|
||||||
long inspectionTotal = labelingTotal;
|
long inspectionTotal = labelingTotal;
|
||||||
long inspectionRemaining = inspectionTotal - inspectCompleted - skipped;
|
long inspectionRemaining = inspectionTotal - inspectCompleted - inspectExcepted;
|
||||||
if (inspectionRemaining < 0) {
|
if (inspectionRemaining < 0) {
|
||||||
inspectionRemaining = 0;
|
inspectionRemaining = 0;
|
||||||
}
|
}
|
||||||
@@ -658,7 +671,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
.inspectionStatus(inspectionStatus)
|
.inspectionStatus(inspectionStatus)
|
||||||
.inspectionTotalCount(inspectionTotal)
|
.inspectionTotalCount(inspectionTotal)
|
||||||
.inspectionCompletedCount(inspectCompleted)
|
.inspectionCompletedCount(inspectCompleted)
|
||||||
.inspectionSkipCount(skipped) // TODO
|
.inspectionSkipCount(inspectExcepted)
|
||||||
.inspectionRemainingCount(inspectionRemaining)
|
.inspectionRemainingCount(inspectionRemaining)
|
||||||
.inspectorCount(inspectorCount != null ? inspectorCount : 0L)
|
.inspectorCount(inspectorCount != null ? inspectorCount : 0L)
|
||||||
.progressRate(labelingRate)
|
.progressRate(labelingRate)
|
||||||
@@ -740,11 +753,9 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
mapSheetAnalInferenceEntity.targetYyyy.eq(
|
mapSheetAnalInferenceEntity.targetYyyy.eq(
|
||||||
mapSheetAnalDataInferenceGeomEntity.targetYyyy),
|
mapSheetAnalDataInferenceGeomEntity.targetYyyy),
|
||||||
mapSheetAnalInferenceEntity.stage.eq(mapSheetAnalDataInferenceGeomEntity.stage),
|
mapSheetAnalInferenceEntity.stage.eq(mapSheetAnalDataInferenceGeomEntity.stage),
|
||||||
mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull()
|
// mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull()
|
||||||
// mapSheetAnalDataInferenceGeomEntity.pnu.gt(0),
|
mapSheetAnalDataInferenceGeomEntity.pnu.gt(0),
|
||||||
// mapSheetAnalDataInferenceGeomEntity.passYn.isFalse() //TODO: 추후 라벨링 대상 조건
|
mapSheetAnalDataInferenceGeomEntity.fitState.eq(ImageryFitStatus.UNFIT.getId()))
|
||||||
// 수정하기
|
|
||||||
)
|
|
||||||
.where(mapSheetAnalInferenceEntity.id.eq(analEntity.getId()))
|
.where(mapSheetAnalInferenceEntity.id.eq(analEntity.getId()))
|
||||||
.groupBy(
|
.groupBy(
|
||||||
mapSheetAnalInferenceEntity.analTitle,
|
mapSheetAnalInferenceEntity.analTitle,
|
||||||
@@ -1816,4 +1827,85 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
LabelMngState.ASSIGNED.getId(), LabelMngState.ING.getId()))
|
LabelMngState.ASSIGNED.getId(), LabelMngState.ING.getId()))
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public InferenceLearnDto findLabelingIngProcessId(UUID uuid) {
|
||||||
|
return queryFactory
|
||||||
|
.select(
|
||||||
|
Projections.constructor(
|
||||||
|
InferenceLearnDto.class,
|
||||||
|
mapSheetAnalInferenceEntity.uuid,
|
||||||
|
mapSheetLearnEntity.uid,
|
||||||
|
mapSheetAnalInferenceEntity.analState,
|
||||||
|
mapSheetAnalInferenceEntity.id))
|
||||||
|
.from(mapSheetLearnEntity)
|
||||||
|
.join(mapSheetAnalInferenceEntity)
|
||||||
|
.on(mapSheetAnalInferenceEntity.learnId.eq(mapSheetLearnEntity.id))
|
||||||
|
.where(mapSheetAnalInferenceEntity.uuid.eq(uuid))
|
||||||
|
.fetchOne();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<String> findLearnUid(UUID uuid) {
|
||||||
|
return Optional.ofNullable(
|
||||||
|
queryFactory
|
||||||
|
.select(mapSheetLearnEntity.uid)
|
||||||
|
.from(mapSheetLearnEntity)
|
||||||
|
.innerJoin(mapSheetAnalInferenceEntity)
|
||||||
|
.on(mapSheetAnalInferenceEntity.learnId.eq(mapSheetLearnEntity.id))
|
||||||
|
.where(mapSheetAnalInferenceEntity.uuid.eq(uuid))
|
||||||
|
.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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user