From 916a3cbabe4e50062fce61ff6f2f5d46c05dfbd1 Mon Sep 17 00:00:00 2001 From: 이민희 <mhlee@maprex.co.kr> Date: 목, 17 3월 2022 17:47:45 +0900 Subject: [PATCH] - api로 이슈 추가 시 url/ip로 업체 찾는 코드 수정 --- src/main/java/kr/wisestone/owl/service/impl/IssueCommentServiceImpl.java | 30 +++++++++++++++++++++++++++++- 1 files changed, 29 insertions(+), 1 deletions(-) diff --git a/src/main/java/kr/wisestone/owl/service/impl/IssueCommentServiceImpl.java b/src/main/java/kr/wisestone/owl/service/impl/IssueCommentServiceImpl.java index 832585a..a2963aa 100644 --- a/src/main/java/kr/wisestone/owl/service/impl/IssueCommentServiceImpl.java +++ b/src/main/java/kr/wisestone/owl/service/impl/IssueCommentServiceImpl.java @@ -3,6 +3,7 @@ import kr.wisestone.owl.constant.MsgConstants; import kr.wisestone.owl.domain.Issue; import kr.wisestone.owl.domain.IssueComment; +import kr.wisestone.owl.domain.User; import kr.wisestone.owl.exception.OwlRuntimeException; import kr.wisestone.owl.repository.IssueCommentRepository; import kr.wisestone.owl.service.IssueCommentService; @@ -47,6 +48,26 @@ public IssueComment addIssueComment(IssueCommentForm issueCommentForm) { // �궗�슜�븯怨� �엳�뒗 �뾽臾� 怨듦컙�씠 �솢�꽦 �긽�깭�씤吏� �솗�씤�븳�떎. �궗�슜 怨듦컙�뿉�꽌 濡쒓렇�씤�븳 �궗�슜�옄媛� 鍮꾪솢�꽦�씤吏� �솗�씤�븳�떎. this.workspaceService.checkUseWorkspace(); + + IssueComment issueComment = ConvertUtil.copyProperties(issueCommentForm, IssueComment.class); + + this.verifyComment(issueCommentForm.getDescription()); + + Issue issue = this.issueService.getIssue(issueCommentForm.getIssueId()); + issueComment.setIssue(issue); + issueComment.setWorkspace(issue.getProject().getWorkspace()); + + this.issueCommentRepository.saveAndFlush(issueComment); + + return issueComment; + } + + // �뙎湲��쓣 �벑濡앺븳�떎. (api�슜) + @Override + @Transactional + public IssueComment addIssueComment(IssueCommentForm issueCommentForm, User user) { + // �궗�슜�븯怨� �엳�뒗 �뾽臾� 怨듦컙�씠 �솢�꽦 �긽�깭�씤吏� �솗�씤�븳�떎. �궗�슜 怨듦컙�뿉�꽌 濡쒓렇�씤�븳 �궗�슜�옄媛� 鍮꾪솢�꽦�씤吏� �솗�씤�븳�떎. + this.workspaceService.checkUseWorkspace(user); IssueComment issueComment = ConvertUtil.copyProperties(issueCommentForm, IssueComment.class); @@ -133,7 +154,14 @@ @Override @Transactional(readOnly = true) public List<IssueCommentVo> findIssueComment(Long issueId) { - return this.issueCommentRepository.findByIssueId(issueId); + List<IssueCommentVo> issueCommentVos = this.issueCommentRepository.findByIssueId(issueId); + Issue issue = this.issueService.getIssue(issueId); + if (issueCommentVos != null && issueCommentVos.size() > 0) { + for (IssueCommentVo issueCommentVo : issueCommentVos) { + issueCommentVo.setTitle(issue.getTitle()); + } + } + return issueCommentVos; } } -- Gitblit v1.8.0