Ver Fonte

fix:“优化海外报警可以发送多个邮箱“

soobin há 1 ano atrás
pai
commit
b54658d32b

+ 30 - 22
src/main/java/com/szwl/controller/AlarmRecordIndexController.java

@@ -77,34 +77,42 @@ public class AlarmRecordIndexController {
         String email = admin.getEmail();
         String ifForeign = admin.getIfForeign();
         String companyType = admin.getCompanyType();
+        String messageReceiver = equipment.getMessageReceiver();
         if(ifForeign.equals("1")){
-            if(email!=null){
-                String subject = "Error message from Magic Candy Machine";
-                StringBuffer contnet = new StringBuffer();
-                String str1="Dear customer<br>" +
-                        "<br>" +
-                        "This is an automatic-sent mail to inform you that there is an error occurred on one of your Magic Candy machines, please kindly check the detail as below.<br>" +
-                        "<br>" +
-                        " Machine name:";
-                String str2="<br>" +" Time&Date:";
-                String str3="<br>"+" Error Message:";
-                String str4= "<br>" +" <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>" +
-                        "Magic Candy Service Team";
-                contnet.append(str1).append(name).append(str2).append(alarmRecordVo.getOccurrenceTime()).append(str3).append(alarmContent).append(str4);
-                new MailUtil().send(email,subject,contnet.toString());
+            String subject = "Error message from Magic Candy Machine";
+            StringBuffer contnet = new StringBuffer();
+            String str1="Dear customer<br>" +
+                    "<br>" +
+                    "This is an automatic-sent mail to inform you that there is an error occurred on one of your Magic Candy machines, please kindly check the detail as below.<br>" +
+                    "<br>" +
+                    " Machine name:";
+            String str2="<br>" +" Time&Date:";
+            String str3="<br>"+" Error Message:";
+            String str4= "<br>" +" <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>" +
+                    "Magic Candy Service Team";
+            contnet.append(str1).append(name).append(str2).append(alarmRecordVo.getOccurrenceTime()).append(str3).append(alarmContent).append(str4);
+            if(StringUtils.isNotEmpty(messageReceiver)) {
+                String[] split = messageReceiver.split(",");
+                for (String s : split) {
+                    new MailUtil().send(s,subject,contnet.toString());
+                }
                 return "报警记录添加成功";
-            }else {
-                return "email is null";
+            } else {
+                if(email!=null){
+                    new MailUtil().send(email,subject,contnet.toString());
+                    return "报警记录添加成功";
+                }else {
+                    return "email is null";
+                }
             }
         }
         String result = null;
         try {
-            String messageReceiver = equipment.getMessageReceiver();
             if (!"二次曲棍".equals(alarmContent)) {
                 if (StringUtils.isNotEmpty(messageReceiver)) {
                     String[] split = messageReceiver.split(",");