Search in sources :

Example 1 with BizProcess

use of com.creditease.mspl.domain.BizProcess in project uavstack by uavorg.

the class CEMailAction method buildEmailEvent.

/**
 * 装载消息
 *
 * @param notifyEvent
 * @return EmailEvent
 * @throws Exception
 */
private EmailEvent buildEmailEvent(NotificationEvent notifyEvent, String title, String mailTemplatePath) throws Exception {
    List<EmailEntity> list = new ArrayList<EmailEntity>();
    EmailEntity emailEntity = new EmailEntity();
    /**
     * 如果notifyEvent中含有目的地址,则用该地址,否则使用默认地址
     */
    String address = notifyEvent.getArg(cName);
    if (StringHelper.isEmpty(address)) {
        if (log.isTraceEnable()) {
            log.warn(this, "Send Mail FAIL as no any email addresses");
        }
        return null;
    }
    emailEntity.setToAddress(address);
    String html = IOHelper.readTxtFile(mailTemplatePath, "utf-8");
    if (StringHelper.isEmpty(html)) {
        log.err(this, "Send Mail FAIL as mail template is empty");
        return null;
    }
    /**
     * 变量替换
     */
    html = buildMailBody(html, notifyEvent);
    /**
     * 主题
     */
    emailEntity.setSubject(title);
    /**
     * 正文
     */
    emailEntity.setContent(html);
    /**
     * 添加附件
     */
    list.add(emailEntity);
    /**
     * 配置信息
     */
    EmailEvent emailEvent = new EmailEvent();
    BizProcess bizProcess = new BizProcess();
    bizProcess.setDealCode("mspl_ltn_0107");
    emailEvent.setBizProcess(bizProcess);
    emailEvent.setUserList(list);
    emailEvent.setActivityId(activeID);
    emailEvent.setChannelCode("channel 001");
    emailEvent.setMailType("消息类22");
    emailEvent.setSystemSign(systemSign);
    return emailEvent;
}
Also used : EmailEvent(com.creditease.mspl.event.vo.EmailEvent) ArrayList(java.util.ArrayList) EmailEntity(com.creditease.mspl.event.vo.EmailEntity) BizProcess(com.creditease.mspl.domain.BizProcess)

Aggregations

BizProcess (com.creditease.mspl.domain.BizProcess)1 EmailEntity (com.creditease.mspl.event.vo.EmailEntity)1 EmailEvent (com.creditease.mspl.event.vo.EmailEvent)1 ArrayList (java.util.ArrayList)1