251222_04_ENH : RequestBody에 Valid 적용 및 중괄호 스타일 통일

This commit is contained in:
2025-12-22 16:50:36 +09:00
parent cf3adf883b
commit 09e0b4ca05
35 changed files with 209 additions and 124 deletions

View File

@@ -1,7 +1,7 @@
package com.kri.contact.server.common.consts; package com.kri.contact.server.common.consts;
public final class ContactConstant { public final class ContactConstant {
private ContactConstant(){} private ContactConstant() {}
public static final String DEFAULT_COMPANY_NAME = "KRI"; public static final String DEFAULT_COMPANY_NAME = "KRI";

View File

@@ -50,7 +50,7 @@ public class IntranetExtensionApiClient {
} }
} }
public List<String> getUserIdArray(){ public List<String> getUserIdArray() {
String url = String.format("%s/api/v1/user/user-id-list", intranetExtensionBaseUrl); String url = String.format("%s/api/v1/user/user-id-list", intranetExtensionBaseUrl);
Map<String, String> headers = new HashMap<>(); Map<String, String> headers = new HashMap<>();
headers.put(apiKeyHeaderName, apiKey); headers.put(apiKeyHeaderName, apiKey);

View File

@@ -4,7 +4,9 @@ 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;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@@ -20,18 +22,21 @@ public class AssignController {
private final SystemEventLogService systemEventLogService; private final SystemEventLogService systemEventLogService;
private final AssignService assignService; private final AssignService assignService;
@Operation(summary = "배정된 외주사 조회")
@GetMapping("/prjct-outsource/{prjctIdx}") @GetMapping("/prjct-outsource/{prjctIdx}")
public List<String> getPrjctOutsourceAssign(@PathVariable Long prjctIdx){ public List<String> getPrjctOutsourceAssign(@PathVariable Long prjctIdx) {
return assignService.getPrjctOutsourceAssign(prjctIdx); return assignService.getPrjctOutsourceAssign(prjctIdx);
} }
@Operation(summary = "배정된 컨택원/면접원 조회")
@GetMapping("/prjct-fieldwork/{prjctIdx}") @GetMapping("/prjct-fieldwork/{prjctIdx}")
public List<String> getPrjctFieldworkAssign(@PathVariable Long prjctIdx){ public List<String> getPrjctFieldworkAssign(@PathVariable Long prjctIdx) {
return assignService.getPrjctFieldworkAssign(prjctIdx); return assignService.getPrjctFieldworkAssign(prjctIdx);
} }
@Operation(summary = "컨택원/면접원 배정")
@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) {
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime(); final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
assignService.upsertPrjctFieldworkAssign(prjctIdx, assignUserIdList, ctx.getUserId(), now); assignService.upsertPrjctFieldworkAssign(prjctIdx, assignUserIdList, ctx.getUserId(), now);
systemEventLogService.writeAssignUserProject(ctx.getUserId(), now, ctx.getClientIp(), prjctIdx, assignUserIdList); systemEventLogService.writeAssignUserProject(ctx.getUserId(), now, ctx.getClientIp(), prjctIdx, assignUserIdList);

View File

@@ -6,6 +6,7 @@ import com.kri.contact.server.dto.LoginRequestDto;
import com.kri.contact.server.dto.LoginResponseDto; import com.kri.contact.server.dto.LoginResponseDto;
import com.kri.contact.server.service.AuthService; import com.kri.contact.server.service.AuthService;
import com.kri.contact.server.service.SystemEventLogService; import com.kri.contact.server.service.SystemEventLogService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; 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.*;
@@ -20,8 +21,9 @@ public class AuthController {
private final AuthService authService; private final AuthService authService;
private final SystemEventLogService systemEventLogService; private final SystemEventLogService systemEventLogService;
@Operation(summary = "로그인 요청")
@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(); final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
LoginResponseDto response = authService.tryLogin(request); LoginResponseDto response = authService.tryLogin(request);
@@ -30,8 +32,9 @@ public class AuthController {
return response; return response;
} }
@Operation(summary = "로그아웃 요청")
@PostMapping("/logout/{userId}") @PostMapping("/logout/{userId}")
public boolean logout(@PathVariable String userId, RequestUserContext ctx){ public boolean logout(@PathVariable String userId, RequestUserContext ctx) {
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime(); final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
systemEventLogService.writeLogoutLog(userId, now, ctx.getClientIp()); systemEventLogService.writeLogoutLog(userId, now, ctx.getClientIp());

View File

@@ -7,7 +7,9 @@ import com.kri.contact.server.dto.common.PageResponseDto;
import com.kri.contact.server.service.FileService; import com.kri.contact.server.service.FileService;
import com.kri.contact.server.service.ProjectService; import com.kri.contact.server.service.ProjectService;
import com.kri.contact.server.service.SystemEventLogService; import com.kri.contact.server.service.SystemEventLogService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor; 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;
@@ -25,20 +27,23 @@ public class ProjectController {
private final ProjectService projectService; private final ProjectService projectService;
private final FileService fileService; private final FileService fileService;
@Operation(summary = "프로젝트 조회")
@GetMapping("/{prjctIdx}") @GetMapping("/{prjctIdx}")
public ProjectInfoDto getProject(@PathVariable Long prjctIdx){ public ProjectInfoDto getProject(@PathVariable Long prjctIdx) {
return projectService.getProject(prjctIdx); return projectService.getProject(prjctIdx);
} }
@Operation(summary = "상위 프로젝트 조회(생성일자 늦은 순)")
@GetMapping("/top/{topCount}") @GetMapping("/top/{topCount}")
public List<ProjectInfoDto> getTopProject( public List<ProjectInfoDto> getTopProject(
@PathVariable int topCount, @PathVariable int topCount,
@RequestParam(required = false) String keyword, @RequestParam(required = false) String keyword,
RequestUserContext ctx RequestUserContext ctx
){ ) {
return projectService.getTopProject(topCount, keyword, ctx.getUserId(), ctx.getUserRole()); return projectService.getTopProject(topCount, keyword, ctx.getUserId(), ctx.getUserRole());
} }
@Operation(summary = "프로젝트 목록 조회")
@PostMapping("/list") @PostMapping("/list")
public PageResponseDto<ProjectInfoDto> searchProject( public PageResponseDto<ProjectInfoDto> searchProject(
@RequestBody ProjectSearchRequestDto req, @RequestBody ProjectSearchRequestDto req,
@@ -47,14 +52,16 @@ public class ProjectController {
return projectService.searchProject(req, ctx.getUserId(), ctx.getUserRole()); return projectService.searchProject(req, ctx.getUserId(), ctx.getUserRole());
} }
@Operation(summary = "프로젝트를 소유하고 있는 모든 부서/실사 목록 조회")
@GetMapping("/owner-list") @GetMapping("/owner-list")
public ProjectOwnerResponseDto getOwnerList(RequestUserContext ctx){ public ProjectOwnerResponseDto getOwnerList(RequestUserContext ctx) {
return projectService.getOwnerList(ctx.getUserRole()); return projectService.getOwnerList(ctx.getUserRole());
} }
@Operation(summary = "프로젝트 생성")
@PutMapping() @PutMapping()
public ProjectInfoDto createProject( public ProjectInfoDto createProject(
@RequestBody ProjectCreateRequestDto req, @Valid @RequestBody ProjectCreateRequestDto req,
RequestUserContext ctx RequestUserContext ctx
) { ) {
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime(); final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
@@ -65,17 +72,19 @@ public class ProjectController {
return prjctInfo; return prjctInfo;
} }
@Operation(summary = "시나리오 이미지 업로드")
@PutMapping("/senario-image/{prjctCd}") @PutMapping("/senario-image/{prjctCd}")
public String uploadContactSenarioImage(@PathVariable String prjctCd, @RequestParam("file") MultipartFile file){ public String uploadContactSenarioImage(@PathVariable String prjctCd, @RequestParam("file") MultipartFile file) {
return fileService.storeTempFile(prjctCd, file); return fileService.storeTempFile(prjctCd, file);
} }
@Operation(summary = "프로젝트 수정")
@PatchMapping("/{prjctIdx}") @PatchMapping("/{prjctIdx}")
public void updateProject( public void updateProject(
@PathVariable long prjctIdx, @PathVariable long prjctIdx,
@RequestBody ProjectUpdateRequestDto req, @Valid @RequestBody ProjectUpdateRequestDto req,
RequestUserContext ctx RequestUserContext ctx
){ ) {
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime(); final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
String newHtml = fileService.syncOnSave( String newHtml = fileService.syncOnSave(
@@ -89,8 +98,9 @@ public class ProjectController {
systemEventLogService.writeUpdateProject(ctx.getUserId(), now, ctx.getClientIp(), prjctIdx, req); systemEventLogService.writeUpdateProject(ctx.getUserId(), now, ctx.getClientIp(), prjctIdx, req);
} }
@Operation(summary = "프로젝트 삭제(소프트 삭제)")
@DeleteMapping("/{prjctIdx}") @DeleteMapping("/{prjctIdx}")
public void deleteProject(@PathVariable Long prjctIdx, RequestUserContext ctx){ public void deleteProject(@PathVariable Long prjctIdx, RequestUserContext ctx) {
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime(); final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
projectService.deleteProject(prjctIdx, ctx.getUserId(), now); projectService.deleteProject(prjctIdx, ctx.getUserId(), now);

View File

@@ -5,6 +5,7 @@ import com.kri.contact.server.common.enums.ResultCodeType;
import com.kri.contact.server.dto.ResultCodeDto; import com.kri.contact.server.dto.ResultCodeDto;
import com.kri.contact.server.service.ResultCodeService; import com.kri.contact.server.service.ResultCodeService;
import com.kri.contact.server.service.SystemEventLogService; import com.kri.contact.server.service.SystemEventLogService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; 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.*;
@@ -20,11 +21,12 @@ public class ResultCodeController {
private final SystemEventLogService systemEventLogService; private final SystemEventLogService systemEventLogService;
private final ResultCodeService resultCodeService; private final ResultCodeService resultCodeService;
@Operation(summary = "결과 코드 조회")
@GetMapping("/{prjctIdx}") @GetMapping("/{prjctIdx}")
public List<ResultCodeDto> getResultCodeList( public List<ResultCodeDto> getResultCodeList(
@PathVariable long prjctIdx, @PathVariable long prjctIdx,
@RequestParam(required = false) ResultCodeType resultCdTy @RequestParam(required = false) ResultCodeType resultCdTy
){ ) {
return resultCodeService.getResultCode(prjctIdx, resultCdTy); return resultCodeService.getResultCode(prjctIdx, resultCdTy);
} }
} }

View File

@@ -3,6 +3,7 @@ package com.kri.contact.server.controller;
import com.kri.common.webmvc.RequestUserContext; import com.kri.common.webmvc.RequestUserContext;
import com.kri.contact.server.dto.RoleInfoDto; import com.kri.contact.server.dto.RoleInfoDto;
import com.kri.contact.server.service.RoleService; import com.kri.contact.server.service.RoleService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@@ -18,8 +19,9 @@ import java.util.List;
public class RoleController { public class RoleController {
private final RoleService roleService; private final RoleService roleService;
@Operation(summary = "권한 목록 조회")
@GetMapping() @GetMapping()
public List<RoleInfoDto> getRoleList(RequestUserContext ctx){ public List<RoleInfoDto> getRoleList(RequestUserContext ctx) {
return roleService.getRoleList(ctx.getUserRole()); return roleService.getRoleList(ctx.getUserRole());
} }
} }

View File

@@ -9,7 +9,9 @@ import com.kri.contact.server.dto.UserInfoDto;
import com.kri.contact.server.dto.systemlog.UploadUserContentDto; import com.kri.contact.server.dto.systemlog.UploadUserContentDto;
import com.kri.contact.server.service.SystemEventLogService; import com.kri.contact.server.service.SystemEventLogService;
import com.kri.contact.server.service.UserService; import com.kri.contact.server.service.UserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
@@ -29,20 +31,23 @@ public class UserController {
private final UserService userService; private final UserService userService;
private final SystemEventLogService systemEventLogService; private final SystemEventLogService systemEventLogService;
@Operation(summary = "ID 가용 여부 검사")
@GetMapping("/check-user-id") @GetMapping("/check-user-id")
public DataVerificationDto checkUserId(@RequestParam String userId){ public DataVerificationDto checkUserId(@RequestParam String userId) {
return userService.checkUserId(userId); return userService.checkUserId(userId);
} }
@Operation(summary = "사용자 정보 조회")
@GetMapping("/{userId}") @GetMapping("/{userId}")
public UserInfoDto getUser(@PathVariable String userId){ public UserInfoDto getUser(@PathVariable String userId) {
return userService.getUser(userId); return userService.getUser(userId);
} }
@Operation(summary = "사용자 목록 조회")
@GetMapping() @GetMapping()
public List<UserInfoDto> getUserList(RequestUserContext ctx){ public List<UserInfoDto> getUserList(RequestUserContext ctx) {
String searchCmpn = ctx.getUserCmpn(); String searchCmpn = ctx.getUserCmpn();
if(ctx.getUserRole() < ContactConstant.OUTSOURCE_USER_ROLE){ if(ctx.getUserRole() < ContactConstant.OUTSOURCE_USER_ROLE) {
return userService.getUserList(); return userService.getUserList();
} }
else{ else{
@@ -50,32 +55,36 @@ public class UserController {
} }
} }
@Operation(summary = "컨택원/면접원 목록 조회")
@GetMapping("fieldwork") @GetMapping("fieldwork")
public List<UserInfoDto> getFiledoworkUserList(RequestUserContext ctx){ public List<UserInfoDto> getFiledoworkUserList(RequestUserContext ctx) {
String searchCmpn = ctx.getUserCmpn(); String searchCmpn = ctx.getUserCmpn();
if(ctx.getUserRole() < ContactConstant.OUTSOURCE_USER_ROLE){ if(ctx.getUserRole() < ContactConstant.OUTSOURCE_USER_ROLE) {
searchCmpn = ""; searchCmpn = "";
} }
return userService.getFieldworkUserListWithCmpn(searchCmpn); return userService.getFieldworkUserListWithCmpn(searchCmpn);
} }
@Operation(summary = "외주사 목록 조회")
@GetMapping("outsource") @GetMapping("outsource")
List<UserInfoDto> getOutsourceList(){ List<UserInfoDto> getOutsourceList() {
return userService.getOutsourceList(); return userService.getOutsourceList();
} }
@Operation(summary = "사용자 회사 목록 조회")
@GetMapping("cmpn") @GetMapping("cmpn")
public List<String> getUserCmpnList(RequestUserContext ctx){ public List<String> getUserCmpnList(RequestUserContext ctx) {
if(ctx.getUserRole() < ContactConstant.OUTSOURCE_USER_ROLE){ if(ctx.getUserRole() < ContactConstant.OUTSOURCE_USER_ROLE) {
return userService.getUserCmpnList(); return userService.getUserCmpnList();
} }
return Collections.emptyList(); return Collections.emptyList();
} }
@Operation(summary = "사용자 생성")
@PutMapping @PutMapping
public void createUser(@RequestBody UserInfoDto userInfo, RequestUserContext ctx){ public void createUser(@Valid @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(); final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
@@ -84,6 +93,7 @@ public class UserController {
systemEventLogService.writeCreateUserLog(regId, now, clientIp, userInfo); systemEventLogService.writeCreateUserLog(regId, now, clientIp, userInfo);
} }
@Operation(summary = "사용자 일괄 생성(엑셀 업로드)")
@PostMapping("/excel") @PostMapping("/excel")
public ExcelUploadResponseDto createUserFromExcel( public ExcelUploadResponseDto createUserFromExcel(
@RequestPart("file") MultipartFile file, @RequestPart("file") MultipartFile file,
@@ -107,8 +117,9 @@ public class UserController {
return result; return result;
} }
@Operation(summary = "사용자 일괄 생성 양식 다운로드")
@PostMapping("/excel/template") @PostMapping("/excel/template")
public ResponseEntity<byte[]> exportUserTemplate(){ public ResponseEntity<byte[]> exportUserTemplate() {
byte[] bytes = userService.exportUserTemplate(); byte[] bytes = userService.exportUserTemplate();
return ResponseEntity.ok() return ResponseEntity.ok()
@@ -119,8 +130,9 @@ public class UserController {
.body(bytes); .body(bytes);
} }
@Operation(summary = "사용자 정보 수정")
@PatchMapping() @PatchMapping()
public void updateUser(@RequestBody UserInfoDto dto, RequestUserContext ctx){ public void updateUser(@Valid @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(); final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
@@ -129,8 +141,9 @@ public class UserController {
systemEventLogService.writeUpdateUserLog(modId, now, clientIp, dto); systemEventLogService.writeUpdateUserLog(modId, now, clientIp, dto);
} }
@Operation(summary = "사용자 삭제(소프트 삭제)")
@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(); final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();

View File

@@ -16,7 +16,7 @@ public class LoginResponseDto {
@Schema(description = "사용자 정보") @Schema(description = "사용자 정보")
private JwtUserClaimsDto user; private JwtUserClaimsDto user;
public static LoginResponseDto from(String accessToken, JwtUserClaimsDto jwtUserClaims){ public static LoginResponseDto from(String accessToken, JwtUserClaimsDto jwtUserClaims) {
return LoginResponseDto.builder() return LoginResponseDto.builder()
.accessToken(accessToken) .accessToken(accessToken)
.user(jwtUserClaims) .user(jwtUserClaims)

View File

@@ -1,6 +1,8 @@
package com.kri.contact.server.dto; package com.kri.contact.server.dto;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.*; import lombok.*;
@Getter @Getter
@@ -9,15 +11,23 @@ import lombok.*;
@AllArgsConstructor @AllArgsConstructor
@Schema(description = "프로젝트 생성 요청") @Schema(description = "프로젝트 생성 요청")
public class ProjectCreateRequestDto { public class ProjectCreateRequestDto {
@Size(max = 128)
@NotBlank
@Schema(description = "프로젝트 명") @Schema(description = "프로젝트 명")
private String prjctName; private String prjctName;
@Size(max = 32)
@NotBlank
@Schema(description = "인트라넷 프로젝트 코드") @Schema(description = "인트라넷 프로젝트 코드")
private String itrntPrjctCd; private String itrntPrjctCd;
@Size(max = 32)
@NotBlank
@Schema(description = "담당 그룹") @Schema(description = "담당 그룹")
private String ownerDept; private String ownerDept;
@Size(max = 16)
@NotBlank
@Schema(description = "담당 실사") @Schema(description = "담당 실사")
private String ownerFw; private String ownerFw;
} }

View File

@@ -5,6 +5,9 @@ import com.kri.contact.server.common.enums.ProjectStatus;
import com.kri.contact.server.common.enums.SurveyType; import com.kri.contact.server.common.enums.SurveyType;
import com.kri.contact.server.persistence.entity.TPrjctEntity; import com.kri.contact.server.persistence.entity.TPrjctEntity;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.*; import lombok.*;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@@ -16,45 +19,63 @@ import java.time.LocalDateTime;
@AllArgsConstructor @AllArgsConstructor
@Schema(description = "프로젝트 정보") @Schema(description = "프로젝트 정보")
public class ProjectInfoDto { public class ProjectInfoDto {
@NotNull
@Schema(description = "프로젝트 고유 번호") @Schema(description = "프로젝트 고유 번호")
private Long prjctIdx; private Long prjctIdx;
@Size(max = 32)
@NotBlank
@Schema(description = "프로젝트 코드") @Schema(description = "프로젝트 코드")
private String prjctCd; private String prjctCd;
@NotNull
@Schema(description = "프로젝트 진행 상태") @Schema(description = "프로젝트 진행 상태")
private ProjectStatus prjctStatus; private ProjectStatus prjctStatus;
@Size(max = 128)
@NotBlank
@Schema(description = "프로젝트 명") @Schema(description = "프로젝트 명")
private String prjctName; private String prjctName;
@Size(max = 32)
@NotBlank
@Schema(description = "인트라넷 프로젝트 코드") @Schema(description = "인트라넷 프로젝트 코드")
private String itrntPrjctCd; private String itrntPrjctCd;
@Size(max = 32)
@NotBlank
@Schema(description = "담당 그룹") @Schema(description = "담당 그룹")
private String ownerDept; private String ownerDept;
@Size(max = 16)
@NotBlank
@Schema(description = "담당 실사") @Schema(description = "담당 실사")
private String ownerFw; private String ownerFw;
@NotNull
@Schema(description = "설문지 타입") @Schema(description = "설문지 타입")
private SurveyType surveyTy; private SurveyType surveyTy;
@Size(max = 32)
@Schema(description = "내부 설문 시스템 프로젝트 코드") @Schema(description = "내부 설문 시스템 프로젝트 코드")
private String surveyPrjctCd; private String surveyPrjctCd;
@Size(max = 128)
@Schema(description = "설문 URL") @Schema(description = "설문 URL")
private String surveyUrl; private String surveyUrl;
@NotNull
@Schema(description = "면접원 확인사항 여부") @Schema(description = "면접원 확인사항 여부")
private Boolean ff; private Boolean ff;
@NotNull
@Schema(description = "컨택 시나리오 사용 여부") @Schema(description = "컨택 시나리오 사용 여부")
private Boolean useContactSenario; private Boolean useContactSenario;
@Schema(description = "컨택 시나리오") @Schema(description = "컨택 시나리오")
private String contactSenario; private String contactSenario;
@Size(max = 32)
@Schema(description = "등록자", accessMode = Schema.AccessMode.READ_ONLY) @Schema(description = "등록자", accessMode = Schema.AccessMode.READ_ONLY)
@JsonProperty(access = JsonProperty.Access.READ_ONLY) @JsonProperty(access = JsonProperty.Access.READ_ONLY)
private String regUser; private String regUser;
@@ -63,6 +84,7 @@ public class ProjectInfoDto {
@JsonProperty(access = JsonProperty.Access.READ_ONLY) @JsonProperty(access = JsonProperty.Access.READ_ONLY)
private LocalDateTime regDt; private LocalDateTime regDt;
@Size(max = 32)
@Schema(description = "수정자", accessMode = Schema.AccessMode.READ_ONLY) @Schema(description = "수정자", accessMode = Schema.AccessMode.READ_ONLY)
@JsonProperty(access = JsonProperty.Access.READ_ONLY) @JsonProperty(access = JsonProperty.Access.READ_ONLY)
private String modUser; private String modUser;
@@ -71,7 +93,7 @@ public class ProjectInfoDto {
@JsonProperty(access = JsonProperty.Access.READ_ONLY) @JsonProperty(access = JsonProperty.Access.READ_ONLY)
private LocalDateTime modDt; private LocalDateTime modDt;
public static ProjectInfoDto from(TPrjctEntity entity){ public static ProjectInfoDto from(TPrjctEntity entity) {
return ProjectInfoDto.builder() return ProjectInfoDto.builder()
.prjctIdx(entity.getPrjctIdx()) .prjctIdx(entity.getPrjctIdx())
.prjctCd(entity.getPrjctCd()) .prjctCd(entity.getPrjctCd())

View File

@@ -1,6 +1,7 @@
package com.kri.contact.server.dto; package com.kri.contact.server.dto;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
@@ -11,6 +12,7 @@ import java.util.List;
@Setter @Setter
@Schema(description = "프로젝트 수정 요청") @Schema(description = "프로젝트 수정 요청")
public class ProjectUpdateRequestDto { public class ProjectUpdateRequestDto {
@NotNull
@Schema(description = "프로젝트 정보") @Schema(description = "프로젝트 정보")
private ProjectInfoDto projectInfo; private ProjectInfoDto projectInfo;

View File

@@ -29,7 +29,7 @@ public class ResultCodeDto {
@Schema(description = "결과 코드 라벨") @Schema(description = "결과 코드 라벨")
private String resultCdLbl; private String resultCdLbl;
public static ResultCodeDto from(TResultCodeEntity entity){ public static ResultCodeDto from(TResultCodeEntity entity) {
return ResultCodeDto.builder() return ResultCodeDto.builder()
.resultCdUUID(UUID.randomUUID().toString()) .resultCdUUID(UUID.randomUUID().toString())
.prjctIdx(entity.getPrjctIdx()) .prjctIdx(entity.getPrjctIdx())

View File

@@ -40,7 +40,7 @@ public class RoleInfoDto {
private LocalDateTime modDt; private LocalDateTime modDt;
public static RoleInfoDto from(TRoleEntity roleEntity){ public static RoleInfoDto from(TRoleEntity roleEntity) {
return RoleInfoDto.builder() return RoleInfoDto.builder()
.roleCd(roleEntity.getRoleCd()) .roleCd(roleEntity.getRoleCd())
.roleNm(roleEntity.getRoleNm()) .roleNm(roleEntity.getRoleNm())

View File

@@ -5,6 +5,9 @@ import com.kri.common.datetime.DateTimeUtil;
import com.kri.contact.server.dto.excel.UserUploadDto; import com.kri.contact.server.dto.excel.UserUploadDto;
import com.kri.contact.server.persistence.entity.TUserEntity; import com.kri.contact.server.persistence.entity.TUserEntity;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.*; import lombok.*;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@@ -16,27 +19,39 @@ import java.time.LocalDateTime;
@AllArgsConstructor @AllArgsConstructor
@Schema(description = "사용자 정보") @Schema(description = "사용자 정보")
public class UserInfoDto { public class UserInfoDto {
@Size(max = 32)
@NotBlank
@Schema(description = "사용자 ID") @Schema(description = "사용자 ID")
private String userId; private String userId;
@Size(max = 128)
@NotBlank
@Schema(description = "사용자 PW") @Schema(description = "사용자 PW")
private String userPw; private String userPw;
@Size(max = 32)
@NotBlank
@Schema(description = "사용자 이름") @Schema(description = "사용자 이름")
private String userName; private String userName;
@Size(max = 32)
@NotBlank
@Schema(description = "사용자 소속 회사") @Schema(description = "사용자 소속 회사")
private String userCmpn; private String userCmpn;
@Size(max = 32)
@NotBlank
@Schema(description = "사용자 소속 팀") @Schema(description = "사용자 소속 팀")
private String userTeam = "S101"; private String userTeam = "S101";
@NotNull
@Schema(description = "사용자 권한") @Schema(description = "사용자 권한")
private Integer userRole; private Integer userRole;
@Schema(description = "메모") @Schema(description = "메모")
private String memo; private String memo;
@Size(max = 32)
@Schema(description = "등록자", accessMode = Schema.AccessMode.READ_ONLY) @Schema(description = "등록자", accessMode = Schema.AccessMode.READ_ONLY)
@JsonProperty(access = JsonProperty.Access.READ_ONLY) @JsonProperty(access = JsonProperty.Access.READ_ONLY)
private String regUser; private String regUser;
@@ -45,6 +60,7 @@ public class UserInfoDto {
@JsonProperty(access = JsonProperty.Access.READ_ONLY) @JsonProperty(access = JsonProperty.Access.READ_ONLY)
private LocalDateTime regDt; private LocalDateTime regDt;
@Size(max = 32)
@Schema(description = "수정자", accessMode = Schema.AccessMode.READ_ONLY) @Schema(description = "수정자", accessMode = Schema.AccessMode.READ_ONLY)
@JsonProperty(access = JsonProperty.Access.READ_ONLY) @JsonProperty(access = JsonProperty.Access.READ_ONLY)
private String modUser; private String modUser;
@@ -53,7 +69,7 @@ public class UserInfoDto {
@JsonProperty(access = JsonProperty.Access.READ_ONLY) @JsonProperty(access = JsonProperty.Access.READ_ONLY)
private LocalDateTime modDt; private LocalDateTime modDt;
public static UserInfoDto from(TUserEntity entity){ public static UserInfoDto from(TUserEntity entity) {
return UserInfoDto.builder() return UserInfoDto.builder()
.userId(entity.getUserId()) .userId(entity.getUserId())
.userName(entity.getUserNm()) .userName(entity.getUserNm())
@@ -68,7 +84,7 @@ public class UserInfoDto {
.build(); .build();
} }
public static UserInfoDto from(UserUploadDto dto, Integer userRole, String regUser){ public static UserInfoDto from(UserUploadDto dto, Integer userRole, String regUser) {
return UserInfoDto.builder() return UserInfoDto.builder()
.userId(dto.getUserId()) .userId(dto.getUserId())
.userPw(dto.getUserPw()) .userPw(dto.getUserPw())

View File

@@ -45,11 +45,11 @@ public class TListEntity {
@Column(name = "mod_dt", insertable = false) @Column(name = "mod_dt", insertable = false)
private LocalDateTime modDt; private LocalDateTime modDt;
public Long getPrjctIdx(){ public Long getPrjctIdx() {
return id.getPrjctIdx(); return id.getPrjctIdx();
} }
public Integer getSid(){ public Integer getSid() {
return id.getSid(); return id.getSid();
} }
} }

View File

@@ -66,11 +66,11 @@ public class TListHeaderEntity {
@Column(name = "mod_dt", insertable = false) @Column(name = "mod_dt", insertable = false)
private LocalDateTime modDt; private LocalDateTime modDt;
public Long getPrjctIdx(){ public Long getPrjctIdx() {
return id.getPrjctIdx(); return id.getPrjctIdx();
} }
public Integer getListHderId(){ public Integer getListHderId() {
return id.getListHderId(); return id.getListHderId();
} }
} }

View File

@@ -39,15 +39,15 @@ public class TListItemEntity {
@Column(name = "mod_dt", insertable = false) @Column(name = "mod_dt", insertable = false)
private LocalDateTime modDt; private LocalDateTime modDt;
public Long getPrjctIdx(){ public Long getPrjctIdx() {
return id.getPrjctIdx(); return id.getPrjctIdx();
} }
public Integer getSid(){ public Integer getSid() {
return id.getSid(); return id.getSid();
} }
public Integer getListHderId(){ public Integer getListHderId() {
return id.getListHderId(); return id.getListHderId();
} }
} }

View File

@@ -48,15 +48,15 @@ public class TListItemUploadEntity {
@Column(name = "mod_dt", insertable = false) @Column(name = "mod_dt", insertable = false)
private LocalDateTime modDt; private LocalDateTime modDt;
public Long getPrjctIdx(){ public Long getPrjctIdx() {
return id.getPrjctIdx(); return id.getPrjctIdx();
} }
public Integer getSid(){ public Integer getSid() {
return id.getSid(); return id.getSid();
} }
public Integer getListHderId(){ public Integer getListHderId() {
return id.getListHderId(); return id.getListHderId();
} }
} }

View File

@@ -6,17 +6,17 @@ import jakarta.persistence.Entity;
import jakarta.persistence.Table; import jakarta.persistence.Table;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size; import jakarta.validation.constraints.Size;
import lombok.Builder; import lombok.*;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault; import org.hibernate.annotations.ColumnDefault;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@Builder
@Getter @Getter
@Setter @Setter
@Entity @Entity
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "t_prjct_assign") @Table(name = "t_prjct_assign")
public class TPrjctAssignEntity { public class TPrjctAssignEntity {
@EmbeddedId @EmbeddedId
@@ -40,11 +40,11 @@ public class TPrjctAssignEntity {
.build(); .build();
} }
public Long getPrjctIdx(){ public Long getPrjctIdx() {
return id.getPrjctIdx(); return id.getPrjctIdx();
} }
public String getUserId(){ public String getUserId() {
return id.getUserId(); return id.getUserId();
} }
} }

View File

@@ -4,18 +4,18 @@ import jakarta.persistence.Column;
import jakarta.persistence.Embeddable; import jakarta.persistence.Embeddable;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size; import jakarta.validation.constraints.Size;
import lombok.Builder; import lombok.*;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.Hibernate; import org.hibernate.Hibernate;
import java.io.Serializable; import java.io.Serializable;
import java.util.Objects; import java.util.Objects;
@Builder
@Getter @Getter
@Setter @Setter
@Embeddable @Embeddable
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class TPrjctAssignEntityId implements Serializable { public class TPrjctAssignEntityId implements Serializable {
private static final long serialVersionUID = -263674621497298216L; private static final long serialVersionUID = -263674621497298216L;
@Column(name = "prjct_idx", columnDefinition = "int UNSIGNED not null") @Column(name = "prjct_idx", columnDefinition = "int UNSIGNED not null")

View File

@@ -8,17 +8,17 @@ import com.kri.contact.server.dto.ProjectInfoDto;
import jakarta.persistence.*; import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size; import jakarta.validation.constraints.Size;
import lombok.Builder; import lombok.*;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault; import org.hibernate.annotations.ColumnDefault;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@Builder
@Getter @Getter
@Setter @Setter
@Entity @Entity
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "t_prjct") @Table(name = "t_prjct")
public class TPrjctEntity { public class TPrjctEntity {
@Id @Id
@@ -112,7 +112,7 @@ public class TPrjctEntity {
@Column(name = "del_dt") @Column(name = "del_dt")
private LocalDateTime delDt; private LocalDateTime delDt;
public static TPrjctEntity fromDto(ProjectInfoDto dto){ public static TPrjctEntity fromDto(ProjectInfoDto dto) {
return TPrjctEntity.builder() return TPrjctEntity.builder()
.prjctCd(dto.getPrjctCd()) .prjctCd(dto.getPrjctCd())
.prjctStatus(dto.getPrjctStatus().getCode()) .prjctStatus(dto.getPrjctStatus().getCode())
@@ -131,7 +131,7 @@ public class TPrjctEntity {
.build(); .build();
} }
public static TPrjctEntity create(ProjectCreateRequestDto req, String prjctCd, String regUser, LocalDateTime regDt){ 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())

View File

@@ -9,17 +9,17 @@ import jakarta.persistence.Entity;
import jakarta.persistence.Table; import jakarta.persistence.Table;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size; import jakarta.validation.constraints.Size;
import lombok.Builder; import lombok.*;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault; import org.hibernate.annotations.ColumnDefault;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@Builder
@Getter @Getter
@Setter @Setter
@Entity @Entity
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "t_result_code") @Table(name = "t_result_code")
public class TResultCodeEntity { public class TResultCodeEntity {
@EmbeddedId @EmbeddedId
@@ -40,15 +40,15 @@ public class TResultCodeEntity {
@Column(name = "reg_dt", nullable = false) @Column(name = "reg_dt", nullable = false)
private LocalDateTime regDt; private LocalDateTime regDt;
public Long getPrjctIdx(){ public Long getPrjctIdx() {
return id.getPrjctIdx(); return id.getPrjctIdx();
} }
public ResultCodeType getResultCdTy(){ public ResultCodeType getResultCdTy() {
return id.getResultCdTy(); return id.getResultCdTy();
} }
public Short getResultCd(){ public Short getResultCd() {
return id.getResultCd(); return id.getResultCd();
} }

View File

@@ -12,10 +12,10 @@ import org.hibernate.Hibernate;
import java.io.Serializable; import java.io.Serializable;
import java.util.Objects; import java.util.Objects;
@Builder
@Getter @Getter
@Setter @Setter
@Embeddable @Embeddable
@Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class TResultCodeEntityId implements Serializable { public class TResultCodeEntityId implements Serializable {

View File

@@ -30,11 +30,11 @@ public class TRoleFuncMapEntity {
@Column(name = "reg_dt", nullable = false) @Column(name = "reg_dt", nullable = false)
private LocalDateTime regDt; private LocalDateTime regDt;
public Integer getRoleCd(){ public Integer getRoleCd() {
return id.getRoleCd(); return id.getRoleCd();
} }
public Long getFuncCd(){ public Long getFuncCd() {
return id.getFuncCd(); return id.getFuncCd();
} }
} }

View File

@@ -13,11 +13,11 @@ import org.hibernate.annotations.Type;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Map; import java.util.Map;
@Builder
@Getter @Getter
@Setter @Setter
@Entity @Entity
@NoArgsConstructor(access = AccessLevel.PROTECTED) @Builder
@NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@Table(name = "t_sys_event_log") @Table(name = "t_sys_event_log")
public class TSysEventLogEntity { public class TSysEventLogEntity {

View File

@@ -10,10 +10,10 @@ import org.hibernate.annotations.ColumnDefault;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@Builder
@Getter @Getter
@Setter @Setter
@Entity @Entity
@Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@Table(name = "t_user") @Table(name = "t_user")

View File

@@ -17,7 +17,7 @@ public class AssignService {
private final ProjectAssignRepository projectAssignRepository; private final ProjectAssignRepository projectAssignRepository;
public List<String> getPrjctOutsourceAssign(Long prjctIdx){ public List<String> getPrjctOutsourceAssign(Long prjctIdx) {
return projectAssignRepository.findAssignUserIdByPrjctIdxAndRoleRange( return projectAssignRepository.findAssignUserIdByPrjctIdxAndRoleRange(
prjctIdx, prjctIdx,
ContactConstant.OUTSOURCE_USER_ROLE, ContactConstant.OUTSOURCE_USER_ROLE,
@@ -25,7 +25,7 @@ public class AssignService {
); );
} }
public List<String> getPrjctFieldworkAssign(Long prjctIdx){ public List<String> getPrjctFieldworkAssign(Long prjctIdx) {
return projectAssignRepository.findAssignUserIdByPrjctIdxAndRoleRange( return projectAssignRepository.findAssignUserIdByPrjctIdxAndRoleRange(
prjctIdx, prjctIdx,
ContactConstant.FIELDWORK_USER_ROLE, ContactConstant.FIELDWORK_USER_ROLE,
@@ -34,7 +34,7 @@ public class AssignService {
} }
@Transactional @Transactional
public void upsertPrjctOutsourceAssign(Long prjctIdx, List<String> assignUserIdList, String regUser, LocalDateTime regDt){ 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,
@@ -45,7 +45,7 @@ public class AssignService {
} }
@Transactional @Transactional
public void upsertPrjctFieldworkAssign(Long prjctIdx, List<String> assignUserIdList, String regUser, LocalDateTime regDt){ 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,
@@ -55,7 +55,7 @@ public class AssignService {
insertPrjctAssign(prjctIdx, assignUserIdList, regUser, regDt); insertPrjctAssign(prjctIdx, assignUserIdList, regUser, regDt);
} }
private void insertPrjctAssign(Long prjctIdx, List<String> assignUserIdList, String regUser, LocalDateTime regDt){ private void insertPrjctAssign(Long prjctIdx, List<String> assignUserIdList, String regUser, LocalDateTime regDt) {
if (assignUserIdList == null || assignUserIdList.isEmpty()) { if (assignUserIdList == null || assignUserIdList.isEmpty()) {
return; return;
} }

View File

@@ -18,11 +18,11 @@ public class AuthService {
private final IntranetExtensionApiClient intranetExtensionApiClient; private final IntranetExtensionApiClient intranetExtensionApiClient;
public LoginResponseDto tryLogin(LoginRequestDto request){ public LoginResponseDto tryLogin(LoginRequestDto request) {
SearchLoginInfoResponseDto loginInfoResponse = intranetExtensionApiClient.searchLoginInfo(request); SearchLoginInfoResponseDto loginInfoResponse = intranetExtensionApiClient.searchLoginInfo(request);
JwtUserClaimsDto claims; JwtUserClaimsDto claims;
if(loginInfoResponse != null){ if(loginInfoResponse != null) {
claims = JwtUserClaimsDto.builder() claims = JwtUserClaimsDto.builder()
.userId(loginInfoResponse.getUserId()) .userId(loginInfoResponse.getUserId())
.userCmpn(loginInfoResponse.getUserCmpn()) .userCmpn(loginInfoResponse.getUserCmpn())

View File

@@ -105,7 +105,7 @@ public class FileService {
// body 안의 HTML만 반환 (불필요한 <html><body> wrapper 제거) // body 안의 HTML만 반환 (불필요한 <html><body> wrapper 제거)
returnHtml = doc.body().html(); returnHtml = doc.body().html();
} }
catch (IOException e){ catch (IOException e) {
log.warn("temp 파일 이동 실패: {}", rawHtml, e); log.warn("temp 파일 이동 실패: {}", rawHtml, e);
} }

View File

@@ -49,11 +49,11 @@ public class ProjectService {
} }
} }
public ProjectInfoDto getProject(Long prjctIdx){ public ProjectInfoDto getProject(Long prjctIdx) {
return ProjectInfoDto.from(projectRepository.findByPrjctIdxAndDelFalse(prjctIdx)); return ProjectInfoDto.from(projectRepository.findByPrjctIdxAndDelFalse(prjctIdx));
} }
public List<ProjectInfoDto> getTopProject(int topCount, String keyword, String userId, Integer userRole){ public List<ProjectInfoDto> getTopProject(int topCount, String keyword, String userId, Integer userRole) {
Specification<TPrjctEntity> spec = Specification<TPrjctEntity> spec =
ProjectSpecs.keywordLike(keyword) ProjectSpecs.keywordLike(keyword)
.and(ProjectSpecs.isDelFalse()); .and(ProjectSpecs.isDelFalse());
@@ -105,7 +105,7 @@ public class ProjectService {
return PageResponseDto.from(page); return PageResponseDto.from(page);
} }
public ProjectOwnerResponseDto getOwnerList(Integer userRole){ public ProjectOwnerResponseDto getOwnerList(Integer userRole) {
ProjectOwnerResponseDto responseDto = new ProjectOwnerResponseDto(); ProjectOwnerResponseDto responseDto = new ProjectOwnerResponseDto();
responseDto.setOwnerDeptList(this.getOwnerDeptList(userRole)); responseDto.setOwnerDeptList(this.getOwnerDeptList(userRole));
@@ -133,7 +133,7 @@ public class ProjectService {
} }
@Transactional @Transactional
public void updateProject(long prjctIdx, ProjectUpdateRequestDto req, String modUser, LocalDateTime modDt){ 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(() ->
@@ -148,17 +148,17 @@ public class ProjectService {
} }
@Transactional @Transactional
public void deleteProject(Long prjctIdx, String delUser, LocalDateTime delDt){ public void deleteProject(Long prjctIdx, String delUser, LocalDateTime delDt) {
int deleteCount = projectRepository.softDeleteByPrjctIdx(prjctIdx, delUser, delDt); 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", "프로젝트를 찾을 수 없습니다.")
.with("prjctIdx", prjctIdx); .with("prjctIdx", prjctIdx);
} }
} }
/***************************private************************************/ /***************************private************************************/
private String makePrjctCd(String itrntPrjctCd){ private String makePrjctCd(String itrntPrjctCd) {
String prefix = itrntPrjctCd + "_"; String prefix = itrntPrjctCd + "_";
List<TPrjctEntity> sameItrnt = projectRepository.findByItrntPrjctCd(itrntPrjctCd); List<TPrjctEntity> sameItrnt = projectRepository.findByItrntPrjctCd(itrntPrjctCd);

View File

@@ -22,7 +22,7 @@ public class ResultCodeService {
private final ResultCodeRepository resultCodeRepository; private final ResultCodeRepository resultCodeRepository;
public void copyResultCodeFromDefault(long prjctIdx, String regUser, LocalDateTime regDt){ 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()
@@ -32,7 +32,7 @@ public class ResultCodeService {
resultCodeRepository.saveAll(copyCodeList); resultCodeRepository.saveAll(copyCodeList);
} }
public List<ResultCodeDto> getResultCode(long prjctIdx, ResultCodeType resultCdTy){ public List<ResultCodeDto> getResultCode(long prjctIdx, ResultCodeType resultCdTy) {
if (resultCdTy == null) { if (resultCdTy == null) {
return resultCodeRepository.findByIdPrjctIdx(prjctIdx).stream() return resultCodeRepository.findByIdPrjctIdx(prjctIdx).stream()
.map(ResultCodeDto::from) .map(ResultCodeDto::from)
@@ -45,7 +45,7 @@ public class ResultCodeService {
} }
@Transactional @Transactional
public void updateResultCode(long prjctIdx, List<ResultCodeDto> resultCodeDtoList, String modUser, LocalDateTime modDt){ 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)

View File

@@ -14,13 +14,13 @@ public class RoleService {
private final RoleRepository roleRepository; private final RoleRepository roleRepository;
public List<RoleInfoDto> getRoleList(){ public List<RoleInfoDto> getRoleList() {
return roleRepository.findAll().stream() return roleRepository.findAll().stream()
.map(RoleInfoDto::from) .map(RoleInfoDto::from)
.toList(); .toList();
} }
public List<RoleInfoDto> getRoleList(Integer roleCd){ public List<RoleInfoDto> getRoleList(Integer roleCd) {
Integer searchRoleCd = roleCd < ContactConstant.OUTSOURCE_USER_ROLE ? Integer searchRoleCd = roleCd < ContactConstant.OUTSOURCE_USER_ROLE ?
ContactConstant.OUTSOURCE_USER_ROLE : ContactConstant.OUTSOURCE_USER_ROLE :
ContactConstant.FIELDWORK_USER_ROLE; ContactConstant.FIELDWORK_USER_ROLE;

View File

@@ -48,19 +48,19 @@ public class SystemEventLogService {
); );
} }
public void writeCreateUserLog(String regId, LocalDateTime regDt, String clientIp, UserInfoDto userInfo){ public void writeCreateUserLog(String regId, LocalDateTime regDt, String clientIp, UserInfoDto userInfo) {
writeSystemLog(SystemEventType.CREATE_USER, "Create User", null, regId, regDt, clientIp, userInfo); writeSystemLog(SystemEventType.CREATE_USER, "Create User", null, regId, regDt, clientIp, userInfo);
} }
public void writeUploadUserLog(String regId, LocalDateTime regDt, String clientIp, UploadUserContentDto content){ public void writeUploadUserLog(String regId, LocalDateTime regDt, String clientIp, UploadUserContentDto content) {
writeSystemLog(SystemEventType.UPLOAD_USER, "Upload User", null, regId, regDt, clientIp, content); writeSystemLog(SystemEventType.UPLOAD_USER, "Upload User", null, regId, regDt, clientIp, content);
} }
public void writeUpdateUserLog(String regId, LocalDateTime regDt, String clientIp, UserInfoDto userInfo){ public void writeUpdateUserLog(String regId, LocalDateTime regDt, String clientIp, UserInfoDto userInfo) {
writeSystemLog(SystemEventType.UPDATE_USER, "Update User", null, regId, regDt, clientIp, userInfo); writeSystemLog(SystemEventType.UPDATE_USER, "Update User", null, regId, regDt, clientIp, userInfo);
} }
public void writeDeleteUserLog(String regId, LocalDateTime regDt, 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",
@@ -73,15 +73,15 @@ public class SystemEventLogService {
); );
} }
public void writeCreateProject(String regId, LocalDateTime regDt, 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, regDt, clientIp, req); writeSystemLog(SystemEventType.CREATE_PROJECT, "Create Project", prjctIdx, regId, regDt, clientIp, req);
} }
public void writeUpdateProject(String regId, LocalDateTime regDt, 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, regDt, clientIp, req); writeSystemLog(SystemEventType.UPDATE_PROJECT, "Update Project", prjctIdx, regId, regDt, clientIp, req);
} }
public void writeDeleteProject(String regId, LocalDateTime regDt, 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",
@@ -94,7 +94,7 @@ public class SystemEventLogService {
); );
} }
public void writeAssignUserProject(String regId, LocalDateTime regDt, 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",
@@ -143,7 +143,7 @@ public class SystemEventLogService {
LocalDateTime regDt, LocalDateTime regDt,
String clientIp, String clientIp,
Map<String, Object> contentMap Map<String, Object> contentMap
){ ) {
TSysEventLogEntity log = TSysEventLogEntity.of( TSysEventLogEntity log = TSysEventLogEntity.of(
eventType, eventType,
title, title,

View File

@@ -34,14 +34,14 @@ public class UserService {
private final UserRepository userRepository; private final UserRepository userRepository;
@Transactional @Transactional
public void createUser(UserInfoDto userInfo, String regUser, LocalDateTime regDt){ 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();
userInfo.setUserId(userInfo.getUserId().toLowerCase()); userInfo.setUserId(userInfo.getUserId().toLowerCase());
List<DataVerificationDto> failList = validateUserDto(userInfo, roleList, intranetUserList).stream().filter(dto -> !dto.isSuccess()).toList(); List<DataVerificationDto> failList = validateUserDto(userInfo, roleList, intranetUserList).stream().filter(dto -> !dto.isSuccess()).toList();
if(!failList.isEmpty()){ if(!failList.isEmpty()) {
DataVerificationDto firstFail = failList.get(0); DataVerificationDto firstFail = failList.get(0);
throw BusinessException.badRequest("WRONG_USER_DATA", firstFail.getErrMessage()); throw BusinessException.badRequest("WRONG_USER_DATA", firstFail.getErrMessage());
} }
@@ -82,7 +82,7 @@ public class UserService {
.orElse(null); .orElse(null);
UserInfoDto dto = UserInfoDto.from(uploadDto, roleCd, regUser); UserInfoDto dto = UserInfoDto.from(uploadDto, roleCd, regUser);
if(!forceCmpn.isBlank()){ if(!forceCmpn.isBlank()) {
dto.setUserCmpn(forceCmpn); dto.setUserCmpn(forceCmpn);
} }
@@ -119,7 +119,7 @@ public class UserService {
); );
} }
public byte[] exportUserTemplate(){ public byte[] exportUserTemplate() {
try (Workbook workbook = try (Workbook workbook =
ExcelMapper.writeToWorkbook(Collections.emptyList(), UserUploadDto.class); ExcelMapper.writeToWorkbook(Collections.emptyList(), UserUploadDto.class);
ByteArrayOutputStream out = new ByteArrayOutputStream()) { ByteArrayOutputStream out = new ByteArrayOutputStream()) {
@@ -136,7 +136,7 @@ public class UserService {
return this.verifyUserId(userId, intranetUserList); return this.verifyUserId(userId, intranetUserList);
} }
public UserInfoDto getUser(String userId){ public UserInfoDto getUser(String userId) {
TUserEntity user = userRepository.findByUserIdAndDelFalse(userId) TUserEntity user = userRepository.findByUserIdAndDelFalse(userId)
.orElseThrow(() -> .orElseThrow(() ->
BusinessException.notFound("USER_NOT_FOUND", "사용자가 없습니다.") BusinessException.notFound("USER_NOT_FOUND", "사용자가 없습니다.")
@@ -148,7 +148,7 @@ public class UserService {
return userInfoDto; return userInfoDto;
} }
public TUserEntity getUser(String userId, String userPw){ public TUserEntity getUser(String userId, String userPw) {
return userRepository.findByUserIdAndUserPwAndDelFalse(userId, userPw) return userRepository.findByUserIdAndUserPwAndDelFalse(userId, userPw)
.orElseThrow(() -> .orElseThrow(() ->
BusinessException.notFound("USER_NOT_FOUND", "사용자가 없습니다.") BusinessException.notFound("USER_NOT_FOUND", "사용자가 없습니다.")
@@ -156,15 +156,15 @@ public class UserService {
); );
} }
public List<UserInfoDto> getUserList(){ public List<UserInfoDto> getUserList() {
return userRepository.findByDelFalse().stream() return userRepository.findByDelFalse().stream()
.map(UserInfoDto::from) .map(UserInfoDto::from)
.toList(); .toList();
} }
public List<UserInfoDto> getFieldworkUserListWithCmpn(String searchCmpn){ public List<UserInfoDto> getFieldworkUserListWithCmpn(String searchCmpn) {
List<TUserEntity> userList; List<TUserEntity> userList;
if(searchCmpn == null || searchCmpn.isBlank()){ if(searchCmpn == null || searchCmpn.isBlank()) {
userList = userRepository.findByUserRoleGreaterThanEqualAndDelFalse(ContactConstant.FIELDWORK_USER_ROLE); userList = userRepository.findByUserRoleGreaterThanEqualAndDelFalse(ContactConstant.FIELDWORK_USER_ROLE);
} }
else{ else{
@@ -176,7 +176,7 @@ public class UserService {
.toList(); .toList();
} }
public List<UserInfoDto> getOutsourceList(){ public List<UserInfoDto> getOutsourceList() {
List<TUserEntity> userList = userRepository.findByRoleRangeAndDelFalse( List<TUserEntity> userList = userRepository.findByRoleRangeAndDelFalse(
ContactConstant.OUTSOURCE_USER_ROLE, ContactConstant.OUTSOURCE_USER_ROLE,
ContactConstant.OUTSOURCE_USER_ROLE + 1000 ContactConstant.OUTSOURCE_USER_ROLE + 1000
@@ -187,12 +187,12 @@ public class UserService {
.toList(); .toList();
} }
public List<String> getUserCmpnList(){ public List<String> getUserCmpnList() {
return userRepository.findDistinctUserCmpnAndDelFalse(); return userRepository.findDistinctUserCmpnAndDelFalse();
} }
@Transactional @Transactional
public void updateUser(UserInfoDto dto, String modUser, LocalDateTime modDt){ 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(() ->
@@ -204,18 +204,18 @@ public class UserService {
} }
@Transactional @Transactional
public void deleteUser(String userId, String delUser){ public void deleteUser(String userId, String delUser) {
int deleteCount = userRepository.softDeleteByUserId(userId, delUser, DateTimeUtil.nowKstLocalDateTime()); int deleteCount = userRepository.softDeleteByUserId(userId, delUser, DateTimeUtil.nowKstLocalDateTime());
if(deleteCount == 0){ if(deleteCount == 0) {
throw BusinessException.notFound("USER_NOT_FOUND", "사용자를 찾을 수 없습니다.") throw BusinessException.notFound("USER_NOT_FOUND", "사용자를 찾을 수 없습니다.")
.with("userId", userId); .with("userId", userId);
} }
} }
/*******************************private*******************************/ /*******************************private*******************************/
private DataVerificationDto verifyUserId(String userId, List<String> intranetUserList){ private DataVerificationDto verifyUserId(String userId, List<String> intranetUserList) {
if(userId == null || userId.isBlank()){ if(userId == null || userId.isBlank()) {
return new DataVerificationDto(false, "사용자 ID", "사용자 ID가 비었습니다."); return new DataVerificationDto(false, "사용자 ID", "사용자 ID가 비었습니다.");
} }
if (userId.length() < 3 || userId.length() > 16 ) { if (userId.length() < 3 || userId.length() > 16 ) {
@@ -224,10 +224,10 @@ public class UserService {
if (!userId.matches("^[a-z가-힣][a-z0-9가-힣]+$")) { if (!userId.matches("^[a-z가-힣][a-z0-9가-힣]+$")) {
return new DataVerificationDto(false,"사용자 ID", "사용자 ID는 한글, 영소문자, 숫자만 허용합니다."); return new DataVerificationDto(false,"사용자 ID", "사용자 ID는 한글, 영소문자, 숫자만 허용합니다.");
} }
if(userRepository.existsByUserIdAndDelFalse(userId)){ if(userRepository.existsByUserIdAndDelFalse(userId)) {
return new DataVerificationDto(false,"사용자 ID", "이미 사용중인 ID입니다."); return new DataVerificationDto(false,"사용자 ID", "이미 사용중인 ID입니다.");
} }
if(intranetUserList.contains(userId) || intranetUserList.contains(String.format("%s@kric.com", userId))){ if(intranetUserList.contains(userId) || intranetUserList.contains(String.format("%s@kric.com", userId))) {
return new DataVerificationDto(false,"사용자 ID", "이미 사용중인 직원 ID입니다."); return new DataVerificationDto(false,"사용자 ID", "이미 사용중인 직원 ID입니다.");
} }
@@ -325,7 +325,7 @@ public class UserService {
List<DataVerificationDto> validateUserList = this.validateUserDto(dto, roleList, intranetUserList); List<DataVerificationDto> validateUserList = this.validateUserDto(dto, roleList, intranetUserList);
validateUserList.forEach(validateResult -> { validateUserList.forEach(validateResult -> {
if(!validateResult.isSuccess()){ if(!validateResult.isSuccess()) {
errors.add(UserUploadErrorDto.of( errors.add(UserUploadErrorDto.of(
rowNumber, rowNumber,
validateResult.getFieldName(), validateResult.getFieldName(),