251222_03_ENH : 객체 생성 시간과 시스템 로그 시간 맞추기 위해 Controller로 시간 변수 이동
This commit is contained in:
@@ -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.service.AssignService;
|
||||
import com.kri.contact.server.service.SystemEventLogService;
|
||||
@@ -7,6 +8,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@@ -30,7 +32,8 @@ public class AssignController {
|
||||
|
||||
@PutMapping("/prjct-fieldwork/{prjctIdx}")
|
||||
public void upsertPrjctFieldworkAssign(@PathVariable Long prjctIdx, @RequestBody List<String> assignUserIdList, RequestUserContext ctx){
|
||||
assignService.upsertPrjctFieldworkAssign(prjctIdx, assignUserIdList, ctx.getUserId());
|
||||
systemEventLogService.writeAssignUserProject(ctx.getUserId(), ctx.getClientIp(), prjctIdx, assignUserIdList);
|
||||
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||
assignService.upsertPrjctFieldworkAssign(prjctIdx, assignUserIdList, ctx.getUserId(), now);
|
||||
systemEventLogService.writeAssignUserProject(ctx.getUserId(), now, ctx.getClientIp(), prjctIdx, assignUserIdList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.dto.LoginRequestDto;
|
||||
import com.kri.contact.server.dto.LoginResponseDto;
|
||||
@@ -9,6 +10,8 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/auth")
|
||||
@RequiredArgsConstructor
|
||||
@@ -19,15 +22,19 @@ public class AuthController {
|
||||
|
||||
@PostMapping("/login")
|
||||
public LoginResponseDto tryLogin(@RequestBody LoginRequestDto request, RequestUserContext ctx){
|
||||
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||
|
||||
LoginResponseDto response = authService.tryLogin(request);
|
||||
systemEventLogService.writeLoginLog(response.getUser().getUserId(), ctx.getClientIp());
|
||||
systemEventLogService.writeLoginLog(response.getUser().getUserId(), now, ctx.getClientIp());
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
@PostMapping("/logout/{userId}")
|
||||
public boolean logout(@PathVariable String userId, RequestUserContext ctx){
|
||||
systemEventLogService.writeLogoutLog(userId, ctx.getClientIp());
|
||||
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||
|
||||
systemEventLogService.writeLogoutLog(userId, now, ctx.getClientIp());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -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.dto.*;
|
||||
import com.kri.contact.server.dto.common.PageResponseDto;
|
||||
@@ -11,6 +12,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@@ -55,8 +57,10 @@ public class ProjectController {
|
||||
@RequestBody ProjectCreateRequestDto req,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
ProjectInfoDto prjctInfo = projectService.createProject(req, ctx.getUserId());
|
||||
systemEventLogService.writeCreateProject(ctx.getUserId(), ctx.getClientIp(), prjctInfo.getPrjctIdx(), req);
|
||||
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||
|
||||
ProjectInfoDto prjctInfo = projectService.createProject(req, ctx.getUserId(), now);
|
||||
systemEventLogService.writeCreateProject(ctx.getUserId(), now, ctx.getClientIp(), prjctInfo.getPrjctIdx(), req);
|
||||
|
||||
return prjctInfo;
|
||||
}
|
||||
@@ -72,20 +76,24 @@ public class ProjectController {
|
||||
@RequestBody ProjectUpdateRequestDto req,
|
||||
RequestUserContext ctx
|
||||
){
|
||||
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||
|
||||
String newHtml = fileService.syncOnSave(
|
||||
req.getProjectInfo().getPrjctCd(),
|
||||
req.getProjectInfo().getContactSenario()
|
||||
);
|
||||
req.getProjectInfo().setContactSenario(newHtml);
|
||||
|
||||
projectService.updateProject(prjctIdx, req, ctx.getUserId());
|
||||
projectService.updateProject(prjctIdx, req, ctx.getUserId(), now);
|
||||
|
||||
systemEventLogService.writeUpdateProject(ctx.getUserId(), ctx.getClientIp(), prjctIdx, req);
|
||||
systemEventLogService.writeUpdateProject(ctx.getUserId(), now, ctx.getClientIp(), prjctIdx, req);
|
||||
}
|
||||
|
||||
@DeleteMapping("/{prjctIdx}")
|
||||
public void deleteProject(@PathVariable Long prjctIdx, RequestUserContext ctx){
|
||||
projectService.deleteProject(prjctIdx, ctx.getUserId());
|
||||
systemEventLogService.writeDeleteProject(ctx.getUserId(), ctx.getClientIp(), prjctIdx);
|
||||
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||
|
||||
projectService.deleteProject(prjctIdx, ctx.getUserId(), now);
|
||||
systemEventLogService.writeDeleteProject(ctx.getUserId(), now, ctx.getClientIp(), prjctIdx);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user