필요없는 파일 삭제 및 이동
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package app.module.core.config.adapters.persistence.repository;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface AdminRepo {
|
||||
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package app.module.core.config.adapters.persistence.repository;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface OperationLogRepo {
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package app.module.core.config.adapters.persistence.repository;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface UICodeRepo {
|
||||
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package app.module.core.config.adapters.persistence.repository;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface URIRepo {
|
||||
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package app.module.core.config.adapters.persistence.repository;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface UploadFileRepo {
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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";
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
);
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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()
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
|
||||
@@ -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.usecase.uri.save.adapters.persistence.model.UriHasRoleDeleteParam;
|
||||
import app.module.core.usecase.uri.save.adapters.persistence.model.UriHasRoleSaveParam;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package app.module.core.usecase.uri.view.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.usecase.uri.getUris.ports.GetUrisPortIn;
|
||||
import app.module.core.usecase.uri.view.ports.URIViewPortIn;
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
package app.module.core.usecase.user.createUser.adapters.persistence;
|
||||
|
||||
import app.module.core.config.adapters.persistence.entity.FrontUser;
|
||||
import app.module.core.config.application.util.CommonUtil;
|
||||
import app.module.core.usecase.user.createUser.adapters.persistence.model.SaveFrontUserHasRoleParam;
|
||||
import app.module.core.usecase.user.createUser.ports.CreateUserPortOut;
|
||||
import app.module.core.usecase.user.createUser.ports.application.domain.CreateUser;
|
||||
import app.module.core.usecase.user.createUser.ports.application.domain.CreateUserCmd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Optional;
|
||||
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
class CreateUserDao implements CreateUserPortOut {
|
||||
|
||||
private final CreateUserMapper mapper;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Optional<CreateUser> operate(CreateUserCmd cmd) {
|
||||
|
||||
String userId = CommonUtil.getLoginUsername();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
|
||||
mapper.insertFrontUser(
|
||||
new FrontUser(
|
||||
cmd.getId(),
|
||||
cmd.getPassword(),
|
||||
cmd.getEmail(),
|
||||
cmd.getNickname(),
|
||||
cmd.getSignUpType(),
|
||||
LocalDateTime.now(),
|
||||
cmd.isAccountDisabled(),
|
||||
cmd.getLoginFailCnt(),
|
||||
cmd.getAccountLocked(),
|
||||
null
|
||||
));
|
||||
|
||||
if(CollectionUtils.isNotEmpty(cmd.getRoles())) {
|
||||
mapper.insertFrontUserHasRoles(new SaveFrontUserHasRoleParam(
|
||||
cmd.getId(), cmd.getRoles(), now, userId, now, userId, false
|
||||
));
|
||||
}
|
||||
|
||||
return Optional.of(new CreateUser(
|
||||
cmd.getId(),
|
||||
cmd.getPassword(),
|
||||
cmd.getEmail(),
|
||||
cmd.isAccountDisabled(),
|
||||
cmd.getLoginFailCnt(),
|
||||
cmd.getAccountLocked(),
|
||||
cmd.getRoles()
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package app.module.core.usecase.user.createUser.adapters.persistence;
|
||||
|
||||
import app.module.core.config.adapters.persistence.entity.FrontUser;
|
||||
import app.module.core.usecase.user.createUser.adapters.persistence.model.SaveFrontUserHasRoleParam;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface CreateUserMapper {
|
||||
void insertFrontUser(FrontUser user);
|
||||
void insertFrontUserHasRoles(SaveFrontUserHasRoleParam param);
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package app.module.core.usecase.user.createUser.adapters.persistence.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Set;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
public class SaveFrontUserHasRoleParam {
|
||||
private String userId;
|
||||
private Set<String> roleIds;
|
||||
private LocalDateTime createdAt;
|
||||
private String createdBy;
|
||||
private LocalDateTime updatedAt;
|
||||
private String updatedBy;
|
||||
private boolean deleted;
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package app.module.core.usecase.user.createUser.ports;
|
||||
|
||||
import app.module.core.usecase.user.createUser.ports.application.domain.CreateUser;
|
||||
import app.module.core.usecase.user.createUser.ports.application.domain.CreateUserCmd;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public interface CreateUserPortIn {
|
||||
|
||||
Optional<CreateUser> operate(CreateUserCmd command);
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package app.module.core.usecase.user.createUser.ports;
|
||||
|
||||
import app.module.core.usecase.user.createUser.ports.application.domain.CreateUser;
|
||||
import app.module.core.usecase.user.createUser.ports.application.domain.CreateUserCmd;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public interface CreateUserPortOut {
|
||||
|
||||
Optional<CreateUser> operate(CreateUserCmd command);
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package app.module.core.usecase.user.createUser.ports.application;
|
||||
|
||||
import app.module.core.usecase.user.createUser.ports.CreateUserPortIn;
|
||||
import app.module.core.usecase.user.createUser.ports.CreateUserPortOut;
|
||||
import app.module.core.usecase.user.createUser.ports.application.domain.CreateUser;
|
||||
import app.module.core.usecase.user.createUser.ports.application.domain.CreateUserCmd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
class CreateUserService implements CreateUserPortIn {
|
||||
|
||||
private final CreateUserPortOut portOut;
|
||||
private final BCryptPasswordEncoder passwordEncoder;
|
||||
|
||||
@Override
|
||||
public Optional<CreateUser> operate(CreateUserCmd command) {
|
||||
command.setPassword(passwordEncoder.encode(command.getPassword()));
|
||||
return portOut.operate(command);
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package app.module.core.usecase.user.createUser.ports.application.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class CreateUser {
|
||||
private String id;
|
||||
private String password;
|
||||
private String email;
|
||||
private boolean accountDisabled;
|
||||
private Integer loginFailCnt;
|
||||
private Boolean accountLocked;
|
||||
private Set<String> roles;
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package app.module.core.usecase.user.createUser.ports.application.domain;
|
||||
|
||||
import app.module.core.config.application.enums.SignUpType;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class CreateUserCmd {
|
||||
private String id;
|
||||
private String password;
|
||||
private String email;
|
||||
private String nickname;
|
||||
private SignUpType signUpType;
|
||||
private boolean accountDisabled;
|
||||
private Integer loginFailCnt;
|
||||
private Boolean accountLocked;
|
||||
private Set<String> roles;
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
package app.module.core.usecase.user.findUser.adapters.persistence;
|
||||
|
||||
import app.module.core.config.adapters.web.security.domain.CoreRole;
|
||||
import app.module.core.config.application.enums.FileUploadType;
|
||||
import app.module.core.usecase.user.findUser.adapters.persistence.model.FindUserDto;
|
||||
import app.module.core.usecase.user.findUser.ports.FindUserPortOut;
|
||||
import app.module.core.usecase.user.findUser.ports.application.domain.FindProfileImages;
|
||||
import app.module.core.usecase.user.findUser.ports.application.domain.FindUser;
|
||||
import app.module.core.usecase.user.findUser.ports.application.domain.FindUserCmd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
class FindUserDao implements FindUserPortOut {
|
||||
|
||||
private final FindUserMapper mapper;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Optional<FindUser> operate(FindUserCmd command) {
|
||||
String id = command.getId();
|
||||
|
||||
FindUserDto dto = mapper.findUserById(id);
|
||||
List<CoreRole> roles = mapper.findRolesWithPrivilegesByUserId(id);
|
||||
FindProfileImages image = mapper.findProfileImageByUserId(id, FileUploadType.PRIVATE.name());
|
||||
|
||||
return Optional.of(new FindUser(
|
||||
dto.getId(),
|
||||
dto.getPassword(),
|
||||
dto.getEmail(),
|
||||
dto.getNickname(),
|
||||
dto.getSignUpType(),
|
||||
dto.getPasswordUpdatedAt(),
|
||||
dto.getAccountDisabled(),
|
||||
dto.getLoginFailCnt(),
|
||||
dto.getAccountLocked(),
|
||||
dto.getCreatedAt(),
|
||||
dto.getCreatedBy(),
|
||||
dto.getUpdatedAt(),
|
||||
dto.getUpdatedBy(),
|
||||
Set.copyOf(roles),
|
||||
image
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package app.module.core.usecase.user.findUser.adapters.persistence;
|
||||
|
||||
import app.module.core.config.adapters.web.security.domain.CoreRole;
|
||||
import app.module.core.usecase.user.findUser.adapters.persistence.model.FindUserDto;
|
||||
import app.module.core.usecase.user.findUser.ports.application.domain.FindProfileImages;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface FindUserMapper {
|
||||
FindUserDto findUserById(String id);
|
||||
List<CoreRole> findRolesWithPrivilegesByUserId(String userId);
|
||||
FindProfileImages findProfileImageByUserId(
|
||||
@Param("userId") String userId,
|
||||
@Param("fileUploadType") String fileUploadType);
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package app.module.core.usecase.user.findUser.adapters.persistence.model;
|
||||
|
||||
import app.module.core.config.application.enums.SignUpType;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
public class FindUserDto {
|
||||
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 LocalDateTime createdAt;
|
||||
private String createdBy;
|
||||
private LocalDateTime updatedAt;
|
||||
private String updatedBy;
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package app.module.core.usecase.user.findUser.ports;
|
||||
|
||||
import app.module.core.usecase.user.findUser.ports.application.domain.FindUser;
|
||||
import app.module.core.usecase.user.findUser.ports.application.domain.FindUserCmd;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public interface FindUserPortIn {
|
||||
|
||||
Optional<FindUser> operate(FindUserCmd command);
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package app.module.core.usecase.user.findUser.ports;
|
||||
|
||||
import app.module.core.usecase.user.findUser.ports.application.domain.FindUser;
|
||||
import app.module.core.usecase.user.findUser.ports.application.domain.FindUserCmd;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public interface FindUserPortOut {
|
||||
|
||||
Optional<FindUser> operate(FindUserCmd command);
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
package app.module.core.usecase.user.findUser.ports.application;
|
||||
|
||||
import app.module.core.config.application.enums.FileStorageType;
|
||||
import app.module.core.usecase.file.url.application.port.in.FileUrlPortIn;
|
||||
import app.module.core.usecase.user.findUser.ports.FindUserPortIn;
|
||||
import app.module.core.usecase.user.findUser.ports.FindUserPortOut;
|
||||
import app.module.core.usecase.user.findUser.ports.application.domain.FindProfileImages;
|
||||
import app.module.core.usecase.user.findUser.ports.application.domain.FindUser;
|
||||
import app.module.core.usecase.user.findUser.ports.application.domain.FindUserCmd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
class FindUserService implements FindUserPortIn {
|
||||
|
||||
private final FindUserPortOut portOut;
|
||||
private final FileUrlPortIn fileUrlPortIn;
|
||||
|
||||
@Value("${path.upload.storage}")
|
||||
private String uploadStorageType;
|
||||
|
||||
@Override
|
||||
public Optional<FindUser> operate(FindUserCmd command) {
|
||||
return portOut
|
||||
.operate(command)
|
||||
.flatMap(
|
||||
findUser -> {
|
||||
FindProfileImages profileImg = findUser.getUploadFile();
|
||||
|
||||
if (profileImg != null) {
|
||||
// 참조 URL 전달
|
||||
profileImg.setReferURL(
|
||||
fileUrlPortIn.getInline(
|
||||
FileStorageType.valueOf(uploadStorageType),
|
||||
profileImg.getPath(),
|
||||
profileImg.getName()));
|
||||
|
||||
// attachment URL 전달
|
||||
profileImg.setAttachmentURL(
|
||||
fileUrlPortIn.getAttachment(
|
||||
FileStorageType.valueOf(uploadStorageType), profileImg.getId()));
|
||||
}
|
||||
|
||||
return Optional.of(findUser);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package app.module.core.usecase.user.findUser.ports.application.domain;
|
||||
|
||||
import app.module.core.config.application.enums.FileUploadType;
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class FindProfileImages {
|
||||
private Long id;
|
||||
private FileUploadType type;
|
||||
private String path;
|
||||
private String name;
|
||||
private String originName;
|
||||
private Long fileLength;
|
||||
private String referURL;
|
||||
private String attachmentURL;
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package app.module.core.usecase.user.findUser.ports.application.domain;
|
||||
|
||||
import app.module.core.config.adapters.web.security.domain.CoreRole;
|
||||
import app.module.core.config.application.enums.SignUpType;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Set;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class FindUser {
|
||||
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 LocalDateTime createdAt;
|
||||
private String createdBy;
|
||||
private LocalDateTime updatedAt;
|
||||
private String updatedBy;
|
||||
private Set<CoreRole> roles;
|
||||
private FindProfileImages uploadFile;
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package app.module.core.usecase.user.findUser.ports.application.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class FindUserCmd {
|
||||
|
||||
private String id;
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package app.module.core.usecase.user.findUser.ports.application.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class FindUserPrivilege {
|
||||
|
||||
private String id;
|
||||
private String description;
|
||||
private Integer orderNo;
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package app.module.core.usecase.user.findUser.ports.application.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class FindUserRole {
|
||||
|
||||
private String id;
|
||||
private String description;
|
||||
private Integer orderNo;
|
||||
private Set<FindUserPrivilege> privileges;
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package app.module.core.usecase.user.getRoles.adapters.persistence;
|
||||
|
||||
import app.module.core.usecase.user.getRoles.ports.GetRolesPortOut;
|
||||
import app.module.core.usecase.user.getRoles.ports.application.domain.GetRoles;
|
||||
import app.module.core.usecase.user.getRoles.ports.application.domain.GetRolesCmd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
class GetRolesDao implements GetRolesPortOut {
|
||||
|
||||
private final GetRolesMapper mapper;
|
||||
|
||||
@Override
|
||||
public List<GetRoles> operate(GetRolesCmd command) {
|
||||
return mapper.findByAppType(command);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package app.module.core.usecase.user.getRoles.adapters.persistence;
|
||||
|
||||
import app.module.core.usecase.user.getRoles.ports.application.domain.GetRoles;
|
||||
import app.module.core.usecase.user.getRoles.ports.application.domain.GetRolesCmd;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface GetRolesMapper {
|
||||
List<GetRoles> findByAppType(GetRolesCmd cmd);
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package app.module.core.usecase.user.getRoles.ports;
|
||||
|
||||
import app.module.core.usecase.user.getRoles.ports.application.domain.GetRoles;
|
||||
import app.module.core.usecase.user.getRoles.ports.application.domain.GetRolesCmd;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface GetRolesPortIn {
|
||||
|
||||
List<GetRoles> operate(GetRolesCmd command);
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package app.module.core.usecase.user.getRoles.ports;
|
||||
|
||||
import app.module.core.usecase.user.getRoles.ports.application.domain.GetRoles;
|
||||
import app.module.core.usecase.user.getRoles.ports.application.domain.GetRolesCmd;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface GetRolesPortOut {
|
||||
|
||||
List<GetRoles> operate(GetRolesCmd command);
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package app.module.core.usecase.user.getRoles.ports.application;
|
||||
|
||||
import app.module.core.usecase.user.getRoles.ports.GetRolesPortIn;
|
||||
import app.module.core.usecase.user.getRoles.ports.GetRolesPortOut;
|
||||
import app.module.core.usecase.user.getRoles.ports.application.domain.GetRoles;
|
||||
import app.module.core.usecase.user.getRoles.ports.application.domain.GetRolesCmd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
class GetRolesService implements GetRolesPortIn {
|
||||
|
||||
private final GetRolesPortOut portOut;
|
||||
|
||||
@Override
|
||||
public List<GetRoles> operate(GetRolesCmd command) {
|
||||
return portOut.operate(command);
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package app.module.core.usecase.user.getRoles.ports.application.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetRoles {
|
||||
private String id;
|
||||
private String description;
|
||||
private Integer orderNo;
|
||||
private LocalDateTime createdAt;
|
||||
private String createdBy;
|
||||
private LocalDateTime updatedAt;
|
||||
private String updatedBy;
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package app.module.core.usecase.user.getRoles.ports.application.domain;
|
||||
|
||||
import app.module.core.config.application.enums.AppType;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetRolesCmd {
|
||||
|
||||
private AppType appType;
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
package app.module.core.usecase.user.getUsers.adapters.persistence;
|
||||
|
||||
import app.module.core.usecase.user.getUsers.adapters.persistence.model.GetUsersDto;
|
||||
import app.module.core.usecase.user.getUsers.ports.GetUsersPortOut;
|
||||
import app.module.core.usecase.user.getUsers.ports.application.domain.GetUsers;
|
||||
import app.module.core.usecase.user.getUsers.ports.application.domain.GetUsersCmd;
|
||||
import app.module.core.usecase.user.getUsers.ports.application.domain.GetUsersRole;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
class GetUsersDao implements GetUsersPortOut {
|
||||
|
||||
private final GetUsersMapper mapper;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Page<GetUsers> operate(Pageable pageable, GetUsersCmd command) {
|
||||
// 사용자 목록 조회
|
||||
List<GetUsersDto> users = mapper.getUsers(command, pageable);
|
||||
|
||||
// 사용자의 역할 목록 얻기
|
||||
List<GetUsersRole> roles =
|
||||
mapper.findRolesWithPrivilegesByUserIds(users.stream().map(GetUsersDto::getId).toList());
|
||||
|
||||
return new PageImpl<>(
|
||||
users.stream()
|
||||
.map(user -> new GetUsers(
|
||||
user.getId(),
|
||||
user.getEmail(),
|
||||
user.getNickname(),
|
||||
user.getSignUpType(),
|
||||
user.getPasswordUpdatedAt(),
|
||||
user.getAccountDisabled(),
|
||||
user.getLoginFailCnt(),
|
||||
user.getAccountLocked(),
|
||||
user.getCreatedAt(),
|
||||
user.getCreatedBy(),
|
||||
user.getUpdatedAt(),
|
||||
user.getUpdatedBy(),
|
||||
roles.stream()
|
||||
.filter(r -> r.getUserId().equals(user.getId()))
|
||||
.collect(Collectors.toSet())
|
||||
)).toList(),
|
||||
pageable,
|
||||
users.isEmpty() ? 0 : users.get(0).getTotal());
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package app.module.core.usecase.user.getUsers.adapters.persistence;
|
||||
|
||||
import app.module.core.usecase.user.getUsers.adapters.persistence.model.GetUsersDto;
|
||||
import app.module.core.usecase.user.getUsers.ports.application.domain.GetUsersCmd;
|
||||
import app.module.core.usecase.user.getUsers.ports.application.domain.GetUsersRole;
|
||||
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 GetUsersMapper {
|
||||
List<GetUsersDto> getUsers(
|
||||
@Param("cmd") GetUsersCmd cmd,
|
||||
@Param("pageable") Pageable pageable);
|
||||
|
||||
List<GetUsersRole> findRolesWithPrivilegesByUserIds(@Param("ids") List<String> ids);
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package app.module.core.usecase.user.getUsers.adapters.persistence.model;
|
||||
|
||||
import app.module.core.config.application.enums.SignUpType;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class GetUsersDto {
|
||||
private String id;
|
||||
private String email;
|
||||
private String nickname;
|
||||
private SignUpType signUpType;
|
||||
private LocalDateTime passwordUpdatedAt;
|
||||
private Boolean accountDisabled;
|
||||
private Integer loginFailCnt;
|
||||
private Boolean accountLocked;
|
||||
private LocalDateTime createdAt;
|
||||
private String createdBy;
|
||||
private LocalDateTime updatedAt;
|
||||
private String updatedBy;
|
||||
private Long total;
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package app.module.core.usecase.user.getUsers.ports;
|
||||
|
||||
import app.module.core.usecase.user.getUsers.ports.application.domain.GetUsers;
|
||||
import app.module.core.usecase.user.getUsers.ports.application.domain.GetUsersCmd;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
public interface GetUsersPortIn {
|
||||
|
||||
Page<GetUsers> operate(Pageable pageable, GetUsersCmd command);
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package app.module.core.usecase.user.getUsers.ports;
|
||||
|
||||
import app.module.core.usecase.user.getUsers.ports.application.domain.GetUsers;
|
||||
import app.module.core.usecase.user.getUsers.ports.application.domain.GetUsersCmd;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
public interface GetUsersPortOut {
|
||||
|
||||
Page<GetUsers> operate(Pageable pageable, GetUsersCmd command);
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package app.module.core.usecase.user.getUsers.ports.application;
|
||||
|
||||
import app.module.core.usecase.user.getUsers.ports.GetUsersPortIn;
|
||||
import app.module.core.usecase.user.getUsers.ports.GetUsersPortOut;
|
||||
import app.module.core.usecase.user.getUsers.ports.application.domain.GetUsers;
|
||||
import app.module.core.usecase.user.getUsers.ports.application.domain.GetUsersCmd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
class GetUsersService implements GetUsersPortIn {
|
||||
|
||||
private final GetUsersPortOut portOut;
|
||||
|
||||
@Override
|
||||
public Page<GetUsers> operate(Pageable pageable, GetUsersCmd command) {
|
||||
return portOut.operate(pageable, command);
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package app.module.core.usecase.user.getUsers.ports.application.domain;
|
||||
|
||||
import app.module.core.config.application.enums.SignUpType;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Set;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetUsers {
|
||||
private String id;
|
||||
private String email;
|
||||
private String nickname;
|
||||
private SignUpType signUpType;
|
||||
private LocalDateTime passwordUpdatedAt;
|
||||
private Boolean accountDisabled;
|
||||
private Integer loginFailCnt;
|
||||
private Boolean accountLocked;
|
||||
private LocalDateTime createdAt;
|
||||
private String createdBy;
|
||||
private LocalDateTime updatedAt;
|
||||
private String updatedBy;
|
||||
private Set<GetUsersRole> roles;
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package app.module.core.usecase.user.getUsers.ports.application.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetUsersCmd {
|
||||
private final String searchField;
|
||||
private final String searchValue;
|
||||
private final String searchRole;
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package app.module.core.usecase.user.getUsers.ports.application.domain;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetUsersPrivilege {
|
||||
private String id;
|
||||
private String description;
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package app.module.core.usecase.user.getUsers.ports.application.domain;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetUsersRole {
|
||||
private String id;
|
||||
private String userId;
|
||||
private String description;
|
||||
private Set<GetUsersPrivilege> privileges;
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
package app.module.core.usecase.user.updateFrontUser.adapters.persistence;
|
||||
|
||||
import app.module.core.config.adapters.persistence.entity.FrontUser;
|
||||
import app.module.core.config.application.util.CommonUtil;
|
||||
import app.module.core.usecase.user.updateFrontUser.adapters.persistence.model.UpdateFrontUserHasUploadFileParam;
|
||||
import app.module.core.usecase.user.updateFrontUser.adapters.persistence.model.UpdateFrontUserParam;
|
||||
import app.module.core.usecase.user.updateFrontUser.ports.UpdateFrontUserPortOut;
|
||||
import app.module.core.usecase.user.updateFrontUser.ports.application.domain.UpdateFrontUserOutCmd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
class UpdateFrontUserDao implements UpdateFrontUserPortOut {
|
||||
|
||||
private final UpdateFrontUserMapper mapper;
|
||||
|
||||
@Override
|
||||
public void operate(UpdateFrontUserOutCmd cmd) {
|
||||
String userId = cmd.getId();
|
||||
String loginUser = CommonUtil.getLoginUsername();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
|
||||
// 사용자 기본 정보 수정
|
||||
mapper.updateFrontUser(
|
||||
new FrontUser(
|
||||
userId,
|
||||
cmd.getPassword(),
|
||||
cmd.getEmail(),
|
||||
cmd.getNickname(),
|
||||
cmd.getSignUpType(),
|
||||
cmd.getPasswordUpdatedAt(),
|
||||
cmd.getAccountDisabled(),
|
||||
cmd.getLoginFailCnt(),
|
||||
cmd.getAccountLocked(),
|
||||
null
|
||||
)
|
||||
);
|
||||
|
||||
// 업로드 파일 매핑 재처리
|
||||
if (CollectionUtils.isNotEmpty(cmd.getFileMappingId())) {
|
||||
// 파일 삭제
|
||||
mapper.deleteFrontUserHasUploadFiles(
|
||||
new UpdateFrontUserParam(userId, now, loginUser, now, loginUser));
|
||||
// 저장
|
||||
mapper.insertFrontUserHasUploadFiles(
|
||||
new UpdateFrontUserHasUploadFileParam(
|
||||
userId,
|
||||
cmd.getFileMappingId().stream().map(Long::parseLong).toList(),
|
||||
now, loginUser, now, loginUser));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package app.module.core.usecase.user.updateFrontUser.adapters.persistence;
|
||||
|
||||
import app.module.core.config.adapters.persistence.entity.FrontUser;
|
||||
import app.module.core.usecase.user.updateFrontUser.adapters.persistence.model.UpdateFrontUserHasUploadFileParam;
|
||||
import app.module.core.usecase.user.updateFrontUser.adapters.persistence.model.UpdateFrontUserParam;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface UpdateFrontUserMapper {
|
||||
void updateFrontUser(FrontUser user);
|
||||
void deleteFrontUserHasUploadFiles(UpdateFrontUserParam param);
|
||||
void insertFrontUserHasUploadFiles(UpdateFrontUserHasUploadFileParam param);
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package app.module.core.usecase.user.updateFrontUser.adapters.persistence.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
public class UpdateFrontUserHasUploadFileParam {
|
||||
private String userId;
|
||||
private List<Long> fileIds;
|
||||
private LocalDateTime createdAt;
|
||||
private String createdBy;
|
||||
private LocalDateTime updatedAt;
|
||||
private String updatedBy;
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package app.module.core.usecase.user.updateFrontUser.adapters.persistence.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
public class UpdateFrontUserParam {
|
||||
private String userId;
|
||||
private LocalDateTime updatedAt;
|
||||
private String updatedBy;
|
||||
private LocalDateTime deletedAt;
|
||||
private String deletedBy;
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package app.module.core.usecase.user.updateFrontUser.ports;
|
||||
|
||||
import app.module.core.usecase.user.updateFrontUser.ports.application.domain.UpdateFrontUserInCmd;
|
||||
|
||||
public interface UpdateFrontUserPortIn {
|
||||
|
||||
void operate(UpdateFrontUserInCmd inCommand);
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package app.module.core.usecase.user.updateFrontUser.ports;
|
||||
|
||||
import app.module.core.usecase.user.updateFrontUser.ports.application.domain.UpdateFrontUserOutCmd;
|
||||
|
||||
public interface UpdateFrontUserPortOut {
|
||||
|
||||
void operate(UpdateFrontUserOutCmd outCommand);
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
package app.module.core.usecase.user.updateFrontUser.ports.application;
|
||||
|
||||
import app.module.core.config.adapters.web.security.domain.CoreRole;
|
||||
import app.module.core.config.application.util.CommonUtil;
|
||||
import app.module.core.usecase.user.findUser.ports.FindUserPortIn;
|
||||
import app.module.core.usecase.user.findUser.ports.application.domain.FindUser;
|
||||
import app.module.core.usecase.user.findUser.ports.application.domain.FindUserCmd;
|
||||
import app.module.core.usecase.user.updateFrontUser.ports.UpdateFrontUserPortIn;
|
||||
import app.module.core.usecase.user.updateFrontUser.ports.UpdateFrontUserPortOut;
|
||||
import app.module.core.usecase.user.updateFrontUser.ports.application.domain.UpdateFrontUserInCmd;
|
||||
import app.module.core.usecase.user.updateFrontUser.ports.application.domain.UpdateFrontUserOutCmd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.thymeleaf.util.StringUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
class UpdateFrontUserService implements UpdateFrontUserPortIn {
|
||||
|
||||
private final UpdateFrontUserPortOut portOut;
|
||||
private final FindUserPortIn findUserPortIn;
|
||||
private final BCryptPasswordEncoder passwordEncoder;
|
||||
|
||||
@Override
|
||||
public void operate(UpdateFrontUserInCmd cmd) {
|
||||
FindUser findUser =
|
||||
findUserPortIn.operate(new FindUserCmd(CommonUtil.getLoginUsername())).orElseThrow();
|
||||
|
||||
portOut.operate(
|
||||
new UpdateFrontUserOutCmd(
|
||||
findUser.getId(),
|
||||
StringUtils.isEmptyOrWhitespace(cmd.getPassword())
|
||||
? findUser.getPassword()
|
||||
: passwordEncoder.encode(cmd.getPassword()),
|
||||
StringUtils.isEmptyOrWhitespace(cmd.getPassword())
|
||||
? findUser.getPasswordUpdatedAt()
|
||||
: LocalDateTime.now(),
|
||||
cmd.getEmail(),
|
||||
cmd.getNickname(),
|
||||
findUser.getSignUpType(),
|
||||
cmd.getFileMappingId(),
|
||||
findUser.getAccountDisabled(),
|
||||
findUser.getLoginFailCnt(),
|
||||
findUser.getAccountLocked(),
|
||||
CollectionUtils.emptyIfNull(findUser.getRoles()).stream()
|
||||
.map(CoreRole::getId)
|
||||
.collect(Collectors.toSet())));
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package app.module.core.usecase.user.updateFrontUser.ports.application.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class UpdateFrontUserInCmd {
|
||||
private String password;
|
||||
private String email;
|
||||
private String nickname;
|
||||
private List<String> fileMappingId;
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package app.module.core.usecase.user.updateFrontUser.ports.application.domain;
|
||||
|
||||
import app.module.core.config.application.enums.SignUpType;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class UpdateFrontUserOutCmd {
|
||||
private String id;
|
||||
private String password;
|
||||
private LocalDateTime passwordUpdatedAt;
|
||||
private String email;
|
||||
private String nickname;
|
||||
private SignUpType signUpType;
|
||||
private List<String> fileMappingId;
|
||||
private Boolean accountDisabled;
|
||||
private Integer loginFailCnt;
|
||||
private Boolean accountLocked;
|
||||
private Set<String> roles;
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
package app.module.core.usecase.user.updateUserByAdmin.adapters.persistence;
|
||||
|
||||
import app.module.core.config.adapters.persistence.entity.FrontUser;
|
||||
import app.module.core.config.application.util.CommonUtil;
|
||||
import app.module.core.usecase.user.updateUserByAdmin.adapters.persistence.model.UpdateFrontUserByAdminParam;
|
||||
import app.module.core.usecase.user.updateUserByAdmin.adapters.persistence.model.UpdateFrontUserHasRoleParam;
|
||||
import app.module.core.usecase.user.updateUserByAdmin.ports.UpdateUserPortOut;
|
||||
import app.module.core.usecase.user.updateUserByAdmin.ports.application.domain.UpdateUserCmd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
class UpdateUserDao implements UpdateUserPortOut {
|
||||
|
||||
private final UpdateUserMapper mapper;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void operate(UpdateUserCmd cmd) {
|
||||
String userId = cmd.getId();
|
||||
String loginUser = CommonUtil.getLoginUsername();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
|
||||
// 관리자의 사용자 정보 수정
|
||||
mapper.updateFrontUser(
|
||||
new FrontUser(
|
||||
userId,
|
||||
cmd.getEmail(),
|
||||
cmd.getNickname(),
|
||||
cmd.getAccountDisabled(),
|
||||
cmd.getLoginFailCnt(),
|
||||
cmd.getAccountLocked()
|
||||
)
|
||||
);
|
||||
|
||||
// 기존 역할 삭제
|
||||
mapper.deleteFrontUserHasRoles(
|
||||
new UpdateFrontUserByAdminParam(userId, now, loginUser, now, loginUser));
|
||||
|
||||
// 새로운 역할 등록
|
||||
if (CollectionUtils.isNotEmpty(cmd.getRoles())) {
|
||||
mapper.insertFrontUserHasRoles(
|
||||
new UpdateFrontUserHasRoleParam(
|
||||
userId, cmd.getRoles().stream().toList(), now, loginUser, now, loginUser));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package app.module.core.usecase.user.updateUserByAdmin.adapters.persistence;
|
||||
|
||||
import app.module.core.config.adapters.persistence.entity.FrontUser;
|
||||
import app.module.core.usecase.user.updateUserByAdmin.adapters.persistence.model.UpdateFrontUserByAdminParam;
|
||||
import app.module.core.usecase.user.updateUserByAdmin.adapters.persistence.model.UpdateFrontUserHasRoleParam;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface UpdateUserMapper {
|
||||
void updateFrontUser(FrontUser user);
|
||||
void deleteFrontUserHasRoles(UpdateFrontUserByAdminParam param);
|
||||
void insertFrontUserHasRoles(UpdateFrontUserHasRoleParam param);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user