116 Commits

Author SHA1 Message Date
827f701186 Merge pull request 'feat/infer_dev_260211' (#80) from feat/infer_dev_260211 into develop
Reviewed-on: #80
2026-02-20 11:12:25 +09:00
db897268de 비밀번호 변경 API 시큐리티 로직 수정 2026-02-20 11:11:39 +09:00
4dc5c196ca 추론실행 변경 2026-02-20 09:46:47 +09:00
ea74203667 add log 2026-02-19 22:18:36 +09:00
9421df2b9b dd 2026-02-19 22:17:55 +09:00
2a3bf9852d Merge pull request '모델 M1,M2,M3를 G1,G2,G3 으로 변경(추론실행 포함)' (#79) from feat/infer_dev_260211 into develop
Reviewed-on: #79
2026-02-19 16:08:33 +09:00
3f1bb8f082 모델 M1,M2,M3를 G1,G2,G3 으로 변경(추론실행 포함) 2026-02-19 16:07:59 +09:00
21ac562fd5 Merge pull request '모델타입 M -> G로 수정 다시 원복' (#78) from feat/infer_dev_260211 into develop
Reviewed-on: #78
2026-02-18 16:56:53 +09:00
778e87383c 모델타입 M -> G로 수정 다시 원복 2026-02-18 16:56:37 +09:00
aac8c91cd0 Merge pull request '모델타입 M -> G로 수정' (#77) from feat/infer_dev_260211 into develop
Reviewed-on: #77
2026-02-18 16:49:27 +09:00
38c4fbf4e5 모델타입 M -> G로 수정 2026-02-18 16:48:56 +09:00
b8fc314bff Merge pull request '라벨링툴 count 종료된 회차는 count하지 않게 조건 추가' (#76) from feat/infer_dev_260206 into develop
Reviewed-on: #76
2026-02-12 18:28:38 +09:00
a2bb1b2442 라벨링툴 count 종료된 회차는 count하지 않게 조건 추가 2026-02-12 18:03:34 +09:00
4e2e5c0b1d Merge pull request 'open-in-view: false' (#75) from feat/infer_dev_260211 into develop
Reviewed-on: #75
2026-02-11 16:33:50 +09:00
fd1ba1ef3b 대용량 다운로드 테스트 2026-02-11 16:33:21 +09:00
6b65dbdc75 Merge pull request 'feat/infer_dev_260211' (#74) from feat/infer_dev_260211 into develop
Reviewed-on: #74
2026-02-11 16:23:42 +09:00
2d2b55efcd 대용량 다운로드 테스트 2026-02-11 16:23:24 +09:00
ac13f36663 대용량 다운로드 테스트 2026-02-11 15:55:27 +09:00
82f08c4240 Merge pull request '대용량 다운로드 테스트' (#73) from feat/infer_dev_260211 into develop
Reviewed-on: #73
2026-02-11 15:52:37 +09:00
e15b35943b 대용량 다운로드 테스트 2026-02-11 15:52:19 +09:00
8bdccfdce6 Merge pull request '대용량 다운로드 테스트' (#72) from feat/infer_dev_260211 into develop
Reviewed-on: #72
2026-02-11 15:34:38 +09:00
e209eeb826 대용량 다운로드 테스트 2026-02-11 15:34:10 +09:00
3aca011104 Merge pull request '대용량 다운로드 테스트' (#71) from feat/infer_dev_260211 into develop
Reviewed-on: #71
2026-02-11 15:18:04 +09:00
2c320194b4 대용량 다운로드 테스트 2026-02-11 15:17:43 +09:00
3f6737706a Merge pull request '대용량 다운로드 수정' (#70) from feat/infer_dev_260211 into develop
Reviewed-on: #70
2026-02-11 13:54:24 +09:00
0df7d7c5cf 대용량 다운로드 수정 2026-02-11 13:54:10 +09:00
3724528ea9 Merge pull request '대용량 다운로드 수정' (#69) from feat/infer_dev_260211 into develop
Reviewed-on: #69
2026-02-11 13:46:43 +09:00
9885c19b50 대용량 다운로드 수정 2026-02-11 13:46:28 +09:00
079a899822 Merge pull request '대용량 다운로드 수정' (#68) from feat/infer_dev_260211 into develop
Reviewed-on: #68
2026-02-11 12:35:04 +09:00
5b09b2e29a 대용량 다운로드 수정 2026-02-11 12:34:51 +09:00
58a73de9ab Merge pull request '대용량 다운로드 테스트 html 추가' (#67) from feat/infer_dev_260211 into develop
Reviewed-on: #67
2026-02-11 12:16:52 +09:00
4cbd2b8d76 대용량 다운로드 테스트 html 추가 2026-02-11 12:16:32 +09:00
f4a890bec8 Merge pull request '대용량 다운로드 테스트 html 추가' (#66) from feat/infer_dev_260211 into develop
Reviewed-on: #66
2026-02-11 12:01:47 +09:00
89504e4156 대용량 다운로드 테스트 html 추가 2026-02-11 12:01:18 +09:00
783609b015 Merge pull request '대용량 다운로드 타임아웃 설정' (#65) from feat/infer_dev_260211 into develop
Reviewed-on: #65
2026-02-11 11:47:02 +09:00
5d33190c31 대용량 다운로드 타임아웃 설정 2026-02-11 11:46:34 +09:00
92232e13f1 Merge pull request '라벨 다운로드 수정' (#64) from feat/infer_dev_260211 into develop
Reviewed-on: #64
2026-02-11 11:37:59 +09:00
81b0b55d57 라벨 다운로드 수정 2026-02-11 11:37:36 +09:00
83ef7e36ed shp 생성 profile 파라미터 추가 2026-02-11 10:46:02 +09:00
0d13e6989f Merge pull request '라벨링 다운로드 경로 추가' (#63) from feat/infer_dev_260206 into develop
Reviewed-on: #63
2026-02-11 09:57:36 +09:00
80b037a9cb 라벨링 다운로드 경로 추가 2026-02-11 09:57:02 +09:00
4342df9bf5 대용량 다운로드, 라벨링 다운로드 이력 기능 추가
Reviewed-on: #62
2026-02-11 09:54:57 +09:00
8f9585b516 dd 2026-02-11 06:54:46 +09:00
43b5a79031 Merge pull request 'change prod properties' (#61) from feat/dean/change_point into develop
Reviewed-on: #61
2026-02-11 06:33:02 +09:00
3ba3b05f2f change prod properties 2026-02-11 06:29:30 +09:00
298b90a289 라벨 다운로드 확인 API 추가 2026-02-10 16:50:02 +09:00
985e1789d2 파일다운로드 변경, 파일다운로드 로그 저장 변경, 라벨 다운로드 이력 추가, 라벨 다운로드 추가 2026-02-10 11:20:16 +09:00
fffc2efd96 change prod properties 2026-02-09 22:42:23 +09:00
2d86fab030 라벨링툴 > 검수자 상세 라벨러 이름 조건 수정, 이노팸 object DTO 주석 추가 2026-02-09 12:29:35 +09:00
82e3250fd4 Merge pull request '라벨링툴 탐지분류 명칭 추가' (#60) from feat/infer_dev_260206 into develop
Reviewed-on: #60
2026-02-06 16:46:28 +09:00
cf6b1323d8 라벨링툴 탐지분류 명칭 추가 2026-02-06 16:46:04 +09:00
470f2191b7 Merge pull request '국유인 배치 수정, 라벨링툴 적합여부 수정' (#59) from feat/infer_dev_260206 into develop
Reviewed-on: #59
2026-02-06 16:33:56 +09:00
5377294e6e 국유인 배치 수정, 라벨링툴 적합여부 수정 2026-02-06 16:32:46 +09:00
c127531412 Merge pull request '레이어명 추가' (#58) from feat/infer_dev_260206 into develop
Reviewed-on: #58
2026-02-06 16:00:27 +09:00
4e3e2a0181 레이어명 추가 2026-02-06 15:59:56 +09:00
61cfd8240a Merge pull request '스웨거 로그인 수정' (#57) from feat/infer_dev_260206 into develop
Reviewed-on: #57
2026-02-06 14:54:29 +09:00
57a2ec8367 스웨거 로그인 수정 2026-02-06 14:53:54 +09:00
54b6712273 Merge pull request '국유인 등록 로직 순서 변경' (#56) from feat/infer_dev_260206 into develop
Reviewed-on: #56
2026-02-06 14:25:51 +09:00
fe6edbb19f 국유인 등록 로직 순서 변경 2026-02-06 14:25:16 +09:00
b2141e98c0 Merge pull request '국유인 실태조사 적합여부 업데이트 로직 수정, 라벨링 건수 조건 수정' (#55) from feat/infer_dev_260206 into develop
Reviewed-on: #55
2026-02-06 11:12:56 +09:00
0e45adc52e 국유인 실태조사 적합여부 업데이트 로직 수정, 라벨링 건수 조건 수정 2026-02-06 11:12:15 +09:00
581b8c968e Merge pull request '국유인 수정, 라벨대상 건수 수정' (#54) from feat/infer_dev_260107 into develop
Reviewed-on: #54
2026-02-06 09:53:01 +09:00
bdce18119f Merge pull request '학습데이터 라벨링 현황 건수 조건 수정, 라벨러, 검수자 목록 수정' (#53) from feat/infer_dev_260107 into develop
Reviewed-on: #53
2026-02-05 18:01:45 +09:00
3b5536a57e Merge pull request '국유인 연동 경로 확인 TEST' (#52) from feat/infer_dev_260107 into develop
Reviewed-on: #52
2026-02-05 17:00:37 +09:00
9dd03f3c52 Merge pull request '국유인 API 수정 추가' (#51) from feat/infer_dev_260107 into develop
Reviewed-on: #51
2026-02-05 15:10:34 +09:00
796591eca6 Merge pull request '국유인 API 수정 추가' (#50) from feat/infer_dev_260107 into develop
Reviewed-on: #50
2026-02-05 15:03:06 +09:00
825e393e05 Merge pull request '국유인 API 수정 추가' (#49) from feat/infer_dev_260107 into develop
Reviewed-on: #49
2026-02-05 14:58:50 +09:00
1410333829 Merge pull request '국유인 API 수정' (#48) from feat/infer_dev_260107 into develop
Reviewed-on: #48
2026-02-05 14:55:43 +09:00
d63980476f Merge pull request '라벨링 할당 수정' (#47) from feat/infer_dev_260107 into develop
Reviewed-on: #47
2026-02-05 13:56:01 +09:00
ae1693a33c Merge pull request '라벨링 가능 건수 조건 수정' (#46) from feat/infer_dev_260107 into develop
Reviewed-on: #46
2026-02-05 13:49:44 +09:00
8dfae65bcc Merge pull request 'feat/infer_dev_260107' (#45) from feat/infer_dev_260107 into develop
Reviewed-on: #45
2026-02-04 17:56:37 +09:00
872df11844 Merge pull request '국유in 등록 로그 추가' (#44) from feat/infer_dev_260107 into develop
Reviewed-on: #44
2026-02-04 11:10:55 +09:00
f992bbe9ca Merge pull request '국유인, 라벨링 job 각각 분리 작업' (#43) from feat/infer_dev_260107 into develop
Reviewed-on: #43
2026-02-02 19:18:15 +09:00
643ea5cf9a Merge pull request 'spotless 적용' (#42) from feat/infer_dev_260107 into develop
Reviewed-on: #42
2026-02-02 17:17:45 +09:00
bc4b2dbac1 Merge pull request 'feat/infer_dev_260107' (#41) from feat/infer_dev_260107 into develop
Reviewed-on: #41
2026-02-02 17:16:21 +09:00
694b2fc31e Merge pull request '인증 예시 아이디 수정' (#40) from feat/infer_dev_260107 into develop
Reviewed-on: #40
2026-02-02 14:01:01 +09:00
fbdda6477c Merge pull request '사번 자리수 6자리 벨리데이션 수정' (#39) from feat/infer_dev_260107 into develop
Reviewed-on: #39
2026-02-02 13:37:13 +09:00
a572089dff Merge pull request '변화지도 레이어 조회 url 수정' (#38) from feat/infer_dev_260107 into develop
Reviewed-on: #38
2026-02-02 12:22:50 +09:00
c6abf7a935 Merge pull request 'feat/infer_dev_260107' (#37) from feat/infer_dev_260107 into develop
Reviewed-on: #37
2026-02-02 12:18:09 +09:00
a9348d9a66 Merge pull request '타일 url 시큐리티 추가' (#36) from feat/infer_dev_260107 into develop
Reviewed-on: #36
2026-02-02 10:31:59 +09:00
b877d2a8c9 Merge pull request 'feat/infer_dev_260107' (#35) from feat/infer_dev_260107 into develop
Reviewed-on: #35
2026-02-02 10:28:28 +09:00
151012ea28 Merge pull request 'feat/infer_dev_260107' (#34) from feat/infer_dev_260107 into develop
Reviewed-on: #34
2026-02-02 10:14:44 +09:00
68c68082cf Merge branch 'develop' of ssh://192.168.2.126:2222/MVPTeam/kamco-cd-api into develop 2026-02-01 22:27:49 +09:00
4ce96b72aa prod 2026-02-01 22:27:20 +09:00
0a5c5dfd7d Merge pull request 'crs 타입 수정하기' (#32) from feat/infer_dev_260107 into develop
Reviewed-on: #32
2026-01-30 21:43:05 +09:00
7442e4ee09 Merge pull request 'feat/infer_dev_260107' (#31) from feat/infer_dev_260107 into develop
Reviewed-on: #31
2026-01-30 21:32:17 +09:00
d278baed96 Merge pull request 'feat/infer_dev_260107' (#30) from feat/infer_dev_260107 into develop
Reviewed-on: #30
2026-01-30 21:05:04 +09:00
6b0074316f Merge pull request 'feat/infer_dev_260107' (#29) from feat/infer_dev_260107 into develop
Reviewed-on: #29
2026-01-30 19:44:42 +09:00
f921ef5d0d Merge pull request 'geoserver url 변경' (#28) from feat/infer_dev_260107 into develop
Reviewed-on: #28
2026-01-30 19:16:14 +09:00
7667620395 Merge pull request 'bbox 5186 transform' (#27) from feat/infer_dev_260107 into develop
Reviewed-on: #27
2026-01-30 18:20:03 +09:00
527acc9839 Merge pull request 'bbox 5186 으로 변환' (#26) from feat/infer_dev_260107 into develop
Reviewed-on: #26
2026-01-30 18:09:46 +09:00
407f14d230 Merge pull request 'wmts 수정' (#25) from feat/infer_dev_260107 into develop
Reviewed-on: #25
2026-01-30 17:56:40 +09:00
4a91d61b7d Merge pull request '추론실행 퍼센트 수정' (#24) from feat/infer_dev_260107 into develop
Reviewed-on: #24
2026-01-30 17:49:40 +09:00
9d7bbc1b63 Merge pull request 'wmts 수정, 국유인 어제완료된 라벨전송, 전송완료된 리스트 기능 추가' (#23) from feat/infer_dev_260107 into develop
Reviewed-on: #23
2026-01-30 17:44:26 +09:00
f46ea62761 Merge pull request 'RestTemplateConfig 수정' (#22) from feat/infer_dev_260107 into develop
Reviewed-on: #22
2026-01-30 17:21:11 +09:00
1abc0b93c0 Merge pull request 'RestTemplateConfig 수정, wmts 수정' (#21) from feat/infer_dev_260107 into develop
Reviewed-on: #21
2026-01-30 17:13:30 +09:00
4204e48d88 Merge pull request 'feat/infer_dev_260107' (#20) from feat/infer_dev_260107 into develop
Reviewed-on: #20
2026-01-30 16:53:04 +09:00
fa41d41739 Merge pull request 'RestTemplateConfig 수정, 추론실행 수정' (#19) from feat/infer_dev_260107 into develop
Reviewed-on: #19
2026-01-30 16:19:02 +09:00
ee28edd9d0 Merge pull request 'RestTemplateConfig 수정' (#18) from feat/infer_dev_260107 into develop
Reviewed-on: #18
2026-01-30 14:44:05 +09:00
8555897b77 Merge pull request 'feat/infer_dev_260107' (#17) from feat/infer_dev_260107 into develop
Reviewed-on: #17
2026-01-30 14:19:34 +09:00
fe7b1ed0bd Merge pull request '레이어관리 수정' (#16) from feat/infer_dev_260107 into develop
Reviewed-on: #16
2026-01-30 11:54:34 +09:00
064c02e21b Merge pull request '년도 1개만 조회하는 타일 API' (#15) from feat/infer_dev_260107 into develop
Reviewed-on: #15
2026-01-30 11:17:59 +09:00
fd3499a5ec Merge pull request 'feat/infer_dev_260107' (#14) from feat/infer_dev_260107 into develop
Reviewed-on: #14
2026-01-30 11:05:30 +09:00
686cf03524 Merge pull request 'geoserver 등록 수정' (#13) from feat/infer_dev_260107 into develop
Reviewed-on: #13
2026-01-30 10:23:20 +09:00
ee9914a5f3 Merge pull request 'geoserver 등록 수정' (#12) from feat/infer_dev_260107 into develop
Reviewed-on: #12
2026-01-30 10:21:25 +09:00
b3e90c9f2b Merge pull request 'feat/infer_dev_260107' (#11) from feat/infer_dev_260107 into develop
Reviewed-on: #11
2026-01-30 09:50:59 +09:00
156b7a312d Merge pull request '레이어관리 - 변화지도,라벨링툴 맵 리스트' (#10) from feat/infer_dev_260107 into develop
Reviewed-on: #10
2026-01-29 20:56:34 +09:00
cfed31656a Merge pull request 'ai 주소 변경' (#9) from feat/infer_dev_260107 into develop
Reviewed-on: #9
2026-01-29 20:12:17 +09:00
14e8a6476f Merge pull request '영상관리 등록 년도 tile 추가' (#8) from feat/infer_dev_260107 into develop
Reviewed-on: #8
2026-01-29 19:03:39 +09:00
ae6de0c030 Merge pull request 'ai 주소 변경' (#7) from feat/infer_dev_260107 into develop
Reviewed-on: #7
2026-01-29 17:34:32 +09:00
4036f88296 Merge pull request 'feat/infer_dev_260107' (#6) from feat/infer_dev_260107 into develop
Reviewed-on: #6
2026-01-29 16:25:08 +09:00
28718c4218 Merge pull request 'feat/infer_dev_260107' (#5) from feat/infer_dev_260107 into develop
Reviewed-on: #5
2026-01-29 14:42:55 +09:00
54c92842d4 Merge pull request '헬스체크 시큐리티 설정 추가' (#4) from feat/infer_dev_260107 into develop
Reviewed-on: #4
2026-01-29 12:30:48 +09:00
c83c540dfb Merge pull request 'feat/infer_dev_260107' (#3) from feat/infer_dev_260107 into develop
Reviewed-on: #3
2026-01-29 12:16:10 +09:00
dd1284f5c0 Merge pull request '추론실행 수정' (#2) from feat/infer_dev_260107 into develop
Reviewed-on: #2
2026-01-29 10:35:15 +09:00
385ada3291 Merge pull request 'feat/infer_dev_260107' (#1) from feat/infer_dev_260107 into develop
Reviewed-on: #1
2026-01-29 10:31:31 +09:00
68 changed files with 1696 additions and 383 deletions

29
Dockerfile-prod Normal file
View 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
View 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"]

View File

@@ -15,10 +15,6 @@ services:
- SPRING_PROFILES_ACTIVE=dev - SPRING_PROFILES_ACTIVE=dev
- TZ=Asia/Seoul - TZ=Asia/Seoul
volumes: volumes:
- /mnt/nfs_share/images:/app/original-images
- /mnt/nfs_share/model_output:/app/model-outputs
- /mnt/nfs_share/train_dataset:/app/train-dataset
- /mnt/nfs_share/tmp:/app/tmp
- /kamco-nfs:/kamco-nfs - /kamco-nfs:/kamco-nfs
networks: networks:
- kamco-cds - kamco-cds

50
docker-compose-prod.yml Normal file
View File

@@ -0,0 +1,50 @@
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:
build:
context: .
dockerfile: Dockerfile-prod
args:
UID: 1000 # manager01 UID
GID: 1000 # manager01 GID
image: kamco-cd-api:${IMAGE_TAG:-latest}
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
View 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
View 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
View 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;
}

View File

@@ -18,12 +18,13 @@ import org.springframework.web.filter.OncePerRequestFilter;
@RequiredArgsConstructor @RequiredArgsConstructor
public class JwtAuthenticationFilter extends OncePerRequestFilter { public class JwtAuthenticationFilter extends OncePerRequestFilter {
private final JwtTokenProvider jwtTokenProvider;
private final UserDetailsService userDetailsService;
private static final AntPathMatcher PATH_MATCHER = new AntPathMatcher(); private static final AntPathMatcher PATH_MATCHER = new AntPathMatcher();
private static final String[] EXCLUDE_PATHS = { private static final String[] EXCLUDE_PATHS = {
"/api/auth/signin", "/api/auth/refresh", "/api/auth/logout", "/api/members/*/password" // "/api/auth/signin", "/api/auth/refresh", "/api/auth/logout", "/api/members/*/password"
"/api/auth/signin", "/api/auth/refresh", "/api/auth/logout"
}; };
private final JwtTokenProvider jwtTokenProvider;
private final UserDetailsService userDetailsService;
@Override @Override
protected void doFilterInternal( protected void doFilterInternal(

View File

@@ -0,0 +1,92 @@
package com.kamco.cd.kamcoback.common.download;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.kamco.cd.kamcoback.common.download.dto.DownloadAuditEvent;
import com.kamco.cd.kamcoback.menu.dto.MenuDto;
import com.kamco.cd.kamcoback.menu.service.MenuService;
import com.kamco.cd.kamcoback.postgres.entity.AuditLogEntity;
import com.kamco.cd.kamcoback.postgres.repository.log.AuditLogRepository;
import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Objects;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@Slf4j
@Component
@RequiredArgsConstructor
public class DownloadAuditEventListener {
private final AuditLogRepository auditLogRepository;
private final MenuService menuService;
private final ObjectMapper objectMapper;
@Async("auditLogExecutor")
@Transactional(propagation = Propagation.REQUIRES_NEW)
@EventListener
public void onDownloadAudit(DownloadAuditEvent ev) {
try {
String menuUid = resolveMenuUid(ev.normalizedUri());
if (menuUid == null) {
// menuUid null 불가 -> 스킵
log.warn(
"MenuUid not resolved. skip audit. uri={}, normalized={}",
ev.requestUri(),
ev.normalizedUri());
return;
}
AuditLogEntity logEntity =
AuditLogEntity.forFileDownload(
ev.userId(), ev.requestUri(), menuUid, ev.ip(), ev.status(), ev.downloadUuid());
auditLogRepository.save(logEntity);
} catch (Exception e) {
// 본 요청과 분리되어야 함
log.warn("Download audit save failed. uri={}, err={}", ev.requestUri(), e.toString());
}
}
private String resolveMenuUid(String normalizedUri) {
try {
List<?> list = menuService.getFindAll();
List<MenuDto.Basic> basics =
list.stream()
.map(
item -> {
if (item instanceof LinkedHashMap<?, ?> map) {
return objectMapper.convertValue(map, MenuDto.Basic.class);
} else if (item instanceof MenuDto.Basic dto) {
return dto;
}
return null;
})
.filter(Objects::nonNull)
.toList();
MenuDto.Basic basic =
basics.stream()
.filter(m -> m.getMenuUrl() != null && normalizedUri.startsWith(m.getMenuUrl()))
.max(Comparator.comparingInt(m -> m.getMenuUrl().length()))
.orElse(null);
if (basic == null) return null;
String menuUidStr = basic.getMenuUid(); // ← String
if (menuUidStr == null || menuUidStr.isBlank()) return null;
return menuUidStr; // ← Long 변환
} catch (Exception e) {
return null;
}
}
}

View File

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

View File

@@ -0,0 +1,79 @@
package com.kamco.cd.kamcoback.common.download;
import jakarta.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.ResourceRegion;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpRange;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
@Component
public class RangeDownloadResponder {
public ResponseEntity<?> buildZipResponse(
Path filePath, String downloadFileName, HttpServletRequest request) throws IOException {
if (!Files.isRegularFile(filePath)) {
return ResponseEntity.notFound().build();
}
long totalSize = Files.size(filePath);
Resource resource = new FileSystemResource(filePath);
String disposition = "attachment; filename=\"" + downloadFileName + "\"";
String rangeHeader = request.getHeader(HttpHeaders.RANGE);
// 🔥 공통 헤더 (여기 고정)
ResponseEntity.BodyBuilder base =
ResponseEntity.ok()
.contentType(MediaType.APPLICATION_OCTET_STREAM)
.header(HttpHeaders.CONTENT_DISPOSITION, disposition)
.header(HttpHeaders.ACCEPT_RANGES, "bytes")
.header("X-Accel-Buffering", "no");
if (rangeHeader == null || rangeHeader.isBlank()) {
return base.contentLength(totalSize).body(resource);
}
List<HttpRange> ranges;
try {
ranges = HttpRange.parseRanges(rangeHeader);
} catch (IllegalArgumentException ex) {
return ResponseEntity.status(416)
.header(HttpHeaders.CONTENT_RANGE, "bytes */" + totalSize)
.header("X-Accel-Buffering", "no")
.build();
}
HttpRange range = ranges.get(0);
long start = range.getRangeStart(totalSize);
long end = range.getRangeEnd(totalSize);
if (start >= totalSize) {
return ResponseEntity.status(416)
.header(HttpHeaders.CONTENT_RANGE, "bytes */" + totalSize)
.header("X-Accel-Buffering", "no")
.build();
}
long regionLength = end - start + 1;
ResourceRegion region = new ResourceRegion(resource, start, regionLength);
return ResponseEntity.status(206)
.contentType(MediaType.APPLICATION_OCTET_STREAM)
.header(HttpHeaders.CONTENT_DISPOSITION, disposition)
.header(HttpHeaders.ACCEPT_RANGES, "bytes")
.header("X-Accel-Buffering", "no")
.header(HttpHeaders.CONTENT_RANGE, "bytes " + start + "-" + end + "/" + totalSize)
.contentLength(regionLength)
.body(region);
}
}

View File

@@ -0,0 +1,11 @@
package com.kamco.cd.kamcoback.common.download.dto;
import java.util.UUID;
public record DownloadAuditEvent(
Long userId,
String requestUri,
String normalizedUri,
String ip,
int status,
UUID downloadUuid) {}

View File

@@ -7,11 +7,14 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Log4j2 @Log4j2
@Component @Component
public class ExternalJarRunner { public class ExternalJarRunner {
@Value("${spring.profiles.active}")
private String profile;
private static final long TIMEOUT_MINUTES = TimeUnit.DAYS.toMinutes(3); private static final long TIMEOUT_MINUTES = TimeUnit.DAYS.toMinutes(3);
@@ -40,7 +43,7 @@ public class ExternalJarRunner {
if (mode != null && !mode.isEmpty()) { if (mode != null && !mode.isEmpty()) {
addArg(args, "converter.mode", mode); addArg(args, "converter.mode", mode);
} }
addArg(args, "spring.profiles.active", profile);
execJar(jarPath, args); execJar(jarPath, args);
} }
@@ -57,6 +60,7 @@ public class ExternalJarRunner {
addArg(args, "upload-shp", register); addArg(args, "upload-shp", register);
// addArg(args, "layer", layer); // addArg(args, "layer", layer);
addArg(args, "spring.profiles.active", profile);
execJar(jarPath, args); execJar(jarPath, args);
} }

View File

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

View File

@@ -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,21 +71,33 @@ 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",
@@ -90,24 +106,21 @@ public class SecurityConfig {
"/api/layer/tile-url", "/api/layer/tile-url",
"/api/layer/tile-url-year") "/api/layer/tile-url-year")
.permitAll() .permitAll()
// 로그인한 사용자만 가능 IAM // 로그인한 사용자만 가능 IAM
.requestMatchers( .requestMatchers(
"/api/user/**", "/api/user/**",
"/api/my/menus", "/api/my/menus",
"/api/common-code/**", "/api/common-code/**",
"/api/members/*/password",
"/api/training-data/label/**", "/api/training-data/label/**",
"/api/training-data/review/**") "/api/training-data/review/**")
.authenticated() .authenticated()
.anyRequest()
.access(menuAuthorizationManager)
// .authenticated() // 나머지는 메뉴권한
) .anyRequest()
.addFilterBefore( .access(menuAuthorizationManager))
jwtAuthenticationFilter, .addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class);
UsernamePasswordAuthenticationFilter
.class) // 요청 들어오면 먼저 JWT 토큰 검사 후 security context 에 사용자 정보 저장.
;
return http.build(); return http.build();
} }
@@ -118,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;
} }

View File

@@ -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/**"); // 학습데이터 다운로드
} }
} }

View File

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

View File

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

View File

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

View File

@@ -137,4 +137,15 @@ public class ChngDetectContDto {
private String reqIp; private String reqIp;
private String reqEpno; private String reqEpno;
} }
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class StbltResult {
private String stbltYn;
private String incyCd;
private String incyCmnt;
}
} }

View File

@@ -247,45 +247,45 @@ public class ChngDetectMastDto {
@AllArgsConstructor @AllArgsConstructor
public static class RlbDtctMastDto { public static class RlbDtctMastDto {
private String pnuDtctId; private String pnuDtctId; // PNU탐지ID
private String pnu; private String pnu; // PNU코드(19자리)
private String lrmSyncYmd; private String lrmSyncYmd; // 지적도동기화일자(YYYYMMDD)
private String pnuSyncYmd; private String pnuSyncYmd; // PNU동기화일자(YYYYMMDD)
private String mpqdNo; // 도번호 private String mpqdNo; // 도번호
private String cprsYr; // 비교년도 private String cprsYr; // 비교년도
private String crtrYr; // 기준년도 private String crtrYr; // 기준년도
private String chnDtctSno; // 회차 private String chnDtctSno; // 회차, 변화탐지순번
private String chnDtctId; private String chnDtctId; // 변화탐지ID(UUID)
private String chnDtctMstId; private String chnDtctMstId; // 변화탐지마스터ID
private String chnDtctObjtId; private String chnDtctObjtId; // 변화탐지객체ID
private String chnDtctContId; private String chnDtctContId; // 변화탐지내용ID
private String chnCd; private String chnCd; // 변화코드
private String chnDtctProb; private String chnDtctProb; // 변화탐지정확도(0~1)
private String bfClsCd; // 이전분류코드 private String bfClsCd; // 이전분류코드
private String bfClsProb; // 이전분류정확도 private String bfClsProb; // 이전분류정확도(0~1)
private String afClsCd; // 이후분류코드 private String afClsCd; // 이후분류코드
private String afClsProb; // 이후분류정확도 private String afClsProb; // 이후분류정확도(0~1)
private String pnuSqms; private String pnuSqms; // PNU면적(㎡)
private String pnuDtctSqms; private String pnuDtctSqms; // PNU탐지면적(㎡)
private String chnDtctSqms; private String chnDtctSqms; // 변화탐지면적(㎡)
private String stbltYn; private String stbltYn; // 적합여부(Y/N) - 안정성 (Y:부적합, N:적합)
private String incyCd; private String incyCd; // 부적합코드
private String incyRsnCont; private String incyRsnCont; // 부적합사유내용
private String lockYn; private String lockYn; // 잠금여부(Y/N)
private String lblYn; private String lblYn; // 라벨여부(Y/N)
private String chgYn; private String chgYn; // 변경여부(Y/N)
private String rsatctNo; private String rsatctNo; // 부동산등기번호
private String rmk; private String rmk; // 비고
private String crtDt; // 생성일시 private String crtDt; // 생성일시
private String crtEpno; // 생성사원번호 private String crtEpno; // 생성사원번호
private String crtIp; // 생성사원아이피 private String crtIp; // 생성사원아이피
private String chgDt; private String chgDt; // 변경일시
private String chgEpno; private String chgEpno; // 변경자사번
private String chgIp; private String chgIp; // 변경자IP
private String delYn; // 삭제여부 private String delYn; // 삭제여부
} }

View File

@@ -452,20 +452,15 @@ public class GukYuinApiService {
return new ResponseObj(ApiResponseCode.DUPLICATE_DATA, "이미 국유인 연동을 한 회차입니다."); return new ResponseObj(ApiResponseCode.DUPLICATE_DATA, "이미 국유인 연동을 한 회차입니다.");
} }
if (!Files.isDirectory(Path.of("/kamco-nfs/dataset/export/" + info.getUid()))) {
return new ResponseObj(
ApiResponseCode.NOT_FOUND_DATA, "파일 경로에 회차 실행 파일이 생성되지 않았습니다. 확인 부탁드립니다.");
}
// 비교년도,기준년도로 전송한 데이터 있는지 확인 후 회차 번호 생성 // 비교년도,기준년도로 전송한 데이터 있는지 확인 후 회차 번호 생성
Integer maxStage = Integer maxStage =
gukyuinCoreService.findMapSheetLearnYearStage(info.getCompareYyyy(), info.getTargetYyyy()); gukyuinCoreService.findMapSheetLearnYearStage(info.getCompareYyyy(), info.getTargetYyyy());
// 1회차를 종료 상태로 처리하고 2회차를 보내야 함
// 추론(learn), 학습데이터(inference) 둘 다 종료 처리
if (maxStage > 0) {
Long learnId =
gukyuinCoreService.findMapSheetLearnInfoByYyyy(
info.getCompareYyyy(), info.getTargetYyyy(), maxStage);
gukyuinCoreService.updateMapSheetLearnGukyuinEndStatus(learnId);
gukyuinCoreService.updateMapSheetInferenceLabelEndStatus(learnId);
}
// reqDto 셋팅 // reqDto 셋팅
ChnDetectMastReqDto reqDto = new ChnDetectMastReqDto(); ChnDetectMastReqDto reqDto = new ChnDetectMastReqDto();
reqDto.setCprsYr(String.valueOf(info.getCompareYyyy())); reqDto.setCprsYr(String.valueOf(info.getCompareYyyy()));
@@ -474,9 +469,14 @@ public class GukYuinApiService {
reqDto.setChnDtctId(info.getUid()); reqDto.setChnDtctId(info.getUid());
reqDto.setPathNm("/kamco-nfs/dataset/export/" + info.getUid()); reqDto.setPathNm("/kamco-nfs/dataset/export/" + info.getUid());
if (!Files.isDirectory(Path.of("/kamco-nfs/dataset/export/" + info.getUid()))) { // 1회차를 종료 상태로 처리하고 2회차를 보내야 함
return new ResponseObj( // 추론(learn), 학습데이터(inference) 둘 다 종료 처리
ApiResponseCode.NOT_FOUND_DATA, "파일 경로에 회차 실행 파일이 생성되지 않았습니다. 확인 부탁드립니다."); if (maxStage > 0) {
Long learnId =
gukyuinCoreService.findMapSheetLearnInfoByYyyy(
info.getCompareYyyy(), info.getTargetYyyy(), maxStage);
gukyuinCoreService.updateMapSheetLearnGukyuinEndStatus(learnId);
gukyuinCoreService.updateMapSheetInferenceLabelEndStatus(learnId);
} }
// 국유인 /chn/mast/regist 전송 // 국유인 /chn/mast/regist 전송

View File

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

View File

@@ -246,15 +246,15 @@ public class InferenceResultDto {
@NotBlank @NotBlank
private String title; private String title;
@Schema(description = "M1", example = "b40e0f68-c1d8-49fc-93f9-a36270093861") @Schema(description = "G1", example = "b40e0f68-c1d8-49fc-93f9-a36270093861")
@NotNull @NotNull
private UUID model1Uuid; private UUID model1Uuid;
@Schema(description = "M2", example = "ec92b7d2-b5a3-4915-9bdf-35fb3ca8ad27") @Schema(description = "G2", example = "ec92b7d2-b5a3-4915-9bdf-35fb3ca8ad27")
@NotNull @NotNull
private UUID model2Uuid; private UUID model2Uuid;
@Schema(description = "M3", example = "37f45782-8ccf-4cf6-911c-a055a1510d39") @Schema(description = "G3", example = "37f45782-8ccf-4cf6-911c-a055a1510d39")
@NotNull @NotNull
private UUID model3Uuid; private UUID model3Uuid;
@@ -297,6 +297,30 @@ public class InferenceResultDto {
@Schema(name = "InferenceStatusDetailDto", description = "추론(변화탐지) 진행상태") @Schema(name = "InferenceStatusDetailDto", description = "추론(변화탐지) 진행상태")
public static class InferenceStatusDetailDto { public static class InferenceStatusDetailDto {
@Schema(description = "모델1 사용시간 시작일시")
@JsonFormatDttm
ZonedDateTime m1ModelStartDttm;
@Schema(description = "모델2 사용시간 시작일시")
@JsonFormatDttm
ZonedDateTime m2ModelStartDttm;
@Schema(description = "모델3 사용시간 시작일시")
@JsonFormatDttm
ZonedDateTime m3ModelStartDttm;
@Schema(description = "모델1 사용시간 종료일시")
@JsonFormatDttm
ZonedDateTime m1ModelEndDttm;
@Schema(description = "모델2 사용시간 종료일시")
@JsonFormatDttm
ZonedDateTime m2ModelEndDttm;
@Schema(description = "모델3 사용시간 종료일시")
@JsonFormatDttm
ZonedDateTime m3ModelEndDttm;
@Schema(description = "탐지대상 도엽수") @Schema(description = "탐지대상 도엽수")
private Long detectingCnt; private Long detectingCnt;
@@ -336,30 +360,6 @@ public class InferenceResultDto {
@Schema(description = "모델3 분석 실패") @Schema(description = "모델3 분석 실패")
private Integer m3FailedJobs; private Integer m3FailedJobs;
@Schema(description = "모델1 사용시간 시작일시")
@JsonFormatDttm
ZonedDateTime m1ModelStartDttm;
@Schema(description = "모델2 사용시간 시작일시")
@JsonFormatDttm
ZonedDateTime m2ModelStartDttm;
@Schema(description = "모델3 사용시간 시작일시")
@JsonFormatDttm
ZonedDateTime m3ModelStartDttm;
@Schema(description = "모델1 사용시간 종료일시")
@JsonFormatDttm
ZonedDateTime m1ModelEndDttm;
@Schema(description = "모델2 사용시간 종료일시")
@JsonFormatDttm
ZonedDateTime m2ModelEndDttm;
@Schema(description = "모델3 사용시간 종료일시")
@JsonFormatDttm
ZonedDateTime m3ModelEndDttm;
@Schema(description = "변화탐지 제목") @Schema(description = "변화탐지 제목")
private String title; private String title;
@@ -496,19 +496,19 @@ public class InferenceResultDto {
return MapSheetScope.getDescByCode(this.mapSheetScope); return MapSheetScope.getDescByCode(this.mapSheetScope);
} }
@Schema(description = "M1 사용시간") @Schema(description = "G1 사용시간")
@JsonProperty("m1ElapsedTim") @JsonProperty("m1ElapsedTim")
public String getM1ElapsedTime() { public String getM1ElapsedTime() {
return formatElapsedTime(this.m1ModelStartDttm, this.m1ModelEndDttm); return formatElapsedTime(this.m1ModelStartDttm, this.m1ModelEndDttm);
} }
@Schema(description = "M2 사용시간") @Schema(description = "G2 사용시간")
@JsonProperty("m2ElapsedTim") @JsonProperty("m2ElapsedTim")
public String getM2ElapsedTime() { public String getM2ElapsedTime() {
return formatElapsedTime(this.m2ModelStartDttm, this.m2ModelEndDttm); return formatElapsedTime(this.m2ModelStartDttm, this.m2ModelEndDttm);
} }
@Schema(description = "M3 사용시간") @Schema(description = "G3 사용시간")
@JsonProperty("m3ElapsedTim") @JsonProperty("m3ElapsedTim")
public String getM3ElapsedTime() { public String getM3ElapsedTime() {
return formatElapsedTime(this.m3ModelStartDttm, this.m3ModelEndDttm); return formatElapsedTime(this.m3ModelStartDttm, this.m3ModelEndDttm);

View File

@@ -248,7 +248,7 @@ public class InferenceResultService {
saveInferenceAiDto.setUuid(uuid); saveInferenceAiDto.setUuid(uuid);
saveInferenceAiDto.setBatchId(batchId); saveInferenceAiDto.setBatchId(batchId);
saveInferenceAiDto.setStatus(Status.IN_PROGRESS.getId()); saveInferenceAiDto.setStatus(Status.IN_PROGRESS.getId());
saveInferenceAiDto.setType("M1"); saveInferenceAiDto.setType("G1");
saveInferenceAiDto.setInferStartDttm(ZonedDateTime.now()); saveInferenceAiDto.setInferStartDttm(ZonedDateTime.now());
saveInferenceAiDto.setModelComparePath(modelComparePath.getFilePath()); saveInferenceAiDto.setModelComparePath(modelComparePath.getFilePath());
saveInferenceAiDto.setModelTargetPath(modelTargetPath.getFilePath()); saveInferenceAiDto.setModelTargetPath(modelTargetPath.getFilePath());
@@ -414,9 +414,9 @@ public class InferenceResultService {
String modelType = ""; String modelType = "";
if (modelInfo.getModelType().equals(ModelType.M1.getId())) { if (modelInfo.getModelType().equals(ModelType.G1.getId())) {
modelType = "G1"; modelType = "G1";
} else if (modelInfo.getModelType().equals(ModelType.M2.getId())) { } else if (modelInfo.getModelType().equals(ModelType.G2.getId())) {
modelType = "G2"; modelType = "G2";
} else { } else {
modelType = "G3"; modelType = "G3";

View File

@@ -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,34 @@ 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.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 +52,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 +352,110 @@ 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));
}
} }

View File

@@ -359,4 +359,15 @@ 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;
}
} }

View File

@@ -16,25 +16,28 @@ 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.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 +276,30 @@ 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);
}
} }

View File

@@ -31,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;
@@ -63,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;
@@ -119,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;
@@ -215,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;
@@ -268,6 +280,7 @@ public class LayerDto {
private String crs; private String crs;
public LayerMapDto( public LayerMapDto(
String layerName,
String layerType, String layerType,
String tag, String tag,
Long sortOrder, Long sortOrder,
@@ -282,6 +295,7 @@ public class LayerDto {
UUID uuid, UUID uuid,
String rawJsonString, String rawJsonString,
String crs) { String crs) {
this.layerName = layerName;
this.layerType = layerType; this.layerType = layerType;
this.tag = tag; this.tag = tag;
this.sortOrder = sortOrder; this.sortOrder = sortOrder;

View File

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

View File

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

View File

@@ -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;
@@ -79,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);
} }
@@ -89,6 +89,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.saveWms(addDto); return mapLayerCoreService.saveWms(addDto);
} }
@@ -165,24 +166,6 @@ public class LayerService {
return wmsService.getTile(); return wmsService.getTile();
} }
/**
* wms 저장
*
* @param dto
* @return
*/
@Transactional
public UUID saveWms(WmsAddReqDto dto) {
// 선택한 tile 상세정보 조회
WmsLayerInfo info = wmsService.getDetail(dto.getTitle());
WmsAddDto addDto = new WmsAddDto();
addDto.setWmsLayerInfo(info);
addDto.setDescription(dto.getDescription());
addDto.setTitle(dto.getTitle());
addDto.setTag(dto.getTag());
return mapLayerCoreService.saveWms(addDto);
}
public List<LayerMapDto> findLayerMapList(String type) { public List<LayerMapDto> findLayerMapList(String type) {
List<LayerMapDto> layerMapDtoList = mapLayerCoreService.findLayerMapList(type); List<LayerMapDto> layerMapDtoList = mapLayerCoreService.findLayerMapList(type);
layerMapDtoList.forEach( layerMapDtoList.forEach(

View File

@@ -134,7 +134,6 @@ public class MapSheetMngService {
} }
MngDto mngDto = mapSheetMngCoreService.findMapSheetMng(errDto.getMngYyyy()); MngDto mngDto = mapSheetMngCoreService.findMapSheetMng(errDto.getMngYyyy());
String targetYearDir = mngDto.getMngPath();
// 중복체크 -> 도엽50k/uuid 경로에 업로드 할 거라 overwrite 되지 않음 // 중복체크 -> 도엽50k/uuid 경로에 업로드 할 거라 overwrite 되지 않음
// if (!overwrite) { // if (!overwrite) {

View File

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

View File

@@ -41,21 +41,6 @@ public class ModelMngApiController {
private final ModelMngService modelMngService; private final ModelMngService modelMngService;
@Value("${file.sync-root-dir}")
private String syncRootDir;
@Value("${file.sync-tmp-dir}")
private String syncTmpDir;
@Value("${file.sync-file-extention}")
private String syncFileExtention;
@Value("${file.dataset-dir}")
private String datasetDir;
@Value("${file.dataset-tmp-dir}")
private String datasetTmpDir;
@Value("${file.model-dir}") @Value("${file.model-dir}")
private String modelDir; private String modelDir;

View File

@@ -21,9 +21,9 @@ public class ModelMngDto {
@Getter @Getter
@AllArgsConstructor @AllArgsConstructor
public enum ModelType implements EnumType { public enum ModelType implements EnumType {
M1("모델 M1"), G1("G1"),
M2("모델 M2"), G2("G2"),
M3("모델 M3"); G3("G3");
private final String desc; private final String desc;

View File

@@ -35,27 +35,6 @@ public class ModelMngService {
private final UploadService uploadService; private final UploadService uploadService;
@Value("${file.sync-root-dir}")
private String syncRootDir;
@Value("${file.sync-tmp-dir}")
private String syncTmpDir;
@Value("${file.sync-file-extention}")
private String syncFileExtention;
@Value("${file.dataset-dir}")
private String datasetDir;
@Value("${file.dataset-tmp-dir}")
private String datasetTmpDir;
@Value("${file.model-dir}")
private String modelDir;
@Value("${file.model-tmp-dir}")
private String modelTmpDir;
@Value("${file.pt-path}") @Value("${file.pt-path}")
private String ptPath; private String ptPath;

View File

@@ -1,5 +1,6 @@
package com.kamco.cd.kamcoback.postgres.core; 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.LearnKeyDto;
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.RlbDtctMastDto; import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.RlbDtctMastDto;
import com.kamco.cd.kamcoback.postgres.entity.PnuEntity; import com.kamco.cd.kamcoback.postgres.entity.PnuEntity;
@@ -24,13 +25,10 @@ public class GukYuinStbltJobCoreService {
@Transactional @Transactional
public void updateGukYuinEligibleForSurvey(String resultUid, RlbDtctMastDto stbltDto) { public void updateGukYuinEligibleForSurvey(String resultUid, RlbDtctMastDto stbltDto) {
String chnDtctObjtId = "";
PnuEntity entity = PnuEntity entity =
gukYuinStbltRepository.findPnuEntityByResultUid(resultUid, stbltDto.getPnu()); gukYuinStbltRepository.findPnuEntityByResultUid(resultUid, stbltDto.getPnu());
if (entity != null) { if (entity != null) {
chnDtctObjtId = resultUid;
entity.setPnuDtctId(stbltDto.getPnuDtctId()); entity.setPnuDtctId(stbltDto.getPnuDtctId());
entity.setPnu(stbltDto.getPnu()); entity.setPnu(stbltDto.getPnu());
entity.setLrmSyncYmd(stbltDto.getLrmSyncYmd()); entity.setLrmSyncYmd(stbltDto.getLrmSyncYmd());
@@ -68,8 +66,11 @@ public class GukYuinStbltJobCoreService {
entity.setCreatedDttm(ZonedDateTime.now()); entity.setCreatedDttm(ZonedDateTime.now());
gukYuinStbltRepository.save(entity); gukYuinStbltRepository.save(entity);
//
} }
} }
@Transactional
public void updateGukYuinObjectStbltYn(String resultUid, StbltResult stbResult) {
gukYuinStbltRepository.updateGukYuinObjectStbltYn(resultUid, stbResult);
}
} }

View File

@@ -110,7 +110,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("G1");
mapSheetLearnEntity.setM1ModelUuid(req.getModel1Uuid()); mapSheetLearnEntity.setM1ModelUuid(req.getModel1Uuid());
mapSheetLearnEntity.setM2ModelUuid(req.getModel2Uuid()); mapSheetLearnEntity.setM2ModelUuid(req.getModel2Uuid());
mapSheetLearnEntity.setM3ModelUuid(req.getModel3Uuid()); mapSheetLearnEntity.setM3ModelUuid(req.getModel3Uuid());
@@ -301,7 +301,7 @@ public class InferenceResultCoreService {
private void applyModelUpdate(MapSheetLearnEntity entity, SaveInferenceAiDto request) { private void applyModelUpdate(MapSheetLearnEntity entity, SaveInferenceAiDto request) {
switch (request.getType()) { switch (request.getType()) {
case "M1" -> case "G1" ->
applyModelFields( applyModelFields(
request, request,
entity::setM1ModelBatchId, entity::setM1ModelBatchId,
@@ -311,7 +311,7 @@ public class InferenceResultCoreService {
entity::setM1RunningJobs, entity::setM1RunningJobs,
entity::setM1CompletedJobs, entity::setM1CompletedJobs,
entity::setM1FailedJobs); entity::setM1FailedJobs);
case "M2" -> case "G2" ->
applyModelFields( applyModelFields(
request, request,
entity::setM2ModelBatchId, entity::setM2ModelBatchId,
@@ -321,7 +321,7 @@ public class InferenceResultCoreService {
entity::setM2RunningJobs, entity::setM2RunningJobs,
entity::setM2CompletedJobs, entity::setM2CompletedJobs,
entity::setM2FailedJobs); entity::setM2FailedJobs);
case "M3" -> case "G3" ->
applyModelFields( applyModelFields(
request, request,
entity::setM3ModelBatchId, entity::setM3ModelBatchId,

View File

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

View File

@@ -87,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());
} }
@@ -213,6 +217,7 @@ public class MapLayerCoreService {
Long order = mapLayerRepository.findSortOrderDesc(); Long order = mapLayerRepository.findSortOrderDesc();
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());
@@ -243,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());
@@ -273,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());
@@ -305,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());

View File

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

View File

@@ -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;
@@ -109,6 +113,7 @@ public class MapLayerEntity {
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,

View File

@@ -35,17 +35,17 @@ public class MapSheetLearn5kRepositoryImpl implements MapSheetLearn5kRepositoryC
final StringPath errorMsgPath; final StringPath errorMsgPath;
switch (type) { switch (type) {
case "M1" -> { case "G1" -> {
failPath = mapSheetLearn5kEntity.isM1Fail; failPath = mapSheetLearn5kEntity.isM1Fail;
jobIdPath = mapSheetLearn5kEntity.m1JobId; jobIdPath = mapSheetLearn5kEntity.m1JobId;
errorMsgPath = mapSheetLearn5kEntity.m1ErrorMessage; errorMsgPath = mapSheetLearn5kEntity.m1ErrorMessage;
} }
case "M2" -> { case "G2" -> {
failPath = mapSheetLearn5kEntity.isM2Fail; failPath = mapSheetLearn5kEntity.isM2Fail;
jobIdPath = mapSheetLearn5kEntity.m2JobId; jobIdPath = mapSheetLearn5kEntity.m2JobId;
errorMsgPath = mapSheetLearn5kEntity.m2ErrorMessage; errorMsgPath = mapSheetLearn5kEntity.m2ErrorMessage;
} }
case "M3" -> { case "G3" -> {
failPath = mapSheetLearn5kEntity.isM3Fail; failPath = mapSheetLearn5kEntity.isM3Fail;
jobIdPath = mapSheetLearn5kEntity.m3JobId; jobIdPath = mapSheetLearn5kEntity.m3JobId;
errorMsgPath = mapSheetLearn5kEntity.m3ErrorMessage; errorMsgPath = mapSheetLearn5kEntity.m3ErrorMessage;
@@ -85,15 +85,15 @@ public class MapSheetLearn5kRepositoryImpl implements MapSheetLearn5kRepositoryC
final StringPath errorMsgPath; final StringPath errorMsgPath;
switch (type) { switch (type) {
case "M1" -> { case "G1" -> {
failPath = mapSheetLearn5kEntity.isM1Fail; failPath = mapSheetLearn5kEntity.isM1Fail;
jobIdPath = mapSheetLearn5kEntity.m1JobId; jobIdPath = mapSheetLearn5kEntity.m1JobId;
} }
case "M2" -> { case "G2" -> {
failPath = mapSheetLearn5kEntity.isM2Fail; failPath = mapSheetLearn5kEntity.isM2Fail;
jobIdPath = mapSheetLearn5kEntity.m2JobId; jobIdPath = mapSheetLearn5kEntity.m2JobId;
} }
case "M3" -> { case "G3" -> {
failPath = mapSheetLearn5kEntity.isM3Fail; failPath = mapSheetLearn5kEntity.isM3Fail;
jobIdPath = mapSheetLearn5kEntity.m3JobId; jobIdPath = mapSheetLearn5kEntity.m3JobId;
} }
@@ -135,15 +135,15 @@ public class MapSheetLearn5kRepositoryImpl implements MapSheetLearn5kRepositoryC
BooleanPath failPath; BooleanPath failPath;
switch (type) { switch (type) {
case "M1" -> { case "G1" -> {
jobIdPath = mapSheetLearn5kEntity.m1JobId; jobIdPath = mapSheetLearn5kEntity.m1JobId;
failPath = mapSheetLearn5kEntity.isM1Fail; failPath = mapSheetLearn5kEntity.isM1Fail;
} }
case "M2" -> { case "G2" -> {
jobIdPath = mapSheetLearn5kEntity.m2JobId; jobIdPath = mapSheetLearn5kEntity.m2JobId;
failPath = mapSheetLearn5kEntity.isM2Fail; failPath = mapSheetLearn5kEntity.isM2Fail;
} }
case "M3" -> { case "G3" -> {
jobIdPath = mapSheetLearn5kEntity.m3JobId; jobIdPath = mapSheetLearn5kEntity.m3JobId;
failPath = mapSheetLearn5kEntity.isM3Fail; failPath = mapSheetLearn5kEntity.isM3Fail;
} }
@@ -180,13 +180,13 @@ public class MapSheetLearn5kRepositoryImpl implements MapSheetLearn5kRepositoryC
BooleanPath failPath; BooleanPath failPath;
switch (type) { switch (type) {
case "M1" -> { case "G1" -> {
jobIdPath = mapSheetLearn5kEntity.m1JobId; jobIdPath = mapSheetLearn5kEntity.m1JobId;
} }
case "M2" -> { case "G2" -> {
jobIdPath = mapSheetLearn5kEntity.m2JobId; jobIdPath = mapSheetLearn5kEntity.m2JobId;
} }
case "M3" -> { case "G3" -> {
jobIdPath = mapSheetLearn5kEntity.m3JobId; jobIdPath = mapSheetLearn5kEntity.m3JobId;
} }
default -> { default -> {

View File

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

View File

@@ -0,0 +1,5 @@
package com.kamco.cd.kamcoback.postgres.repository.batch;
public interface BatchStepHistoryRepositoryCustom {
boolean isDownloadable(Long analUid);
}

View File

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

View File

@@ -1,5 +1,6 @@
package com.kamco.cd.kamcoback.postgres.repository.gukyuin; 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.LearnKeyDto;
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.RlbDtctMastDto; import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.RlbDtctMastDto;
import com.kamco.cd.kamcoback.postgres.entity.PnuEntity; import com.kamco.cd.kamcoback.postgres.entity.PnuEntity;
@@ -12,4 +13,6 @@ public interface GukYuinStbltJobRepositoryCustom {
void updateGukYuinEligibleForSurvey(String resultUid, RlbDtctMastDto stbltDto); void updateGukYuinEligibleForSurvey(String resultUid, RlbDtctMastDto stbltDto);
PnuEntity findPnuEntityByResultUid(String resultUid, String pnu); PnuEntity findPnuEntityByResultUid(String resultUid, String pnu);
void updateGukYuinObjectStbltYn(String resultUid, StbltResult stbResult);
} }

View File

@@ -7,6 +7,7 @@ import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity.mapShe
import static com.kamco.cd.kamcoback.postgres.entity.QPnuEntity.pnuEntity; import static com.kamco.cd.kamcoback.postgres.entity.QPnuEntity.pnuEntity;
import com.kamco.cd.kamcoback.common.enums.ImageryFitStatus; 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.LearnKeyDto;
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.RlbDtctMastDto; import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.RlbDtctMastDto;
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus; import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
@@ -90,4 +91,19 @@ public class GukYuinStbltJobRepositoryImpl implements GukYuinStbltJobRepositoryC
.where(pnuEntity.pnu.eq(pnu), pnuEntity.chnDtctObjtId.eq(resultUid)) .where(pnuEntity.pnu.eq(pnu), pnuEntity.chnDtctObjtId.eq(resultUid))
.fetchOne(); .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();
}
} }

View File

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

View File

@@ -6,6 +6,7 @@ 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.ImageryFitStatus;
@@ -13,6 +14,7 @@ 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;
@@ -49,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;
@@ -1824,4 +1827,33 @@ 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());
}
} }

View File

@@ -134,20 +134,16 @@ public class LabelWorkRepositoryImpl implements LabelWorkRepositoryCustom {
.and(mapSheetAnalDataInferenceGeomEntity.labelStateDttm.lt(end))); .and(mapSheetAnalDataInferenceGeomEntity.labelStateDttm.lt(end)));
} }
// labelTotCnt: pnu가 있고 pass_yn = false (부적합)인 건수만 라벨링 대상 // labelTotCnt: pnu가 있고 fitState = UNFIT 인 건수만 라벨링 대상
NumberExpression<Long> labelTotCntExpr = NumberExpression<Long> labelTotCntExpr =
new CaseBuilder() new CaseBuilder()
.when( .when(
mapSheetAnalDataInferenceGeomEntity mapSheetAnalDataInferenceGeomEntity
.pnu .pnu
.isNotNull() .gt(0)
.and( .and(
mapSheetAnalDataInferenceGeomEntity.pnu mapSheetAnalDataInferenceGeomEntity.fitState.eq(
.isNotNull()) // TODO: 이노팸 연동 후 0 이상이라고 해야할 듯 ImageryFitStatus.UNFIT.getId())))
//
// .and(mapSheetAnalDataInferenceGeomEntity.passYn.eq(Boolean.FALSE)) //TODO: 추후
// 라벨링 대상 조건 수정하기
)
.then(1L) .then(1L)
.otherwise(0L) .otherwise(0L)
.sum(); .sum();
@@ -201,7 +197,7 @@ public class LabelWorkRepositoryImpl implements LabelWorkRepositoryCustom {
new CaseBuilder() new CaseBuilder()
.when( .when(
mapSheetAnalDataInferenceGeomEntity.labelState.eq( mapSheetAnalDataInferenceGeomEntity.labelState.eq(
LabelState.DONE.getId())) // "LABEL_COMPLETE"? LabelState.DONE.getId()))
.then(1L) .then(1L)
.otherwise(0L) .otherwise(0L)
.sum(), .sum(),

View File

@@ -46,6 +46,7 @@ public class MapLayerRepositoryImpl implements MapLayerRepositoryCustom {
if (searchReq.getTag() != null) { if (searchReq.getTag() != null) {
whereBuilder.and(mapLayerEntity.tag.toLowerCase().eq(searchReq.getTag().toLowerCase())); whereBuilder.and(mapLayerEntity.tag.toLowerCase().eq(searchReq.getTag().toLowerCase()));
} }
if (searchReq.getLayerType() != null) { if (searchReq.getLayerType() != null) {
whereBuilder.and( whereBuilder.and(
mapLayerEntity.layerType.toLowerCase().eq(searchReq.getLayerType().toLowerCase())); mapLayerEntity.layerType.toLowerCase().eq(searchReq.getLayerType().toLowerCase()));
@@ -57,6 +58,7 @@ public class MapLayerRepositoryImpl implements MapLayerRepositoryCustom {
Projections.constructor( Projections.constructor(
LayerDto.Basic.class, LayerDto.Basic.class,
mapLayerEntity.uuid, mapLayerEntity.uuid,
mapLayerEntity.layerName,
mapLayerEntity.layerType, mapLayerEntity.layerType,
mapLayerEntity.description, mapLayerEntity.description,
mapLayerEntity.tag, mapLayerEntity.tag,
@@ -101,6 +103,7 @@ public class MapLayerRepositoryImpl implements MapLayerRepositoryCustom {
.select( .select(
Projections.constructor( Projections.constructor(
LayerMapDto.class, LayerMapDto.class,
mapLayerEntity.layerName,
mapLayerEntity.layerType, mapLayerEntity.layerType,
mapLayerEntity.tag, mapLayerEntity.tag,
mapLayerEntity.order, mapLayerEntity.order,

View File

@@ -168,13 +168,13 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
whereBuilder.and(auditLogEntity.eventStatus.ne(EventStatus.valueOf("FAILED"))); whereBuilder.and(auditLogEntity.eventStatus.ne(EventStatus.valueOf("FAILED")));
whereBuilder.and(auditLogEntity.eventType.eq(EventType.valueOf("DOWNLOAD"))); whereBuilder.and(auditLogEntity.eventType.eq(EventType.valueOf("DOWNLOAD")));
if (req.getMenuId() != null && !req.getMenuId().isEmpty()) { // if (req.getMenuId() != null && !req.getMenuId().isEmpty()) {
whereBuilder.and(auditLogEntity.menuUid.eq(req.getMenuId())); // whereBuilder.and(auditLogEntity.menuUid.eq(req.getMenuId()));
} // }
if (req.getUuid() != null) { if (req.getUuid() != null) {
whereBuilder.and(auditLogEntity.requestUri.contains("/api/inference/download/")); whereBuilder.and(auditLogEntity.requestUri.contains(req.getRequestUri()));
whereBuilder.and(auditLogEntity.requestUri.endsWith(String.valueOf(req.getUuid()))); whereBuilder.and(auditLogEntity.downloadUuid.eq(req.getUuid()));
} }
if (req.getSearchValue() != null && !req.getSearchValue().isEmpty()) { if (req.getSearchValue() != null && !req.getSearchValue().isEmpty()) {

View File

@@ -7,6 +7,7 @@ import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity.mapShe
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InspectState; import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InspectState;
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelMngState; import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelMngState;
import com.kamco.cd.kamcoback.model.dto.ModelMngDto.ModelType;
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity; import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalCntInfo; import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalCntInfo;
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalMapSheetList; import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalMapSheetList;
@@ -58,10 +59,10 @@ public class TrainingDataReviewJobRepositoryImpl extends QuerydslRepositorySuppo
Properties.class, Properties.class,
new CaseBuilder() new CaseBuilder()
.when(mapSheetLearnDataGeomEntity.classAfterCd.in("building", "container")) .when(mapSheetLearnDataGeomEntity.classAfterCd.in("building", "container"))
.then("M1") .then(ModelType.G1.getId())
.when(mapSheetLearnDataGeomEntity.classAfterCd.eq("waste")) .when(mapSheetLearnDataGeomEntity.classAfterCd.eq("waste"))
.then("M2") .then(ModelType.G2.getId())
.otherwise("M3"), .otherwise(ModelType.G3.getId()),
mapSheetLearnDataGeomEntity.classBeforeCd, mapSheetLearnDataGeomEntity.classBeforeCd,
mapSheetLearnDataGeomEntity.classAfterCd))) mapSheetLearnDataGeomEntity.classAfterCd)))
.from(labelingAssignmentEntity) .from(labelingAssignmentEntity)

View File

@@ -10,6 +10,7 @@ import static com.kamco.cd.kamcoback.postgres.entity.QPnuEntity.pnuEntity;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.kamco.cd.kamcoback.common.enums.DetectionClassification;
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;
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity; import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
@@ -305,6 +306,10 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
queryFactory queryFactory
.select(labelingAssignmentEntity.count()) .select(labelingAssignmentEntity.count())
.from(labelingAssignmentEntity) .from(labelingAssignmentEntity)
.innerJoin(mapSheetAnalInferenceEntity)
.on(
labelingAssignmentEntity.analUid.eq(mapSheetAnalInferenceEntity.id),
mapSheetAnalInferenceEntity.analState.ne(LabelMngState.FINISH.getId()))
.where(labelingAssignmentEntity.workerUid.eq(userId)) .where(labelingAssignmentEntity.workerUid.eq(userId))
.fetchOne(); .fetchOne();
@@ -325,6 +330,10 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
queryFactory queryFactory
.select(labelingAssignmentEntity.count()) .select(labelingAssignmentEntity.count())
.from(labelingAssignmentEntity) .from(labelingAssignmentEntity)
.innerJoin(mapSheetAnalInferenceEntity)
.on(
labelingAssignmentEntity.analUid.eq(mapSheetAnalInferenceEntity.id),
mapSheetAnalInferenceEntity.analState.ne(LabelMngState.FINISH.getId()))
.where( .where(
labelingAssignmentEntity.workerUid.eq(userId), labelingAssignmentEntity.workerUid.eq(userId),
labelingAssignmentEntity.workState.eq("ASSIGNED")) labelingAssignmentEntity.workState.eq("ASSIGNED"))
@@ -353,6 +362,10 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
queryFactory queryFactory
.select(labelingAssignmentEntity.count()) .select(labelingAssignmentEntity.count())
.from(labelingAssignmentEntity) .from(labelingAssignmentEntity)
.innerJoin(mapSheetAnalInferenceEntity)
.on(
labelingAssignmentEntity.analUid.eq(mapSheetAnalInferenceEntity.id),
mapSheetAnalInferenceEntity.analState.ne(LabelMngState.FINISH.getId()))
.where( .where(
labelingAssignmentEntity.workerUid.eq(userId), labelingAssignmentEntity.workerUid.eq(userId),
labelingAssignmentEntity.workState.in( labelingAssignmentEntity.workState.in(
@@ -492,6 +505,9 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
mapSheetAnalDataInferenceGeomEntityEntity.getClassBeforeCd() != null mapSheetAnalDataInferenceGeomEntityEntity.getClassBeforeCd() != null
? mapSheetAnalDataInferenceGeomEntityEntity.getClassBeforeCd() ? mapSheetAnalDataInferenceGeomEntityEntity.getClassBeforeCd()
: "") : "")
.classificationName(
DetectionClassification.fromStrDesc(
mapSheetAnalDataInferenceGeomEntityEntity.getClassAfterCd()))
.probability( .probability(
mapSheetAnalDataInferenceGeomEntityEntity.getClassBeforeProb() != null mapSheetAnalDataInferenceGeomEntityEntity.getClassBeforeProb() != null
? mapSheetAnalDataInferenceGeomEntityEntity.getClassBeforeProb() ? mapSheetAnalDataInferenceGeomEntityEntity.getClassBeforeProb()
@@ -503,6 +519,9 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
mapSheetAnalDataInferenceGeomEntityEntity.getClassAfterCd() != null mapSheetAnalDataInferenceGeomEntityEntity.getClassAfterCd() != null
? mapSheetAnalDataInferenceGeomEntityEntity.getClassAfterCd() ? mapSheetAnalDataInferenceGeomEntityEntity.getClassAfterCd()
: "") : "")
.classificationName(
DetectionClassification.fromStrDesc(
mapSheetAnalDataInferenceGeomEntityEntity.getClassAfterCd()))
.probability( .probability(
mapSheetAnalDataInferenceGeomEntityEntity.getClassAfterProb() != null mapSheetAnalDataInferenceGeomEntityEntity.getClassAfterProb() != null
? mapSheetAnalDataInferenceGeomEntityEntity.getClassAfterProb() ? mapSheetAnalDataInferenceGeomEntityEntity.getClassAfterProb()
@@ -524,12 +543,17 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
.build(); .build();
var inspectionResultInfo = var inspectionResultInfo =
InspectionResultInfo.builder() queryFactory
.verificationResult(convertInspectState(assignment.toDto().getInspectState())) .select(
.inappropriateReason("") Projections.constructor(
// .memo(assignment.toDto().getInspectMemo() != null ? InspectionResultInfo.class,
// assignment.toDto().getInspectMemo() : "") mapSheetAnalDataInferenceGeomEntity.fitState,
.build(); mapSheetAnalDataInferenceGeomEntity.fitStateCmmnt))
.from(mapSheetAnalDataInferenceGeomEntity)
.where(
mapSheetAnalDataInferenceGeomEntity.geoUid.eq(
mapSheetAnalDataInferenceGeomEntityEntity.getGeoUid()))
.fetchOne();
// 6. Geometry를 GeoJSON으로 변환 // 6. Geometry를 GeoJSON으로 변환
InferenceDataGeometry inferData = InferenceDataGeometry inferData =

View File

@@ -11,6 +11,7 @@ import static com.kamco.cd.kamcoback.postgres.entity.QPnuEntity.pnuEntity;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.kamco.cd.kamcoback.common.enums.DetectionClassification;
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.postgres.entity.LabelingAssignmentEntity; import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
@@ -24,7 +25,6 @@ import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto.DetailRes;
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto.GeoFeatureRequest.Properties; import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto.GeoFeatureRequest.Properties;
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto.InferenceDataGeometry; import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto.InferenceDataGeometry;
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto.InferenceDataGeometry.InferenceProperties; import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto.InferenceDataGeometry.InferenceProperties;
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto.InspectionResultInfo;
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto.LearnDataGeometry; import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto.LearnDataGeometry;
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto.LearnDataGeometry.LearnProperties; import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto.LearnDataGeometry.LearnProperties;
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto.ReviewGeometryInfo; import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto.ReviewGeometryInfo;
@@ -314,6 +314,10 @@ public class TrainingDataReviewRepositoryImpl extends QuerydslRepositorySupport
queryFactory queryFactory
.select(labelingAssignmentEntity.count()) .select(labelingAssignmentEntity.count())
.from(labelingAssignmentEntity) .from(labelingAssignmentEntity)
.innerJoin(mapSheetAnalInferenceEntity)
.on(
labelingAssignmentEntity.analUid.eq(mapSheetAnalInferenceEntity.id),
mapSheetAnalInferenceEntity.analState.ne(LabelMngState.FINISH.getId()))
.where(labelingAssignmentEntity.inspectorUid.eq(userId)) .where(labelingAssignmentEntity.inspectorUid.eq(userId))
.fetchOne(); .fetchOne();
@@ -334,6 +338,10 @@ public class TrainingDataReviewRepositoryImpl extends QuerydslRepositorySupport
queryFactory queryFactory
.select(labelingAssignmentEntity.count()) .select(labelingAssignmentEntity.count())
.from(labelingAssignmentEntity) .from(labelingAssignmentEntity)
.innerJoin(mapSheetAnalInferenceEntity)
.on(
labelingAssignmentEntity.analUid.eq(mapSheetAnalInferenceEntity.id),
mapSheetAnalInferenceEntity.analState.ne(LabelMngState.FINISH.getId()))
.where( .where(
labelingAssignmentEntity.inspectorUid.eq(userId), labelingAssignmentEntity.inspectorUid.eq(userId),
labelingAssignmentEntity.inspectState.eq("UNCONFIRM")) labelingAssignmentEntity.inspectState.eq("UNCONFIRM"))
@@ -362,6 +370,10 @@ public class TrainingDataReviewRepositoryImpl extends QuerydslRepositorySupport
queryFactory queryFactory
.select(labelingAssignmentEntity.count()) .select(labelingAssignmentEntity.count())
.from(labelingAssignmentEntity) .from(labelingAssignmentEntity)
.innerJoin(mapSheetAnalInferenceEntity)
.on(
labelingAssignmentEntity.analUid.eq(mapSheetAnalInferenceEntity.id),
mapSheetAnalInferenceEntity.analState.ne(LabelMngState.FINISH.getId()))
.where( .where(
labelingAssignmentEntity.inspectorUid.eq(userId), labelingAssignmentEntity.inspectorUid.eq(userId),
labelingAssignmentEntity.inspectState.in("COMPLETE", "EXCEPT"), labelingAssignmentEntity.inspectState.in("COMPLETE", "EXCEPT"),
@@ -483,7 +495,7 @@ public class TrainingDataReviewRepositoryImpl extends QuerydslRepositorySupport
queryFactory queryFactory
.select(memberEntity.name) .select(memberEntity.name)
.from(memberEntity) .from(memberEntity)
.where(memberEntity.userId.eq(assignment.toDto().getWorkerUid())) .where(memberEntity.employeeNo.eq(assignment.toDto().getWorkerUid()))
.fetchFirst(); .fetchFirst();
if (workerName == null) { if (workerName == null) {
workerName = ""; workerName = "";
@@ -520,6 +532,9 @@ public class TrainingDataReviewRepositoryImpl extends QuerydslRepositorySupport
mapSheetAnalDataInferenceGeomEntityEntity.getClassBeforeCd() != null mapSheetAnalDataInferenceGeomEntityEntity.getClassBeforeCd() != null
? mapSheetAnalDataInferenceGeomEntityEntity.getClassBeforeCd() ? mapSheetAnalDataInferenceGeomEntityEntity.getClassBeforeCd()
: "") : "")
.classificationName(
DetectionClassification.fromStrDesc(
mapSheetAnalDataInferenceGeomEntityEntity.getClassAfterCd()))
.probability( .probability(
mapSheetAnalDataInferenceGeomEntityEntity.getClassBeforeProb() != null mapSheetAnalDataInferenceGeomEntityEntity.getClassBeforeProb() != null
? mapSheetAnalDataInferenceGeomEntityEntity.getClassBeforeProb() ? mapSheetAnalDataInferenceGeomEntityEntity.getClassBeforeProb()
@@ -531,6 +546,9 @@ public class TrainingDataReviewRepositoryImpl extends QuerydslRepositorySupport
mapSheetAnalDataInferenceGeomEntityEntity.getClassAfterCd() != null mapSheetAnalDataInferenceGeomEntityEntity.getClassAfterCd() != null
? mapSheetAnalDataInferenceGeomEntityEntity.getClassAfterCd() ? mapSheetAnalDataInferenceGeomEntityEntity.getClassAfterCd()
: "") : "")
.classificationName(
DetectionClassification.fromStrDesc(
mapSheetAnalDataInferenceGeomEntityEntity.getClassAfterCd()))
.probability( .probability(
mapSheetAnalDataInferenceGeomEntityEntity.getClassAfterProb() != null mapSheetAnalDataInferenceGeomEntityEntity.getClassAfterProb() != null
? mapSheetAnalDataInferenceGeomEntityEntity.getClassAfterProb() ? mapSheetAnalDataInferenceGeomEntityEntity.getClassAfterProb()
@@ -553,11 +571,17 @@ public class TrainingDataReviewRepositoryImpl extends QuerydslRepositorySupport
.build(); .build();
var inspectionResultInfo = var inspectionResultInfo =
InspectionResultInfo.builder() queryFactory
.verificationResult(convertInspectState(assignment.toDto().getInspectState())) .select(
.inappropriateReason("") Projections.constructor(
.memo("") TrainingDataReviewDto.InspectionResultInfo.class,
.build(); mapSheetAnalDataInferenceGeomEntity.fitState,
mapSheetAnalDataInferenceGeomEntity.fitStateCmmnt))
.from(mapSheetAnalDataInferenceGeomEntity)
.where(
mapSheetAnalDataInferenceGeomEntity.geoUid.eq(
mapSheetAnalDataInferenceGeomEntityEntity.getGeoUid()))
.fetchOne();
// 6. Geometry를 GeoJSON으로 변환 // 6. Geometry를 GeoJSON으로 변환
InferenceDataGeometry inferData = InferenceDataGeometry inferData =

View File

@@ -60,10 +60,10 @@ select msldge1_0.geo_uid,
st_asgeojson(msldge1_0.geom), st_asgeojson(msldge1_0.geom),
case case
when (msldge1_0.class_after_cd in ('building', 'container')) when (msldge1_0.class_after_cd in ('building', 'container'))
then cast('M1' as varchar) then cast('G1' as varchar)
when (msldge1_0.class_after_cd = 'waste') when (msldge1_0.class_after_cd = 'waste')
then cast('M2' as varchar) then cast('G2' as varchar)
else 'M3' else 'G3'
end, end,
msldge1_0.class_before_cd, msldge1_0.class_before_cd,
msldge1_0.class_after_cd msldge1_0.class_after_cd

View File

@@ -20,4 +20,15 @@ public class AsyncConfig {
ex.initialize(); ex.initialize();
return ex; return ex;
} }
@Bean(name = "auditLogExecutor")
public Executor auditLogExecutor() {
ThreadPoolTaskExecutor exec = new ThreadPoolTaskExecutor();
exec.setCorePoolSize(2);
exec.setMaxPoolSize(8);
exec.setQueueCapacity(2000);
exec.setThreadNamePrefix("auditlog-");
exec.initialize();
return exec;
}
} }

View File

@@ -1,5 +1,6 @@
package com.kamco.cd.kamcoback.scheduler.service; package com.kamco.cd.kamcoback.scheduler.service;
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.LearnKeyDto;
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.RlbDtctDto; import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.RlbDtctDto;
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.RlbDtctMastDto; import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.RlbDtctMastDto;
@@ -10,6 +11,8 @@ import java.time.LocalDate;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
@@ -37,7 +40,7 @@ public class GukYuinApiStbltJobService {
} }
/** 국유인 연동 후, 실태조사 적합여부 확인하여 update */ /** 국유인 연동 후, 실태조사 적합여부 확인하여 update */
@Scheduled(cron = "0 0 3 * * *") // 0 0 3 * * * @Scheduled(cron = "0 0 3 * * *")
public void findGukYuinEligibleForSurvey() { public void findGukYuinEligibleForSurvey() {
if (isLocalProfile()) { if (isLocalProfile()) {
return; return;
@@ -68,6 +71,42 @@ public class GukYuinApiStbltJobService {
gukYuinStbltJobCoreService.updateGukYuinEligibleForSurvey(resultUid, stbltDto); gukYuinStbltJobCoreService.updateGukYuinEligibleForSurvey(resultUid, stbltDto);
} }
Map<String, StbltResult> resultMap =
result.getResult().stream()
.collect(Collectors.groupingBy(RlbDtctMastDto::getChnDtctObjtId))
.entrySet()
.stream()
.collect(
Collectors.toMap(
Map.Entry::getKey,
e -> {
List<RlbDtctMastDto> pnuList = e.getValue();
boolean hasY = pnuList.stream().anyMatch(v -> "Y".equals(v.getStbltYn()));
String fitYn = hasY ? "Y" : "N";
RlbDtctMastDto selected =
hasY
? pnuList.stream()
.filter(v -> "Y".equals(v.getStbltYn()))
.findFirst()
.orElse(null)
: pnuList.stream()
.filter(v -> "N".equals(v.getStbltYn()))
.findFirst()
.orElse(null);
if (selected == null) {
return null; // 방어 코드
}
return new StbltResult(
fitYn, selected.getIncyCd(), selected.getIncyRsnCont());
}));
resultMap.forEach(gukYuinStbltJobCoreService::updateGukYuinObjectStbltYn);
} catch (Exception e) { } catch (Exception e) {
log.error("[GUKYUIN] failed uid={}", dto.getChnDtctMstId(), e); log.error("[GUKYUIN] failed uid={}", dto.getChnDtctMstId(), e);
} }

View File

@@ -122,7 +122,7 @@ public class MapSheetInferenceJobService {
* @return * @return
*/ */
private Long resolveBatchId(InferenceBatchSheet sheet) { private Long resolveBatchId(InferenceBatchSheet sheet) {
// M3 > M2 > M1 // G3 > G2 > G1
if (sheet.getM3BatchId() != null) { if (sheet.getM3BatchId() != null) {
return sheet.getM3BatchId(); return sheet.getM3BatchId();
} }
@@ -216,12 +216,12 @@ public class MapSheetInferenceJobService {
updateProcessingEndTimeByModel(job, sheet.getUuid(), now, currentType); updateProcessingEndTimeByModel(job, sheet.getUuid(), now, currentType);
// M3이면 전체 종료 // M3이면 전체 종료
if ("M3".equals(currentType)) { if ("G3".equals(currentType)) {
endAll(sheet, now); endAll(sheet, now);
return; return;
} }
// 다음 모델 실행 (M1->M2, M2->M3) // 다음 모델 실행 (G1->G2, G2->G3)
String nextType = nextModelType(currentType); String nextType = nextModelType(currentType);
UUID nextModelUuid = resolveModelUuid(sheet, nextType); UUID nextModelUuid = resolveModelUuid(sheet, nextType);
@@ -240,7 +240,7 @@ public class MapSheetInferenceJobService {
save.setUuid(sheet.getUuid()); save.setUuid(sheet.getUuid());
save.setStatus(Status.END.getId()); save.setStatus(Status.END.getId());
save.setInferEndDttm(now); save.setInferEndDttm(now);
save.setType("M3"); // 마지막 모델 기준 save.setType("G3"); // 마지막 모델 기준
inferenceResultCoreService.update(save); inferenceResultCoreService.update(save);
// 추론 종료일때 geom 데이터 저장 // 추론 종료일때 geom 데이터 저장
@@ -266,11 +266,11 @@ public class MapSheetInferenceJobService {
* @return * @return
*/ */
private String nextModelType(String currentType) { private String nextModelType(String currentType) {
if ("M1".equals(currentType)) { if ("G1".equals(currentType)) {
return "M2"; return "G2";
} }
if ("M2".equals(currentType)) { if ("G2".equals(currentType)) {
return "M3"; return "G3";
} }
throw new IllegalArgumentException("Unknown runningModelType: " + currentType); throw new IllegalArgumentException("Unknown runningModelType: " + currentType);
} }
@@ -283,13 +283,13 @@ public class MapSheetInferenceJobService {
* @return * @return
*/ */
private UUID resolveModelUuid(InferenceBatchSheet sheet, String type) { private UUID resolveModelUuid(InferenceBatchSheet sheet, String type) {
if ("M1".equals(type)) { if ("G1".equals(type)) {
return sheet.getM1ModelUuid(); return sheet.getM1ModelUuid();
} }
if ("M2".equals(type)) { if ("G2".equals(type)) {
return sheet.getM2ModelUuid(); return sheet.getM2ModelUuid();
} }
if ("M3".equals(type)) { if ("G3".equals(type)) {
return sheet.getM3ModelUuid(); return sheet.getM3ModelUuid();
} }
throw new IllegalArgumentException("Unknown type: " + type); throw new IllegalArgumentException("Unknown type: " + type);
@@ -379,13 +379,13 @@ public class MapSheetInferenceJobService {
* @return String * @return String
*/ */
private String modelToInferenceType(String type) { private String modelToInferenceType(String type) {
if ("M1".equals(type)) { if ("G1".equals(type)) {
return "G1"; return "G1";
} }
if ("M2".equals(type)) { if ("G2".equals(type)) {
return "G2"; return "G2";
} }
if ("M3".equals(type)) { if ("G3".equals(type)) {
return "G3"; return "G3";
} }
throw new IllegalArgumentException("Unknown type: " + type); throw new IllegalArgumentException("Unknown type: " + type);

View File

@@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.ObjectNode;
import com.kamco.cd.kamcoback.common.enums.ImageryFitStatus;
import com.kamco.cd.kamcoback.common.utils.geometry.GeometryDeserializer; import com.kamco.cd.kamcoback.common.utils.geometry.GeometryDeserializer;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List; import java.util.List;
@@ -372,9 +373,12 @@ public class TrainingDataLabelDto {
@AllArgsConstructor @AllArgsConstructor
public static class ClassificationInfo { public static class ClassificationInfo {
@Schema(description = "분류", example = "일반토지") @Schema(description = "분류", example = "land")
private String classification; private String classification;
@Schema(description = "분류 한글명", example = "일반토지")
private String classificationName;
@Schema(description = "확률", example = "80.0") @Schema(description = "확률", example = "80.0")
private Double probability; private Double probability;
} }
@@ -382,9 +386,7 @@ public class TrainingDataLabelDto {
@Schema(name = "InspectionResultInfo", description = "실태조사결과정보") @Schema(name = "InspectionResultInfo", description = "실태조사결과정보")
@Getter @Getter
@Setter @Setter
@Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor
public static class InspectionResultInfo { public static class InspectionResultInfo {
@Schema(description = "검증결과 (미확인/제외/완료)", example = "미확인") @Schema(description = "검증결과 (미확인/제외/완료)", example = "미확인")
@@ -395,6 +397,11 @@ public class TrainingDataLabelDto {
@Schema(description = "메모") @Schema(description = "메모")
private String memo; private String memo;
public InspectionResultInfo(String verificationResult, String inappropriateReason) {
this.verificationResult = ImageryFitStatus.fromCode(verificationResult).getText();
this.inappropriateReason = inappropriateReason;
}
} }
@Schema(name = "SummaryRes", description = "작업 통계 응답") @Schema(name = "SummaryRes", description = "작업 통계 응답")

View File

@@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.ObjectNode;
import com.kamco.cd.kamcoback.common.enums.ImageryFitStatus;
import com.kamco.cd.kamcoback.common.utils.geometry.GeometryDeserializer; import com.kamco.cd.kamcoback.common.utils.geometry.GeometryDeserializer;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List; import java.util.List;
@@ -368,9 +369,12 @@ public class TrainingDataReviewDto {
@AllArgsConstructor @AllArgsConstructor
public static class ClassificationInfo { public static class ClassificationInfo {
@Schema(description = "분류", example = "일반토지") @Schema(description = "분류", example = "land")
private String classification; private String classification;
@Schema(description = "분류한글명", example = "일반토지")
private String classificationName;
@Schema(description = "확률", example = "80.0") @Schema(description = "확률", example = "80.0")
private Double probability; private Double probability;
} }
@@ -378,9 +382,7 @@ public class TrainingDataReviewDto {
@Schema(name = "InspectionResultInfo", description = "실태조사결과정보") @Schema(name = "InspectionResultInfo", description = "실태조사결과정보")
@Getter @Getter
@Setter @Setter
@Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor
public static class InspectionResultInfo { public static class InspectionResultInfo {
@Schema(description = "검증결과 (미확인/제외/완료)", example = "미확인") @Schema(description = "검증결과 (미확인/제외/완료)", example = "미확인")
@@ -391,6 +393,11 @@ public class TrainingDataReviewDto {
@Schema(description = "메모") @Schema(description = "메모")
private String memo; private String memo;
public InspectionResultInfo(String verificationResult, String inappropriateReason) {
this.verificationResult = ImageryFitStatus.fromCode(verificationResult).getText();
this.inappropriateReason = inappropriateReason;
}
} }
@Schema(name = "SummaryRes", description = "작업 통계 응답") @Schema(name = "SummaryRes", description = "작업 통계 응답")

View File

@@ -29,27 +29,12 @@ public class UploadApiController {
private final UploadService uploadService; private final UploadService uploadService;
@Value("${file.sync-root-dir}")
private String syncRootDir;
@Value("${file.sync-tmp-dir}")
private String syncTmpDir;
@Value("${file.sync-file-extention}")
private String syncFileExtention;
@Value("${file.dataset-dir}") @Value("${file.dataset-dir}")
private String datasetDir; private String datasetDir;
@Value("${file.dataset-tmp-dir}") @Value("${file.dataset-tmp-dir}")
private String datasetTmpDir; private String datasetTmpDir;
@Value("${file.model-dir}")
private String modelDir;
@Value("${file.model-tmp-dir}")
private String modelTmpDir;
/* /*
@Operation(summary = "데이터셋 대용량 업로드 세션 시작", description = "데이터셋 대용량 파일 업로드 세션을 시작합니다.") @Operation(summary = "데이터셋 대용량 업로드 세션 시작", description = "데이터셋 대용량 파일 업로드 세션을 시작합니다.")
@ApiResponses( @ApiResponses(

View File

@@ -16,6 +16,10 @@ spring:
format_sql: true # ⚠️ 선택 - SQL 포맷팅 (가독성) format_sql: true # ⚠️ 선택 - SQL 포맷팅 (가독성)
jdbc: jdbc:
batch_size: 1000 # ✅ 추가 (JDBC batch) batch_size: 1000 # ✅ 추가 (JDBC batch)
open-in-view: false
mvc:
async:
request-timeout: 300s # 5분 (예: 30s, 120s, 10m 등도 가능)
datasource: datasource:
url: jdbc:postgresql://192.168.2.127:15432/kamco_cds url: jdbc:postgresql://192.168.2.127:15432/kamco_cds
@@ -83,35 +87,38 @@ mapsheet:
upload: upload:
skipGdalValidation: true skipGdalValidation: true
shp: shp:
baseurl: /app/tmp/detect/result baseurl: /app/tmp/detect/result #현재사용안함
file: file:
#sync-root-dir: D:/kamco-nfs/images/ #sync-root-dir: D:/kamco-nfs/images/
sync-root-dir: /kamco-nfs/images/ sync-root-dir: /kamco-nfs/images/
sync-tmp-dir: ${file.sync-root-dir}/tmp sync-tmp-dir: /kamco-nfs/requests/temp # image upload temp dir
#sync-tmp-dir: ${file.sync-root-dir}/tmp
sync-file-extention: tfw,tif sync-file-extention: tfw,tif
sync-auto-exception-start-year: 2024 sync-auto-exception-start-year: 2024
sync-auto-exception-before-year-cnt: 3 sync-auto-exception-before-year-cnt: 3
#dataset-dir: D:/kamco-nfs/dataset/ #dataset-dir: D:/kamco-nfs/model_output/
dataset-dir: /kamco-nfs/dataset/export/ dataset-dir: /kamco-nfs/model_output/export/ # 마운트경로 AI 추론결과
dataset-tmp-dir: ${file.dataset-dir}tmp/ dataset-tmp-dir: ${file.dataset-dir}tmp/
#model-dir: D:/kamco-nfs/ckpt/model/ #model-dir: D:/kamco-nfs/ckpt/model/
model-dir: /kamco-nfs/ckpt/model/ model-dir: /kamco-nfs/ckpt/model/ # 학습서버에서 트레이닝한 모델업로드경로
model-tmp-dir: ${file.model-dir}tmp/ model-tmp-dir: ${file.model-dir}tmp/
model-file-extention: pth,json,py model-file-extention: pth,json,py
pt-path: /kamco-nfs/ckpt/model/v6-cls-checkpoints/ pt-path: /kamco-nfs/ckpt/model/v6-cls-checkpoints/
pt-FileName: yolov8_6th-6m.pt pt-FileName: yolov8_6th-6m.pt
dataset-response: /kamco-nfs/dataset/response/
inference: inference:
url: http://192.168.2.183:8000/jobs url: http://192.168.2.183:8000/jobs
batch-url: http://192.168.2.183:8000/batches batch-url: http://192.168.2.183:8000/batches
geojson-dir: /kamco-nfs/requests/ geojson-dir: /kamco-nfs/requests/ # 추론실행을 위한 파일생성경로
jar-path: /kamco-nfs/dataset/shp/shp-exporter.jar jar-path: /kamco-nfs/repo/jar/shp-exporter.jar
inference-server-name: server1,server2,server3,server4 inference-server-name: server1,server2,server3,server4
gukyuin: gukyuin:
@@ -120,10 +127,12 @@ gukyuin:
cdi: ${gukyuin.url}/api/kcd/cdi cdi: ${gukyuin.url}/api/kcd/cdi
training-data: training-data:
geojson-dir: /kamco-nfs/model_output/labeling/ geojson-dir: /kamco-nfs/dataset/request/
layer: layer:
geoserver-url: https://kamco.geo-dev.gs.dabeeo.com geoserver-url: https://kamco.geo-dev.gs.dabeeo.com
wms-path: geoserver/cd wms-path: geoserver/cd
wmts-path: geoserver/cd/gwc/service wmts-path: geoserver/cd/gwc/service
workspace: cd workspace: cd

View File

@@ -18,12 +18,38 @@ spring:
batch_size: 1000 # ✅ 추가 (JDBC batch) batch_size: 1000 # ✅ 추가 (JDBC batch)
datasource: datasource:
url: jdbc:postgresql://10.100.0.10:25432/temp url: jdbc:postgresql://kamco-cd-postgis:5432/kamco_cds
username: temp #url: jdbc:postgresql://localhost:15432/kamco_cds
password: temp123! username: kamco_cds
password: kamco_cds_Q!W@E#R$
hikari: hikari:
minimum-idle: 10 minimum-idle: 10
maximum-pool-size: 20 maximum-pool-size: 20
connection-timeout: 60000 # 60초 연결 타임아웃
idle-timeout: 300000 # 5분 유휴 타임아웃
max-lifetime: 1800000 # 30분 최대 수명
leak-detection-threshold: 60000 # 연결 누수 감지
transaction:
default-timeout: 300 # 5분 트랜잭션 타임아웃
data:
redis:
host: 127.0.0.1
port: 16379
password: kamco
servlet:
multipart:
enabled: true
max-file-size: 4GB
max-request-size: 4GB
file-size-threshold: 10MB
server:
tomcat:
max-swallow-size: 4GB
max-http-form-post-size: 4GB
jwt: jwt:
secret: "kamco_token_9b71e778-19a3-4c1d-97bf-2d687de17d5b" secret: "kamco_token_9b71e778-19a3-4c1d-97bf-2d687de17d5b"
@@ -34,28 +60,39 @@ token:
refresh-cookie-name: kamco # 개발용 쿠키 이름 refresh-cookie-name: kamco # 개발용 쿠키 이름
refresh-cookie-secure: true # 로컬 http 테스트면 false refresh-cookie-secure: true # 로컬 http 테스트면 false
logging:
level:
root: INFO
org.springframework.web: INFO
org.springframework.security: INFO
# 헬스체크 노이즈 핵심만 다운
org.springframework.security.web.FilterChainProxy: INFO
org.springframework.security.web.authentication.AnonymousAuthenticationFilter: INFO
org.springframework.security.web.authentication.Http403ForbiddenEntryPoint: INFO
org.springframework.web.servlet.DispatcherServlet: INFO
mapsheet: mapsheet:
upload: upload:
skipGdalValidation: true skipGdalValidation: true
shp: shp:
baseurl: /app/detect/result baseurl: /app/detect/result #현재사용안함
file: file:
#sync-root-dir: D:/kamco-nfs/images/ #sync-root-dir: D:/kamco-nfs/images/
sync-root-dir: /kamco-nfs/images/ sync-root-dir: /kamco-nfs/images/
sync-tmp-dir: ${file.sync-root-dir}/tmp sync-tmp-dir: ${file.sync-root-dir}/tmp # image upload temp dir
sync-file-extention: tfw,tif sync-file-extention: tfw,tif
sync-auto-exception-start-year: 2025 sync-auto-exception-start-year: 2025
sync-auto-exception-before-year-cnt: 3 sync-auto-exception-before-year-cnt: 3
#dataset-dir: D:/kamco-nfs/dataset/ #dataset-dir: D:/kamco-nfs/model_output/ #변경 model_output
dataset-dir: /kamco-nfs/dataset/export/ dataset-dir: /kamco-nfs/model_output/export/ # 마운트경로 AI 추론결과
dataset-tmp-dir: ${file.dataset-dir}tmp/ dataset-tmp-dir: ${file.dataset-dir}tmp/
#model-dir: D:/kamco-nfs/ckpt/model/ #model-dir: D:/kamco-nfs/ckpt/model/
model-dir: /kamco-nfs/ckpt/model/ model-dir: /kamco-nfs/ckpt/model/ # 학습서버에서 트레이닝한 모델업로드경로
model-tmp-dir: ${file.model-dir}tmp/ model-tmp-dir: ${file.model-dir}tmp/
model-file-extention: pth,json,py model-file-extention: pth,json,py
@@ -63,19 +100,18 @@ file:
pt-FileName: yolov8_6th-6m.pt pt-FileName: yolov8_6th-6m.pt
inference: inference:
url: http://192.168.2.183:8000/jobs url: http://127.0.0.1:8000/jobs
batch-url: http://192.168.2.183:8000/batches batch-url: http://127.0.0.1:8000/batches
geojson-dir: /kamco-nfs/requests/ geojson-dir: /kamco-nfs/requests/ # 학습서버에서 트레이닝한 모델업로드경로
jar-path: /kamco-nfs/dataset/shp/shp-exporter.jar jar-path: /kamco-nfs/repo/jar/shp-exporter.jar # 추론실행을 위한 파일생성경로
inference-server-name: server1,server2,server3,server4 inference-server-name: server1,server2,server3,server4
gukyuin: gukyuin:
#url: http://localhost:8080 url: http://127.0.0.1:5301
url: http://192.168.2.129:5301
cdi: ${gukyuin.url}/api/kcd/cdi cdi: ${gukyuin.url}/api/kcd/cdi
training-data: training-data:
geojson-dir: /kamco-nfs/model_output/labeling/ geojson-dir: /kamco-nfs/dataset/request/
layer: layer:
geoserver-url: https://kamco.geo-dev.gs.dabeeo.com geoserver-url: https://kamco.geo-dev.gs.dabeeo.com

View File

@@ -0,0 +1,120 @@
spring:
config:
activate:
on-profile: prod
jpa:
show-sql: true
hibernate:
ddl-auto: validate
properties:
hibernate:
default_batch_fetch_size: 100 # ✅ 성능 - N+1 쿼리 방지
order_updates: true # ✅ 성능 - 업데이트 순서 정렬로 데드락 방지
order_inserts: true
use_sql_comments: true # ⚠️ 선택 - SQL에 주석 추가 (디버깅용)
format_sql: true # ⚠️ 선택 - SQL 포맷팅 (가독성)
jdbc:
batch_size: 1000 # ✅ 추가 (JDBC batch)
datasource:
url: jdbc:postgresql://kamco-cd-postgis:5432/kamco_cds
#url: jdbc:postgresql://localhost:15432/kamco_cds
username: kamco_cds
password: kamco_cds_Q!W@E#R$
hikari:
minimum-idle: 10
maximum-pool-size: 20
connection-timeout: 60000 # 60초 연결 타임아웃
idle-timeout: 300000 # 5분 유휴 타임아웃
max-lifetime: 1800000 # 30분 최대 수명
leak-detection-threshold: 60000 # 연결 누수 감지
transaction:
default-timeout: 300 # 5분 트랜잭션 타임아웃
data:
redis:
host: 127.0.0.1
port: 16379
password: kamco
servlet:
multipart:
enabled: true
max-file-size: 4GB
max-request-size: 4GB
file-size-threshold: 10MB
server:
tomcat:
max-swallow-size: 4GB
max-http-form-post-size: 4GB
jwt:
secret: "kamco_token_9b71e778-19a3-4c1d-97bf-2d687de17d5b"
access-token-validity-in-ms: 86400000 # 1일
refresh-token-validity-in-ms: 604800000 # 7일
token:
refresh-cookie-name: kamco # 개발용 쿠키 이름
refresh-cookie-secure: true # 로컬 http 테스트면 false
logging:
level:
root: INFO
org.springframework.web: INFO
org.springframework.security: INFO
# 헬스체크 노이즈 핵심만 다운
org.springframework.security.web.FilterChainProxy: INFO
org.springframework.security.web.authentication.AnonymousAuthenticationFilter: INFO
org.springframework.security.web.authentication.Http403ForbiddenEntryPoint: INFO
org.springframework.web.servlet.DispatcherServlet: INFO
mapsheet:
upload:
skipGdalValidation: true
shp:
baseurl: /app/detect/result #현재사용안함
file:
#sync-root-dir: D:/kamco-nfs/images/
sync-root-dir: /kamco-nfs/images/
sync-tmp-dir: ${file.sync-root-dir}/tmp # image upload temp dir
sync-file-extention: tfw,tif
sync-auto-exception-start-year: 2025
sync-auto-exception-before-year-cnt: 3
#dataset-dir: D:/kamco-nfs/model_output/ #변경 model_output
dataset-dir: /kamco-nfs/model_output/export/ # 마운트경로 AI 추론결과
dataset-tmp-dir: ${file.dataset-dir}tmp/
#model-dir: D:/kamco-nfs/ckpt/model/
model-dir: /kamco-nfs/ckpt/model/ # 학습서버에서 트레이닝한 모델업로드경로
model-tmp-dir: ${file.model-dir}tmp/
model-file-extention: pth,json,py
pt-path: /kamco-nfs/ckpt/model/v6-cls-checkpoints/
pt-FileName: yolov8_6th-6m.pt
inference:
url: http://127.0.0.1:8000/jobs
batch-url: http://127.0.0.1:8000/batches
geojson-dir: /kamco-nfs/requests/ # 학습서버에서 트레이닝한 모델업로드경로
jar-path: /kamco-nfs/repo/jar/shp-exporter.jar # 추론실행을 위한 파일생성경로
inference-server-name: server1,server2,server3,server4
gukyuin:
url: http://127.0.0.1:5301
cdi: ${gukyuin.url}/api/kcd/cdi
training-data:
geojson-dir: /kamco-nfs/dataset/request/
layer:
geoserver-url: https://kamco.geo-dev.gs.dabeeo.com
wms-path: geoserver/cd
wmts-path: geoserver/cd/gwc/service
workspace: cd

View File

@@ -0,0 +1,83 @@
<!doctype html>
<html lang="ko">
<head>
<meta charset="utf-8" />
<title>라벨 ZIP 다운로드</title>
</head>
<body>
<h3>라벨 ZIP 다운로드</h3>
UUID:
<input id="uuid" value="6d8d49dc-0c9d-4124-adc7-b9ca610cc394" />
<br><br>
JWT Token:
<input id="token" style="width:600px;" placeholder="Bearer 토큰 붙여넣기" />
<br><br>
<button onclick="download()">다운로드</button>
<br><br>
<progress id="bar" value="0" max="100" style="width:400px;"></progress>
<div id="status"></div>
<script>
async function download() {
const uuid = document.getElementById("uuid").value.trim();
const token = document.getElementById("token").value.trim();
if (!uuid) {
alert("UUID 입력하세요");
return;
}
if (!token) {
alert("토큰 입력하세요");
return;
}
const url = `/api/training-data/stage/download/${uuid}`;
const res = await fetch(url, {
headers: {
"Authorization": token.startsWith("Bearer ")
? token
: `Bearer ${token}`,
"kamco-download-uuid": uuid
}
});
if (!res.ok) {
document.getElementById("status").innerText =
"실패: " + res.status;
return;
}
const total = parseInt(res.headers.get("Content-Length") || "0", 10);
const reader = res.body.getReader();
const chunks = [];
let received = 0;
while (true) {
const { done, value } = await reader.read();
if (done) break;
chunks.push(value);
received += value.length;
if (total) {
document.getElementById("bar").value =
(received / total) * 100;
}
}
const blob = new Blob(chunks);
const a = document.createElement("a");
a.href = URL.createObjectURL(blob);
a.download = uuid + ".zip";
a.click();
document.getElementById("status").innerText = "완료 ✅";
}
</script>
</body>
</html>