회원가입 가입 개선
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,12 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="PortalApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true">
|
||||||
|
<option name="ACTIVE_PROFILES" value="local_gf63" />
|
||||||
|
<option name="FRAME_DEACTIVATION_UPDATE_POLICY" value="UpdateClassesAndResources" />
|
||||||
|
<module name="eapim-portal.main" />
|
||||||
|
<option name="SPRING_BOOT_MAIN_CLASS" value="com.eactive.apim.portal.PortalApplication" />
|
||||||
|
<option name="VM_PARAMETERS" value="-Ddamo-manager.enabled=true -Dlogging.config=classpath:logback-local_gf63.xml" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="eapim-admin" type="#com.intellij.j2ee.web.tomcat.TomcatRunConfigurationFactory" factoryName="Local" APPLICATION_SERVER_NAME="Tomcat 9.0.122" ALTERNATIVE_JRE_ENABLED="true" ALTERNATIVE_JRE_PATH="17">
|
||||||
|
<option name="OPEN_IN_BROWSER" value="false" />
|
||||||
|
<option name="COMMON_VM_ARGUMENTS" value="-Deai.datasource.type=DEV -Dinst.Name=emsSvr-RinjaeGF63 -Deai.tableowner=EMSAPP -Deai.systemmode=D -Dfile.encoding=utf-8 -Dlogin.mode=db -DLOGBACK_LOG_LEVEL=DEBUG -Dlogback.configurationFile=classpath:logback-rinjae_gf63_linux.xml -Dhibernate.dialect=org.hibernate.dialect.Oracle12cDialect -Dorg.jboss.logging.provider=slf4j -Ddamo-manager.enabled=true -Xms512m -Xmx2048m" />
|
||||||
|
<option name="UPDATE_ON_FRAME_DEACTIVATION" value="true" />
|
||||||
|
<deployment>
|
||||||
|
<artifact name="Gradle : com.eactive : eapim-admin.war (exploded)">
|
||||||
|
<settings>
|
||||||
|
<option name="CONTEXT_PATH" value="/monitoring" />
|
||||||
|
</settings>
|
||||||
|
</artifact>
|
||||||
|
</deployment>
|
||||||
|
<server-settings>
|
||||||
|
<option name="BASE_DIRECTORY_NAME" value="45eaed49-b6b5-44cd-89e9-0aa5aa2f6574" />
|
||||||
|
<option name="HTTP_PORT" value="39120" />
|
||||||
|
<option name="JNDI_PORT" value="39125" />
|
||||||
|
<option name="PRESERVE_SESSIONS" value="true" />
|
||||||
|
</server-settings>
|
||||||
|
<predefined_log_file enabled="true" id="Tomcat" />
|
||||||
|
<predefined_log_file enabled="true" id="Tomcat Catalina" />
|
||||||
|
<predefined_log_file id="Tomcat Manager" />
|
||||||
|
<predefined_log_file id="Tomcat Host Manager" />
|
||||||
|
<predefined_log_file id="Tomcat Localhost Access" />
|
||||||
|
<RunnerSettings RunnerId="Debug">
|
||||||
|
<option name="DEBUG_PORT" value="41307" />
|
||||||
|
</RunnerSettings>
|
||||||
|
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Cover">
|
||||||
|
<option name="USE_ENV_VARIABLES" value="true" />
|
||||||
|
<STARTUP>
|
||||||
|
<option name="USE_DEFAULT" value="true" />
|
||||||
|
<option name="SCRIPT" value="" />
|
||||||
|
<option name="VM_PARAMETERS" value="" />
|
||||||
|
<option name="PROGRAM_PARAMETERS" value="" />
|
||||||
|
</STARTUP>
|
||||||
|
<SHUTDOWN>
|
||||||
|
<option name="USE_DEFAULT" value="true" />
|
||||||
|
<option name="SCRIPT" value="" />
|
||||||
|
<option name="VM_PARAMETERS" value="" />
|
||||||
|
<option name="PROGRAM_PARAMETERS" value="" />
|
||||||
|
</SHUTDOWN>
|
||||||
|
</ConfigurationWrapper>
|
||||||
|
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Debug">
|
||||||
|
<option name="USE_ENV_VARIABLES" value="true" />
|
||||||
|
<STARTUP>
|
||||||
|
<option name="USE_DEFAULT" value="true" />
|
||||||
|
<option name="SCRIPT" value="" />
|
||||||
|
<option name="VM_PARAMETERS" value="" />
|
||||||
|
<option name="PROGRAM_PARAMETERS" value="" />
|
||||||
|
</STARTUP>
|
||||||
|
<SHUTDOWN>
|
||||||
|
<option name="USE_DEFAULT" value="true" />
|
||||||
|
<option name="SCRIPT" value="" />
|
||||||
|
<option name="VM_PARAMETERS" value="" />
|
||||||
|
<option name="PROGRAM_PARAMETERS" value="" />
|
||||||
|
</SHUTDOWN>
|
||||||
|
</ConfigurationWrapper>
|
||||||
|
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Profile">
|
||||||
|
<option name="USE_ENV_VARIABLES" value="true" />
|
||||||
|
<STARTUP>
|
||||||
|
<option name="USE_DEFAULT" value="true" />
|
||||||
|
<option name="SCRIPT" value="" />
|
||||||
|
<option name="VM_PARAMETERS" value="" />
|
||||||
|
<option name="PROGRAM_PARAMETERS" value="" />
|
||||||
|
</STARTUP>
|
||||||
|
<SHUTDOWN>
|
||||||
|
<option name="USE_DEFAULT" value="true" />
|
||||||
|
<option name="SCRIPT" value="" />
|
||||||
|
<option name="VM_PARAMETERS" value="" />
|
||||||
|
<option name="PROGRAM_PARAMETERS" value="" />
|
||||||
|
</SHUTDOWN>
|
||||||
|
</ConfigurationWrapper>
|
||||||
|
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Run">
|
||||||
|
<option name="USE_ENV_VARIABLES" value="true" />
|
||||||
|
<STARTUP>
|
||||||
|
<option name="USE_DEFAULT" value="true" />
|
||||||
|
<option name="SCRIPT" value="" />
|
||||||
|
<option name="VM_PARAMETERS" value="" />
|
||||||
|
<option name="PROGRAM_PARAMETERS" value="" />
|
||||||
|
</STARTUP>
|
||||||
|
<SHUTDOWN>
|
||||||
|
<option name="USE_DEFAULT" value="true" />
|
||||||
|
<option name="SCRIPT" value="" />
|
||||||
|
<option name="VM_PARAMETERS" value="" />
|
||||||
|
<option name="PROGRAM_PARAMETERS" value="" />
|
||||||
|
</SHUTDOWN>
|
||||||
|
</ConfigurationWrapper>
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
<option name="BuildArtifacts" enabled="true">
|
||||||
|
<artifact name="Gradle : com.eactive : eapim-admin.war (exploded)" />
|
||||||
|
</option>
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
@@ -37,8 +37,7 @@
|
|||||||
- **feats/\***, **design\***, **develop**: 과거 작업 잔여 브랜치
|
- **feats/\***, **design\***, **develop**: 과거 작업 잔여 브랜치
|
||||||
- 현재 활성 개발에 사용하지 않는다. 참고용으로만 남아 있다
|
- 현재 활성 개발에 사용하지 않는다. 참고용으로만 남아 있다
|
||||||
|
|
||||||
> 과거 문서에 있던 `jenkins_with_weblogic` 브랜치는 **존재하지 않는다**.
|
> Jenkins/WebLogic 배포 설정은 master 의 `Jenkinsfile.deploy` 에 있다.
|
||||||
> Jenkins/WebLogic 설정은 master 의 `Jenkinsfile.deploy` 에 통합되어 있다.
|
|
||||||
|
|
||||||
**작업 흐름:**
|
**작업 흐름:**
|
||||||
```bash
|
```bash
|
||||||
@@ -57,16 +56,24 @@ git push origin master
|
|||||||
### 애플리케이션 실행
|
### 애플리케이션 실행
|
||||||
- Linux 개발 환경에서는 `gradlew` 대신 설치된 `gradle`(8.7)을 직접 쓴다. Jenkins 노드도 `/apps/opts/gradle-8.7` 의 `gradle` 을 쓴다.
|
- Linux 개발 환경에서는 `gradlew` 대신 설치된 `gradle`(8.7)을 직접 쓴다. Jenkins 노드도 `/apps/opts/gradle-8.7` 의 `gradle` 을 쓴다.
|
||||||
- Windows/Eclipse 환경 기동 절차는 `BOOTRUN_SETUP_GUIDE.md` 참고 (거기서는 `gradlew.bat bootRun` 사용).
|
- Windows/Eclipse 환경 기동 절차는 `BOOTRUN_SETUP_GUIDE.md` 참고 (거기서는 `gradlew.bat bootRun` 사용).
|
||||||
- `.envrc`(direnv)는 **없다**. JAVA_HOME(JDK 8)/GRADLE_HOME 은 셸에서 직접 맞춰야 한다.
|
- JAVA_HOME(JDK 8)/GRADLE_HOME 은 **워크스페이스 루트(`djb-workspace/.envrc`)의 direnv** 로 설정한다.
|
||||||
|
저장소 안에는 `.envrc` 를 두지 않는다(`.gitignore` 의 `/.envrc`, 머신별 절대경로). 작성법은 `djb-docs/개발환경-준비-사항.md` §3.
|
||||||
|
- 의존성은 사내 Nexus(`https://nexus.eactive.synology.me:8090/repository/maven-public/`, `build.gradle` 의 유일한 저장소)에서 받는다.
|
||||||
|
`--offline` 은 `~/.gradle/caches` 가 채워진 뒤에만 동작한다.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# bootRun 기본 프로파일은 build.gradle 의 bootProfile 기본값(local_rinjaemac)
|
# bootRun 기본 프로파일은 build.gradle 의 bootProfile 기본값(local_rinjaemac).
|
||||||
|
# direnv 의 ORG_GRADLE_PROJECT_bootProfile 로 머신별 기본값을 덮어쓴다.
|
||||||
gradle bootRun
|
gradle bootRun
|
||||||
|
|
||||||
# 다른 프로파일로 기동 (--args 가 아니라 -PbootProfile)
|
# 다른 프로파일로 기동 (--args 가 아니라 -PbootProfile)
|
||||||
gradle bootRun -PbootProfile=dev
|
gradle bootRun -PbootProfile=local_gf63
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> **로컬 기동(bootRun)은 local 전용 프로파일(`local_*`)로만 한다.** dev/stage/prod 는 서버(WAS) 배포용이라
|
||||||
|
> bootRun 으로 뜨지 않는 것이 **의도된 동작**이다 — JNDI 전용이고 로그 경로도 서버 경로(`/logs/prod/eapim`)다.
|
||||||
|
> dev 를 로컬에서 띄우려고 dev yml 에 JDBC 정보나 로컬 경로를 넣지 않는다.
|
||||||
|
|
||||||
> `bootRun` 의 프로파일은 `-PbootProfile` 로 넘긴다. `-Pprofile` 은 `ext.profile='local'`
|
> `bootRun` 의 프로파일은 `-PbootProfile` 로 넘긴다. `-Pprofile` 은 `ext.profile='local'`
|
||||||
> 이 이미 점유하고 있어 무시된다(`build.gradle` 의 주석 참고).
|
> 이 이미 점유하고 있어 무시된다(`build.gradle` 의 주석 참고).
|
||||||
> Jenkins 빌드에서 쓰는 `-Pprofile=weblogic` 은 스프링 프로파일이 아니라 빌드용 플래그다.
|
> Jenkins 빌드에서 쓰는 `-Pprofile=weblogic` 은 스프링 프로파일이 아니라 빌드용 플래그다.
|
||||||
@@ -105,10 +112,10 @@ gradle test --tests "com.eactive.apim.portal.apps.user.AccountControllerTest"
|
|||||||
gradle test --tests "*Controller*"
|
gradle test --tests "*Controller*"
|
||||||
```
|
```
|
||||||
|
|
||||||
> **커버리지는 측정되지 않는다.** JaCoCo 플러그인이 `build.gradle` 에 없고
|
> **커버리지**: `test` 가 `finalizedBy jacocoTestReport` 로 `build/reports/jacoco/test/jacocoTestReport.xml` 을 만들고
|
||||||
> `sonar-project.properties` 에도 `sonar.coverage.jacoco.xmlReportPaths` 가 없다.
|
> `sonar-project.properties` 의 `sonar.coverage.jacoco.xmlReportPaths` 가 이를 읽는다.
|
||||||
> 그래서 SonarQube 의 Coverage 가 항상 0% 로 뜨고 Quality Gate 가 ERROR 가 된다
|
> `jacocoTestReport` 에서 클래스를 제외하지 말 것 — 리포트에서 빠진 클래스는 Sonar 의 Zero Coverage Sensor 가
|
||||||
> (Sonar 의 Zero Coverage Sensor 가 리포트 없는 라인을 전부 0 으로 채운다).
|
> 0% 로 채운다. 커버리지 집계 제외는 `sonar.coverage.exclusions` 로 한다.
|
||||||
|
|
||||||
### CSS/SASS 빌드
|
### CSS/SASS 빌드
|
||||||
|
|
||||||
@@ -158,11 +165,6 @@ docker build -t eapim-portal:latest .
|
|||||||
자동으로 clone/reset 한다. 로컬에서도 `../eapim-online/elink-online-core-jpa` 와
|
자동으로 clone/reset 한다. 로컬에서도 `../eapim-online/elink-online-core-jpa` 와
|
||||||
`../elink-portal-common` 이 없으면 컴파일 자체가 되지 않는다.
|
`../elink-portal-common` 이 없으면 컴파일 자체가 되지 않는다.
|
||||||
|
|
||||||
**kjb-safedb (SafeDB 암호화 라이브러리)는 현재 빌드에서 빠져 있다.**
|
|
||||||
`build.gradle` 의 `implementation project(':kjb-safedb')` 가 주석 처리되어 있고
|
|
||||||
`settings.gradle` 에도 등록되어 있지 않으며 `../kjb-safedb` 디렉터리도 없다.
|
|
||||||
다시 붙일 때는 세 곳을 모두 되살려야 한다.
|
|
||||||
|
|
||||||
### 패키지 구조
|
### 패키지 구조
|
||||||
|
|
||||||
코드는 기술 계층이 아닌 **기능 모듈**(수직 분할) 방식으로 구성됩니다:
|
코드는 기술 계층이 아닌 **기능 모듈**(수직 분할) 방식으로 구성됩니다:
|
||||||
@@ -194,6 +196,7 @@ com.eactive.apim/
|
|||||||
│ ├── custom/ # 사이트별 커스터마이징 설정
|
│ ├── custom/ # 사이트별 커스터마이징 설정
|
||||||
│ ├── djb/ # 은행 특화 기능
|
│ ├── djb/ # 은행 특화 기능
|
||||||
│ │ ├── apistatus/ community/ footer/ guide/ menu/ notitest/
|
│ │ ├── apistatus/ community/ footer/ guide/ menu/ notitest/
|
||||||
|
│ │ ├── swing/ testbed/ testcleanup/ webhook/
|
||||||
│ ├── spring/ # DatabaseSessionVerifier 등
|
│ ├── spring/ # DatabaseSessionVerifier 등
|
||||||
│ └── tools/ # HibernateSqlGenerator, JpaErrorLoggingAspect
|
│ └── tools/ # HibernateSqlGenerator, JpaErrorLoggingAspect
|
||||||
└── gateway/ # Gateway DB 직접 접근 (portal 의 하위가 아님)
|
└── gateway/ # Gateway DB 직접 접근 (portal 의 하위가 아님)
|
||||||
@@ -224,8 +227,12 @@ com.eactive.apim/
|
|||||||
- Entities: `com.eactive.eai.data.entity.onl.*`
|
- Entities: `com.eactive.eai.data.entity.onl.*`
|
||||||
- 목적: API 명세, 서비스, 메시지
|
- 목적: API 명세, 서비스, 메시지
|
||||||
|
|
||||||
두 데이터소스 모두 **dev 프로파일에서도 JNDI 로 연결한다**(`application-dev.yml`, `application-stage.yml`).
|
저장소의 프로파일(dev/stage/prod)은 **모두 JNDI 로 연결한다**. 직접 JDBC 는 개인 로컬 프로파일
|
||||||
직접 JDBC URL 을 쓰는 프로파일은 없다.
|
(`application-local_*.yml`, 커밋 안 함)에서만 쓴다 — `PortalDatasourceConfiguration` 은 `jndi-name` 이 비었거나
|
||||||
|
lookup 이 실패하면 `jdbc-url` 로 직접 접속하고, 둘 다 없으면 `IllegalArgumentException` 으로 기동을 멈춘다.
|
||||||
|
|
||||||
|
- 개발 DB: `jdbc:oracle:thin:@//172.30.1.50:1598/DAPM` (djb-vm Podman Oracle), 계정 `EMSAPP` / `AGWAPP`
|
||||||
|
- **DB 비밀번호는 저장소에 커밋하지 않는다** (개인 로컬 프로파일은 gitignore 대상이어야 한다)
|
||||||
|
|
||||||
설정: `config/PortalDatasourceConfiguration.java`
|
설정: `config/PortalDatasourceConfiguration.java`
|
||||||
- 각 데이터베이스별 별도 EntityManager
|
- 각 데이터베이스별 별도 EntityManager
|
||||||
@@ -237,16 +244,34 @@ com.eactive.apim/
|
|||||||
|
|
||||||
환경별 설정 파일: `src/main/resources/application-{profile}.yml`
|
환경별 설정 파일: `src/main/resources/application-{profile}.yml`
|
||||||
|
|
||||||
저장소에 실제로 있는 프로파일은 4개다:
|
프로파일은 용도에 따라 두 종류로 나뉜다.
|
||||||
|
|
||||||
- **dev**: 개발 환경 (DevTools 활성화, SQL 로깅)
|
**서버 배포용** — 저장소에 커밋된 3개. 모두 JNDI 전용이며 WAS(WebLogic)에 배포해서만 동작한다.
|
||||||
- **stage**: 스테이징 환경 (JNDI 데이터소스, proxy to inter-dapiwas01)
|
로컬 bootRun 대상이 아니다.
|
||||||
- **prod**: 운영 환경 (JNDI 데이터소스, proxy to inter-apiwas00, 캐싱 활성화)
|
|
||||||
- **local_gf63**: 개인 로컬 개발 환경
|
|
||||||
|
|
||||||
> `bootRun` 의 기본값은 `build.gradle` 에서 `local_rinjaemac` 으로 잡혀 있지만
|
- **dev**: 개발서버 (DevTools 활성화, SQL 로깅)
|
||||||
> `application-local_rinjaemac.yml` 은 저장소에 없다. 기본값 그대로 `gradle bootRun` 을
|
- **stage**: 스테이징 서버 (JNDI 데이터소스, proxy to inter-dapiwas01)
|
||||||
> 하면 해당 프로파일 설정 없이 뜨므로, 로컬 기동 시에는 `-PbootProfile=dev` 처럼 명시하는 편이 안전하다.
|
- **prod**: 운영 서버 (JNDI 데이터소스, proxy to inter-apiwas00, 캐싱 활성화)
|
||||||
|
|
||||||
|
**로컬 전용** (`local_*`) — bootRun/IDE 기동용. 직접 JDBC 로 개발 DB 에 붙고, 로그도 로컬 경로에 남긴다.
|
||||||
|
|
||||||
|
- **샘플 (git 관리)**: `application-local_example.yml` + `logback-local_example.xml`.
|
||||||
|
비밀번호는 `CHANGE_ME`, 로그는 `${user.home}/eapim-logs/eapim-portal`. **실제 비밀번호를 넣지 않는다.**
|
||||||
|
샘플 구조(키·로컬용 설정)를 바꾸면 개인 프로파일에도 같이 반영하도록 안내한다.
|
||||||
|
- **개인 프로파일 (git 제외)**: 샘플을 `application-local_<이름>.yml` / `logback-local_<이름>.xml` 로 복사해
|
||||||
|
`on-profile`, `logging.config`, `password` 만 바꿔 쓴다. 현재 있는 개인 프로파일:
|
||||||
|
|
||||||
|
| 프로파일 | 파일 | 머신 |
|
||||||
|
|---|---|---|
|
||||||
|
| `local_gf63` | `application-local_gf63.yml`, `logback-local_gf63.xml` | Linux (GF63) |
|
||||||
|
| `local_rinjaemac` | `application-local_rinjaemac.yml` | macOS |
|
||||||
|
|
||||||
|
- `.gitignore` 의 개인 패턴(`*gf63*`, `*rinjae*`)으로 무시된다. **패턴은 개인별**이라 새 개인 프로파일은
|
||||||
|
자동으로 무시되지 않는다 — `git check-ignore -v <파일>` 로 확인하고, 안 걸리면 `.gitignore` 에 추가한다.
|
||||||
|
- 파일명은 반드시 `application-local` / `logback-local` 로 시작해야 한다. `build.gradle` 의 `localOnlyResources`
|
||||||
|
(`**/application-local*.yml`, `**/logback-local*.xml`)가 WAR 산출물에서 제외한다 — 샘플도 WAR 에 실리지 않는다.
|
||||||
|
- 만드는 절차는 `djb-docs/개발환경-준비-사항.md` §5.2.
|
||||||
|
- 기본값 `local_rinjaemac` 은 다른 머신에는 없으므로 `-PbootProfile` 또는 direnv 로 자기 프로파일을 지정한다.
|
||||||
|
|
||||||
주요 설정 (`application.yml`):
|
주요 설정 (`application.yml`):
|
||||||
- 세션 타임아웃: **10분** (`server.servlet.session.timeout: 10m`, WebLogic 은 `weblogic.xml` 의 `timeout-secs 600`)
|
- 세션 타임아웃: **10분** (`server.servlet.session.timeout: 10m`, WebLogic 은 `weblogic.xml` 의 `timeout-secs 600`)
|
||||||
@@ -438,7 +463,9 @@ return queryFactory.selectFrom(user)
|
|||||||
|
|
||||||
로깅은 `application.yml` 의 `logging.file.path` 가 아니라 **logback 설정으로 제어**한다.
|
로깅은 `application.yml` 의 `logging.file.path` 가 아니라 **logback 설정으로 제어**한다.
|
||||||
|
|
||||||
- 설정 파일: `src/main/resources/logback-spring.xml` (그 외 `logback-debug.xml`, `logback-local_gf63.xml`)
|
- 설정 파일: `src/main/resources/logback-spring.xml` (그 외 `logback-debug.xml`)
|
||||||
|
- 로컬용 `logback-local_*.xml` 은 로컬 yml 의 `logging.config` 로 지정한다 (샘플 `logback-local_example.xml` 만 커밋, WAR 제외)
|
||||||
|
- `logback-spring.xml` 은 콘솔 출력이 기본 OFF 다 (`-DCONSOLE_LOG_ENABLED=true` 로 켬)
|
||||||
- 로그 디렉터리: `portal.logging.log-path` yml 프로퍼티 + 인스턴스명
|
- 로그 디렉터리: `portal.logging.log-path` yml 프로퍼티 + 인스턴스명
|
||||||
```xml
|
```xml
|
||||||
<springProperty scope="context" name="profileLogPath" source="portal.logging.log-path"/>
|
<springProperty scope="context" name="profileLogPath" source="portal.logging.log-path"/>
|
||||||
@@ -494,11 +521,6 @@ class UserControllerTest extends BaseWebTest {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### SafeDB
|
|
||||||
|
|
||||||
SafeDB 모듈이 현재 빌드에서 빠져 있으므로(위 "멀티 모듈 구조" 참고) 테스트에서
|
|
||||||
별도로 켜고 끌 것이 없다. `-Dsafedb=` 옵션은 더 이상 동작하지 않는다.
|
|
||||||
|
|
||||||
## 중요 사항
|
## 중요 사항
|
||||||
|
|
||||||
### 한글 지원
|
### 한글 지원
|
||||||
@@ -570,14 +592,13 @@ WAR 파일 호환 서버:
|
|||||||
`ci/` 디렉터리(`sonar-classpath.gradle`, `dependency-check-classpath.gradle`,
|
`ci/` 디렉터리(`sonar-classpath.gradle`, `dependency-check-classpath.gradle`,
|
||||||
`dependency-check-suppressions.xml`)에 있다.
|
`dependency-check-suppressions.xml`)에 있다.
|
||||||
|
|
||||||
알려진 CI 이슈 두 가지:
|
알려진 CI 이슈:
|
||||||
- **Coverage 0% → Quality Gate ERROR**: JaCoCo 미설정 (위 "테스트" 섹션 참고)
|
|
||||||
- **Dependency-Check NVD 갱신 실패**: Jenkins 에 `nvd-api-key` credential 이 없다.
|
- **Dependency-Check NVD 갱신 실패**: Jenkins 에 `nvd-api-key` credential 이 없다.
|
||||||
폐쇄망/키 부재 시에는 `UPDATE_NVD=false` 로 실행해 캐시 DB 로만 검사한다.
|
폐쇄망/키 부재 시에는 `UPDATE_NVD=false` 로 실행해 캐시 DB 로만 검사한다.
|
||||||
|
|
||||||
### JNDI 설정 필수
|
### JNDI 설정 필수
|
||||||
|
|
||||||
dev 를 포함한 모든 환경에서 WAS 에 JNDI 리소스가 있어야 한다:
|
dev 를 포함한 모든 WAS 배포 환경에 JNDI 리소스가 있어야 한다 (로컬 bootRun 은 개인 로컬 프로파일의 직접 JDBC 로 대체):
|
||||||
- `jdbc/dsOBP_EMS` → Portal 데이터베이스
|
- `jdbc/dsOBP_EMS` → Portal 데이터베이스
|
||||||
- `jdbc/dsOBP_AGW` → Gateway 데이터베이스
|
- `jdbc/dsOBP_AGW` → Gateway 데이터베이스
|
||||||
|
|
||||||
@@ -609,7 +630,6 @@ docker run -p 30200:30200 \
|
|||||||
다음 항목에 영향을 주는 변경 시:
|
다음 항목에 영향을 주는 변경 시:
|
||||||
- **Gateway API 명세**: `elink-online-core-jpa` 모듈 확인
|
- **Gateway API 명세**: `elink-online-core-jpa` 모듈 확인
|
||||||
- **공통 유틸리티**: `elink-portal-common` 모듈 확인
|
- **공통 유틸리티**: `elink-portal-common` 모듈 확인
|
||||||
- **암호화**: `kjb-safedb` 모듈 — 현재 빌드에서 제외됨 (위 "멀티 모듈 구조" 참고)
|
|
||||||
- **Admin 포털**: `../eapim-admin/` 관련 프로젝트
|
- **Admin 포털**: `../eapim-admin/` 관련 프로젝트
|
||||||
- **Online 포털**: `../eapim-online/` 관련 프로젝트
|
- **Online 포털**: `../eapim-online/` 관련 프로젝트
|
||||||
|
|
||||||
|
|||||||
@@ -1,45 +1,73 @@
|
|||||||
# EAPIM Portal
|
# EAPIM Portal
|
||||||
|
|
||||||
광주은행 엔터프라이즈 API 포털 관리 시스템
|
제주은행(DJBank) 엔터프라이즈 API 포털 관리 시스템
|
||||||
|
|
||||||
|
## 프로젝트 개요
|
||||||
|
|
||||||
|
**EAPIM Portal**은 제주은행(DJBank)의 API 서비스를 관리하고, 사용자 등록, API 키 발급, 문서화, 테스트 기능을 제공하는 웹 기반 플랫폼입니다.
|
||||||
|
|
||||||
|
## 기술 스택
|
||||||
|
|
||||||
|
- Spring Boot 2.7.18 (Spring MVC + Thymeleaf)
|
||||||
|
- Java 8
|
||||||
|
- Gradle 8.7
|
||||||
|
- Oracle 19c (JNDI 이중 데이터소스)
|
||||||
|
- Spring Security
|
||||||
|
- JPA/Hibernate 5.6.15 with Envers
|
||||||
|
- MapStruct, Lombok
|
||||||
|
- Dart Sass (SCSS)
|
||||||
|
|
||||||
## 프로젝트 클론 (Git Clone)
|
## 프로젝트 클론 (Git Clone)
|
||||||
|
|
||||||
아래 스크립트를 복사하여 한 번에 실행하면 모든 프로젝트를 클론합니다:
|
모든 저장소는 사내 Gitea 에 있으며 **`master` 브랜치**를 기준으로 합니다.
|
||||||
|
|
||||||
|
- Git 베이스 URL: `ssh://git@172.30.1.50:2222/djb-eapim`
|
||||||
|
- Gitea 웹: `http://172.30.1.50:3000/djb-eapim`
|
||||||
|
|
||||||
|
### 클론 스크립트 (Linux / macOS / Git Bash)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 변수 설정 (환경에 맞게 수정하세요)
|
# 변수 설정 (환경에 맞게 수정하세요)
|
||||||
GIT_URL="ssh://git@192.168.240.178:18081/eapim"
|
GIT_BASE="ssh://git@172.30.1.50:2222/djb-eapim"
|
||||||
PROJECT_HOME="/c/eactive/workspaces/kjb-eapim-devPortal"
|
WORKSPACE_DIR="$HOME/djb-workspace" # 예: /c/eactive/workspaces/djb-workspace
|
||||||
DEFAULT_BRANCH="jenkins_with_weblogic"
|
|
||||||
|
|
||||||
# 프로젝트 홈 디렉토리 생성 및 이동
|
mkdir -p "$WORKSPACE_DIR" && cd "$WORKSPACE_DIR"
|
||||||
mkdir -p "$PROJECT_HOME"
|
|
||||||
cd "$PROJECT_HOME"
|
|
||||||
|
|
||||||
# 메인 프로젝트 클론
|
# 1. 메인 프로젝트
|
||||||
git clone -b "$DEFAULT_BRANCH" "$GIT_URL/kjb-eapim.git" kjb-eapim
|
git clone -b master "$GIT_BASE/eapim-portal.git" eapim-portal
|
||||||
|
|
||||||
# 의존 모듈 클론 (kjb-eapim 폴더와 동일 레벨)
|
# 2. 공통 모듈
|
||||||
mkdir -p eapim-online
|
git clone -b master "$GIT_BASE/elink-portal-common.git" elink-portal-common
|
||||||
git clone -b "$DEFAULT_BRANCH" "$GIT_URL/elink-online-core-jpa.git" eapim-online/elink-online-core-jpa
|
|
||||||
git clone -b "$DEFAULT_BRANCH" "$GIT_URL/elink-portal-common.git" elink-portal-common
|
|
||||||
git clone -b "$DEFAULT_BRANCH" "$GIT_URL/kjb-safedb.git" kjb-safedb
|
|
||||||
|
|
||||||
# 클론 후 폴더 구조 확인
|
# 3. eapim-online 과 하위 모듈
|
||||||
echo "=== 프로젝트 구조 ==="
|
# eapim-online/.gitmodules 는 구 서버(synology)를 가리키므로 `git submodule update` 를 쓰지 않고
|
||||||
ls -la "$PROJECT_HOME"
|
# Gitea 에서 각 모듈을 직접 클론한다. (빈 서브모듈 디렉터리에 그대로 클론된다)
|
||||||
|
git clone -b master "$GIT_BASE/eapim-online.git" eapim-online
|
||||||
|
for m in elink-online-core-jpa elink-online-core elink-online-common elink-online-emsclient elink-online-transformer; do
|
||||||
|
git clone -b master "$GIT_BASE/$m.git" "eapim-online/$m"
|
||||||
|
done
|
||||||
|
|
||||||
|
# (선택) Admin 포털
|
||||||
|
git clone -b master "$GIT_BASE/eapim-admin.git" eapim-admin
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> eapim-portal 빌드에 필요한 건 `elink-online-core-jpa` 와 `elink-portal-common` 두 개뿐입니다.
|
||||||
|
> 나머지 eapim-online 모듈 4개는 eapim-admin 빌드에 필요합니다.
|
||||||
|
|
||||||
### 클론 후 폴더 구조
|
### 클론 후 폴더 구조
|
||||||
|
|
||||||
```
|
```
|
||||||
$PROJECT_HOME/
|
djb-workspace/
|
||||||
├── kjb-eapim/ # 메인 프로젝트
|
├── .envrc # (선택) direnv 환경변수 — 아래 "초기 세팅" 참고
|
||||||
│ └── eapim-portal/ # 이 프로젝트 (Portal)
|
├── eapim-portal/ # 이 프로젝트 (Portal)
|
||||||
├── eapim-online/ # Gateway 데이터 모델
|
├── eapim-admin/ # (선택) Admin 포털
|
||||||
│ └── elink-online-core-jpa/ # JPA 엔티티 모듈
|
├── eapim-online/ # Online 프로젝트
|
||||||
├── elink-portal-common/ # 공통 유틸리티
|
│ ├── elink-online-core-jpa/ # Gateway JPA 엔티티 ← portal 필수
|
||||||
└── kjb-safedb/ # SafeDB 암호화 라이브러리
|
│ ├── elink-online-core/
|
||||||
|
│ ├── elink-online-common/
|
||||||
|
│ ├── elink-online-emsclient/
|
||||||
|
│ └── elink-online-transformer/
|
||||||
|
└── elink-portal-common/ # 포털 공통 유틸리티 ← portal 필수
|
||||||
```
|
```
|
||||||
|
|
||||||
### 의존 관계 (settings.gradle 참조)
|
### 의존 관계 (settings.gradle 참조)
|
||||||
@@ -47,270 +75,168 @@ $PROJECT_HOME/
|
|||||||
```
|
```
|
||||||
eapim-portal
|
eapim-portal
|
||||||
├── elink-online-core-jpa → ../eapim-online/elink-online-core-jpa
|
├── elink-online-core-jpa → ../eapim-online/elink-online-core-jpa
|
||||||
├── elink-portal-common → ../elink-portal-common
|
└── elink-portal-common → ../elink-portal-common
|
||||||
└── kjb-safedb → ../kjb-safedb
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## 프로젝트 개요
|
두 디렉터리가 없으면 컴파일 자체가 되지 않습니다.
|
||||||
|
|
||||||
**EAPIM Portal**은 광주은행의 API 서비스를 관리하고, 사용자 등록, API 키 발급, 문서화, 테스트 기능을 제공하는 웹 기반 플랫폼입니다.
|
|
||||||
|
|
||||||
## 기술 스택
|
|
||||||
|
|
||||||
- Spring Boot 2.7.18
|
|
||||||
- Java 8
|
|
||||||
- Gradle 8.7
|
|
||||||
- Oracle 19c
|
|
||||||
- Spring Security
|
|
||||||
- JPA/Hibernate 5.6.15 with Envers
|
|
||||||
- MapStruct, Lombok
|
|
||||||
|
|
||||||
## 초기 세팅 가이드
|
## 초기 세팅 가이드
|
||||||
|
|
||||||
### 사전 요구사항
|
### 사전 요구사항
|
||||||
|
|
||||||
아래 도구 설치 및 검증 절차는 별도 문서로 분리되어 있습니다. 신규 개발자는 먼저 이 문서를 끝까지 진행하세요.
|
도구별 설치 절차는 별도 문서를 참고하세요.
|
||||||
|
|
||||||
📄 **[개발환경 준비 사항](djb-docs/개발환경-준비-사항.md)** — JDK 8 · Gradle 8.7 · Git · Oracle 19c · Node.js & SASS · direnv · IDE 설정
|
📄 **[개발환경 준비 사항](djb-docs/개발환경-준비-사항.md)** — JDK 8 · Gradle 8.7 · Git · Oracle 19c · Node.js & SASS · direnv · IDE 설정
|
||||||
|
|
||||||
요약:
|
| 도구 | 버전 | 비고 |
|
||||||
|
|---|---|---|
|
||||||
|
| JDK | 1.8 (Zulu 8 권장) | `build.gradle` 의 `sourceCompatibility = 1.8` |
|
||||||
|
| Gradle | 8.7 | 시스템에 설치한 gradle 사용 (Jenkins 노드와 동일) |
|
||||||
|
| Git | - | Gitea SSH 키 등록 필요 |
|
||||||
|
| Node.js | 18 LTS 이상 | SCSS 컴파일용 |
|
||||||
|
| direnv | 최신 (선택) | JAVA_HOME / GRADLE_HOME 자동 설정 |
|
||||||
|
|
||||||
- JDK 8 (Zulu 권장)
|
- **Gradle**: 시스템에 설치한 `gradle` 8.7 을 직접 사용합니다. Windows/Eclipse 환경의 기동 절차는
|
||||||
- Gradle 8.7 (gradlew 사용 금지)
|
[`BOOTRUN_SETUP_GUIDE.md`](BOOTRUN_SETUP_GUIDE.md) 를 따릅니다 (여기서는 `gradlew.bat bootRun` 사용).
|
||||||
- Git
|
- **의존성 저장소**: 사내 Nexus (`https://nexus.eactive.synology.me:8090/repository/maven-public/`) 에서 받습니다.
|
||||||
- Oracle 19c 접근 (개발: `192.168.240.177:1599`)
|
Nexus 에 접근할 수 있어야 하며, offline 빌드는 로컬 캐시가 채워진 뒤에만 가능합니다.
|
||||||
- Node.js 18 LTS 이상 (SCSS 컴파일용)
|
|
||||||
|
|
||||||
### Git Bash에서 초기 세팅
|
### 환경 변수 (direnv 권장)
|
||||||
|
|
||||||
|
시스템 기본 JDK 가 8 이 아니면 `JAVA_HOME` 을 반드시 8 로 맞춰야 합니다.
|
||||||
|
direnv 를 쓰면 워크스페이스 루트에 `.envrc` 하나로 하위 모든 프로젝트(eapim-portal, eapim-admin, eapim-online)에 적용됩니다.
|
||||||
|
머신별 절대경로가 들어가므로 **저장소 안이 아닌 워크스페이스 루트**에 둡니다.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# ====================================
|
# djb-workspace/.envrc (경로는 환경에 맞게 수정)
|
||||||
# 1. 변수 설정 (프로젝트 경로 및 브랜치)
|
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
|
||||||
# ====================================
|
export GRADLE_HOME=/opt/gradle-8.7
|
||||||
export WORKSPACE_DIR="/c/eactive/workspaces/kjb-eapim"
|
|
||||||
export PROJECT_BRANCH="jenkins_with_weblogic"
|
|
||||||
|
|
||||||
# Git Repository URL 설정
|
PATH_add "$JAVA_HOME/bin"
|
||||||
# 기본: ssh://git@192.168.240.178:18081/eapim
|
PATH_add "$GRADLE_HOME/bin"
|
||||||
# 대체: https://git.eactive.synology.me:8090/kjb-eapim
|
|
||||||
export GIT_REPO_BASE="ssh://git@192.168.240.178:18081/eapim"
|
|
||||||
# export GIT_REPO_BASE="https://git.eactive.synology.me:8090/kjb-eapim"
|
|
||||||
|
|
||||||
# Gradle 명령어 설정
|
|
||||||
export GRADLE_CMD="gradle"
|
|
||||||
|
|
||||||
# ====================================
|
|
||||||
# 2. 작업 디렉토리 생성
|
|
||||||
# ====================================
|
|
||||||
mkdir -p $WORKSPACE_DIR
|
|
||||||
cd $WORKSPACE_DIR
|
|
||||||
|
|
||||||
# ====================================
|
|
||||||
# 3. eapim-portal 프로젝트 클론
|
|
||||||
# ====================================
|
|
||||||
git clone ${GIT_REPO_BASE}/eapim-portal.git
|
|
||||||
cd eapim-portal
|
|
||||||
|
|
||||||
# 프로젝트 브랜치로 체크아웃
|
|
||||||
git checkout $PROJECT_BRANCH
|
|
||||||
|
|
||||||
# ====================================
|
|
||||||
# 4. eapim-online 프로젝트 클론 (elink-online-core-jpa 포함)
|
|
||||||
# ====================================
|
|
||||||
cd $WORKSPACE_DIR
|
|
||||||
git clone ${GIT_REPO_BASE}/eapim-online.git
|
|
||||||
cd eapim-online
|
|
||||||
git checkout $PROJECT_BRANCH
|
|
||||||
|
|
||||||
# ====================================
|
|
||||||
# 5. 의존 모듈 클론
|
|
||||||
# ====================================
|
|
||||||
cd $WORKSPACE_DIR
|
|
||||||
|
|
||||||
# elink-portal-common 클론
|
|
||||||
git clone ${GIT_REPO_BASE}/elink-portal-common.git
|
|
||||||
cd elink-portal-common
|
|
||||||
git checkout master # 또는 필요한 브랜치
|
|
||||||
|
|
||||||
# ====================================
|
|
||||||
# 6. 최종 폴더 구조 확인
|
|
||||||
# ====================================
|
|
||||||
# kjb-eapim/
|
|
||||||
# ├── eapim-portal/
|
|
||||||
# ├── eapim-online/
|
|
||||||
# │ └── elink-online-core-jpa/
|
|
||||||
# ├── elink-portal-common/
|
|
||||||
|
|
||||||
# ====================================
|
|
||||||
# 7. eapim-portal 프로젝트로 이동 및 디펜던시 다운로드
|
|
||||||
# ====================================
|
|
||||||
cd $WORKSPACE_DIR/eapim-portal
|
|
||||||
|
|
||||||
# Gradle 디펜던시 다운로드
|
|
||||||
$GRADLE_CMD dependencies
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Windows CMD에서 초기 세팅
|
```bash
|
||||||
|
# 셸 훅 등록 (최초 1회, zsh 기준 — bash 는 'direnv hook bash' / ~/.bashrc)
|
||||||
|
echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc
|
||||||
|
|
||||||
```cmd
|
# .envrc 허용
|
||||||
REM ====================================
|
cd ~/djb-workspace && direnv allow
|
||||||
REM 1. 변수 설정 (프로젝트 경로 및 브랜치)
|
|
||||||
REM ====================================
|
|
||||||
set WORKSPACE_DIR=C:\eactive\workspaces\kjb-eapim
|
|
||||||
set PROJECT_BRANCH=jenkins_with_weblogic
|
|
||||||
|
|
||||||
REM Git Repository URL 설정
|
# 확인
|
||||||
REM 기본: ssh://git@192.168.240.178:18081/eapim
|
cd eapim-portal && which gradle && java -version # Gradle 8.7 / 1.8.x
|
||||||
REM 대체: https://git.eactive.synology.me:8090/kjb-eapim
|
|
||||||
set GIT_REPO_BASE=ssh://git@192.168.240.178:18081/eapim
|
|
||||||
REM set GIT_REPO_BASE=https://git.eactive.synology.me:8090/kjb-eapim
|
|
||||||
|
|
||||||
REM Gradle 명령어 설정
|
|
||||||
set GRADLE_CMD=gradle
|
|
||||||
|
|
||||||
REM ====================================
|
|
||||||
REM 2. 작업 디렉토리 생성
|
|
||||||
REM ====================================
|
|
||||||
if not exist "%WORKSPACE_DIR%" mkdir "%WORKSPACE_DIR%"
|
|
||||||
cd /d "%WORKSPACE_DIR%"
|
|
||||||
|
|
||||||
REM ====================================
|
|
||||||
REM 3. eapim-portal 프로젝트 클론
|
|
||||||
REM ====================================
|
|
||||||
git clone %GIT_REPO_BASE%/eapim-portal.git
|
|
||||||
cd eapim-portal
|
|
||||||
|
|
||||||
REM 프로젝트 브랜치로 체크아웃
|
|
||||||
git checkout %PROJECT_BRANCH%
|
|
||||||
|
|
||||||
REM ====================================
|
|
||||||
REM 4. eapim-online 프로젝트 클론 (elink-online-core-jpa 포함)
|
|
||||||
REM ====================================
|
|
||||||
cd /d "%WORKSPACE_DIR%"
|
|
||||||
git clone %GIT_REPO_BASE%/eapim-online.git
|
|
||||||
cd eapim-online
|
|
||||||
git checkout %PROJECT_BRANCH%
|
|
||||||
|
|
||||||
REM ====================================
|
|
||||||
REM 5. 의존 모듈 클론
|
|
||||||
REM ====================================
|
|
||||||
cd /d "%WORKSPACE_DIR%"
|
|
||||||
|
|
||||||
REM elink-portal-common 클론
|
|
||||||
git clone %GIT_REPO_BASE%/elink-portal-common.git
|
|
||||||
cd elink-portal-common
|
|
||||||
git checkout master
|
|
||||||
|
|
||||||
REM ====================================
|
|
||||||
REM 6. 최종 폴더 구조 확인
|
|
||||||
REM ====================================
|
|
||||||
REM kjb-eapim\
|
|
||||||
REM ├── eapim-portal\
|
|
||||||
REM ├── eapim-online\
|
|
||||||
REM │ └── elink-online-core-jpa\
|
|
||||||
REM ├── elink-portal-common\
|
|
||||||
|
|
||||||
REM ====================================
|
|
||||||
REM 7. eapim-portal 프로젝트로 이동 및 디펜던시 다운로드
|
|
||||||
REM ====================================
|
|
||||||
cd /d "%WORKSPACE_DIR%\eapim-portal"
|
|
||||||
|
|
||||||
REM Gradle 디펜던시 다운로드
|
|
||||||
%GRADLE_CMD% dependencies
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### 환경별 설정 파일
|
### 설정 프로파일
|
||||||
|
|
||||||
프로젝트 클론 후 필요한 환경 설정을 수정하세요:
|
프로파일은 용도에 따라 두 종류로 나뉩니다.
|
||||||
|
|
||||||
- `src/main/resources/application-dev.yml` - 개발 환경
|
**서버 배포용** — 저장소에 커밋된 3개. 모두 JNDI 전용이며 WAS(WebLogic)에 배포해서만 동작합니다.
|
||||||
- `src/main/resources/application-stage.yml` - 스테이징 환경
|
|
||||||
- `src/main/resources/application-prod.yml` - 운영 환경
|
|
||||||
- `src/main/resources/application-gf63.yml` - 개인 개발 환경
|
|
||||||
|
|
||||||
### 데이터베이스 설정
|
| 프로파일 | 파일 | 용도 |
|
||||||
|
|---|---|---|
|
||||||
|
| `dev` | `application-dev.yml` | 개발서버 (DevTools, SQL 로깅) |
|
||||||
|
| `stage` | `application-stage.yml` | 스테이징 서버 |
|
||||||
|
| `prod` | `application-prod.yml` | 운영 서버 (캐싱 활성화) |
|
||||||
|
|
||||||
개발 환경(dev)에서는 `application-dev.yml`에 데이터베이스 설정이 포함되어 있습니다.
|
**로컬 전용** (`local_*`) — `gradle bootRun`/IDE 기동용. git 관리되는 샘플 `local_example` 을 복사해
|
||||||
스테이징/운영 환경에서는 JNDI 데이터소스가 필요합니다:
|
각자 `application-local_<이름>.yml` 을 만들어 씁니다 (개인 파일은 커밋하지 않음, 아래 "데이터베이스" 참고).
|
||||||
|
|
||||||
- `jdbc/dsOBP_EMS` - Portal 데이터베이스
|
| 파일 | git | 용도 |
|
||||||
- `jdbc/dsOBP_AGW` - Gateway 데이터베이스
|
|---|---|---|
|
||||||
|
| `application-local_example.yml` / `logback-local_example.xml` | 관리 | 샘플 (비밀번호 `CHANGE_ME`) |
|
||||||
|
| `application-local_<이름>.yml` / `logback-local_<이름>.xml` | **제외** | 개인 프로파일 (실제 비밀번호) |
|
||||||
|
|
||||||
### 주의사항
|
> **로컬 기동은 local 전용 프로파일로만 합니다.** dev/stage/prod 는 서버 배포용이라 bootRun 으로 뜨지 않는 것이
|
||||||
|
> **의도된 동작**입니다 (JNDI 전용, 로그 경로도 서버 경로 `/logs/prod/eapim`).
|
||||||
|
> dev 를 로컬에서 띄우려고 `application-dev.yml` 에 JDBC 정보나 로컬 경로를 넣지 마세요.
|
||||||
|
|
||||||
- **gradlew 사용 금지**: 반드시 시스템에 설치된 gradle을 직접 사용하거나 환경에 맞는 스크립트를 사용하세요
|
> `bootRun` 의 기본 프로파일은 `build.gradle` 의 `bootProfile` 기본값(`local_rinjaemac`, 개인 파일)입니다.
|
||||||
- **Gradle 명령어 변수화**: 위의 `GRADLE_CMD` 변수를 설정하면 환경별로 다른 gradle 명령어 사용 가능
|
> 자기 프로파일은 `-PbootProfile=local_<이름>` 또는 direnv 의 `ORG_GRADLE_PROJECT_bootProfile` 로 지정하세요.
|
||||||
|
|
||||||
|
### 데이터베이스
|
||||||
|
|
||||||
|
서버 배포용 프로파일(dev/stage/prod)은 **모두 JNDI 로 데이터소스를 연결합니다.** 배포 대상 WAS 에 아래 JNDI 리소스가 있어야 합니다.
|
||||||
|
|
||||||
|
| JNDI | 스키마 | 용도 |
|
||||||
|
|---|---|---|
|
||||||
|
| `jdbc/dsOBP_EMS` | `EMSAPP` | Portal — 사용자, 조직, API 키, 승인 |
|
||||||
|
| `jdbc/dsOBP_AGW` | `AGWAPP` | Gateway — API 명세, 서비스 (조회 전용) |
|
||||||
|
|
||||||
|
두 DB 는 JTA/XA 없이 각각 독립 로컬 트랜잭션으로 동작합니다 (`config/PortalConfigTransaction.java`).
|
||||||
|
|
||||||
|
**로컬 기동 (bootRun)** — 내장 Tomcat 에는 JNDI 가 없으므로 local 전용 프로파일에서 `jndi-name` 을 비우고
|
||||||
|
개발 DB(`172.30.1.50:1598/DAPM`)에 직접 접속합니다. `PortalDatasourceConfiguration` 은 `jndi-name` 이 비어 있으면
|
||||||
|
`jdbc-url` 로 직접 접속합니다.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd src/main/resources
|
||||||
|
cp application-local_example.yml application-local_<이름>.yml
|
||||||
|
cp logback-local_example.xml logback-local_<이름>.xml
|
||||||
|
# 복사한 yml 에서 on-profile, logging.config 의 local_example → local_<이름>, password CHANGE_ME → 실제 값
|
||||||
|
```
|
||||||
|
|
||||||
|
자세한 절차는 [개발환경 준비 사항 § 5.2](djb-docs/개발환경-준비-사항.md#52-애플리케이션의-db-연결-방식) 를 참고하세요.
|
||||||
|
|
||||||
|
- 파일명은 반드시 `application-local` / `logback-local` 로 시작 — `build.gradle` 의 `localOnlyResources` 가 WAR 에서 제외합니다
|
||||||
|
- 샘플(`*_example`)에는 실제 비밀번호를 넣지 않습니다
|
||||||
|
- DB 비밀번호가 들어가므로 **커밋 금지** — `.gitignore` 는 개인별 패턴(`*rinjae*`, `*gf63*`)만 무시하니
|
||||||
|
`git check-ignore -v <파일>` 로 확인하세요
|
||||||
|
|
||||||
## 빌드 및 실행
|
## 빌드 및 실행
|
||||||
|
|
||||||
### Gradle 명령어 설정
|
|
||||||
|
|
||||||
**Git Bash:**
|
|
||||||
```bash
|
```bash
|
||||||
export GRADLE_CMD="gradle"
|
# 로컬 기동 (개인 로컬 프로파일 — -Pprofile 이 아니라 -PbootProfile)
|
||||||
```
|
gradle bootRun -PbootProfile=local_<이름>
|
||||||
|
# → http://localhost:39130
|
||||||
**Windows CMD:**
|
|
||||||
```cmd
|
|
||||||
set GRADLE_CMD=gradle
|
|
||||||
```
|
|
||||||
|
|
||||||
### 빌드 및 실행 명령어
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# 개발 환경 실행
|
|
||||||
$GRADLE_CMD bootRun
|
|
||||||
# 또는: %GRADLE_CMD% bootRun (CMD)
|
|
||||||
|
|
||||||
# WAR 빌드
|
|
||||||
$GRADLE_CMD bootWar
|
|
||||||
|
|
||||||
# 테스트
|
|
||||||
$GRADLE_CMD test
|
|
||||||
|
|
||||||
# 컴파일만 수행
|
# 컴파일만 수행
|
||||||
$GRADLE_CMD classes
|
gradle classes
|
||||||
|
|
||||||
|
# 테스트
|
||||||
|
gradle test
|
||||||
|
gradle test --tests "com.eactive.apim.portal.apps.user.AccountControllerTest"
|
||||||
|
|
||||||
|
# 실행 가능 WAR → build/libs/eapim-portal-boot.war
|
||||||
|
gradle bootWar
|
||||||
|
|
||||||
|
# WAS 배포용 WAR (WebLogic/JEUS) → build/libs/eapim-portal.war
|
||||||
|
gradle war
|
||||||
|
|
||||||
# 전체 빌드
|
# 전체 빌드
|
||||||
$GRADLE_CMD clean build
|
gradle clean build
|
||||||
```
|
|
||||||
|
|
||||||
**주의**: gradlew 사용 금지 - offline gradle 단독 실행
|
# SBOM (xlsx)
|
||||||
|
gradle sbomXlsx
|
||||||
|
```
|
||||||
|
|
||||||
## 프로젝트 구조
|
## 프로젝트 구조
|
||||||
|
|
||||||
### 전체 프로젝트 구조
|
|
||||||
```
|
```
|
||||||
kjb-eapim/
|
src/main/java/com/eactive/apim/
|
||||||
├── eapim-portal/ # Portal 웹 애플리케이션 (현재 프로젝트)
|
├── portal/
|
||||||
├── eapim-online/ # Online 프로젝트
|
│ ├── apps/ # 기능 모듈 (user, app, approval, apis, community, dashboard, ...)
|
||||||
│ └── elink-online-core-jpa/ # Gateway 데이터 모델
|
│ ├── common/ # 공통 관심사 (예외, 보안, 비밀번호 전송암호화)
|
||||||
├── elink-portal-common/ # 공통 유틸리티
|
│ ├── config/ # Spring 설정 (Security, Datasource, Transaction)
|
||||||
|
│ ├── custom/ # 사이트별 커스터마이징
|
||||||
|
│ ├── djb/ # 제주은행 특화 기능 (apistatus, community, footer, guide, menu, webhook, ...)
|
||||||
|
│ ├── spring/ # DatabaseSessionVerifier 등
|
||||||
|
│ └── tools/ # HibernateSqlGenerator, JpaErrorLoggingAspect
|
||||||
|
└── gateway/ # Gateway DB 직접 접근 (portal 하위가 아님)
|
||||||
```
|
```
|
||||||
|
|
||||||
### eapim-portal 내부 구조
|
코드는 기술 계층이 아닌 **기능 모듈(수직 분할)** 방식이며, 각 모듈은 `controller/` · `service/` · `repository/` · `dto/` · `mapper/` 로 구성됩니다.
|
||||||
```
|
|
||||||
src/main/java/com/eactive/apim/portal/
|
|
||||||
├── apps/ # 기능 모듈 (user, app, approval, apis, etc.)
|
|
||||||
├── common/ # 공통 관심사
|
|
||||||
├── config/ # Spring 설정
|
|
||||||
└── gateway/ # Gateway DB 접근
|
|
||||||
```
|
|
||||||
|
|
||||||
## 외부 모듈
|
|
||||||
|
|
||||||
이 프로젝트는 다음 모듈에 의존합니다 (settings.gradle 참조):
|
|
||||||
- `eapim-online/elink-online-core-jpa`: Gateway 데이터 모델 (../eapim-online/elink-online-core-jpa)
|
|
||||||
- `elink-portal-common`: 공통 유틸리티 (../elink-portal-common)
|
|
||||||
|
|
||||||
## SASS / CSS 스타일 개발
|
## SASS / CSS 스타일 개발
|
||||||
|
|
||||||
### 개요
|
### 개요
|
||||||
|
|
||||||
이 프로젝트는 **Dart Sass**를 사용하여 CSS를 관리합니다.
|
이 프로젝트는 **Dart Sass**로 CSS를 관리합니다.
|
||||||
`src/main/resources/static/css/main.css`는 SASS에서 컴파일된 결과물이므로 **직접 수정하면 안 됩니다.**
|
`src/main/resources/static/css/main.css`는 SASS에서 컴파일된 결과물이므로 **직접 수정하면 안 됩니다.**
|
||||||
스타일 변경은 반드시 `src/main/resources/static/sass/` 하위 파일을 수정하세요.
|
스타일 변경은 반드시 `src/main/resources/static/sass/` 하위 파일을 수정하세요.
|
||||||
|
|
||||||
|
디자인 토큰·컴포넌트 규약은 📄 **[`DESIGN.md`](DESIGN.md)** 를 참고하세요.
|
||||||
|
|
||||||
### 설치
|
### 설치
|
||||||
|
|
||||||
Node.js 및 SASS 설치 절차는 [개발환경 준비 사항 § 6. Node.js & SASS 빌드 환경](djb-docs/개발환경-준비-사항.md#6-nodejs--sass-빌드-환경) 을 참고하세요.
|
Node.js 및 SASS 설치 절차는 [개발환경 준비 사항 § 6. Node.js & SASS 빌드 환경](djb-docs/개발환경-준비-사항.md#6-nodejs--sass-빌드-환경) 을 참고하세요.
|
||||||
@@ -355,7 +281,7 @@ src/main/resources/static/sass/
|
|||||||
│ ├── _reset.scss
|
│ ├── _reset.scss
|
||||||
│ ├── _typography.scss
|
│ ├── _typography.scss
|
||||||
│ ├── _animations.scss
|
│ ├── _animations.scss
|
||||||
│ ├── _kjb-font.scss # 광주은행 전용 폰트
|
│ ├── _djb-font.scss # 제주은행 전용 폰트
|
||||||
│ └── _utilities.scss # 유틸리티 클래스
|
│ └── _utilities.scss # 유틸리티 클래스
|
||||||
│
|
│
|
||||||
├── layout/ # 페이지 레이아웃 구조
|
├── layout/ # 페이지 레이아웃 구조
|
||||||
@@ -369,16 +295,15 @@ src/main/resources/static/sass/
|
|||||||
│ ├── _forms.scss
|
│ ├── _forms.scss
|
||||||
│ ├── _modals.scss # customPopup 모달 스타일
|
│ ├── _modals.scss # customPopup 모달 스타일
|
||||||
│ ├── _tables.scss
|
│ ├── _tables.scss
|
||||||
│ ├── _badges.scss
|
│ ├── _djb-inquiry-comments.scss
|
||||||
│ ├── _cards.scss
|
│ ├── _session-timer.scss
|
||||||
│ ├── _navigation.scss
|
|
||||||
│ ├── _pagination.scss
|
|
||||||
│ └── ...
|
│ └── ...
|
||||||
│
|
│
|
||||||
├── pages/ # 페이지별 스타일
|
├── pages/ # 페이지별 스타일
|
||||||
│ ├── _mypage.scss
|
│ ├── _mypage.scss
|
||||||
│ ├── _login.scss
|
│ ├── _login.scss
|
||||||
│ ├── _apikey-list.scss
|
│ ├── _apikey-list.scss
|
||||||
|
│ ├── _webhook.scss
|
||||||
│ └── ...
|
│ └── ...
|
||||||
│
|
│
|
||||||
├── themes/
|
├── themes/
|
||||||
@@ -424,7 +349,7 @@ touch src/main/resources/static/sass/pages/_new-page.scss
|
|||||||
```scss
|
```scss
|
||||||
// abstracts/_variables.scss 에 정의된 변수 사용
|
// abstracts/_variables.scss 에 정의된 변수 사용
|
||||||
.my-component {
|
.my-component {
|
||||||
color: $primary-blue; // #0049b4 (광주은행 블루)
|
color: $primary-blue; // #0049b4 (주 브랜드 블루)
|
||||||
background: $gray-bg; // #F8FAFC
|
background: $gray-bg; // #F8FAFC
|
||||||
border: 1px solid $border-gray; // #E2E8F0
|
border: 1px solid $border-gray; // #E2E8F0
|
||||||
box-shadow: $shadow-md;
|
box-shadow: $shadow-md;
|
||||||
@@ -435,7 +360,6 @@ touch src/main/resources/static/sass/pages/_new-page.scss
|
|||||||
### 컴파일 결과 확인
|
### 컴파일 결과 확인
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 컴파일 후 출력 파일 확인
|
|
||||||
ls -lh src/main/resources/static/css/main.css
|
ls -lh src/main/resources/static/css/main.css
|
||||||
ls -lh src/main/resources/static/css/main.min.css # minified
|
ls -lh src/main/resources/static/css/main.min.css # minified
|
||||||
```
|
```
|
||||||
@@ -446,82 +370,69 @@ ls -lh src/main/resources/static/css/main.min.css # minified
|
|||||||
- `style2.css` 는 레거시 파일(구 디자인 시스템)이며 `main.css` 와 **별도로 관리됨**
|
- `style2.css` 는 레거시 파일(구 디자인 시스템)이며 `main.css` 와 **별도로 관리됨**
|
||||||
- `@import` 대신 **`@use`** 사용 (Dart Sass 3.0 호환)
|
- `@import` 대신 **`@use`** 사용 (Dart Sass 3.0 호환)
|
||||||
- 파일명 앞에 언더스코어(`_`) 필수 — `_filename.scss` 형식이어야 단독 컴파일되지 않음
|
- 파일명 앞에 언더스코어(`_`) 필수 — `_filename.scss` 형식이어야 단독 컴파일되지 않음
|
||||||
|
- 신규 폼은 **DJB 계열 클래스**(`.djb-label`, `.djb-input` 등)를 사용 — 자세한 내용은 `DESIGN.md`
|
||||||
|
|
||||||
---
|
## 주요 기능
|
||||||
|
|
||||||
|
- 사용자 관리 (내부 사용자 / 기업 사용자, 가입 → 이메일 인증 → 관리자 승인)
|
||||||
|
- API 키 관리 및 승인 워크플로우
|
||||||
|
- API 카탈로그 · 문서 · 테스트베드
|
||||||
|
- 웹훅 구독 관리
|
||||||
|
- 커뮤니티 (FAQ, 공지사항, Q&A, 제휴문의)
|
||||||
|
- 감사 추적 (Hibernate Envers)
|
||||||
|
|
||||||
|
## 배포
|
||||||
|
|
||||||
|
### 지원 서버
|
||||||
|
|
||||||
|
- **WebLogic** (`src/main/resources/weblogic.xml`) — 현재 실제 배포 대상
|
||||||
|
- JEUS (`src/main/resources/jeus-web-dd.xml`)
|
||||||
|
- Tomcat (Spring Boot 내장)
|
||||||
|
|
||||||
|
### Jenkins 파이프라인
|
||||||
|
|
||||||
|
저장소 루트의 Jenkinsfile 4개가 모두 `origin/master` 를 대상으로 합니다.
|
||||||
|
`master` 에 push 하면 `Jenkinsfile.security` 가 pollSCM 으로 자동 실행됩니다.
|
||||||
|
|
||||||
|
| 파일 | 용도 |
|
||||||
|
|---|---|
|
||||||
|
| `Jenkinsfile.security` | OWASP Dependency-Check(SCA) + SonarQube(SAST), pollSCM 자동 트리거 |
|
||||||
|
| `Jenkinsfile.sonar` | SonarQube 정적 분석 전용 |
|
||||||
|
| `Jenkinsfile.test-build` | 테스트 + WAR 빌드 + SBOM |
|
||||||
|
| `Jenkinsfile.deploy` | WAR 빌드 후 WebLogic 배포 (정지 → WAR 교체 → 기동 → readiness 확인) |
|
||||||
|
|
||||||
|
파이프라인의 `Checkout dependencies` 스테이지가 `elink-portal-common`, `elink-online-core-jpa` 를 자동으로 clone/reset 합니다.
|
||||||
|
|
||||||
|
### Docker
|
||||||
|
|
||||||
|
```bash
|
||||||
|
gradle bootWar
|
||||||
|
docker build -t eapim-portal:latest .
|
||||||
|
```
|
||||||
|
|
||||||
## AI 코딩 어시스턴트 지침 파일
|
## AI 코딩 어시스턴트 지침 파일
|
||||||
|
|
||||||
이 프로젝트는 여러 AI 코딩 어시스턴트를 지원합니다. 각 도구는 다음 파일을 참조합니다:
|
|
||||||
|
|
||||||
### 지침 파일 위치
|
|
||||||
|
|
||||||
| AI 도구 | 지침 파일 경로 | 용도 |
|
| AI 도구 | 지침 파일 경로 | 용도 |
|
||||||
|---------|---------------|------|
|
|---------|---------------|------|
|
||||||
| **Claude Code** | `CLAUDE.md` | 마스터 지침 파일 (한글) |
|
| **Claude Code** | `CLAUDE.md` | 마스터 지침 파일 (한글) |
|
||||||
| **GitHub Copilot** | `.github/copilot-instructions.md` | Copilot용 지침 |
|
| **GitHub Copilot** | `.github/copilot-instructions.md` | Copilot용 지침 |
|
||||||
| **Cursor** | `.cursorrules` | Cursor용 간결한 규칙 |
|
| **Cursor** | `.cursorrules` | Cursor용 간결한 규칙 |
|
||||||
|
|
||||||
### 지침 파일 관리 방법
|
`CLAUDE.md` 가 마스터입니다. 수정 시 이 파일을 먼저 업데이트한 뒤 다른 파일에 반영하세요.
|
||||||
|
|
||||||
1. **마스터 파일**: `CLAUDE.md`
|
```bash
|
||||||
- 가장 상세한 프로젝트 지침을 포함
|
# copilot-instructions.md 는 8줄 머리말 + CLAUDE.md 본문 구조다 (머리말 보존)
|
||||||
- 한글로 작성되어 한국 개발팀이 이해하기 쉬움
|
{ head -8 .github/copilot-instructions.md; cat CLAUDE.md; } > /tmp/ci.md && mv /tmp/ci.md .github/copilot-instructions.md
|
||||||
- 수정 시 이 파일을 먼저 업데이트
|
# .cursorrules 는 간결한 버전이므로 필요 시 수동 업데이트
|
||||||
|
```
|
||||||
2. **동기화**:
|
|
||||||
```bash
|
|
||||||
# CLAUDE.md 수정 후 다른 파일들 동기화
|
|
||||||
cp CLAUDE.md .github/copilot-instructions.md
|
|
||||||
# .cursorrules는 간결한 버전이므로 필요시 수동 업데이트
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **새로운 AI 도구 지원 추가**:
|
|
||||||
- Windsurf: `.windsurfrules` 파일 생성
|
|
||||||
- 기타 도구: 해당 도구의 규칙 파일명 확인 후 생성
|
|
||||||
|
|
||||||
### 지침 파일에 포함된 내용
|
|
||||||
|
|
||||||
- 프로젝트 개요 및 기술 스택
|
|
||||||
- 빌드 명령어 및 개발 환경 설정
|
|
||||||
- 아키텍처 구조 (멀티 모듈, 이중 DB)
|
|
||||||
- 주요 기능 및 비즈니스 로직
|
|
||||||
- 개발 패턴 및 코딩 컨벤션
|
|
||||||
- 보안, 트랜잭션, 로깅 가이드
|
|
||||||
- 테스트 패턴
|
|
||||||
- 배포 방법
|
|
||||||
|
|
||||||
## 환경 설정
|
|
||||||
|
|
||||||
### 프로파일
|
|
||||||
|
|
||||||
- **dev**: 개발 환경
|
|
||||||
- **stage**: 스테이징 환경
|
|
||||||
- **prod**: 운영 환경
|
|
||||||
- **gf63**: 개인 개발 환경
|
|
||||||
- **kjb_rinjae**: 개인 개발 환경
|
|
||||||
|
|
||||||
### 데이터베이스
|
|
||||||
|
|
||||||
- **EMS Database**: Portal 사용자, 조직, API 키
|
|
||||||
- **Gateway Database**: API 명세, 서비스
|
|
||||||
|
|
||||||
## 주요 기능
|
|
||||||
|
|
||||||
- 사용자 관리 (내부/기업)
|
|
||||||
- API 키 관리 및 승인 워크플로우
|
|
||||||
- 감사 추적 (Hibernate Envers)
|
|
||||||
|
|
||||||
## 배포
|
|
||||||
|
|
||||||
### 지원 서버
|
|
||||||
- JEUS
|
|
||||||
- WebLogic
|
|
||||||
- Tomcat (내장)
|
|
||||||
|
|
||||||
## 문서
|
## 문서
|
||||||
|
|
||||||
- **개발환경 준비 사항**: [`djb-docs/개발환경-준비-사항.md`](djb-docs/개발환경-준비-사항.md) — JDK·Gradle·Node.js·SASS 설치 가이드
|
- **개발환경 준비 사항**: [`djb-docs/개발환경-준비-사항.md`](djb-docs/개발환경-준비-사항.md) — JDK·Gradle·Node.js·SASS 설치 가이드
|
||||||
|
- **로컬 기동 가이드 (Windows/Eclipse)**: [`BOOTRUN_SETUP_GUIDE.md`](BOOTRUN_SETUP_GUIDE.md)
|
||||||
|
- **OHS 정적 리소스 설정**: [`djb-docs/OHS-StaticResource-설정.md`](djb-docs/OHS-StaticResource-설정.md)
|
||||||
|
- **디자인 시스템**: [`DESIGN.md`](DESIGN.md) — 디자인 토큰·컴포넌트 규약·SASS 작성 규칙
|
||||||
- **메뉴 관리 개발 가이드**: [`readme-docs/메뉴-관리-개발-가이드.md`](readme-docs/메뉴-관리-개발-가이드.md) — menu.yml/roles.yml 스키마·시딩 규칙·캐시 리로드·admin 포탈메뉴관리 연동
|
- **메뉴 관리 개발 가이드**: [`readme-docs/메뉴-관리-개발-가이드.md`](readme-docs/메뉴-관리-개발-가이드.md) — menu.yml/roles.yml 스키마·시딩 규칙·캐시 리로드·admin 포탈메뉴관리 연동
|
||||||
- **프로젝트 상세 지침**: `CLAUDE.md` (한글)
|
- **프로젝트 상세 지침**: `CLAUDE.md` (한글)
|
||||||
- **사용자 가이드**: `개발자포탈.md` (한글)
|
- **사용자 가이드**: `개발자포탈.md` (한글)
|
||||||
- **빌드 스크립트**: `build-gf63.sh`, `deploy_portal.sh`
|
- **CI 설정**: `Jenkinsfile.*`, `sonar-project.properties`, `ci/`
|
||||||
|
|||||||
+2
-1
@@ -323,7 +323,8 @@ jacocoTestReport {
|
|||||||
// 로컬 전용 설정 파일. 배포 산출물(WAR)에 실리면 Actuator/SBA 설정이 그대로 노출되어
|
// 로컬 전용 설정 파일. 배포 산출물(WAR)에 실리면 Actuator/SBA 설정이 그대로 노출되어
|
||||||
// 정보보호 점검에 불필요하게 걸린다. processResources 는 건드리지 않는다
|
// 정보보호 점검에 불필요하게 걸린다. processResources 는 건드리지 않는다
|
||||||
// (bootRun 이 build/resources/main 을 그대로 쓰므로 로컬 기동이 깨진다).
|
// (bootRun 이 build/resources/main 을 그대로 쓰므로 로컬 기동이 깨진다).
|
||||||
def localOnlyResources = ['**/application-local*.yml']
|
// logback-local*.xml: git 관리되는 샘플(logback-local_example.xml)이 WAR 에 실리지 않도록 함께 제외한다.
|
||||||
|
def localOnlyResources = ['**/application-local*.yml', '**/logback-local*.xml']
|
||||||
|
|
||||||
// 배포 산출물에서 로컬 전용 라이브러리를 걸러낸다. localOnlyLibPrefixes 는 파일 상단 정의.
|
// 배포 산출물에서 로컬 전용 라이브러리를 걸러낸다. localOnlyLibPrefixes 는 파일 상단 정의.
|
||||||
def excludeLocalOnlyLibs = { org.gradle.api.file.FileCollection cp ->
|
def excludeLocalOnlyLibs = { org.gradle.api.file.FileCollection cp ->
|
||||||
|
|||||||
+175
-34
@@ -1,22 +1,23 @@
|
|||||||
# 개발환경 준비 사항
|
# 개발환경 준비 사항
|
||||||
|
|
||||||
EAPIM Portal 개발에 필요한 도구와 런타임을 설치하고 검증하는 절차입니다.
|
EAPIM Portal(제주은행 DJBank) 개발에 필요한 도구와 런타임을 설치하고 검증하는 절차입니다.
|
||||||
처음 환경을 세팅하는 신규 개발자는 이 문서를 끝까지 따라 진행한 뒤 [README.md](../README.md)의 "초기 세팅 가이드" 단계를 이어서 수행하세요.
|
처음 환경을 세팅하는 신규 개발자는 이 문서를 끝까지 따라 진행한 뒤 [README.md](../README.md)의 "프로젝트 클론" / "초기 세팅 가이드" 단계를 이어서 수행하세요.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 0. 한눈에 보는 요구사항
|
## 0. 한눈에 보는 요구사항
|
||||||
|
|
||||||
| 구분 | 도구 | 권장 버전 | 비고 |
|
| 구분 | 도구 | 권장 버전 | 비고 |
|
||||||
|------|------|-----------|----------------------------------|
|
|------|------|-----------|------|
|
||||||
| 백엔드 | JDK | 1.8 (Zulu 8 권장) | `sourceCompatibility=1.8` |
|
| 백엔드 | JDK | 1.8 (Zulu 8 권장, Linux 는 OpenJDK 8) | `sourceCompatibility=1.8` |
|
||||||
| 빌드 | Gradle | 8.7 | gradlew 사용 금지 — 시스템 gradle 직접 사용 |
|
| 빌드 | Gradle | 8.7 | 시스템에 설치한 gradle 직접 사용 (Jenkins 노드와 동일) |
|
||||||
| 형상관리 | Git | 2.30 이상 | SSH 키 등록 권장 |
|
| 형상관리 | Git | 2.30 이상 | 사내 Gitea `172.30.1.50:2222` SSH 키 등록 필요 |
|
||||||
| DB | Oracle Client/접근 | 19c | 개발은 `192.168.240.177:1598` |
|
| 의존성 저장소 | Nexus | - | `https://nexus.eactive.synology.me:8090` 접근 필요 |
|
||||||
| 프론트엔드 빌드 | Node.js | 18 LTS 이상 | SCSS 컴파일 전용 |
|
| DB | Oracle 19c | 19c | 개발 DB `172.30.1.50:1598/DAPM` (djb-vm) |
|
||||||
| 프론트엔드 빌드 | npm | Node.js 함께 설치 | `sass` 패키지 사용 |
|
| 프론트엔드 빌드 | Node.js | 18 LTS 이상 | SCSS 컴파일 전용 |
|
||||||
| (선택) 환경 변수 | direnv | 최신 | `.envrc` 자동 로드 |
|
| 프론트엔드 빌드 | npm | Node.js 함께 설치 | `sass` 패키지 사용 |
|
||||||
| (선택) IDE | IntelliJ IDEA | 2023.x 이상 | Lombok / MapStruct 플러그인 |
|
| (권장) 환경 변수 | direnv | 최신 | 워크스페이스 루트 `.envrc` 자동 로드 |
|
||||||
|
| (선택) IDE | IntelliJ IDEA | 2023.x 이상 | Lombok / MapStruct 플러그인 |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -32,6 +33,16 @@ brew install --cask zulu@8
|
|||||||
/usr/libexec/java_home -v 1.8
|
/usr/libexec/java_home -v 1.8
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Linux (Ubuntu)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt install openjdk-8-jdk
|
||||||
|
# 설치 경로: /usr/lib/jvm/java-8-openjdk-amd64
|
||||||
|
```
|
||||||
|
|
||||||
|
> 시스템 기본 `java` 가 다른 버전(예: 21)으로 남아 있어도 됩니다. 프로젝트에서는 direnv 로
|
||||||
|
> `JAVA_HOME` 을 8 로 고정합니다 (§3). `update-alternatives` 로 시스템 기본값을 바꿀 필요는 없습니다.
|
||||||
|
|
||||||
### Windows
|
### Windows
|
||||||
|
|
||||||
1. [Azul Zulu JDK 8 다운로드](https://www.azul.com/downloads/?version=java-8-lts&package=jdk)
|
1. [Azul Zulu JDK 8 다운로드](https://www.azul.com/downloads/?version=java-8-lts&package=jdk)
|
||||||
@@ -51,9 +62,12 @@ echo %JAVA_HOME% # Windows
|
|||||||
|
|
||||||
## 2. Gradle 8.7 설치
|
## 2. Gradle 8.7 설치
|
||||||
|
|
||||||
이 프로젝트는 **gradlew 사용을 금지**합니다. 시스템에 설치된 gradle 8.7을 직접 사용합니다.
|
시스템에 설치한 gradle 8.7 을 직접 사용합니다. Jenkins 노드도 `/apps/opts/gradle-8.7` 의 `gradle` 을 씁니다.
|
||||||
|
|
||||||
### macOS (Homebrew + SDKMAN 권장)
|
> Windows/Eclipse 환경에서 bootRun 으로 기동하는 절차는 [`BOOTRUN_SETUP_GUIDE.md`](../BOOTRUN_SETUP_GUIDE.md) 를
|
||||||
|
> 따릅니다 (그 가이드는 `gradlew.bat bootRun` 을 사용합니다).
|
||||||
|
|
||||||
|
### macOS (SDKMAN 권장)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# SDKMAN 설치 (이미 있으면 생략)
|
# SDKMAN 설치 (이미 있으면 생략)
|
||||||
@@ -65,6 +79,24 @@ sdk install gradle 8.7
|
|||||||
sdk default gradle 8.7
|
sdk default gradle 8.7
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Linux (배포판 직접 설치)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
GRADLE_DIR=/work/eactive/djb-eapim/apps # 설치 위치는 환경에 맞게
|
||||||
|
|
||||||
|
cd /tmp
|
||||||
|
curl -LO https://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||||
|
curl -LO https://services.gradle.org/distributions/gradle-8.7-bin.zip.sha256
|
||||||
|
|
||||||
|
# 체크섬 검증 (OK 가 나와야 함)
|
||||||
|
echo "$(cat gradle-8.7-bin.zip.sha256) gradle-8.7-bin.zip" | sha256sum -c -
|
||||||
|
|
||||||
|
mkdir -p "$GRADLE_DIR" && unzip -q gradle-8.7-bin.zip -d "$GRADLE_DIR"
|
||||||
|
# → $GRADLE_DIR/gradle-8.7/bin/gradle
|
||||||
|
```
|
||||||
|
|
||||||
|
`PATH` 등록은 §3 의 direnv 에서 합니다.
|
||||||
|
|
||||||
### Windows
|
### Windows
|
||||||
|
|
||||||
1. [Gradle 8.7 Binary-only 다운로드](https://gradle.org/releases/)
|
1. [Gradle 8.7 Binary-only 다운로드](https://gradle.org/releases/)
|
||||||
@@ -80,12 +112,23 @@ gradle -v
|
|||||||
# JVM: 1.8.x
|
# JVM: 1.8.x
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### 의존성 저장소 (Nexus)
|
||||||
|
|
||||||
|
`build.gradle` 에 선언된 저장소는 사내 Nexus 하나뿐입니다.
|
||||||
|
|
||||||
|
```
|
||||||
|
https://nexus.eactive.synology.me:8090/repository/maven-public/
|
||||||
|
```
|
||||||
|
|
||||||
|
플러그인(`org.cyclonedx.bom` 등)은 Gradle Plugin Portal 에서 받습니다. 최초 빌드는 두 곳 모두 접근 가능해야 하며,
|
||||||
|
`--offline` 은 로컬 캐시(`~/.gradle/caches`)가 채워진 뒤에만 동작합니다.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 3. (권장) direnv 사용
|
## 3. (권장) direnv 사용
|
||||||
|
|
||||||
저장소 루트의 `.envrc` 가 `JAVA_HOME`, `GRADLE_USER_HOME` 등을 자동 주입합니다.
|
`JAVA_HOME` · `GRADLE_HOME` · `PATH` 를 디렉터리 진입만으로 자동 설정합니다.
|
||||||
디렉터리 진입만으로 환경이 격리되므로 다른 프로젝트와 JDK가 섞이지 않습니다.
|
다른 프로젝트와 JDK 가 섞이지 않습니다.
|
||||||
|
|
||||||
### 설치
|
### 설치
|
||||||
|
|
||||||
@@ -93,6 +136,9 @@ gradle -v
|
|||||||
# macOS
|
# macOS
|
||||||
brew install direnv
|
brew install direnv
|
||||||
|
|
||||||
|
# Linux (Ubuntu)
|
||||||
|
sudo apt install direnv
|
||||||
|
|
||||||
# Windows (scoop)
|
# Windows (scoop)
|
||||||
scoop install direnv
|
scoop install direnv
|
||||||
```
|
```
|
||||||
@@ -107,11 +153,37 @@ echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc
|
|||||||
echo 'eval "$(direnv hook bash)"' >> ~/.bashrc
|
echo 'eval "$(direnv hook bash)"' >> ~/.bashrc
|
||||||
```
|
```
|
||||||
|
|
||||||
### 프로젝트에서 허용
|
등록 후 새 터미널을 열거나 `source ~/.zshrc` 를 실행합니다.
|
||||||
|
|
||||||
|
### .envrc 작성 — 워크스페이스 루트에 둔다
|
||||||
|
|
||||||
|
`.envrc` 는 **저장소 안이 아니라 워크스페이스 루트**(`djb-workspace/`)에 둡니다.
|
||||||
|
|
||||||
|
- 머신별 절대경로가 저장소에 커밋되지 않습니다 (eapim-portal 의 `.gitignore` 도 `/.envrc` 를 무시합니다)
|
||||||
|
- direnv 는 상위 디렉터리를 거슬러 올라가 `.envrc` 를 찾으므로 eapim-portal · eapim-admin · eapim-online 에 한 번에 적용됩니다
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd /path/to/eapim-portal
|
# djb-workspace/.envrc (경로는 환경에 맞게 수정)
|
||||||
|
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
|
||||||
|
export GRADLE_HOME=/work/eactive/djb-eapim/apps/gradle-8.7
|
||||||
|
|
||||||
|
PATH_add "$JAVA_HOME/bin"
|
||||||
|
PATH_add "$GRADLE_HOME/bin"
|
||||||
|
|
||||||
|
# gradle bootRun 기본 프로파일 (§5.2 의 개인 로컬 프로파일)
|
||||||
|
# ORG_GRADLE_PROJECT_<name> 환경변수는 gradle 이 -P<name> 으로 읽는다.
|
||||||
|
export ORG_GRADLE_PROJECT_bootProfile=local_<이름>
|
||||||
|
```
|
||||||
|
|
||||||
|
### 허용 및 확인
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd ~/djb-workspace
|
||||||
direnv allow
|
direnv allow
|
||||||
|
|
||||||
|
cd eapim-portal
|
||||||
|
which gradle # .../gradle-8.7/bin/gradle
|
||||||
|
java -version # 1.8.x
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -124,40 +196,106 @@ direnv allow
|
|||||||
brew install git
|
brew install git
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Linux (Ubuntu)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt install git
|
||||||
|
```
|
||||||
|
|
||||||
### Windows
|
### Windows
|
||||||
|
|
||||||
[Git for Windows](https://git-scm.com/download/win) 설치. Git Bash가 함께 설치되어 README의 Bash 스니펫을 그대로 사용할 수 있습니다.
|
[Git for Windows](https://git-scm.com/download/win) 설치. Git Bash가 함께 설치되어 README의 Bash 스니펫을 그대로 사용할 수 있습니다.
|
||||||
|
|
||||||
### SSH 키 등록 (사내 Git 서버용)
|
### SSH 키 등록 (사내 Gitea)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
ssh-keygen -t ed25519 -C "your.email@djbank.co.kr"
|
ssh-keygen -t ed25519 -C "your.email@example.com"
|
||||||
cat ~/.ssh/id_ed25519.pub
|
cat ~/.ssh/id_ed25519.pub
|
||||||
# 출력된 공개키를 사내 Git 서버(192.168.240.178:18081)에 등록
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
출력된 공개키를 Gitea(`http://172.30.1.50:3000`) → 우상단 프로필 → **설정 → SSH/GPG 키** 에 등록합니다.
|
||||||
|
|
||||||
### 검증
|
### 검증
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git --version
|
git --version
|
||||||
ssh -T git@192.168.240.178 -p 18081
|
ssh -T -p 2222 git@172.30.1.50
|
||||||
|
# Hi there, <계정>! You've successfully authenticated ... but Gitea does not provide shell access.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
위 메시지가 나오면 정상입니다 (셸 접근이 없다는 문구는 오류가 아닙니다).
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 5. Oracle 19c 접근 정보
|
## 5. Oracle 19c 접근 정보
|
||||||
|
|
||||||
개발 환경에서는 별도 Oracle 설치 없이 사내 개발 DB에 접속합니다.
|
### 5.1 개발 DB
|
||||||
|
|
||||||
- **Host**: `192.168.240.177`
|
별도 Oracle 설치 없이 djb-vm 의 개발 DB(Podman 컨테이너)에 접속합니다.
|
||||||
- **Port**: `1599`
|
|
||||||
- **Schemas**: `EMSADM` (Portal), `AGWADM` (Gateway)
|
|
||||||
- 상세 계정/패스워드는 사내 비밀번호 관리자에게 문의
|
|
||||||
|
|
||||||
스테이징/운영은 JNDI를 통해 접근합니다 — `jdbc/dsOBP_EMS`, `jdbc/dsOBP_AGW`.
|
| 항목 | 값 |
|
||||||
|
|---|---|
|
||||||
|
| Host | `172.30.1.50` |
|
||||||
|
| Port | `1598` |
|
||||||
|
| Service Name | `DAPM` |
|
||||||
|
| JDBC URL | `jdbc:oracle:thin:@//172.30.1.50:1598/DAPM` |
|
||||||
|
| Schema / 계정 | `EMSAPP` (Portal), `AGWAPP` (Gateway) |
|
||||||
|
|
||||||
|
계정 비밀번호는 담당자에게 문의하세요. **비밀번호를 저장소에 커밋하지 마세요.**
|
||||||
|
|
||||||
DB 클라이언트 도구는 자유 선택 (DBeaver, DataGrip, SQL Developer 등).
|
DB 클라이언트 도구는 자유 선택 (DBeaver, DataGrip, SQL Developer 등).
|
||||||
|
|
||||||
|
### 5.2 애플리케이션의 DB 연결 방식
|
||||||
|
|
||||||
|
서버 배포용 프로파일(`dev` · `stage` · `prod`)은 **모두 JNDI** 로 연결하며 WAS 에 배포해서만 동작합니다.
|
||||||
|
|
||||||
|
| JNDI | 스키마 | 용도 |
|
||||||
|
|---|---|---|
|
||||||
|
| `jdbc/dsOBP_EMS` | `EMSAPP` | Portal |
|
||||||
|
| `jdbc/dsOBP_AGW` | `AGWAPP` | Gateway (조회 전용) |
|
||||||
|
|
||||||
|
로컬 기동(`gradle bootRun`, 내장 Tomcat)은 **local 전용 프로파일**(`local_*`)로만 합니다.
|
||||||
|
dev 가 로컬에서 뜨지 않는 것은 의도된 동작입니다 — `application-dev.yml` 을 로컬용으로 고치지 마세요.
|
||||||
|
내장 Tomcat 에는 JNDI 가 없으므로 local 프로파일은 `jndi-name` 을 비우고 직접 JDBC 로 접속합니다
|
||||||
|
(`PortalDatasourceConfiguration` 은 `jndi-name` 이 비어 있으면 `jdbc-url` 로 직접 접속).
|
||||||
|
|
||||||
|
#### 샘플에서 개인 프로파일 만들기
|
||||||
|
|
||||||
|
git 으로 관리되는 샘플 `application-local_example.yml` / `logback-local_example.xml` 을 복사해서 씁니다.
|
||||||
|
샘플에는 DB 접속정보(비밀번호 제외)와 로컬용 설정(캐시 비활성화, 콘솔 로그, SQL 로그 분리)이 들어 있습니다.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd src/main/resources
|
||||||
|
cp application-local_example.yml application-local_<이름>.yml
|
||||||
|
cp logback-local_example.xml logback-local_<이름>.xml
|
||||||
|
```
|
||||||
|
|
||||||
|
복사한 yml 에서 세 군데를 고칩니다.
|
||||||
|
|
||||||
|
| 위치 | 샘플 값 | 변경 |
|
||||||
|
|---|---|---|
|
||||||
|
| `spring.config.activate.on-profile` | `local_example` | `local_<이름>` |
|
||||||
|
| `logging.config` | `classpath:logback-local_example.xml` | `classpath:logback-local_<이름>.xml` |
|
||||||
|
| `ems/gateway.datasource.password` | `CHANGE_ME` | 실제 비밀번호 (담당자 문의) |
|
||||||
|
|
||||||
|
로그는 기본으로 `~/eapim-logs/eapim-portal` 에 남습니다. 바꾸려면 yml 의 `portal.logging.log-path` 와
|
||||||
|
logback 의 `LOG_PATH` 를 함께 고칩니다.
|
||||||
|
|
||||||
|
기동:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
gradle bootRun -PbootProfile=local_<이름> # → http://localhost:39130
|
||||||
|
# direnv 에 ORG_GRADLE_PROJECT_bootProfile 을 넣었다면 그냥 gradle bootRun
|
||||||
|
```
|
||||||
|
|
||||||
|
주의사항:
|
||||||
|
|
||||||
|
- **샘플 파일(`*_example`)에는 실제 비밀번호를 넣지 마세요** — git 으로 관리되는 파일입니다.
|
||||||
|
- **개인 파일의 gitignore 확인 필수** — `.gitignore` 는 `*rinjae*`, `*gf63*` 처럼 **개인별 패턴만** 무시합니다.
|
||||||
|
`git check-ignore -v application-local_<이름>.yml` 로 확인하고, 안 걸리면 `.gitignore` 에 본인 패턴을 추가하세요.
|
||||||
|
- 파일명은 반드시 `application-local` / `logback-local` 로 시작해야 합니다.
|
||||||
|
`build.gradle` 의 `localOnlyResources` 가 이 패턴을 **WAR 산출물에서 제외**합니다.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 6. Node.js & SASS 빌드 환경
|
## 6. Node.js & SASS 빌드 환경
|
||||||
@@ -237,6 +375,7 @@ ls -lh src/main/resources/static/css/main.min.css
|
|||||||
- SCSS 파일은 `src/main/resources/static/sass/` 하위에서만 작성
|
- SCSS 파일은 `src/main/resources/static/sass/` 하위에서만 작성
|
||||||
- 새 파일 추가 시 파일명 앞에 언더스코어(`_`) 필수 (`_filename.scss`)
|
- 새 파일 추가 시 파일명 앞에 언더스코어(`_`) 필수 (`_filename.scss`)
|
||||||
- `@import` 대신 `@use` 사용 (Dart Sass 3.0 호환)
|
- `@import` 대신 `@use` 사용 (Dart Sass 3.0 호환)
|
||||||
|
- 디자인 토큰·컴포넌트 규약은 [`DESIGN.md`](../DESIGN.md) 참고
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -246,7 +385,7 @@ ls -lh src/main/resources/static/css/main.min.css
|
|||||||
|
|
||||||
1. **Lombok 플러그인** 설치 → `Settings → Plugins → Lombok`
|
1. **Lombok 플러그인** 설치 → `Settings → Plugins → Lombok`
|
||||||
2. **Annotation Processing 활성화** → `Settings → Build → Compiler → Annotation Processors → Enable annotation processing`
|
2. **Annotation Processing 활성화** → `Settings → Build → Compiler → Annotation Processors → Enable annotation processing`
|
||||||
3. **Gradle JVM** 설정 → `Settings → Build → Build Tools → Gradle → Gradle JVM` 을 JDK 1.8 (Zulu) 로 지정
|
3. **Gradle JVM** 설정 → `Settings → Build → Build Tools → Gradle → Gradle JVM` 을 JDK 1.8 로 지정
|
||||||
4. **MapStruct** 는 별도 플러그인 불필요 (annotation processor 만 활성화되어 있으면 됨)
|
4. **MapStruct** 는 별도 플러그인 불필요 (annotation processor 만 활성화되어 있으면 됨)
|
||||||
|
|
||||||
### VS Code
|
### VS Code
|
||||||
@@ -262,12 +401,14 @@ ls -lh src/main/resources/static/css/main.min.css
|
|||||||
아래 명령이 모두 정상 동작하면 개발환경 준비가 완료된 것입니다.
|
아래 명령이 모두 정상 동작하면 개발환경 준비가 완료된 것입니다.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
java -version # 1.8.x
|
java -version # 1.8.x
|
||||||
gradle -v # 8.7 / JVM 1.8
|
gradle -v # 8.7 / JVM 1.8
|
||||||
git --version
|
git --version
|
||||||
node -v # v18 이상
|
ssh -T -p 2222 git@172.30.1.50 # "successfully authenticated"
|
||||||
|
node -v # v18 이상
|
||||||
npm -v
|
npm -v
|
||||||
direnv version # (선택)
|
direnv version # (권장)
|
||||||
```
|
```
|
||||||
|
|
||||||
이후 [README.md](../README.md) 의 "초기 세팅 가이드" 로 이동해 프로젝트 클론과 의존 모듈 설치를 진행하세요.
|
이후 [README.md](../README.md) 의 "프로젝트 클론" 으로 이동해 저장소와 의존 모듈을 받고,
|
||||||
|
`gradle classes` 로 컴파일이 되는지 확인하세요.
|
||||||
|
|||||||
@@ -85,9 +85,6 @@ public class OrgRegisterFacadeImpl implements OrgRegisterFacade {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
FileInfo uploadedFile = handleFileUpload(orgDTO.getFiles());
|
FileInfo uploadedFile = handleFileUpload(orgDTO.getFiles());
|
||||||
if (uploadedFile == null) {
|
|
||||||
return new ValidationResponse(false, "첨부파일이 올바르지 않습니다.");
|
|
||||||
}
|
|
||||||
return registerNewCorporateUser(orgDTO, uploadedFile, emailVerified);
|
return registerNewCorporateUser(orgDTO, uploadedFile, emailVerified);
|
||||||
} catch (IllegalArgumentException | IOException e) {
|
} catch (IllegalArgumentException | IOException e) {
|
||||||
return new ValidationResponse(false, e.getMessage());
|
return new ValidationResponse(false, e.getMessage());
|
||||||
@@ -113,9 +110,6 @@ public class OrgRegisterFacadeImpl implements OrgRegisterFacade {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
FileInfo uploadedFile = handleFileUpload(orgDTO.getFiles());
|
FileInfo uploadedFile = handleFileUpload(orgDTO.getFiles());
|
||||||
if (uploadedFile == null) {
|
|
||||||
return new ValidationResponse(false, "첨부파일이 올바르지 않습니다.");
|
|
||||||
}
|
|
||||||
return convertExistingUserToCorporate(existingUser, orgDTO, uploadedFile);
|
return convertExistingUserToCorporate(existingUser, orgDTO, uploadedFile);
|
||||||
} catch (IllegalArgumentException | IOException e) {
|
} catch (IllegalArgumentException | IOException e) {
|
||||||
return new ValidationResponse(false, e.getMessage());
|
return new ValidationResponse(false, e.getMessage());
|
||||||
@@ -139,9 +133,6 @@ public class OrgRegisterFacadeImpl implements OrgRegisterFacade {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
FileInfo uploadedFile = handleFileUpload(orgDTO.getFiles());
|
FileInfo uploadedFile = handleFileUpload(orgDTO.getFiles());
|
||||||
if (uploadedFile == null) {
|
|
||||||
return new ValidationResponse(false, "첨부파일이 올바르지 않습니다.");
|
|
||||||
}
|
|
||||||
return convertExistingUserToCorporate(existingUser, orgDTO, uploadedFile);
|
return convertExistingUserToCorporate(existingUser, orgDTO, uploadedFile);
|
||||||
} catch (IllegalArgumentException | IOException e) {
|
} catch (IllegalArgumentException | IOException e) {
|
||||||
return new ValidationResponse(false, e.getMessage());
|
return new ValidationResponse(false, e.getMessage());
|
||||||
@@ -168,9 +159,6 @@ public class OrgRegisterFacadeImpl implements OrgRegisterFacade {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
FileInfo uploadedFile = handleFileUpload(orgDTO.getFiles());
|
FileInfo uploadedFile = handleFileUpload(orgDTO.getFiles());
|
||||||
if (uploadedFile == null) {
|
|
||||||
return new ValidationResponse(false, "첨부파일이 올바르지 않습니다.");
|
|
||||||
}
|
|
||||||
return registerNewCorporateUserWithExistingData(orgDTO, existingUser, newEmail, uploadedFile);
|
return registerNewCorporateUserWithExistingData(orgDTO, existingUser, newEmail, uploadedFile);
|
||||||
} catch (IllegalArgumentException | IOException e) {
|
} catch (IllegalArgumentException | IOException e) {
|
||||||
return new ValidationResponse(false, e.getMessage());
|
return new ValidationResponse(false, e.getMessage());
|
||||||
@@ -265,9 +253,10 @@ public class OrgRegisterFacadeImpl implements OrgRegisterFacade {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 파일 업로드를 처리하는 메서드
|
// 파일 업로드를 처리하는 메서드
|
||||||
|
// 사업자등록증은 선택 첨부다. 첨부가 없으면(빈 파일 포함) null 을 반환하고 기관은 첨부 없이 등록된다.
|
||||||
private FileInfo handleFileUpload(List<MultipartFile> files) throws IOException {
|
private FileInfo handleFileUpload(List<MultipartFile> files) throws IOException {
|
||||||
if (!validationService.isFileUploaded(files)) {
|
if (!validationService.isFileUploaded(files)) {
|
||||||
throw new IllegalArgumentException("법인 등록을 위해 파일이 필요합니다.");
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileTypeContext.setFileType("certificate");
|
FileTypeContext.setFileType("certificate");
|
||||||
|
|||||||
@@ -35,10 +35,9 @@ public class PortalOrgService {
|
|||||||
// ID 수동 할당
|
// ID 수동 할당
|
||||||
newOrg.setId(java.util.UUID.randomUUID().toString());
|
newOrg.setId(java.util.UUID.randomUUID().toString());
|
||||||
|
|
||||||
// 파일 정보 설정
|
// 파일 정보 설정 (사업자등록증은 선택 첨부)
|
||||||
if (file != null) {
|
// 매퍼가 DTO 의 compRegFile(화면 표시용 파일명)을 복사하므로, 첨부가 없으면 명시적으로 비운다
|
||||||
newOrg.setCompRegFile(file.getFileId());
|
newOrg.setCompRegFile(file != null ? file.getFileId() : null);
|
||||||
}
|
|
||||||
|
|
||||||
// 초기 상태 설정
|
// 초기 상태 설정
|
||||||
setInitialOrgStatus(newOrg);
|
setInitialOrgStatus(newOrg);
|
||||||
|
|||||||
@@ -0,0 +1,80 @@
|
|||||||
|
# 로컬 전용 프로파일 샘플 (git 관리 대상)
|
||||||
|
#
|
||||||
|
# 로컬 기동(gradle bootRun / IDE)용 개인 프로파일을 만들 때 이 파일을 복사해서 쓴다.
|
||||||
|
# dev/stage/prod 는 서버(WAS) 배포용이라 로컬에서 뜨지 않는 것이 의도된 동작이다.
|
||||||
|
#
|
||||||
|
# 1) 복사: cp application-local_example.yml application-local_<이름>.yml
|
||||||
|
# cp logback-local_example.xml logback-local_<이름>.xml
|
||||||
|
# 2) 아래 on-profile, logging.config 의 'local_example' 을 'local_<이름>' 으로 변경
|
||||||
|
# 3) DB 비밀번호(CHANGE_ME) 입력 — 비밀번호는 담당자에게 문의
|
||||||
|
# 4) 커밋되지 않는지 확인: git check-ignore -v application-local_<이름>.yml
|
||||||
|
# (.gitignore 는 개인별 패턴만 무시한다. 안 걸리면 .gitignore 에 본인 패턴 추가)
|
||||||
|
# 5) 기동: gradle bootRun -PbootProfile=local_<이름> → http://localhost:39130
|
||||||
|
#
|
||||||
|
# - 파일명은 반드시 application-local 로 시작해야 한다.
|
||||||
|
# build.gradle 의 localOnlyResources 가 WAR 산출물에서 제외한다.
|
||||||
|
# - 이 샘플 파일에는 실제 비밀번호를 넣지 않는다.
|
||||||
|
spring:
|
||||||
|
config:
|
||||||
|
activate:
|
||||||
|
on-profile: local_example
|
||||||
|
web:
|
||||||
|
resources:
|
||||||
|
cache:
|
||||||
|
period: 0 # 로컬: 정적 리소스 캐시 비활성화
|
||||||
|
cachecontrol:
|
||||||
|
max-age: 0
|
||||||
|
must-revalidate: true
|
||||||
|
no-cache: true
|
||||||
|
jpa:
|
||||||
|
properties:
|
||||||
|
hibernate:
|
||||||
|
show_sql: false # SQL 은 logback 의 hibernate.log 로 남긴다
|
||||||
|
format_sql: true
|
||||||
|
use_sql_comments: true
|
||||||
|
devtools:
|
||||||
|
restart:
|
||||||
|
enabled: false
|
||||||
|
additional-exclude: logback*.xml
|
||||||
|
livereload:
|
||||||
|
enabled: true
|
||||||
|
thymeleaf:
|
||||||
|
cache: false
|
||||||
|
|
||||||
|
logging:
|
||||||
|
config: classpath:logback-local_example.xml
|
||||||
|
|
||||||
|
# 내장 Tomcat 에는 JNDI 가 없으므로 jndi-name 을 비우고 개발 DB 에 직접 접속한다.
|
||||||
|
# (PortalDatasourceConfiguration: jndi-name 이 비어 있으면 jdbc-url 로 직접 접속)
|
||||||
|
ems:
|
||||||
|
datasource:
|
||||||
|
jndi-name: ""
|
||||||
|
jdbc-url: jdbc:oracle:thin:@//172.30.1.50:1598/DAPM
|
||||||
|
driver-class-name: oracle.jdbc.OracleDriver
|
||||||
|
username: EMSAPP
|
||||||
|
password: CHANGE_ME
|
||||||
|
schema: EMSAPP
|
||||||
|
|
||||||
|
gateway:
|
||||||
|
datasource:
|
||||||
|
jndi-name: ""
|
||||||
|
jdbc-url: jdbc:oracle:thin:@//172.30.1.50:1598/DAPM
|
||||||
|
driver-class-name: oracle.jdbc.OracleDriver
|
||||||
|
username: AGWAPP
|
||||||
|
password: CHANGE_ME
|
||||||
|
schema: AGWAPP
|
||||||
|
|
||||||
|
portal:
|
||||||
|
logging:
|
||||||
|
# 기본값 /logs/prod/eapim 은 서버 경로다. 로컬은 홈 디렉터리 아래로 둔다.
|
||||||
|
# 실제 로그 경로는 logback-local_*.xml 의 LOG_PATH 가 결정한다 — 두 값을 맞춰 둔다.
|
||||||
|
log-path: ${user.home}/eapim-logs/eapim-portal
|
||||||
|
security:
|
||||||
|
password-encrypt:
|
||||||
|
# localhost 는 secure context 라 crypto.subtle(WebCrypto)을 그대로 쓴다.
|
||||||
|
enabled: true
|
||||||
|
plaintext-policy: permissive
|
||||||
|
dev:
|
||||||
|
# application.yml 의 `page:` 트리(브레드크럼/메뉴 이름) 라이브 반영
|
||||||
|
hot-reload-pages: true
|
||||||
|
test-auth-notice-enabled: true
|
||||||
@@ -0,0 +1,121 @@
|
|||||||
|
<!--
|
||||||
|
로컬 전용 logback 샘플 (git 관리 대상). application-local_example.yml 의 logging.config 로 로드된다.
|
||||||
|
복사해서 logback-local_<이름>.xml 로 쓴다 (application-local_example.yml 상단 절차 참고).
|
||||||
|
build.gradle 의 localOnlyResources 가 WAR 산출물에서 제외한다.
|
||||||
|
|
||||||
|
- 콘솔 출력 ON (logback-spring.xml 은 기본 OFF)
|
||||||
|
- com.eactive.apim DEBUG, Hibernate SQL + 바인딩 파라미터는 hibernate.log 로 분리
|
||||||
|
- scan=true: 이 파일의 로그 레벨을 고치면 재시작 없이 10초 내 반영된다.
|
||||||
|
(그래서 springProperty/springProfile 같은 Spring 확장 태그를 쓰지 않는다 — scan 과 함께 쓰면 오류)
|
||||||
|
-->
|
||||||
|
<configuration scan="true" scanPeriod="10 seconds">
|
||||||
|
<shutdownHook class="ch.qos.logback.core.hook.DelayingShutdownHook"/>
|
||||||
|
|
||||||
|
<!-- application-local_*.yml 의 portal.logging.log-path 와 맞춰 둔다 -->
|
||||||
|
<property name="LOG_PATH" value="${user.home}/eapim-logs/eapim-portal"/>
|
||||||
|
|
||||||
|
<property name="CONSOLE_PATTERN" value="%d{HH:mm:ss.SSS} %magenta([%thread]) %highlight([%-5level]) %cyan(%logger{36}) - %msg %n" />
|
||||||
|
<property name="FILE_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n" />
|
||||||
|
|
||||||
|
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder><pattern>${CONSOLE_PATTERN}</pattern></encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="ROLLING" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_PATH}/portal.log</file>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${LOG_PATH}/backup/portal.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||||
|
<maxFileSize>100MB</maxFileSize>
|
||||||
|
<maxHistory>7</maxHistory>
|
||||||
|
<totalSizeCap>1GB</totalSizeCap>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder><pattern>${FILE_PATTERN}</pattern></encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="HIBERNATE_APPENDER" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_PATH}/hibernate.log</file>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${LOG_PATH}/backup/hibernate.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||||
|
<maxFileSize>100MB</maxFileSize>
|
||||||
|
<maxHistory>7</maxHistory>
|
||||||
|
<totalSizeCap>1GB</totalSizeCap>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder><pattern>${FILE_PATTERN}</pattern></encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="HTTP_SESSION" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_PATH}/http-session.log</file>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${LOG_PATH}/backup/http-session.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||||
|
<maxFileSize>100MB</maxFileSize>
|
||||||
|
<maxHistory>7</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder><pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level - %msg%n</pattern></encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="API_TESTER_AUDIT" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_PATH}/apitester-audit.log</file>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${LOG_PATH}/backup/apitester-audit.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||||
|
<maxFileSize>100MB</maxFileSize>
|
||||||
|
<maxHistory>7</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder><pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %msg%n</pattern></encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_PATH}/error.log</file>
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<level>ERROR</level>
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${LOG_PATH}/backup/error.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||||
|
<maxFileSize>100MB</maxFileSize>
|
||||||
|
<maxHistory>7</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder><pattern>${FILE_PATTERN}</pattern></encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 애플리케이션 -->
|
||||||
|
<logger name="com.eactive.apim" level="DEBUG" />
|
||||||
|
<logger name="com.eactive.eai" level="INFO" />
|
||||||
|
|
||||||
|
<!-- 세션 / API 테스터 감사 로그 (logback-spring.xml 과 동일 로거명) -->
|
||||||
|
<logger name="eapim.portal.session" level="INFO" additivity="false">
|
||||||
|
<appender-ref ref="HTTP_SESSION" />
|
||||||
|
</logger>
|
||||||
|
<logger name="eapim.portal.apitester.audit" level="INFO" additivity="false">
|
||||||
|
<appender-ref ref="API_TESTER_AUDIT" />
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<!-- Hibernate SQL + 바인딩 파라미터 → hibernate.log (콘솔 노이즈 방지) -->
|
||||||
|
<logger name="org.hibernate.SQL" level="DEBUG" additivity="false">
|
||||||
|
<appender-ref ref="HIBERNATE_APPENDER" />
|
||||||
|
</logger>
|
||||||
|
<logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE" additivity="false">
|
||||||
|
<appender-ref ref="HIBERNATE_APPENDER" />
|
||||||
|
</logger>
|
||||||
|
<logger name="org.hibernate.engine.jdbc.spi.SqlExceptionHelper" level="DEBUG" additivity="false">
|
||||||
|
<appender-ref ref="HIBERNATE_APPENDER" />
|
||||||
|
<appender-ref ref="ERROR_FILE" />
|
||||||
|
</logger>
|
||||||
|
<logger name="org.springframework.transaction.interceptor" level="DEBUG" additivity="false">
|
||||||
|
<appender-ref ref="HIBERNATE_APPENDER" />
|
||||||
|
</logger>
|
||||||
|
<logger name="org.springframework.orm.jpa.JpaTransactionManager" level="DEBUG" additivity="false">
|
||||||
|
<appender-ref ref="HIBERNATE_APPENDER" />
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<!-- 필요 시 주석 해제 -->
|
||||||
|
<!-- <logger name="org.thymeleaf.templateparser" level="DEBUG" /> -->
|
||||||
|
<!-- <logger name="org.springframework.security" level="DEBUG" /> -->
|
||||||
|
<!-- <logger name="org.springframework.web" level="DEBUG" /> -->
|
||||||
|
|
||||||
|
<root level="INFO">
|
||||||
|
<appender-ref ref="CONSOLE"/>
|
||||||
|
<appender-ref ref="ROLLING"/>
|
||||||
|
<appender-ref ref="ERROR_FILE"/>
|
||||||
|
</root>
|
||||||
|
</configuration>
|
||||||
@@ -21542,6 +21542,54 @@ input[type=checkbox]:checked + .custom-checkbox {
|
|||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.has-field-error .org-form-label,
|
||||||
|
.has-field-error .title .dot {
|
||||||
|
color: #FF6B6B;
|
||||||
|
}
|
||||||
|
.has-field-error input.is-invalid,
|
||||||
|
.has-field-error select.is-invalid {
|
||||||
|
border-color: #FF6B6B;
|
||||||
|
background-color: rgba(255, 107, 107, 0.06);
|
||||||
|
box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.18);
|
||||||
|
}
|
||||||
|
.has-field-error input.is-invalid:focus,
|
||||||
|
.has-field-error select.is-invalid:focus {
|
||||||
|
border-color: #FF6B6B;
|
||||||
|
box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.org-field-error {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 6px;
|
||||||
|
margin-top: 6px;
|
||||||
|
color: #FF6B6B;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 500;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
.org-field-error::before {
|
||||||
|
content: "!";
|
||||||
|
flex-shrink: 0;
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
margin-top: 2px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #FF6B6B;
|
||||||
|
color: #FFFFFF;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 16px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.agreement-item-row.has-field-error .agreement-checkbox-custom {
|
||||||
|
box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.35);
|
||||||
|
}
|
||||||
|
.agreement-item-row.has-field-error .agreement-title {
|
||||||
|
color: #FF6B6B;
|
||||||
|
}
|
||||||
|
|
||||||
.org-loading-overlay {
|
.org-loading-overlay {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -708,6 +708,65 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 제출 검증 실패 항목 강조 — templates/views/apps/register/components/formFieldErrors.html 가 붙인다.
|
||||||
|
// 그룹(.has-field-error) 안에서 '실제로 비어 있거나 틀린 칸'(.is-invalid)만 강하게 표시한다.
|
||||||
|
// 입력 중 토글되는 기존 .is-invalid(주황 테두리)와 구분하려고 그룹 범위로 한정한다.
|
||||||
|
.has-field-error {
|
||||||
|
.org-form-label,
|
||||||
|
.title .dot {
|
||||||
|
color: $accent-orange;
|
||||||
|
}
|
||||||
|
|
||||||
|
input.is-invalid,
|
||||||
|
select.is-invalid {
|
||||||
|
border-color: $accent-orange;
|
||||||
|
background-color: rgba($accent-orange, 0.06);
|
||||||
|
box-shadow: 0 0 0 3px rgba($accent-orange, 0.18);
|
||||||
|
|
||||||
|
&:focus {
|
||||||
|
border-color: $accent-orange;
|
||||||
|
box-shadow: 0 0 0 3px rgba($accent-orange, 0.3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.org-field-error {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 6px;
|
||||||
|
margin-top: 6px;
|
||||||
|
color: $accent-orange;
|
||||||
|
font-size: $font-size-sm;
|
||||||
|
font-weight: 500;
|
||||||
|
line-height: 1.5;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: '!';
|
||||||
|
flex-shrink: 0;
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
margin-top: 2px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: $accent-orange;
|
||||||
|
color: $white;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 16px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 동의 항목 행: 체크박스 외곽 링 + 제목 색
|
||||||
|
.agreement-item-row.has-field-error {
|
||||||
|
.agreement-checkbox-custom {
|
||||||
|
box-shadow: 0 0 0 3px rgba($accent-orange, 0.35);
|
||||||
|
}
|
||||||
|
|
||||||
|
.agreement-title {
|
||||||
|
color: $accent-orange;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Loading Overlay
|
// Loading Overlay
|
||||||
.org-loading-overlay {
|
.org-loading-overlay {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
|
|||||||
@@ -46,6 +46,7 @@
|
|||||||
<option value="016">016</option>
|
<option value="016">016</option>
|
||||||
<option value="017">017</option>
|
<option value="017">017</option>
|
||||||
<option value="018">018</option>
|
<option value="018">018</option>
|
||||||
|
<option value="019">019</option>
|
||||||
</select>
|
</select>
|
||||||
<span class="separator">-</span>
|
<span class="separator">-</span>
|
||||||
<input type="tel" id="phoneMiddle" name="phoneMiddle" maxlength="4" class="form-input phone-number"
|
<input type="tel" id="phoneMiddle" name="phoneMiddle" maxlength="4" class="form-input phone-number"
|
||||||
|
|||||||
@@ -54,6 +54,7 @@
|
|||||||
<option value="016">016</option>
|
<option value="016">016</option>
|
||||||
<option value="017">017</option>
|
<option value="017">017</option>
|
||||||
<option value="018">018</option>
|
<option value="018">018</option>
|
||||||
|
<option value="019">019</option>
|
||||||
</select>
|
</select>
|
||||||
<span class="separator">-</span>
|
<span class="separator">-</span>
|
||||||
<input type="tel" id="phoneMiddle" name="phoneMiddle" maxlength="4" class="form-input phone-number"
|
<input type="tel" id="phoneMiddle" name="phoneMiddle" maxlength="4" class="form-input phone-number"
|
||||||
|
|||||||
@@ -91,43 +91,30 @@
|
|||||||
</script>
|
</script>
|
||||||
<script th:replace="~{apps/register/userAgreementContent :: agreementScript}"></script>
|
<script th:replace="~{apps/register/userAgreementContent :: agreementScript}"></script>
|
||||||
<script th:replace="~{apps/register/components/orgBasicInfoForm :: orgInfoScript}"></script>
|
<script th:replace="~{apps/register/components/orgBasicInfoForm :: orgInfoScript}"></script>
|
||||||
|
<script th:replace="~{apps/register/components/formFieldErrors :: formFieldErrorsScript}"></script>
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
document.addEventListener('DOMContentLoaded', function () {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
const form = document.getElementById('businessTransferForm');
|
const form = document.getElementById('businessTransferForm');
|
||||||
let isAuthVerified = false;
|
// 미입력/미충족 항목을 화면 순서대로 모아 강조·안내한다 (FormFieldErrors)
|
||||||
|
|
||||||
// 기존의 공통 유효성 검사 함수
|
|
||||||
function validateCommonFields() {
|
function validateCommonFields() {
|
||||||
|
const errors = [];
|
||||||
|
|
||||||
if(!validatePhoneNumber('org') || !validatePhoneNumber('sc')) {
|
[
|
||||||
|
['termsOfUse', '이용약관에 동의해주세요.'],
|
||||||
|
['privacyCollect', '개인정보 수집 및 이용동의서(법인 회원용)에 동의해주세요.']
|
||||||
|
].forEach(function (item) {
|
||||||
|
const checkbox = document.getElementById(item[0]);
|
||||||
|
if (!checkbox || !checkbox.checked) {
|
||||||
|
errors.push({ message: item[1], fields: checkbox });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
errors.push.apply(errors, collectOrgBasicInfoErrors());
|
||||||
|
|
||||||
|
if (errors.length > 0) {
|
||||||
|
window.FormFieldErrors.report(errors);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const validations = {
|
|
||||||
termsOfUse: $('#termsOfUse').prop('checked'),
|
|
||||||
privacyPolicy: $('#privacyCollect').prop('checked'),
|
|
||||||
compRegNo: $('#compRegNo').val().trim() !== '',
|
|
||||||
corpRegNo: $('#corpRegNo').val().trim() !== '',
|
|
||||||
orgName: $('#orgName').val().trim() !== '',
|
|
||||||
compRegFile: $('#compRegFile').val().trim() !== ''
|
|
||||||
};
|
|
||||||
|
|
||||||
const messages = {
|
|
||||||
termsOfUse: '이용약관에 동의해주세요.',
|
|
||||||
privacyPolicy: '개인정보 수집 및 이용동의서(법인 회원용)에 동의해주세요.',
|
|
||||||
compRegNo: '사업자등록번호를 입력해주세요.',
|
|
||||||
corpRegNo: '법인등록번호를 입력해주세요.',
|
|
||||||
orgName: '법인명을 입력해주세요.',
|
|
||||||
compRegFile: '사업자등록증을 업로드해주세요.'
|
|
||||||
};
|
|
||||||
|
|
||||||
for (const [field, isValid] of Object.entries(validations)) {
|
|
||||||
if (!isValid) {
|
|
||||||
customPopups.showAlert(messages[field]);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,6 +124,7 @@
|
|||||||
console.log('제출 버튼 클릭');
|
console.log('제출 버튼 클릭');
|
||||||
|
|
||||||
// 공통 유효성 검사
|
// 공통 유효성 검사
|
||||||
|
window.FormFieldErrors.clearAll();
|
||||||
if (!validateCommonFields()) {
|
if (!validateCommonFields()) {
|
||||||
console.log('유효성 검사 실패');
|
console.log('유효성 검사 실패');
|
||||||
return;
|
return;
|
||||||
@@ -180,11 +168,6 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// 인증 완료 이벤트 리스너
|
|
||||||
document.addEventListener('authVerified', function () {
|
|
||||||
isAuthVerified = true;
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</th:block>
|
</th:block>
|
||||||
|
|||||||
@@ -0,0 +1,136 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns:th="http://www.thymeleaf.org">
|
||||||
|
<body>
|
||||||
|
<th:block>
|
||||||
|
<script th:fragment="formFieldErrorsScript">
|
||||||
|
/**
|
||||||
|
* 가입/전환 폼 제출 검증 실패 항목 강조.
|
||||||
|
*
|
||||||
|
* report(errors) 는 항목별로 입력칸을 강조(그룹 라벨·입력 테두리·그룹 안 안내문구)하고 목록 팝업을 띄운다.
|
||||||
|
* 팝업을 닫으면 첫 항목으로 스크롤·포커스한다. 강조는 그 그룹에 입력/변경이 생기면 그룹 단위로 해제된다.
|
||||||
|
*
|
||||||
|
* errors: [{ message: string, fields: Element | id문자열 | 그 배열 }]
|
||||||
|
* fields 는 '실제로 비어 있거나 틀린 칸'만 넘긴다 (예: 전화번호 3칸 중 빈 칸만).
|
||||||
|
*/
|
||||||
|
window.FormFieldErrors = (function () {
|
||||||
|
const GROUP_SELECTOR = '.org-form-group, .agreement-item-row, .info1';
|
||||||
|
const GROUP_ERROR_CLASS = 'has-field-error';
|
||||||
|
const MESSAGE_CLASS = 'org-field-error';
|
||||||
|
|
||||||
|
function toElements(fields) {
|
||||||
|
return [].concat(fields || [])
|
||||||
|
.map(function (f) { return typeof f === 'string' ? document.getElementById(f) : f; })
|
||||||
|
.filter(Boolean);
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearGroup(group) {
|
||||||
|
group.classList.remove(GROUP_ERROR_CLASS);
|
||||||
|
group.querySelectorAll('[data-field-error]').forEach(function (el) {
|
||||||
|
// 화면 스크립트가 원래 붙여 둔 is-invalid 는 남긴다
|
||||||
|
if (el.getAttribute('data-field-error') === 'added') {
|
||||||
|
el.classList.remove('is-invalid');
|
||||||
|
}
|
||||||
|
el.removeAttribute('data-field-error');
|
||||||
|
el.removeAttribute('aria-invalid');
|
||||||
|
});
|
||||||
|
group.querySelectorAll('.' + MESSAGE_CLASS).forEach(function (el) { el.remove(); });
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearAll() {
|
||||||
|
document.querySelectorAll('.' + GROUP_ERROR_CLASS).forEach(clearGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
function mark(error) {
|
||||||
|
const fields = toElements(error.fields);
|
||||||
|
const groups = [];
|
||||||
|
fields.forEach(function (el) {
|
||||||
|
if (!el.hasAttribute('data-field-error')) {
|
||||||
|
el.setAttribute('data-field-error', el.classList.contains('is-invalid') ? 'kept' : 'added');
|
||||||
|
}
|
||||||
|
el.classList.add('is-invalid');
|
||||||
|
el.setAttribute('aria-invalid', 'true');
|
||||||
|
const group = el.closest(GROUP_SELECTOR);
|
||||||
|
if (group && groups.indexOf(group) === -1) {
|
||||||
|
groups.push(group);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
groups.forEach(function (group) {
|
||||||
|
group.classList.add(GROUP_ERROR_CLASS);
|
||||||
|
// 동의 항목 행은 높이가 고정이라 문구 없이 강조만 한다
|
||||||
|
if (group.classList.contains('agreement-item-row')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const container = group.querySelector('.org-form-input-wrapper') || group;
|
||||||
|
const message = document.createElement('div');
|
||||||
|
message.className = MESSAGE_CLASS;
|
||||||
|
message.setAttribute('role', 'alert');
|
||||||
|
message.textContent = error.message;
|
||||||
|
container.appendChild(message);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function isFocusable(el) {
|
||||||
|
return !el.disabled && !el.readOnly && el.type !== 'hidden' && el.offsetParent !== null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function focusFirst(errors) {
|
||||||
|
for (let i = 0; i < errors.length; i++) {
|
||||||
|
const fields = toElements(errors[i].fields);
|
||||||
|
if (fields.length === 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const target = fields.filter(isFocusable)[0];
|
||||||
|
const group = fields[0].closest(GROUP_SELECTOR) || fields[0];
|
||||||
|
group.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||||
|
if (target) {
|
||||||
|
target.focus({ preventScroll: true });
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function report(errors) {
|
||||||
|
clearAll();
|
||||||
|
errors.forEach(mark);
|
||||||
|
const list = errors.map(function (e) { return '• ' + e.message; }).join('<br>');
|
||||||
|
customPopups.showAlert('아래 항목을 확인해주세요.<br><br>' + list, function () {
|
||||||
|
focusFirst(errors);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function onEdit(event) {
|
||||||
|
const target = event.target;
|
||||||
|
const group = target && target.closest ? target.closest('.' + GROUP_ERROR_CLASS) : null;
|
||||||
|
if (group) {
|
||||||
|
clearGroup(group);
|
||||||
|
}
|
||||||
|
// '전체동의' 는 개별 체크박스를 코드로 바꿔 change 이벤트가 없다 → 체크된 행을 직접 해제
|
||||||
|
document.querySelectorAll('.agreement-item-row.' + GROUP_ERROR_CLASS).forEach(function (row) {
|
||||||
|
const checkbox = row.querySelector('input[type="checkbox"]');
|
||||||
|
if (checkbox && checkbox.checked) {
|
||||||
|
clearGroup(row);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener('input', onEdit, true);
|
||||||
|
document.addEventListener('change', onEdit, true);
|
||||||
|
|
||||||
|
// 휴대폰 인증 완료는 입력 이벤트 없이 끝날 수 있다(이미 입력된 인증번호로 '확인'만 누른 경우)
|
||||||
|
document.addEventListener('authVerified', function () {
|
||||||
|
['phoneMobile', 'authNumber'].forEach(function (id) {
|
||||||
|
const el = document.getElementById(id);
|
||||||
|
const group = el ? el.closest('.' + GROUP_ERROR_CLASS) : null;
|
||||||
|
if (group) {
|
||||||
|
clearGroup(group);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return { report: report, clearAll: clearAll };
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
</th:block>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -29,9 +29,10 @@
|
|||||||
<option value="">선택</option>
|
<option value="">선택</option>
|
||||||
<option value="010">010</option>
|
<option value="010">010</option>
|
||||||
<option value="011">011</option>
|
<option value="011">011</option>
|
||||||
<option value="017">017</option>
|
|
||||||
<option value="016">016</option>
|
<option value="016">016</option>
|
||||||
|
<option value="017">017</option>
|
||||||
<option value="018">018</option>
|
<option value="018">018</option>
|
||||||
|
<option value="019">019</option>
|
||||||
</select>
|
</select>
|
||||||
<span class="separator">-</span>
|
<span class="separator">-</span>
|
||||||
<input type="text" id="cellPhone1" maxlength="4" class="org-form-input phone-number"
|
<input type="text" id="cellPhone1" maxlength="4" class="org-form-input phone-number"
|
||||||
@@ -383,71 +384,152 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// 비밀번호 검증
|
// ===== 비밀번호 서버 검증 =====
|
||||||
$('#password').on('blur', function () {
|
// 결과는 hidden(#isPasswordValid / #isPasswordMatch)에 'true'/'false' 로 남고 가입 버튼 검증이 이를 읽는다.
|
||||||
let password = $(this).val();
|
// blur 로만 돌리면 비동기(공개키 조회 → 암호화 → ajax)가 끝나기 전에 가입 버튼 검증이 먼저 돌 수 있다
|
||||||
|
// (Tab→Enter, 브라우저 비밀번호 자동완성). 그래서 가입 버튼은 ensurePasswordChecks() 를 기다린 뒤 검증한다.
|
||||||
|
// 요청이 겹치면 마지막 요청의 응답만 반영한다.
|
||||||
|
let passwordCheckSeq = 0;
|
||||||
|
let passwordMatchCheckSeq = 0;
|
||||||
|
|
||||||
|
function postForValidation(url, data) {
|
||||||
|
return new Promise(function (resolve, reject) {
|
||||||
|
$.ajax({
|
||||||
|
url: url,
|
||||||
|
type: 'POST',
|
||||||
|
data: data,
|
||||||
|
success: resolve,
|
||||||
|
error: function () { reject(new Error('비밀번호 검증 요청 실패: ' + url)); }
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function showCheckResult(targetSelector, response) {
|
||||||
|
let targetElement = $(targetSelector);
|
||||||
|
targetElement.removeClass('success error');
|
||||||
|
targetElement.addClass(response.valid ? 'success' : 'error');
|
||||||
|
targetElement.text(response.message);
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkPassword() {
|
||||||
|
const seq = ++passwordCheckSeq;
|
||||||
|
const password = $('#password').val();
|
||||||
if (!password) {
|
if (!password) {
|
||||||
return;
|
$('#isPasswordValid').val('');
|
||||||
|
return Promise.resolve(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 전송암호화. 꺼져 있으면 원본 값이 그대로 돌아온다.
|
// 전송암호화. 꺼져 있으면 원본 값이 그대로 돌아온다.
|
||||||
window.portalPasswordCrypto.encryptValues({ password: password }).then(function (enc) {
|
return window.portalPasswordCrypto.encryptValues({ password: password }).then(function (enc) {
|
||||||
$.ajax({
|
return postForValidation(/*[[@{/check_password}]]*/ '/check_password', {
|
||||||
url: /*[[@{/check_password}]]*/ '/check_password',
|
|
||||||
type: 'POST',
|
|
||||||
data: {
|
|
||||||
password: enc.password,
|
password: enc.password,
|
||||||
mobileNumber: $('#mobileNumber').val(),
|
mobileNumber: $('#mobileNumber').val(),
|
||||||
loginId: $('#loginId').val(),
|
loginId: $('#loginId').val(),
|
||||||
_csrf: $('input[name="_csrf"]').val()
|
_csrf: $('input[name="_csrf"]').val()
|
||||||
},
|
});
|
||||||
success: function (response) {
|
}).then(function (response) {
|
||||||
let targetElement = $('#password-validation');
|
if (seq === passwordCheckSeq) {
|
||||||
targetElement.removeClass('success error');
|
showCheckResult('#password-validation', response);
|
||||||
targetElement.addClass(response.valid ? 'success' : 'error');
|
|
||||||
targetElement.text(response.message);
|
|
||||||
$('#isPasswordValid').val(response.valid);
|
$('#isPasswordValid').val(response.valid);
|
||||||
},
|
|
||||||
error: function () {
|
|
||||||
customPopups.showAlert('처리 중 오류가 발생했습니다. 다시 시도해주세요.');
|
|
||||||
}
|
}
|
||||||
|
return response.valid;
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
});
|
|
||||||
|
|
||||||
// 비밀번호 확인 검증
|
function checkPasswordMatch() {
|
||||||
$('#confirmPassword').on('blur', function () {
|
const seq = ++passwordMatchCheckSeq;
|
||||||
let confirmPassword = $(this).val();
|
const confirmPassword = $('#confirmPassword').val();
|
||||||
if (!confirmPassword) {
|
if (!confirmPassword) {
|
||||||
return;
|
$('#isPasswordMatch').val('');
|
||||||
|
return Promise.resolve(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 두 값이 같은 AES 키로 각각 다른 IV 로 암호화되므로 서버에서 복호화 후 비교해야 한다.
|
// 두 값이 같은 AES 키로 각각 다른 IV 로 암호화되므로 서버에서 복호화 후 비교해야 한다.
|
||||||
window.portalPasswordCrypto.encryptValues({
|
return window.portalPasswordCrypto.encryptValues({
|
||||||
password: $('#password').val(),
|
password: $('#password').val(),
|
||||||
confirmPassword: confirmPassword
|
confirmPassword: confirmPassword
|
||||||
}).then(function (enc) {
|
}).then(function (enc) {
|
||||||
$.ajax({
|
return postForValidation(/*[[@{/check_password_match}]]*/ '/check_password_match', {
|
||||||
url: /*[[@{/check_password_match}]]*/ '/check_password_match',
|
|
||||||
type: 'POST',
|
|
||||||
data: {
|
|
||||||
password: enc.password,
|
password: enc.password,
|
||||||
confirmPassword: enc.confirmPassword,
|
confirmPassword: enc.confirmPassword,
|
||||||
_csrf: $('input[name="_csrf"]').val()
|
_csrf: $('input[name="_csrf"]').val()
|
||||||
},
|
});
|
||||||
success: function (response) {
|
}).then(function (response) {
|
||||||
let targetElement = $('#password-match-validation');
|
if (seq === passwordMatchCheckSeq) {
|
||||||
targetElement.removeClass('success error');
|
showCheckResult('#password-match-validation', response);
|
||||||
targetElement.addClass(response.valid ? 'success' : 'error');
|
|
||||||
targetElement.text(response.message);
|
|
||||||
$('#isPasswordMatch').val(response.valid);
|
$('#isPasswordMatch').val(response.valid);
|
||||||
},
|
|
||||||
error: function () {
|
|
||||||
customPopups.showAlert("처리 중 오류가 발생했습니다. 다시 시도해주세요.");
|
|
||||||
}
|
}
|
||||||
|
return response.valid;
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
|
function alertCheckFailure(error) {
|
||||||
|
console.error(error);
|
||||||
|
customPopups.showAlert('처리 중 오류가 발생했습니다. 다시 시도해주세요.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#password').on('blur', function () {
|
||||||
|
if ($(this).val()) {
|
||||||
|
checkPassword().catch(alertCheckFailure);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#confirmPassword').on('blur', function () {
|
||||||
|
if ($(this).val()) {
|
||||||
|
checkPasswordMatch().catch(alertCheckFailure);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 이 폼 항목의 미입력/미충족 목록 (FormFieldErrors.report 형식, 화면 순서)
|
||||||
|
function collectErrors() {
|
||||||
|
const errors = [];
|
||||||
|
|
||||||
|
if ($('#userName').val().trim() === '') {
|
||||||
|
errors.push({ message: '성명을 입력해주세요.', fields: 'userName' });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isAuthVerified) {
|
||||||
|
const mobileParts = ['phoneMobile', 'cellPhone1', 'cellPhone2'];
|
||||||
|
const emptyParts = mobileParts.filter(function (id) {
|
||||||
|
return document.getElementById(id).value.trim() === '';
|
||||||
|
});
|
||||||
|
const authContainer = document.getElementById('authNumberContainer');
|
||||||
|
const authNumberEl = document.getElementById('authNumber');
|
||||||
|
|
||||||
|
if (emptyParts.length > 0) {
|
||||||
|
errors.push({ message: '휴대폰 번호를 입력하고 인증을 완료해주세요.', fields: emptyParts });
|
||||||
|
} else if (!authContainer || authContainer.style.display === 'none') {
|
||||||
|
errors.push({ message: "'인증번호 받기'로 휴대폰 인증을 진행해주세요.", fields: mobileParts });
|
||||||
|
} else if (authNumberEl.readOnly) {
|
||||||
|
errors.push({ message: '인증 시간이 초과되었습니다. 인증번호를 다시 받아주세요.', fields: mobileParts });
|
||||||
|
} else {
|
||||||
|
errors.push({ message: "인증번호를 입력하고 '인증번호 확인'을 눌러주세요.", fields: 'authNumber' });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$('#password').val()) {
|
||||||
|
errors.push({ message: '비밀번호를 입력해주세요.', fields: 'password' });
|
||||||
|
} else if ($('#isPasswordValid').val() !== 'true') {
|
||||||
|
errors.push({ message: '비밀번호가 조건에 맞지 않습니다. 비밀번호 조건을 확인해주세요.', fields: 'password' });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$('#confirmPassword').val()) {
|
||||||
|
errors.push({ message: '비밀번호 확인을 입력해주세요.', fields: 'confirmPassword' });
|
||||||
|
} else if ($('#isPasswordMatch').val() !== 'true') {
|
||||||
|
errors.push({ message: '비밀번호 확인이 일치하지 않습니다.', fields: 'confirmPassword' });
|
||||||
|
}
|
||||||
|
|
||||||
|
return errors;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.NewUserInfoForm = {
|
||||||
|
// 가입 버튼 검증 직전에 호출: 현재 입력값으로 두 검사를 다시 돌리고 hidden 에 반영될 때까지 기다린다.
|
||||||
|
ensurePasswordChecks: function () {
|
||||||
|
return Promise.all([checkPassword(), checkPasswordMatch()]);
|
||||||
|
},
|
||||||
|
collectErrors: collectErrors,
|
||||||
|
isAuthVerified: function () { return isAuthVerified; }
|
||||||
|
};
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</th:block>
|
</th:block>
|
||||||
|
|||||||
+110
-78
@@ -221,7 +221,7 @@
|
|||||||
<!-- Business Registration Certificate Upload -->
|
<!-- Business Registration Certificate Upload -->
|
||||||
<div class="org-form-group">
|
<div class="org-form-group">
|
||||||
<label class="org-form-label">
|
<label class="org-form-label">
|
||||||
사업자 등록증 <span class="required-badge">필수</span>
|
사업자 등록증
|
||||||
</label>
|
</label>
|
||||||
<div class="org-form-input-wrapper">
|
<div class="org-form-input-wrapper">
|
||||||
<div class="org-file-upload">
|
<div class="org-file-upload">
|
||||||
@@ -260,18 +260,46 @@
|
|||||||
<th:block layout:fragment="contentScript">
|
<th:block layout:fragment="contentScript">
|
||||||
<script th:fragment="orgInfoScript">
|
<script th:fragment="orgInfoScript">
|
||||||
|
|
||||||
function validatePhoneNumber(prefix) {
|
// 선택 입력 전화번호: 일부만 입력된 경우에만 오류. 비어 있는 칸만 fields 로 돌려준다.
|
||||||
const areaCode = document.getElementById(`${prefix}AreaCode`).value;
|
function getPhoneNumberError(prefix) {
|
||||||
const part1 = document.getElementById(`${prefix}PhoneNumber1`).value.trim();
|
const parts = [`${prefix}AreaCode`, `${prefix}PhoneNumber1`, `${prefix}PhoneNumber2`]
|
||||||
const part2 = document.getElementById(`${prefix}PhoneNumber2`).value.trim();
|
.map(id => document.getElementById(id));
|
||||||
|
const filled = parts.map(el => el.value.trim() !== '');
|
||||||
// 전화번호는 선택 입력이므로, 일부만 입력된 경우에만 검증
|
if (filled.every(v => !v) || filled.every(v => v)) {
|
||||||
const hasAnyInput = areaCode || part1 || part2;
|
return null;
|
||||||
if (hasAnyInput && (!areaCode || areaCode === '' || !part1 || !part2)) {
|
|
||||||
customPopups.showAlert(`${prefix === 'org' ? '회사' : '고객센터'} 전화번호를 모두 입력해주세요.`);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
return true;
|
let message = `${prefix === 'org' ? '회사' : '고객센터'} 전화번호를 모두 입력해주세요.`;
|
||||||
|
if (!filled[0]) {
|
||||||
|
message += " (지역번호가 없는 번호는 '국번없음'을 선택)";
|
||||||
|
}
|
||||||
|
return { message: message, fields: parts.filter((el, i) => !filled[i]) };
|
||||||
|
}
|
||||||
|
|
||||||
|
// 분할 입력 번호(사업자/법인등록번호): 자릿수가 모자란 칸, 또는 서버 검증(형식·중복) 실패 문구
|
||||||
|
function getSplitNumberError(prefix, lengths, emptyMessage) {
|
||||||
|
const parts = lengths.map((len, i) => document.getElementById(`${prefix}${i + 1}`));
|
||||||
|
const shortParts = parts.filter((el, i) => el.value.length !== lengths[i]);
|
||||||
|
if (shortParts.length > 0 || document.getElementById(prefix).value.trim() === '') {
|
||||||
|
return { message: emptyMessage, fields: shortParts.length > 0 ? shortParts : parts };
|
||||||
|
}
|
||||||
|
const validationDiv = document.getElementById(`${prefix}-validation`);
|
||||||
|
if (validationDiv && validationDiv.classList.contains('error')) {
|
||||||
|
return { message: validationDiv.textContent.trim() || emptyMessage, fields: parts };
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 법인 기본 정보 영역의 미입력/미충족 목록 (FormFieldErrors.report 형식, 화면 순서)
|
||||||
|
function collectOrgBasicInfoErrors() {
|
||||||
|
const errors = [
|
||||||
|
getSplitNumberError('compRegNo', [3, 2, 5], '사업자등록번호를 입력해주세요.'),
|
||||||
|
getSplitNumberError('corpRegNo', [6, 7], '법인등록번호를 입력해주세요.')
|
||||||
|
];
|
||||||
|
if (document.getElementById('orgName').value.trim() === '') {
|
||||||
|
errors.push({ message: '법인명을 입력해주세요.', fields: 'orgName' });
|
||||||
|
}
|
||||||
|
errors.push(getPhoneNumberError('org'), getPhoneNumberError('sc'));
|
||||||
|
return errors.filter(Boolean);
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
@@ -288,41 +316,50 @@
|
|||||||
fullValue += parts[i].value;
|
fullValue += parts[i].value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isValid) {
|
if (!isValid) {
|
||||||
document.getElementById(hiddenInputId).value = fullValue;
|
// 다 입력했다가 지운 경우 이전 값·검증 결과가 남아 그대로 제출되지 않도록 비운다
|
||||||
|
document.getElementById(hiddenInputId).value = '';
|
||||||
// CSRF 토큰을 정확하게 가져오기
|
const validationDiv = document.getElementById(hiddenInputId + '-validation');
|
||||||
const csrfToken = document.querySelector('input[name="_csrf"]')?.value ||
|
if (validationDiv) {
|
||||||
document.querySelector('meta[name="_csrf"]')?.content;
|
validationDiv.className = 'org-validation-message';
|
||||||
|
validationDiv.textContent = '';
|
||||||
// AJAX로 검증 요청
|
}
|
||||||
$.ajax({
|
return;
|
||||||
url: url,
|
|
||||||
type: 'POST',
|
|
||||||
data: {
|
|
||||||
[paramName]: fullValue,
|
|
||||||
_csrf: csrfToken
|
|
||||||
},
|
|
||||||
headers: {
|
|
||||||
'X-Custom-Handler': 'registration-validation'
|
|
||||||
},
|
|
||||||
success: function(response) {
|
|
||||||
const validationDiv = document.getElementById(hiddenInputId + '-validation');
|
|
||||||
if (validationDiv) {
|
|
||||||
if (response.valid) {
|
|
||||||
validationDiv.className = 'org-validation-message success';
|
|
||||||
validationDiv.textContent = response.message || '유효한 번호입니다.';
|
|
||||||
} else {
|
|
||||||
validationDiv.className = 'org-validation-message error';
|
|
||||||
validationDiv.textContent = response.message || '유효하지 않은 번호입니다.';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function() {
|
|
||||||
console.error('Validation request failed');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
document.getElementById(hiddenInputId).value = fullValue;
|
||||||
|
|
||||||
|
// CSRF 토큰을 정확하게 가져오기
|
||||||
|
const csrfToken = document.querySelector('input[name="_csrf"]')?.value ||
|
||||||
|
document.querySelector('meta[name="_csrf"]')?.content;
|
||||||
|
|
||||||
|
// AJAX로 검증 요청
|
||||||
|
$.ajax({
|
||||||
|
url: url,
|
||||||
|
type: 'POST',
|
||||||
|
data: {
|
||||||
|
[paramName]: fullValue,
|
||||||
|
_csrf: csrfToken
|
||||||
|
},
|
||||||
|
headers: {
|
||||||
|
'X-Custom-Handler': 'registration-validation'
|
||||||
|
},
|
||||||
|
success: function(response) {
|
||||||
|
const validationDiv = document.getElementById(hiddenInputId + '-validation');
|
||||||
|
if (validationDiv) {
|
||||||
|
if (response.valid) {
|
||||||
|
validationDiv.className = 'org-validation-message success';
|
||||||
|
validationDiv.textContent = response.message || '유효한 번호입니다.';
|
||||||
|
} else {
|
||||||
|
validationDiv.className = 'org-validation-message error';
|
||||||
|
validationDiv.textContent = response.message || '유효하지 않은 번호입니다.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function() {
|
||||||
|
console.error('Validation request failed');
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkBusinessNumber() {
|
function checkBusinessNumber() {
|
||||||
@@ -348,39 +385,38 @@
|
|||||||
const compRegFileInput = document.getElementById('compRegFile');
|
const compRegFileInput = document.getElementById('compRegFile');
|
||||||
const fileRemoveBtn = document.getElementById('fileRemoveBtn');
|
const fileRemoveBtn = document.getElementById('fileRemoveBtn');
|
||||||
|
|
||||||
fileInput.addEventListener('change', function() {
|
// 화면 표시(파일명)와 실제 전송 대상(fileInput.files)을 항상 같이 비운다
|
||||||
const files = fileInput.files;
|
function resetFileSelection() {
|
||||||
if (files.length > 0) {
|
|
||||||
// FileValidator를 사용한 파일 검증
|
|
||||||
if (!FileValidator.validateFiles(files)) {
|
|
||||||
fileInput.value = '';
|
|
||||||
fileNameInput.value = '';
|
|
||||||
fileNameInput.classList.remove('i_trash', 'after');
|
|
||||||
fileNameInput.classList.add('before');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let fileNames = [];
|
|
||||||
for (let i = 0; i < files.length; i++) {
|
|
||||||
fileNames.push(files[i].name);
|
|
||||||
}
|
|
||||||
|
|
||||||
fileNameDisplay.value = fileNames.join(', ');
|
|
||||||
fileNameDisplay.classList.add('has-file');
|
|
||||||
compRegFileInput.value = fileNames.join(', '); // hidden input에 파일 이름들 설정
|
|
||||||
fileRemoveBtn.style.display = 'block';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// File remove button
|
|
||||||
fileRemoveBtn.addEventListener('click', function() {
|
|
||||||
fileInput.value = '';
|
fileInput.value = '';
|
||||||
fileNameDisplay.value = '';
|
fileNameDisplay.value = '';
|
||||||
compRegFileInput.value = '';
|
compRegFileInput.value = '';
|
||||||
fileNameDisplay.classList.remove('has-file');
|
fileNameDisplay.classList.remove('has-file');
|
||||||
fileRemoveBtn.style.display = 'none';
|
fileRemoveBtn.style.display = 'none';
|
||||||
|
}
|
||||||
|
|
||||||
|
fileInput.addEventListener('change', function() {
|
||||||
|
const files = fileInput.files;
|
||||||
|
// 파일 선택창 '취소'(Chrome 은 기존 선택을 비움) 또는 검증 실패 시 이전 파일명이 남아
|
||||||
|
// 첨부된 것처럼 보이지 않게 한다 — 사업자등록증은 선택이라 그대로 첨부 없이 가입된다
|
||||||
|
if (files.length === 0 || !FileValidator.validateFiles(files)) {
|
||||||
|
resetFileSelection();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let fileNames = [];
|
||||||
|
for (let i = 0; i < files.length; i++) {
|
||||||
|
fileNames.push(files[i].name);
|
||||||
|
}
|
||||||
|
|
||||||
|
fileNameDisplay.value = fileNames.join(', ');
|
||||||
|
fileNameDisplay.classList.add('has-file');
|
||||||
|
compRegFileInput.value = fileNames.join(', '); // hidden input에 파일 이름들 설정
|
||||||
|
fileRemoveBtn.style.display = 'block';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// File remove button
|
||||||
|
fileRemoveBtn.addEventListener('click', resetFileSelection);
|
||||||
|
|
||||||
function addListeners() {
|
function addListeners() {
|
||||||
document.getElementById('compRegNo1').addEventListener('input', checkBusinessNumber);
|
document.getElementById('compRegNo1').addEventListener('input', checkBusinessNumber);
|
||||||
document.getElementById('compRegNo2').addEventListener('input', checkBusinessNumber);
|
document.getElementById('compRegNo2').addEventListener('input', checkBusinessNumber);
|
||||||
@@ -395,14 +431,10 @@
|
|||||||
const part1 = document.getElementById(`${prefix}PhoneNumber1`).value;
|
const part1 = document.getElementById(`${prefix}PhoneNumber1`).value;
|
||||||
const part2 = document.getElementById(`${prefix}PhoneNumber2`).value;
|
const part2 = document.getElementById(`${prefix}PhoneNumber2`).value;
|
||||||
|
|
||||||
if (!areaCode || areaCode === '' || !part1 || !part2) return;
|
// hidden input에 하이픈이 포함된 값 설정 (일부 칸이 비면 비운다 — 이전 번호가 남아 제출되지 않도록)
|
||||||
|
|
||||||
const fullNumber = `${areaCode}-${part1}-${part2}`;
|
|
||||||
|
|
||||||
// hidden input에 하이픈이 포함된 값 설정
|
|
||||||
const hiddenInput = document.getElementById(`${prefix}PhoneNumber`);
|
const hiddenInput = document.getElementById(`${prefix}PhoneNumber`);
|
||||||
if (hiddenInput) {
|
if (hiddenInput) {
|
||||||
hiddenInput.value = fullNumber;
|
hiddenInput.value = (areaCode && part1 && part2) ? `${areaCode}-${part1}-${part2}` : '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -103,12 +103,10 @@
|
|||||||
<script th:replace="~{apps/register/components/orgUserInfoForm :: orgUserInfoScript}"></script>
|
<script th:replace="~{apps/register/components/orgUserInfoForm :: orgUserInfoScript}"></script>
|
||||||
<script th:replace="~{apps/register/components/emailChangeForm :: emailChangeScript}"></script>
|
<script th:replace="~{apps/register/components/emailChangeForm :: emailChangeScript}"></script>
|
||||||
<script th:replace="~{apps/register/components/newUserInfoForm :: newUserScript}"></script>
|
<script th:replace="~{apps/register/components/newUserInfoForm :: newUserScript}"></script>
|
||||||
|
<script th:replace="~{apps/register/components/formFieldErrors :: formFieldErrorsScript}"></script>
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
document.addEventListener('DOMContentLoaded', function () {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
let form = document.getElementById('registerForm');
|
|
||||||
let agreementForm = document.getElementById('agreementForm');
|
|
||||||
let btn_register = document.querySelector('.btn_register');
|
let btn_register = document.querySelector('.btn_register');
|
||||||
let isAuthVerified = false;
|
|
||||||
|
|
||||||
// registrationScenario를 hidden input에서 가져오도록 수정
|
// registrationScenario를 hidden input에서 가져오도록 수정
|
||||||
let registrationScenario = document.getElementById('registrationScenario')?.value || 'new';
|
let registrationScenario = document.getElementById('registrationScenario')?.value || 'new';
|
||||||
@@ -133,23 +131,15 @@
|
|||||||
observer.observe(scenarioInput, { attributes: true });
|
observer.observe(scenarioInput, { attributes: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
// 시나리오별 필수 필드 정의
|
// 시나리오별 제출 대상 user 필드 (필수 여부 검증은 collectFormErrors 가 한다)
|
||||||
const requiredFieldsByScenario = {
|
const submitUserFieldsByScenario = {
|
||||||
new: {
|
new: ['loginId', 'userName', 'password', 'confirmPassword', 'mobileNumber', 'authNumber'],
|
||||||
user: ['loginId', 'userName', 'password', 'confirmPassword', 'mobileNumber', 'authNumber'],
|
retain: ['loginId', 'passwordConfirmIndividual'],
|
||||||
org: ['compRegNo', 'corpRegNo', 'orgName', 'compRegFile', 'files']
|
change: ['loginId', 'passwordConfirmEmailChange', 'newLoginId']
|
||||||
},
|
|
||||||
retain: {
|
|
||||||
user: ['loginId', 'passwordConfirmIndividual'],
|
|
||||||
org: ['compRegNo', 'corpRegNo', 'orgName', 'compRegFile', 'files']
|
|
||||||
},
|
|
||||||
change: {
|
|
||||||
user: ['loginId', 'passwordConfirmEmailChange', 'newLoginId'],
|
|
||||||
org: ['compRegNo', 'corpRegNo', 'orgName', 'compRegFile', 'files']
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 제출 대상 org 필드 (검증 필수목록과 별개 - 선택입력 포함 전 필드 전송)
|
// 제출 대상 org 필드 (검증 필수목록과 별개 - 선택입력 포함 전 필드 전송)
|
||||||
|
// 사업자등록증(compRegFile, files)은 선택 첨부 — 파일을 고른 경우에만 files 가 전송된다
|
||||||
// 제외: ipWhitelist(가입 미입력), orgCode(관리자/시스템 부여)
|
// 제외: ipWhitelist(가입 미입력), orgCode(관리자/시스템 부여)
|
||||||
const submitOrgFields = [
|
const submitOrgFields = [
|
||||||
'compRegNo', 'corpRegNo', 'orgName', 'compRegFile', 'files',
|
'compRegNo', 'corpRegNo', 'orgName', 'compRegFile', 'files',
|
||||||
@@ -170,9 +160,9 @@
|
|||||||
form.action = '/signup/portalOrg';
|
form.action = '/signup/portalOrg';
|
||||||
form.style.display = 'none';
|
form.style.display = 'none';
|
||||||
|
|
||||||
const fields = requiredFieldsByScenario[registrationScenario];
|
const userFields = submitUserFieldsByScenario[registrationScenario];
|
||||||
|
|
||||||
if (!fields) {
|
if (!userFields) {
|
||||||
console.error('Unknown scenario');
|
console.error('Unknown scenario');
|
||||||
return form;
|
return form;
|
||||||
}
|
}
|
||||||
@@ -194,7 +184,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// user와 org 필드를 따로 처리
|
// user와 org 필드를 따로 처리
|
||||||
fields.user.forEach(fieldId => {
|
userFields.forEach(fieldId => {
|
||||||
const element = document.getElementById(fieldId);
|
const element = document.getElementById(fieldId);
|
||||||
if (element) {
|
if (element) {
|
||||||
const input = document.createElement('input');
|
const input = document.createElement('input');
|
||||||
@@ -300,148 +290,82 @@
|
|||||||
return form;
|
return form;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 시나리오별 유효성 검사
|
// 기존 계정 비밀번호 확인 (retain/change 시나리오)
|
||||||
function validateFormByScenario() {
|
function getExistingPasswordError(fieldId) {
|
||||||
|
const value = document.getElementById(fieldId)?.value || '';
|
||||||
|
if (value === '') {
|
||||||
|
return { message: '기존 계정의 비밀번호를 입력해주세요.', fields: fieldId };
|
||||||
|
}
|
||||||
|
if (value.length < 8) {
|
||||||
|
return { message: '기존 계정의 비밀번호를 정확히 입력해주세요.', fields: fieldId };
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const currentScenario = document.getElementById('registrationScenario')?.value || 'new';
|
// 미입력/미충족 항목을 화면 순서대로 수집 (FormFieldErrors.report 형식).
|
||||||
console.log('Registration Scenario:', currentScenario);
|
// 제출 가능 여부도 이 목록 하나로 판단한다 — 판단 로직과 안내 목록이 따로 놀면
|
||||||
|
// '막혔는데 무엇이 문제인지 안 나오는' 안내가 생긴다.
|
||||||
|
function collectFormErrors() {
|
||||||
|
const errors = [];
|
||||||
|
|
||||||
if (!currentScenario) {
|
// 약관 (사용하지 않도록 설정한 약관은 화면에 없으므로 통과 — 관리 콘솔 > 약관 종류 관리)
|
||||||
console.log('Unknown scenario');
|
[
|
||||||
return false;
|
['termsOfUse', '이용약관에 동의해주세요.'],
|
||||||
|
['privacyCollect', '개인정보 수집·이용에 동의해주세요.'],
|
||||||
|
['notificationConsent', '알림 수신에 동의해주세요.']
|
||||||
|
].forEach(function (item) {
|
||||||
|
const checkbox = document.getElementById(item[0]);
|
||||||
|
if (checkbox && !checkbox.checked) {
|
||||||
|
errors.push({ message: item[1], fields: checkbox });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 법인 기본 정보
|
||||||
|
errors.push.apply(errors, collectOrgBasicInfoErrors());
|
||||||
|
|
||||||
|
// 법인 관리자 정보 — 이메일 중복체크를 통과해야 시나리오별 입력칸이 열린다
|
||||||
|
const loginId = document.getElementById('loginId').value;
|
||||||
|
if (!document.getElementById('userId').disabled) {
|
||||||
|
errors.push({
|
||||||
|
message: isValidEmail(loginId)
|
||||||
|
? '이메일 아이디 중복체크를 해주세요.'
|
||||||
|
: '이메일 아이디를 입력하고 중복체크를 해주세요.',
|
||||||
|
fields: ['userId', 'domain']
|
||||||
|
});
|
||||||
|
return errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (registrationScenario) {
|
switch (registrationScenario) {
|
||||||
case 'new':
|
case 'new':
|
||||||
const loginIdElement = document.getElementById('loginId');
|
errors.push.apply(errors, window.NewUserInfoForm.collectErrors());
|
||||||
const userNameElement = document.getElementById('userName');
|
break;
|
||||||
|
|
||||||
const isEmailValid = loginIdElement ? isValidEmail(loginIdElement.value) : false;
|
|
||||||
const hasUserName = userNameElement ? userNameElement.value.trim() !== '' : false;
|
|
||||||
const isPasswordValid = document.getElementById('isPasswordValid').value.trim() === 'true';
|
|
||||||
const isPasswordMatch = document.getElementById('isPasswordMatch').value.trim() === 'true';
|
|
||||||
|
|
||||||
console.log('New User Validation:', {
|
|
||||||
email: loginIdElement?.value,
|
|
||||||
isEmailValid,
|
|
||||||
isPasswordValid,
|
|
||||||
isPasswordMatch,
|
|
||||||
userName: userNameElement?.value,
|
|
||||||
hasUserName,
|
|
||||||
isAuthVerified,
|
|
||||||
requiredFields: currentScenario
|
|
||||||
});
|
|
||||||
return isEmailValid && isPasswordValid && isPasswordMatch && hasUserName && isAuthVerified;
|
|
||||||
|
|
||||||
case 'retain':
|
case 'retain':
|
||||||
const passwordConfirmElement = document.getElementById('passwordConfirmIndividual');
|
errors.push(getExistingPasswordError('passwordConfirmIndividual'));
|
||||||
const hasPassword = passwordConfirmElement ? passwordConfirmElement.value.length >= 8 : false;
|
break;
|
||||||
const retainLoginIdElement = document.getElementById('loginId');
|
|
||||||
|
|
||||||
console.log('Retain User Validation:', {
|
|
||||||
email: retainLoginIdElement?.value,
|
|
||||||
isEmailValid: retainLoginIdElement ? isValidEmail(retainLoginIdElement.value) : false,
|
|
||||||
passwordLength: passwordConfirmElement?.value.length,
|
|
||||||
hasPassword,
|
|
||||||
requiredFields: currentScenario
|
|
||||||
});
|
|
||||||
return retainLoginIdElement && isValidEmail(retainLoginIdElement.value) && hasPassword;
|
|
||||||
|
|
||||||
case 'change':
|
case 'change':
|
||||||
const changeLoginIdElement = document.getElementById('loginId');
|
errors.push(getExistingPasswordError('passwordConfirmEmailChange'));
|
||||||
const newLoginIdElement = document.getElementById('newLoginId');
|
if (!isValidEmail(document.getElementById('newLoginId')?.value || '')) {
|
||||||
const changePasswordElement = document.getElementById('passwordConfirmEmailChange');
|
errors.push({ message: '신규 이메일 아이디를 입력해주세요.', fields: ['newUserId', 'newDomain'] });
|
||||||
const hasChangePassword = changePasswordElement ? changePasswordElement.value.length >= 8 : false;
|
}
|
||||||
|
break;
|
||||||
console.log('Change Email Validation:', {
|
|
||||||
currentEmail: changeLoginIdElement?.value,
|
|
||||||
newEmail: newLoginIdElement?.value,
|
|
||||||
hasPassword: hasChangePassword,
|
|
||||||
requiredFields: currentScenario
|
|
||||||
});
|
|
||||||
return changeLoginIdElement && newLoginIdElement &&
|
|
||||||
isValidEmail(changeLoginIdElement.value) &&
|
|
||||||
hasChangePassword &&
|
|
||||||
isValidEmail(newLoginIdElement.value);
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
console.log('Unknown scenario');
|
errors.push({ message: '가입 유형을 확인할 수 없습니다. 페이지를 새로고침 후 다시 시도해주세요.', fields: [] });
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 공통 필드 유효성 검사
|
|
||||||
function validateCommonFields() {
|
|
||||||
|
|
||||||
if (!validatePhoneNumber('org') || !validatePhoneNumber('sc')) {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 사용하지 않도록 설정한 약관은 화면에 없으므로(관리 콘솔 > 약관 종류 관리) 없으면 통과 처리
|
return errors.filter(Boolean);
|
||||||
const termsOfUseEl = document.getElementById('termsOfUse');
|
|
||||||
const privacyCollectEl = document.getElementById('privacyCollect');
|
|
||||||
const notificationConsentEl = document.getElementById('notificationConsent');
|
|
||||||
const validations = {
|
|
||||||
termsOfUse: !termsOfUseEl || termsOfUseEl.checked,
|
|
||||||
privacyPolicy: !privacyCollectEl || privacyCollectEl.checked,
|
|
||||||
notificationConsent: !notificationConsentEl || notificationConsentEl.checked,
|
|
||||||
compRegNo: $('#compRegNo').val().trim() !== '',
|
|
||||||
corpRegNo: $('#corpRegNo').val().trim() !== '',
|
|
||||||
orgName: $('#orgName').val().trim() !== '',
|
|
||||||
compRegFile: $('#compRegFile').val().trim() !== ''
|
|
||||||
};
|
|
||||||
|
|
||||||
console.log('Common Fields Validation:', validations);
|
|
||||||
return Object.values(validations).every(value => value === true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 전체 폼 유효성 검사
|
|
||||||
function validateForm() {
|
|
||||||
const scenarioValidation = validateFormByScenario();
|
|
||||||
const commonValidation = validateCommonFields();
|
|
||||||
|
|
||||||
console.log('Form validation result:', {
|
|
||||||
scenarioValidation,
|
|
||||||
commonValidation,
|
|
||||||
registrationScenario
|
|
||||||
});
|
|
||||||
|
|
||||||
return scenarioValidation && commonValidation;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 미입력/미충족 항목을 구체적으로 수집
|
|
||||||
function collectFormErrors() {
|
|
||||||
const errors = [];
|
|
||||||
|
|
||||||
// 시나리오별 항목
|
|
||||||
if (registrationScenario === 'new') {
|
|
||||||
const loginIdElement = document.getElementById('loginId');
|
|
||||||
const userNameElement = document.getElementById('userName');
|
|
||||||
|
|
||||||
if (!(loginIdElement && isValidEmail(loginIdElement.value))) errors.push('이메일 아이디를 올바르게 입력해주세요.');
|
|
||||||
if (!(userNameElement && userNameElement.value.trim() !== '')) errors.push('성명을 입력해주세요.');
|
|
||||||
if (!isAuthVerified) errors.push('휴대폰 인증을 완료해주세요.');
|
|
||||||
if (document.getElementById('isPasswordValid')?.value.trim() !== 'true') errors.push('비밀번호 조건을 확인해주세요.');
|
|
||||||
if (document.getElementById('isPasswordMatch')?.value.trim() !== 'true') errors.push('비밀번호 확인이 일치하지 않습니다.');
|
|
||||||
}
|
|
||||||
|
|
||||||
// 공통 항목
|
|
||||||
const termsOfUseEl = document.getElementById('termsOfUse');
|
|
||||||
const privacyCollectEl = document.getElementById('privacyCollect');
|
|
||||||
const notificationConsentEl = document.getElementById('notificationConsent');
|
|
||||||
if ($('#orgName').val().trim() === '') errors.push('회사명을 입력해주세요.');
|
|
||||||
if ($('#compRegNo').val().trim() === '') errors.push('사업자등록번호를 올바르게 입력해주세요.');
|
|
||||||
if ($('#corpRegNo').val().trim() === '') errors.push('법인등록번호를 올바르게 입력해주세요.');
|
|
||||||
if ($('#compRegFile').val().trim() === '') errors.push('사업자등록증 파일을 첨부해주세요.');
|
|
||||||
if (termsOfUseEl && !termsOfUseEl.checked) errors.push('이용약관에 동의해주세요.');
|
|
||||||
if (privacyCollectEl && !privacyCollectEl.checked) errors.push('개인정보 수집·이용에 동의해주세요.');
|
|
||||||
if (notificationConsentEl && !notificationConsentEl.checked) errors.push('알림 수신에 동의해주세요.');
|
|
||||||
|
|
||||||
return errors;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let isSubmitting = false;
|
let isSubmitting = false;
|
||||||
|
|
||||||
|
function resetSubmitState() {
|
||||||
|
isSubmitting = false;
|
||||||
|
btn_register.disabled = false;
|
||||||
|
document.getElementById('loadingOverlay').classList.remove('active');
|
||||||
|
}
|
||||||
|
|
||||||
// 등록 버튼 클릭 이벤트
|
// 등록 버튼 클릭 이벤트
|
||||||
btn_register.addEventListener('click', function (event) {
|
btn_register.addEventListener('click', function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@@ -449,69 +373,39 @@
|
|||||||
|
|
||||||
// Prevent resubmission
|
// Prevent resubmission
|
||||||
if (isSubmitting) {
|
if (isSubmitting) {
|
||||||
console.log('Form is already being submitted...');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
isSubmitting = true;
|
isSubmitting = true;
|
||||||
btn_register.disabled = true;
|
btn_register.disabled = true;
|
||||||
|
|
||||||
// Show loading overlay
|
|
||||||
document.getElementById('loadingOverlay').classList.add('active');
|
document.getElementById('loadingOverlay').classList.add('active');
|
||||||
|
window.FormFieldErrors.clearAll();
|
||||||
|
|
||||||
try {
|
// 비밀번호 검사는 blur 로 시작된 비동기 요청이 아직 안 끝났을 수 있으므로 현재 값으로 다시 돌리고 기다린다
|
||||||
form.classList.add('was-validated');
|
const passwordChecks = (registrationScenario === 'new' && document.getElementById('userId').disabled)
|
||||||
if (agreementForm) {
|
? window.NewUserInfoForm.ensurePasswordChecks()
|
||||||
agreementForm.classList.add('was-validated');
|
: Promise.resolve();
|
||||||
|
|
||||||
|
passwordChecks.then(function () {
|
||||||
|
const errors = collectFormErrors();
|
||||||
|
if (errors.length > 0) {
|
||||||
|
console.log('Form validation failed:', errors.map(function (e) { return e.message; }));
|
||||||
|
resetSubmitState();
|
||||||
|
window.FormFieldErrors.report(errors);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('Validating form...');
|
const submitForm = collectFormData();
|
||||||
|
document.body.appendChild(submitForm);
|
||||||
if (validateForm()) {
|
// 전송암호화(봉투 치환) 후 제출. 시나리오별로 password 가 없을 수 있으나
|
||||||
console.log('Form validation passed, collecting form data...');
|
// 존재하는 필드만 치환하므로 그대로 호출한다.
|
||||||
const form = collectFormData();
|
return window.portalPasswordCrypto.encryptForm(submitForm, ['password', 'confirmPassword'])
|
||||||
document.body.appendChild(form);
|
.then(function () { submitForm.submit(); });
|
||||||
// 전송암호화(봉투 치환) 후 제출. 시나리오별로 password 가 없을 수 있으나
|
}).catch(function (error) {
|
||||||
// 존재하는 필드만 치환하므로 그대로 호출한다.
|
|
||||||
window.portalPasswordCrypto.encryptForm(form, ['password', 'confirmPassword'])
|
|
||||||
.then(function () { form.submit(); });
|
|
||||||
} else {
|
|
||||||
console.log('Form validation failed');
|
|
||||||
|
|
||||||
// 현재 상태 출력
|
|
||||||
const scenarioValidation = validateFormByScenario();
|
|
||||||
const commonValidation = validateCommonFields();
|
|
||||||
|
|
||||||
const isPasswordValid = document.getElementById('isPasswordValid')?.value.trim() === 'true';
|
|
||||||
const isPasswordMatch = document.getElementById('isPasswordMatch')?.value.trim() === 'true';
|
|
||||||
|
|
||||||
console.log('Validation details:', {
|
|
||||||
scenarioValidation,
|
|
||||||
commonValidation,
|
|
||||||
registrationScenario,
|
|
||||||
isAuthVerified,
|
|
||||||
isPasswordValid,
|
|
||||||
isPasswordMatch
|
|
||||||
});
|
|
||||||
|
|
||||||
const errors = collectFormErrors();
|
|
||||||
let errorMessage = errors.length > 0
|
|
||||||
? '아래 항목을 확인해주세요.<br><br>' + errors.map(e => '• ' + e).join('<br>')
|
|
||||||
: '모든 필수 항목을 입력하고 약관에 동의해주세요.';
|
|
||||||
customPopups.showAlert(errorMessage);
|
|
||||||
|
|
||||||
// Reset submission state since validation failed
|
|
||||||
isSubmitting = false;
|
|
||||||
btn_register.disabled = false;
|
|
||||||
document.getElementById('loadingOverlay').classList.remove('active');
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Form submission error:', error);
|
console.error('Form submission error:', error);
|
||||||
// Reset submission state on error
|
resetSubmitState();
|
||||||
isSubmitting = false;
|
customPopups.showAlert('처리 중 오류가 발생했습니다. 다시 시도해주세요.');
|
||||||
btn_register.disabled = false;
|
});
|
||||||
document.getElementById('loadingOverlay').classList.remove('active');
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// 신규 이메일 중복 체크 응답 처리 함수
|
// 신규 이메일 중복 체크 응답 처리 함수
|
||||||
@@ -523,11 +417,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 인증 완료 이벤트 리스너
|
|
||||||
document.addEventListener('authVerified', function () {
|
|
||||||
isAuthVerified = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
// 취소 버튼 클릭 시
|
// 취소 버튼 클릭 시
|
||||||
document.getElementById('cancelButton').addEventListener('click', function () {
|
document.getElementById('cancelButton').addEventListener('click', function () {
|
||||||
location.href = '/login';
|
location.href = '/login';
|
||||||
|
|||||||
@@ -89,17 +89,12 @@
|
|||||||
<script th:replace="~{apps/register/userAgreementContent :: agreementScript}"></script>
|
<script th:replace="~{apps/register/userAgreementContent :: agreementScript}"></script>
|
||||||
<script th:replace="~{apps/register/components/commonUserInfoForm :: commonUserInfoScript}"></script>
|
<script th:replace="~{apps/register/components/commonUserInfoForm :: commonUserInfoScript}"></script>
|
||||||
<script th:replace="~{apps/register/components/newUserInfoForm :: newUserScript}"></script>
|
<script th:replace="~{apps/register/components/newUserInfoForm :: newUserScript}"></script>
|
||||||
|
<script th:replace="~{apps/register/components/formFieldErrors :: formFieldErrorsScript}"></script>
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
document.addEventListener('DOMContentLoaded', function () {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
let form = document.getElementById('registerForm');
|
let form = document.getElementById('registerForm');
|
||||||
let agreementForm = document.getElementById('agreementForm');
|
let agreementForm = document.getElementById('agreementForm');
|
||||||
let btn_register = document.querySelector('.btn_register');
|
let btn_register = document.querySelector('.btn_register');
|
||||||
let isAuthVerified = false;
|
|
||||||
|
|
||||||
// 인증 완료 이벤트 리스너
|
|
||||||
document.addEventListener('authVerified', function() {
|
|
||||||
isAuthVerified = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
// 이메일 유효성 검사 함수
|
// 이메일 유효성 검사 함수
|
||||||
function isValidEmail(email) {
|
function isValidEmail(email) {
|
||||||
@@ -107,31 +102,86 @@
|
|||||||
return emailRegex.test(email);
|
return emailRegex.test(email);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 폼 유효성 검사 함수
|
// 미입력/미충족 항목을 화면 순서대로 수집 (FormFieldErrors.report 형식).
|
||||||
function checkFormValidity() {
|
// 제출 가능 여부도 이 목록 하나로 판단한다.
|
||||||
const loginIdElement = $('#loginId');
|
function collectFormErrors() {
|
||||||
const userNameElement = $('#userName');
|
const errors = [];
|
||||||
const termsOfUseElement = $('#termsOfUse');
|
|
||||||
const privacyCollectElement = $('#privacyCollect');
|
|
||||||
const notificationConsentElement = $('#notificationConsent');
|
|
||||||
const mobileNumberElement = $('#mobileNumber');
|
|
||||||
const isPasswordValid = $('#isPasswordValid').val() === 'true';
|
|
||||||
const isPasswordMatch = $('#isPasswordMatch').val() === 'true';
|
|
||||||
|
|
||||||
return isValidEmail(loginIdElement.val()) &&
|
// 사용하지 않도록 설정한 약관은 화면에 없으므로(관리 콘솔 > 약관 종류 관리) 없으면 통과 처리
|
||||||
isPasswordValid &&
|
[
|
||||||
isPasswordMatch &&
|
['termsOfUse', '이용약관에 동의해주세요.'],
|
||||||
userNameElement.val().trim() !== '' &&
|
['privacyCollect', '개인정보 수집·이용에 동의해주세요.'],
|
||||||
// 사용하지 않도록 설정한 약관은 화면에 없으므로(관리 콘솔 > 약관 종류 관리) 없으면 통과 처리
|
['notificationConsent', '알림 수신에 동의해주세요.']
|
||||||
(termsOfUseElement.length === 0 || termsOfUseElement.prop('checked')) &&
|
].forEach(function (item) {
|
||||||
(privacyCollectElement.length === 0 || privacyCollectElement.prop('checked')) &&
|
const checkbox = document.getElementById(item[0]);
|
||||||
(notificationConsentElement.length === 0 || notificationConsentElement.prop('checked')) &&
|
if (checkbox && !checkbox.checked) {
|
||||||
mobileNumberElement.val().trim() !== '' &&
|
errors.push({ message: item[1], fields: checkbox });
|
||||||
isAuthVerified;
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!isValidEmail($('#loginId').val())) {
|
||||||
|
errors.push({ message: '이메일 아이디를 올바르게 입력해주세요.', fields: ['userId', 'domain'] });
|
||||||
|
}
|
||||||
|
|
||||||
|
errors.push.apply(errors, window.NewUserInfoForm.collectErrors());
|
||||||
|
|
||||||
|
// 그 밖의 브라우저 기본 제약(required 등) 위반 — 위 목록에 없는 항목만 추가
|
||||||
|
if (errors.length === 0) {
|
||||||
|
[form, agreementForm].filter(Boolean).forEach(function (f) {
|
||||||
|
const invalid = f.querySelector(':invalid');
|
||||||
|
if (invalid) {
|
||||||
|
errors.push({ message: invalid.validationMessage || '입력값을 확인해주세요.', fields: invalid });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
let isSubmitting = false;
|
let isSubmitting = false;
|
||||||
|
|
||||||
|
function resetSubmitState() {
|
||||||
|
isSubmitting = false;
|
||||||
|
btn_register.disabled = false;
|
||||||
|
document.getElementById('loadingOverlay').classList.remove('active');
|
||||||
|
}
|
||||||
|
|
||||||
|
function submitRegisterForm() {
|
||||||
|
// 약관 동의 폼의 데이터를 hidden input으로 추가
|
||||||
|
if (agreementForm) {
|
||||||
|
let agreementFormData = new FormData(agreementForm);
|
||||||
|
for (let pair of agreementFormData.entries()) {
|
||||||
|
if (!form.querySelector('input[name="' + pair[0] + '"]')) {
|
||||||
|
let input = document.createElement('input');
|
||||||
|
input.type = 'hidden';
|
||||||
|
input.name = pair[0];
|
||||||
|
input.value = pair[1];
|
||||||
|
form.appendChild(input);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 불필요한 hidden input 제거
|
||||||
|
const unnecessaryFields = ['isPasswordValid', 'isPasswordMatch'];
|
||||||
|
unnecessaryFields.forEach(fieldName => {
|
||||||
|
const field = form.querySelector(`input[name="${fieldName}"]`);
|
||||||
|
if (field) {
|
||||||
|
field.remove();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// authCompletedYn 값 설정
|
||||||
|
const authCompletedField = document.createElement('input');
|
||||||
|
authCompletedField.type = 'hidden';
|
||||||
|
authCompletedField.name = 'authCompletedYn';
|
||||||
|
authCompletedField.value = window.NewUserInfoForm.isAuthVerified() ? 'Y' : 'N';
|
||||||
|
form.appendChild(authCompletedField);
|
||||||
|
|
||||||
|
// 전송암호화(봉투 치환) 후 제출. 꺼져 있으면 즉시 resolve 되어 평문 그대로 간다.
|
||||||
|
return window.portalPasswordCrypto.encryptForm(form, ['password', 'confirmPassword'])
|
||||||
|
.then(function () { form.submit(); });
|
||||||
|
}
|
||||||
|
|
||||||
// 등록 버튼 클릭 이벤트
|
// 등록 버튼 클릭 이벤트
|
||||||
btn_register.addEventListener('click', function(event) {
|
btn_register.addEventListener('click', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@@ -139,70 +189,28 @@
|
|||||||
|
|
||||||
// Prevent resubmission
|
// Prevent resubmission
|
||||||
if (isSubmitting) {
|
if (isSubmitting) {
|
||||||
console.log('Form is already being submitted...');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
isSubmitting = true;
|
isSubmitting = true;
|
||||||
btn_register.disabled = true;
|
btn_register.disabled = true;
|
||||||
|
|
||||||
// Show loading overlay
|
|
||||||
document.getElementById('loadingOverlay').classList.add('active');
|
document.getElementById('loadingOverlay').classList.add('active');
|
||||||
|
window.FormFieldErrors.clearAll();
|
||||||
|
|
||||||
try {
|
// 비밀번호 검사는 blur 로 시작된 비동기 요청이 아직 안 끝났을 수 있으므로 현재 값으로 다시 돌리고 기다린다
|
||||||
form.classList.add('was-validated');
|
window.NewUserInfoForm.ensurePasswordChecks().then(function () {
|
||||||
if (agreementForm) {
|
const errors = collectFormErrors();
|
||||||
agreementForm.classList.add('was-validated');
|
if (errors.length > 0) {
|
||||||
|
resetSubmitState();
|
||||||
|
window.FormFieldErrors.report(errors);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
return submitRegisterForm();
|
||||||
if (checkFormValidity() && form.checkValidity() && (agreementForm ? agreementForm.checkValidity() : true)) {
|
}).catch(function (error) {
|
||||||
// 약관 동의 폼의 데이터를 hidden input으로 추가
|
|
||||||
if (agreementForm) {
|
|
||||||
let agreementFormData = new FormData(agreementForm);
|
|
||||||
for (let pair of agreementFormData.entries()) {
|
|
||||||
if (!form.querySelector('input[name="' + pair[0] + '"]')) {
|
|
||||||
let input = document.createElement('input');
|
|
||||||
input.type = 'hidden';
|
|
||||||
input.name = pair[0];
|
|
||||||
input.value = pair[1];
|
|
||||||
form.appendChild(input);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 불필요한 hidden input 제거
|
|
||||||
const unnecessaryFields = ['isPasswordValid', 'isPasswordMatch'];
|
|
||||||
unnecessaryFields.forEach(fieldName => {
|
|
||||||
const field = form.querySelector(`input[name="${fieldName}"]`);
|
|
||||||
if (field) {
|
|
||||||
field.remove();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// authCompletedYn 값 설정
|
|
||||||
const authCompletedField = document.createElement('input');
|
|
||||||
authCompletedField.type = 'hidden';
|
|
||||||
authCompletedField.name = 'authCompletedYn';
|
|
||||||
authCompletedField.value = isAuthVerified ? 'Y' : 'N';
|
|
||||||
form.appendChild(authCompletedField);
|
|
||||||
|
|
||||||
// 전송암호화(봉투 치환) 후 제출. 꺼져 있으면 즉시 resolve 되어 평문 그대로 간다.
|
|
||||||
window.portalPasswordCrypto.encryptForm(form, ['password', 'confirmPassword'])
|
|
||||||
.then(function () { form.submit(); });
|
|
||||||
} else {
|
|
||||||
customPopups.showAlert(!isAuthVerified
|
|
||||||
? '인증번호확인을 완료해주세요.'
|
|
||||||
: '모든 필수 항목을 입력하고 약관에 동의해주세요.');
|
|
||||||
isSubmitting = false;
|
|
||||||
btn_register.disabled = false;
|
|
||||||
document.getElementById('loadingOverlay').classList.remove('active');
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Form submission error:', error);
|
console.error('Form submission error:', error);
|
||||||
isSubmitting = false;
|
resetSubmitState();
|
||||||
btn_register.disabled = false;
|
customPopups.showAlert('처리 중 오류가 발생했습니다. 다시 시도해주세요.');
|
||||||
document.getElementById('loadingOverlay').classList.remove('active');
|
});
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// 취소 버튼 클릭 시
|
// 취소 버튼 클릭 시
|
||||||
|
|||||||
@@ -0,0 +1,164 @@
|
|||||||
|
package com.eactive.apim.portal.apps.user;
|
||||||
|
|
||||||
|
import com.eactive.apim.portal.apps.agreements.service.AgreementsFacade;
|
||||||
|
import com.eactive.apim.portal.apps.approval.service.ApprovalService;
|
||||||
|
import com.eactive.apim.portal.apps.user.dto.PortalOrgRegistrationDTO;
|
||||||
|
import com.eactive.apim.portal.apps.user.dto.UserAgreementDTO;
|
||||||
|
import com.eactive.apim.portal.apps.user.dto.ValidationResponse;
|
||||||
|
import com.eactive.apim.portal.apps.user.facade.OrgRegisterFacadeImpl;
|
||||||
|
import com.eactive.apim.portal.apps.user.service.BasicValidationService;
|
||||||
|
import com.eactive.apim.portal.apps.user.service.PortalOrgService;
|
||||||
|
import com.eactive.apim.portal.apps.user.service.PortalUserService;
|
||||||
|
import com.eactive.apim.portal.apps.user.service.UserRegistrationValidationService;
|
||||||
|
import com.eactive.apim.portal.apps.user.validator.AgreementValidator;
|
||||||
|
import com.eactive.apim.portal.apps.user.validator.PasswordValidator;
|
||||||
|
import com.eactive.apim.portal.file.entity.FileInfo;
|
||||||
|
import com.eactive.apim.portal.file.service.FileService;
|
||||||
|
import com.eactive.apim.portal.file.service.FileTypeContext;
|
||||||
|
import com.eactive.apim.portal.portalorg.entity.PortalOrg;
|
||||||
|
import com.eactive.apim.portal.portaluser.entity.PortalUser;
|
||||||
|
import com.eactive.apim.portal.portaluser.repository.PortalUserRepository;
|
||||||
|
import org.junit.jupiter.api.AfterEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.InjectMocks;
|
||||||
|
import org.mockito.Mock;
|
||||||
|
import org.mockito.Spy;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
import org.springframework.mock.web.MockMultipartFile;
|
||||||
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
|
import static org.mockito.Mockito.verify;
|
||||||
|
import static org.mockito.Mockito.verifyNoInteractions;
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 법인 가입/전환 시 사업자등록증 첨부는 선택이다.
|
||||||
|
*/
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class OrgRegisterFacadeImplTest {
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
private AgreementsFacade agreementsFacade;
|
||||||
|
@Mock
|
||||||
|
private PortalUserService portalUserService;
|
||||||
|
@Mock
|
||||||
|
private PortalOrgService portalOrgService;
|
||||||
|
@Mock
|
||||||
|
private PortalUserRepository portalUserRepository;
|
||||||
|
@Mock
|
||||||
|
private FileService fileService;
|
||||||
|
@Spy
|
||||||
|
private BasicValidationService validationService;
|
||||||
|
@Mock
|
||||||
|
private UserRegistrationValidationService userRegistrationValidationService;
|
||||||
|
@Mock
|
||||||
|
private PasswordValidator passwordValidator;
|
||||||
|
@Mock
|
||||||
|
private PasswordEncoder passwordEncoder;
|
||||||
|
@Mock
|
||||||
|
private AgreementValidator agreementValidator;
|
||||||
|
@Mock
|
||||||
|
private ApprovalService approvalService;
|
||||||
|
|
||||||
|
@InjectMocks
|
||||||
|
private OrgRegisterFacadeImpl orgRegisterFacade;
|
||||||
|
|
||||||
|
private final UserAgreementDTO agreementDTO = new UserAgreementDTO();
|
||||||
|
|
||||||
|
@AfterEach
|
||||||
|
void clearFileTypeContext() {
|
||||||
|
FileTypeContext.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void registerNewOrgUser_withoutCertificate_registersOrgWithoutFile() {
|
||||||
|
PortalOrgRegistrationDTO orgDTO = newOrgDTO();
|
||||||
|
PortalOrg org = new PortalOrg();
|
||||||
|
stubNewOrgUserValidationPasses(orgDTO);
|
||||||
|
when(portalOrgService.registerOrgFromDTOWithFile(orgDTO, null)).thenReturn(org);
|
||||||
|
when(portalUserService.createUserWithOrg(orgDTO, org, "corporate", true)).thenReturn(newUser());
|
||||||
|
|
||||||
|
ValidationResponse response = orgRegisterFacade.registerNewOrgUser(orgDTO, agreementDTO, true);
|
||||||
|
|
||||||
|
assertTrue(response.isValid(), response.getMessage());
|
||||||
|
verify(portalOrgService).registerOrgFromDTOWithFile(orgDTO, null);
|
||||||
|
verifyNoInteractions(fileService);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void registerNewOrgUser_withCertificate_registersOrgWithFile() throws IOException {
|
||||||
|
PortalOrgRegistrationDTO orgDTO = newOrgDTO();
|
||||||
|
List<MultipartFile> files = Collections.singletonList(
|
||||||
|
new MockMultipartFile("files", "cert.pdf", "application/pdf", "%PDF-1.4".getBytes()));
|
||||||
|
orgDTO.setFiles(files);
|
||||||
|
FileInfo fileInfo = new FileInfo();
|
||||||
|
fileInfo.setFileId("file-1");
|
||||||
|
PortalOrg org = new PortalOrg();
|
||||||
|
stubNewOrgUserValidationPasses(orgDTO);
|
||||||
|
when(fileService.createFile(files)).thenReturn(fileInfo);
|
||||||
|
when(portalOrgService.registerOrgFromDTOWithFile(orgDTO, fileInfo)).thenReturn(org);
|
||||||
|
when(portalUserService.createUserWithOrg(orgDTO, org, "corporate", true)).thenReturn(newUser());
|
||||||
|
|
||||||
|
ValidationResponse response = orgRegisterFacade.registerNewOrgUser(orgDTO, agreementDTO, true);
|
||||||
|
|
||||||
|
assertTrue(response.isValid(), response.getMessage());
|
||||||
|
verify(portalOrgService).registerOrgFromDTOWithFile(orgDTO, fileInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void convertToOrgUser_withoutCertificate_convertsExistingUser() {
|
||||||
|
// 마이페이지 법인회원 전환 경로
|
||||||
|
PortalOrgRegistrationDTO orgDTO = newOrgDTO();
|
||||||
|
PortalUser existingUser = newUser();
|
||||||
|
when(agreementValidator.isAgreementAccepted(agreementDTO)).thenReturn(true);
|
||||||
|
when(portalUserRepository.findByLoginId("user@example.com")).thenReturn(Optional.of(existingUser));
|
||||||
|
when(portalOrgService.existsByCompRegNo("1234567890")).thenReturn(false);
|
||||||
|
when(portalOrgService.registerOrgFromDTOWithFile(orgDTO, null)).thenReturn(new PortalOrg());
|
||||||
|
|
||||||
|
ValidationResponse response = orgRegisterFacade.convertToOrgUser(orgDTO, agreementDTO, "user@example.com");
|
||||||
|
|
||||||
|
assertTrue(response.isValid(), response.getMessage());
|
||||||
|
verify(portalOrgService).registerOrgFromDTOWithFile(orgDTO, null);
|
||||||
|
verify(portalUserRepository).save(any(PortalUser.class));
|
||||||
|
verifyNoInteractions(fileService);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void stubNewOrgUserValidationPasses(PortalOrgRegistrationDTO orgDTO) {
|
||||||
|
when(agreementValidator.isAgreementAccepted(agreementDTO)).thenReturn(true);
|
||||||
|
when(userRegistrationValidationService.isValidOrgRegistration(orgDTO)).thenReturn(true);
|
||||||
|
when(passwordValidator.isValidPassword(orgDTO.getPassword(), orgDTO.getLoginId(), orgDTO.getMobileNumber()))
|
||||||
|
.thenReturn(true);
|
||||||
|
when(portalUserRepository.findByLoginId(orgDTO.getLoginId())).thenReturn(Optional.empty());
|
||||||
|
when(portalUserService.isMobileDuplicateCheckEnabled()).thenReturn(false);
|
||||||
|
when(portalOrgService.existsByCompRegNo(orgDTO.getCompRegNo())).thenReturn(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private PortalOrgRegistrationDTO newOrgDTO() {
|
||||||
|
PortalOrgRegistrationDTO orgDTO = new PortalOrgRegistrationDTO();
|
||||||
|
orgDTO.setCompRegNo("1234567890");
|
||||||
|
orgDTO.setCorpRegNo("1234567890123");
|
||||||
|
orgDTO.setOrgName("테스트법인");
|
||||||
|
orgDTO.setLoginId("user@example.com");
|
||||||
|
orgDTO.setUserName("홍길동");
|
||||||
|
orgDTO.setMobileNumber("010-1234-5678");
|
||||||
|
orgDTO.setPassword("Passw0rd!x");
|
||||||
|
orgDTO.setConfirmPassword("Passw0rd!x");
|
||||||
|
return orgDTO;
|
||||||
|
}
|
||||||
|
|
||||||
|
private PortalUser newUser() {
|
||||||
|
PortalUser user = new PortalUser();
|
||||||
|
user.setId("user-1");
|
||||||
|
user.setLoginId("user@example.com");
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user