Bläddra i källkod

Merge remote-tracking branch 'origin/test' into test

soobin 11 månader sedan
förälder
incheckning
b6214ffb4d

+ 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";

+ 2 - 5
src/main/java/com/szwl/service/impl/TLocationCheckServiceImpl.java

@@ -49,13 +49,12 @@ public class TLocationCheckServiceImpl extends ServiceImpl<TLocationCheckMapper,
 
         boolean containsUserInput = isAddressInCountryList(addr, country);
 
-        String phone = "18620242721";
-//        String phone1 = "13631231970"; // 基哥
+        String phone1 = "13631231970"; // 基哥
         String phone2 = "15018460394"; // 龙
 
         String messages = "【申泽部门】设备编号:" + clientId + ",所在ip与设定位置不符,请及时查看。";
         if (!containsUserInput) { // 不包含,发短信通知,并拒绝审核
-            YunPianSms.sendSms(appid, messages, phone);
+            YunPianSms.sendSms(appid, messages, phone1);
             YunPianSms.sendSms(appid, messages, phone2);
             return "fail";
         }
@@ -96,11 +95,9 @@ public class TLocationCheckServiceImpl extends ServiceImpl<TLocationCheckMapper,
 
     @Override
     public void schSendMsg(String locErrorEq) throws IOException {
-        String phone = "18620242721";
 //        String phone1 = "13631231970"; // 基哥
         String phone2 = "15018460394"; // 龙
         String messages = "【申泽部门】设备编号:" + locErrorEq + ",所在ip与设定位置不符,请及时查看。";
-        YunPianSms.sendSms(appid, messages, phone);
 //        YunPianSms.sendSms(appid, messages, phone1);
         YunPianSms.sendSms(appid, messages, phone2);
     }

+ 12 - 0
src/test/java/com/szwl/util/WechatSendUtilTest.java

@@ -0,0 +1,12 @@
+package com.szwl.util;
+
+
+class WechatSendUtilTest {
+    public static void main(String[] args) {
+        String email = "wangzeyu@tom.com";
+        String name = "设备名字";
+        String zoneID = "Asia/Shanghai";
+        String machineType = "2";
+        WechatSendUtil.sentEmail(email, name, zoneID, machineType);
+    }
+}