|
@@ -1,37 +1,46 @@
|
|
|
package com.szwl.service.impl;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.szwl.model.entity.TAlarmClean;
|
|
|
import com.szwl.mapper.TAlarmCleanMapper;
|
|
|
+import com.szwl.model.entity.TEquipment;
|
|
|
import com.szwl.model.utils.MailUtil;
|
|
|
-import com.szwl.model.utils.SampleMail;
|
|
|
import com.szwl.model.utils.YunPianSms;
|
|
|
import com.szwl.service.TAlarmCleanService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.szwl.service.TEquipmentService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
|
- * 服务实现类
|
|
|
+ * 服务实现类
|
|
|
* </p>
|
|
|
*
|
|
|
* @author wuhs
|
|
|
- * @since 2024-04-26
|
|
|
+ * @since 2024-08-02
|
|
|
*/
|
|
|
@Service
|
|
|
public class TAlarmCleanServiceImpl extends ServiceImpl<TAlarmCleanMapper, TAlarmClean> implements TAlarmCleanService {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ TEquipmentService equipmentService;
|
|
|
+
|
|
|
private static final String appid = "07784f5fedb508046c841b391005b7de";
|
|
|
|
|
|
public String getContent(String clientId) {
|
|
|
+ String clientName = getClientNameById(clientId);
|
|
|
StringBuffer content = new StringBuffer();
|
|
|
|
|
|
String str = "Dear customer:<br>" +
|
|
|
"<br>" +
|
|
|
- "Your machine number is <" + clientId + "> marshmallow robot, the stove maintenance cycle has arrived, please clean the stove cover to keep the pattern in the best condition, if it has been cleaned, please ignore this reminder." +
|
|
|
+ "Your machine name is <" + clientName + "> marshmallow robot, the stove maintenance cycle has arrived, please clean the stove cover to keep the pattern in the best condition, if it has been cleaned, please ignore this reminder." +
|
|
|
"<br>" +
|
|
|
"<br>" +
|
|
|
"Best Regards.<br>" +
|
|
@@ -42,8 +51,9 @@ public class TAlarmCleanServiceImpl extends ServiceImpl<TAlarmCleanMapper, TAlar
|
|
|
|
|
|
@Override
|
|
|
public void sendEmail(String email, String clientId) {
|
|
|
+ String clientName = getClientNameById(clientId);
|
|
|
String content = "";
|
|
|
- content = getContent(clientId);
|
|
|
+ content = getContent(clientName);
|
|
|
String subject = "Cleaning reminders";
|
|
|
new MailUtil().send(email, subject, content);
|
|
|
}
|
|
@@ -64,6 +74,15 @@ public class TAlarmCleanServiceImpl extends ServiceImpl<TAlarmCleanMapper, TAlar
|
|
|
|
|
|
|
|
|
private String getAlarmCleanMessage(String clientId) {
|
|
|
- return "【申泽智能】您机器编号为 " + clientId + " 的棉花糖机器人,炉头保养周期已到,请清洁炉头盖,以保持花型在最佳状态,如已清洁请忽略本提醒。";
|
|
|
+ String clientName = getClientNameById(clientId);
|
|
|
+ return "【申泽智能】您机器名称为 " + clientName + " 的棉花糖机器人,炉头保养周期已到,请清洁炉头盖,以保持花型在最佳状态,如已清洁请忽略本提醒。";
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getClientNameById(String clientId) {
|
|
|
+ LambdaQueryWrapper<TEquipment> wrapper = Wrappers.lambdaQuery();
|
|
|
+ wrapper.eq(TEquipment::getClientId, clientId);
|
|
|
+ List<TEquipment> equipmentList = equipmentService.list(wrapper);
|
|
|
+ TEquipment equipment = equipmentList.get(0);
|
|
|
+ return equipment.getName();
|
|
|
}
|
|
|
}
|