| | |
| | | import java.io.IOException; |
| | | import java.util.*; |
| | | |
| | | import static kr.wisestone.owl.domain.enumType.CustomFieldType.INPUT; |
| | | |
| | | @Service |
| | | public class IssueServiceImpl extends AbstractServiceImpl<Issue, Long, JpaRepository<Issue, Long>> implements IssueService { |
| | | |
| | |
| | | @Autowired |
| | | private IssueRelationMapper issueRelationMapper; |
| | | |
| | | @Autowired |
| | | private WorkflowTransitionService workflowTransitionService; |
| | | |
| | | @Override |
| | | protected JpaRepository<Issue, Long> getRepository() { |
| | | return this.issueRepository; |
| | |
| | | } |
| | | } else if (issueApiForm.getIssueStatusId() == null){ |
| | | throw new ApiParameterException(this.messageAccessor.getMessage(MsgConstants.API_ISSUE_STATUS_NOT_EXIST)); |
| | | } else if (!this.workflowTransitionService.contains(issueApiForm.getIssueStatusId(), workflow.getId())) { |
| | | //이슈 상태 유효성 확인 |
| | | throw new ApiParameterException(this.messageAccessor.getMessage(MsgConstants.API_ISSUE_STATUS_NOT_EXIST_IN_WORKFLOW)); |
| | | } |
| | | |
| | | // 프로젝트 입력 |
| | |
| | | @Override |
| | | @Transactional |
| | | public Issue addIssue(User user, IssueForm issueForm, List<MultipartFile> multipartFiles) { |
| | | StringBuilder detectIssueChange = new StringBuilder(); |
| | | |
| | | // 사용하고 있는 업무 공간이 활성 상태인지 확인한다. 사용 공간에서 로그인한 사용자가 비활성인지 확인한다. |
| | | Workspace workspace = this.workspaceService.checkUseWorkspace(user, user.getLastWorkspaceId()); |
| | | // 프로젝트 유효성 체크 |
| | |
| | | // 담당부서 지정 |
| | | this.issueDepartmentService.modifyIssueDepartment(issue, user, project.getWorkspace(), issueForm.getDepartmentIds()); |
| | | // 업체 정보 저장 |
| | | this.issueCompanyService.modifyIssueCompanyField(issue, issueForm); |
| | | this.issueCompanyService.modifyIssueCompanyField(issue, issueForm, detectIssueChange); |
| | | // ISP 정보 저장 |
| | | this.issueIspService.modifyIssueIspField(issue, issueForm); |
| | | this.issueIspService.modifyIssueIspField(issue, issueForm, detectIssueChange); |
| | | // HOSTING 정보 저장 |
| | | this.issueHostingService.modifyIssueHostingField(issue, issueForm); |
| | | this.issueHostingService.modifyIssueHostingField(issue, issueForm, detectIssueChange); |
| | | |
| | | // 첨부 파일 저장 |
| | | // multipartFile 을 file Map List 객체로 변경한다. |
| | |
| | | @Override |
| | | @Transactional |
| | | public Issue addDownIssue(User user, IssueForm issueForm, List<MultipartFile> multipartFiles) { |
| | | StringBuilder detectIssueChange = new StringBuilder(); |
| | | |
| | | // 사용하고 있는 업무 공간이 활성 상태인지 확인한다. 사용 공간에서 로그인한 사용자가 비활성인지 확인한다. |
| | | Workspace workspace = this.workspaceService.checkUseWorkspace(user, user.getLastWorkspaceId()); |
| | | // 프로젝트 유효성 체크 |
| | |
| | | // 담당부서 지정 |
| | | this.issueDepartmentService.modifyIssueDepartment(issue, user, project.getWorkspace(), issueForm.getDepartmentIds()); |
| | | // 업체 정보 저장 |
| | | this.issueCompanyService.modifyIssueCompanyField(issue, issueForm); |
| | | this.issueCompanyService.modifyIssueCompanyField(issue, issueForm, detectIssueChange); |
| | | // ISP 정보 저장 |
| | | this.issueIspService.modifyIssueIspField(issue, issueForm); |
| | | this.issueIspService.modifyIssueIspField(issue, issueForm, detectIssueChange); |
| | | // HOSTING 정보 저장 |
| | | this.issueHostingService.modifyIssueHostingField(issue, issueForm); |
| | | this.issueHostingService.modifyIssueHostingField(issue, issueForm, detectIssueChange); |
| | | |
| | | // 첨부 파일 저장 |
| | | // multipartFile 을 file Map List 객체로 변경한다. |
| | |
| | | @Override |
| | | @Transactional |
| | | public Issue addRelIssue(User user, IssueForm issueForm, List<MultipartFile> multipartFiles) { |
| | | StringBuilder detectIssueChange = new StringBuilder(); |
| | | // 사용하고 있는 업무 공간이 활성 상태인지 확인한다. 사용 공간에서 로그인한 사용자가 비활성인지 확인한다. |
| | | Workspace workspace = this.workspaceService.checkUseWorkspace(user, user.getLastWorkspaceId()); |
| | | // 프로젝트 유효성 체크 |
| | |
| | | // 담당부서 지정 |
| | | this.issueDepartmentService.modifyIssueDepartment(issue, user, project.getWorkspace(), issueForm.getDepartmentIds()); |
| | | // 업체 정보 저장 |
| | | this.issueCompanyService.modifyIssueCompanyField(issue, issueForm); |
| | | this.issueCompanyService.modifyIssueCompanyField(issue, issueForm, detectIssueChange); |
| | | // ISP 정보 저장 |
| | | this.issueIspService.modifyIssueIspField(issue, issueForm); |
| | | this.issueIspService.modifyIssueIspField(issue, issueForm, detectIssueChange); |
| | | // HOSTING 정보 저장 |
| | | this.issueHostingService.modifyIssueHostingField(issue, issueForm); |
| | | this.issueHostingService.modifyIssueHostingField(issue, issueForm, detectIssueChange); |
| | | |
| | | // 첨부 파일 저장 |
| | | // multipartFile 을 file Map List 객체로 변경한다. |
| | |
| | | useValues.add(issueCustomFieldValueVo.getUseValue()); |
| | | customField.put(issueCustomFieldValueVo.getCustomFieldVo().getName(), useValues); |
| | | } else { |
| | | if (issueCustomFieldValueVo.getCustomFieldVo().getCustomFieldType().equals(CustomFieldType.INPUT.toString())) { |
| | | if (issueCustomFieldValueVo.getCustomFieldVo().getCustomFieldType().equals(INPUT.toString())) { |
| | | customField.put(issueCustomFieldValueVo.getCustomFieldVo().getName(), issueCustomFieldValueVo.getUseValue()); |
| | | } else { |
| | | customField.put(issueCustomFieldValueVo.getCustomFieldVo().getName(), Lists.newArrayList(issueCustomFieldValueVo.getUseValue())); |
| | |
| | | this.setIssueCustomFields(downIssue, downIssueVo); // 사용자정의필드 정보 세팅 |
| | | this.setIssueHistory(downIssue, downIssueVo); // 이슈 기록 정보 셋팅 |
| | | this.setIssueComments(downIssue, downIssueVo); // 댓글 정보 셋팅 |
| | | this.setIssueCompanyField(downIssue, downIssueVo); //업체 정보 세팅 |
| | | this.setIssueIspField(downIssue, downIssueVo); //ISP 정보 세팅 |
| | | this.setIssueHostingField(downIssue, downIssueVo); //HOSTING 정보 세팅 |
| | | |
| | | downIssueVo.setModifyPermissionCheck(issueVo.getModifyPermissionCheck()); |
| | | |
| | |
| | | @Override |
| | | @Transactional(readOnly = true) |
| | | public void setIssueDetail(IssueVo issueVo, Issue issue, User user) { |
| | | // 이슈 수정 권한을 갖고 있는지 확인 |
| | | if (this.checkHasPermission(issueVo, issueVo.getUserVos(), user, issueVo.getDepartmentVos())) { |
| | | issueVo.setModifyPermissionCheck(Boolean.TRUE); |
| | | } |
| | | |
| | | issueVo.setProjectVo(ConvertUtil.copyProperties(issue.getProject(), ProjectVo.class)); |
| | | issueVo.setIssueTypeVo(ConvertUtil.copyProperties(issue.getIssueType(), IssueTypeVo.class)); |
| | | IssueStatusVo issueStatusVo = ConvertUtil.copyProperties(issue.getIssueStatus(), IssueStatusVo.class, "issueStatusType"); |
| | |
| | | this.setIssueIspField(issue, issueVo); //ISP 정보 세팅 |
| | | this.setIssueHostingField(issue, issueVo); //HOSTING 정보 세팅 |
| | | this.setParentIssue(issue,issueVo); //상위 이슈 정보 세팅 |
| | | |
| | | // 이슈 수정 권한을 갖고 있는지 확인 |
| | | if (this.checkHasPermission(issueVo, issueVo.getUserVos(), user, issueVo.getDepartmentVos())) { |
| | | issueVo.setModifyPermissionCheck(Boolean.TRUE); |
| | | } |
| | | } |
| | | |
| | | // 상위일감 정보 추가 |
| | |
| | | this.setRegister(relationIssue, relIssueVo); // 등록자 |
| | | this.setIssueDepartment(relationIssue, relIssueVo); // 담당부서 정보 셋팅 |
| | | this.setIssueCustomFields(relationIssue, relIssueVo); // 사용자정의필드 정보 세팅 |
| | | |
| | | Set<IssueCompany> issueCompanies = relationIssue.getIssueCompanies(); |
| | | Iterator<IssueCompany> itrCompany = issueCompanies.iterator(); |
| | | while (itrCompany.hasNext()) { |
| | | issueRelationVo.addIssueCompanyVo(ConvertUtil.copyProperties(itrCompany.next(), IssueCompanyVo.class)); |
| | | } |
| | | |
| | | Set<IssueIsp> issueIsps = relationIssue.getIssueIspFields(); |
| | | Iterator<IssueIsp> itrIsp = issueIsps.iterator(); |
| | | while (itrIsp.hasNext()) { |
| | | issueRelationVo.addIssueIspVo(ConvertUtil.copyProperties(itrIsp.next(), IssueIspVo.class)); |
| | | } |
| | | |
| | | Set<IssueHosting> issueHostings = relationIssue.getIssueHostingFields(); |
| | | Iterator<IssueHosting> itrHosting = issueHostings.iterator(); |
| | | while (itrHosting.hasNext()) { |
| | | issueRelationVo.addIssueHostingVo(ConvertUtil.copyProperties(itrHosting.next(), IssueHostingVo.class)); |
| | | } |
| | | |
| | | issueVo.addIssueRelationVo(issueRelationVo); |
| | | } |
| | | } else { |
| | |
| | | issueCustomFieldValueCondition.setUseValue(concatUseValue); |
| | | issueCustomFieldValueCondition.setUseValues(userValues); |
| | | issueCustomFieldValueCondition.setIssueTypeId(issueApiform.getIssueTypeId()); |
| | | issueCustomFieldValueCondition.setIssueStatusType("CLOSE"); |
| | | List<Map<String, Object>> results = this.issueMapper.findByCustomFieldValue(issueCustomFieldValueCondition); |
| | | if (results != null && results.size() > 0) { |
| | | for (Map<String, Object> result : results) { |
| | |
| | | this.checkNotHaveIssueIdAttachedFile(issue, issueForm); |
| | | // 사용자 정의 필드 저장 |
| | | this.issueCustomFieldValueService.modifyIssueCustomFieldValue(issue, issueForm.getIssueCustomFields()); |
| | | // 이슈 이력 등록 |
| | | if (!StringUtils.isEmpty(detectIssueChange.toString())) { |
| | | this.issueHistoryService.addIssueHistory(issue, user, IssueHistoryType.MODIFY, detectIssueChange.toString()); |
| | | } |
| | | // 사용자 시스템 기능 사용 정보 수집 |
| | | UserVo userVo = ConvertUtil.copyProperties(user, UserVo.class); |
| | | log.info(ElasticSearchUtil.makeUserActiveHistoryMessage(userVo, ElasticSearchConstants.ISSUE_MODIFY)); |
| | | |
| | | // 업체 정보 저장 |
| | | this.issueCompanyService.modifyIssueCompanyField(issue, issueForm); |
| | | this.issueCompanyService.modifyIssueCompanyField(issue, issueForm, detectIssueChange); |
| | | // ISP 정보 저장 |
| | | this.issueIspService.modifyIssueIspField(issue, issueForm); |
| | | this.issueIspService.modifyIssueIspField(issue, issueForm, detectIssueChange); |
| | | // HOSTING 정보 저장 |
| | | this.issueHostingService.modifyIssueHostingField(issue, issueForm); |
| | | this.issueHostingService.modifyIssueHostingField(issue, issueForm, detectIssueChange); |
| | | |
| | | // 이슈 이력 등록 |
| | | if (!StringUtils.isEmpty(detectIssueChange.toString())) { |
| | | this.issueHistoryService.addIssueHistory(issue, user, IssueHistoryType.MODIFY, detectIssueChange.toString()); |
| | | } |
| | | |
| | | return issue; |
| | | } |
| | |
| | | CompanyField companyField = issueCompany.getCompanyField(); |
| | | if (companyField != null) { |
| | | issueCompanyVo.setCompanyId(issueCompany.getCompanyField().getId()); |
| | | if (issueCompany.getCompanyTypeId() != null) { |
| | | if (issueCompany.getCompanyTypeId() != null && issueCompany.getCompanyTypeId() != -1) { |
| | | CompanyFieldCategory companyType = this.companyFieldCategoryService.find(issueCompany.getCompanyTypeId()); |
| | | issueCompanyVo.setCompanyTypeName(companyType.getUseValue()); |
| | | } |
| | | if (issueCompany.getParentSectorId() != null) { |
| | | if (issueCompany.getParentSectorId() != null && issueCompany.getParentSectorId() != -1) { |
| | | CompanyFieldCategory parentSector = this.companyFieldCategoryService.find(issueCompany.getParentSectorId()); |
| | | issueCompanyVo.setParentSectorName(parentSector.getUseValue()); |
| | | } |
| | | if (issueCompany.getChildSectorId() != null) { |
| | | if (issueCompany.getChildSectorId() != null && issueCompany.getChildSectorId() != -1) { |
| | | CompanyFieldCategory childSector = this.companyFieldCategoryService.find(issueCompany.getChildSectorId()); |
| | | issueCompanyVo.setChildSectorName(childSector.getUseValue()); |
| | | } |
| | | if (issueCompany.getRegionId() != null) { |
| | | if (issueCompany.getRegionId() != null && issueCompany.getRegionId() != -1) { |
| | | CompanyFieldCategory region = this.companyFieldCategoryService.find(issueCompany.getRegionId()); |
| | | issueCompanyVo.setRegionName(region.getUseValue()); |
| | | } |
| | | if (issueCompany.getStatusId() != null) { |
| | | if (issueCompany.getStatusId() != null && issueCompany.getStatusId() != -1) { |
| | | CompanyFieldCategory status = this.companyFieldCategoryService.find(issueCompany.getStatusId()); |
| | | issueCompanyVo.setStatusName(status.getUseValue()); |
| | | } |
| | |
| | | case EMAIL: |
| | | case SITE: |
| | | case TEL: |
| | | if (cellValue.length() > 100) { |
| | | if (customField.getCustomFieldType() != INPUT && cellValue.length() > 100) { |
| | | throw new OwlRuntimeException( |
| | | this.messageAccessor.getMessage(MsgConstants.CUSTOM_FIELD_TEXT_TYPE_MAX_LENGTH_OUT)); |
| | | } |
| | |
| | | if (emailCommonForm.getSendEmails().size() < 1) { |
| | | throw new OwlRuntimeException( |
| | | this.messageAccessor.getMessage(MsgConstants.ISSUE_NOT_SEND_USER)); |
| | | } else if (emailCommonForm.getIssueId() == null) { |
| | | throw new OwlRuntimeException( |
| | | this.messageAccessor.getMessage(MsgConstants.ISSUE_NOT_EXIST)); |
| | | } |
| | | |
| | | Issue issue = this.getIssue(emailCommonForm.getIssueId()); |
| | | Issue issue = null; |
| | | if(emailCommonForm.getIssueId() != null) { |
| | | issue = this.getIssue(emailCommonForm.getIssueId()); |
| | | } |
| | | |
| | | // 발신자 표시 |
| | | User user = this.webAppUtil.getLoginUserObject(); |
| | |
| | | } |
| | | this.systemEmailService.sendEmail(emailCommonForm.getTitle(), emailCommonForm.getDescription(), sendMails, null); |
| | | |
| | | this.issueHistoryService.detectSendIssueMail(IssueHistoryType.SEND, emailCommonForm.getSendEmails(), sb); |
| | | this.issueHistoryService.addIssueHistory(issue, IssueHistoryType.SEND, sb.toString()); |
| | | if (issue != null) { |
| | | this.issueHistoryService.detectSendIssueMail(IssueHistoryType.SEND, emailCommonForm.getSendEmails(), sb); |
| | | this.issueHistoryService.addIssueHistory(issue, IssueHistoryType.SEND, sb.toString()); |
| | | } |
| | | } |
| | | |
| | | // 예약 발생 이슈를 실행한다 |