From 367c498ea88844fd36079b46a9f7c7f5d0a9c1cd Mon Sep 17 00:00:00 2001 From: jhjang <jhjang@maprex.co.kr> Date: 월, 27 12월 2021 10:33:53 +0900 Subject: [PATCH] - api 이슈 변경시 워크플로우에 포함된 상태로만 변경가능하도록 수정 --- src/main/java/kr/wisestone/owl/web/controller/ApiController.java | 57 ++++++++++++++++++++++++++------------------------------- 1 files changed, 26 insertions(+), 31 deletions(-) diff --git a/src/main/java/kr/wisestone/owl/web/controller/ApiController.java b/src/main/java/kr/wisestone/owl/web/controller/ApiController.java index f056a56..5c13abc 100644 --- a/src/main/java/kr/wisestone/owl/web/controller/ApiController.java +++ b/src/main/java/kr/wisestone/owl/web/controller/ApiController.java @@ -8,16 +8,14 @@ import kr.wisestone.owl.util.ConvertUtil; import kr.wisestone.owl.web.form.IssueApiForm; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.domain.Pageable; -import org.springframework.http.MediaType; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.multipart.MultipartHttpServletRequest; import java.util.HashMap; +import java.util.List; import java.util.Map; @Controller @@ -26,34 +24,32 @@ @Autowired private IssueService issueService; - // �씠�뒋 異붽�(json 諛⑹떇�쑝濡� �뙆�씪�쟾�넚) -// @RequestMapping(value = "api/issue", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) -// public -// @ResponseBody -// Map<String, Object> addIssue(@RequestBody Map<String, Map<String, Object>> params) { -// Map<String, Object> resJsonData = new HashMap<>(); -// -// IssueApiForm issueForm = IssueApiForm.make(params.get(Constants.REQ_KEY_CONTENT)); -// Issue issue = this.issueService.addApiIssue(issueForm); -// // 踰꾩쟾 �깮�꽦 -// this.issueService.addIssueVersion(issue.getId()); -// return this.setSuccessMessage(resJsonData); -// } @RequestMapping(value = "api/issue", method = RequestMethod.POST) public @ResponseBody - Map<String, Object> addIssue(MultipartHttpServletRequest request) throws OwlRuntimeException { + Map<String, Object> addIssue(MultipartHttpServletRequest request) throws OwlRuntimeException, CloneNotSupportedException { Map<String, Object> resJsonData = new HashMap<>(); - IssueApiForm issueForm = IssueApiForm.make(ConvertUtil.convertJsonToMap(request.getParameter(Constants.REQ_KEY_CONTENT)), request.getFiles("file")); + String str = request.getParameter(Constants.REQ_KEY_CONTENT); + + IssueApiForm issueForm = IssueApiForm.make(ConvertUtil.convertJsonToMap(str), request.getFiles("file")); if (issueForm == null) { throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.API_PARAMETER_ERROR)); } + // �궗�슜�옄 �젙�쓽 �븘�뱶媛� �뾾�쓣 寃쎌슦 寃��깋�쓣 �븷 �닔 �뾾湲� �븣臾몄뿉 �삁�쇅泥섎━ + else if (issueForm.getCustomFieldValues() == null || issueForm.getCustomFieldValues().size() == 0) { + throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.API_CUSTOM_FIELD_NOT_EXIST)); + } + if (issueForm.getApiType() == IssueApiForm.ApiType.add) { - Issue issue = this.issueService.addApiIssue(issueForm); + List<Issue> issues = this.issueService.addApiIssue(issueForm); // 踰꾩쟾 �깮�꽦 - this.issueService.addIssueVersion(issue.getId()); + for (Issue issue : issues) { + this.issueService.addIssueVersion(issue.getId(), issue.getRegisterId()); + } } else { + + this.issueService.modifyIssue(issueForm, request.getFiles("file")); } @@ -61,16 +57,15 @@ } // �씠�뒋 議고쉶 - @RequestMapping(value = "/api/issueList", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) - public - @ResponseBody - Map<String, Object> find(@RequestBody Map<String, Map<String, Object>> params) { - Map<String, Object> resJsonData = new HashMap<>(); - Pageable pageable = this.pageUtil.convertPageable(this.getPageVo(params)); - - // todo - - return this.setSuccessMessage(resJsonData); - } +// @RequestMapping(value = "/api/issueList", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) +// public +// @ResponseBody +// Map<String, Object> find(@RequestBody Map<String, Map<String, Object>> params) { +// Map<String, Object> resJsonData = new HashMap<>(); +// Pageable pageable = this.pageUtil.convertPageable(this.getPageVo(params)); +// +// // todo +// return this.setSuccessMessage(resJsonData); +// } } -- Gitblit v1.8.0