251210_01_ENH: Project CRUD 구현 및 테스트 진행중
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
package com.kri.contact.server.controller;
|
||||
|
||||
import com.kri.common.web.BusinessException;
|
||||
import com.kri.common.webmvc.RequestUserContext;
|
||||
import com.kri.contact.server.common.consts.AppConstant;
|
||||
import com.kri.contact.server.service.AssignService;
|
||||
import com.kri.contact.server.service.SystemEventLogService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/assign")
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "Assign", description = "배정 API")
|
||||
public class AssignController {
|
||||
|
||||
private final SystemEventLogService systemEventLogService;
|
||||
private final AssignService assignService;
|
||||
|
||||
@GetMapping("/prjct-outsource/{prjctIdx}")
|
||||
public List<String> getPrjctOutsourceAssign(@PathVariable Long prjctIdx, RequestUserContext ctx){
|
||||
return assignService.getPrjctOutsourceAssign(prjctIdx);
|
||||
}
|
||||
|
||||
@PutMapping("/prjct-outsource/{prjctIdx}")
|
||||
public void upsertPrjctOutsourceAssign(
|
||||
@PathVariable Long prjctIdx,
|
||||
@RequestBody List<String> assignUserIdList,
|
||||
RequestUserContext ctx
|
||||
){
|
||||
assignService.upsertPrjctOutsourceAssign(prjctIdx, assignUserIdList, ctx.getUserId());
|
||||
systemEventLogService.writeAssignProjectOutsource(ctx.getUserId(), ctx.getClientIp(), prjctIdx, assignUserIdList);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.kri.contact.server.controller;
|
||||
|
||||
import com.kri.common.webmvc.RequestUserContext;
|
||||
import com.kri.contact.server.dto.ProjectOwnerResponseDto;
|
||||
import com.kri.contact.server.dto.common.PageResponseDto;
|
||||
import com.kri.contact.server.dto.ProjectCreateRequestDto;
|
||||
import com.kri.contact.server.dto.ProjectInfoDto;
|
||||
import com.kri.contact.server.dto.ProjectSearchRequestDto;
|
||||
import com.kri.contact.server.service.ProjectService;
|
||||
import com.kri.contact.server.service.SystemEventLogService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/project")
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "Project", description = "프로젝트 API")
|
||||
public class ProjectController {
|
||||
|
||||
private final SystemEventLogService systemEventLogService;
|
||||
private final ProjectService projectService;
|
||||
|
||||
@GetMapping("/{prjctIdx}")
|
||||
public ProjectInfoDto getProject(@PathVariable Long prjctIdx){
|
||||
return projectService.getProject(prjctIdx);
|
||||
}
|
||||
|
||||
@GetMapping("/top/{topCount}")
|
||||
public List<ProjectInfoDto> getTopProject(
|
||||
@PathVariable int topCount,
|
||||
@RequestParam(required = false) String keyword,
|
||||
RequestUserContext ctx
|
||||
){
|
||||
return projectService.getTopProject(topCount, keyword, ctx.getUserId(), ctx.getUserRole());
|
||||
}
|
||||
|
||||
@PostMapping("/list")
|
||||
public PageResponseDto<ProjectInfoDto> searchProject(
|
||||
@RequestBody ProjectSearchRequestDto req,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return projectService.searchProject(req, ctx.getUserId(), ctx.getUserRole());
|
||||
}
|
||||
|
||||
@GetMapping("/owner-list")
|
||||
public ProjectOwnerResponseDto getOwnerList(RequestUserContext ctx){
|
||||
return projectService.getOwnerList(ctx.getUserRole());
|
||||
}
|
||||
|
||||
@PutMapping()
|
||||
public ProjectInfoDto createProject(
|
||||
@RequestBody ProjectCreateRequestDto req,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
ProjectInfoDto prjctInfo = projectService.createProject(req, ctx.getUserId());
|
||||
systemEventLogService.writeCreateProject(ctx.getUserId(), ctx.getClientIp(), prjctInfo.getPrjctIdx(), req);
|
||||
|
||||
return prjctInfo;
|
||||
}
|
||||
|
||||
@PatchMapping()
|
||||
public void updateProject(
|
||||
@RequestBody ProjectInfoDto req,
|
||||
RequestUserContext ctx
|
||||
){
|
||||
projectService.updateProject(req, ctx.getUserId());
|
||||
systemEventLogService.writeUpdateProject(ctx.getUserId(), ctx.getClientIp(), req.getPrjctIdx(), req);
|
||||
}
|
||||
|
||||
@DeleteMapping("/{prjctIdx}")
|
||||
public void deleteProject(@PathVariable Long prjctIdx, RequestUserContext ctx){
|
||||
projectService.deleteProject(prjctIdx, ctx.getUserId());
|
||||
systemEventLogService.writeDeleteProject(ctx.getUserId(), ctx.getClientIp(), prjctIdx);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.kri.contact.server.controller;
|
||||
|
||||
import com.kri.common.web.BusinessException;
|
||||
import com.kri.common.webmvc.RequestUserContext;
|
||||
import com.kri.contact.server.common.consts.AppConstant;
|
||||
import com.kri.contact.server.dto.DataVerificationDto;
|
||||
@@ -39,17 +40,22 @@ public class UserController {
|
||||
|
||||
@GetMapping()
|
||||
public List<UserInfoDto> getUserList(RequestUserContext ctx){
|
||||
//내부 직원
|
||||
if(ctx.getUserRole() < AppConstant.EXTERNAL_USER_ROLE){
|
||||
return userService.getUserListWithCmpn("");
|
||||
String searchCmpn = ctx.getUserCmpn();
|
||||
if(ctx.getUserRole() < AppConstant.OUTSOURCE_USER_ROLE){
|
||||
searchCmpn = "";
|
||||
}
|
||||
//외주사 이상
|
||||
return userService.getUserListWithCmpn(ctx.getUserCmpn());
|
||||
|
||||
return userService.getUserListWithCmpn(searchCmpn);
|
||||
}
|
||||
|
||||
@GetMapping("outsource")
|
||||
List<UserInfoDto> getOutsourceList(RequestUserContext ctx){
|
||||
return userService.getOutsourceList();
|
||||
}
|
||||
|
||||
@GetMapping("cmpn")
|
||||
public List<String> getUserCmpnList(RequestUserContext ctx){
|
||||
if(ctx.getUserRole() < AppConstant.EXTERNAL_USER_ROLE){
|
||||
if(ctx.getUserRole() < AppConstant.OUTSOURCE_USER_ROLE){
|
||||
return userService.getUserCmpnList();
|
||||
}
|
||||
|
||||
@@ -73,7 +79,7 @@ public class UserController {
|
||||
String regId = ctx.getUserId();
|
||||
String clientIp = ctx.getClientIp();
|
||||
//외주사급이 업로드로 계정을 생성하는 경우 자신의 회사명으로 고정
|
||||
String forceCmpn = ctx.getUserRole() < AppConstant.EXTERNAL_USER_ROLE? "" : ctx.getUserCmpn();
|
||||
String forceCmpn = ctx.getUserRole() < AppConstant.OUTSOURCE_USER_ROLE? "" : ctx.getUserCmpn();
|
||||
|
||||
ExcelUploadResponseDto result = userService.createUsersFromExcel(file, regId, forceCmpn);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user