OWL ITS + 탐지시스템(인터넷 진흥원)
이민희
2021-12-01 76819906d6fc67d59f67658df46f20b4c5526890
src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java
@@ -2615,14 +2615,55 @@
        //  사용자 시스템 기능 사용 정보 수집
        log.info(ElasticSearchUtil.makeUserActiveHistoryMessage(this.webAppUtil.getLoginUser(), ElasticSearchConstants.ISSUE_ANOTHER_USER_SEND_EMAIL));
        //this.systemEmailService.directEmail(issueForm.getSendEmails().toArray(new String[issueForm.getSendEmails().size()]), EmailType.ISSUE_SEND, issueMap, null);
        this.systemEmailService.directEmail(issueForm.getSendEmails().toArray(new String[issueForm.getSendEmails().size()]), EmailType.ISSUE_SEND, issueMap, null);
        if(issueForm.getTemplate().equals("SEND1")){
            this.systemEmailService.directEmail(issueForm.getSendEmails().toArray(new String[issueForm.getSendEmails().size()]), EmailType.ISSUE_SEND_1, issueMap, null);
        }else if(issueForm.getTemplate().equals("SEND2")){
            this.systemEmailService.directEmail(issueForm.getSendEmails().toArray(new String[issueForm.getSendEmails().size()]), EmailType.ISSUE_SEND_2, issueMap, null);
        }else if(issueForm.getTemplate().equals("SEND3")){
            this.systemEmailService.directEmail(issueForm.getSendEmails().toArray(new String[issueForm.getSendEmails().size()]), EmailType.ISSUE_SEND_3, issueMap, null);
        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);
        }
    }
    //  이슈를 템플릿에 따라 파트너 담당자에게 메일로 발송한다.
    @Override
    @Transactional(readOnly = true)
    public void sendIssueEmailPartners(IssueForm issueForm) {
        if (issueForm.getSendEmails().size() < 1) {
            throw new OwlRuntimeException(
                    this.messageAccessor.getMessage(MsgConstants.ISSUE_NOT_SEND_USER));
        }else if (issueForm.getTemplate() == null){
            throw new OwlRuntimeException(
                    this.messageAccessor.getMessage(MsgConstants.ISSUE_NOT_SELECT_TEMPLATE));
        }
        Issue issue = this.getIssue(issueForm.getId());
        Map<String, Object> issueMap = new HashMap<>();
        //  이슈 정보를 이메일 전송에 사용하기 위해 Map 형태로 변환한다.
        this.makeIssueMapToIssue(issue, issueMap);
        //  발신자 표시
        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));
        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);
        }
    }
@@ -2829,73 +2870,4 @@
            resJsonData.put(Constants.RES_KEY_CONTENTS, usePartnerVos);
        }
    }
    /*@Override
    @Transactional
    public void findMailTargetAll(Map<String, Object> resJsonData, IssueCondition condition, Pageable pageable) {
        IssueVo issueVo = new IssueVo();
        //Long issueId = MapUtil.getLong(params, "issueId");
        Long issueId = condition.getId();
        List<String> emailList = Lists.newArrayList();
        if(issueId != null){
            Issue issue = this.getIssue(issueId);
            issueVo = ConvertUtil.copyProperties(issue, IssueVo.class);
            this.setIssueCompanyField(issue, issueVo);  //업체 정보 세팅
            this.setIssueIspField(issue, issueVo);  //ISP 정보 세팅
            this.setIssueHostingField(issue, issueVo);  //HOSTING 정보 세팅
            for(IssueCompanyVo issueCompanyVo : issueVo.getIssueCompanyVos()) {
                emailList.add(issueCompanyVo.getEmail());
            }
            for(IssueIspVo issueIspVo : issueVo.getIssueIspVos()) {
                emailList.add(issueIspVo.getEmail());
            }
            for(IssueHostingVo issueHostingVo : issueVo.getIssueHostingVos()) {
                emailList.add(issueHostingVo.getEmail());
            }
        }
        Long totalCount = this.issueMapper.count(condition);
        int totalPage = (int) Math.ceil((totalCount - 1) / pageable.getPageSize()) + 1;
        condition.setPage(pageable.getPageNumber() * pageable.getPageSize());
        condition.setPageSize(pageable.getPageSize());
        //resJsonData.put(Constants.RES_KEY_CONTENTS, emailList);
        resJsonData.put(Constants.RES_KEY_CONTENTS, emailList);
        resJsonData.put(Constants.REQ_KEY_PAGE_VO, new ResPage(pageable.getPageNumber(), pageable.getPageSize(),
                totalPage, totalCount));
    }*/
    /*@Override
    @Transactional
    public void findMailTargetCompany(Map<String, Object> resJsonData, Map<String, Object> params) {
        IssueVo issueVo = new IssueVo();
        Long issueId = MapUtil.getLong(params, "issueId");
        List<String> emailList = Lists.newArrayList();
        if(issueId != null){
            Issue issue = this.getIssue(issueId);
            issueVo = ConvertUtil.copyProperties(issue, IssueVo.class);
            this.setIssueCompanyField(issue, issueVo);  //업체 정보 세팅
            for(IssueCompanyVo issueCompanyVo : issueVo.getIssueCompanyVos()) {
                emailList.add(issueCompanyVo.getEmail());
            }
        }
        resJsonData.put(Constants.RES_KEY_CONTENTS, emailList);
    }
    @Override
    @Transactional
    public void findMailTargetIsp(Map<String, Object> resJsonData, Map<String, Object> params) {
    }
    @Override
    @Transactional
    public void findMailTargetHosting(Map<String, Object> resJsonData, Map<String, Object> params) {
    }*/
}