|
@@ -1,10 +1,10 @@
|
|
package com.shcd.service.impl;
|
|
package com.shcd.service.impl;
|
|
|
|
|
|
import cn.hutool.http.HttpUtil;
|
|
import cn.hutool.http.HttpUtil;
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
import com.shcd.conf.DMConfiguration;
|
|
import com.shcd.conf.DMConfiguration;
|
|
import com.shcd.mapper.EmailSupervisionMapper;
|
|
import com.shcd.mapper.EmailSupervisionMapper;
|
|
import com.shcd.service.EmailSupervisionService;
|
|
import com.shcd.service.EmailSupervisionService;
|
|
-import com.shcd.util.EmailUtil;
|
|
|
|
import com.shcd.vo.Result;
|
|
import com.shcd.vo.Result;
|
|
import com.shcd.vo.Rule;
|
|
import com.shcd.vo.Rule;
|
|
import com.shcd.vo.RuleUser;
|
|
import com.shcd.vo.RuleUser;
|
|
@@ -21,12 +21,11 @@ public class EmailSupervisionServiceImpl implements EmailSupervisionService {
|
|
@Resource
|
|
@Resource
|
|
private EmailSupervisionMapper emailSupervisionMapper;
|
|
private EmailSupervisionMapper emailSupervisionMapper;
|
|
|
|
|
|
- @Autowired
|
|
|
|
- private EmailUtil emailUtil;
|
|
|
|
-
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private DMConfiguration configuration;
|
|
private DMConfiguration configuration;
|
|
|
|
|
|
|
|
+ @Value("${emailUrl}")
|
|
|
|
+ private String emailUrl;
|
|
@Override
|
|
@Override
|
|
public void sendEmail() {
|
|
public void sendEmail() {
|
|
//获取所有的规则,用来判断是否发送邮件
|
|
//获取所有的规则,用来判断是否发送邮件
|
|
@@ -57,7 +56,16 @@ public class EmailSupervisionServiceImpl implements EmailSupervisionService {
|
|
String s = ruleUser.getMessage().replaceAll(ruleResult.getKeyTime(), ruleResult.getTime());
|
|
String s = ruleUser.getMessage().replaceAll(ruleResult.getKeyTime(), ruleResult.getTime());
|
|
String content = ruleUser.getUsername() + ": \n" + s;
|
|
String content = ruleUser.getUsername() + ": \n" + s;
|
|
//HttpUtil.createPost(url).form("to",ruleUser.getEmail()).form("subject",ruleUser.getSubject()).form("content",content).setReadTimeout(30000).execute();
|
|
//HttpUtil.createPost(url).form("to",ruleUser.getEmail()).form("subject",ruleUser.getSubject()).form("content",content).setReadTimeout(30000).execute();
|
|
- emailUtil.sendMail(ruleUser.getEmail(),ruleUser.getSubject(),content);
|
|
|
|
|
|
+ //emailUtil.sendMail(ruleUser.getEmail(),ruleUser.getSubject(),content);
|
|
|
|
+ HashMap<String, Object> map = new HashMap<>();
|
|
|
|
+ map.put("subject",ruleUser.getSubject());
|
|
|
|
+ map.put("text",content);
|
|
|
|
+ map.put("isHtml",false);
|
|
|
|
+ map.put("sender","港航中心");
|
|
|
|
+ map.put("mail","944927389@qq.com");
|
|
|
|
+ String[] strings = {ruleUser.getEmail()};
|
|
|
|
+ map.put("to",strings);
|
|
|
|
+ HttpUtil.createPost(emailUrl).body(JSON.toJSONString(map)).execute();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|