src/main/java/kr/wisestone/owl/constant/MsgConstants.java
@@ -245,4 +245,5 @@ public static final String API_OVERLAP_SETTING_NOT_EXIST = "API_OVERLAP_SETTING_NOT_EXIST"; // API 중복된 설정이 안되어 있을 경우 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"; // 이슈 상태를 찾을수 없습니다 } src/main/java/kr/wisestone/owl/service/DepartmentService.java
@@ -39,5 +39,7 @@ void findWorkflowDepartment(Map<String, Object> resJsonData, DepartmentCondition departmentCondition); List<DepartmentVo> findWorkflowDepartment(Long issueTypeId); List<Map<String, Object>> findProjectDepartment(Project project); } src/main/java/kr/wisestone/owl/service/WorkflowDepartmentService.java
@@ -1,17 +1,10 @@ package kr.wisestone.owl.service; import kr.wisestone.owl.domain.IssueStatus; import kr.wisestone.owl.domain.Workflow; import kr.wisestone.owl.domain.WorkflowDepartment; import kr.wisestone.owl.domain.WorkflowTransition; import kr.wisestone.owl.domain.enumType.ProjectType; import kr.wisestone.owl.util.MapUtil; import kr.wisestone.owl.domain.*; import kr.wisestone.owl.vo.IssueStatusVo; import kr.wisestone.owl.vo.WorkflowDepartmentVo; import kr.wisestone.owl.vo.WorkflowTransitionVo; import kr.wisestone.owl.web.condition.WorkflowDepartmentCondition; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.transaction.annotation.Transactional; import java.util.HashMap; import java.util.List; @@ -22,6 +15,8 @@ WorkflowDepartment getWorkflowDepartment(Long id); List<WorkflowDepartmentVo> find(WorkflowDepartmentCondition condition); List<WorkflowDepartmentVo> find(Long workflowId, Long issueStatusId); List<WorkflowDepartment> find(Long workflowId); List<Long> findFirstDepartmentIds(Workflow workflow); void modify(Workflow workflow, List<IssueStatusVo> issueStatusVos); void remove(Long workflowId); } src/main/java/kr/wisestone/owl/service/impl/DepartmentServiceImpl.java
@@ -2,13 +2,10 @@ import kr.wisestone.owl.domain.*; import kr.wisestone.owl.mapper.DepartmentMapper; import kr.wisestone.owl.repository.WorkflowDepartmentRepository; import kr.wisestone.owl.service.*; import kr.wisestone.owl.util.CommonUtil; import kr.wisestone.owl.web.condition.DepartmentCondition; import kr.wisestone.owl.web.condition.UserCondition; import kr.wisestone.owl.web.form.DepartmentForm; import kr.wisestone.owl.web.form.UserDepartmentForm; import org.jsoup.Jsoup; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -49,16 +46,13 @@ private DepartmentService departmentService; @Autowired private UserDepartmentService userDepartmentService; private WorkflowDepartmentService workflowDepartmentService; @Autowired private ProjectRoleDepartmentService projectRoleDepartmentService; @Autowired private ProjectRoleService projectRoleService; @Autowired private WorkflowDepartmentRepository workflowDepartmentRepository; @Autowired private IssueTypeService issueTypeService; @@ -167,24 +161,37 @@ @Override @Transactional(readOnly = true) public void findWorkflowDepartment(Map<String, Object> resJsonData, DepartmentCondition departmentCondition) { List<DepartmentVo> departmentVos = findWorkflowDepartment(departmentCondition.getIssueTypeId()); resJsonData.put(Constants.RES_KEY_CONTENTS, departmentVos); } IssueType issueType = this.issueTypeService.getIssueType(departmentCondition.getIssueTypeId()); Long workflowId = issueType.getWorkflow().getId(); List<WorkflowDepartment> workflowDepartmentList = this.workflowDepartmentRepository.findByWorkflowId(workflowId); // 워크플로우에 속해있는 부서 목록 조회 @Override @Transactional(readOnly = true) public List<DepartmentVo> findWorkflowDepartment(Long issueTypeId) { List<WorkflowDepartment> workflowDepartmentList = this.findWorkflowDepartmentByIssueTypeId(issueTypeId); List<DepartmentVo> departmentVos = Lists.newArrayList(); //List<Long> workflowDepartmentIds = Lists.newArrayList(); if(workflowDepartmentList != null && workflowDepartmentList.size()>0){ for(WorkflowDepartment workflowDepartment : workflowDepartmentList){ DepartmentVo departmentVo = ConvertUtil.copyProperties(workflowDepartment.getDepartment(), DepartmentVo.class); departmentVo.setByName(departmentVo.getDepartmentName()); //workflowDepartmentIds.add(workflowDepartment.getDepartment().getId()); departmentVos.add(departmentVo); } resJsonData.put(Constants.RES_KEY_CONTENTS, departmentVos); } return departmentVos; } // 이슈 유형(워크플로우)에 있는 담당부서 조회 private List<WorkflowDepartment> findWorkflowDepartmentByIssueTypeId(Long issueTypeId) { Long workflowId = this.getWorkflowId(issueTypeId); return this.workflowDepartmentService.find(workflowId); } private Long getWorkflowId(Long issueTypeId) { IssueType issueType = this.issueTypeService.getIssueType(issueTypeId); return issueType.getWorkflow().getId(); } // 부서 목록을 엑셀로 다운로드 한다. @Override src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java
@@ -211,23 +211,16 @@ Workflow workflow = issueType.getWorkflow(); // 이슈 상태가 지정되어 있지 않을 경우 초기값으로 지정 if (issueApiForm.getIssueStatusId() == null) { List<IssueStatusVo> issueStatusVos = issueStatusService.findByWorkflowId(workflow.getId()); IssueStatusVo issueStatusVo = issueStatusVos.get(0); issueApiForm.setIssueStatusId(issueStatusVo.getId()); } // 워크플로우 상태에 따른 담당부서 가져오기 if (issueApiForm.getIssueStatusId() != null) { WorkflowDepartmentCondition workflowDepartmentCondition = new WorkflowDepartmentCondition(); workflowDepartmentCondition.setIssueStatusId(issueApiForm.getIssueStatusId()); workflowDepartmentCondition.setWorkflowId(workflow.getId()); List<WorkflowDepartmentVo> workflowDepartmentVos = this.workflowDepartmentService.find(workflowDepartmentCondition); for (WorkflowDepartmentVo workflowDepartmentVo : workflowDepartmentVos) { issueForm.addDepartmentId(workflowDepartmentVo.getDepartmentVo().getId()); if (issueApiForm.getApiType().equals(IssueApiForm.ApiType.add)) { // 이슈 상태가 지정되어 있지 않을 경우 워크플로우 대기 상태 값으로 지정 List<Long> departmentIds = this.workflowDepartmentService.findFirstDepartmentIds(workflow); if (departmentIds != null && departmentIds.size() > 0) { for (Long departmentId : departmentIds) { issueForm.addDepartmentId(departmentId); } } } else if (issueApiForm.getIssueStatusId() == null){ throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.API_ISSUE_STATUS_NOT_EXIST)); } // 프로젝트 입력 src/main/java/kr/wisestone/owl/service/impl/WorkflowDepartmentServiceImpl.java
@@ -74,6 +74,31 @@ return find(condition); } public List<WorkflowDepartment> find(Long workflowId) { return this.workflowDepartmentRepository.findByWorkflowId(workflowId); } @Override // 워크플로우의 해당 이슈상태를 가진 워크플로우 부서 가져오기(Ready) public List<Long> findFirstDepartmentIds(Workflow workflow) { List<Long> departmentIds = Lists.newArrayList(); IssueStatus issueStatus = issueStatusService.findByIssueStatusTypeIsReady(workflow); // 워크플로우 상태에 따른 담당부서 가져오기 if (issueStatus != null) { WorkflowDepartmentCondition workflowDepartmentCondition = new WorkflowDepartmentCondition(); workflowDepartmentCondition.setIssueStatusId(issueStatus.getId()); workflowDepartmentCondition.setWorkflowId(workflow.getId()); List<WorkflowDepartmentVo> workflowDepartmentVos = this.find(workflowDepartmentCondition); for (WorkflowDepartmentVo workflowDepartmentVo : workflowDepartmentVos) { departmentIds.add(workflowDepartmentVo.getDepartmentVo().getId()); } } return departmentIds; } // 담당 부서정보를 조회한다. @Transactional(readOnly = true) @Override src/main/java/kr/wisestone/owl/web/condition/IssueCondition.java
@@ -187,6 +187,8 @@ if (MapUtil.getBoolean(conditions, "isTree") != null) { condition.setTree(MapUtil.getBoolean(conditions, "isTree")); } else { condition.setTree(false); } return condition;