@Override
public Boolean javamailButton(String picUrl) {
Vector file_Vector = new Vector(); //存放文件的集合Vector
String rootPath = this.getClass().getResource("/").getPath() + Constants.LOCAL_DIR;
// 邮件附件的图片名
String picName = Constants.HIGHCHARTS_PNG_NAME_PAY_DATA_DAILY_PAPER + holidaysService.getFileNameDate(null, null);
// 邮件附件带的EXCEL 1文件名
String excelName = Constants.BIG_STAGE_SUB_EXCEL_FILE_NAME + holidaysService.getFileNameDate(null, null);
// 邮件附件带的EXCEL 2文件名
String valueAddedName = Constants.VALUE_ADDED_EXCEL_FILE_NAME + holidaysService.getFileNameDate(null, null);
String picPath = rootPath + "/" + picName + ".png";
file_Vector.add(picPath);
file_Vector.add(rootPath + "/" + excelName + ".xlsx");
String valueAddedFile = rootPath + "/" + valueAddedName + ".xlsx";
File f = new File(valueAddedFile);
if (f.exists()) {
file_Vector.add(valueAddedFile);
}
Map<String, Object> param = new HashMap<String, Object>();
String startPaymentDate = holidaysService.getTradeDays(DateUtil.getCurrentDayAsString());//上一个交易日
String endPaymentDate = DateUtil.getLastDayStr();//昨天
param.put("startPaymentDate", startPaymentDate);
param.put("endPaymentDate", endPaymentDate);
// 查询邮件正文表单的数据
List<BigStageSub> payDataList = b2BBigStageSubManager.queryPayDataSumList(param);
String forEachTD = "";
String forEachTR = "";
int i = 1;
// 邮件表单的表单项
for (BigStageSub big : payDataList) {
forEachTR =
"<tr>" +
"<td>" +
big.getPayWay() +
"</td>" +
"<td>" +
MoneyUtil.formatMoneyReturnNull(big.getBJSums()) +
"</td>" +
"<td>" +
big.getBJNums() +
"</td>" +
"<td>" +
MoneyUtil.formatMoneyReturnNull(big.getCDSums()) +
"</td>" +
"<td>" +
big.getCDNums() +
"</td>" +
"<td>" +
MoneyUtil.formatMoneyReturnNull(big.getGZSums()) +
"</td>" +
"<td>" +
big.getGZNums() +
"</td>" +
"<td>" +
MoneyUtil.formatMoneyReturnNull(big.getHZSums()) +
"</td>" +
"<td>" +
big.getHZNums() +
"</td>" +
"<td>" +
MoneyUtil.formatMoneyReturnNull(big.getSHSums()) +
"</td>" +
"<td>" +
big.getSHNums() +
"</td>" +
"<td>" +
MoneyUtil.formatMoneyReturnNull(big.getSZSums()) +
"</td>" +
"<td>" +
big.getSZNums() +
"</td>" +
"<td>" +
MoneyUtil.formatMoneyReturnNull(big.getTJSums()) +
"</td>" +
"<td>" +
big.getTJNums() +
"</td>" +
"<td>" +
MoneyUtil.formatMoneyReturnNull(big.getWHSums()) +
"</td>" +
"<td>" +
big.getWHNums() +
"</td>" +
"<td>" +
MoneyUtil.formatMoneyReturnNull(big.getOtherSums()) +
"</td>" +
"<td>" +
big.getOtherNums() +
"</td>" +
"</tr>";
forEachTD += forEachTR;
}
// 此处是邮件正文,邮件正文里包含一个表单和一张嵌入的饼状图.png
String demo = null;
if (!"".equals(forEachTD)) {
demo =
"<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">" +
"<html>" +
"<head>" +
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">" +
"<title>B2B收付款系统自动发送邮件</title>" +
"<style type=\"text/css\">" +
".test{font-family:\"Microsoft Yahei\";font-size: 18px;color: balck;}" +
".tablelist{font-size:12px;border-top:solid 1px #222222;border-left:solid 1px #222222; width:1880px; clear:both;}" +
".tablelist th{height:20px; width:70px;line-height:20px; border-bottom:solid 1px #222222;border-right: solid 1px #222222; text-indent:5px; text-align:left;background-color: #D9E1F2;}" +
".tablelist td{line-height:20px; width:70px;text-indent:5px;border-bottom:solid 1px #222222; border-right: solid 1px #222222;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;}" +
".tablelist tbody tr.odd{background-color: #d6e8f1}" +
".tablelist tbody tr:hover{background:#e5ebee;}" +
"</style>" +
"</head>" +
"<body>" +
// 邮件问候语
"<span class=\"test\">Dear all :</span>" +
"</br>" +
"<span class=\"test\">这是" + holidaysService.getTradeDays(DateUtil.getCurrentDayAsString()) + "至" + DateUtil.getLastDayStr() + "的支付数据日报</span>" +
"</br>" +
"</br>" +
"<form action=\"Send\" method=\"post\" name=\"mail\" enctype=\"multipart/form-data\">" +
"<div class=\"table-a\" style=\"float: left\">" +
"<table class=\"tablelist\">" +
"<thead>" +
"<tr>" +
"<th style=\"text-align: center;\" colspan=\"1\"></th>" +
"<th style=\"text-align: center;border-right: 1px solid #222222\" colspan=\"2\">北京</th>" +
"<th style=\"text-align: center;border-right: 1px solid #222222\" colspan=\"2\">成都</th>" +
"<th style=\"text-align: center;border-right: 1px solid #222222\" colspan=\"2\">广州</th>" +
"<th style=\"text-align: center;border-right: 1px solid #222222\" colspan=\"2\">杭州</th>" +
"<th style=\"text-align: center;border-right: 1px solid #222222\" colspan=\"2\">上海</th>" +
"<th style=\"text-align: center;border-right: 1px solid #222222\" colspan=\"2\">深圳</th>" +
"<th style=\"text-align: center;border-right: 1px solid #222222\" colspan=\"2\">天津</th>" +
"<th style=\"text-align: center;border-right: 1px solid #222222\" colspan=\"2\">武汉</th>" +
"<th style=\"text-align: center;border-right: 1px solid #222222\" colspan=\"2\">总计</th>" +