Merge branch 'dev' into fetch_friday

This commit is contained in:
주수현
2025-07-30 13:50:30 +09:00
188 changed files with 1047 additions and 3696 deletions

566
README.md
View File

@@ -1,404 +1,328 @@
# KOREA-RESEARCH 시스템
# KOREA-RESEARCH
## 📌 프로젝트 개요
**KOREA-RESEARCH**는 임가 패널의 일계부 수집 및 관리를 위한 시스템입니다.
이 시스템은 헥사고날 아키텍처(Ports & Adapters) 패턴을 적용한 Spring Boot 기반의 멀티모듈 프레임워크를 기반으로 하여 작성 되었습니다.
---
## ✅ Prerequisites
- JDK 17+
- Maven
- PostgreSQL
---
## 📂 프로젝트 구조
```
┬─┐┌─┐┌─┐┬ ┬┌─┐┬ ┌─┐
├┬┘├┤ │ └┬┘│ │ ├┤
┴└─└─┘└─┘ ┴ └─┘┴─┘└─┘ - framework for spring developers exploring JPA
├── admin # 관리자 어플리케이션
├── core # 공통 도메인 및 로직
├── front # 사용자 어플리케이션
└── pom.xml
_____\ _______
/ \ | /\
/_______/ |_____/ \
| \ / / /
\ \ \/ /
\ / \__/_
\/ ____ /\
/ \ / \
/\ \ / /
\ \/ /
\___\__/
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
```
## 프로젝트 개요
> 모든 애플리케이션은 `core` 모듈을 중심으로 포트, 어댑터 구조로 구성됩니다.
본 프로젝트는 **헥사고날 아키텍처(Ports & Adapters)** 기반의 Spring Boot 멀티모듈 시스템입니다.
도메인 로직과 외부 시스템(웹, DB, 파일 등)을 명확히 분리하여 유지보수성과 확장성을 극대화하였습니다.
## Prerequisites
* JDK 17+
* Maven
* PostgreSQL
## Structure
recycle 은 `core` 모듈을 기반으로 한 `admin`, `front`, `api` 어플리케이션으로 구성되어 있다.
```shell
.
|-- README.md
|-- admin # 관리자 어플리케이션
| |-- pom.xml
| |-- src
| `-- target
|-- core # 공통 모듈
| |-- pom.xml
| |-- src
| `-- target
|-- front # 프론트 어플리케이션
| |-- pom.xml
| |-- src
| `-- target
`-- pom.xml
`-- README.md
```
⚡ AWS S3 업로드를 이용하지 않는다면, pom.xml 에서 `aws`모듈 관련 내용을 삭제하면 된다.
⚡ `admin`, `front`, `api` 중 실제 프로젝트에서 사용할 모듈만 남기고 삭제해주세요.
✔️ Dockerfile 과 .gitlab-ci.yml 은 삭제해주세요 : ) recycle demo 용이기에 여려분의 프로젝트에서는 의미가 없습니다.
recycle 의 demo 가 궁금하다면 아래 URL 에서 확인 해주세요.
- `recycle-admin` - https://recycle-admin.etribe.co.kr 계정정보 (recycle-super/recycle1@#$)
- `recycle-api` - https://recycle-api.etribe.co.kr/swagger-ui/index.html
- `recycle-front` - https://recycle-front.etribe.co.kr/ 계정정보 (generalUser/generalUser1@#$)
### 각 모듈의 내부 구조(헥사고날 아키텍처 예시)
### 📦 헥사고날 구조 예시
```
usecase/
└── daily/
└── expense/
├── ports/
│ ├── application/
│ │ └── DailyExpenseService.java
│ ├── DailyExpensePortIn.java
│ └── DailyExpensePortOut.java
└── adapters/
├── persistence/
│ └── DailyExpenseDao.java
└── web/
└── DailyExpenseController.java
```
- **ports/**: 도메인 서비스 및 인터페이스(Port)
- **adapters/**: 외부 시스템(웹, DB 등) 연결 어댑터
└── daily/
└── expense/
├── ports/
│ ├── application/
│ │ └── DailyExpenseService.java
│ ├── DailyExpensePortIn.java
│ └── DailyExpensePortOut.java
└── adapters/
├── persistence/
│ └── DailyExpenseDao.java
└── web/
└── DailyExpenseController.java
````
## VM Options
---
프레임워크 실행 시 필요한 자바 VM 옵션은 아래와 같다.
## ⚙️ VM Options
| VM 변수 | 설명 | 설정 값 | 필수여부 |
|-----------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------|-------------------------|------|
| -Dspring.profiles.active | Spring active 프로파일 | local, dev, prod | Y |
| -Dapp.initData.core | 어플리케이션 초기 구동에 필요한 필수 데이터 생성여부 | true, false | N |
| -Dspring.sql.init.mode | SQL 초기화 모드를 설정 | always, embedded, never | N |
| -Dpath.upload.public | 파일 업로드 경로 | 기본값 (~/upload/public) | N |
| -Dpath.upload.tmpdir | 임시 파일 업로드 경로 | 기본값 (~/upload/tmpdir) | N |
| -Dlogging.file.path | 로그 파일 생성 경로 | 기본값 (~/logs) | N |
| -Dfile.encoding | JVM 속성 | `UTF-8` | Y |
| -Djava.net.preferIPv4Stack | JVM 속성. 클라이언트 IP체크시 IPv4 형식을 사용하기 위함. | true | Y |
| -Dcom.amazonaws.sdk.disableEc2Metadata | aws 모듈의 ec2 metadata 전송 끄기 | true | N |
| **-Dserver.port** (2023-03-25 추가) | 서버 포트 (없다면 기본 8080) | 원하는 port | N |
| **-Dserver.forward-headers-strategy** (2023-03-25 추가) | 프록시 서버(nginx, apache)에 정의된 `X-Forward-For`, `X-Forwarded-Proto` 설정값을 이용하려면 `native` 로 설정해주면 된다. (내장 컨테이너를 사용하는 경우에만 유효) | `native` | N |
| **-Dspring.datasource.driver-class-name** (2023-03-25 추가) | JDBC Driver. 없다면 JDBC URL을 기준으로 JPA가 판단한다. | jdbc 드라이버 | Y |
| **-Dspring.datasource.url** (2023-03-25 추가) | JDBC URL | jdbc url | N |
| **-Dspring.datasource.username** (2023-03-25 추가) | DB Username | DB 사용자 | Y |
| **-Dspring.datasource.password** (2023-03-25 추가) | DB Password | DB 패스워드 | Y |
### VM Options 예시
#### `admin`, `front` 모두 사용가능합니다.
```
-Dspring.profiles.active=local
-Dapp.initData.core=false
-Dspring.sql.init.mode=never
```bash
-Dspring.profiles.active=prod
-Dserver.port=8081
-Dfile.encoding=UTF-8
-Djava.net.preferIPv4Stack=true
-Dcom.amazonaws.sdk.disableEc2Metadata=true
-Dserver.port=8080
-Dserver.forward-headers-strategy=native
-Dlogging.level.org.springframework.security=DEBUG
-Daes.secret-key=092HW829O0A0AVR0
-Dpath.upload.storage=LOCAL
-Dpath.upload.sftp.public=/home/etribe/data/upload
-Dfile.upload.sftp.ip=115.68.193.117
-Dfile.upload.sftp.id=etribe
-Dfile.upload.sftp.password=Etribe@3415
-Dfile.upload.sftp.port=22
-Dspring.datasource.hikari.maximum-pool-size=10
-Dspring.datasource.hikari.minimum-idle=5
-Dspring.datasource.hikari.idle-timeout=120000
-Dspring.datasource.hikari.max-lifetime=900000
-Dspring.datasource.hikari.connection-timeout=5000
-Dspring.datasource.hikari.leak-detection-threshold=30000
```
** 주의 : 운영서버일 경우 vm옵션 추가
-Dspring.profiles.active=prod
-Dpath.upload.storage=SFTP
-Dpath.upload.public=/home/etribe/data/upload
-Dpath.upload.tmpdir=/home/etribe/data/upload/tmp
-Djasypt.encryptor.password=ko-research
-Djasypt.encryptor.algorithm=PBEWITHHMACSHA512ANDAES_256
````
## 💻 로컬 구동 시 필수 설정
## JDBC 및 데이터 핸들링 구성 옵션
로컬 환경에서 구동 시 아래 JVM 옵션들을 환경에 맞게 설정해 주세요
### app.initData.core
```shell
-Dapp.initData.core=true # true | false
```bash
-Dspring.profiles.active=local
-Dpath.upload.public=/home/etribe/data/upload
-Dpath.upload.tmpdir=/home/etribe/data/upload/tmp
-Djasypt.encryptor.password=ko-research
-Djasypt.encryptor.algorithm=PBEWITHHMACSHA512ANDAES_256
```
어플리케이션 초기 구동에 필요한 필수 데이터 생성여부. 공통코드, 메뉴 정보 및 개발에 필요한 기반 데이터 등이 여기에 해당한다.
InitAdminData, InitUriFrontData 등 *ApplicationRunner* 구현체에서 내용을 확인할 수 있다.
### spring.sql.init.mode
```shell
-Dspring.sql.init.mode=never # always | embedded | never
```
어플리케이션 초기 구동 시, schema.sql, data.sql 등 SQL 초기화 스크립트 실행 여부를 제어하는 설정.
* always : 애플리케이션 구동 시 항상 SQL 스크립트를 실행
* embedded : 내장 DB(H2 등)일 경우에만 실행
* never : SQL 스크립트를 실행하지 않음
## 데이터 호출 및 응답 처리 방식 가이드
> BO(Back Office)와 FO(Front Office) 화면에서는 기능에 따라 **Ajax 호출 방식**과 **서버 렌더링 방식(Server-Side Rendering, SSR)을** 구분하여 사용합니다.
### BO (Back Office: 관리자 화면)
- #### 📡 Ajax 호출 방식 (REST API, JSON 응답)
다음 기능은 Ajax를 통해 REST API(JSON)를 호출합니다
| 기능 | 메서드 | URI | 예시 |
|----------|----------|------------------------------------|------------------------|
| 목록 조회 | GET | `/api/{resource-name}/list` | `/api/articles/list` |
| 등록 | POST | `/api/{resource-name}/create` | `/api/articles/create` |
| 수정 | PUT/PATCH | `/api/{resource-name}/update` | `/api/articles/update` |
| 삭제 | DELETE | `/api/{resource-name}/remove` | `/api/articles/remove` |
| 등록 & 수정 |POST | `/api/{resource-name}/save` | `/api/articles/save` |
- #### 🖥️ 서버 렌더링 방식 (SSR)
상세 조회(view) 화면은 SSR 방식으로 처리합니다.
| 기능 | 메서드 | URI | 예시 |
|------------|--------|------------------------|---------------|
| 상세 조회 | GET | `/{resource-name}/{id}` | `/articles/1` |
> 💡 `-Djasypt.encryptor.password`와 `-Djasypt.encryptor.algorithm`는 환경에 따라 **수정 가능**합니다.
---
### FO (Front Office: 사용자 화면)
- #### 📡 Ajax 호출 방식 (REST API, JSON 응답)
다음 기능은 Ajax 기반 REST API 호출로 처리합니다.
| 기능 | 메서드 | URI | 예시 |
|------|------------|-------------------------|--------------------------|
| 등록 | POST | `/api/{resource-name}/create` | `/api/articles/create` |
| 수정 | PUT/PATCH | `/api/{resource-name}/update` | `/api/articles/update` |
| 삭제 | DELETE | `/api/{resource-name}/remove` | `/api/articles/remove` |
## ⚠️ 로컬 DB 연결 관련 안내
- #### 🖥️ 서버 렌더링 방식 (SSR)
목록 및 상세 화면은 SSR 방식으로 처리할 수 있으며, 상황에 따라 선택적으로 사용합니다.
현재 제공된 DB 설정은 **운영 서버용 정보**만 포함되어 있습니다.
로컬 환경에서 구동하기 위해서는 **로컬 DB 설정을 별도로 구성해야 합니다.**
| 기능 | 메서드 | URI | 예시 |
|------------|--------|------------------------------|------------------------|
| 목록 조회 | GET | `/{resource-name}/list` | `/articles/list` |
| 상세 조회 | GET | `/{resource-name}/{id}` | `/articles/1` |
* `application-local.yml`에 로컬 DB 접속 정보를 입력해야 합니다.
* 운영 DB에 직접 접근하여 개발하지 않도록 주의가 필요합니다
* `Jasypt`로 암호화된 DB 계정 정보가 있는 경우, 로컬 비밀번호 복호화를 위한 `encryptor.password`가 반드시 필요합니다.
## LOG 생성 옵션
---
## 🔐 Jasypt 암호화
### logging.file.path
* DB 커넥션 정보는 Jasypt로 암호화되어 사용됩니다.
* `admin`, `front` 모듈 각각에 `JasyptConfig.java` 설정이 포함되어 있습니다.
```shell
-Dlogging.file.path=~/logs # 기본값 ${user.home}/logs
```yaml
jasypt:
encryptor:
password: # 별도 관리
algorithm: # 별도 관리
```
로그 파일 생성 경로를 지정한다. 지정된 경로에 아래와 같은 로그 파일이 생성된다.
예시:
```shell
admin-app.log # 어드민 전체 로그
admin-app-ERROR.log # 어드민 로그 중 ERROR 부분 필터링
front-app.log # 프론트 전체 로그
front-app-ERROR.log # 프론트 로그 중 ERROR 부분 필터링
```yaml
spring:
datasource:
kri:
jdbc-url: ENC(...)
username: ENC(...)
password: ENC(...)
mms:
jdbc-url: ENC(...)
username: ENC(...)
password: ENC(...)
```
## File 구성 옵션
---
### 파일 업로드
## 🗃️ DB 구성
```shell
-Dpath.upload.public=~/upload/public # 파일 업로드 경로
-Dpath.upload.tmpdir=~/upload/tmpdir # tmp 디렉토리 경로
| 모듈 | 연결 DB |
| ------- | ----------------------- |
| `admin` | kri DB, mms DB (문자 발송용) |
| `front` | kri DB |
---
## 🔄 다중 DB 설정 (admin)
* `admin` 모듈에는 `MMSDBConfig.java`를 통한 **mms 전용 DataSource** 설정이 있습니다.
* MyBatis 매퍼는 별도 위치로 구분됩니다.
```yaml
mybatis:
mapper-locations:
kri: classpath*:mappers/**/*Mapper.xml
mms: classpath*:mappers/mms/*Mapper.xml
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
```
파일 업로드 경로가 지정되면 사용자가 업로드한 파일은 이 경로를 기준으로 `주제`/`년월일` 폴더 아래에 저장됩니다.
tmpdir 은 서블릿 컨테이너가 multipart 파일 업로드 시 대용량 처리를 위해 임시파일을 저장하는 공간입니다.
---
파일 시스템 외에 AWS S3 로도 업로드해야 한다면, 아래 AWS CLI 를 이용하기 위한 정보를 제공해주어야 합니다.
```shell
-Dapp.aws.s3.accessKey=AKIAZF27HETWNITZBZOF # AMI 에서 발급한 사용자 엑세스 키
-Dapp.aws.s3.secretKey=IhnTG0X7Wav8ak3cbYR1l8UAjL+gbnXdWJRM11cx # AMI 에서 발급한 사용자 시크릿 키
-Dapp.aws.s3.bucketName=etribe # S3 버킷 이름
-Dapp.aws.s3.bucketFolder=/recycle/upload # S3 버킷 디렉토리
-Dapp.aws.s3.domain=dixjkmptx5pkm.cloudfront.net # S3 혹은 cloudfront 도메인
```
🔑 위 accessKey 정보는 제가 만든 임시 정보이며, recycle 데모용으로만 사용되니 참고해주세요.
💡 recycle 은 파일 시스템 업로드와 S3 업로드를 사용 목적에 맞게 선택할 수 있는 유연성을 제공합니다.
`FileUploadType`은 파일 업로드가 필요한 주제 도메인들이 정의된 enum 객체입니다. 여기 기술된 `FileStorageType` 속성에 따라 파일 업로드 경로가 결정됩니다.
### 파일 참조
업로드된 파일은 참조될 수 있어야 합니다. `fileUrlPortIn`는 파일이 파일 시스템에 있든 S3 에 있든 정확한 참조 URL 을 전달해주는 인터페이스입니다.
## 🧩 MyBatis 다중 DB 설정 예시 (`MMSDBConfig.java`)
```java
// 참조 URL 전달 - inline 방식
fileUrlPortIn.getInline(
uploadFile.getType().getFileStorageType(),
uploadFile.getPath(),
uploadFile.getName());
// 참조 URL 전달 - attachment 방식
fileUrlPortIn.getAttachment(
uploadFile.getType().getFileStorageType(),
uploadFile.getId());
@MapperScan(
basePackages = "app.module.mms.**.persistence",
sqlSessionFactoryRef = "mmsSqlSessionFactory")
```
`inline` 과 `attachment` 는 응답 헤더의 content-disposition 속성 값을 의미합니다.
업로드된 파일은 사용자에게 전달할 때 `inline` 과 `attachment` 두 방식 중 요건에 맞게 사용하면 됩니다.
## 공통 필드(Audit) 자동 주입 방법 (AOP기반)
createdAt, createdBy, updatedAt, updatedBy, deletedAt, deletedBy, isDeleted 와 같은 공통 이력 필드는
매번 수동으로 설정하지 않아도 되도록, AOP를 활용해 자동으로 주입되도록 구성했습니다.
## 🔧 일계부 등록 가능 날짜
### 1. 기본 구조
create, update, delete 시 Command 객체에 AuditCommand를 상속합니다.
#### AuditCommand 사용 예시
``` java
// 필수: AuditCommand 상속
public class UpdateCmd extends AuditCommand {
private Long seq;
...
}
```
AuditCommand는 아래 메서드를 제공하며, 각각 생성/수정/삭제 작업에 필요한 필드를 자동으로 설정합니다.
``` java
public class AuditCommand {
private LocalDateTime createdAt;
private String createdBy;
private LocalDateTime updatedAt;
private String updatedBy;
private LocalDateTime deletedAt;
private String deletedBy;
public void create() { ... }
public void update() { ... }
public void delete() { ... }
}
`DailyRecordConstants.java`는 **일계부 등록 및 수정 가능 시점에 대한 정책 상수**를 정의하고 있습니다.
---
### ✅ 정책 정의
| 항목 | 정책 설명 | 상수명 | 값 |
| ------- | ------------------------ | ---------------------- |------------------------|
| 등록 가능 월 | 해당 월 기준, **이전 월만 등록 가능** | `REGISTER_LIMIT_MONTH` | `1` → *임시로 `4` 설정 중* |
| 등록 가능 일 | 해당 월 **15일까지만 등록 가능** | `REGISTER_LIMIT_DAY` | `15` → *임시로 `31` 설정 중* |
| 수정 가능 월 | 해당 월 기준, **이전 월만 수정 가능** | `MODIFY_LIMIT_MONTH` | `1` → *임시로 `4` 설정 중* |
| 수정 가능 일 | 해당 월 **15일까지만 수정 가능** | `MODIFY_LIMIT_DAY` | `15` → *임시로 `31` 설정 중* |
---
### ⚠️ 현재 임시 설정 사항
현재 시스템에서는 **등록 가능 월(`REGISTER_LIMIT_MONTH`)** 및 **수정 가능 월(`MODIFY_LIMIT_MONTH`)** 값을 **임시로 `4달` **등록 가능 일(`REGISTER_LIMIT_DAY`)** 및 **수정 가능 일(`MODIFY_LIMIT_DAY`)** 값을 **임시로 `31일`로 설정**해 두었으며,
**정책상 원래는 `15일`로 제한**되어야 합니다.
> 📌 향후 운영 정책에 따라 **`이전월` **`15일`로 복원 예정**으로 해당값으로 수정한 war파일 제공
---
## 📤 파일 업로드
```bash
-Dpath.upload.public=/home/etribe/data/upload
```
### 2. AOP 기반 어노테이션 자동 주입
service 또는 dao 내에
@CreateCommand, @UpdateCommand, @DeleteCommand 어노테이션을 통해
AOP가 자동으로 해당 메서드의 파라미터(AuditCommand 상속 객체)에 공통 필드를 주입합니다.
파일 저장 구조는 `주제/년월일/파일명`이며, `FileUploadType` Enum에 따라 경로가 결정됩니다.
| 어노테이션 | 자동 설정되는 필드 |
| ---------------- | -------------------------------------------------- |
| `@CreateCommand` | `createdAt`, `createdBy`, `updatedAt`, `updatedBy` |
| `@UpdateCommand` | `updatedAt`, `updatedBy` |
| `@DeleteCommand` | `updatedAt`, `updatedBy`, `deletedAt`, `deletedBy` |
```java
fileUrlPortIn.getInline(type, path, name);
fileUrlPortIn.getAttachment(type, id);
```
#### 어노테이션 사용 예시
---
## 🧾 Audit 공통 필드 자동 주입
* AOP 기반 자동 주입 방식으로 생성/수정/삭제 시 필드 반복을 최소화합니다.
* 공통 필드: `createdAt`, `createdBy`, `updatedAt`, `updatedBy`, `deletedAt`, `deletedBy`, `isDeleted`
| 어노테이션 | 주입 필드 |
| ---------------- | ------------------------------------------ |
| `@CreateCommand` | createdAt, createdBy, updatedAt, updatedBy |
| `@UpdateCommand` | updatedAt, updatedBy |
| `@DeleteCommand` | deletedAt, deletedBy |
### ✅ 기본 사용법
모든 Command는 AuditCommand를 상속하고, Service/DAO 메서드에 어노테이션만 붙이면 자동으로 필드에 값이 주입됩니다.
```java
@UpdateCommand
public void operate(UpdateCmd cmd) {
mapper.update(cmd);
public void update(UpdateCmd cmd) {
mapper.update(cmd); // updatedAt, updatedBy 자동 주입
}
```
### 3. AOP 외 수동 적용이 필요한 경우: AuditUtil 사용
AOP 외에도, 하나의 DAO 메서드 내에서 여러 Insert/Delete 처리가 필요한 경우에는 아래처럼 직접 AuditUtil을 사용할 수 있습니다.
#### AuditUtil 사용 예시
```java
public class UpdateCmd extends AuditCommand {
private Long seq;
}
```
### ✅ 복합적인 CRUD 처리 시
하나의 로직 안에서 insert, update, delete 등 여러 DB 작업이 함께 처리되는 경우, `AuditUtil`의 유틸 메서드를 사용합니다.
```java
// 관리자 등록
mapper.insertAdmin(AuditUtil.create(cmd));
// 관리자의 역할 매핑
// 관리자 역할 매핑 (다건)
mapper.insertAdminHasRoles(
AuditUtil.create(new SaveAdminHasRoleParam(cmd.getSeq(), cmd.getRoleIds()))
);
```
---
### 4. XML에서 공통 필드 include로 재사용
SQL 작성 시 공통필드의 반복 작성을 피하기 위해 `<sql>` 태그로 분리하여 `<include>` 방식으로 재사용합니다.
자세한 정의는 `CommonFieldsMapper.xml` 파일에서 확인할 수 있습니다.
## 🔁 XML 공통 필드 include
| SQL ID | 설명 | 사용 예시 |
| ---------------------------- | -------------------------------------- | -------------------------------------------------------------- |
| `CreateUpdateBaseColumns` | `INSERT` 시 공통 컬럼 정의 | `<include refid="common.fields.CreateUpdateBaseColumns" />` |
| `CreateUpdateBaseValues` | `INSERT` 시 공통 컬럼의 값 정의 | `<include refid="common.fields.CreateUpdateBaseValues" />` |
| `CreateUpdateListBaseValues` | `다건 INSERT` 시 공통 값 정의 (e.g. `foreach`) | `<include refid="common.fields.CreateUpdateListBaseValues" />` |
| `UpdateBaseSet` | `UPDATE` 시 공통 `SET` 구문 | `<include refid="common.fields.UpdateBaseSet" />` |
| `DeleteBaseSet` | `삭제 처리용 UPDATE` 시 공통 `SET` 구문 | `<include refid="common.fields.DeleteBaseSet" />` |
#### include 사용 예시
```xml
UPDATE household
SET
owner_name = #{ownerName},
owner_age = #{ownerAge},
tel = #{tel},
phone = #{phone},
region = #{region},
city = #{city},
address_detail = #{addressDetail},
<include refid="common.fields.UpdateBaseSet" /> <!-- 공통 필드 include -->
WHERE seq = ${seq}
<include refid="common.fields.UpdateBaseSet" />
```
공통 SQL은 `CommonFieldsMapper.xml` 에 정의되어 있습니다.
## PACKAGING
---
배포방식 설정을 위해 두가지 maven 프로파일을 제공한다.
## 📦 패키징 (WAR)
* `jar` (default)
* `war` Jeus, WebLogic, Tomcat 등 별도 외장 컨테이너 이용시 사용
maven 빌드 시 프로파일을 지정하지 않으면 기본 `jar` 프로파일로 동작하고, `war` 의 경우 명시적인 지정이 필요하다.
아래는 admin 빌드시 `war` 프로파일을 지정한 예시이다.
```shell
$ mvn --projects admin --also-make clean package -DskipTests -P war
# 빌드 후, admin/target 디렉토리에 war 가 생성된걸 확인할 수 있다.
$ ll admin/target
-rw-r--r-- 1 user 197121 94905770 4월 22 09:59 admin-0.0.1-SNAPSHOT.war
```bash
$ mvn clean package -P war
```
## 개발 서버 환경
---
### database - postgresql 14.17
## 🔌 API 호출 방식
```
URL: jdbc:postgresql://15.165.180.203:5432/korea_research
USERNAME: ko_research
PASSWORD: koresearch1@#4
### BO (관리자)
| 기능 | 방식 | URI 예시 |
| ------- | ---- | -------------------------------------- |
| 목록/등록 등 | Ajax | `/api/household/daily/list`, `/save` 등 |
| 상세 조회 | SSR | `/household/{id}` |
### FO (사용자)
| 기능 | 방식 | URI 예시 |
| -------- | ---- | -------------------------------------------------------- |
| 등록/수정/삭제 | Ajax | `/api/record/income/{searchMonth}/{groupNo}/form/{id}` 등 |
| 목록/상세 조회 | SSR | `/record/income/{searchMonth}/{groupNo}`, `/form/{id}` 등 |
---
## 📋 로그 설정
```bash
-Dlogging.file.path=~/logs
```
### 🚀 ADMIN DEPLOY
| 파일 이름 | 설명 |
| --------------------- | ------------ |
| `admin-app.log` | 관리자 전체 로그 |
| `admin-app-ERROR.log` | 관리자 에러 전용 로그 |
| `front-app.log` | 프론트 전체 로그 |
| `front-app-ERROR.log` | 프론트 에러 전용 로그 |
#### `deploy_dev_admin` 브렌치로 merge! pipeline 실행 후 아래 URL 에서 확인가능.
* https://ko-research-admin.etribe.co.kr
---
### 🚀 FRONT DEPLOY
## ⏱️ 배치 스케줄러
`AutoSchedulesController.java`에 정의되어 있으며, 총 3개의 배치가 존재합니다.
| 배치명 | 실행 주기 | 설명 |
| ----------- | ------------ | -------------------------- |
| 월별 입력 상태 등록 | 매월 1일 0시 0초 | 월별 입력 상태를 초기화 등록함 |
| 문자 자동 발송 | 매일 17시 0분 | mms DB로부터 수신 대상 추출 후 문자 발송 |
| 월초 이월금 등록 | 매월 16일 0시 0초 | 이전 달 데이터를 기준으로 이월금 등록 |
---
## 👤운영서버 테스트 계정
계정 ID | 비밀번호 | 권한 |
| ------------ | ------- | ------- |
| `koadmin` | `0701!` | 관리자 권한 |
| `kolocal` | `0701@` | 지방실사 권한 |
| `kosearcher` | `0701#` | 조사원 권한 |
---
## 🧾 운영서버 임가 계정 목록
| 임가번호 | 비밀번호 |
|---------| ------ |
| `22221` | `1111` |
| `22222` | `1111` |
| `22223` | `1111` |
| `22224` | `1111` |
| `22225` | `1111` |
| `22226` | `1111` |
---
## ❗ 실사지역 설정 주의사항
테스트 계정들은 **실사지역이 `테스트`로 지정**되어 있습니다.
> 이로 인해 해당 계정으로 수집된 데이터는 **통계에 반영되지 않습니다.**
**주의:**⚠️ 통계에 포함되도록 하려면 **실제 실사지역**으로 매핑이 필요합니다.
---
#### `deploy_dev_front` 브렌치로 merge! pipeline 실행 후 아래 URL 에서 확인가능.
* https://ko-research-front.etribe.co.kr

View File

@@ -81,8 +81,6 @@ public class AdminURIInterceptor implements HandlerInterceptor {
return;
}
// 활성 프로파일 가져오기 TODO 2차 오픈시 삭제 예정
modelAndView.addObject("activeProfile", activeProfiles);
String roleId = AdminUtil.getLoginUserRole();
if (!CommonUtil.isAjaxRequest(request)) {

View File

@@ -1,11 +1,6 @@
package app.module.admin.config.application.aop;
import app.module.core.config.application.enums.AppType;
import app.module.core.config.application.enums.OperationLogType;
import app.module.core.config.application.util.CommonUtil;
import app.module.core.config.application.util.MessageUtil;
import app.module.core.usecase.operationlog.save.application.domain.OperationLogSaveCommand;
import app.module.core.usecase.operationlog.save.application.port.in.OperationLogSavePortIn;
import jakarta.servlet.http.HttpServletRequest;
import lombok.RequiredArgsConstructor;
import org.aspectj.lang.JoinPoint;
@@ -18,21 +13,12 @@ import org.springframework.stereotype.Component;
@RequiredArgsConstructor
public class LoginFailAspect {
private final OperationLogSavePortIn operationLogSavePortIn;
private final MessageUtil messageUtil;
@After("@annotation(app.module.admin.config.application.aop.LoginFailOperateLog)")
public void operate(JoinPoint joinPoint) throws Throwable {
Object[] args = joinPoint.getArgs();
HttpServletRequest request = (HttpServletRequest) args[0];
String targetId = request.getParameter("username");
operationLogSavePortIn.connect(
new OperationLogSaveCommand(
AppType.ADMIN,
OperationLogType.LOGIN_FAIL,
targetId,
CommonUtil.getClientIP(request),
messageUtil.getMessage("operate.login.fail", targetId)));
}
}

View File

@@ -4,8 +4,6 @@ import app.module.core.config.application.enums.AppType;
import app.module.core.config.application.enums.OperationLogType;
import app.module.core.config.application.util.CommonUtil;
import app.module.core.config.application.util.MessageUtil;
import app.module.core.usecase.operationlog.save.application.domain.OperationLogSaveCommand;
import app.module.core.usecase.operationlog.save.application.port.in.OperationLogSavePortIn;
import jakarta.servlet.http.HttpServletRequest;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -20,8 +18,6 @@ import org.springframework.stereotype.Component;
@Slf4j
@RequiredArgsConstructor
public class LoginSuccessAspect {
private final OperationLogSavePortIn operationLogSavePortIn;
private final MessageUtil messageUtil;
@After("@annotation(app.module.admin.config.application.aop.LoginSuccessOperateLog)")
@@ -31,12 +27,5 @@ public class LoginSuccessAspect {
HttpServletRequest request = (HttpServletRequest) args[0];
Authentication authentication = (Authentication) args[2];
operationLogSavePortIn.connect(
new OperationLogSaveCommand(
AppType.ADMIN,
OperationLogType.LOGIN_SUCCESS,
null,
CommonUtil.getClientIP(request),
messageUtil.getMessage("operate.login.success", authentication.getName())));
}
}

View File

@@ -5,8 +5,6 @@ import app.module.core.config.application.enums.OperationLogType;
import app.module.core.config.application.util.CommonUtil;
import app.module.core.usecase.admin.view.ports.AdminViewPortIn;
import app.module.core.usecase.admin.view.ports.application.domain.AdminView;
import app.module.core.usecase.operationlog.save.application.domain.OperationLogSaveCommand;
import app.module.core.usecase.operationlog.save.application.port.in.OperationLogSavePortIn;
import jakarta.servlet.http.HttpServletRequest;
import lombok.RequiredArgsConstructor;
import org.aspectj.lang.ProceedingJoinPoint;
@@ -27,7 +25,6 @@ import java.util.Optional;
public class RoleUpdateAspect {
private final AdminViewPortIn adminViewPortIn;
private final OperationLogSavePortIn operationLogSavePortIn;
@Around(
"execution(* app.module.core.usecase.admin.saveAdmin.ports.application.SaveAdminService.connect(..))")
@@ -54,34 +51,7 @@ public class RoleUpdateAspect {
// .map(adminUserWithRole -> adminUserWithRole.getRole().getId())
// .collect(Collectors.toList());
boolean createLog = false;
if (beforeAdmin.isPresent()) {
List<String> beforeRoles =
beforeAdmin.stream().map(r -> r.getRole().getId()).toList();
if (beforeRoles.size() != currentRoles.size()
|| currentRoles.stream().anyMatch(item -> !beforeRoles.contains(item))) {
createLog = true;
}
} else if (!currentRoles.isEmpty()) {
createLog = true;
}
if (createLog) {
String operatorId = Optional.ofNullable(CommonUtil.getLoginUsername())
.orElse("init data");
HttpServletRequest request = CommonUtil.getRequest();
operationLogSavePortIn.connect(
new OperationLogSaveCommand(
AppType.ADMIN,
OperationLogType.ROLE_UPDATE,
adminId,
request != null ? CommonUtil.getClientIP(request) : null,
String.format(
"`%s` grants [%s] permissions to `%s`",
operatorId, StringUtils.join(currentRoles, ", "), adminId)));
}
return joinPoint.proceed();
}

View File

@@ -7,8 +7,6 @@ import app.module.core.config.application.util.MessageUtil;
import app.module.core.usecase.admin.status.ports.AdminUpdateAccountLockPortIn;
import app.module.core.usecase.admin.status.ports.AdminUpdateLoginFailPortIn;
import app.module.core.usecase.admin.view.ports.AdminViewPortIn;
import app.module.core.usecase.operationlog.save.application.domain.OperationLogSaveCommand;
import app.module.core.usecase.operationlog.save.application.port.in.OperationLogSavePortIn;
import jakarta.servlet.http.HttpServletRequest;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -31,7 +29,6 @@ public class AdminAuthFailEvent {
private final AdminViewPortIn adminViewPortIn;
private final AdminUpdateLoginFailPortIn updateLoginFailPortIn;
private final AdminUpdateAccountLockPortIn updateAccountLockPortIn;
private final OperationLogSavePortIn operationLogSavePortIn;
private final MessageUtil messageUtil;
@Value("${app.admin.auth.fail.permit}")
private int failPermit;
@@ -61,15 +58,6 @@ public class AdminAuthFailEvent {
request.getSession(),
messageUtil.getMessage("security.auth.fail.exceed", failPermit));
// 계정 잠금 로그 기록
operationLogSavePortIn.connect(
new OperationLogSaveCommand(
AppType.ADMIN,
OperationLogType.ACCOUNT_LOCKED,
adminUserViewInfo.getId(),
CommonUtil.getClientIP(request),
messageUtil.getMessage(
"operate.account.locked", adminUserViewInfo.getId())));
}
});
}

View File

@@ -1,6 +1,7 @@
package app.module.admin.usecase.communication.notice.getNotice.ports.application.domain;
import app.module.core.config.application.enums.FileUploadType;
import app.module.core.usecase.file.model.UploadFile;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -9,7 +10,7 @@ import java.io.Serializable;
import java.time.LocalDateTime;
/**
* DTO for {@link app.module.core.config.adapters.persistence.entity.UploadFile}
* DTO for {@link UploadFile}
*/
@Data
@AllArgsConstructor

View File

@@ -48,16 +48,6 @@ public class CreateHouseholdValidator implements Validator {
return;
}
// 4. 가구 연락처
// TODO : 필수입력값 맞는지 체크
// if (!StringUtils.hasText(vo.getTel1()) || !StringUtils.hasText(vo.getTel2()) || !StringUtils.hasText(vo.getTel3())) {
// errors.reject("tel", "가구 연락처를 모두 입력해주세요.");
// return;
// }
// if (vo.getTel2().length() > 4 || vo.getTel3().length() > 4) {
// errors.reject("tel", "가구 연락처는 각 4자리까지 입력 가능합니다.");
// return;
// }
if (StringUtils.hasText(vo.getTel2()) || StringUtils.hasText(vo.getTel3())) {
if ((vo.getTel2() != null && vo.getTel2().length() > 4) ||
(vo.getTel3() != null && vo.getTel3().length() > 4)) {

View File

@@ -27,10 +27,5 @@ public class GetHouseholdsStatus {
private Boolean isGiftSent;
private String researcherName;
private String researcherPhone;
private Integer ownerAge;
private String address;
private String industrySubMiddle;
private String industryDetail;
private String usageType;
private Integer total;
}

View File

@@ -1,6 +1,7 @@
package app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferExpense.adapters.web.validator;
import app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferExpense.adapters.web.model.SaveBankAutoTransferExpenseReqVO;
import app.module.core.config.constants.CommonConstants;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import org.springframework.validation.Errors;
@@ -33,6 +34,13 @@ public class SaveBankAutoTransferExpenseValidator implements Validator {
return;
}
// 수량 0 이상 입력
if (StringUtils.hasText(vo.getCount()) && Integer.parseInt(vo.getCount()) <= 0) {
errors.rejectValue(
"count", CommonConstants.VALID_CODE_INVALID_ZERO,
"수량은 0 이상 입력해 주세요.");
}
// 수량 입력 O, 단위 선택 X
if (StringUtils.hasText(vo.getCount()) && !StringUtils.hasText(vo.getUnitCode())) {
errors.rejectValue("unitCode", "error.unitCode",
@@ -59,5 +67,11 @@ public class SaveBankAutoTransferExpenseValidator implements Validator {
errors.rejectValue("price", "error.price",
"현금(원)을 입력해주세요.");
}
if (vo.getPrice() != null && vo.getPrice() <= 0) {
errors.rejectValue(
"price", CommonConstants.VALID_CODE_INVALID_ZERO,
"현금(원)은 0 이상 입력해 주세요.");
}
}
}

View File

@@ -1,6 +1,7 @@
package app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferIncome.adapters.web.validator;
import app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferIncome.adapters.web.model.SaveBankAutoTransferIncomeReqVO;
import app.module.core.config.constants.CommonConstants;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import org.springframework.validation.Errors;
@@ -42,6 +43,13 @@ public class SaveBankAutoTransferIncomeValidator implements Validator {
"수입의 종류를 입력해주세요.");
}
// 수량 0 이상 입력
if (StringUtils.hasText(vo.getCount()) && Integer.parseInt(vo.getCount()) <= 0) {
errors.rejectValue(
"count", CommonConstants.VALID_CODE_INVALID_ZERO,
"수량은 0 이상 입력해 주세요.");
}
// 수량 입력 O, 단위 선택 X
if (StringUtils.hasText(vo.getCount()) && !StringUtils.hasText(vo.getUnitCode())) {
errors.rejectValue("unitCode", "error.unitCode",
@@ -68,5 +76,11 @@ public class SaveBankAutoTransferIncomeValidator implements Validator {
errors.rejectValue("price", "error.price",
"현금(원)을 입력해주세요.");
}
if (vo.getPrice() != null && vo.getPrice() <= 0) {
errors.rejectValue(
"price", CommonConstants.VALID_CODE_INVALID_ZERO,
"현금(원)은 0 이상 입력해 주세요.");
}
}
}

View File

@@ -27,6 +27,12 @@ public class SaveDailyExpenseValidator implements Validator {
"수량을 입력해 주세요.");
}
if (vo.getQuantity() != null && vo.getQuantity() <= 0) {
errors.rejectValue(
"quantity", CommonConstants.VALID_CODE_INVALID_ZERO,
"수량은 0 이상 입력해 주세요.");
}
if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) {
errors.rejectValue(
"unitCode", CommonConstants.VALID_CODE_NOTBLANK,
@@ -47,5 +53,15 @@ public class SaveDailyExpenseValidator implements Validator {
"estimatedValue", CommonConstants.VALID_CODE_NOTBLANK,
"현금 또는 현물평가액을 입력해 주세요.");
}
if ((vo.getPrice() != null && vo.getPrice() <= 0)
|| (vo.getEstimatedValue() != null && vo.getEstimatedValue() <= 0)) {
errors.rejectValue(
"price", CommonConstants.VALID_CODE_INVALID_ZERO,
"현금 또는 현물평가액은 0 이상 입력해 주세요.");
errors.rejectValue(
"estimatedValue", CommonConstants.VALID_CODE_INVALID_ZERO,
"현금 또는 현물평가액은 0 이상 입력해 주세요.");
}
}
}

View File

@@ -32,6 +32,12 @@ public class SaveDailyFarmingValidator implements Validator {
"수량을 입력해 주세요.");
}
if (vo.getQuantity() != null && vo.getQuantity() <= 0) {
errors.rejectValue(
"quantity", CommonConstants.VALID_CODE_INVALID_ZERO,
"수량은 0 이상 입력해 주세요.");
}
if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) {
errors.rejectValue(
"unitCode", CommonConstants.VALID_CODE_NOTBLANK,
@@ -49,5 +55,11 @@ public class SaveDailyFarmingValidator implements Validator {
"estimatedValue", CommonConstants.VALID_CODE_NOTBLANK,
"현물평가액을 입력해 주세요.");
}
if (vo.getEstimatedValue() != null && vo.getEstimatedValue() <= 0) {
errors.rejectValue(
"estimatedValue", CommonConstants.VALID_CODE_INVALID_ZERO,
"현물평가액은 0 이상 입력해 주세요.");
}
}
}

View File

@@ -26,6 +26,12 @@ public class SaveDailyForestryValidator implements Validator {
"수량을 입력해 주세요.");
}
if (vo.getQuantity() != null && vo.getQuantity() <= 0) {
errors.rejectValue(
"quantity", CommonConstants.VALID_CODE_INVALID_ZERO,
"수량은 0 이상 입력해 주세요.");
}
if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) {
errors.rejectValue(
"unitCode", CommonConstants.VALID_CODE_NOTBLANK,
@@ -43,5 +49,12 @@ public class SaveDailyForestryValidator implements Validator {
"estimatedValue", CommonConstants.VALID_CODE_NOTBLANK,
"현물평가액을 입력해 주세요.");
}
if (vo.getEstimatedValue() != null && vo.getEstimatedValue() <= 0) {
errors.rejectValue(
"estimatedValue", CommonConstants.VALID_CODE_INVALID_ZERO,
"현물평가액은 0 이상 입력해 주세요.");
}
}
}

View File

@@ -27,6 +27,12 @@ public class SaveDailyIncomeValidator implements Validator {
"수량을 입력해 주세요.");
}
if (vo.getQuantity() != null && vo.getQuantity() <= 0) {
errors.rejectValue(
"quantity", CommonConstants.VALID_CODE_INVALID_ZERO,
"수량은 0 이상 입력해 주세요.");
}
if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) {
errors.rejectValue(
"unitCode", CommonConstants.VALID_CODE_NOTBLANK,
@@ -47,5 +53,15 @@ public class SaveDailyIncomeValidator implements Validator {
"estimatedValue", CommonConstants.VALID_CODE_NOTBLANK,
"현금 또는 현물평가액을 입력해 주세요.");
}
if ((vo.getPrice() != null && vo.getPrice() <= 0)
|| (vo.getEstimatedValue() != null && vo.getEstimatedValue() <= 0)) {
errors.rejectValue(
"price", CommonConstants.VALID_CODE_INVALID_ZERO,
"현금 또는 현물평가액은 0 이상 입력해 주세요.");
errors.rejectValue(
"estimatedValue", CommonConstants.VALID_CODE_INVALID_ZERO,
"현금 또는 현물평가액은 0 이상 입력해 주세요.");
}
}
}

View File

@@ -27,5 +27,15 @@ public class SaveDailyPowerValidator implements Validator {
"leasedHours", CommonConstants.VALID_CODE_NOTBLANK,
"자가 사용시간 또는 임차 사용시간을 입력해 주세요.");
}
if ((vo.getOwnedHours() != null && vo.getOwnedHours() <= 0)
|| (vo.getLeasedHours() != null && vo.getLeasedHours() <= 0)) {
errors.rejectValue(
"ownedHours", CommonConstants.VALID_CODE_INVALID_ZERO,
"자가 사용시간 또는 임차 사용시간은 0 이상 입력해 주세요.");
errors.rejectValue(
"leasedHours", CommonConstants.VALID_CODE_INVALID_ZERO,
"자가 사용시간 또는 임차 사용시간은 0 이상 입력해 주세요.");
}
}
}

View File

@@ -25,7 +25,11 @@ public class SaveDailyWorkValidator implements Validator {
"workLandArea", CommonConstants.VALID_CODE_NOTBLANK,
"작업 면적을 입력해 주세요.");
}
if (vo.getWorkLandArea() != null && vo.getWorkLandArea() <= 0) {
errors.rejectValue(
"workLandArea", CommonConstants.VALID_CODE_INVALID_ZERO,
"작업 면적은 0 이상 입력해 주세요.");
}
if (vo.getWorkLandArea() != null && StringUtils.isBlank(vo.getAreaUnitCode())) {
errors.rejectValue(
"areaUnitCode", CommonConstants.VALID_CODE_NOTBLANK,
@@ -44,6 +48,12 @@ public class SaveDailyWorkValidator implements Validator {
"수확량을 입력해 주세요.");
}
if (vo.getHarvestQuantity() != null && vo.getHarvestQuantity() <= 0) {
errors.rejectValue(
"harvestQuantity", CommonConstants.VALID_CODE_INVALID_ZERO,
"수확량은 0 이상 입력해 주세요.");
}
if (vo.getHarvestQuantity() != null && StringUtils.isBlank(vo.getHarvestUnitCode())) {
errors.rejectValue(
"harvestUnitCode", CommonConstants.VALID_CODE_NOTBLANK,
@@ -72,5 +82,27 @@ public class SaveDailyWorkValidator implements Validator {
errors.rejectValue("volunteerMHours", CommonConstants.VALID_CODE_NOTBLANK);
errors.rejectValue("volunteerFHours", CommonConstants.VALID_CODE_NOTBLANK);
}
if ((vo.getOwnerTime() != null && vo.getOwnerTime() <= 0)
|| (vo.getSpouseTime() != null && vo.getSpouseTime() <= 0)
|| (vo.getFamilyMHours() != null && vo.getFamilyMHours() <= 0)
|| (vo.getFamilyFHours() != null && vo.getFamilyFHours() <= 0)
|| (vo.getHiredMHours() != null && vo.getHiredMHours() <= 0)
|| (vo.getHiredFHours() != null && vo.getHiredFHours() <= 0)
|| (vo.getSharedMHours() != null && vo.getSharedMHours() <= 0)
|| (vo.getSharedFHours() != null && vo.getSharedFHours() <= 0)
|| (vo.getVolunteerMHours() != null && vo.getVolunteerMHours() <= 0)
|| (vo.getVolunteerFHours() != null && vo.getVolunteerFHours() <= 0)) {
errors.rejectValue("ownerTime", CommonConstants.VALID_CODE_INVALID_ZERO, "노동투입시간은 0 이상 입력해 주세요.");
errors.rejectValue("spouseTime", CommonConstants.VALID_CODE_INVALID_ZERO);
errors.rejectValue("familyMHours", CommonConstants.VALID_CODE_INVALID_ZERO);
errors.rejectValue("familyFHours", CommonConstants.VALID_CODE_INVALID_ZERO);
errors.rejectValue("hiredMHours", CommonConstants.VALID_CODE_INVALID_ZERO);
errors.rejectValue("hiredFHours", CommonConstants.VALID_CODE_INVALID_ZERO);
errors.rejectValue("sharedMHours", CommonConstants.VALID_CODE_INVALID_ZERO);
errors.rejectValue("sharedFHours", CommonConstants.VALID_CODE_INVALID_ZERO);
errors.rejectValue("volunteerMHours", CommonConstants.VALID_CODE_INVALID_ZERO);
errors.rejectValue("volunteerFHours", CommonConstants.VALID_CODE_INVALID_ZERO);
}
}
}

View File

@@ -18,18 +18,18 @@ public class SaveForestProductReqVO {
private String landType;
private String town;
private String cropName;
private String landArea;
private String availableArea;
private String mainYield;
private String mainYieldUnitCode;
private String mainYieldUnit;
private String mainSaleAmount;
private String mainSaleUnitCode;
private String mainSaleUnit;
private String subYield;
private String subYieldUnitCode;
private String subYieldUnit;
private String subSaleAmount;
private String subSaleUnitCode;
private String subSaleUnit;
private String landArea; // 면적(평)
private String availableArea; // 가능면적(평)
private String mainYield; // 주생산물 수확량
private String mainYieldUnitCode; // 주생산물 수확량 단위 (select)
private String mainYieldUnit; // 주생산물 수확량 직접입력 단위
private String mainSaleAmount; // 주생산물 판매량
private String mainSaleUnitCode; // 주생산물 판매량 단위 (select)
private String mainSaleUnit; // 주생산물 판매량 직접입력 단위
private String subYield; // 부생산물 수확량
private String subYieldUnitCode; // 부생산물 수확량 단위 (select)
private String subYieldUnit; // 부생산물 수확량 직접입력 단위
private String subSaleAmount; // 부생산물 판매량
private String subSaleUnitCode; // 부생산물 판매량 단위 (select)
private String subSaleUnit; // 부생산물 판매량 직접입력 단위
}

View File

@@ -1,6 +1,7 @@
package app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.adapters.web.validator;
import app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.adapters.web.model.SaveForestProductReqVO;
import app.module.core.config.constants.CommonConstants;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import org.springframework.validation.Errors;
@@ -21,5 +22,93 @@ public class SaveForestProductValidator implements Validator {
if (!StringUtils.hasText(vo.getCropName())) {
errors.rejectValue("cropName", "error.cropName", "재배 작물명을 입력해주세요.");
}
if (StringUtils.hasText(vo.getLandArea()) && Integer.parseInt(vo.getLandArea()) <= 0) {
errors.rejectValue(
"landArea", CommonConstants.VALID_CODE_INVALID_ZERO,
"면적(평)은 0 이상 입력해 주세요.");
}
if (StringUtils.hasText(vo.getAvailableArea()) && Integer.parseInt(vo.getAvailableArea()) <= 0) {
errors.rejectValue(
"availableArea", CommonConstants.VALID_CODE_INVALID_ZERO,
"가능면적(평)은 0 이상 입력해 주세요.");
}
// 주생산물 수확량
if (StringUtils.hasText(vo.getMainYield()) && Integer.parseInt(vo.getMainYield()) <= 0) {
errors.rejectValue(
"mainYield", CommonConstants.VALID_CODE_INVALID_ZERO,
"주생산물 수확량은 0 이상 입력해 주세요.");
}
if (StringUtils.hasText(vo.getMainYield()) && !StringUtils.hasText(vo.getMainYieldUnitCode())) {
errors.rejectValue(
"mainYieldUnitCode", CommonConstants.VALID_CODE_NOTBLANK,
"주생산물 수확량의 단위를 선택해 주세요.");
}
if (CommonConstants.UNIT_CODE_SELF.equals(vo.getMainYieldUnitCode()) && !StringUtils.hasText(vo.getMainYieldUnit())) {
errors.rejectValue(
"mainYieldUnit", CommonConstants.VALID_CODE_NOTBLANK,
"주생산물 수확량 단위를 입력해 주세요.");
}
// 주생산물 판매량
if (StringUtils.hasText(vo.getMainSaleAmount()) && Integer.parseInt(vo.getMainSaleAmount()) <= 0) {
errors.rejectValue(
"mainSaleAmount", CommonConstants.VALID_CODE_INVALID_ZERO,
"주생산물 판매량은 0 이상 입력해 주세요.");
}
if (StringUtils.hasText(vo.getMainSaleAmount()) && !StringUtils.hasText(vo.getMainSaleUnitCode())) {
errors.rejectValue(
"mainSaleUnitCode", CommonConstants.VALID_CODE_NOTBLANK,
"주생산물 판매량의 단위를 선택해 주세요.");
}
if (CommonConstants.UNIT_CODE_SELF.equals(vo.getMainSaleUnitCode()) && !StringUtils.hasText(vo.getMainSaleUnit())) {
errors.rejectValue(
"mainSaleUnit", CommonConstants.VALID_CODE_NOTBLANK,
"주생산물 판매량 단위를 입력해 주세요.");
}
// 부생산물 수확량
if (StringUtils.hasText(vo.getSubYield()) && Integer.parseInt(vo.getSubYield()) <= 0) {
errors.rejectValue(
"subYield", CommonConstants.VALID_CODE_INVALID_ZERO,
"부생산물 수확량은 0 이상 입력해 주세요.");
}
if (StringUtils.hasText(vo.getSubYield()) && !StringUtils.hasText(vo.getSubYieldUnitCode())) {
errors.rejectValue(
"subYieldUnitCode", CommonConstants.VALID_CODE_NOTBLANK,
"부생산물 수확량의 단위를 선택해 주세요.");
}
if (CommonConstants.UNIT_CODE_SELF.equals(vo.getSubYieldUnitCode()) && !StringUtils.hasText(vo.getSubYieldUnit())) {
errors.rejectValue(
"subYieldUnit", CommonConstants.VALID_CODE_NOTBLANK,
"부생산물 수확량 단위를 입력해 주세요.");
}
// 부생산물 판매량
if (StringUtils.hasText(vo.getSubSaleAmount()) && Integer.parseInt(vo.getSubSaleAmount()) <= 0) {
errors.rejectValue(
"subSaleAmount", CommonConstants.VALID_CODE_INVALID_ZERO,
"부생산물 판매량은 0 이상 입력해 주세요.");
}
if (StringUtils.hasText(vo.getSubSaleAmount()) && !StringUtils.hasText(vo.getSubSaleUnitCode())) {
errors.rejectValue(
"subSaleUnitCode", CommonConstants.VALID_CODE_NOTBLANK,
"부생산물 판매량의 단위를 선택해 주세요.");
}
if (CommonConstants.UNIT_CODE_SELF.equals(vo.getSubSaleUnitCode()) && !StringUtils.hasText(vo.getSubSaleUnit())) {
errors.rejectValue(
"subSaleUnit", CommonConstants.VALID_CODE_NOTBLANK,
"부생산물 판매량 단위를 입력해 주세요.");
}
}
}
}

View File

@@ -58,7 +58,7 @@
bat.income_code, /* 수입부호(엑셀용) */
bat.expense_code, /* 지출부호(엑셀용) */
CASE
WHEN ui_category.id = 'code.bank.input.self'
WHEN ui_category.id = 'code.bank.output.self'
THEN bat.transfer_category
ELSE ui_category.code_text
END AS categoryText, /* 지출의 종류 */

View File

@@ -79,12 +79,7 @@
vs.second_visit_date AS secondVisitDate,
COALESCE(vs.is_gift_sent, false) AS isGiftSent,
r.researcher_name AS researcherName,
r.researcher_phone AS researcherPhone,
h.owner_age, /* 엑셀용 */
h.address, /* 엑셀용 */
h.industry_sub_middle, /* 엑셀용 */
h.industry_detail, /* 엑셀용 */
h.usage_type /* 엑셀용 */
r.researcher_phone AS researcherPhone
FROM v_household_with_code h
CROSS JOIN total_days td
LEFT JOIN daily_progress dp ON h.seq = dp.household_seq

View File

@@ -337,7 +337,6 @@
h.is_panel AS isPanel,
r.researcher_name AS researcherName
FROM v_household_with_code h
LEFT JOIN v_household_visit v ON h.seq = v.household_seq
LEFT JOIN v_household_researcher r ON h.seq = r.household_seq
) AS hvr
<where>
@@ -386,10 +385,10 @@
/* 맵핑 여부 */
<choose>
<when test="cmd.isMapping">
AND r.researcher_name is not null
AND hvr.researcher_name is not null
</when>
<when test="!cmd.isMapping">
AND r.researcher_name is null
AND hvr.researcher_name is null
</when>
</choose>
</if>

View File

@@ -2,6 +2,7 @@ valid.common.required=\uD544\uC218\uC785\uB825 \uD56D\uBAA9\uC785\uB2C8\uB2E4.
valid.common.required.ask=\uD544\uC218\uC785\uB825\uD56D\uBAA9\uC744 \uD655\uC778\uD574\uC8FC\uC138\uC694.
valid.common.required.size={0} \uAC1C \uD56D\uBAA9\uC774 \uB2F4\uACA8\uC788\uC5B4\uC57C \uD569\uB2C8\uB2E4.
valid.common.required.size.min={0} \uAC1C \uC774\uC0C1 \uD56D\uBAA9\uC774 \uD544\uC694\uD569\uB2C8\uB2E4.
valid.common.required.value.min={0} \uC774\uC0C1 \uC785\uB825\uD574 \uC8FC\uC138\uC694.
valid.common.required.remove.item=\uC0AD\uC81C\uD560 \uC544\uC774\uD15C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.
valid.common.email.wrong=\uC774\uBA54\uC77C \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
valid.common.nickname.wrong=\uB2C9\uB124\uC784(2-10\uAE00\uC790)\uC740 \uD55C\uAE00,\uC601\uC5B4 \uB300\uC18C\uBB38\uC790, -, _ \uB9CC \uC785\uB825\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.

View File

@@ -136,7 +136,6 @@ var ajaxUtil = {
if (options.handle422Type === 'field' || !options.handle422Type) {
$(rstData.responseJSON).each((idx, oj) => {
// TODO : form id? or body
let target = $('body').find('[name=' + oj.field + ']');
target.addClass('is-invalid');

View File

@@ -56,7 +56,7 @@
<span class="btn-txt">중복확인</span>
</button>
</div>
<span>4~15자 / 영문,숫자,한글 가능/ 특수문자 _,- 사용가능</span>
<span>2~15자 / 영문,숫자,한글 가능/ 특수문자 _,- 사용가능</span>
</div>
</div>
</td>

View File

@@ -178,9 +178,11 @@
form.price.value = data.price ?? '';
form.sourcePurpose.value = data.sourcePurpose ?? '';
form.transferCategoryCode.value = data.transferCategoryCode ?? '';
form.transferCategory.value = data.transferCategory ?? '';
toggleSelfInput(form.expenseCode.value, form.transferCategory);
toggleSelfInput(form.unitCode.value, form.unit);
// 초기 상태 업데이트
toggleExpenseSelfInput(form.transferCategoryCode);
selectedSelf(form.unitCode);
}
</script>
@@ -255,11 +257,15 @@
f.expenseCode.value = codeValue;
const tr = el.closest('tr');
toggleExpenseSelfInput(el);
}
const toggleExpenseSelfInput = (selectElement) => {
const tr = selectElement.closest('tr');
const selfArea = tr.querySelector('.self-input');
const selfInput = tr.querySelector('.self-input input');
if (el.value?.endsWith('.self')) {
if (selectElement.value?.endsWith('.self')) {
selfInput.disabled = false;
selfArea.classList.remove('input-disabled');
} else {

View File

@@ -148,7 +148,7 @@
</div>
</div>
</td>
<th>가족노동(남)</th>
<th>가족노동(여)</th>
<td>
<div class="component-input">
<div class="input-field">
@@ -169,7 +169,7 @@
</div>
</div>
</td>
<th>고용노동(남)</th>
<th>고용노동(여)</th>
<td>
<div class="component-input">
<div class="input-field">
@@ -190,7 +190,7 @@
</div>
</div>
</td>
<th>품앗이(남)</th>
<th>품앗이(여)</th>
<td>
<div class="component-input">
<div class="input-field">
@@ -211,7 +211,7 @@
</div>
</div>
</td>
<th>일손돕기(남)</th>
<th>일손돕기(여)</th>
<td>
<div class="component-input">
<div class="input-field">

View File

@@ -136,7 +136,7 @@
tbody.append(tmpl);
}
// 은행자동이체내역 수출 테이블 그리기
// 은행자동이체내역 지출 테이블 그리기
const gridBankExpenseTable = (data) => {
const tbody = $('#table-bank-expense tbody');
tbody.empty();

View File

@@ -81,7 +81,6 @@
const tbody = $('.tab-content.forest-product tbody');
tbody.empty();
// TODO(ks) : monthlyStatus 없을 경우 처리 추가... 일단 .. 이렇게 처리 하지만.. 또 다른 방안이 있을지...
if (!response.monthlyStatus || !response.monthlyStatus.forestStatus) {
noDataMonthly(tbody, null, 15);
return;

View File

@@ -1,30 +0,0 @@
package app.module.admin;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import org.springframework.web.filter.CharacterEncodingFilter;
import java.lang.annotation.*;
/**
* MockMvc `application/json` 타입 전송 시 UTF-8 설정 어노테이션
*
* @author Youngmok Kim
* @version 1.0 2022-06-27
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@AutoConfigureMockMvc
@Import(EnableJsonUTF8.Config.class)
public @interface EnableJsonUTF8 {
class Config {
@Bean
public CharacterEncodingFilter characterEncodingFilter() {
return new CharacterEncodingFilter("UTF-8", true);
}
}
}

View File

@@ -1,26 +0,0 @@
package app.module.admin.config.initData;
import app.module.core.config.adapters.persistence.repository.RoleRepo;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@Component
@RequiredArgsConstructor
public class InitAdminUserRoleTestData implements ApplicationRunner {
private final RoleRepo roleRepo;
private final Environment env;
@Override
public void run(ApplicationArguments args) {
if (!env.getProperty("admin.initData.test", Boolean.class)) {
return;
}
// roleRepo.save(new Role("ROLE_SUPER"));
// roleRepo.save(new Role("ROLE_STAFF"));
}
}

View File

@@ -1,72 +0,0 @@
package app.module.admin.config.security;
import app.module.core.usecase.admin.saveAdmin.ports.SaveAdminPortIn;
import app.module.core.usecase.admin.view.ports.AdminViewPortIn;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.TestInstance.Lifecycle;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.web.servlet.MockMvc;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestBuilders.formLogin;
import static org.springframework.security.test.web.servlet.response.SecurityMockMvcResultMatchers.unauthenticated;
@SpringBootTest
@TestPropertySource("classpath:application-override.properties")
@AutoConfigureMockMvc
@TestInstance(Lifecycle.PER_CLASS)
class AdminAuthFailHandlerTest {
static {
System.setProperty("com.amazonaws.sdk.disableEc2Metadata", "true");
}
@Autowired
MockMvc mockMvc;
@Autowired
AdminViewPortIn adminViewPortIn;
@Autowired
SaveAdminPortIn saveAdminPortIn;
@Value("${app.admin.auth.fail.permit}")
Integer loginFailPermit;
String testUsername = "testUser";
@BeforeAll
public void beforeAll() {
/* saveAdminPortIn.connect(
1L,
testUsername,
"test.1@#$",
null,
false,
Arrays.asList("ROLE_SUPER", "ROLE_STAFF"));*/
}
@Test
@DisplayName("operate - 계정 잠김")
void onAuthenticationFailure() throws Exception {
String badPassword = "bad-password.1@#$";
String goodPassword = "test.1@#$";
for (int i = 0; i < loginFailPermit; i++) {
mockMvc.perform(formLogin().user(testUsername).password(badPassword));
}
assertTrue(
adminViewPortIn.connect(testUsername).orElseThrow().getAccountLocked(),
String.format("%s 회 이상 로그인 실패로 계정이 잠김처리되어야 한다.", loginFailPermit));
mockMvc
.perform(formLogin().user(testUsername).password(goodPassword))
.andExpect(unauthenticated());
}
}

View File

@@ -1,71 +0,0 @@
package app.module.admin.config.security;
import app.module.core.usecase.admin.saveAdmin.ports.SaveAdminPortIn;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.TestInstance.Lifecycle;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.web.servlet.MockMvc;
import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestBuilders.formLogin;
import static org.springframework.security.test.web.servlet.response.SecurityMockMvcResultMatchers.authenticated;
import static org.springframework.security.test.web.servlet.response.SecurityMockMvcResultMatchers.unauthenticated;
@SpringBootTest
@TestPropertySource("classpath:application-override.properties")
@AutoConfigureMockMvc
@TestInstance(Lifecycle.PER_CLASS)
class AdminDetailsServiceTest {
static {
System.setProperty("com.amazonaws.sdk.disableEc2Metadata", "true");
}
@Autowired
MockMvc mockMvc;
@Autowired
SaveAdminPortIn saveAdminPortIn;
String username = "test";
String password = "test.1@#$";
String oldUsername = "admin_for_old_password_test";
@BeforeAll
public void beforeAll() {
/* saveAdminPortIn.connect(
1L,
username,
password,
null,
false,
Arrays.asList("ROLE_SUPER", "ROLE_STAFF"));*/
}
@Test
@DisplayName("operate - 로그인 성공")
void operate1() throws Exception {
mockMvc.perform(formLogin().user(username).password(password)).andExpect(authenticated());
}
@Test
@DisplayName("operate - 로그인 실패")
void operate2() throws Exception {
String badPassword = "bad-password.1@#$";
mockMvc.perform(formLogin().user(username).password(badPassword))
.andExpect(unauthenticated());
}
// @Test
// @DisplayName("operate - 패스워드 유효기간 지남")
// void operate3() throws Exception {
//
// mockMvc.perform(formLogin().user(oldUsername).password(password)).andExpect(unauthenticated());
// }
}

View File

@@ -1,55 +0,0 @@
package app.module.admin.feature.admin.repository.dao;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
@Slf4j
class AdminCreateUpdateDaoTest {
static {
System.setProperty("com.amazonaws.sdk.disableEc2Metadata", "true");
}
/* @Autowired
SaveAdminPortOut adminCreateUpdateDao;
@Autowired
AdminViewPortIn adminViewPortIn;
@Autowired
SaveAdminPortIn saveAdminPortIn;*/
@Test
@DisplayName("operate - AdminCreateDao")
void operate() {
/* saveAdminPortIn.connect(
1L,
"admin_for_createDao_test",
"test.1@#$",
null,
false,
Arrays.asList("ROLE_SUPER", "ROLE_STAFF"));
adminViewPortIn
.connect("admin_for_createDao_test")
.ifPresent(
retrieveUser ->
assertEquals(
Arrays.asList("ROLE_SUPER", "ROLE_STAFF").size(),
retrieveUser.getRoles().size()));
saveAdminPortIn.connect(
2L,
"admin_for_createDao_test",
"test.1@#$",
null,
false,
List.of("ROLE_STAFF"));
assertEquals(
1,
adminViewPortIn.connect("admin_for_createDao_test").orElseThrow().getRoles().size(),
"기존 권한들을 (내부적으로) 삭제하고 새로이 추가 등록되기에 withRoles 의 size 는 1이다.");*/
}
}

View File

@@ -1,11 +0,0 @@
# disable JNDI lookup
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.JndiDataSourceAutoConfiguration
spring.profiles.active=local
spring.jpa.hibernate.ddl-auto=create
spring.datasource.url=jdbc:h2:~/test;
spring.datasource.username=sa
spring.datasource.password=
spring.datasource.driver-class-name=org.h2.Driver
spring.jpa.properties.hibernate.show_sql=true
logging.level.org.hibernate.type.descriptor.sql=trace
admin.initData.test=true

View File

@@ -1,35 +0,0 @@
package app.module.core.config.adapters.persistence.entity;
import app.module.core.config.adapters.persistence.component.AuditEntity;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.time.LocalDateTime;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class Admin extends AuditEntity {
private Long seq;
private String id;
private String password;
private String email;
private LocalDateTime passwordUpdatedAt;
private Boolean accountDisabled;
private Integer loginFailCnt;
private Boolean accountLocked;
public Admin(String id) {
this.id = id;
}
}

View File

@@ -1,18 +0,0 @@
package app.module.core.config.adapters.persistence.entity;
import app.module.core.config.adapters.persistence.component.AuditEntity;
import lombok.*;
@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AdminHasRole extends AuditEntity {
private Long id;
private String adminId;
private String roleId;
}

View File

@@ -1,53 +0,0 @@
package app.module.core.config.adapters.persistence.entity;
import app.module.core.config.adapters.persistence.component.AuditEntity;
import app.module.core.config.application.enums.SignUpType;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.time.LocalDateTime;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class FrontUser extends AuditEntity {
private String id;
private String password;
private String email;
private String nickname;
private SignUpType signUpType;
private LocalDateTime passwordUpdatedAt;
private Boolean accountDisabled;
private Integer loginFailCnt;
private Boolean accountLocked;
// private String roleId;
private String uploadFileId;
public FrontUser(String id) {
this.id = id;
}
public FrontUser(String id, String email, String nickname, Boolean accountDisabled,
Integer loginFailCnt, Boolean accountLocked) {
this.id = id;
this.email = email;
this.nickname = nickname;
this.accountDisabled = accountDisabled;
this.loginFailCnt = loginFailCnt;
this.accountLocked = accountLocked;
}
}

View File

@@ -1,18 +0,0 @@
package app.module.core.config.adapters.persistence.entity;
import app.module.core.config.adapters.persistence.component.AuditEntity;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
public class FrontUserHasRole extends AuditEntity {
private Long id;
private String frontUSerId;
private String roleId;
}

View File

@@ -1,22 +0,0 @@
package app.module.core.config.adapters.persistence.entity;
import app.module.core.config.adapters.persistence.component.AuditEntity;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class FrontUserHasUploadFile extends AuditEntity {
private String frontUserId;
private Long uploadFilesId;
public FrontUserHasUploadFile(String frontUserId) {
this.frontUserId = frontUserId;
}
}

View File

@@ -1,50 +0,0 @@
package app.module.core.config.adapters.persistence.entity;
import app.module.core.config.adapters.persistence.component.AuditEntity;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class Household extends AuditEntity {
private Long id;
private String householdNum;
private String ownerName;
private Integer ownerAge;
private String tel;
private String phone;
private String password;
private String region;
private String city;
private String addressDetail;
private Integer industryLargeCode;
private Integer industryMiddleCode;
private Integer industrySmallCode;
private Integer scaleCode;
private Integer employmentType;
private Boolean isPanel;
private String memo;
private String dropReason;
}

View File

@@ -1,22 +0,0 @@
package app.module.core.config.adapters.persistence.entity;
import app.module.core.config.adapters.persistence.component.AuditEntity;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class NoticeHasUploadFile extends AuditEntity {
private Long noticeId;
private Long uploadFilesId;
public NoticeHasUploadFile(Long noticeId) {
this.noticeId = noticeId;
}
}

View File

@@ -1,28 +0,0 @@
package app.module.core.config.adapters.persistence.entity;
import app.module.core.config.adapters.persistence.component.AuditEntity;
import app.module.core.config.application.enums.AppType;
import app.module.core.config.application.enums.OperationLogType;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class OperationLog extends AuditEntity {
private Long id;
private AppType appType;
private OperationLogType operationLogType;
private String targetId;
private String ip;
private String taskDesc;
}

View File

@@ -1,23 +0,0 @@
package app.module.core.config.adapters.persistence.entity;
import app.module.core.config.adapters.persistence.component.AuditEntity;
import lombok.Getter;
import lombok.Setter;
import java.util.Date;
/**
* Spring Security - Remember me 기능을 위한 엔티티
*/
@Getter
@Setter
public class PersistentLogins extends AuditEntity {
private String series;
private String username;
private String token;
private Date lastUsed;
}

View File

@@ -1,18 +0,0 @@
package app.module.core.config.adapters.persistence.entity;
import app.module.core.config.adapters.persistence.component.AuditEntity;
import lombok.*;
@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class UriHasRole extends AuditEntity {
private Long id;
private String uriId;
private String roleId;
}

View File

@@ -1,8 +0,0 @@
package app.module.core.config.adapters.persistence.repository;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface AdminRepo {
}

View File

@@ -1,8 +0,0 @@
package app.module.core.config.adapters.persistence.repository;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface OperationLogRepo {
}

View File

@@ -1,14 +0,0 @@
package app.module.core.config.adapters.persistence.repository;
import app.module.core.config.adapters.persistence.entity.Role;
import app.module.core.config.application.enums.AppType;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.data.domain.Sort;
import java.util.List;
@Mapper
public interface RoleRepo {
List<Role> findAllByAppType(AppType appType, Sort sort);
}

View File

@@ -1,8 +0,0 @@
package app.module.core.config.adapters.persistence.repository;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface UICodeRepo {
}

View File

@@ -1,8 +0,0 @@
package app.module.core.config.adapters.persistence.repository;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface URIRepo {
}

View File

@@ -1,8 +0,0 @@
package app.module.core.config.adapters.persistence.repository;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface UploadFileRepo {
}

View File

@@ -7,8 +7,7 @@ import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
public enum FileStorageType {
LOCAL("로컬 스토리지"),
S3("AWS S3 스토리지"),
SFTP("SFTP");
S3("AWS S3 스토리지");
private final String desc;
private String name;

View File

@@ -13,7 +13,7 @@ public enum FileUploadType {
// URI og:image 용 이미지 파일
OG_IMAGE(Set.of(FileStorageType.LOCAL), "/ogImage", Set.of(AcceptableFileType.IMAGE)),
// WEB Editor 이미지 파일
EDITOR_IMAGE(Set.of(FileStorageType.SFTP,FileStorageType.LOCAL), "/editorImage", Set.of(AcceptableFileType.IMAGE)),
EDITOR_IMAGE(Set.of(FileStorageType.LOCAL), "/editorImage", Set.of(AcceptableFileType.IMAGE)),
PUBLIC(
Set.of(FileStorageType.LOCAL),
@@ -43,7 +43,6 @@ public enum FileUploadType {
AcceptableFileType.ZIP)),
NOTICE(
Set.of(
FileStorageType.SFTP,
FileStorageType.LOCAL
),
"/notice",
@@ -58,14 +57,14 @@ public enum FileUploadType {
AcceptableFileType.PDF,
AcceptableFileType.ZIP)),
INCOME(
Set.of(FileStorageType.SFTP,FileStorageType.LOCAL),
Set.of(FileStorageType.LOCAL),
"/income",
Set.of(
AcceptableFileType.IMAGE
)
),
EXPENSE(
Set.of(FileStorageType.SFTP,FileStorageType.LOCAL),
Set.of(FileStorageType.LOCAL),
"/expense",
Set.of(
AcceptableFileType.IMAGE

View File

@@ -1,12 +0,0 @@
package app.module.core.config.application.enums;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
@Getter
@RequiredArgsConstructor
public enum UiCodeType {
REGION_MAIN("code.region.main"),
REGION_SUB("code.region.sub");
private final String code;
}

View File

@@ -1,96 +0,0 @@
package app.module.core.config.application.util;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.StandardCharsets;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.Base64;
@Slf4j
@Component
public class AESEncryptUtil {
@Value("${aes.secret-key}")
private String key;
@Value("${encrypt.aes.iv}")
private String iv;
private static final String AES_ALGORITHM = "AES/CBC/PKCS5PADDING";
public static final String ENCRYPT_IV = "0123456789ABCDEF";
public String encrypt(String text)
throws NoSuchPaddingException, NoSuchAlgorithmException, BadPaddingException,
IllegalBlockSizeException, InvalidAlgorithmParameterException, InvalidKeyException {
Cipher cipher = Cipher.getInstance(getTransformation());
SecretKeySpec keySpec = new SecretKeySpec(key.getBytes(), "AES");
IvParameterSpec ivParamSpec = new IvParameterSpec(iv.getBytes());
cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivParamSpec);
byte[] encrypted = cipher.doFinal(text.getBytes(StandardCharsets.UTF_8));
return Base64.getEncoder().encodeToString(encrypted);
}
public String decrypt(String cipherText)
throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidAlgorithmParameterException,
InvalidKeyException, BadPaddingException, IllegalBlockSizeException {
Cipher cipher = Cipher.getInstance(getTransformation());
SecretKeySpec keySpec = new SecretKeySpec(key.getBytes(), "AES");
IvParameterSpec ivParamSpec = new IvParameterSpec(iv.getBytes());
cipher.init(Cipher.DECRYPT_MODE, keySpec, ivParamSpec);
byte[] decodedBytes = Base64.getDecoder().decode(cipherText);
byte[] decrypted = cipher.doFinal(decodedBytes);
return new String(decrypted, StandardCharsets.UTF_8);
}
public byte[] encryptAesCbc(byte[] plainData) {
if (plainData == null || plainData.length == 0) {
throw new IllegalArgumentException("데이터는 null이거나 비어 있을 수 없습니다.");
}
try {
SecretKeySpec keySpec = new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), "AES");
IvParameterSpec ivSpec = new IvParameterSpec(ENCRYPT_IV.getBytes(StandardCharsets.UTF_8));
Cipher cipher = Cipher.getInstance(AES_ALGORITHM);
cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec);
return org.apache.commons.codec.binary.Base64.encodeBase64(cipher.doFinal(plainData));
} catch (Exception e) {
log.error("바이너리 데이터 암호화 실패", e);
throw new RuntimeException("바이너리 데이터 암호화 실패", e);
}
}
public byte[] decryptAesCbc(byte[] cipherData) {
if (cipherData == null || cipherData.length == 0) {
throw new IllegalArgumentException("암호문은 null이거나 비어 있을 수 없습니다.");
}
try {
byte[] encrypted = org.apache.commons.codec.binary.Base64.decodeBase64(cipherData);
SecretKeySpec keySpec = new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), "AES");
IvParameterSpec ivSpec = new IvParameterSpec(ENCRYPT_IV.getBytes(StandardCharsets.UTF_8));
Cipher cipher = Cipher.getInstance(AES_ALGORITHM);
cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec);
return cipher.doFinal(encrypted);
} catch (Exception e) {
log.error("바이너리 데이터 복호화 실패", e);
throw new RuntimeException("바이너리 데이터 복호화 실패", e);
}
}
private String getTransformation() {
return "AES/CBC/PKCS5Padding";
}
}

View File

@@ -1,130 +0,0 @@
package app.module.core.config.application.util;
import app.module.core.usecase.file.getFile.adapters.persistence.GetFileMapper;
import app.module.core.usecase.file.getFile.ports.application.domain.GetFile;
import app.module.core.usecase.file.saveToStorage.ports.application.strategy.SftpConnector;
import app.module.core.usecase.file.updateFile.adapters.persistence.UpdateFileMapper;
import app.module.core.usecase.file.updateFile.ports.application.domain.UploadFileDto;
import com.jcraft.jsch.ChannelSftp;
import com.jcraft.jsch.JSchException;
import com.jcraft.jsch.SftpException;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.nio.file.Paths;
@Slf4j
@Component
@RequiredArgsConstructor
public class SftpFileDeleteUtil {
private final SftpConnector sftpConnector;
private final GetFileMapper getFileMapper;
private final UpdateFileMapper updateFileMapper;
@Value("${path.upload.sftp.public}")
private String publicPath;
/**
* SFTP 서버에서 파일을 삭제하는 공통 메서드
* @param deleteFile 삭제할 파일 정보
* @throws JSchException SFTP 연결 오류
* @throws SftpException SFTP 작업 오류
*/
public void deleteRealFile(UploadFileDto deleteFile) throws JSchException, SftpException {
if (deleteFile == null || deleteFile.getPath() == null || deleteFile.getName() == null) {
log.error("Invalid file information: {}", deleteFile);
throw new IllegalArgumentException("Invalid file information");
}
// 경로 검증 및 생성
String filePath = constructSafeFilePath(deleteFile.getPath(), deleteFile.getName());
log.info("Attempting to delete file from SFTP: {}", filePath);
// SFTP 연결 확인 및 재연결
if (!sftpConnector.isConnected()) {
log.warn("SFTP connection lost, attempting to reconnect");
sftpConnector.connect();
}
ChannelSftp channelSftp = sftpConnector.getChannelSftp();
if (channelSftp == null) {
log.error("SFTP channel is not initialized");
throw new SftpException(ChannelSftp.SSH_FX_NO_CONNECTION, "SFTP channel is not initialized");
}
// 파일 삭제
try {
channelSftp.stat(filePath); // 파일 존재 여부 확인
channelSftp.rm(filePath);
log.info("File deleted successfully from SFTP: {}", filePath);
} catch (SftpException e) {
if (e.id == ChannelSftp.SSH_FX_NO_SUCH_FILE) {
log.warn("File does not exist on SFTP: {}", filePath);
} else {
log.error("Failed to delete file from SFTP: {}, error: {}", filePath, e.getMessage(), e);
throw e;
}
}
}
public void deleteRealFile(Long deleteFileId) throws JSchException, SftpException {
GetFile deleteFile = getFileMapper.findById(deleteFileId).orElseThrow();
updateFileMapper.deleteReceiptFile(deleteFileId,CommonUtil.getLoginUsername());
if (deleteFile == null || deleteFile.getPath() == null || deleteFile.getName() == null) {
log.error("Invalid file information: {}", deleteFile);
throw new IllegalArgumentException("Invalid file information");
}
// 경로 검증 및 생성
String filePath = constructSafeFilePath(deleteFile.getPath(), deleteFile.getName());
log.info("Attempting to delete file from SFTP: {}", filePath);
// SFTP 연결 확인 및 재연결
if (!sftpConnector.isConnected()) {
log.warn("SFTP connection lost, attempting to reconnect");
sftpConnector.connect();
}
ChannelSftp channelSftp = sftpConnector.getChannelSftp();
if (channelSftp == null) {
log.error("SFTP channel is not initialized");
throw new SftpException(ChannelSftp.SSH_FX_NO_CONNECTION, "SFTP channel is not initialized");
}
// 파일 삭제
try {
channelSftp.stat(filePath); // 파일 존재 여부 확인
channelSftp.rm(filePath);
log.info("File deleted successfully from SFTP: {}", filePath);
} catch (SftpException e) {
if (e.id == ChannelSftp.SSH_FX_NO_SUCH_FILE) {
log.warn("File does not exist on SFTP: {}", filePath);
} else {
log.error("Failed to delete file from SFTP: {}, error: {}", filePath, e.getMessage(), e);
throw e;
}
}
}
/**
* 경로 조작 방지를 위해 안전한 파일 경로 생성
*/
private String constructSafeFilePath(String subPath, String fileName) {
// 경로 및 파일 이름 정규화
String normalizedSubPath = Paths.get(subPath).normalize().toString().replace("\\", "/");
String normalizedFileName = Paths.get(fileName).getFileName().toString();
String safePath = CommonUtil.removeLastChar(publicPath, "/") + "/" + normalizedSubPath + "/" + normalizedFileName;
// 경로가 publicPath로 시작하는지 검증
if (!safePath.startsWith(publicPath)) {
log.error("Invalid file path detected: {}", safePath);
throw new IllegalArgumentException("Invalid file path: " + safePath);
}
return safePath;
}
}

View File

@@ -1,102 +0,0 @@
package app.module.core.config.application.util;
import app.module.core.usecase.file.getFile.ports.application.domain.GetFile;
import app.module.core.usecase.file.saveToStorage.ports.application.strategy.SftpConnector;
import com.jcraft.jsch.ChannelSftp;
import com.jcraft.jsch.JSchException;
import com.jcraft.jsch.SftpException;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
@Slf4j
@Component
@RequiredArgsConstructor
public class SftpFileDownloader {
private final SftpConnector sftpConnector;
private final AESEncryptUtil encryptUtil;
@Value("${path.upload.sftp.public}")
private String publicPath;
@Value("${file.download.base-path:/tmp/downloads}")
private String defaultDownloadBasePath;
public void downloadFile(GetFile file) throws JSchException, SftpException, IOException {
// SFTP 연결 확인 및 재연결
if (!sftpConnector.isConnected()) {
log.info("SFTP connection lost, attempting to reconnect");
sftpConnector.connect();
}
ChannelSftp channelSftp = sftpConnector.getChannelSftp();
if (channelSftp == null) {
throw new SftpException(ChannelSftp.SSH_FX_NO_CONNECTION, "SFTP channel is not initialized");
}
try {
// 원격 파일 경로 (암호화된 파일명 사용)
String remoteFilePath = CommonUtil.removeLastChar(publicPath, "/") + file.getPath() + "/" +"encrypted_"+ file.getName();
log.info("Remote file path: {}", remoteFilePath);
// 다운로드 경로 정규화
String basePath = CommonUtil.normalizePath(defaultDownloadBasePath);
log.info("Base path: {}", basePath);
String localEncryptedFilePath = basePath + File.separator + "encrypted_" + file.getOriginName();
String localDecryptedFilePath = basePath + File.separator + file.getOriginName();
log.info("Local encrypted file path: {}", localEncryptedFilePath);
log.info("Local decrypted file path: {}", localDecryptedFilePath);
// 로컬 디렉토리 생성
File localDir = new File(localEncryptedFilePath).getParentFile();
CommonUtil.createDirectories(localDir);
// 원격 파일 존재 여부 확인 (디버깅 용)
try {
channelSftp.lstat(remoteFilePath);
log.info("Remote file exists: {}", remoteFilePath);
} catch (SftpException e) {
log.error("Remote file does not exist: {}", remoteFilePath, e);
throw new SftpException(ChannelSftp.SSH_FX_NO_SUCH_FILE, "Remote file does not exist: " + remoteFilePath);
}
// 암호화된 파일 다운로드
try (FileOutputStream fos = new FileOutputStream(localEncryptedFilePath)) {
channelSftp.get(remoteFilePath, fos);
log.info("File downloaded to: {}", localEncryptedFilePath);
}
// 파일 복호화
try {
byte[] encryptedContent = Files.readAllBytes(Paths.get(localEncryptedFilePath));
byte[] decryptedContent = encryptUtil.decryptAesCbc(encryptedContent);
Files.write(Paths.get(localDecryptedFilePath), decryptedContent);
log.info("File decrypted and saved to: {}", localDecryptedFilePath);
file.setLocalPath(localDecryptedFilePath);
} catch (Exception e) {
log.error("Failed to decrypt file: {}", file.getOriginName(), e);
throw new IOException("Failed to decrypt file", e);
} finally {
// 암호화된 임시 파일 삭제
Files.deleteIfExists(Paths.get(localEncryptedFilePath));
log.info("Temporary encrypted file deleted: {}", localEncryptedFilePath);
}
} catch (SftpException e) {
log.error("Failed to download file: {} (Error: {})", file.getOriginName(), e.getMessage());
throw e;
} catch (IOException e) {
log.error("IO error during file download or decryption: {}", file.getOriginName(), e);
throw e;
} catch (Exception e) {
log.error("Unexpected error during file download: {}", file.getOriginName(), e);
throw new RuntimeException("Unexpected error during file download", e);
}
}
}

View File

@@ -17,14 +17,14 @@ public final class CommonConstants {
/**
* 관리자 아이디 생성 규칙
* [정책] 아이디: 4~15자, 영문/숫자/한글/특수문자(_,-) 허용
* [정책] 아이디: 2~15자, 영문/숫자/한글/특수문자(_,-) 허용
*/
public static final String ADMIN_ID_REGEX = "^[a-zA-Z0-9가-힣_-]{4,15}$";
public static final String ADMIN_ID_REGEX = "^[a-zA-Z0-9가-힣_-]{2,15}$";
/**
* 관리자 아이디 유효성 실패 메시지
*/
public static final String ADMIN_ID_MSG = "아이디는 4~15자, 영문/숫자/한글/특수문자(_,-)만 가능합니다.";
public static final String ADMIN_ID_MSG = "아이디는 2~15자, 영문/숫자/한글/특수문자(_,-)만 가능합니다.";
/**
* 관리자 비밀번호 생성 규칙
@@ -42,9 +42,19 @@ public final class CommonConstants {
*/
public static final String VALID_CODE_NOTBLANK = "valid.common.required";
/**
* Validator NotBlank errorCode
*/
public static final String VALID_CODE_NOTZERO = "valid.common.notZero";
/**
* 핸드폰 번호 규칙
*/
public static final String PHONE_REGEX = "^01([0|1|6|7|8|9])-?([0-9]{3,4})-?([0-9]{4})$";
/**
* Validator Invalid Zero errorCode
*/
public static final String VALID_CODE_INVALID_ZERO = "valid.common.required.value.min";
}

View File

@@ -46,7 +46,7 @@ public final class DailyRecordConstants {
* 일계부 등록 가능 일
* [정책] 해당월 15일까지는 이전달 데이터 등록 가능
* 날짜 기준 정책
* TODO 15로 변경
* 임시로 31일로 설정해둠 15일로 변경해야됨.
*/
public static final int REGISTER_LIMIT_DAY = 31;
@@ -61,7 +61,7 @@ public final class DailyRecordConstants {
* 일계부 수정 가능 일
* [정책] 해당월 15일까지는 이전달 데이터 수정 가능
* 날짜 기준 정책
* TODO : 15로 변경
* 임시로 31일로 설정해둠 15일로 변경해야됨.
*/
public static final int MODIFY_LIMIT_DAY = 31;

View File

@@ -45,7 +45,6 @@ public class CreateCellService implements CreateCellPortIn {
cell.setCellValue(Double.parseDouble(String.valueOf(cellValue)));
} catch (NumberFormatException e) {
cell.setCellValue(String.valueOf(cellValue)); // 숫자로 변환 불가 시 문자열로 처리
// TODO: 로깅 또는 예외 처리
}
}
break;
@@ -83,10 +82,6 @@ public class CreateCellService implements CreateCellPortIn {
// 셀 스타일 적용 (null 체크)
if (cellConfig.getCellStyle() != null) {
cell.setCellStyle(cellConfig.getCellStyle());
//} else {
// TODO: cellConfig.getCellStyle()이 null인 경우, 워크북에서 새로운 스타일을 생성하거나 기본 스타일을 적용하는 로직 고려
// XSSFWorkbook workbook = (XSSFWorkbook) sheet.getWorkbook();
// cell.setCellStyle(workbook.createCellStyle());
}
// MERGE 병합
@@ -108,7 +103,7 @@ public class CreateCellService implements CreateCellPortIn {
private void setMergedRegionBorderStyle(
XSSFCellStyle style, CellRangeAddress cellRangeAddress, Sheet sheet) {
if (style == null) {
// TODO: 스타일이 제공되지 않으면 경고 로깅 또는 기본 스타일 적용 고려
// 스타일이 제공되지 않으면 경고 로깅 또는 기본 스타일 적용 고려
return;
}

View File

@@ -1,6 +1,6 @@
package app.module.core.usecase.file.createFile.adapters.persistence;
import app.module.core.config.adapters.persistence.entity.UploadFile;
import app.module.core.usecase.file.model.UploadFile;
import app.module.core.config.application.enums.FileStorageType;
import app.module.core.usecase.file.createFile.ports.CreateFilePortOut;
import app.module.core.usecase.file.createFile.ports.application.domain.CreateFile;

View File

@@ -1,6 +1,6 @@
package app.module.core.usecase.file.createFile.adapters.persistence;
import app.module.core.config.adapters.persistence.entity.UploadFile;
import app.module.core.usecase.file.model.UploadFile;
import org.apache.ibatis.annotations.Mapper;
@Mapper

View File

@@ -1,60 +0,0 @@
package app.module.core.usecase.file.downloadFile.adapters;
import app.module.core.config.application.util.SftpFileDownloader;
import app.module.core.usecase.file.getFile.ports.GetFilePortIn;
import app.module.core.usecase.file.getFile.ports.application.domain.GetFile;
import app.module.core.usecase.file.getFile.ports.application.domain.GetFileCmd;
import com.jcraft.jsch.JSchException;
import com.jcraft.jsch.SftpException;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.io.FileSystemResource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import java.io.File;
import java.io.IOException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
@Slf4j
@RestController
@RequiredArgsConstructor
class DownloadFileController {
private final GetFilePortIn getFilePortIn;
private final SftpFileDownloader sftpFileDownloader;
@GetMapping(path = "/api/file/download/{fileId}")
ResponseEntity<?> downloadFile(@PathVariable Long fileId) throws JSchException, SftpException, IOException {
GetFile file = getFilePortIn.operate(new GetFileCmd(fileId)).orElseThrow(() -> new IllegalArgumentException("File not found: " + fileId));
// SFTP에서 파일 다운로드
sftpFileDownloader.downloadFile(file);
// 로컬 파일 경로
File downloadedFile = new File(file.getLocalPath());
if (!downloadedFile.exists()) {
throw new IllegalStateException("파일 다운로드에 실패하였습니다.");
}
String encodedFileName = URLEncoder.encode(file.getOriginName(), StandardCharsets.UTF_8)
.replace("+", "%20");
// HTTP 헤더 설정
HttpHeaders headers = new HttpHeaders();
headers.add(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename*=UTF-8''" + encodedFileName);
headers.add(HttpHeaders.CACHE_CONTROL, "no-cache, no-store, must-revalidate");
headers.add(HttpHeaders.PRAGMA, "no-cache");
headers.add(HttpHeaders.EXPIRES, "0");
return ResponseEntity.ok()
.headers(headers)
.contentLength(downloadedFile.length())
.contentType(MediaType.APPLICATION_OCTET_STREAM)
.body(new FileSystemResource(downloadedFile));
}
}

View File

@@ -1,4 +1,4 @@
package app.module.core.config.adapters.persistence.entity;
package app.module.core.usecase.file.model;
import app.module.core.config.adapters.persistence.component.AuditEntity;
import app.module.core.config.application.enums.FileUploadType;

View File

@@ -1,71 +0,0 @@
package app.module.core.usecase.file.saveToStorage.ports.application.strategy;
import com.jcraft.jsch.ChannelSftp;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.JSchException;
import com.jcraft.jsch.Session;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component
@Slf4j
public class SftpConnector {
@Value("${file.upload.sftp.ip}")
private String host;
@Value("${file.upload.sftp.id}")
private String id;
@Value("${file.upload.sftp.password}")
private String password;
@Value("${file.upload.sftp.port}")
private int port;
private Session session;
private ChannelSftp channelSftp;
public void connect() throws JSchException {
if (host == null || id == null || password == null) {
throw new IllegalStateException("SFTP configuration is incomplete: host=" + host + ", id=" + id + ", password=" + (password != null ? "****" : null));
}
try {
JSch jsch = new JSch();
// 세션 설정
session = jsch.getSession(id, host, port);
session.setPassword(password);
// 호스트 키 검증 비활성화 (개발 환경에서만 사용, 프로덕션에서는 적절히 설정)
session.setConfig("StrictHostKeyChecking", "no");
// 연결
session.connect();
// SFTP 채널 열기
channelSftp = (ChannelSftp) session.openChannel("sftp");
channelSftp.connect();
log.info("SFTP connection established successfully");
}catch (JSchException e){
log.error("Failed to connect to SFTP server", e);
}
}
public void disconnect() {
if (channelSftp != null && channelSftp.isConnected()) {
channelSftp.disconnect();
log.info("SFTP channel disconnected");
}
if (session != null && session.isConnected()) {
session.disconnect();
log.info("SFTP channel disconnected");
}
}
public boolean isConnected() {
return channelSftp != null && channelSftp.isConnected() && session != null && session.isConnected();
}
// ChannelSftp 객체 반환
public ChannelSftp getChannelSftp() {
return channelSftp;
}
}

View File

@@ -1,129 +0,0 @@
package app.module.core.usecase.file.saveToStorage.ports.application.strategy;
import app.module.core.config.application.enums.FileStorageType;
import app.module.core.config.application.util.AESEncryptUtil;
import app.module.core.config.application.util.CommonUtil;
import com.jcraft.jsch.ChannelSftp;
import com.jcraft.jsch.JSchException;
import com.jcraft.jsch.SftpException;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.ByteArrayInputStream;
import java.io.IOException;
@Service
@RequiredArgsConstructor
@Slf4j
public class SftpStorageFileUploadStrategy implements FileUploadStrategy {
@Value("${path.upload.sftp.public}")
private String publicPath;
private final SftpConnector sftpConnector;
private final AESEncryptUtil aesEncryptUtil;
@PostConstruct
public void initialize() throws Exception {
log.info("FileIoService - initialize : path.upload.public is {}", publicPath);
try {
// SFTP 연결 초기화
sftpConnector.connect();
// 원격 디렉토리 생성
createRemoteDirectories(publicPath);
} catch (JSchException | SftpException e) {
throw new IOException("Could not initialize SFTP connection or directories", e);
}
}
private void createRemoteDirectories(String path) throws SftpException {
ChannelSftp channelSftp = sftpConnector.getChannelSftp();
if (channelSftp != null) {
String[] folders = path.split("/");
String currentPath = "";
for (String folder : folders) {
if (!folder.isEmpty()) {
currentPath += "/" + folder;
try {
channelSftp.cd(currentPath);
} catch (SftpException e) {
channelSftp.mkdir(currentPath);
channelSftp.cd(currentPath);
}
}
}
}
}
@Override
public FileStorageType getStorageType() {
return FileStorageType.SFTP;
}
@Override
public void operate(MultipartFile multipartFile, String createSubPath, String createFilename) throws IOException {
if (multipartFile == null || multipartFile.isEmpty()) {
throw new IllegalArgumentException("파일이 비어 있거나 null입니다.");
}
// 경로 조작 방지를 위해 subPath와 filename 유효성 검사
if (createSubPath == null || createSubPath.contains("..") || createFilename == null || createFilename.contains("..")) {
throw new IllegalArgumentException("잘못된 파일 경로 또는 이름입니다.");
}
// 메모리 내에서 파일 암호화
byte[] encryptedContent;
try {
byte[] fileContent = multipartFile.getBytes(); // 파일을 메모리로 직접 읽음
encryptedContent = aesEncryptUtil.encryptAesCbc(fileContent); // 암호화
} catch (Exception e) {
log.error("파일 암호화 실패: {}", createFilename, e);
throw new IOException("파일 암호화에 실패했습니다.", e);
}
// SFTP 경로 생성
String remotePath = CommonUtil.removeLastChar(publicPath, "/") + createSubPath;
String remoteFilePath = remotePath + "/encrypted_" + createFilename;
// SFTP 업로드
try {
// 연결 상태 확인 및 재연결 (최대 3회 시도)
int retryCount = 0;
while (!sftpConnector.isConnected() && retryCount < 3) {
log.warn("SFTP 연결이 끊겼습니다. 재연결 시도 {}회", retryCount + 1);
sftpConnector.connect();
retryCount++;
}
if (!sftpConnector.isConnected()) {
throw new IOException("SFTP 서버에 연결할 수 없습니다.");
}
createRemoteDirectories(remotePath);
ChannelSftp channelSftp = sftpConnector.getChannelSftp();
if (channelSftp == null) {
throw new SftpException(ChannelSftp.SSH_FX_NO_CONNECTION, "SFTP 채널이 초기화되지 않았습니다.");
}
// 암호화된 내용을 SFTP에 직접 업로드
try (ByteArrayInputStream encryptedInputStream = new ByteArrayInputStream(encryptedContent)) {
channelSftp.put(encryptedInputStream, remoteFilePath);
channelSftp.chmod(0644, remoteFilePath); // 파일 권한 설정
log.info("암호화된 파일이 SFTP에 업로드되었습니다: {}", remoteFilePath);
}
} catch (SftpException | JSchException e) {
log.error("SFTP 업로드 실패: {}", remoteFilePath, e);
throw new IOException("SFTP에 파일 업로드 실패", e);
}
}
@PreDestroy
public void cleanup() {
sftpConnector.disconnect();
}
}

View File

@@ -2,7 +2,6 @@ package app.module.core.usecase.file.updateFile.adapters.persistence;
import app.module.core.config.application.annotation.DeleteCommand;
import app.module.core.config.application.util.AuditUtil;
import app.module.core.config.application.util.SftpFileDeleteUtil;
import app.module.core.usecase.file.updateFile.ports.UpdateFilePortOut;
import app.module.core.usecase.file.updateFile.ports.application.domain.UpdateFileCmd;
import app.module.core.usecase.file.updateFile.ports.application.domain.UpdateUploadFileParam;
@@ -18,7 +17,6 @@ import java.util.List;
@RequiredArgsConstructor
class UpdateFileDao implements UpdateFilePortOut {
private final UpdateFileMapper mapper;
private final SftpFileDeleteUtil sftpFileDeleteUtil;
@Override
@DeleteCommand
@@ -30,18 +28,6 @@ class UpdateFileDao implements UpdateFilePortOut {
command.getType().getName()
)));
/* for (UploadFileDto file : deletedFileList) {
try {
sftpFileDeleteUtil.deleteRealFile(file);
} catch (JSchException | SftpException e) {
log.error("Failed to delete file from SFTP for mapping ID {}: {}", file.getId(), e.getMessage(), e);
throw new RuntimeException("Failed to delete file from SFTP", e);
} catch (Exception e) {
log.error("Unexpected error while deleting file for mapping ID {}: {}", file.getId(), e.getMessage(), e);
throw new RuntimeException("Unexpected error while deleting file", e);
}
}*/
if (!deletedFileList.isEmpty()) {
mapper.deleteFile(
AuditUtil.delete(new UpdateUploadFileParam(

View File

@@ -1,24 +0,0 @@
package app.module.core.usecase.file.url.strategy;
import app.module.core.config.application.enums.FileStorageType;
import org.springframework.stereotype.Service;
@Service
public class SftpFileUrlStrategy implements FileUrlStrategy {
@Override
public FileStorageType getStorageType() {
return FileStorageType.SFTP;
}
@Override
public String getInlineURL(String subPath, String filename) {
return String.format("/content-disposition/inline%s/%s", subPath, filename);
}
@Override
public String getAttachmentURL(Long fileId) {
return String.format("/content-disposition/attachment/%s", fileId);
}
}

View File

@@ -1,7 +1,6 @@
package app.module.core.usecase.getAttachment.adapters.web;
import app.module.core.config.application.enums.FileStorageType;
import app.module.core.config.application.util.SftpFileDownloader;
import app.module.core.usecase.file.getFile.ports.GetFilePortIn;
import app.module.core.usecase.file.getFile.ports.application.domain.GetFile;
import app.module.core.usecase.file.getFile.ports.application.domain.GetFileCmd;
@@ -33,7 +32,6 @@ import java.nio.file.Paths;
class GetAttachmentController {
private final GetFilePortIn getFilePortIn;
private final SftpFileDownloader sftpFileDownloader;
@Value("${path.upload.public}")
private String publicPath;
@@ -56,22 +54,6 @@ class GetAttachmentController {
.body("파일을 찾을 수 없습니다: " + e.getMessage());
}
// TODO - private 업로드 기능을 일단 mute
// boolean isPrivate = !getFile.getType().isPubic();
//
// if (isPrivate) {
// Authentication auth = SecurityContextHolder.getContext().getAuthentication();
// auth.getAuthorities().stream()
// .filter(
// grantedAuthority ->
// grantedAuthority.getAuthority().equals("ROLE_SUPER")
// || grantedAuthority.getAuthority().equals("PRIVATE_DOWNLOAD"))
// .findFirst()
// .orElseThrow(
// () -> new AccessDeniedException("[AccessDenied] Private 파일 리소스 접근 권한이 없습니다."));
// }
// HTTP 헤더 설정
String encodedFileName = URLEncoder.encode(getFile.getOriginName(), StandardCharsets.UTF_8)
.replace("+", "%20");
@@ -109,25 +91,6 @@ class GetAttachmentController {
.contentType(MediaType.APPLICATION_OCTET_STREAM)
.body(s3Resource);
case SFTP:
try {
sftpFileDownloader.downloadFile(getFile);
} catch (JSchException | SftpException | IOException e) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body("SFTP 파일 다운로드에 실패했습니다 " + e.getMessage());
}
File downloadedFile = new File(getFile.getLocalPath());
if (!downloadedFile.exists()) {
return ResponseEntity.status(HttpStatus.NOT_FOUND)
.body("다운로드된 파일을 찾을 수 없습니다 " + getFile.getLocalPath());
}
return ResponseEntity.ok()
.headers(headers)
.contentLength(downloadedFile.length())
.contentType(MediaType.APPLICATION_OCTET_STREAM)
.body(new FileSystemResource(downloadedFile));
default:
return ResponseEntity.status(HttpStatus.BAD_REQUEST)
.body("지원되지 않는 저장소 타입입니다: " + uploadStorageType);

View File

@@ -1,6 +1,6 @@
package app.module.core.usecase.loggedinuser.save.adapter.persistence;
import app.module.core.config.adapters.persistence.entity.LoggedInUser;
import app.module.core.usecase.loggedinuser.save.adapter.persistence.model.LoggedInUser;
import app.module.core.usecase.loggedinuser.save.ports.LoggedInUserSavePortOut;
import app.module.core.usecase.loggedinuser.save.ports.application.domain.LoggedInUserSaveCmd;
import lombok.RequiredArgsConstructor;

View File

@@ -1,6 +1,6 @@
package app.module.core.usecase.loggedinuser.save.adapter.persistence;
import app.module.core.config.adapters.persistence.entity.LoggedInUser;
import app.module.core.usecase.loggedinuser.save.adapter.persistence.model.LoggedInUser;
import org.apache.ibatis.annotations.Mapper;
@Mapper

View File

@@ -1,20 +1,18 @@
package app.module.core.config.adapters.persistence.entity;
package app.module.core.usecase.loggedinuser.save.adapter.persistence.model;
import app.module.core.config.adapters.persistence.component.AuditEntity;
import app.module.core.config.application.enums.AppType;
import lombok.*;
import java.time.LocalDateTime;
/**
* 동시접속 사용자 체크를 위한 기록용 엔티티
* 사용자 로그
*/
@Builder
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class LoggedInUser extends AuditEntity {
public class LoggedInUser {
private AppType appType;

View File

@@ -1,35 +0,0 @@
package app.module.core.usecase.operationlog.list.adapter.persistence;
import app.module.core.usecase.operationlog.list.application.domain.OperationLogElement;
import app.module.core.usecase.operationlog.list.application.domain.OperationLogListFilterCommand;
import app.module.core.usecase.operationlog.list.application.port.out.OperationLogListPortOut;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.ListUtils;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
@RequiredArgsConstructor
class OperationLogListDao implements OperationLogListPortOut {
private final OperationLogMapper operationLogMapper;
@Override
public Page<OperationLogElement> connect(
Pageable pageable, OperationLogListFilterCommand operationLogListFilterCommand) {
// 로그 목록 조회
List<OperationLogElement> contents = ListUtils.emptyIfNull(
operationLogMapper.getLogs(pageable, operationLogListFilterCommand));
return new PageImpl<>(
contents,
pageable,
contents.isEmpty() ? 0 : contents.get(0).getTotal()
);
}
}

View File

@@ -1,17 +0,0 @@
package app.module.core.usecase.operationlog.list.adapter.persistence;
import app.module.core.usecase.operationlog.list.application.domain.OperationLogElement;
import app.module.core.usecase.operationlog.list.application.domain.OperationLogListFilterCommand;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import java.util.List;
@Mapper
public interface OperationLogMapper {
List<OperationLogElement> getLogs(
@Param("pageable") Pageable pageable,
@Param("cmd") OperationLogListFilterCommand cmd
);
}

View File

@@ -1,42 +0,0 @@
package app.module.core.usecase.operationlog.list.application.domain;
import app.module.core.config.application.component.AuditOutput;
import app.module.core.config.application.enums.AppType;
import app.module.core.config.application.enums.OperationLogType;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;
@Getter
@Setter
@AllArgsConstructor
public class OperationLogElement implements AuditOutput {
private String createdBy;
private LocalDateTime createdAt;
// 고유키
private Long id;
// App 타입
private AppType appType;
// 수행 작업 타입
private OperationLogType operationLogType;
// 타겟 계정
private String targetId;
// 접속 아이피
private String ip;
// 수행 내용 설명
private String taskDesc;
// 총개수
Long total;
@Override
public String getUpdatedBy() {
return null;
}
@Override
public LocalDateTime getUpdatedAt() {
return null;
}
}

View File

@@ -1,16 +0,0 @@
package app.module.core.usecase.operationlog.list.application.domain;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class OperationLogListFilterCommand {
private String searchField;
private String searchValue;
private String searchAppType;
private String searchOperationType;
}

View File

@@ -1,11 +0,0 @@
package app.module.core.usecase.operationlog.list.application.port.in;
import app.module.core.usecase.operationlog.list.application.domain.OperationLogElement;
import app.module.core.usecase.operationlog.list.application.domain.OperationLogListFilterCommand;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
public interface OperationLogListPortIn {
Page<OperationLogElement> connect(Pageable pageable, OperationLogListFilterCommand condition);
}

View File

@@ -1,22 +0,0 @@
package app.module.core.usecase.operationlog.list.application.port.in;
import app.module.core.usecase.operationlog.list.application.domain.OperationLogElement;
import app.module.core.usecase.operationlog.list.application.domain.OperationLogListFilterCommand;
import app.module.core.usecase.operationlog.list.application.port.out.OperationLogListPortOut;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
public class OperationLogListService implements OperationLogListPortIn {
private final OperationLogListPortOut portOut;
@Override
public Page<OperationLogElement> connect(
Pageable pageable, OperationLogListFilterCommand condition) {
return portOut.connect(pageable, condition);
}
}

View File

@@ -1,11 +0,0 @@
package app.module.core.usecase.operationlog.list.application.port.out;
import app.module.core.usecase.operationlog.list.application.domain.OperationLogElement;
import app.module.core.usecase.operationlog.list.application.domain.OperationLogListFilterCommand;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
public interface OperationLogListPortOut {
Page<OperationLogElement> connect(Pageable pageable, OperationLogListFilterCommand condition);
}

View File

@@ -1,26 +0,0 @@
package app.module.core.usecase.operationlog.save.adapter.persistence;
import app.module.core.config.adapters.persistence.entity.OperationLog;
import app.module.core.usecase.operationlog.save.application.domain.OperationLogSaveCommand;
import app.module.core.usecase.operationlog.save.application.port.out.OperationLogSavePortOut;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;
@Repository
@RequiredArgsConstructor
class OperationLogSaveDao implements OperationLogSavePortOut {
private final OperationLogSaveMapper mapper;
@Override
public void connect(OperationLogSaveCommand saveCommand) {
mapper.insertOperationLog(new OperationLog(
null,
saveCommand.getAppType(),
saveCommand.getOperationLogType(),
saveCommand.getTargetId(),
saveCommand.getIp(),
saveCommand.getTaskDesc()
));
}
}

View File

@@ -1,9 +0,0 @@
package app.module.core.usecase.operationlog.save.adapter.persistence;
import app.module.core.config.adapters.persistence.entity.OperationLog;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface OperationLogSaveMapper {
void insertOperationLog(OperationLog log);
}

View File

@@ -1,25 +0,0 @@
package app.module.core.usecase.operationlog.save.application.domain;
import app.module.core.config.application.enums.AppType;
import app.module.core.config.application.enums.OperationLogType;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
public class OperationLogSaveCommand {
// App 타입
private AppType appType;
// 수행 작업 타입
private OperationLogType operationLogType;
// 타겟 계정
private String targetId;
// 접속 아이피
private String ip;
// 수행 내용 설명
private String taskDesc;
}

View File

@@ -1,8 +0,0 @@
package app.module.core.usecase.operationlog.save.application.port.in;
import app.module.core.usecase.operationlog.save.application.domain.OperationLogSaveCommand;
public interface OperationLogSavePortIn {
void connect(OperationLogSaveCommand saveCommand);
}

View File

@@ -1,18 +0,0 @@
package app.module.core.usecase.operationlog.save.application.port.in;
import app.module.core.usecase.operationlog.save.application.domain.OperationLogSaveCommand;
import app.module.core.usecase.operationlog.save.application.port.out.OperationLogSavePortOut;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
class OperationLogSaveService implements OperationLogSavePortIn {
private final OperationLogSavePortOut operationLogSavePortout;
@Override
public void connect(OperationLogSaveCommand saveCommand) {
operationLogSavePortout.connect(saveCommand);
}
}

View File

@@ -1,8 +0,0 @@
package app.module.core.usecase.operationlog.save.application.port.out;
import app.module.core.usecase.operationlog.save.application.domain.OperationLogSaveCommand;
public interface OperationLogSavePortOut {
void connect(OperationLogSaveCommand saveCommand);
}

View File

@@ -1,6 +1,6 @@
package app.module.core.usecase.role.save.adapters.persistence;
import app.module.core.config.adapters.persistence.entity.Role;
import app.module.core.usecase.uri.model.Role;
import app.module.core.config.application.enums.AppType;
import app.module.core.config.application.util.AuditUtil;
import app.module.core.usecase.role.save.adapters.persistence.model.RoleHasPrivilegeDeleteParam;

View File

@@ -1,6 +1,6 @@
package app.module.core.usecase.role.save.adapters.persistence;
import app.module.core.config.adapters.persistence.entity.Role;
import app.module.core.usecase.uri.model.Role;
import app.module.core.usecase.role.save.adapters.persistence.model.RoleHasPrivilegeDeleteParam;
import app.module.core.usecase.role.save.adapters.persistence.model.RoleHasPrivilegeSaveParam;
import org.apache.ibatis.annotations.Mapper;

View File

@@ -1,4 +1,4 @@
package app.module.core.config.adapters.persistence.entity;
package app.module.core.usecase.uicode.model;
import app.module.core.config.adapters.persistence.component.AuditEntity;
import lombok.AllArgsConstructor;
@@ -10,7 +10,7 @@ import lombok.Setter;
@Setter
@RequiredArgsConstructor
@AllArgsConstructor
public class UICode extends AuditEntity {
public class UICode {
private String id;

View File

@@ -1,6 +1,6 @@
package app.module.core.usecase.uicode.save.adapters.persistence;
import app.module.core.config.adapters.persistence.entity.UICode;
import app.module.core.usecase.uicode.model.UICode;
import app.module.core.usecase.uicode.save.ports.UICodeSavePortOut;
import app.module.core.usecase.uicode.save.ports.application.domain.UICodeSaveCommand;
import app.module.core.usecase.uicode.view.adapters.persistence.UICodeViewMapper;

View File

@@ -1,6 +1,6 @@
package app.module.core.usecase.uicode.save.adapters.persistence;
import app.module.core.config.adapters.persistence.entity.UICode;
import app.module.core.usecase.uicode.model.UICode;
import org.apache.ibatis.annotations.Mapper;
@Mapper

View File

@@ -1,5 +1,6 @@
package app.module.core.usecase.uicode.sort.ports.application.domain;
import app.module.core.config.adapters.persistence.component.AuditCommand;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
@@ -7,7 +8,7 @@ import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
public class UICodeSortCommand {
public class UICodeSortCommand extends AuditCommand {
private String id;
private Integer orderNo;

View File

@@ -1,6 +1,6 @@
package app.module.core.usecase.uicode.toptier.adapters.persistence;
import app.module.core.config.adapters.persistence.entity.UICode;
import app.module.core.usecase.uicode.model.UICode;
import app.module.core.usecase.uicode.toptier.ports.UICodeTopTierPortOut;
import app.module.core.usecase.uicode.toptier.ports.application.domain.UICodeTopTier;
import lombok.RequiredArgsConstructor;

View File

@@ -1,6 +1,6 @@
package app.module.core.usecase.uicode.toptier.adapters.persistence;
import app.module.core.config.adapters.persistence.entity.UICode;
import app.module.core.usecase.uicode.model.UICode;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;

View File

@@ -1,6 +1,6 @@
package app.module.core.usecase.uri.currentmatch.ports.application;
import app.module.core.config.adapters.persistence.entity.Role;
import app.module.core.usecase.uri.model.Role;
import app.module.core.config.application.enums.AppType;
import app.module.core.config.application.util.CommonUtil;
import app.module.core.usecase.uri.currentmatch.ports.URICurrentMatchingPortIn;

View File

@@ -1,7 +1,7 @@
package app.module.core.usecase.uri.getUris.adapters.persistence;
import app.module.core.config.adapters.persistence.entity.Role;
import app.module.core.config.adapters.persistence.entity.RoleHasPrivilege;
import app.module.core.usecase.uri.model.Role;
import app.module.core.usecase.uri.model.RoleHasPrivilege;
import app.module.core.config.application.enums.AppType;
import app.module.core.usecase.uri.getUris.adapters.persistence.model.GetRolesDto;
import app.module.core.usecase.uri.getUris.adapters.persistence.model.GetUrisDto;

View File

@@ -1,6 +1,6 @@
package app.module.core.usecase.uri.getUris.ports.application.domain;
import app.module.core.config.adapters.persistence.entity.Role;
import app.module.core.usecase.uri.model.Role;
import app.module.core.config.application.enums.AppType;
import lombok.AllArgsConstructor;
import lombok.Getter;

View File

@@ -1,4 +1,4 @@
package app.module.core.config.adapters.persistence.entity;
package app.module.core.usecase.uri.model;
import app.module.core.config.adapters.persistence.component.AuditEntity;
import app.module.core.config.application.enums.AppType;

View File

@@ -1,4 +1,4 @@
package app.module.core.config.adapters.persistence.entity;
package app.module.core.usecase.uri.model;
import app.module.core.config.adapters.persistence.component.AuditEntity;
import lombok.AllArgsConstructor;

View File

@@ -1,4 +1,4 @@
package app.module.core.config.adapters.persistence.entity;
package app.module.core.usecase.uri.model;
import app.module.core.config.adapters.persistence.component.AuditEntity;
import app.module.core.config.application.enums.AppType;

View File

@@ -1,6 +1,6 @@
package app.module.core.usecase.uri.save.adapters.persistence;
import app.module.core.config.adapters.persistence.entity.URI;
import app.module.core.usecase.uri.model.URI;
import app.module.core.config.application.util.CommonUtil;
import app.module.core.usecase.uri.save.adapters.persistence.model.UriHasRoleDeleteParam;
import app.module.core.usecase.uri.save.adapters.persistence.model.UriHasRoleSaveParam;

Some files were not shown because too many files have changed in this diff Show More