浏览代码

2019-07-29
增加数量的判断,若没有数据则不发送邮件

zxl 6 年之前
父节点
当前提交
e3d7c9e6ad
共有 1 个文件被更改,包括 19 次插入12 次删除
  1. 19 12
      src/main/java/com/uas/eis/serviceImpl/SendSaleForecastmailServiceImpl.java

+ 19 - 12
src/main/java/com/uas/eis/serviceImpl/SendSaleForecastmailServiceImpl.java

@@ -40,13 +40,16 @@ public class SendSaleForecastmailServiceImpl implements SendSaleForecastmailServ
             }
             message = new StringBuilder();
             SqlRowList contrs = baseDao.queryForRowSet("select * from FINISHSALEFORECAST_VIEW where sd_qty<>0 and (CU_SELLERNAME = '"+emrs.getString("name")+"' or CU_SERVICENAME = '"+emrs.getString("name")+"')");
-            message.append("<p><font color=\"red\"><b>"+emrs.getString("name")+":</b></font></p><p><font color=\"red\">您好!</font></p><p><font color=\"red\">您有如下客户的销售预测在上周结案,请及时跟进,谢谢!</font></p><table border=\"1\" cellspacing=\"0\" style=\"font-size:12px;width:100%\"><tr><th width=\"150px\">预测单号</th><th>行号</th><th width=\"500px\">客户名称</th><th width=\"100px\">物料编号</th><th>型号二</th><th>数量</th></tr>");
-            while (contrs.next()){
-                message.append("<tr><th>"+contrs.getString("sf_code")+"</th><th>"+contrs.getInt("sd_detno")+"</th><th>"+contrs.getString("sf_custname")+"</th><th>"+contrs.getString("sd_prodcode")+"</th><th align=\"right\">"+contrs.getString("pr_vendprodcode")+"</th><th>"+contrs.getString("sd_qty")+"</th></tr>");
-            }
-            message.append("</table><p><font color=\"red\">如有疑问请联系系统维护人员,谢谢!</font></p><p><font color=\"red\">日期:"+ DateUtil.format(new Date(),"yyyy-MM-dd")+"</font></p>");
+            if(contrs.size()>0){
+                message.append("<p><font color=\"red\"><b>"+emrs.getString("name")+":</b></font></p><p><font color=\"red\">您好!</font></p><p><font color=\"red\">您有如下客户的销售预测在上周结案,请及时跟进,谢谢!</font></p><table border=\"1\" cellspacing=\"0\" style=\"font-size:12px;width:100%\"><tr><th width=\"150px\">预测单号</th><th>行号</th><th width=\"500px\">客户名称</th><th width=\"100px\">物料编号</th><th>型号二</th><th>数量</th></tr>");
+                while (contrs.next()){
+                    message.append("<tr><th>"+contrs.getString("sf_code")+"</th><th>"+contrs.getInt("sd_detno")+"</th><th>"+contrs.getString("sf_custname")+"</th><th>"+contrs.getString("sd_prodcode")+"</th><th align=\"right\">"+contrs.getString("pr_vendprodcode")+"</th><th>"+contrs.getString("sd_qty")+"</th></tr>");
+                }
+                message.append("</table><p><font color=\"red\">如有疑问请联系系统维护人员,谢谢!</font></p><p><font color=\"red\">日期:"+ DateUtil.format(new Date(),"yyyy-MM-dd")+"</font></p>");
 //			sendMailService.sendSysMail("上周结案销售预测提醒("+emrs.getString("name")+")",message.toString(),emrs.getString("mail"),ccman.toString(),null);
-            sendMailService.sendSysMail("上周结案销售预测提醒("+emrs.getString("name")+")",message.toString(),"396996717@qq.com","xiaolu.ding@hi-mantech.com;727300463@qq.com",null);
+                sendMailService.sendSysMail("上周结案销售预测提醒("+emrs.getString("name")+")",message.toString(),emrs.getString("mail"),"xiaolu.ding@hi-mantech.com;727300463@qq.com",null);
+            }
+
 //			System.out.println(emrs.getString("mail"));
 //            System.out.println(ccman.toString());
 //			System.out.println(message);
@@ -74,13 +77,17 @@ public class SendSaleForecastmailServiceImpl implements SendSaleForecastmailServ
             }
             message = new StringBuilder();
             SqlRowList contrs = baseDao.queryForRowSet("select * from FINISHSALEFORECAST_VIEW where sd_qty<>0 and (CU_SELLERNAME = '"+emrs.getString("name")+"' or CU_SERVICENAME = '"+emrs.getString("name")+"')");
-            message.append("<p><font color=\"red\"><b>"+emrs.getString("name")+":</b></font></p><p><font color=\"red\">您好!</font></p><p><font color=\"red\">您有如下客户的销售预测在上周结案,请及时跟进,谢谢!</font></p><table border=\"1\" cellspacing=\"0\" style=\"font-size:12px;width:100%\"><tr><th width=\"150px\">预测单号</th><th>行号</th><th width=\"500px\">客户名称</th><th width=\"100px\">物料编号</th><th>型号二</th><th>数量</th></tr>");
-            while (contrs.next()){
-                message.append("<tr><th>"+contrs.getString("sf_code")+"</th><th>"+contrs.getInt("sd_detno")+"</th><th>"+contrs.getString("sf_custname")+"</th><th>"+contrs.getString("sd_prodcode")+"</th><th align=\"right\">"+contrs.getString("pr_vendprodcode")+"</th><th>"+contrs.getString("sd_qty")+"</th></tr>");
+            if(contrs.size()>0){
+                message.append("<p><font color=\"red\"><b>"+emrs.getString("name")+":</b></font></p><p><font color=\"red\">您好!</font></p><p><font color=\"red\">您有如下客户的销售预测在上周结案,请及时跟进,谢谢!</font></p><table border=\"1\" cellspacing=\"0\" style=\"font-size:12px;width:100%\"><tr><th width=\"150px\">预测单号</th><th>行号</th><th width=\"500px\">客户名称</th><th width=\"100px\">物料编号</th><th>型号二</th><th>数量</th></tr>");
+                while (contrs.next()){
+                    message.append("<tr><th>"+contrs.getString("sf_code")+"</th><th>"+contrs.getInt("sd_detno")+"</th><th>"+contrs.getString("sf_custname")+"</th><th>"+contrs.getString("sd_prodcode")+"</th><th align=\"right\">"+contrs.getString("pr_vendprodcode")+"</th><th>"+contrs.getString("sd_qty")+"</th></tr>");
+                }
+                message.append("</table><p><font color=\"red\">如有疑问请联系系统维护人员,谢谢!</font></p><p><font color=\"red\">日期:"+ DateUtil.format(new Date(),"yyyy-MM-dd")+"</font></p>");
+//              sendMailService.sendSysMail("上周结案销售预测提醒("+emrs.getString("name")+")",message.toString(),emrs.getString("mail"),ccman.toString(),null);
+                sendMailService.sendSysMail("上周结案销售预测提醒("+emrs.getString("name")+")",message.toString(),emrs.getString("mail"),"xiaolu.ding@hi-mantech.com;727300463@qq.com",null);
             }
-            message.append("</table><p><font color=\"red\">如有疑问请联系系统维护人员,谢谢!</font></p><p><font color=\"red\">日期:"+ DateUtil.format(new Date(),"yyyy-MM-dd")+"</font></p>");
-//			sendMailService.sendSysMail("上周结案销售预测提醒("+emrs.getString("name")+")",message.toString(),emrs.getString("mail"),ccman.toString(),null);
-            sendMailService.sendSysMail("上周结案销售预测提醒("+emrs.getString("name")+")",message.toString(),"396996717@qq.com","xiaolu.ding@hi-mantech.com;727300463@qq.com",null);
+
+
 //			System.out.println(emrs.getString("mail"));
 //            System.out.println(ccman.toString());
 //			System.out.println(message);