Commit b4c063d5 by 穆龙飞

modify:修改邮件发送逻辑

parent 170cf423
...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject; ...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.netease.mail.yanxuan.change.integration.email.service.UasClientService; import com.netease.mail.yanxuan.change.integration.email.service.UasClientService;
import com.netease.mail.yanxuan.change.integration.flow.email.EmailRpcService; import com.netease.mail.yanxuan.change.integration.flow.email.EmailRpcService;
import com.netease.mail.yanxuan.qc.service.client.remote.UasClient; import com.netease.mail.yanxuan.qc.service.client.remote.UasClient;
import com.netease.mail.yanxuan.qc.service.client.utils.http.HttpClientExecutor;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -31,18 +32,28 @@ public class UasClientServiceImpl implements UasClientService { ...@@ -31,18 +32,28 @@ public class UasClientServiceImpl implements UasClientService {
private EmailRpcService service; private EmailRpcService service;
@Autowired @Autowired
private UasClient uasClient; private HttpClientExecutor httpClientExecutor;
@Override @Override
public void sendEmail(String subject, String content, Collection<String> toList, Collection<String> ccList, List<File> fileList) { public void sendEmail(String subject, String content, Collection<String> toList, Collection<String> ccList, List<File> fileList) {
if (!CollectionUtils.isEmpty(toList)) { if (!CollectionUtils.isEmpty(toList)) {
Map<String, String> params = new HashMap(); Map<String, String> params = new HashMap();
params.put("subject", subject);
params.put("content", content);
params.put("to", StringUtils.join(toList, ","));
params.put("topic", "qc");
if (!CollectionUtils.isEmpty(ccList)) { if (!CollectionUtils.isEmpty(ccList)) {
params.put("cc", StringUtils.join(ccList, ",")); params.put("cc", StringUtils.join(ccList, ","));
} }
logger.info(JSONObject.toJSONString("邮箱接口入参 subject={},content={},toList={},ccList={}"), subject, content, StringUtils.join(toList, ","), params.get("cc")); logger.info(JSONObject.toJSONString("邮箱接口入参 subject={},content={},toList={},ccList={}"), subject, content, StringUtils.join(toList, ","), params.get("cc"));
//String res = service.sendEmail(subject,content,StringUtils.join(toList, ","),params.get("cc")); //String res = service.sendEmail(subject,content,StringUtils.join(toList, ","),params.get("cc"));
uasClient.sendEmail(subject, content, toList, ccList, null); String url = "http://127.0.0.1:8550/proxy/test.logistics-uas.service.mailsaas/push/email/qc";
String res = this.httpClientExecutor.doPost(url, params);
this.logger.info("[op:sendEmail] res={} ", new Object[]{res});
JSONObject jsonObject = JSON.parseObject(res);
if (jsonObject.getInteger("code") != 200) {
logger.error("send email has ex: {}", res);
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment