[2025.05.31] initData 작업
This commit is contained in:
@@ -34,7 +34,7 @@ public class RoleUpdateAspect {
|
||||
public Object operate(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
Object[] args = joinPoint.getArgs();
|
||||
|
||||
String adminId = (String) args[0];
|
||||
String adminId = (String) args[1];
|
||||
List<String> currentRoles = Collections.emptyList();
|
||||
|
||||
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||
|
||||
@@ -4,10 +4,6 @@ import app.module.core.config.adapters.web.security.domain.CorePrivilege;
|
||||
import app.module.core.config.adapters.web.security.domain.CoreRole;
|
||||
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.adminResearch.getAdmin.ports.GetAdminPortIn;
|
||||
import app.module.core.usecase.adminResearch.getAdmin.ports.application.domain.GetAdmin;
|
||||
import app.module.core.usecase.adminResearch.getAdmin.ports.application.domain.GetAdminCmd;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
import java.util.Optional;
|
||||
@@ -21,13 +17,13 @@ import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AdminDetailsService implements UserDetailsService {
|
||||
|
||||
private final AdminViewPortIn adminViewPortIn;
|
||||
private final GetAdminPortIn getAdminPortIn;
|
||||
|
||||
@Value("${app.admin.password.validity.period.days}")
|
||||
private long passwordValidPeriodDays;
|
||||
@@ -36,28 +32,23 @@ public class AdminDetailsService implements UserDetailsService {
|
||||
@Transactional
|
||||
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
||||
|
||||
GetAdmin getAdmin =
|
||||
getAdminPortIn
|
||||
.operate(new GetAdminCmd(username))
|
||||
AdminView adminUser =
|
||||
adminViewPortIn
|
||||
.connect(username)
|
||||
.orElseThrow(() -> new UsernameNotFoundException("Invalid username or password."));
|
||||
|
||||
// AdminView adminUser =
|
||||
// adminViewPortIn
|
||||
// .connect(username)
|
||||
// .orElseThrow(() -> new UsernameNotFoundException("Invalid username or password."));
|
||||
|
||||
boolean accountLocked = Optional.ofNullable(getAdmin.getAccountLocked()).orElse(false);
|
||||
boolean accountDisabled = Optional.ofNullable(getAdmin.getAccountDisabled()).orElse(false);
|
||||
boolean accountLocked = Optional.ofNullable(adminUser.getAccountLocked()).orElse(false);
|
||||
boolean accountDisabled = Optional.ofNullable(adminUser.getAccountDisabled()).orElse(false);
|
||||
|
||||
return new AdminUser(
|
||||
getAdmin.getId(),
|
||||
getAdmin.getPassword(),
|
||||
adminUser.getId(),
|
||||
adminUser.getPassword(),
|
||||
!accountDisabled,
|
||||
true,
|
||||
isCredentialsNonExpired(getAdmin.getPasswordUpdatedAt()),
|
||||
isCredentialsNonExpired(adminUser.getPasswordUpdatedAt()),
|
||||
!accountLocked,
|
||||
getAuthorities(getAdmin.getRoles()),
|
||||
passwordValidPeriodDays - getDaysPassedFrom(getAdmin.getPasswordUpdatedAt()));
|
||||
getAuthorities(adminUser.getRoles()),
|
||||
passwordValidPeriodDays - getDaysPassedFrom(adminUser.getPasswordUpdatedAt()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -38,6 +38,7 @@ public class AdminCreatePostController {
|
||||
}
|
||||
|
||||
savePortIn.connect(
|
||||
bindingVO.getSeq(),
|
||||
bindingVO.getId(),
|
||||
bindingVO.getPassword(),
|
||||
bindingVO.getEmail(),
|
||||
|
||||
@@ -48,6 +48,7 @@ class AdminUpdateGetController {
|
||||
output.getCreatedAt(),
|
||||
output.getUpdatedBy(),
|
||||
output.getUpdatedAt(),
|
||||
output.getSeq(),
|
||||
output.getId(),
|
||||
null,
|
||||
output.getEmail(),
|
||||
|
||||
@@ -38,6 +38,7 @@ class AdminUpdatePostController {
|
||||
}
|
||||
|
||||
saveAdminPortIn.connect(
|
||||
bindingVO.getSeq(),
|
||||
bindingVO.getId(),
|
||||
bindingVO.getUpdatePassword(),
|
||||
bindingVO.getEmail(),
|
||||
|
||||
@@ -11,7 +11,7 @@ import lombok.Setter;
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
public class AdminCreateBindingVO {
|
||||
|
||||
private Long seq;
|
||||
private String id;
|
||||
private String password;
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ public class AdminUpdateBindingVO implements AuditOutput {
|
||||
|
||||
private final LocalDateTime updatedAt;
|
||||
|
||||
private Long seq;
|
||||
private String id;
|
||||
private String updatePassword;
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package app.module.admin.usecase.analyst.dashboard.getAnalystDashboardUI;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import app.module.admin.usecase.analyst.dashboard.getAnalystDashboardUI.model.GetAnalystDashboardReqVO;
|
||||
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
class GetAnalystDashboardController {
|
||||
|
||||
@GetMapping(path = "/analyst/dashboard")
|
||||
String operate(
|
||||
Model model,
|
||||
@ModelAttribute("reqVO") GetAnalystDashboardReqVO reqVO) {
|
||||
|
||||
return "analyst/dashboard";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package app.module.admin.usecase.analyst.dashboard.getAnalystDashboardUI.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetAnalystDashboardReqVO {
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package app.module.admin.usecase.communication.notice.getNoticesUI;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import app.module.admin.usecase.communication.notice.getNoticesUI.model.GetNoticesReqVO;
|
||||
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
class GetNoticesController {
|
||||
|
||||
@GetMapping(path = "/communication/notices")
|
||||
String operate(
|
||||
Model model,
|
||||
@ModelAttribute("reqVO") GetNoticesReqVO reqVO) {
|
||||
|
||||
return "communication/notices";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package app.module.admin.usecase.communication.notice.getNoticesUI.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetNoticesReqVO {
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package app.module.admin.usecase.communication.sms.getSmsUI;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import app.module.admin.usecase.communication.sms.getSmsUI.model.GetSmsReqVO;
|
||||
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
class GetSmsController {
|
||||
|
||||
@GetMapping(path = "/communication/sms")
|
||||
String operate(
|
||||
Model model,
|
||||
@ModelAttribute("reqVO") GetSmsReqVO reqVO) {
|
||||
|
||||
return "communication/sms";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package app.module.admin.usecase.communication.sms.getSmsUI.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetSmsReqVO {
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package app.module.admin.usecase.household.getHouseholdsUI;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import app.module.admin.usecase.household.getHouseholdsUI.model.GetHouseholdsUIReqVO;
|
||||
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
class GetHouseholdsUIController {
|
||||
|
||||
@GetMapping(path = "/household/households")
|
||||
String operate(
|
||||
Model model,
|
||||
@ModelAttribute("reqVO") GetHouseholdsUIReqVO reqVO) {
|
||||
|
||||
return "household/households";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package app.module.admin.usecase.household.getHouseholdsUI.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetHouseholdsUIReqVO {
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package app.module.admin.usecase.researcher.dashboard.getResearcherDashboardUI.adapters.web;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import app.module.admin.usecase.researcher.dashboard.getResearcherDashboardUI.adapters.web.model.GetResearcherDashboardUIReqVO;
|
||||
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
class GetResearcherDashboardUIController {
|
||||
|
||||
@GetMapping(path = "/researcher/dashboard")
|
||||
String operate(
|
||||
Model model,
|
||||
@ModelAttribute("reqVO") GetResearcherDashboardUIReqVO reqVO) {
|
||||
|
||||
return "researcher/dashboard";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package app.module.admin.usecase.researcher.dashboard.getResearcherDashboardUI.adapters.web.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetResearcherDashboardUIReqVO {
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package app.module.admin.usecase.researcher.household.getResearcherHouseholdUI.web;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import app.module.admin.usecase.researcher.household.getResearcherHouseholdUI.web.model.GetResearcherHouseholdsUIReqVO;
|
||||
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
class GetResearcherHouseholdsUIController {
|
||||
|
||||
@GetMapping(path = "/researcher/households")
|
||||
String operate(
|
||||
Model model,
|
||||
@ModelAttribute("reqVO") GetResearcherHouseholdsUIReqVO reqVO) {
|
||||
|
||||
return "researcher/households";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package app.module.admin.usecase.researcher.household.getResearcherHouseholdUI.web.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetResearcherHouseholdsUIReqVO {
|
||||
}
|
||||
Reference in New Issue
Block a user