Browse Source

:sparkles: 根据设备类型调整邮件

Ritchie 11 months ago
parent
commit
5dda6d5bc1
1 changed files with 24 additions and 18 deletions
  1. 24 18
      src/main/java/com/szwl/controller/AlarmRecordIndexController.java

+ 24 - 18
src/main/java/com/szwl/controller/AlarmRecordIndexController.java

@@ -5,10 +5,10 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.szwl.model.dto.AlarmRecordVo;
 import com.szwl.model.entity.*;
-import com.szwl.model.utils.MailUtil;
 import com.szwl.model.utils.YunPianSms;
 import com.szwl.service.*;
 import com.szwl.util.TimezoneFmtUtil;
+import com.szwl.util.WechatSendUtil;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
@@ -153,30 +153,36 @@ public class AlarmRecordIndexController {
             }
         }
         if (ifForeign.equals("1")) {
-            String subject = "Error message from Cotton Candy Machine";
-            StringBuilder content = new StringBuilder();
-            String str1 = " <b>Machine name: </b>";
-            String str2 = "<br>" + " <b>Error message: </b>";
-            String str3 = "<br>" + " Time&Date: ";
-            String str4 = "<br>" + "<br>" + "Dear customer:<br>";
-            String str5 = " This is an automatic-sent mail to inform you that there is an error occurred on one of your Cotton Candy machines, please kindly check the details as above.<br>";
-            String str6 = " <br>You don't have to reply this mail. What you need to do is to follow the instructions on the touch screen to clear the error and recover the machine. If there is any question or more information you need. Please do not be hesitated to contact your distributor.<br>" +
-                    "<br>" +
-                    " Thank you for choosing our machine!<br>" +
-                    "<br>" +
-                    "<br>" +
-                    "Best Regards.<br>" +
-                    "Cotton Candy Service Team";
-            content.append(str1).append(name).append(str2).append(alarmContent).append(str3).append(localTime).append(str4).append(str5).append(str6);
+            String machineType = equipment.getMachineType();
+            if (StringUtils.isNotEmpty(machineType)) {
+                machineType = "0";
+            }
+//            String subject = "Error message from Cotton Candy Machine";
+//            StringBuilder content = new StringBuilder();
+//            String str1 = " <b>Machine name: </b>";
+//            String str2 = "<br>" + " <b>Error message: </b>";
+//            String str3 = "<br>" + " Time&Date: ";
+//            String str4 = "<br>" + "<br>" + "Dear customer:<br>";
+//            String str5 = " This is an automatic-sent mail to inform you that there is an error occurred on one of your Cotton Candy machines, please kindly check the details as above.<br>";
+//            String str6 = " <br>You don't have to reply this mail. What you need to do is to follow the instructions on the touch screen to clear the error and recover the machine. If there is any question or more information you need. Please do not be hesitated to contact your distributor.<br>" +
+//                    "<br>" +
+//                    " Thank you for choosing our machine!<br>" +
+//                    "<br>" +
+//                    "<br>" +
+//                    "Best Regards.<br>" +
+//                    "Cotton Candy Service Team";
+//            content.append(str1).append(name).append(str2).append(alarmContent).append(str3).append(localTime).append(str4).append(str5).append(str6);
             if (StringUtils.isNotEmpty(messageReceiver)) {
                 String[] split = messageReceiver.split(",");
                 for (String s : split) {
-                    new MailUtil().send(s, subject, content.toString());
+//                    new MailUtil().send(s, subject, content.toString());
+                    WechatSendUtil.sentEmail(s, name, timeZone, machineType);
                 }
                 return "报警记录添加成功";
             } else {
                 if (email != null) {
-                    new MailUtil().send(email, subject, content.toString());
+//                    new MailUtil().send(email, subject, content.toString());
+                    WechatSendUtil.sentEmail(admin.getEmail(), name, timeZone, machineType);
                     return "报警记录添加成功";
                 } else {
                     return "email is null";