251222_03_ENH : 객체 생성 시간과 시스템 로그 시간 맞추기 위해 Controller로 시간 변수 이동
This commit is contained in:
@@ -21,6 +21,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -33,7 +34,7 @@ public class UserService {
|
||||
private final UserRepository userRepository;
|
||||
|
||||
@Transactional
|
||||
public void createUser(UserInfoDto userInfo, String regUser){
|
||||
public void createUser(UserInfoDto userInfo, String regUser, LocalDateTime regDt){
|
||||
List<RoleInfoDto> roleList = roleService.getRoleList();
|
||||
List<String> intranetUserList = intranetExtensionApiClient.getUserIdArray();
|
||||
|
||||
@@ -45,13 +46,13 @@ public class UserService {
|
||||
throw BusinessException.badRequest("WRONG_USER_DATA", firstFail.getErrMessage());
|
||||
}
|
||||
|
||||
TUserEntity entity = TUserEntity.fromDto(userInfo, regUser);
|
||||
TUserEntity entity = TUserEntity.fromDto(userInfo, regUser, regDt);
|
||||
|
||||
userRepository.save(entity);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public ExcelUploadResponseDto createUsersFromExcel(MultipartFile file, String regUser, String forceCmpn) {
|
||||
public ExcelUploadResponseDto createUsersFromExcel(MultipartFile file, String regUser, LocalDateTime regDt, String forceCmpn) {
|
||||
if (file == null || file.isEmpty()) {
|
||||
throw BusinessException.badRequest("EMPTY_FILE", "업로드된 파일이 없습니다.");
|
||||
}
|
||||
@@ -95,7 +96,7 @@ public class UserService {
|
||||
|
||||
// 2) 실제 DB 저장
|
||||
try {
|
||||
this.createUserInternal(dto, regUser);
|
||||
this.createUserInternal(dto, regUser, regDt);
|
||||
successCount++;
|
||||
} catch (BusinessException ex) {
|
||||
// 시스템/비즈니스 예외도 에러 목록에 추가
|
||||
@@ -191,7 +192,7 @@ public class UserService {
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void updateUser(UserInfoDto dto, String modUser){
|
||||
public void updateUser(UserInfoDto dto, String modUser, LocalDateTime modDt){
|
||||
// dirty checking 업데이트
|
||||
TUserEntity entity = userRepository.findByUserIdAndDelFalse(dto.getUserId())
|
||||
.orElseThrow(() ->
|
||||
@@ -199,7 +200,7 @@ public class UserService {
|
||||
.with("userId", dto.getUserId())
|
||||
);
|
||||
|
||||
entity.updateFromDto(dto, modUser);// 기존 엔티티에 적용
|
||||
entity.updateFromDto(dto, modUser, modDt);// 기존 엔티티에 적용
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@@ -336,11 +337,11 @@ public class UserService {
|
||||
return errors;
|
||||
}
|
||||
|
||||
private void createUserInternal(UserInfoDto userInfo, String regUser) {
|
||||
private void createUserInternal(UserInfoDto userInfo, String regUser, LocalDateTime regDt) {
|
||||
userInfo.setUserId(userInfo.getUserId().toLowerCase());
|
||||
userInfo.setUserTeam("S101");
|
||||
|
||||
TUserEntity entity = TUserEntity.fromDto(userInfo, regUser);
|
||||
TUserEntity entity = TUserEntity.fromDto(userInfo, regUser, regDt);
|
||||
userRepository.save(entity);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user