From 2a4399780b2e146331fbdf0c931fc67dee5e844f Mon Sep 17 00:00:00 2001 From: wyu <kknd09321@nate.com> Date: 일, 12 12월 2021 10:41:42 +0900 Subject: [PATCH] 이메일 템플릿 수정[DB 초기화 필요] --- src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java | 68 +++++++++++++--------------------- 1 files changed, 26 insertions(+), 42 deletions(-) diff --git a/src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java b/src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java index dafd80e..142f491 100644 --- a/src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java +++ b/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)); } // �봽濡쒖젥�듃 �엯�젰 @@ -788,10 +781,10 @@ // Map �뿉 �엳�뒗 �뜲�씠�꽣瑜� IssueVo �뜲�씠�꽣濡� 蹂��솚�븳�떎. this.setMapToIssueVo(results, issueVos, issueCondition, user); - if (issueCondition.getTree()) { +// if (issueCondition.getTree()) { this.setDownIssues(issueVos); this.setRelationIssues(issueVos); - } +// } this.setCountDownIssues(results, issueVos); this.SetWorkflowDepartment(issueVos); //�썙�겕�뵆濡쒖슦�뿉 �꽕�젙�븳 �떞�떦遺��꽌 媛��졇�삤湲� @@ -3262,45 +3255,36 @@ // �씠�뒋瑜� �뀥�뵆由우뿉 �뵲�씪 �뙆�듃�꼫 �떞�떦�옄�뿉寃� 硫붿씪濡� 諛쒖넚�븳�떎. @Override @Transactional(readOnly = true) - public void sendIssueEmailPartners(IssueForm issueForm) { - if (issueForm.getSendEmails().size() < 1) { + public void sendIssueEmailPartners(EmailTemplateForm emailTemplateForm) { + if (emailTemplateForm.getSendEmails().size() < 1) { throw new OwlRuntimeException( this.messageAccessor.getMessage(MsgConstants.ISSUE_NOT_SEND_USER)); - }else if (issueForm.getTemplate() == null){ + }else if (emailTemplateForm.getTemplate() == null){ throw new OwlRuntimeException( this.messageAccessor.getMessage(MsgConstants.ISSUE_NOT_SELECT_TEMPLATE)); + } else if (emailTemplateForm.getIssueId() == null) { + throw new OwlRuntimeException( + this.messageAccessor.getMessage(MsgConstants.ISSUE_NOT_EXIST)); } - Issue issue = this.getIssue(issueForm.getId()); + Issue issue = this.getIssue(emailTemplateForm.getIssueId()); - Map<String, Object> issueMap = new HashMap<>(); - // �씠�뒋 �젙蹂대�� �씠硫붿씪 �쟾�넚�뿉 �궗�슜�븯湲� �쐞�빐 Map �삎�깭濡� 蹂��솚�븳�떎. - this.makeIssueMapToIssue(issue, issueMap); // 諛쒖떊�옄 �몴�떆 + User user = this.webAppUtil.getLoginUserObject(); UserVo toUser = this.webAppUtil.getLoginUser(); - issueMap.put("toUser", toUser.getName() + "(" + CommonUtil.decryptAES128(toUser.getAccount()) + ")"); - - // �씠�뒋 留곹겕 - String projectKey = issue.getProject().getProjectKey(); - Long IssueNumber = issue.getIssueNumber(); - String link = this.configuration.getEmailSendUrl() + "/#/issues/issueList?projectKey=" + projectKey + "&issueNumber=" + IssueNumber.toString(); - - issueMap.put("issueLink", link); - issueMap.put("projectLink", link); // �궗�슜�옄 �떆�뒪�뀥 湲곕뒫 �궗�슜 �젙蹂� �닔吏� log.info(ElasticSearchUtil.makeUserActiveHistoryMessage(this.webAppUtil.getLoginUser(), ElasticSearchConstants.ISSUE_ANOTHER_USER_SEND_EMAIL)); StringBuilder sb = new StringBuilder(); - if(issueForm.getTemplate().equals(EmailType.ISSUE_SEND_1.toString())){ - this.systemEmailService.directEmail(ConvertUtil.ToArray(issueForm.getSendEmails()), EmailType.ISSUE_SEND_1, issueMap, null); - }else if(issueForm.getTemplate().equals(EmailType.ISSUE_SEND_2.toString())){ - this.systemEmailService.directEmail(ConvertUtil.ToArray(issueForm.getSendEmails()), EmailType.ISSUE_SEND_2, issueMap, null); - }else if(issueForm.getTemplate().equals(EmailType.ISSUE_SEND_3.toString())){ - this.systemEmailService.directEmail(ConvertUtil.ToArray(issueForm.getSendEmails()), EmailType.ISSUE_SEND_3, issueMap, null); + Locale locale = CommonUtil.getUserLanguage(user.getLanguage()); + String[] sendMails = ConvertUtil.ToArray(emailTemplateForm.getSendEmails()); + for(int i=0; i < sendMails.length; i++) { + sendMails[i] = CommonUtil.decryptAES128(sendMails[i]); } - //硫붿씪 �쟾�넚 �씠�젰 �궓湲곌린 - this.issueHistoryService.detectSendIssueMail(IssueHistoryType.SEND, issueForm, sb); + this.systemEmailService.sendEmail(emailTemplateForm.getTitle(), emailTemplateForm.getTemplate(), sendMails, null); + + this.issueHistoryService.detectSendIssueMail(IssueHistoryType.SEND, emailTemplateForm.getSendEmails(), sb); this.issueHistoryService.addIssueHistory(issue, IssueHistoryType.SEND, sb.toString()); } -- Gitblit v1.8.0