OWL ITS + 탐지시스템(인터넷 진흥원)
- api 이슈 변경시 워크플로우에 포함된 상태로만 변경가능하도록 수정
6개 파일 변경됨
111 ■■■■■ 파일 변경됨
src/main/java/kr/wisestone/owl/constant/MsgConstants.java 2 ●●●●● 패치 | 보기 | raw | blame | 히스토리
src/main/java/kr/wisestone/owl/data/CheckIssueData.java 45 ●●●●● 패치 | 보기 | raw | blame | 히스토리
src/main/java/kr/wisestone/owl/service/WorkflowTransitionService.java 2 ●●●●● 패치 | 보기 | raw | blame | 히스토리
src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java 18 ●●●● 패치 | 보기 | raw | blame | 히스토리
src/main/java/kr/wisestone/owl/service/impl/WorkflowTransitionServiceImpl.java 7 ●●●●● 패치 | 보기 | raw | blame | 히스토리
src/main/java/kr/wisestone/owl/web/controller/ApiController.java 37 ●●●● 패치 | 보기 | raw | blame | 히스토리
src/main/java/kr/wisestone/owl/constant/MsgConstants.java
@@ -251,5 +251,7 @@
    public static final String API_ISSUE_NOT_EXIST = "API_ISSUE_NOT_EXIST";     // 수정할 이슈를 찾을수 없습니다.
    public static final String API_COMPLETE_ISSUE_STATUS_NOT_EXIST = "API_COMPLETE_ISSUE_STATUS_NOT_EXIST";     // 자동 종료 처리할 상태가 설정되지 않았습니다.
    public static final String API_ISSUE_STATUS_NOT_EXIST = "API_ISSUE_STATUS_NOT_EXIST";     // 이슈 상태를 찾을수 없습니다
    public static final String API_ISSUE_STATUS_IS_NULL = "API_ISSUE_STATUS_IS_NULL";     // 이슈 상태 값이 없습니다.
    public static final String API_CUSTOM_FIELD_NOT_EXIST = "API_CUSTOM_FIELD_NOT_EXIST";     // 사용자 정의 필드를 존재하지 않습니다.
    public static final String API_ISSUE_STATUS_NOT_IN_WORKFLOW = "API_ISSUE_STATUS_NOT_IN_WORKFLOW";     // 이슈 상태가 워크플로우에 포함되어 있지 않습니다
}
src/main/java/kr/wisestone/owl/data/CheckIssueData.java
@@ -1,12 +1,8 @@
package kr.wisestone.owl.data;
import kr.wisestone.owl.config.CommonConfiguration;
import kr.wisestone.owl.domain.*;
import kr.wisestone.owl.service.*;
import kr.wisestone.owl.util.ConvertUtil;
import kr.wisestone.owl.web.form.IssueForm;
import org.springframework.beans.factory.annotation.Autowired;
// issue 유효성 체크용 클래스
public class CheckIssueData {
@@ -18,48 +14,7 @@
    Priority priority;
    Severity severity;
    @Autowired
    private IssueService issueService;
    @Autowired
    private WorkspaceService workspaceService;
    @Autowired
    private ProjectService projectService;
    @Autowired
    private IssueStatusService issueStatusService;
    @Autowired
    private IssueTypeService issueTypeService;
    @Autowired
    private PriorityService priorityService;
    @Autowired
    private SeverityService severityService;
    public CheckIssueData() {}
    public boolean CheckData(User user, IssueForm issueForm) {
        //  사용하고 있는 업무 공간이 활성 상태인지 확인한다. 사용 공간에서 로그인한 사용자가 비활성인지 확인한다.
        this.workspaceService.checkUseWorkspace(user, user.getLastWorkspaceId());
        Issue issue = this.issueService.getIssue(issueForm.getId());
        IssueStatus oldIssueStatus = issue.getIssueStatus();
        //  프로젝트 유효성 체크
        Project project = this.projectService.getProject(issueForm.getProjectId());
        //  이슈 상태 유효성 체크
        IssueStatus issueStatus = this.issueStatusService.getIssueStatus(issueForm.getIssueStatusId());
        //  이슈 유형 유효성 체크
        IssueType issueType = this.issueTypeService.getIssueType(issueForm.getIssueTypeId());
        //  우선순위 유효성 체크
        Priority priority = this.priorityService.getPriority(issueForm.getPriorityId());
        //  중요도 유효성 체크
        Severity severity = this.severityService.getSeverity(issueForm.getSeverityId());
        return true;
    }
    public Issue getIssue() {
        return issue;
src/main/java/kr/wisestone/owl/service/WorkflowTransitionService.java
@@ -16,6 +16,8 @@
    List<WorkflowTransition> findByWorkflowId(Long workflowId);
    boolean contains(Long issueStatusId, Long workflowId);
    List<WorkflowTransitionVo> findBySourceIssueStatusIdAndWorkflowId(Long sourceIssueStatusId, Long workflowId);
    void modify(Workflow workflow, List<IssueStatusVo> issueStatusVos);
src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java
@@ -187,6 +187,9 @@
    private UserDepartmentService userDepartmentService;
    @Autowired
    private WorkflowTransitionService workflowTransitionService;
    @Autowired
    private UserDepartmentRepository userDepartmentRepository;
    @Autowired
@@ -194,6 +197,9 @@
    @Autowired
    private WorkflowDepartmentRepository workflowDepartmentRepository;
    @Autowired
    WorkflowService workflowService;
    @Override
    protected JpaRepository<Issue, Long> getRepository() {
@@ -234,7 +240,6 @@
        }
        Workflow workflow = issueType.getWorkflow();
        if (issueApiForm.getApiType().equals(IssueApiForm.ApiType.add)) {
            // 이슈 상태가 지정되어 있지 않을 경우 워크플로우 대기 상태 값으로 지정
            List<Long> departmentIds = this.workflowDepartmentService.findFirstDepartmentIds(workflow);
@@ -243,8 +248,15 @@
                    issueForm.addDepartmentId(departmentId);
                }
            }
        } else if (issueApiForm.getIssueStatusId() == null){
            throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.API_ISSUE_STATUS_NOT_EXIST));
        } else {
            if (issueApiForm.getIssueStatusId() == null){
                throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.API_ISSUE_STATUS_IS_NULL));
            }
            // 워크플로우에서 사용 중인 이슈 상태인지 체크
            else if (!this.workflowTransitionService.contains(issueApiForm.getIssueStatusId(), workflow.getId())) {
                throw new OwlRuntimeException(
                        this.messageAccessor.getMessage(MsgConstants.API_ISSUE_STATUS_NOT_IN_WORKFLOW));
            }
        }
        // 프로젝트 입력
src/main/java/kr/wisestone/owl/service/impl/WorkflowTransitionServiceImpl.java
@@ -131,6 +131,13 @@
        return this.workflowTransitionRepository.findByWorkflowId(workflowId);
    }
    // 워크플로우에 사용되는 이슈 상태인지 확인한다
    @Override
    public boolean contains(Long issueStatusId, Long workflowId) {
        List<WorkflowTransitionVo> workflowTransitionVos = this.findBySourceIssueStatusIdAndWorkflowId(issueStatusId, workflowId);
        return workflowTransitionVos != null && workflowTransitionVos.size() > 0;
    }
    //  이슈 상태와 연결된 전이선 정보를 조회한다.
    @Override
    @Transactional(readOnly = true)
src/main/java/kr/wisestone/owl/web/controller/ApiController.java
@@ -3,16 +3,12 @@
import kr.wisestone.owl.constant.Constants;
import kr.wisestone.owl.constant.MsgConstants;
import kr.wisestone.owl.domain.Issue;
import kr.wisestone.owl.domain.User;
import kr.wisestone.owl.exception.OwlRuntimeException;
import kr.wisestone.owl.service.IssueService;
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;
@@ -28,19 +24,6 @@
    @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
@@ -74,15 +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);
//    }
}