|
@@ -2,6 +2,7 @@ package com.szwl.util;
|
|
|
|
|
|
import com.szwl.model.utils.MailUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
|
|
|
@Slf4j
|
|
|
public class WechatSendUtil {
|
|
@@ -102,6 +103,9 @@ public class WechatSendUtil {
|
|
|
*/
|
|
|
public static void sentEmail(String email, String name, String zoneID, String machineType, Integer eqeStatus) {
|
|
|
String machineTypeStr = "";
|
|
|
+ if (StringUtils.isEmpty(zoneID)) {
|
|
|
+ zoneID = "Asia/Shanghai";
|
|
|
+ }
|
|
|
switch (machineType) {
|
|
|
case "0":
|
|
|
machineTypeStr = "Cotton Candy"; // 棉花糖
|
|
@@ -116,24 +120,28 @@ public class WechatSendUtil {
|
|
|
machineTypeStr = "";
|
|
|
}
|
|
|
String eqeStatusStr = "";
|
|
|
+ String eqeStatusContent = "";
|
|
|
if (eqeStatus == 0) {
|
|
|
- eqeStatusStr = "Offline";
|
|
|
+ eqeStatusStr = "Machine offline";
|
|
|
+ eqeStatusContent = "Your machine is offline.";
|
|
|
} else {
|
|
|
- eqeStatusStr = "Online";
|
|
|
+ eqeStatusStr = "Machine online";
|
|
|
+ eqeStatusContent = "Your machine is online!";
|
|
|
}
|
|
|
+
|
|
|
String subject = eqeStatusStr + " message from " + machineTypeStr + " Machine";
|
|
|
- StringBuffer content = new StringBuffer();
|
|
|
+ StringBuilder content = new StringBuilder();
|
|
|
String str1 = " <b>Machine name: </b>";
|
|
|
String str3 = "<br>" + " <b>Time&Date: </b>";
|
|
|
- String timeByZoneID = TimezoneFmtUtil.getTimeByZoneID(zoneID);
|
|
|
+ String timeByZoneId = TimezoneFmtUtil.getTimeByZoneID(zoneID);
|
|
|
String str4 = "<br>" + "<br>" + "Dear customer:<br>";
|
|
|
- String str5 = " This email is just a reminder, you don't need to reply. <br>";
|
|
|
+ String str5 = eqeStatusContent + " This email is just a reminder, you don't need to reply. <br>";
|
|
|
String str6 = "<br>" + " Thank you for choosing our machine!<br>" +
|
|
|
"<br>" +
|
|
|
"<br>" +
|
|
|
"Best Regards.<br>" +
|
|
|
"<b>Cotton Candy Service Team</b>";
|
|
|
- content.append(str1).append(name).append(str3).append(timeByZoneID).append(str4).append(str5).append(str6);
|
|
|
+ content.append(str1).append(name).append(str3).append(timeByZoneId).append(str4).append(str5).append(str6);
|
|
|
MailUtil mailUtil = new MailUtil();
|
|
|
mailUtil.send(email, subject, content.toString());
|
|
|
System.out.println("邮件发送成功");
|