Commit fc849532 by jx-art

邮件发送接口整理

parent 2b7d6172
Pipeline #43206 passed with stages
in 1 minute 35 seconds
...@@ -12,9 +12,4 @@ public interface UasClientService { ...@@ -12,9 +12,4 @@ public interface UasClientService {
void sendEmail(String subject, String content, Collection<String> toList, Collection<String> ccList, List<File> fileList); void sendEmail(String subject, String content, Collection<String> toList, Collection<String> ccList, List<File> fileList);
void sendEmail1(String subject, String content, Collection<String> toList, Collection<String> ccList, List<File> fileList);
void sendEmail2(String subject, String content, Collection<String> toList, Collection<String> ccList, List<File> fileList);
} }
...@@ -30,60 +30,13 @@ public class UasClientServiceImpl implements UasClientService { ...@@ -30,60 +30,13 @@ public class UasClientServiceImpl implements UasClientService {
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)) {
//String url = MessageFormat.format("http://{0}{1}/{2}", this.thirdPartyDrmConfig.getUasHostInner(), "/push/email/", this.thirdPartyDrmConfig.getUasProduct());
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(params)); logger.info(JSONObject.toJSONString("邮箱接口入参 subject={},content={},toList={},ccList={}"),subject,content,StringUtils.join(toList, ","),params.get("cc"));
String res = service.sendEmail(params); String res = service.sendEmail(subject,content,StringUtils.join(toList, ","),params.get("cc"));
this.logger.info("[op:sendEmail] res={} ", new Object[]{res}); 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)});
}
}
}
public void sendEmail1(String subject, String content, Collection<String> toList, Collection<String> ccList, List<File> fileList) {
if (!CollectionUtils.isEmpty(toList)) {
//String url = MessageFormat.format("http://{0}{1}/{2}", this.thirdPartyDrmConfig.getUasHostInner(), "/push/email/", this.thirdPartyDrmConfig.getUasProduct());
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)) {
params.put("cc", StringUtils.join(ccList, ","));
}
logger.info(JSONObject.toJSONString(params));
//String res = service.sendEmail1(params);
// this.logger.info("[op:sendEmail] res={} ", new Object[]{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)});
// }
}
}
public void sendEmail2(String subject, String content, Collection<String> toList, Collection<String> ccList, List<File> fileList) {
if (!CollectionUtils.isEmpty(toList)) {
//String url = MessageFormat.format("http://{0}{1}/{2}", this.thirdPartyDrmConfig.getUasHostInner(), "/push/email/", this.thirdPartyDrmConfig.getUasProduct());
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)) {
params.put("cc", StringUtils.join(ccList, ","));
}
logger.info(JSONObject.toJSONString(params));
String res = service.sendEmail2(subject,content,StringUtils.join(toList, ","));
this.logger.info("[op:sendEmail] res={} ", new Object[]{res});
JSONObject jsonObject = JSON.parseObject(res); JSONObject jsonObject = JSON.parseObject(res);
if (jsonObject.getInteger("code") != 200) { 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", (String)null, "send email failed, subject={},toList={},ccList={}", new Object[]{subject, JSON.toJSONString(toList), JSON.toJSONString(ccList)});
......
...@@ -3,10 +3,7 @@ package com.netease.mail.yanxuan.change.integration.flow.email; ...@@ -3,10 +3,7 @@ package com.netease.mail.yanxuan.change.integration.flow.email;
import com.netease.yanxuan.missa.client.annotation.MissaClient; import com.netease.yanxuan.missa.client.annotation.MissaClient;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -18,13 +15,14 @@ import java.util.Map; ...@@ -18,13 +15,14 @@ import java.util.Map;
public interface EmailRpcService { public interface EmailRpcService {
//push/email/attach/qc/upload.json //push/email/attach/qc/upload.json
@PostMapping("/push/email/attach/qc/upload.json") @PostMapping("/push/email/attach/qc/upload.json")
String sendEmail(Map<String, String> params); String sendEmailAttach(Map<String, String> params);
@PostMapping("/push/email/qc") @PostMapping("/push/email/qc")
String sendEmail2(@RequestParam(name = "subject")String subject, String sendEmail(@RequestParam(name = "subject")String subject,
@RequestParam(name = "content")String content, @RequestParam(name = "content")String content,
@RequestParam(name = "to") String to); @RequestParam(name = "to") String to,
@RequestParam(name = "cc",required = false)String cc);
//yanxuan-sc-ehc //yanxuan-sc-ehc
......
...@@ -5,14 +5,16 @@ import com.netease.mail.yanxuan.change.common.bean.AjaxResult; ...@@ -5,14 +5,16 @@ import com.netease.mail.yanxuan.change.common.bean.AjaxResult;
import com.netease.mail.yanxuan.change.biz.service.change.AdminChangeConfigService; import com.netease.mail.yanxuan.change.biz.service.change.AdminChangeConfigService;
import com.netease.mail.yanxuan.change.dal.meta.model.req.ChangeConfigQueryReq; import com.netease.mail.yanxuan.change.dal.meta.model.req.ChangeConfigQueryReq;
import com.netease.mail.yanxuan.change.dal.meta.model.req.ChangeConfigReq; import com.netease.mail.yanxuan.change.dal.meta.model.req.ChangeConfigReq;
import com.netease.mail.yanxuan.change.integration.email.service.IUasEhcClient; import com.netease.mail.yanxuan.change.integration.email.email.EmailFactor;
import com.netease.mail.yanxuan.change.integration.email.service.UasClientService; import com.netease.mail.yanxuan.change.integration.email.enums.EmailTemplateEnum;
import com.netease.mail.yanxuan.change.integration.flow.ius.*; import com.netease.mail.yanxuan.change.integration.email.enums.EmailTypeEnum;
import com.netease.mail.yanxuan.change.integration.email.service.IEmailService;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
/** /**
...@@ -110,57 +112,26 @@ public class ChangeConfigController { ...@@ -110,57 +112,26 @@ public class ChangeConfigController {
private static Logger logger = LoggerFactory.getLogger(ChangeConfigController.class); private static Logger logger = LoggerFactory.getLogger(ChangeConfigController.class);
@Autowired @Autowired
private UasClientService iEmailService; private IEmailService iEmailService;
@GetMapping("/test") @GetMapping("/test")
public void queryCommanderInfo(){ public void queryCommanderInfo(){
EmailFactor emailFactor = new EmailFactor();
emailFactor.setType(EmailTypeEnum.HTML.getType());
emailFactor.setEmailTemplateEnum(EmailTemplateEnum.YX_QC_RELEASE_FLOW);
ArrayList<String> strings = new ArrayList<>(); ArrayList<String> strings = new ArrayList<>();
logger.info("调用接口~~~~~~~~~~~~~~~~~~~~~~~~");
strings.add("wb.tanglongwei@mesg.corp.netease.com"); strings.add("wb.tanglongwei@mesg.corp.netease.com");
iEmailService.sendEmail("yxqc_release_flow","{\n" + HashMap<String,Object> map = new HashMap<>();
" \"flowId\":\"工单ID\",\n" + map.put("flowId","工单ID");
" \"releaseId\":\"发起人账号\",\n" + map.put("releaseId","发起人账号");
" \"releaseName\":\"发起人姓名\",\n" + map.put("releaseName","发起人姓名");
" \"abnormalTitle\":\"异常标题\",\n" + map.put("abnormalTitle","异常标题");
" \"flowLink\":\"工单链接\",\n" + map.put("flowLink","工单链接");
" \"findTime\":\"findTime\",\n" + map.put("findTime","findTime");
" \"findDes\":\"findDes\"\n" + map.put("findDes","findDes");
"\n" + emailFactor.setData(map);
"}", strings,null,null); iEmailService.sendEmail(strings,emailFactor);
}
@GetMapping("/test1")
public void queryCommanderInfo1(){
ArrayList<String> strings = new ArrayList<>();
logger.info("调用接口~~~~~~~~~~~~~~~~~~~~~~~~");
strings.add("wb.tanglongwei@mesg.corp.netease.com");
iEmailService.sendEmail1("yxqc_release_flow","{\n" +
" \"flowId\":\"工单ID\",\n" +
" \"releaseId\":\"发起人账号\",\n" +
" \"releaseName\":\"发起人姓名\",\n" +
" \"abnormalTitle\":\"异常标题\",\n" +
" \"flowLink\":\"工单链接\",\n" +
" \"findTime\":\"findTime\",\n" +
" \"findDes\":\"findDes\"\n" +
"\n" +
"}", strings,null,null);
}
@GetMapping("/test2")
public void queryCommanderInfo2(){
ArrayList<String> strings = new ArrayList<>();
logger.info("调用接口~~~~~~~~~~~~~~~~~~~~~~~~");
strings.add("wb.tanglongwei@mesg.corp.netease.com");
iEmailService.sendEmail2("yanxuan-qc-change-system","{\n" +
" \"flowId\":\"工单ID\",\n" +
" \"releaseId\":\"发起人账号\",\n" +
" \"releaseName\":\"发起人姓名\",\n" +
" \"abnormalTitle\":\"异常标题\",\n" +
" \"flowLink\":\"工单链接\",\n" +
" \"findTime\":\"findTime\",\n" +
" \"findDes\":\"findDes\"\n" +
"\n" +
"}", strings,null,null);
} }
} }
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