251222_03_ENH : 객체 생성 시간과 시스템 로그 시간 맞추기 위해 Controller로 시간 변수 이동

This commit is contained in:
2025-12-22 15:27:32 +09:00
parent 0dcbd4df63
commit cf3adf883b
13 changed files with 118 additions and 80 deletions

View File

@@ -1,5 +1,6 @@
package com.kri.contact.server.controller;
import com.kri.common.datetime.DateTimeUtil;
import com.kri.common.webmvc.RequestUserContext;
import com.kri.contact.server.common.consts.ContactConstant;
import com.kri.contact.server.dto.DataVerificationDto;
@@ -16,6 +17,7 @@ import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.time.LocalDateTime;
import java.util.Collections;
import java.util.List;
@@ -76,9 +78,10 @@ public class UserController {
public void createUser(@RequestBody UserInfoDto userInfo, RequestUserContext ctx){
String regId = ctx.getUserId();
String clientIp = ctx.getClientIp();
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
userService.createUser(userInfo, regId);
systemEventLogService.writeCreateUserLog(regId, clientIp, userInfo);
userService.createUser(userInfo, regId, now);
systemEventLogService.writeCreateUserLog(regId, now, clientIp, userInfo);
}
@PostMapping("/excel")
@@ -88,17 +91,18 @@ public class UserController {
) {
String regId = ctx.getUserId();
String clientIp = ctx.getClientIp();
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
//외주사급이 업로드로 계정을 생성하는 경우 자신의 회사명으로 고정
String forceCmpn = ctx.getUserRole() < ContactConstant.OUTSOURCE_USER_ROLE? "" : ctx.getUserCmpn();
ExcelUploadResponseDto result = userService.createUsersFromExcel(file, regId, forceCmpn);
ExcelUploadResponseDto result = userService.createUsersFromExcel(file, regId, now, forceCmpn);
UploadUserContentDto content = new UploadUserContentDto(
file.getOriginalFilename(),
file.getContentType(),
file.getSize()
);
systemEventLogService.writeUploadUserLog(regId, clientIp, content);
systemEventLogService.writeUploadUserLog(regId, now, clientIp, content);
return result;
}
@@ -119,17 +123,19 @@ public class UserController {
public void updateUser(@RequestBody UserInfoDto dto, RequestUserContext ctx){
String modId = ctx.getUserId();
String clientIp = ctx.getClientIp();
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
userService.updateUser(dto, modId);
systemEventLogService.writeUpdateUserLog(modId, clientIp, dto);
userService.updateUser(dto, modId, now);
systemEventLogService.writeUpdateUserLog(modId, now, clientIp, dto);
}
@DeleteMapping("/{userId}")
public void deleteUser(@PathVariable String userId, RequestUserContext ctx){
String regId = ctx.getUserId();
String clientIp = ctx.getClientIp();
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
userService.deleteUser(userId, regId);
systemEventLogService.writeDeleteUserLog(regId, clientIp, userId);
systemEventLogService.writeDeleteUserLog(regId, now, clientIp, userId);
}
}