필요없는 파일 삭제 및 이동
This commit is contained in:
@@ -1,11 +1,6 @@
|
|||||||
package app.module.admin.config.application.aop;
|
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.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 jakarta.servlet.http.HttpServletRequest;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.aspectj.lang.JoinPoint;
|
import org.aspectj.lang.JoinPoint;
|
||||||
@@ -18,21 +13,12 @@ import org.springframework.stereotype.Component;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class LoginFailAspect {
|
public class LoginFailAspect {
|
||||||
|
|
||||||
private final OperationLogSavePortIn operationLogSavePortIn;
|
|
||||||
private final MessageUtil messageUtil;
|
private final MessageUtil messageUtil;
|
||||||
|
|
||||||
@After("@annotation(app.module.admin.config.application.aop.LoginFailOperateLog)")
|
@After("@annotation(app.module.admin.config.application.aop.LoginFailOperateLog)")
|
||||||
public void operate(JoinPoint joinPoint) throws Throwable {
|
public void operate(JoinPoint joinPoint) throws Throwable {
|
||||||
Object[] args = joinPoint.getArgs();
|
Object[] args = joinPoint.getArgs();
|
||||||
HttpServletRequest request = (HttpServletRequest) args[0];
|
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)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.enums.OperationLogType;
|
||||||
import app.module.core.config.application.util.CommonUtil;
|
import app.module.core.config.application.util.CommonUtil;
|
||||||
import app.module.core.config.application.util.MessageUtil;
|
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 jakarta.servlet.http.HttpServletRequest;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -20,8 +18,6 @@ import org.springframework.stereotype.Component;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class LoginSuccessAspect {
|
public class LoginSuccessAspect {
|
||||||
|
|
||||||
private final OperationLogSavePortIn operationLogSavePortIn;
|
|
||||||
private final MessageUtil messageUtil;
|
private final MessageUtil messageUtil;
|
||||||
|
|
||||||
@After("@annotation(app.module.admin.config.application.aop.LoginSuccessOperateLog)")
|
@After("@annotation(app.module.admin.config.application.aop.LoginSuccessOperateLog)")
|
||||||
@@ -31,12 +27,5 @@ public class LoginSuccessAspect {
|
|||||||
HttpServletRequest request = (HttpServletRequest) args[0];
|
HttpServletRequest request = (HttpServletRequest) args[0];
|
||||||
Authentication authentication = (Authentication) args[2];
|
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())));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ import app.module.core.config.application.enums.OperationLogType;
|
|||||||
import app.module.core.config.application.util.CommonUtil;
|
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.AdminViewPortIn;
|
||||||
import app.module.core.usecase.admin.view.ports.application.domain.AdminView;
|
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 jakarta.servlet.http.HttpServletRequest;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.aspectj.lang.ProceedingJoinPoint;
|
import org.aspectj.lang.ProceedingJoinPoint;
|
||||||
@@ -27,7 +25,6 @@ import java.util.Optional;
|
|||||||
public class RoleUpdateAspect {
|
public class RoleUpdateAspect {
|
||||||
|
|
||||||
private final AdminViewPortIn adminViewPortIn;
|
private final AdminViewPortIn adminViewPortIn;
|
||||||
private final OperationLogSavePortIn operationLogSavePortIn;
|
|
||||||
|
|
||||||
@Around(
|
@Around(
|
||||||
"execution(* app.module.core.usecase.admin.saveAdmin.ports.application.SaveAdminService.connect(..))")
|
"execution(* app.module.core.usecase.admin.saveAdmin.ports.application.SaveAdminService.connect(..))")
|
||||||
@@ -54,34 +51,7 @@ public class RoleUpdateAspect {
|
|||||||
// .map(adminUserWithRole -> adminUserWithRole.getRole().getId())
|
// .map(adminUserWithRole -> adminUserWithRole.getRole().getId())
|
||||||
// .collect(Collectors.toList());
|
// .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();
|
return joinPoint.proceed();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.AdminUpdateAccountLockPortIn;
|
||||||
import app.module.core.usecase.admin.status.ports.AdminUpdateLoginFailPortIn;
|
import app.module.core.usecase.admin.status.ports.AdminUpdateLoginFailPortIn;
|
||||||
import app.module.core.usecase.admin.view.ports.AdminViewPortIn;
|
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 jakarta.servlet.http.HttpServletRequest;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -31,7 +29,6 @@ public class AdminAuthFailEvent {
|
|||||||
private final AdminViewPortIn adminViewPortIn;
|
private final AdminViewPortIn adminViewPortIn;
|
||||||
private final AdminUpdateLoginFailPortIn updateLoginFailPortIn;
|
private final AdminUpdateLoginFailPortIn updateLoginFailPortIn;
|
||||||
private final AdminUpdateAccountLockPortIn updateAccountLockPortIn;
|
private final AdminUpdateAccountLockPortIn updateAccountLockPortIn;
|
||||||
private final OperationLogSavePortIn operationLogSavePortIn;
|
|
||||||
private final MessageUtil messageUtil;
|
private final MessageUtil messageUtil;
|
||||||
@Value("${app.admin.auth.fail.permit}")
|
@Value("${app.admin.auth.fail.permit}")
|
||||||
private int failPermit;
|
private int failPermit;
|
||||||
@@ -61,15 +58,6 @@ public class AdminAuthFailEvent {
|
|||||||
request.getSession(),
|
request.getSession(),
|
||||||
messageUtil.getMessage("security.auth.fail.exceed", failPermit));
|
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())));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package app.module.admin.usecase.communication.notice.getNotice.ports.application.domain;
|
package app.module.admin.usecase.communication.notice.getNotice.ports.application.domain;
|
||||||
|
|
||||||
import app.module.core.config.application.enums.FileUploadType;
|
import app.module.core.config.application.enums.FileUploadType;
|
||||||
|
import app.module.core.usecase.file.model.UploadFile;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -9,7 +10,7 @@ import java.io.Serializable;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DTO for {@link app.module.core.config.adapters.persistence.entity.UploadFile}
|
* DTO for {@link UploadFile}
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
|||||||
@@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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());
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
@@ -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이다.");*/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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
|
|
||||||
@@ -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;
|
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.config.application.enums.FileStorageType;
|
||||||
import app.module.core.usecase.file.createFile.ports.CreateFilePortOut;
|
import app.module.core.usecase.file.createFile.ports.CreateFilePortOut;
|
||||||
import app.module.core.usecase.file.createFile.ports.application.domain.CreateFile;
|
import app.module.core.usecase.file.createFile.ports.application.domain.CreateFile;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package app.module.core.usecase.file.createFile.adapters.persistence;
|
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;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
@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.adapters.persistence.component.AuditEntity;
|
||||||
import app.module.core.config.application.enums.FileUploadType;
|
import app.module.core.config.application.enums.FileUploadType;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package app.module.core.usecase.loggedinuser.save.adapter.persistence;
|
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.LoggedInUserSavePortOut;
|
||||||
import app.module.core.usecase.loggedinuser.save.ports.application.domain.LoggedInUserSaveCmd;
|
import app.module.core.usecase.loggedinuser.save.ports.application.domain.LoggedInUserSaveCmd;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package app.module.core.usecase.loggedinuser.save.adapter.persistence;
|
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;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
@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 app.module.core.config.application.enums.AppType;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 동시접속 사용자 체크를 위한 기록용 엔티티
|
* 사용자 로그
|
||||||
*/
|
*/
|
||||||
@Builder
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class LoggedInUser extends AuditEntity {
|
public class LoggedInUser {
|
||||||
|
|
||||||
private AppType appType;
|
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;
|
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.enums.AppType;
|
||||||
import app.module.core.config.application.util.AuditUtil;
|
import app.module.core.config.application.util.AuditUtil;
|
||||||
import app.module.core.usecase.role.save.adapters.persistence.model.RoleHasPrivilegeDeleteParam;
|
import app.module.core.usecase.role.save.adapters.persistence.model.RoleHasPrivilegeDeleteParam;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package app.module.core.usecase.role.save.adapters.persistence;
|
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.RoleHasPrivilegeDeleteParam;
|
||||||
import app.module.core.usecase.role.save.adapters.persistence.model.RoleHasPrivilegeSaveParam;
|
import app.module.core.usecase.role.save.adapters.persistence.model.RoleHasPrivilegeSaveParam;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
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 app.module.core.config.adapters.persistence.component.AuditEntity;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -10,7 +10,7 @@ import lombok.Setter;
|
|||||||
@Setter
|
@Setter
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class UICode extends AuditEntity {
|
public class UICode {
|
||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package app.module.core.usecase.uicode.save.adapters.persistence;
|
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.UICodeSavePortOut;
|
||||||
import app.module.core.usecase.uicode.save.ports.application.domain.UICodeSaveCommand;
|
import app.module.core.usecase.uicode.save.ports.application.domain.UICodeSaveCommand;
|
||||||
import app.module.core.usecase.uicode.view.adapters.persistence.UICodeViewMapper;
|
import app.module.core.usecase.uicode.view.adapters.persistence.UICodeViewMapper;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package app.module.core.usecase.uicode.save.adapters.persistence;
|
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;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package app.module.core.usecase.uicode.toptier.adapters.persistence;
|
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.UICodeTopTierPortOut;
|
||||||
import app.module.core.usecase.uicode.toptier.ports.application.domain.UICodeTopTier;
|
import app.module.core.usecase.uicode.toptier.ports.application.domain.UICodeTopTier;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package app.module.core.usecase.uicode.toptier.adapters.persistence;
|
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 org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package app.module.core.usecase.uri.currentmatch.ports.application;
|
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.enums.AppType;
|
||||||
import app.module.core.config.application.util.CommonUtil;
|
import app.module.core.config.application.util.CommonUtil;
|
||||||
import app.module.core.usecase.uri.currentmatch.ports.URICurrentMatchingPortIn;
|
import app.module.core.usecase.uri.currentmatch.ports.URICurrentMatchingPortIn;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package app.module.core.usecase.uri.getUris.adapters.persistence;
|
package app.module.core.usecase.uri.getUris.adapters.persistence;
|
||||||
|
|
||||||
import app.module.core.config.adapters.persistence.entity.Role;
|
import app.module.core.usecase.uri.model.Role;
|
||||||
import app.module.core.config.adapters.persistence.entity.RoleHasPrivilege;
|
import app.module.core.usecase.uri.model.RoleHasPrivilege;
|
||||||
import app.module.core.config.application.enums.AppType;
|
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.GetRolesDto;
|
||||||
import app.module.core.usecase.uri.getUris.adapters.persistence.model.GetUrisDto;
|
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;
|
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 app.module.core.config.application.enums.AppType;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
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.adapters.persistence.component.AuditEntity;
|
||||||
import app.module.core.config.application.enums.AppType;
|
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 app.module.core.config.adapters.persistence.component.AuditEntity;
|
||||||
import lombok.AllArgsConstructor;
|
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.adapters.persistence.component.AuditEntity;
|
||||||
import app.module.core.config.application.enums.AppType;
|
import app.module.core.config.application.enums.AppType;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package app.module.core.usecase.uri.save.adapters.persistence;
|
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.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.UriHasRoleDeleteParam;
|
||||||
import app.module.core.usecase.uri.save.adapters.persistence.model.UriHasRoleSaveParam;
|
import app.module.core.usecase.uri.save.adapters.persistence.model.UriHasRoleSaveParam;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package app.module.core.usecase.uri.save.adapters.persistence;
|
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.UriHasRoleDeleteParam;
|
||||||
import app.module.core.usecase.uri.save.adapters.persistence.model.UriHasRoleSaveParam;
|
import app.module.core.usecase.uri.save.adapters.persistence.model.UriHasRoleSaveParam;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package app.module.core.usecase.uri.view.ports.application;
|
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.config.application.enums.AppType;
|
||||||
import app.module.core.usecase.uri.getUris.ports.GetUrisPortIn;
|
import app.module.core.usecase.uri.getUris.ports.GetUrisPortIn;
|
||||||
import app.module.core.usecase.uri.view.ports.URIViewPortIn;
|
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;
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user