private String mailBottom(String to, String type, String lang) { String content = "<br><br><br>"; content = content + "</td></tr>"; content = content + "<tr>"; content = content + "<td colspan=2 style='border-bottom:#999999 0px solid;color:#333333;padding:2px 2px 0px 2px;word-wrap:break-word; word-break:break-all;'>"; content = content + "<table width=100% align=center cellpadding=2 cellspacing=2 style='border-top:cef9d1 1px solid;border-left:cef9d1 1px solid;border-right:cef9d1 1px solid;border-bottom:cef9d1 1px solid;background-color:#edf9e0' border=0>"; content = content + "<tr>"; content = content + "<td>"; String template = ""; if (!StringUtils.equals(type, "email.essential") && !StringUtils.equals(type, "email.share_to")) { // content = content + " 这封邮件是发送给<a href=mailto:" + to + ">" + to + "</a>的,<br>" // + " 如果您不想再接收到此种类型的邮件,请点击<a href=http://" + serverHost + // "/preferences/subscribe?user="******"&type=" + type + "&value=1 // target=_blank>退订</a>。<br>"; template = I18nUtils.getBundleStringByLang(lang, "asyncsendmail.mailbottom.subscribe"); String subscribe = SQLTemplate.merge( template, new Object[][] { {"to", to}, {"serverHost", serverHost}, {"type", type} }); content += subscribe; } else if (StringUtils.equals(type, "email.share_to")) { template = I18nUtils.getBundleStringByLang(lang, "asyncsendmail.mailbottom.shareto"); String shareTo = SQLTemplate.merge( template, new Object[][] { {"to", to}, {"serverHost", serverHost}, {"type", type} }); content += shareTo; } // content = content + " 北京播思软件技术有限公司<br>" // + " <a href=http://" + serverHost + "/search?q=com.borqs.qiupu // target=_blank>http://" + serverHost + "/search?q=com.borqs.qiupu</a>"; template = I18nUtils.getBundleStringByLang(lang, "asyncsendmail.mailbottom.bottom"); String bottom = SQLTemplate.merge(template, new Object[][] {{"serverHost", serverHost}}); content += bottom; content = content + "</td>"; content = content + "</tr>"; content = content + "</table>"; content = content + "</tr>"; content = content + "</table>"; content = content + "</body></html>"; return content; }
public static SQLTemplate compile(String s) { Validate.notNull(s); try { SQLTemplate st = new SQLTemplate(); st.template = new Template("", new StringReader(s), CONF, Charsets.DEFAULT); return st; } catch (IOException e) { throw new ServerException(BaseErrors.PLATFORM_SQL_TEMPLATE_ERROR, e); } }
public static String merge(String s, Map<String, Object> data) { // System.out.println("-------" + s); SQLTemplate st = get(s); return st.merge(data); }