| | |
| | | import kr.wisestone.owl.constant.Constants; |
| | | import kr.wisestone.owl.constant.ElasticSearchConstants; |
| | | import kr.wisestone.owl.constant.MsgConstants; |
| | | import kr.wisestone.owl.data.CheckIssueData; |
| | | import kr.wisestone.owl.domain.*; |
| | | import kr.wisestone.owl.domain.enumType.CustomFieldType; |
| | | import kr.wisestone.owl.domain.enumType.IssueHistoryType; |
| | |
| | | import kr.wisestone.owl.vo.IssueHistoryVo; |
| | | import kr.wisestone.owl.vo.IssueVo; |
| | | import kr.wisestone.owl.web.condition.IssueHistoryCondition; |
| | | import kr.wisestone.owl.web.form.EmailTemplateForm; |
| | | import kr.wisestone.owl.web.form.IssueForm; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.slf4j.Logger; |
| | |
| | | @Override |
| | | @Transactional |
| | | public void addIssueHistory(Issue issue, IssueHistoryType issueHistoryType, String issueChangeDescription) { |
| | | User user = this.webAppUtil.getLoginUserObject(); |
| | | addIssueHistory(issue, user, issueHistoryType, issueChangeDescription); |
| | | } |
| | | |
| | | // 이력 생성 |
| | | @Override |
| | | @Transactional |
| | | public void addIssueHistory(Issue issue, User user, IssueHistoryType issueHistoryType, String issueChangeDescription) { |
| | | IssueHistory issueHistory = new IssueHistory(); |
| | | issueHistory.setIssue(issue); |
| | | issueHistory.setProject(issue.getProject()); |
| | | issueHistory.setIssueHistoryType(issueHistoryType); |
| | | StringBuilder description = new StringBuilder(); |
| | | // 이력 정보를 만들어 낸다. |
| | | this.makeDescription(description, issueHistoryType, issueChangeDescription); |
| | | |
| | | this.makeDescription(user, description, issueHistoryType, issueChangeDescription); |
| | | issueHistory.setDescription(description.toString()); |
| | | |
| | | this.issueHistoryRepository.saveAndFlush(issueHistory); |
| | |
| | | // 이력 정보를 만들어 낸다. |
| | | @Override |
| | | public void makeDescription(StringBuilder description, IssueHistoryType issueHistoryType, String issueChangeDescription) { |
| | | User user = this.webAppUtil.getLoginUserObject(); |
| | | makeDescription(user, description, issueHistoryType, issueChangeDescription); |
| | | } |
| | | |
| | | // 이력 정보를 만들어 낸다. |
| | | @Override |
| | | public void makeDescription(User user, StringBuilder description, IssueHistoryType issueHistoryType, String issueChangeDescription) { |
| | | description.append("<div class=\"activity-text\">"); |
| | | |
| | | // 생성, 수정, 삭제에 대해 기록을 남긴다. |
| | |
| | | description.append("<span class='activity-timestamp'>"); |
| | | description.append(DateUtil.convertDateToStr(new Date())); |
| | | description.append(" ("); |
| | | description.append(this.webAppUtil.getLoginUser().getName()); |
| | | description.append(user.getName()); |
| | | description.append(" - "); |
| | | description.append(CommonUtil.decryptAES128(this.webAppUtil.getLoginUser().getAccount())); |
| | | description.append(CommonUtil.decryptAES128(user.getAccount())); |
| | | description.append(")"); |
| | | description.append("</span></h6>"); |
| | | break; |
| | |
| | | description.append(DateUtil.convertDateToStr(new Date())); |
| | | description.append(" ("); |
| | | |
| | | if (this.webAppUtil.getLoginUser() != null) { |
| | | description.append(this.webAppUtil.getLoginUser().getName()); |
| | | if (user != null) { |
| | | description.append(user.getName()); |
| | | description.append(" - "); |
| | | description.append(CommonUtil.decryptAES128(this.webAppUtil.getLoginUser().getAccount())); |
| | | description.append(CommonUtil.decryptAES128(user.getAccount())); |
| | | } |
| | | else { |
| | | description.append("OWL-ITS-SYSTEM"); |
| | |
| | | description.append("<span class=\"activity-timestamp\">"); |
| | | description.append(DateUtil.convertDateToStr(new Date())); |
| | | description.append(" ("); |
| | | description.append(this.webAppUtil.getLoginUser().getName()); |
| | | description.append(user.getName()); |
| | | description.append(" - "); |
| | | description.append(CommonUtil.decryptAES128(this.webAppUtil.getLoginUser().getAccount())); |
| | | description.append(CommonUtil.decryptAES128(user.getAccount())); |
| | | description.append(")"); |
| | | description.append("</span></h6>"); |
| | | break; |
| | | |
| | | case SEND: |
| | | description.append("<h6 class=\"creat\"><span class=\"dot\"></span><span translate=\"common.sendMailIssue\">이슈 메일 전송</span>"); |
| | | description.append("<span class=\"activity-timestamp\">"); |
| | | description.append(DateUtil.convertDateToStr(new Date())); |
| | | description.append(" ("); |
| | | |
| | | if (user != null) { |
| | | description.append(user.getName()); |
| | | description.append(" - "); |
| | | description.append(CommonUtil.decryptAES128(user.getAccount())); |
| | | } |
| | | else { |
| | | description.append("OWL-ITS-SYSTEM"); |
| | | description.append(" - "); |
| | | description.append(this.systemEmail); |
| | | } |
| | | |
| | | description.append(")"); |
| | | description.append("</span></h6>"); |
| | | description.append(issueChangeDescription); |
| | | break; |
| | | } |
| | | |
| | |
| | | // 이슈 아이디에 해당하는 기록 정보를 가져온다. |
| | | @Override |
| | | @Transactional(readOnly = true) |
| | | public List<IssueHistoryVo> findIssueHistory(Long issueId) { |
| | | return this.issueHistoryRepository.findByIssueId(issueId); |
| | | public List<IssueHistoryVo> findIssueHistory(Issue issue) { |
| | | List<IssueHistoryVo> issueHistoryVos = this.issueHistoryRepository.findByIssueId(issue.getId()); |
| | | if (issueHistoryVos != null && issueHistoryVos.size() > 0) { |
| | | for (IssueHistoryVo issueHistoryVo : issueHistoryVos) { |
| | | issueHistoryVo.setTitle(issue.getTitle()); |
| | | } |
| | | } |
| | | return issueHistoryVos; |
| | | } |
| | | |
| | | // 이슈 변경 내역을 추출한다. |
| | | @Override |
| | | public StringBuilder detectIssueChange(Issue issue, IssueForm issueForm, Project project, IssueStatus issueStatus, IssueType issueType, Priority priority, Severity severity, List<MultipartFile> files) { |
| | | public StringBuilder detectIssueChange(IssueForm issueForm, CheckIssueData data, List<MultipartFile> files) { |
| | | return this.detectIssueChange(data.getIssue(), issueForm, data.getProject(), data.getOldIssueStatus(), data.getNewIssueStatus(), data.getIssueType(), data.getPriority(), data.getSeverity(), files); |
| | | } |
| | | |
| | | // 이슈 변경 내역을 추출한다. |
| | | @Override |
| | | public StringBuilder detectIssueChange(Issue issue, IssueForm issueForm, Project project, IssueStatus oldIssueStatus, IssueStatus issueStatus, IssueType issueType, Priority priority, Severity severity, List<MultipartFile> files) { |
| | | StringBuilder description = new StringBuilder(); |
| | | |
| | | // 이슈 프로젝트 변경 정보를 기록한다. |
| | |
| | | // 이슈 우선순위 변경 정보를 기록한다. |
| | | this.detectIssuePriority(issue, issueForm, description, priority); |
| | | // 이슈 상태 변경 정보를 기록한다. |
| | | this.detectIssueStatus(issue, issueForm, description, issueStatus); |
| | | this.detectIssueStatus(issue, issueForm, description, oldIssueStatus, issueStatus); |
| | | // 이슈 타입 변경 정보를 기록한다. |
| | | this.detectIssueType(issue, issueForm, description, issueType); |
| | | // 이슈에 첨부된 파일에 대해 변경 정보를 기록한다. |
| | |
| | | |
| | | // 이슈 상태 변경 정보를 기록한다. |
| | | @Override |
| | | public void detectIssueStatus(Issue issue, IssueForm issueForm, StringBuilder description, IssueStatus issueStatus) { |
| | | if (!issue.getIssueStatus().getId().equals(issueForm.getIssueStatusId())) { |
| | | @Transactional |
| | | public void detectIssueStatus(Issue issue, IssueForm issueForm, StringBuilder description, IssueStatus oldIssueStatus, IssueStatus issueStatus) { |
| | | if (!oldIssueStatus.getId().equals(issueForm.getIssueStatusId())) { |
| | | String title = "<span translate=\"common.updateHasStatus\">상태가 변경되었습니다.</span>"; |
| | | // 이력 정보를 html 태그로 만들어 준다. |
| | | this.makeIssueHistoryHtml(description, title, issue.getIssueStatus().getName(), issueStatus.getName()); |
| | | this.makeIssueHistoryHtml(description, title, oldIssueStatus.getName(), issueStatus.getName()); |
| | | |
| | | // 이슈 위험 관리에 상태 변경 정보를 업데이트한다. - 담당자 변경 |
| | | this.issueRiskService.modifyIssueRisk(issue, true, false, issueForm.getIssueStatusId()); |
| | |
| | | public void recordRemoveWorkflowToIssueStatus(String oldIssueStatusName, String newIssueStatusName, StringBuilder description) { |
| | | description.append("<ul class=\"activity-list\">"); |
| | | |
| | | String title = "<span translate=\"common.upddetectReservationIssueStatusateWorkflowNotExist\">변경된 워크플로우에서 상태가 존재하지 않아 이슈의 상태가 변경되었습니다.</span>"; |
| | | String title = "<span translate=\"common.updateWorkflowNotExist\">변경된 워크플로우에서 상태가 존재하지 않아 이슈의 상태가 변경되었습니다.</span>"; |
| | | // 이력 정보를 html 태그로 만들어 준다. |
| | | this.makeIssueHistoryHtml(description, title, oldIssueStatusName, newIssueStatusName); |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | // 이슈 메일 전송 정보를 기록한다. |
| | | @Override |
| | | public void detectSendIssueMail(IssueHistoryType type, IssueForm issueForm, StringBuilder description) { |
| | | this.detectSendIssueMail(type, issueForm.getSendEmails(), description); |
| | | } |
| | | |
| | | // 이슈 메일 전송 정보를 기록한다. |
| | | @Override |
| | | public void detectSendIssueMail(IssueHistoryType type, List<String> sendMails, StringBuilder description) { |
| | | if (type == IssueHistoryType.SEND) { |
| | | description.append("<span translate=\"issue.sendIssueMailHistory\">이슈 메일 전송을 완료했습니다. </span>"); |
| | | if(sendMails != null && sendMails.size() > 0){ |
| | | for (String sendEmail : sendMails){ |
| | | description.append("<span class=\"text-primary bold\"> > " + CommonUtil.decryptAES128(sendEmail) + "</span>"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 업체 정보 변경 정보를 기록한다. |
| | | @Override |
| | | public void detectIssueCompany(IssueHistoryType type, Map<String, Object> param, IssueCompany issueCompany, StringBuilder description) { |
| | | Long id = MapUtil.getLong(param, "id"); |
| | | public void detectIssueCompany(IssueHistoryType type, Map<String, Object> param, CompanyField companyField, IssueCompany issueCompany, StringBuilder description) { |
| | | Long id = 0L; |
| | | if (param != null) { |
| | | id = MapUtil.getLong(param, "companyId"); |
| | | }else if(companyField != null) { |
| | | id = companyField.getId(); |
| | | } |
| | | Long companyFieldId = issueCompany.getCompanyField().getId(); |
| | | |
| | | if (type == IssueHistoryType.ADD) { //추가 할 경우 |
| | |
| | | |
| | | // ISP 정보 변경 정보를 기록한다. |
| | | @Override |
| | | public void detectIssueIsp(IssueHistoryType type, Map<String, Object> param, IssueIsp issueIsp, StringBuilder description) { |
| | | Long id = MapUtil.getLong(param, "id"); |
| | | public void detectIssueIsp(IssueHistoryType type, Map<String, Object> param, IspField ispField, IssueIsp issueIsp, StringBuilder description) { |
| | | Long id = 0L; |
| | | if (param != null) { |
| | | id = MapUtil.getLong(param, "companyId"); |
| | | } else if(ispField != null) { |
| | | id = ispField.getId(); |
| | | } |
| | | Long ispFieldId = issueIsp.getIspField().getId(); |
| | | |
| | | if (type == IssueHistoryType.ADD) { |
| | |
| | | |
| | | // 호스팅 정보 변경 정보를 기록한다. |
| | | @Override |
| | | public void detectIssueHosting(IssueHistoryType type, Map<String, Object> param, IssueHosting issueHosting, StringBuilder description) { |
| | | Long id = MapUtil.getLong(param, "id"); |
| | | public void detectIssueHosting(IssueHistoryType type, Map<String, Object> param, HostingField hostingField, IssueHosting issueHosting, StringBuilder description) { |
| | | Long id = 0L; |
| | | if (param != null) { |
| | | id = MapUtil.getLong(param, "companyId"); |
| | | }else if(hostingField != null) { |
| | | id = hostingField.getId(); |
| | | } |
| | | Long hostingFieldId = issueHosting.getHostingField().getId(); |
| | | |
| | | if (type == IssueHistoryType.ADD) { |
| | |
| | | if (StringUtils.isEmpty(value)) { |
| | | switch(customFieldType) { |
| | | case INPUT: |
| | | case NUMBER: |
| | | case DATETIME: |
| | | case IP_ADDRESS: |
| | | case EMAIL: |
| | | case SITE: |
| | | case TEL: |
| | | result = "<span translate=\"common.noValueEntered\">입력한 값이 없습니다.</span>"; |
| | | break; |
| | | case SINGLE_SELECT: |