Commit 32bd30ef by 穆龙飞

modify:修改邮件发送逻辑

parent 813e3c2c
......@@ -4,12 +4,14 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
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.rpc.EncodeUtil;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.io.File;
import java.util.Collection;
import java.util.HashMap;
......@@ -35,12 +37,14 @@ public class UasClientServiceImpl implements UasClientService {
if (!CollectionUtils.isEmpty(ccList)) {
params.put("cc", StringUtils.join(ccList, ","));
}
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"));
logger.info(JSONObject.toJSONString("邮箱接口入参 subject={},content={},toList={},ccList={}"), subject, content, StringUtils.join(toList, ","), params.get("cc"));
String appendStr = "subject=" + subject + "&to=" + StringUtils.join(toList, ",") + "&cc=" + params.get("cc") + "&content=" + content;
String encode = EncodeUtil.encode(appendStr);
String res = service.sendEmail(encode);
this.logger.info("[op:sendEmail] res={} ", res);
JSONObject jsonObject = JSON.parseObject(res);
if (jsonObject.getInteger("code") != 200) {
this.logger.error("SendEmail", (String)null, "send email failed, subject={},toList={},ccList={}", new Object[]{subject, JSON.toJSONString(toList), JSON.toJSONString(ccList)});
this.logger.error("SendEmail", null, "send email failed, subject={},toList={},ccList={}", new Object[]{subject, JSON.toJSONString(toList), JSON.toJSONString(ccList)});
}
}
}
......
......@@ -3,6 +3,7 @@ package com.netease.mail.yanxuan.change.integration.flow.email;
import com.netease.yanxuan.missa.client.annotation.MissaClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.Map;
......@@ -19,9 +20,6 @@ public interface EmailRpcService {
@PostMapping("/push/email/qc")
String sendEmail(@RequestParam(name = "subject")String subject,
@RequestParam(name = "content")String content,
@RequestParam(name = "to") String to,
@RequestParam(name = "cc",required = false)String cc);
String sendEmail(@RequestBody String str);
}
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