Commit 3cf7f493 by “zcwang”

Merge remote-tracking branch 'origin/feature-changeFlow-221110' into feature-changeFlow-221110

parents b4426bf1 b4c063d5
Pipeline #44032 failed with stages
in 1 minute 59 seconds
...@@ -100,6 +100,12 @@ ...@@ -100,6 +100,12 @@
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.netease.yanxuan</groupId>
<artifactId>yanxuan-qc-service-client</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
<!-- spring --> <!-- spring -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
...@@ -229,6 +235,11 @@ ...@@ -229,6 +235,11 @@
<version>${org.aspectj.version}</version> <version>${org.aspectj.version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.netease.yanxuan</groupId>
<artifactId>yanxuan-qc-service-client</artifactId>
</dependency>
<!-- yanxuan --> <!-- yanxuan -->
<!--默认引入apollo配置--> <!--默认引入apollo配置-->
<dependency> <dependency>
......
...@@ -13,7 +13,7 @@ import tk.mybatis.spring.annotation.MapperScan; ...@@ -13,7 +13,7 @@ import tk.mybatis.spring.annotation.MapperScan;
/** /**
* 项目启动类 * 项目启动类
*/ */
@ComponentScan(basePackages = {"com.netease.mail.yanxuan.change", "com.netease.yanxuan.user"}) @ComponentScan(basePackages = {"com.netease.mail.yanxuan.change", "com.netease.yanxuan.user", "com.netease.mail.yanxuan.qc"})
@MapperScan("com.netease.mail.yanxuan.change.dal.mapper") @MapperScan("com.netease.mail.yanxuan.change.dal.mapper")
@EnableApolloConfig @EnableApolloConfig
@EnableMissaClients(basePackages = "com.netease.mail.yanxuan.change") @EnableMissaClients(basePackages = "com.netease.mail.yanxuan.change")
......
...@@ -4,12 +4,15 @@ import com.alibaba.fastjson.JSON; ...@@ -4,12 +4,15 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; 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.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;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.io.File; import java.io.File;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
...@@ -28,19 +31,28 @@ public class UasClientServiceImpl implements UasClientService { ...@@ -28,19 +31,28 @@ public class UasClientServiceImpl implements UasClientService {
@Autowired @Autowired
private EmailRpcService service; private EmailRpcService service;
@Autowired
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"));
this.logger.info("[op:sendEmail] res={} ", res); 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); 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)}); 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