260212_01_DOC: 프로젝트 전체에 구글 java 스타일 적용
This commit is contained in:
@@ -4,19 +4,32 @@ import com.kri.common.datetime.DateTimeUtil;
|
||||
import com.kri.common.webmvc.RequestUserContext;
|
||||
import com.kri.common.webmvc.page.PageResponseDto;
|
||||
import com.kri.contact.server.common.enums.ChannelType;
|
||||
import com.kri.contact.server.dto.*;
|
||||
import com.kri.contact.server.dto.ProjectCreateRequestDto;
|
||||
import com.kri.contact.server.dto.ProjectInfoDto;
|
||||
import com.kri.contact.server.dto.ProjectMainTemplateUpdateRequestDto;
|
||||
import com.kri.contact.server.dto.ProjectOwnerResponseDto;
|
||||
import com.kri.contact.server.dto.ProjectSearchRequestDto;
|
||||
import com.kri.contact.server.dto.ProjectUpdateRequestDto;
|
||||
import com.kri.contact.server.service.FileService;
|
||||
import com.kri.contact.server.service.ProjectService;
|
||||
import com.kri.contact.server.service.SystemEventLogService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PatchMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/project")
|
||||
@@ -24,109 +37,113 @@ import java.util.List;
|
||||
@Tag(name = "Project", description = "프로젝트 API")
|
||||
public class ProjectController {
|
||||
|
||||
private final SystemEventLogService systemEventLogService;
|
||||
private final ProjectService projectService;
|
||||
private final FileService fileService;
|
||||
private final SystemEventLogService systemEventLogService;
|
||||
private final ProjectService projectService;
|
||||
private final FileService fileService;
|
||||
|
||||
@Operation(summary = "프로젝트 조회")
|
||||
@GetMapping("/{prjctIdx}")
|
||||
public ProjectInfoDto getProject(@PathVariable Long prjctIdx) {
|
||||
return projectService.getProject(prjctIdx);
|
||||
}
|
||||
@Operation(summary = "프로젝트 조회")
|
||||
@GetMapping("/{prjctIdx}")
|
||||
public ProjectInfoDto getProject(@PathVariable Long prjctIdx) {
|
||||
return projectService.getProject(prjctIdx);
|
||||
}
|
||||
|
||||
@Operation(summary = "상위 프로젝트 조회(생성일자 늦은 순)")
|
||||
@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());
|
||||
}
|
||||
@Operation(summary = "상위 프로젝트 조회(생성일자 늦은 순)")
|
||||
@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());
|
||||
}
|
||||
|
||||
@Operation(summary = "프로젝트 목록 조회")
|
||||
@PostMapping("/list")
|
||||
public PageResponseDto<ProjectInfoDto> searchProject(
|
||||
@Valid @RequestBody ProjectSearchRequestDto req,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return projectService.searchProject(req, ctx.getUserId(), ctx.getUserRole());
|
||||
}
|
||||
@Operation(summary = "프로젝트 목록 조회")
|
||||
@PostMapping("/list")
|
||||
public PageResponseDto<ProjectInfoDto> searchProject(
|
||||
@Valid @RequestBody ProjectSearchRequestDto req,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
return projectService.searchProject(req, ctx.getUserId(), ctx.getUserRole());
|
||||
}
|
||||
|
||||
@Operation(summary = "프로젝트를 소유하고 있는 모든 부서/실사 목록 조회")
|
||||
@GetMapping("/owner-list")
|
||||
public ProjectOwnerResponseDto getOwnerList(RequestUserContext ctx) {
|
||||
return projectService.getOwnerList(ctx.getUserRole());
|
||||
}
|
||||
|
||||
//프로젝트 메인 발송 템플릿 조회 시 살아있는 템플릿인지 한번 검사하기
|
||||
@Operation(summary = "프로젝트 대표 발송 템플릿 조회")
|
||||
@GetMapping("/main-template/{prjctIdx}/{chnnlTy}")
|
||||
public Long getMainTemplateIdx(
|
||||
@PathVariable Long prjctIdx,
|
||||
@PathVariable ChannelType chnnlTy
|
||||
){
|
||||
return projectService.getMainTemplateIdx(prjctIdx, chnnlTy.getCode());
|
||||
}
|
||||
@Operation(summary = "프로젝트를 소유하고 있는 모든 부서/실사 목록 조회")
|
||||
@GetMapping("/owner-list")
|
||||
public ProjectOwnerResponseDto getOwnerList(RequestUserContext ctx) {
|
||||
return projectService.getOwnerList(ctx.getUserRole());
|
||||
}
|
||||
|
||||
@Operation(summary = "프로젝트 생성")
|
||||
@PutMapping()
|
||||
public ProjectInfoDto createProject(
|
||||
@Valid @RequestBody ProjectCreateRequestDto req,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||
//프로젝트 메인 발송 템플릿 조회 시 살아있는 템플릿인지 한번 검사하기
|
||||
@Operation(summary = "프로젝트 대표 발송 템플릿 조회")
|
||||
@GetMapping("/main-template/{prjctIdx}/{chnnlTy}")
|
||||
public Long getMainTemplateIdx(
|
||||
@PathVariable Long prjctIdx,
|
||||
@PathVariable ChannelType chnnlTy
|
||||
) {
|
||||
return projectService.getMainTemplateIdx(prjctIdx, chnnlTy.getCode());
|
||||
}
|
||||
|
||||
ProjectInfoDto prjctInfo = projectService.createProject(req, ctx.getUserId(), now);
|
||||
systemEventLogService.writeCreateProject(ctx.getUserId(), now, ctx.getClientIp(), prjctInfo.getPrjctIdx(), req);
|
||||
@Operation(summary = "프로젝트 생성")
|
||||
@PutMapping()
|
||||
public ProjectInfoDto createProject(
|
||||
@Valid @RequestBody ProjectCreateRequestDto req,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||
|
||||
return prjctInfo;
|
||||
}
|
||||
ProjectInfoDto prjctInfo = projectService.createProject(req, ctx.getUserId(), now);
|
||||
systemEventLogService.writeCreateProject(ctx.getUserId(), now, ctx.getClientIp(),
|
||||
prjctInfo.getPrjctIdx(), req);
|
||||
|
||||
@Operation(summary = "시나리오 이미지 업로드")
|
||||
@PutMapping("/senario-image/{prjctCd}")
|
||||
public String uploadContactSenarioImage(@PathVariable String prjctCd, @RequestParam("file") MultipartFile file) {
|
||||
return fileService.storeTempFile(prjctCd, file);
|
||||
}
|
||||
return prjctInfo;
|
||||
}
|
||||
|
||||
@Operation(summary = "프로젝트 수정")
|
||||
@PatchMapping("/{prjctIdx}")
|
||||
public void updateProject(
|
||||
@PathVariable long prjctIdx,
|
||||
@Valid @RequestBody ProjectUpdateRequestDto req,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||
@Operation(summary = "시나리오 이미지 업로드")
|
||||
@PutMapping("/senario-image/{prjctCd}")
|
||||
public String uploadContactSenarioImage(@PathVariable String prjctCd,
|
||||
@RequestParam("file") MultipartFile file) {
|
||||
return fileService.storeTempFile(prjctCd, file);
|
||||
}
|
||||
|
||||
String newHtml = fileService.syncOnSave(
|
||||
req.getProjectInfo().getPrjctCd(),
|
||||
req.getProjectInfo().getContactSenario()
|
||||
);
|
||||
req.getProjectInfo().setContactSenario(newHtml);
|
||||
@Operation(summary = "프로젝트 수정")
|
||||
@PatchMapping("/{prjctIdx}")
|
||||
public void updateProject(
|
||||
@PathVariable long prjctIdx,
|
||||
@Valid @RequestBody ProjectUpdateRequestDto req,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||
|
||||
projectService.updateProject(prjctIdx, req, ctx.getUserId(), now);
|
||||
String newHtml = fileService.syncOnSave(
|
||||
req.getProjectInfo().getPrjctCd(),
|
||||
req.getProjectInfo().getContactSenario()
|
||||
);
|
||||
req.getProjectInfo().setContactSenario(newHtml);
|
||||
|
||||
systemEventLogService.writeUpdateProject(ctx.getUserId(), now, ctx.getClientIp(), prjctIdx, req);
|
||||
}
|
||||
projectService.updateProject(prjctIdx, req, ctx.getUserId(), now);
|
||||
|
||||
@Operation(summary = "프로젝트 대표 발송 템플릿 지정")
|
||||
@PatchMapping("/main-template")
|
||||
public void updateProjectMainTemplate(
|
||||
@Valid @RequestBody ProjectMainTemplateUpdateRequestDto req,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||
systemEventLogService.writeUpdateProject(ctx.getUserId(), now, ctx.getClientIp(), prjctIdx,
|
||||
req);
|
||||
}
|
||||
|
||||
projectService.updateProjectMainTemplate(req, ctx.getUserId(), now);
|
||||
systemEventLogService.writeUpdateDefaultMessageTemplate(ctx.getUserId(), now, ctx.getClientIp(), req);
|
||||
}
|
||||
@Operation(summary = "프로젝트 대표 발송 템플릿 지정")
|
||||
@PatchMapping("/main-template")
|
||||
public void updateProjectMainTemplate(
|
||||
@Valid @RequestBody ProjectMainTemplateUpdateRequestDto req,
|
||||
RequestUserContext ctx
|
||||
) {
|
||||
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||
|
||||
@Operation(summary = "프로젝트 삭제(소프트 삭제)")
|
||||
@DeleteMapping("/{prjctIdx}")
|
||||
public void deleteProject(@PathVariable Long prjctIdx, RequestUserContext ctx) {
|
||||
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||
projectService.updateProjectMainTemplate(req, ctx.getUserId(), now);
|
||||
systemEventLogService.writeUpdateDefaultMessageTemplate(ctx.getUserId(), now, ctx.getClientIp(),
|
||||
req);
|
||||
}
|
||||
|
||||
projectService.deleteProject(prjctIdx, ctx.getUserId(), now);
|
||||
systemEventLogService.writeDeleteProject(ctx.getUserId(), now, ctx.getClientIp(), prjctIdx);
|
||||
}
|
||||
@Operation(summary = "프로젝트 삭제(소프트 삭제)")
|
||||
@DeleteMapping("/{prjctIdx}")
|
||||
public void deleteProject(@PathVariable Long prjctIdx, RequestUserContext ctx) {
|
||||
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||
|
||||
projectService.deleteProject(prjctIdx, ctx.getUserId(), now);
|
||||
systemEventLogService.writeDeleteProject(ctx.getUserId(), now, ctx.getClientIp(), prjctIdx);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user