251222_03_ENH : 객체 생성 시간과 시스템 로그 시간 맞추기 위해 Controller로 시간 변수 이동
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package com.kri.contact.server.controller;
|
package com.kri.contact.server.controller;
|
||||||
|
|
||||||
|
import com.kri.common.datetime.DateTimeUtil;
|
||||||
import com.kri.common.webmvc.RequestUserContext;
|
import com.kri.common.webmvc.RequestUserContext;
|
||||||
import com.kri.contact.server.service.AssignService;
|
import com.kri.contact.server.service.AssignService;
|
||||||
import com.kri.contact.server.service.SystemEventLogService;
|
import com.kri.contact.server.service.SystemEventLogService;
|
||||||
@@ -7,6 +8,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -30,7 +32,8 @@ public class AssignController {
|
|||||||
|
|
||||||
@PutMapping("/prjct-fieldwork/{prjctIdx}")
|
@PutMapping("/prjct-fieldwork/{prjctIdx}")
|
||||||
public void upsertPrjctFieldworkAssign(@PathVariable Long prjctIdx, @RequestBody List<String> assignUserIdList, RequestUserContext ctx){
|
public void upsertPrjctFieldworkAssign(@PathVariable Long prjctIdx, @RequestBody List<String> assignUserIdList, RequestUserContext ctx){
|
||||||
assignService.upsertPrjctFieldworkAssign(prjctIdx, assignUserIdList, ctx.getUserId());
|
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||||
systemEventLogService.writeAssignUserProject(ctx.getUserId(), ctx.getClientIp(), prjctIdx, assignUserIdList);
|
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;
|
package com.kri.contact.server.controller;
|
||||||
|
|
||||||
|
import com.kri.common.datetime.DateTimeUtil;
|
||||||
import com.kri.common.webmvc.RequestUserContext;
|
import com.kri.common.webmvc.RequestUserContext;
|
||||||
import com.kri.contact.server.dto.LoginRequestDto;
|
import com.kri.contact.server.dto.LoginRequestDto;
|
||||||
import com.kri.contact.server.dto.LoginResponseDto;
|
import com.kri.contact.server.dto.LoginResponseDto;
|
||||||
@@ -9,6 +10,8 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/v1/auth")
|
@RequestMapping("/api/v1/auth")
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@@ -19,15 +22,19 @@ public class AuthController {
|
|||||||
|
|
||||||
@PostMapping("/login")
|
@PostMapping("/login")
|
||||||
public LoginResponseDto tryLogin(@RequestBody LoginRequestDto request, RequestUserContext ctx){
|
public LoginResponseDto tryLogin(@RequestBody LoginRequestDto request, RequestUserContext ctx){
|
||||||
|
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||||
|
|
||||||
LoginResponseDto response = authService.tryLogin(request);
|
LoginResponseDto response = authService.tryLogin(request);
|
||||||
systemEventLogService.writeLoginLog(response.getUser().getUserId(), ctx.getClientIp());
|
systemEventLogService.writeLoginLog(response.getUser().getUserId(), now, ctx.getClientIp());
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/logout/{userId}")
|
@PostMapping("/logout/{userId}")
|
||||||
public boolean logout(@PathVariable String userId, RequestUserContext ctx){
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.kri.contact.server.controller;
|
package com.kri.contact.server.controller;
|
||||||
|
|
||||||
|
import com.kri.common.datetime.DateTimeUtil;
|
||||||
import com.kri.common.webmvc.RequestUserContext;
|
import com.kri.common.webmvc.RequestUserContext;
|
||||||
import com.kri.contact.server.dto.*;
|
import com.kri.contact.server.dto.*;
|
||||||
import com.kri.contact.server.dto.common.PageResponseDto;
|
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.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -55,8 +57,10 @@ public class ProjectController {
|
|||||||
@RequestBody ProjectCreateRequestDto req,
|
@RequestBody ProjectCreateRequestDto req,
|
||||||
RequestUserContext ctx
|
RequestUserContext ctx
|
||||||
) {
|
) {
|
||||||
ProjectInfoDto prjctInfo = projectService.createProject(req, ctx.getUserId());
|
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||||
systemEventLogService.writeCreateProject(ctx.getUserId(), ctx.getClientIp(), prjctInfo.getPrjctIdx(), req);
|
|
||||||
|
ProjectInfoDto prjctInfo = projectService.createProject(req, ctx.getUserId(), now);
|
||||||
|
systemEventLogService.writeCreateProject(ctx.getUserId(), now, ctx.getClientIp(), prjctInfo.getPrjctIdx(), req);
|
||||||
|
|
||||||
return prjctInfo;
|
return prjctInfo;
|
||||||
}
|
}
|
||||||
@@ -72,20 +76,24 @@ public class ProjectController {
|
|||||||
@RequestBody ProjectUpdateRequestDto req,
|
@RequestBody ProjectUpdateRequestDto req,
|
||||||
RequestUserContext ctx
|
RequestUserContext ctx
|
||||||
){
|
){
|
||||||
|
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||||
|
|
||||||
String newHtml = fileService.syncOnSave(
|
String newHtml = fileService.syncOnSave(
|
||||||
req.getProjectInfo().getPrjctCd(),
|
req.getProjectInfo().getPrjctCd(),
|
||||||
req.getProjectInfo().getContactSenario()
|
req.getProjectInfo().getContactSenario()
|
||||||
);
|
);
|
||||||
req.getProjectInfo().setContactSenario(newHtml);
|
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}")
|
@DeleteMapping("/{prjctIdx}")
|
||||||
public void deleteProject(@PathVariable Long prjctIdx, RequestUserContext ctx){
|
public void deleteProject(@PathVariable Long prjctIdx, RequestUserContext ctx){
|
||||||
projectService.deleteProject(prjctIdx, ctx.getUserId());
|
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||||
systemEventLogService.writeDeleteProject(ctx.getUserId(), ctx.getClientIp(), prjctIdx);
|
|
||||||
|
projectService.deleteProject(prjctIdx, ctx.getUserId(), now);
|
||||||
|
systemEventLogService.writeDeleteProject(ctx.getUserId(), now, ctx.getClientIp(), prjctIdx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.kri.contact.server.controller;
|
package com.kri.contact.server.controller;
|
||||||
|
|
||||||
|
import com.kri.common.datetime.DateTimeUtil;
|
||||||
import com.kri.common.webmvc.RequestUserContext;
|
import com.kri.common.webmvc.RequestUserContext;
|
||||||
import com.kri.contact.server.common.consts.ContactConstant;
|
import com.kri.contact.server.common.consts.ContactConstant;
|
||||||
import com.kri.contact.server.dto.DataVerificationDto;
|
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.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -76,9 +78,10 @@ public class UserController {
|
|||||||
public void createUser(@RequestBody UserInfoDto userInfo, RequestUserContext ctx){
|
public void createUser(@RequestBody UserInfoDto userInfo, RequestUserContext ctx){
|
||||||
String regId = ctx.getUserId();
|
String regId = ctx.getUserId();
|
||||||
String clientIp = ctx.getClientIp();
|
String clientIp = ctx.getClientIp();
|
||||||
|
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||||
|
|
||||||
userService.createUser(userInfo, regId);
|
userService.createUser(userInfo, regId, now);
|
||||||
systemEventLogService.writeCreateUserLog(regId, clientIp, userInfo);
|
systemEventLogService.writeCreateUserLog(regId, now, clientIp, userInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/excel")
|
@PostMapping("/excel")
|
||||||
@@ -88,17 +91,18 @@ public class UserController {
|
|||||||
) {
|
) {
|
||||||
String regId = ctx.getUserId();
|
String regId = ctx.getUserId();
|
||||||
String clientIp = ctx.getClientIp();
|
String clientIp = ctx.getClientIp();
|
||||||
|
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||||
//외주사급이 업로드로 계정을 생성하는 경우 자신의 회사명으로 고정
|
//외주사급이 업로드로 계정을 생성하는 경우 자신의 회사명으로 고정
|
||||||
String forceCmpn = ctx.getUserRole() < ContactConstant.OUTSOURCE_USER_ROLE? "" : ctx.getUserCmpn();
|
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(
|
UploadUserContentDto content = new UploadUserContentDto(
|
||||||
file.getOriginalFilename(),
|
file.getOriginalFilename(),
|
||||||
file.getContentType(),
|
file.getContentType(),
|
||||||
file.getSize()
|
file.getSize()
|
||||||
);
|
);
|
||||||
systemEventLogService.writeUploadUserLog(regId, clientIp, content);
|
systemEventLogService.writeUploadUserLog(regId, now, clientIp, content);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -119,17 +123,19 @@ public class UserController {
|
|||||||
public void updateUser(@RequestBody UserInfoDto dto, RequestUserContext ctx){
|
public void updateUser(@RequestBody UserInfoDto dto, RequestUserContext ctx){
|
||||||
String modId = ctx.getUserId();
|
String modId = ctx.getUserId();
|
||||||
String clientIp = ctx.getClientIp();
|
String clientIp = ctx.getClientIp();
|
||||||
|
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||||
|
|
||||||
userService.updateUser(dto, modId);
|
userService.updateUser(dto, modId, now);
|
||||||
systemEventLogService.writeUpdateUserLog(modId, clientIp, dto);
|
systemEventLogService.writeUpdateUserLog(modId, now, clientIp, dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("/{userId}")
|
@DeleteMapping("/{userId}")
|
||||||
public void deleteUser(@PathVariable String userId, RequestUserContext ctx){
|
public void deleteUser(@PathVariable String userId, RequestUserContext ctx){
|
||||||
String regId = ctx.getUserId();
|
String regId = ctx.getUserId();
|
||||||
String clientIp = ctx.getClientIp();
|
String clientIp = ctx.getClientIp();
|
||||||
|
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||||
|
|
||||||
userService.deleteUser(userId, regId);
|
userService.deleteUser(userId, regId);
|
||||||
systemEventLogService.writeDeleteUserLog(regId, clientIp, userId);
|
systemEventLogService.writeDeleteUserLog(regId, now, clientIp, userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ public class TPrjctEntity {
|
|||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TPrjctEntity create(ProjectCreateRequestDto req, String prjctCd, String regUser){
|
public static TPrjctEntity create(ProjectCreateRequestDto req, String prjctCd, String regUser, LocalDateTime regDt){
|
||||||
return TPrjctEntity.builder()
|
return TPrjctEntity.builder()
|
||||||
.prjctCd(prjctCd)
|
.prjctCd(prjctCd)
|
||||||
.prjctNm(req.getPrjctName())
|
.prjctNm(req.getPrjctName())
|
||||||
@@ -139,11 +139,11 @@ public class TPrjctEntity {
|
|||||||
.ownerDept(req.getOwnerDept())
|
.ownerDept(req.getOwnerDept())
|
||||||
.ownerFw(req.getOwnerFw())
|
.ownerFw(req.getOwnerFw())
|
||||||
.regUser(regUser)
|
.regUser(regUser)
|
||||||
.regDt(DateTimeUtil.nowKstLocalDateTime())
|
.regDt(regDt)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateFrom(ProjectInfoDto dto, String modUser) {
|
public void updateFrom(ProjectInfoDto dto, String modUser, LocalDateTime modDt) {
|
||||||
this.prjctNm = dto.getPrjctName();
|
this.prjctNm = dto.getPrjctName();
|
||||||
this.prjctStatus = dto.getPrjctStatus().getCode();
|
this.prjctStatus = dto.getPrjctStatus().getCode();
|
||||||
this.ownerDept = dto.getOwnerDept();
|
this.ownerDept = dto.getOwnerDept();
|
||||||
@@ -156,6 +156,6 @@ public class TPrjctEntity {
|
|||||||
this.contactSenario = dto.getContactSenario();
|
this.contactSenario = dto.getContactSenario();
|
||||||
|
|
||||||
this.modUser = modUser;
|
this.modUser = modUser;
|
||||||
this.modDt = DateTimeUtil.nowKstLocalDateTime();
|
this.modDt = modDt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -55,22 +55,23 @@ public class TResultCodeEntity {
|
|||||||
public static TResultCodeEntity copyFromDefault(
|
public static TResultCodeEntity copyFromDefault(
|
||||||
TResultCodeEntity src,
|
TResultCodeEntity src,
|
||||||
Long prjctIdx,
|
Long prjctIdx,
|
||||||
String regUser
|
String regUser,
|
||||||
|
LocalDateTime regDt
|
||||||
) {
|
) {
|
||||||
return TResultCodeEntity.builder()
|
return TResultCodeEntity.builder()
|
||||||
.id(TResultCodeEntityId.create(prjctIdx, src.getResultCdTy(), src.getResultCd()))
|
.id(TResultCodeEntityId.create(prjctIdx, src.getResultCdTy(), src.getResultCd()))
|
||||||
.resultCdLbl(src.getResultCdLbl())
|
.resultCdLbl(src.getResultCdLbl())
|
||||||
.regUser(regUser)
|
.regUser(regUser)
|
||||||
.regDt(DateTimeUtil.nowKstLocalDateTime())
|
.regDt(regDt)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TResultCodeEntity fromDto(Long prjctIdx, ResultCodeType resultCdTy, ResultCodeDto req, String regUser) {
|
public static TResultCodeEntity fromDto(Long prjctIdx, ResultCodeType resultCdTy, ResultCodeDto req, String regUser, LocalDateTime regDt) {
|
||||||
return TResultCodeEntity.builder()
|
return TResultCodeEntity.builder()
|
||||||
.id(TResultCodeEntityId.create(prjctIdx, resultCdTy, req.getResultCd()))
|
.id(TResultCodeEntityId.create(prjctIdx, resultCdTy, req.getResultCd()))
|
||||||
.resultCdLbl(req.getResultCdLbl())
|
.resultCdLbl(req.getResultCdLbl())
|
||||||
.regUser(regUser)
|
.regUser(regUser)
|
||||||
.regDt(DateTimeUtil.nowKstLocalDateTime())
|
.regDt(regDt)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,8 @@ public class TSysEventLogEntity {
|
|||||||
Map<String, Object> logContent,
|
Map<String, Object> logContent,
|
||||||
Long prjctIdx,
|
Long prjctIdx,
|
||||||
String ip,
|
String ip,
|
||||||
String regUser
|
String regUser,
|
||||||
|
LocalDateTime regDt
|
||||||
) {
|
) {
|
||||||
return TSysEventLogEntity.builder()
|
return TSysEventLogEntity.builder()
|
||||||
.eventTy(eventTy.getCode())
|
.eventTy(eventTy.getCode())
|
||||||
@@ -73,7 +74,7 @@ public class TSysEventLogEntity {
|
|||||||
.prjctIdx(prjctIdx)
|
.prjctIdx(prjctIdx)
|
||||||
.ip(ip)
|
.ip(ip)
|
||||||
.regUser(regUser)
|
.regUser(regUser)
|
||||||
.regDt(DateTimeUtil.nowKstLocalDateTime())
|
.regDt(regDt)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -88,7 +88,7 @@ public class TUserEntity {
|
|||||||
@Column(name = "del_dt")
|
@Column(name = "del_dt")
|
||||||
private LocalDateTime delDt;
|
private LocalDateTime delDt;
|
||||||
|
|
||||||
public static TUserEntity fromDto(UserInfoDto dto, String regUser) {
|
public static TUserEntity fromDto(UserInfoDto dto, String regUser, LocalDateTime regDt) {
|
||||||
return TUserEntity.builder()
|
return TUserEntity.builder()
|
||||||
.userId(dto.getUserId())
|
.userId(dto.getUserId())
|
||||||
.userPw(dto.getUserPw())
|
.userPw(dto.getUserPw())
|
||||||
@@ -102,11 +102,11 @@ public class TUserEntity {
|
|||||||
.userRole(dto.getUserRole())
|
.userRole(dto.getUserRole())
|
||||||
.memo(dto.getMemo() != null ? dto.getMemo() : "")
|
.memo(dto.getMemo() != null ? dto.getMemo() : "")
|
||||||
.regUser(regUser)
|
.regUser(regUser)
|
||||||
.regDt(DateTimeUtil.nowKstLocalDateTime())
|
.regDt(regDt)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateFromDto(UserInfoDto dto, String modUser) {
|
public void updateFromDto(UserInfoDto dto, String modUser, LocalDateTime modDt) {
|
||||||
// 비번은 값이 있을 때만 변경
|
// 비번은 값이 있을 때만 변경
|
||||||
if (dto.getUserPw() != null && !dto.getUserPw().isBlank()) {
|
if (dto.getUserPw() != null && !dto.getUserPw().isBlank()) {
|
||||||
this.userPw = dto.getUserPw();
|
this.userPw = dto.getUserPw();
|
||||||
@@ -117,6 +117,6 @@ public class TUserEntity {
|
|||||||
this.memo = (dto.getMemo() != null) ? dto.getMemo() : "";
|
this.memo = (dto.getMemo() != null) ? dto.getMemo() : "";
|
||||||
|
|
||||||
this.modUser = modUser;
|
this.modUser = modUser;
|
||||||
this.modDt = DateTimeUtil.nowKstLocalDateTime();
|
this.modDt = modDt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -34,28 +34,28 @@ public class AssignService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void upsertPrjctOutsourceAssign(Long prjctIdx, List<String> assignUserIdList, String regUser){
|
public void upsertPrjctOutsourceAssign(Long prjctIdx, List<String> assignUserIdList, String regUser, LocalDateTime regDt){
|
||||||
projectAssignRepository.deleteAssignByPrjctIdxAndRoleRange(
|
projectAssignRepository.deleteAssignByPrjctIdxAndRoleRange(
|
||||||
prjctIdx,
|
prjctIdx,
|
||||||
ContactConstant.OUTSOURCE_USER_ROLE,
|
ContactConstant.OUTSOURCE_USER_ROLE,
|
||||||
ContactConstant.OUTSOURCE_USER_ROLE + 1000
|
ContactConstant.OUTSOURCE_USER_ROLE + 1000
|
||||||
);
|
);
|
||||||
|
|
||||||
insertPrjctAssign(prjctIdx, assignUserIdList, regUser);
|
insertPrjctAssign(prjctIdx, assignUserIdList, regUser, regDt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void upsertPrjctFieldworkAssign(Long prjctIdx, List<String> assignUserIdList, String regUser){
|
public void upsertPrjctFieldworkAssign(Long prjctIdx, List<String> assignUserIdList, String regUser, LocalDateTime regDt){
|
||||||
projectAssignRepository.deleteAssignByPrjctIdxAndRoleRange(
|
projectAssignRepository.deleteAssignByPrjctIdxAndRoleRange(
|
||||||
prjctIdx,
|
prjctIdx,
|
||||||
ContactConstant.FIELDWORK_USER_ROLE,
|
ContactConstant.FIELDWORK_USER_ROLE,
|
||||||
ContactConstant.FIELDWORK_USER_ROLE + 1000
|
ContactConstant.FIELDWORK_USER_ROLE + 1000
|
||||||
);
|
);
|
||||||
|
|
||||||
insertPrjctAssign(prjctIdx, assignUserIdList, regUser);
|
insertPrjctAssign(prjctIdx, assignUserIdList, regUser, regDt);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void insertPrjctAssign(Long prjctIdx, List<String> assignUserIdList, String regUser){
|
private void insertPrjctAssign(Long prjctIdx, List<String> assignUserIdList, String regUser, LocalDateTime regDt){
|
||||||
if (assignUserIdList == null || assignUserIdList.isEmpty()) {
|
if (assignUserIdList == null || assignUserIdList.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -68,10 +68,8 @@ public class AssignService {
|
|||||||
|
|
||||||
if (normalized.isEmpty()) return;
|
if (normalized.isEmpty()) return;
|
||||||
|
|
||||||
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
|
||||||
|
|
||||||
List<TPrjctAssignEntity> entities = normalized.stream()
|
List<TPrjctAssignEntity> entities = normalized.stream()
|
||||||
.map(uid -> TPrjctAssignEntity.create(prjctIdx, uid, regUser, now))
|
.map(uid -> TPrjctAssignEntity.create(prjctIdx, uid, regUser, regDt))
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
projectAssignRepository.saveAll(entities);
|
projectAssignRepository.saveAll(entities);
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import org.springframework.data.jpa.domain.Specification;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@@ -29,15 +30,15 @@ public class ProjectService {
|
|||||||
private static final List<Short> STATUS_1 = List.of((short) 1);
|
private static final List<Short> STATUS_1 = List.of((short) 1);
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public ProjectInfoDto createProject(ProjectCreateRequestDto req, String regUser) {
|
public ProjectInfoDto createProject(ProjectCreateRequestDto req, String regUser, LocalDateTime regDt) {
|
||||||
String itrnt = req.getItrntPrjctCd();
|
String itrnt = req.getItrntPrjctCd();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String prjctCd = this.makePrjctCd(itrnt);
|
String prjctCd = this.makePrjctCd(itrnt);
|
||||||
TPrjctEntity entity = TPrjctEntity.create(req, prjctCd, regUser);
|
TPrjctEntity entity = TPrjctEntity.create(req, prjctCd, regUser, regDt);
|
||||||
|
|
||||||
ProjectInfoDto savedProject = ProjectInfoDto.from(projectRepository.save(entity));
|
ProjectInfoDto savedProject = ProjectInfoDto.from(projectRepository.save(entity));
|
||||||
resultCodeService.copyResultCodeFromDefault(savedProject.getPrjctIdx(), regUser);
|
resultCodeService.copyResultCodeFromDefault(savedProject.getPrjctIdx(), regUser, regDt);
|
||||||
|
|
||||||
return savedProject;
|
return savedProject;
|
||||||
} catch (DataIntegrityViolationException e) {
|
} catch (DataIntegrityViolationException e) {
|
||||||
@@ -132,7 +133,7 @@ public class ProjectService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void updateProject(long prjctIdx, ProjectUpdateRequestDto req, String modUser){
|
public void updateProject(long prjctIdx, ProjectUpdateRequestDto req, String modUser, LocalDateTime modDt){
|
||||||
// dirty checking 업데이트
|
// dirty checking 업데이트
|
||||||
TPrjctEntity entity = projectRepository.findById(prjctIdx)
|
TPrjctEntity entity = projectRepository.findById(prjctIdx)
|
||||||
.orElseThrow(() ->
|
.orElseThrow(() ->
|
||||||
@@ -140,15 +141,15 @@ public class ProjectService {
|
|||||||
.with("prjctIdx", prjctIdx)
|
.with("prjctIdx", prjctIdx)
|
||||||
);
|
);
|
||||||
|
|
||||||
entity.updateFrom(req.getProjectInfo(), modUser);
|
entity.updateFrom(req.getProjectInfo(), modUser, modDt);
|
||||||
|
|
||||||
assignService.upsertPrjctOutsourceAssign(prjctIdx, req.getAssignUserIdList(), modUser);
|
assignService.upsertPrjctOutsourceAssign(prjctIdx, req.getAssignUserIdList(), modUser, modDt);
|
||||||
resultCodeService.updateResultCode(prjctIdx, req.getResultCodeList(), modUser);
|
resultCodeService.updateResultCode(prjctIdx, req.getResultCodeList(), modUser, modDt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void deleteProject(Long prjctIdx, String delUser){
|
public void deleteProject(Long prjctIdx, String delUser, LocalDateTime delDt){
|
||||||
int deleteCount = projectRepository.softDeleteByPrjctIdx(prjctIdx, delUser, DateTimeUtil.nowKstLocalDateTime());
|
int deleteCount = projectRepository.softDeleteByPrjctIdx(prjctIdx, delUser, delDt);
|
||||||
|
|
||||||
if(deleteCount == 0){
|
if(deleteCount == 0){
|
||||||
throw BusinessException.notFound("PROJECT_NOT_FOUND", "프로젝트를 찾을 수 없습니다.")
|
throw BusinessException.notFound("PROJECT_NOT_FOUND", "프로젝트를 찾을 수 없습니다.")
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -21,11 +22,11 @@ public class ResultCodeService {
|
|||||||
|
|
||||||
private final ResultCodeRepository resultCodeRepository;
|
private final ResultCodeRepository resultCodeRepository;
|
||||||
|
|
||||||
public void copyResultCodeFromDefault(long prjctIdx, String regUser){
|
public void copyResultCodeFromDefault(long prjctIdx, String regUser, LocalDateTime regDt){
|
||||||
List<TResultCodeEntity> defaultCodeList = resultCodeRepository.findDefault();
|
List<TResultCodeEntity> defaultCodeList = resultCodeRepository.findDefault();
|
||||||
|
|
||||||
List<TResultCodeEntity> copyCodeList = defaultCodeList.stream()
|
List<TResultCodeEntity> copyCodeList = defaultCodeList.stream()
|
||||||
.map(src -> TResultCodeEntity.copyFromDefault(src, prjctIdx, regUser))
|
.map(src -> TResultCodeEntity.copyFromDefault(src, prjctIdx, regUser, regDt))
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
resultCodeRepository.saveAll(copyCodeList);
|
resultCodeRepository.saveAll(copyCodeList);
|
||||||
@@ -44,24 +45,24 @@ public class ResultCodeService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void updateResultCode(long prjctIdx, List<ResultCodeDto> resultCodeDtoList, String modUser){
|
public void updateResultCode(long prjctIdx, List<ResultCodeDto> resultCodeDtoList, String modUser, LocalDateTime modDt){
|
||||||
if (resultCodeDtoList != null && !resultCodeDtoList.isEmpty()) {
|
if (resultCodeDtoList != null && !resultCodeDtoList.isEmpty()) {
|
||||||
Map<ResultCodeType, List<ResultCodeDto>> dtoGroupByType = resultCodeDtoList.stream()
|
Map<ResultCodeType, List<ResultCodeDto>> dtoGroupByType = resultCodeDtoList.stream()
|
||||||
.filter(dto -> dto.getResultCdTy() != null)
|
.filter(dto -> dto.getResultCdTy() != null)
|
||||||
.collect(Collectors.groupingBy(ResultCodeDto::getResultCdTy));
|
.collect(Collectors.groupingBy(ResultCodeDto::getResultCdTy));
|
||||||
|
|
||||||
dtoGroupByType.forEach((resultCdTy, dtos) ->
|
dtoGroupByType.forEach((resultCdTy, dtos) ->
|
||||||
replaceResultCodes(prjctIdx, resultCdTy, dtos, modUser)
|
replaceResultCodes(prjctIdx, resultCdTy, dtos, modUser, modDt)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************private************************************/
|
/*************************private************************************/
|
||||||
private void replaceResultCodes(long prjctIdx, ResultCodeType resultCdTy, List<ResultCodeDto> dtos, String userId) {
|
private void replaceResultCodes(long prjctIdx, ResultCodeType resultCdTy, List<ResultCodeDto> dtos, String userId, LocalDateTime modDt) {
|
||||||
resultCodeRepository.deleteByIdPrjctIdxAndIdResultCdTy(prjctIdx, resultCdTy);
|
resultCodeRepository.deleteByIdPrjctIdxAndIdResultCdTy(prjctIdx, resultCdTy);
|
||||||
|
|
||||||
List<TResultCodeEntity> entities = dtos.stream()
|
List<TResultCodeEntity> entities = dtos.stream()
|
||||||
.map(dto -> TResultCodeEntity.fromDto(prjctIdx, resultCdTy, dto, userId))
|
.map(dto -> TResultCodeEntity.fromDto(prjctIdx, resultCdTy, dto, userId, modDt))
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
resultCodeRepository.saveAll(entities);
|
resultCodeRepository.saveAll(entities);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.kri.contact.server.service;
|
package com.kri.contact.server.service;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.kri.common.datetime.DateTimeUtil;
|
||||||
import com.kri.contact.server.dto.*;
|
import com.kri.contact.server.dto.*;
|
||||||
import com.kri.contact.server.dto.systemlog.UploadUserContentDto;
|
import com.kri.contact.server.dto.systemlog.UploadUserContentDto;
|
||||||
import com.kri.contact.server.common.enums.SystemEventType;
|
import com.kri.contact.server.common.enums.SystemEventType;
|
||||||
@@ -9,6 +10,7 @@ import com.kri.contact.server.persistence.repository.SystemEventLogRepository;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -20,80 +22,85 @@ public class SystemEventLogService {
|
|||||||
private final ObjectMapper objectMapper;
|
private final ObjectMapper objectMapper;
|
||||||
private final SystemEventLogRepository systemEventLogRepository;
|
private final SystemEventLogRepository systemEventLogRepository;
|
||||||
|
|
||||||
public void writeLoginLog(String userId, String clientIp) {
|
public void writeLoginLog(String userId, LocalDateTime regDt, String clientIp) {
|
||||||
writeSystemLog(
|
writeSystemLog(
|
||||||
SystemEventType.LOGIN,
|
SystemEventType.LOGIN,
|
||||||
"Login",
|
"Login",
|
||||||
null,
|
null,
|
||||||
userId,
|
userId,
|
||||||
|
regDt,
|
||||||
clientIp,
|
clientIp,
|
||||||
"userId",
|
"userId",
|
||||||
userId
|
userId
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeLogoutLog(String userId, String clientIp) {
|
public void writeLogoutLog(String userId, LocalDateTime regDt, String clientIp) {
|
||||||
writeSystemLog(
|
writeSystemLog(
|
||||||
SystemEventType.LOGOUT,
|
SystemEventType.LOGOUT,
|
||||||
"Logout",
|
"Logout",
|
||||||
null,
|
null,
|
||||||
userId,
|
userId,
|
||||||
|
regDt,
|
||||||
clientIp,
|
clientIp,
|
||||||
"userId",
|
"userId",
|
||||||
userId
|
userId
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeCreateUserLog(String regId, String clientIp, UserInfoDto userInfo){
|
public void writeCreateUserLog(String regId, LocalDateTime regDt, String clientIp, UserInfoDto userInfo){
|
||||||
writeSystemLog(SystemEventType.CREATE_USER, "Create User", null, regId, clientIp, userInfo);
|
writeSystemLog(SystemEventType.CREATE_USER, "Create User", null, regId, regDt, clientIp, userInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeUploadUserLog(String regId, String clientIp, UploadUserContentDto content){
|
public void writeUploadUserLog(String regId, LocalDateTime regDt, String clientIp, UploadUserContentDto content){
|
||||||
writeSystemLog(SystemEventType.UPLOAD_USER, "Upload User", null, regId, clientIp, content);
|
writeSystemLog(SystemEventType.UPLOAD_USER, "Upload User", null, regId, regDt, clientIp, content);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeUpdateUserLog(String regId, String clientIp, UserInfoDto userInfo){
|
public void writeUpdateUserLog(String regId, LocalDateTime regDt, String clientIp, UserInfoDto userInfo){
|
||||||
writeSystemLog(SystemEventType.UPDATE_USER, "Update User", null, regId, clientIp, userInfo);
|
writeSystemLog(SystemEventType.UPDATE_USER, "Update User", null, regId, regDt, clientIp, userInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeDeleteUserLog(String regId, String clientIp, String userId){
|
public void writeDeleteUserLog(String regId, LocalDateTime regDt, String clientIp, String userId){
|
||||||
writeSystemLog(
|
writeSystemLog(
|
||||||
SystemEventType.DELETE_USER,
|
SystemEventType.DELETE_USER,
|
||||||
"Delete User",
|
"Delete User",
|
||||||
null,
|
null,
|
||||||
regId,
|
regId,
|
||||||
|
regDt,
|
||||||
clientIp,
|
clientIp,
|
||||||
"userId",
|
"userId",
|
||||||
userId
|
userId
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeCreateProject(String regId, String clientIp, Long prjctIdx, ProjectCreateRequestDto req){
|
public void writeCreateProject(String regId, LocalDateTime regDt, String clientIp, Long prjctIdx, ProjectCreateRequestDto req){
|
||||||
writeSystemLog(SystemEventType.CREATE_PROJECT, "Create Project", prjctIdx, regId, clientIp, req);
|
writeSystemLog(SystemEventType.CREATE_PROJECT, "Create Project", prjctIdx, regId, regDt, clientIp, req);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeUpdateProject(String regId, String clientIp, Long prjctIdx, ProjectUpdateRequestDto req){
|
public void writeUpdateProject(String regId, LocalDateTime regDt, String clientIp, Long prjctIdx, ProjectUpdateRequestDto req){
|
||||||
writeSystemLog(SystemEventType.UPDATE_PROJECT, "Update Project", prjctIdx, regId, clientIp, req);
|
writeSystemLog(SystemEventType.UPDATE_PROJECT, "Update Project", prjctIdx, regId, regDt, clientIp, req);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeDeleteProject(String regId, String clientIp, Long prjctIdx){
|
public void writeDeleteProject(String regId, LocalDateTime regDt, String clientIp, Long prjctIdx){
|
||||||
writeSystemLog(
|
writeSystemLog(
|
||||||
SystemEventType.DELETE_PROJECT,
|
SystemEventType.DELETE_PROJECT,
|
||||||
"Delete Project",
|
"Delete Project",
|
||||||
prjctIdx,
|
prjctIdx,
|
||||||
regId,
|
regId,
|
||||||
|
regDt,
|
||||||
clientIp,
|
clientIp,
|
||||||
"prjctIdx",
|
"prjctIdx",
|
||||||
prjctIdx
|
prjctIdx
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeAssignUserProject(String regId, String clientIp, Long prjctIdx, List<String> assignUserIdList){
|
public void writeAssignUserProject(String regId, LocalDateTime regDt, String clientIp, Long prjctIdx, List<String> assignUserIdList){
|
||||||
writeSystemLog(
|
writeSystemLog(
|
||||||
SystemEventType.ASSIGN_PROJECT_USER,
|
SystemEventType.ASSIGN_PROJECT_USER,
|
||||||
"Assign Project FW User",
|
"Assign Project FW User",
|
||||||
prjctIdx,
|
prjctIdx,
|
||||||
regId,
|
regId,
|
||||||
|
regDt,
|
||||||
clientIp,
|
clientIp,
|
||||||
"assignUserIdList",
|
"assignUserIdList",
|
||||||
assignUserIdList
|
assignUserIdList
|
||||||
@@ -105,12 +112,13 @@ public class SystemEventLogService {
|
|||||||
String title,
|
String title,
|
||||||
Long prjctIdx,
|
Long prjctIdx,
|
||||||
String regId,
|
String regId,
|
||||||
|
LocalDateTime regDt,
|
||||||
String clientIp,
|
String clientIp,
|
||||||
T content
|
T content
|
||||||
) {
|
) {
|
||||||
Map<String, Object> contentMap = toMap(objectMapper, content);
|
Map<String, Object> contentMap = toMap(objectMapper, content);
|
||||||
|
|
||||||
saveLog(eventType, title, prjctIdx, regId, clientIp, contentMap);
|
saveLog(eventType, title, prjctIdx, regId, regDt, clientIp, contentMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected <T> void writeSystemLog(
|
protected <T> void writeSystemLog(
|
||||||
@@ -118,12 +126,13 @@ public class SystemEventLogService {
|
|||||||
String title,
|
String title,
|
||||||
Long prjctIdx,
|
Long prjctIdx,
|
||||||
String regId,
|
String regId,
|
||||||
|
LocalDateTime regDt,
|
||||||
String clientIp,
|
String clientIp,
|
||||||
String contentKey,
|
String contentKey,
|
||||||
T content
|
T content
|
||||||
) {
|
) {
|
||||||
Map<String, Object> contentMap = Map.of(contentKey, content);
|
Map<String, Object> contentMap = Map.of(contentKey, content);
|
||||||
saveLog(eventType, title, prjctIdx, regId, clientIp, contentMap);
|
saveLog(eventType, title, prjctIdx, regId, regDt, clientIp, contentMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveLog(
|
private void saveLog(
|
||||||
@@ -131,6 +140,7 @@ public class SystemEventLogService {
|
|||||||
String title,
|
String title,
|
||||||
Long prjctIdx,
|
Long prjctIdx,
|
||||||
String regId,
|
String regId,
|
||||||
|
LocalDateTime regDt,
|
||||||
String clientIp,
|
String clientIp,
|
||||||
Map<String, Object> contentMap
|
Map<String, Object> contentMap
|
||||||
){
|
){
|
||||||
@@ -140,7 +150,8 @@ public class SystemEventLogService {
|
|||||||
contentMap,
|
contentMap,
|
||||||
prjctIdx,
|
prjctIdx,
|
||||||
clientIp,
|
clientIp,
|
||||||
regId
|
regId,
|
||||||
|
regDt
|
||||||
);
|
);
|
||||||
|
|
||||||
systemEventLogRepository.save(log);
|
systemEventLogRepository.save(log);
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -33,7 +34,7 @@ public class UserService {
|
|||||||
private final UserRepository userRepository;
|
private final UserRepository userRepository;
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void createUser(UserInfoDto userInfo, String regUser){
|
public void createUser(UserInfoDto userInfo, String regUser, LocalDateTime regDt){
|
||||||
List<RoleInfoDto> roleList = roleService.getRoleList();
|
List<RoleInfoDto> roleList = roleService.getRoleList();
|
||||||
List<String> intranetUserList = intranetExtensionApiClient.getUserIdArray();
|
List<String> intranetUserList = intranetExtensionApiClient.getUserIdArray();
|
||||||
|
|
||||||
@@ -45,13 +46,13 @@ public class UserService {
|
|||||||
throw BusinessException.badRequest("WRONG_USER_DATA", firstFail.getErrMessage());
|
throw BusinessException.badRequest("WRONG_USER_DATA", firstFail.getErrMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
TUserEntity entity = TUserEntity.fromDto(userInfo, regUser);
|
TUserEntity entity = TUserEntity.fromDto(userInfo, regUser, regDt);
|
||||||
|
|
||||||
userRepository.save(entity);
|
userRepository.save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@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()) {
|
if (file == null || file.isEmpty()) {
|
||||||
throw BusinessException.badRequest("EMPTY_FILE", "업로드된 파일이 없습니다.");
|
throw BusinessException.badRequest("EMPTY_FILE", "업로드된 파일이 없습니다.");
|
||||||
}
|
}
|
||||||
@@ -95,7 +96,7 @@ public class UserService {
|
|||||||
|
|
||||||
// 2) 실제 DB 저장
|
// 2) 실제 DB 저장
|
||||||
try {
|
try {
|
||||||
this.createUserInternal(dto, regUser);
|
this.createUserInternal(dto, regUser, regDt);
|
||||||
successCount++;
|
successCount++;
|
||||||
} catch (BusinessException ex) {
|
} catch (BusinessException ex) {
|
||||||
// 시스템/비즈니스 예외도 에러 목록에 추가
|
// 시스템/비즈니스 예외도 에러 목록에 추가
|
||||||
@@ -191,7 +192,7 @@ public class UserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void updateUser(UserInfoDto dto, String modUser){
|
public void updateUser(UserInfoDto dto, String modUser, LocalDateTime modDt){
|
||||||
// dirty checking 업데이트
|
// dirty checking 업데이트
|
||||||
TUserEntity entity = userRepository.findByUserIdAndDelFalse(dto.getUserId())
|
TUserEntity entity = userRepository.findByUserIdAndDelFalse(dto.getUserId())
|
||||||
.orElseThrow(() ->
|
.orElseThrow(() ->
|
||||||
@@ -199,7 +200,7 @@ public class UserService {
|
|||||||
.with("userId", dto.getUserId())
|
.with("userId", dto.getUserId())
|
||||||
);
|
);
|
||||||
|
|
||||||
entity.updateFromDto(dto, modUser);// 기존 엔티티에 적용
|
entity.updateFromDto(dto, modUser, modDt);// 기존 엔티티에 적용
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@@ -336,11 +337,11 @@ public class UserService {
|
|||||||
return errors;
|
return errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createUserInternal(UserInfoDto userInfo, String regUser) {
|
private void createUserInternal(UserInfoDto userInfo, String regUser, LocalDateTime regDt) {
|
||||||
userInfo.setUserId(userInfo.getUserId().toLowerCase());
|
userInfo.setUserId(userInfo.getUserId().toLowerCase());
|
||||||
userInfo.setUserTeam("S101");
|
userInfo.setUserTeam("S101");
|
||||||
|
|
||||||
TUserEntity entity = TUserEntity.fromDto(userInfo, regUser);
|
TUserEntity entity = TUserEntity.fromDto(userInfo, regUser, regDt);
|
||||||
userRepository.save(entity);
|
userRepository.save(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user