/**
* 根据模板id获取文件发送内容
*@param tplId
*/
private String getContentsTpl(Integer tplId,String contents){
EmailTemplate emailTpl = emailTplDao.selectById(tplId);
String textContent="<h4 style=\"font-size: 16px; margin: 10px 0;\">hi,${userName},<br> 您有${taskName}未审批! 请确认。</h4>";
Properties pro=new Properties();
pro.setProperty("userName","yanli.zhang");
pro.setProperty("taskName","task1");
String contents= PlaceholderUtil.resolvePlaceholders(textContent,pro);
return contents;
}
private String generateMessage(String template, Map<String, String> args) {
Set<Map.Entry<String, String>> entrySet = args.entrySet();
for (Map.Entry<String, String> entry : entrySet) {
String placeholder = new StringBuilder("{").append(entry.getKey()).append("}").toString();
template = template.replace(placeholder, StringUtils.nvl(entry.getValue()));
}
return template;
}