|
@@ -13,6 +13,7 @@ import com.szwl.service.TAdminService;
|
|
|
import com.szwl.service.TAlarmRecordService;
|
|
|
import com.szwl.service.TEquipmentService;
|
|
|
import com.szwl.service.TWechatService;
|
|
|
+import com.szwl.util.TimeZoneUtil;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
@@ -52,7 +53,6 @@ public class AlarmRecordIndexController {
|
|
|
@ResponseBody
|
|
|
public String addAlarmRecord(@RequestBody AlarmRecordVo alarmRecordVo) {
|
|
|
|
|
|
-
|
|
|
TAlarmRecord alarmRecord = new TAlarmRecord();
|
|
|
|
|
|
String clientId = alarmRecordVo.getClientId();
|
|
@@ -91,6 +91,10 @@ public class AlarmRecordIndexController {
|
|
|
String ifForeign = admin.getIfForeign();
|
|
|
String companyType = admin.getCompanyType();
|
|
|
String messageReceiver = equipment.getMessageReceiver();
|
|
|
+ String timeZone = admin.getTimeZone();
|
|
|
+ timeZone = StringUtils.isEmpty(timeZone) ? "Asia/Shanghai" : timeZone;
|
|
|
+ // 根据时区获取时间
|
|
|
+ String localTime = TimeZoneUtil.getTimeByZoneID(timeZone);
|
|
|
// 查询是否绑定微信
|
|
|
LambdaQueryWrapper<TWechat> wechatQuery = Wrappers.lambdaQuery();
|
|
|
wechatQuery.eq(TWechat::getAdminId, admin.getId());
|
|
@@ -106,31 +110,31 @@ public class AlarmRecordIndexController {
|
|
|
}
|
|
|
if (ifForeign.equals("1")) {
|
|
|
String subject = "Error message from Magic Candy Machine";
|
|
|
- StringBuffer contnet = new StringBuffer();
|
|
|
+ StringBuffer content = 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>" +
|
|
|
+ " Machine name: ";
|
|
|
+ String str2 = "<br>" + " Time&Date: ";
|
|
|
+ String str3 = "<br>" + " Error Message: ";
|
|
|
+ String str4 = "<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 details as above.<br>";
|
|
|
+ String str5 = " <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);
|
|
|
+ content.append(str1).append(name).append(str2).append(localTime).append(str3).append(alarmContent).append(str4).append(str5);
|
|
|
if (StringUtils.isNotEmpty(messageReceiver)) {
|
|
|
String[] split = messageReceiver.split(",");
|
|
|
for (String s : split) {
|
|
|
- new MailUtil().send(s, subject, contnet.toString());
|
|
|
+ new MailUtil().send(s, subject, content.toString());
|
|
|
}
|
|
|
return "报警记录添加成功";
|
|
|
} else {
|
|
|
if (email != null) {
|
|
|
- new MailUtil().send(email, subject, contnet.toString());
|
|
|
+ new MailUtil().send(email, subject, content.toString());
|
|
|
return "报警记录添加成功";
|
|
|
} else {
|
|
|
return "email is null";
|