Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yanxuan-qc-change-system
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
胡园园
yanxuan-qc-change-system
Commits
5e8d1e78
Commit
5e8d1e78
authored
Nov 30, 2022
by
“zcwang”
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/feature-changeFlow-221110' into feature-changeFlow-221110
parents
afb97c99
02fb504e
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
147 additions
and
403 deletions
+147
-403
pom.xml
pom.xml
+11
-1
application.properties
...mbly/src/main/resources/config/dev/application.properties
+15
-9
RpcTemplate.java
...l/yanxuan/change/integration/email/conig/RpcTemplate.java
+0
-266
EmailTemplateRpcResult.java
...hange/integration/email/email/EmailTemplateRpcResult.java
+0
-38
EmailServiceImpl.java
...ange/integration/email/service/impl/EmailServiceImpl.java
+6
-0
EmailTemplateServiceImpl.java
...egration/email/service/impl/EmailTemplateServiceImpl.java
+15
-13
IUasClientEhcImpl.java
...nge/integration/email/service/impl/IUasClientEhcImpl.java
+0
-6
UasClientServiceImpl.java
.../integration/email/service/impl/UasClientServiceImpl.java
+3
-16
EmailRpcService.java
...anxuan/change/integration/flow/email/EmailRpcService.java
+13
-7
EmailTemplateRpcService.java
...hange/integration/flow/email/EmailTemplateRpcService.java
+23
-0
ChangeConfigController.java
...yanxuan/change/web/controller/ChangeConfigController.java
+19
-47
application.properties
...ange-system-web/src/main/resources/application.properties
+42
-0
No files found.
pom.xml
View file @
5e8d1e78
...
@@ -41,7 +41,7 @@
...
@@ -41,7 +41,7 @@
<netease.ddb.version>
4.6.0.4
</netease.ddb.version>
<netease.ddb.version>
4.6.0.4
</netease.ddb.version>
<!-- store-db -->
<!-- store-db -->
<mysql.version>
5.1.34
</mysql.version>
<mysql.version>
8.0.15
</mysql.version>
<mybatis.spring.boot.starter.version>
1.1.1
</mybatis.spring.boot.starter.version>
<mybatis.spring.boot.starter.version>
1.1.1
</mybatis.spring.boot.starter.version>
<!-- store-redis -->
<!-- store-redis -->
...
@@ -384,6 +384,16 @@
...
@@ -384,6 +384,16 @@
</exclusion>
</exclusion>
</exclusions>
</exclusions>
</dependency>
</dependency>
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger2
</artifactId>
<version>
2.7.0
</version>
</dependency>
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger-ui
</artifactId>
<version>
2.7.0
</version>
</dependency>
<!--qc -->
<!--qc -->
<!--<dependency>-->
<!--<dependency>-->
<!-- <groupId>com.netease.yanxuan</groupId>-->
<!-- <groupId>com.netease.yanxuan</groupId>-->
...
...
yanxuan-qc-change-system-assembly/src/main/resources/config/dev/application.properties
View file @
5e8d1e78
...
@@ -10,10 +10,10 @@ spring.http.multipart.max-file-size=100MB
...
@@ -10,10 +10,10 @@ spring.http.multipart.max-file-size=100MB
spring.http.multipart.max-request-size
=
100MB
spring.http.multipart.max-request-size
=
100MB
# mysql
# mysql
spring.datasource.driver-class-name
=
com.mysql.jdbc.Driver
spring.datasource.driver-class-name
=
com.mysql.
cj.
jdbc.Driver
spring.datasource.url
=
jdbc:mysql://
localhost:3306/change_config?useUnicode=true&characterEncoding=UTF-8&autoReconnet=true
spring.datasource.url
=
jdbc:mysql://
112.74.86.21/tb_yx_link?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai
spring.datasource.username
=
root
spring.datasource.username
=
root
spring.datasource.password
=
abc123
spring.datasource.password
=
wangjiaxiang
#tomcat
#tomcat
server.tomcat.max-threads
=
600
server.tomcat.max-threads
=
600
...
@@ -27,12 +27,18 @@ server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %{X-Forwarded-For}i %D %{
...
@@ -27,12 +27,18 @@ server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %{X-Forwarded-For}i %D %{
mybatis.mapper-locations
=
classpath:mybatis/mapper/*.xml
mybatis.mapper-locations
=
classpath:mybatis/mapper/*.xml
mybatis.configuration.cache-enabled
=
true
mybatis.configuration.cache-enabled
=
true
mybatis.configuration.log-impl
=
org.apache.ibatis.logging.stdout.StdOutImpl
mybatis.configuration.log-impl
=
org.apache.ibatis.logging.stdout.StdOutImpl
mybatis.configuration.map-underscore-to-camel-case
=
true
# redis
# redis
spring.redis.pool.max-active
=
50
spring.redis.host
=
localhost
spring.redis.host
=
127.0.0.1
spring.redis.port
=
6379
spring.redis.password
=
spring.redis.password
=
spring.redis.pool.max-wait
=
10000
spring.redis.database
=
0
spring.redis.pool.max-idle
=
20
spring.redis.port
=
6379
spring.redis.timeout
=
20000
spring.redis.timeout
=
3000
spring.redis.jedis.pool.max-active
=
8
spring.redis.jedis.pool.max-wait
=
-1
spring.redis.jedis.pool.max-idle
=
500
spring.redis.jedis.pool.min-idle
=
0
spring.redis.lettuce.shutdown-timeout
=
0
yanxuan-qc-change-system-integration/src/main/java/com/netease/mail/yanxuan/change/integration/email/conig/RpcTemplate.java
deleted
100644 → 0
View file @
afb97c99
package
com
.
netease
.
mail
.
yanxuan
.
change
.
integration
.
email
.
conig
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.parser.ParserConfig
;
import
com.netease.mail.yanxuan.change.integration.email.exception.RpcException
;
import
com.netease.mail.yanxuan.change.integration.email.exception.RpcStatusException
;
import
com.netease.mail.yanxuan.change.integration.email.exception.RpcTimeoutException
;
import
com.netease.mail.yanxuan.change.integration.email.util.EncodeUtil
;
import
com.netease.mail.yanxuan.change.integration.email.util.HttpClientUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.StringUtils
;
import
java.io.IOException
;
import
java.util.Map
;
/**
* rpc 请求封装,在 HttpClientUtil 基础上加入了返回值处理和日志
*
* @author lwtang
* @date 2019-02-19
*/
@Component
public
class
RpcTemplate
{
private
Logger
logger
=
LoggerFactory
.
getLogger
(
RpcTemplate
.
class
);
@Value
(
"${act.rpc.get.retry:1}"
)
private
int
rpcGetRetry
;
@Value
(
"${act.rpc.post.retry:0}"
)
private
int
rpcPostRetry
;
public
RpcTemplate
()
{
ParserConfig
.
getGlobalInstance
().
setAutoTypeSupport
(
true
);
}
private
String
convertParam
(
Object
param
)
{
if
(
param
instanceof
String
)
{
return
(
String
)
param
;
}
String
reqParam
=
""
;
if
(
param
instanceof
Map
)
{
reqParam
=
EncodeUtil
.
encodeMap
((
Map
)
param
);
}
else
if
(
param
!=
null
)
{
reqParam
=
JSON
.
toJSONString
(
param
);
}
return
reqParam
;
}
private
<
T
>
T
execute
(
String
url
,
Object
params
,
CallHandler
<
T
>
handler
,
CallTemplate
callTemplate
,
int
retryTime
,
Method
method
)
{
int
tryTimes
=
0
;
RpcException
rpcException
=
null
;
String
respBody
=
null
;
int
statusCode
=
200
;
while
(
tryTimes
<=
retryTime
)
{
long
startTime
=
System
.
currentTimeMillis
();
try
{
respBody
=
callTemplate
.
executeCall
();
if
(
StringUtils
.
isEmpty
(
respBody
))
{
throw
new
RpcException
(
"response empty"
);
}
T
t
=
handler
.
handle
(
respBody
);
return
t
;
}
catch
(
RpcTimeoutException
e
)
{
rpcException
=
e
;
}
catch
(
RpcStatusException
e
)
{
rpcException
=
e
;
statusCode
=
e
.
getCode
();
}
catch
(
RpcException
e
)
{
rpcException
=
e
;
}
catch
(
Exception
e
)
{
rpcException
=
new
RpcException
(
e
);
}
finally
{
if
(
logger
.
isDebugEnabled
())
{
long
costTime
=
System
.
currentTimeMillis
()
-
startTime
;
String
reqParam
=
convertParam
(
params
);
logger
.
debug
(
"process request, url={}, method={}, params={}, statusCode = {}, response={}, cost={}ms"
,
url
,
method
.
name
(),
reqParam
,
statusCode
,
respBody
,
costTime
);
}
}
tryTimes
++;
}
logger
.
error
(
"request error, url={}, params={}, statusCode = {}, respBody={}"
,
url
,
convertParam
(
params
),
statusCode
,
respBody
,
rpcException
);
if
(
rpcException
==
null
)
{
rpcException
=
new
RpcException
(
"服务异常"
);
}
throw
rpcException
;
}
/**
* Get 请求
*
* @param url
* @param params
* @param header
* @param timeout
* -1 取默认的超时时间
* @param handler
* @param <T>
* @return
*/
public
<
T
>
T
get
(
String
url
,
Map
<
String
,
Object
>
params
,
Map
<
String
,
String
>
header
,
int
timeout
,
CallHandler
<
T
>
handler
,
Integer
retryTimes
)
{
CallTemplate
template
=
()
->
HttpClientUtil
.
get
(
url
,
params
,
header
,
timeout
);
return
this
.
execute
(
url
,
params
,
handler
,
template
,
retryTimes
,
Method
.
GET
);
}
public
<
T
>
T
get
(
String
url
,
Map
<
String
,
Object
>
params
,
CallHandler
<
T
>
handler
)
{
return
get
(
url
,
params
,
null
,
-
1
,
handler
,
rpcGetRetry
);
}
/**
* Post请求(url encoded)
*
* @param url
* @param params
* @param timeout
* @param handler
* @param <T>
* @return
*/
public
<
T
>
T
post
(
String
url
,
Map
<
String
,
Object
>
params
,
int
timeout
,
CallHandler
<
T
>
handler
,
Integer
retryTime
)
{
CallTemplate
template
=
()
->
HttpClientUtil
.
post
(
url
,
params
,
timeout
);
return
this
.
execute
(
url
,
params
,
handler
,
template
,
retryTime
,
Method
.
POST
);
}
/**
* Post请求(url encoded)
*
* @param url
* @param params
* @param timeout
* @param handler
* @param <T>
* @return
*/
public
<
T
>
T
post
(
String
url
,
Map
<
String
,
Object
>
params
,
int
timeout
,
CallHandler
<
T
>
handler
)
{
CallTemplate
template
=
()
->
HttpClientUtil
.
post
(
url
,
params
,
timeout
);
return
this
.
execute
(
url
,
params
,
handler
,
template
,
rpcPostRetry
,
Method
.
POST
);
}
/**
* Post Json请求
*
* @param url
* @param params
* @param timeout
* @param handler
* @param <T>
* @return
*/
public
<
T
>
T
postJson
(
String
url
,
String
params
,
int
timeout
,
CallHandler
<
T
>
handler
,
Integer
retryTime
)
{
CallTemplate
template
=
()
->
HttpClientUtil
.
postJson
(
url
,
params
,
timeout
);
return
this
.
execute
(
url
,
params
,
handler
,
template
,
retryTime
,
Method
.
POST
);
}
/**
* Post Json请求
*
* @param url
* @param params
* @param timeout
* @param handler
* @param <T>
* @return
*/
public
<
T
>
T
postJson
(
String
url
,
String
params
,
int
timeout
,
CallHandler
<
T
>
handler
)
{
CallTemplate
template
=
()
->
HttpClientUtil
.
postJson
(
url
,
params
,
timeout
);
return
this
.
execute
(
url
,
params
,
handler
,
template
,
rpcPostRetry
,
Method
.
POST
);
}
enum
RpcStatus
{
/**
* 成功
*/
SUCCESS
(
1
),
/**
* 告警(请求成功,但非理想值)
*/
WARNING
(
2
),
/**
* 异常
*/
EXCEPTION
(
3
),
/**
* 超时
*/
TIMEOUT
(
4
);
private
int
value
;
RpcStatus
(
int
value
)
{
this
.
value
=
value
;
}
public
int
getValue
()
{
return
value
;
}
}
enum
Method
{
/**
* Get请求
*/
GET
,
/**
* Post表单请求
*/
POST
,
}
/**
* 模板调用
*/
@FunctionalInterface
public
interface
CallTemplate
{
/**
* 模板调用类
*/
String
executeCall
();
}
/**
* 报文解析
*/
@FunctionalInterface
public
interface
CallHandler
<
T
>
{
/**
* 报文解析
*
* @param resp
* response body
*/
T
handle
(
String
resp
)
throws
IOException
;
/**
* 校验数据体
*
* @param t
* @return
*/
default
boolean
check
(
T
t
)
{
return
true
;
}
}
}
yanxuan-qc-change-system-integration/src/main/java/com/netease/mail/yanxuan/change/integration/email/email/EmailTemplateRpcResult.java
deleted
100644 → 0
View file @
afb97c99
package
com
.
netease
.
mail
.
yanxuan
.
change
.
integration
.
email
.
email
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.netease.mail.yanxuan.change.integration.email.conig.RpcTemplate
;
import
com.netease.mail.yanxuan.change.common.bean.ResponseCode
;
import
com.netease.mail.yanxuan.change.integration.email.exception.RpcException
;
import
java.io.IOException
;
public
class
EmailTemplateRpcResult
<
T
>
implements
RpcTemplate
.
CallHandler
<
T
>
{
private
static
final
String
CODE
=
"code"
;
private
static
final
String
RESULT
=
"data"
;
private
static
final
String
MESSAGE
=
"errorMessage"
;
private
Class
<
T
>
tClass
;
public
EmailTemplateRpcResult
(
Class
<
T
>
tClass
){
this
.
tClass
=
tClass
;
}
@Override
public
T
handle
(
String
resp
)
throws
IOException
{
JSONObject
rpcResult
=
JSON
.
parseObject
(
resp
);
EmailTemplateResponResult
responResult
=
new
EmailTemplateResponResult
();
int
code
=
rpcResult
.
getIntValue
(
CODE
);
if
(
code
==
ResponseCode
.
SUCCESS
.
getCode
()){
String
data
=
rpcResult
.
getString
(
RESULT
);
responResult
.
setData
(
data
);
return
(
T
)
responResult
;
}
String
errorMessage
=
rpcResult
.
getString
(
MESSAGE
);
throw
new
RpcException
(
"email template response error, code : "
+
code
+
" , errorMessage : "
+
errorMessage
);
}
}
yanxuan-qc-change-system-integration/src/main/java/com/netease/mail/yanxuan/change/integration/email/service/impl/EmailServiceImpl.java
View file @
5e8d1e78
...
@@ -6,6 +6,8 @@ import com.netease.mail.yanxuan.change.integration.email.service.IEmailService;
...
@@ -6,6 +6,8 @@ import com.netease.mail.yanxuan.change.integration.email.service.IEmailService;
import
com.netease.mail.yanxuan.change.integration.email.enums.EmailParamEnum
;
import
com.netease.mail.yanxuan.change.integration.email.enums.EmailParamEnum
;
import
com.netease.mail.yanxuan.change.integration.email.service.UasClientService
;
import
com.netease.mail.yanxuan.change.integration.email.service.UasClientService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -25,6 +27,8 @@ public class EmailServiceImpl implements IEmailService {
...
@@ -25,6 +27,8 @@ public class EmailServiceImpl implements IEmailService {
@Autowired
@Autowired
private
EmailTemplateServiceImpl
emailTemplateService
;
private
EmailTemplateServiceImpl
emailTemplateService
;
Logger
logger
=
LoggerFactory
.
getLogger
(
EmailServiceImpl
.
class
);
@Override
@Override
@Async
(
"asyncEmail"
)
@Async
(
"asyncEmail"
)
public
void
sendEmail
(
String
to
,
EmailFactor
emailFactor
)
{
public
void
sendEmail
(
String
to
,
EmailFactor
emailFactor
)
{
...
@@ -73,7 +77,9 @@ public class EmailServiceImpl implements IEmailService {
...
@@ -73,7 +77,9 @@ public class EmailServiceImpl implements IEmailService {
public
void
sendEmail
(
Collection
<
String
>
toList
,
Collection
<
String
>
ccList
,
EmailFactor
factor
,
public
void
sendEmail
(
Collection
<
String
>
toList
,
Collection
<
String
>
ccList
,
EmailFactor
factor
,
List
<
File
>
fileList
)
{
List
<
File
>
fileList
)
{
if
(
factor
!=
null
)
{
if
(
factor
!=
null
)
{
logger
.
info
(
"请求前参数查看\n"
+
factor
.
getData
().
toString
());
String
content
=
this
.
content
(
factor
);
String
content
=
this
.
content
(
factor
);
logger
.
info
(
"请求后参数查看"
+
factor
.
getData
().
toString
());
String
abnormalTitle
=
(
String
)
factor
.
getData
().
get
(
"abnormalTitle"
);
String
abnormalTitle
=
(
String
)
factor
.
getData
().
get
(
"abnormalTitle"
);
String
taskType
=
(
String
)
factor
.
getData
().
get
(
EmailParamEnum
.
TASK_TYPE
.
getKey
());
String
taskType
=
(
String
)
factor
.
getData
().
get
(
EmailParamEnum
.
TASK_TYPE
.
getKey
());
String
subject
=
factor
.
getSubject
();
String
subject
=
factor
.
getSubject
();
...
...
yanxuan-qc-change-system-integration/src/main/java/com/netease/mail/yanxuan/change/integration/email/service/impl/EmailTemplateServiceImpl.java
View file @
5e8d1e78
package
com
.
netease
.
mail
.
yanxuan
.
change
.
integration
.
email
.
service
.
impl
;
package
com
.
netease
.
mail
.
yanxuan
.
change
.
integration
.
email
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.netease.mail.yanxuan.change.integration.email.conig.RpcTemplate
;
import
com.netease.mail.yanxuan.change.integration.flow.email.EmailTemplateRpcService
;
import
com.netease.mail.yanxuan.change.integration.email.email.EmailTemplateResponResult
;
import
com.netease.yanxuan.flowx.sdk.meta.controller.communal.AjaxResponse
;
import
com.netease.mail.yanxuan.change.integration.email.email.EmailTemplateRpcResult
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -14,22 +14,24 @@ import java.util.Map;
...
@@ -14,22 +14,24 @@ import java.util.Map;
@Service
@Service
public
class
EmailTemplateServiceImpl
{
public
class
EmailTemplateServiceImpl
{
private
static
final
String
TEST_URL
=
"http://127.0.0.1:8550/proxy/test.yanxuan-template.service.mailsaas/templates/flowx/template/assemble.json"
;
/**
* 调用链接
private
static
final
String
ONELINE_URL
=
"http://127.0.0.1:8550/proxy/online
.yanxuan-template.service.mailsaas/templates/flowx/template/assemble.json"
;
* private static final String TEST_URL = "http://127.0.0.1:8550/proxy/test
.yanxuan-template.service.mailsaas/templates/flowx/template/assemble.json";
* private static final String ONELINE_URL = "http://127.0.0.1:8550/proxy/online.yanxuan-template.service.mailsaas/templates/flowx/template/assemble.json";
//@Value("${rpc.url.email.template}")
*/
private
String
url
=
"http://127.0.0.1:8550/proxy/test.yanxuan-template.service.mailsaas/templates/flowx/template/assemble.json"
;
Logger
logger
=
LoggerFactory
.
getLogger
(
EmailTemplateServiceImpl
.
class
)
;
@Autowired
@Autowired
private
RpcTemplate
rpcTemplat
e
;
private
EmailTemplateRpcService
servic
e
;
public
String
template
(
String
templateCode
,
Object
mockData
,
String
type
)
{
public
String
template
(
String
templateCode
,
Object
mockData
,
String
type
)
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"mockData"
,
mockData
);
params
.
put
(
"mockData"
,
mockData
);
params
.
put
(
"templateCode"
,
templateCode
);
params
.
put
(
"templateCode"
,
templateCode
);
params
.
put
(
"type"
,
type
);
params
.
put
(
"type"
,
type
);
EmailTemplateResponResult
emailTemplateResponResult
=
rpcTemplate
.
postJson
(
url
,
new
JSONObject
(
params
).
toJSONString
(),
500
,
new
EmailTemplateRpcResult
<>(
EmailTemplateResponResult
.
class
));
logger
.
info
(
JSONObject
.
toJSONString
(
"邮箱接口参数展示mockData={},templateCode={},type={}"
),
mockData
,
templateCode
,
type
);
return
emailTemplateResponResult
.
getData
();
AjaxResponse
<
String
>
response
=
service
.
template
(
params
);
logger
.
info
(
"请求后参数展示\n"
+
response
);
return
response
.
getData
();
}
}
}
}
yanxuan-qc-change-system-integration/src/main/java/com/netease/mail/yanxuan/change/integration/email/service/impl/IUasClientEhcImpl.java
View file @
5e8d1e78
...
@@ -20,8 +20,6 @@ import com.alibaba.fastjson.JSONObject;
...
@@ -20,8 +20,6 @@ import com.alibaba.fastjson.JSONObject;
@Service
@Service
public
class
IUasClientEhcImpl
implements
IUasEhcClient
{
public
class
IUasClientEhcImpl
implements
IUasEhcClient
{
//请求地址 http://127.0.0.1:8550/proxy/online.logistics-uas.service.mailsaas/push/email/yanxuan-sc-ehc
public
static
final
String
CODE
=
"code"
;
public
static
final
String
CODE
=
"code"
;
private
Logger
logger
=
LoggerFactory
.
getLogger
(
IUasClientEhcImpl
.
class
);
private
Logger
logger
=
LoggerFactory
.
getLogger
(
IUasClientEhcImpl
.
class
);
...
@@ -34,10 +32,6 @@ public class IUasClientEhcImpl implements IUasEhcClient {
...
@@ -34,10 +32,6 @@ public class IUasClientEhcImpl implements IUasEhcClient {
List
<
File
>
fileList
)
{
List
<
File
>
fileList
)
{
if
(!
CollectionUtils
.
isEmpty
(
toList
))
{
if
(!
CollectionUtils
.
isEmpty
(
toList
))
{
Map
<
String
,
String
>
params
=
new
HashMap
();
Map
<
String
,
String
>
params
=
new
HashMap
();
logger
.
error
(
"参数查看"
+
subject
);
if
(
subject
==
null
||
subject
.
equals
(
""
)){
subject
=
"测试标题"
;
}
params
.
put
(
"subject"
,
subject
);
params
.
put
(
"subject"
,
subject
);
params
.
put
(
"content"
,
content
);
params
.
put
(
"content"
,
content
);
if
(!
CollectionUtils
.
isEmpty
(
toList
))
{
if
(!
CollectionUtils
.
isEmpty
(
toList
))
{
...
...
yanxuan-qc-change-system-integration/src/main/java/com/netease/mail/yanxuan/change/integration/email/service/impl/UasClientServiceImpl.java
View file @
5e8d1e78
...
@@ -27,29 +27,16 @@ public class UasClientServiceImpl implements UasClientService {
...
@@ -27,29 +27,16 @@ public class UasClientServiceImpl implements UasClientService {
@Autowired
@Autowired
private
EmailRpcService
service
;
private
EmailRpcService
service
;
/*
*
* emailPath=/push/email/
* rpcConfig.getUasApi()=http://127.0.0.1:8550/proxy/online.logistics-uas.service.mailsaas
* UPLOAD_FILE /push/email/attach/{0}/upload.json
*/
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
)
{
logger
.
info
(
"调用接口111~~~~~~~~~~~~~~~~~~~~~~~~"
);
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
(
"返回信息日志打印\n"
+
res
);
this
.
logger
.
info
(
"[op:sendEmail] res={} "
,
res
);
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
)});
...
...
yanxuan-qc-change-system-integration/src/main/java/com/netease/mail/yanxuan/change/integration/flow/email/EmailRpcService.java
View file @
5e8d1e78
...
@@ -3,7 +3,7 @@ package com.netease.mail.yanxuan.change.integration.flow.email;
...
@@ -3,7 +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.RequestParam
;
import
java.util.Map
;
import
java.util.Map
;
/**
/**
...
@@ -13,14 +13,20 @@ import java.util.Map;
...
@@ -13,14 +13,20 @@ import java.util.Map;
@Service
@Service
@MissaClient
(
serviceCode
=
"logistics-uas"
)
@MissaClient
(
serviceCode
=
"logistics-uas"
)
public
interface
EmailRpcService
{
public
interface
EmailRpcService
{
//templates/flowx/template/assemble.json
//push/email/attach/qc/upload.json
//yanxuan-qc-change-system
@PostMapping
(
"/push/email/attach/qc/upload.json"
)
//@PostMapping("/push/email/attach/yanxuan-qc-change-system/upload.json")
String
sendEmailAttach
(
Map
<
String
,
String
>
params
);
@PostMapping
(
"/push/email/attach/yanxuan-qc-ecr-system/upload.json"
)
String
sendEmail
(
Map
<
String
,
String
>
params
);
@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
);
//yanxuan-sc-ehc
//yanxuan-sc-ehc
@PostMapping
(
"/push/email/
yanxuan-qc-eh
c/upload.json"
)
@PostMapping
(
"/push/email/
q
c/upload.json"
)
String
sendEmailInfo
(
Map
<
String
,
String
>
params
);
String
sendEmailInfo
(
Map
<
String
,
String
>
params
);
}
}
yanxuan-qc-change-system-integration/src/main/java/com/netease/mail/yanxuan/change/integration/flow/email/EmailTemplateRpcService.java
0 → 100644
View file @
5e8d1e78
package
com
.
netease
.
mail
.
yanxuan
.
change
.
integration
.
flow
.
email
;
import
com.netease.yanxuan.flowx.sdk.meta.controller.communal.AjaxResponse
;
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
java.util.Map
;
/**
* @author WangJiaXiang
* @date 2022/11/29/029$
*/
@Service
@MissaClient
(
serviceCode
=
"yanxuan-template"
)
public
interface
EmailTemplateRpcService
{
@PostMapping
(
"/templates/flowx/template/assemble.json"
)
AjaxResponse
<
String
>
template
(
@RequestBody
Map
<
String
,
Object
>
params
);
}
yanxuan-qc-change-system-web/src/main/java/com/netease/mail/yanxuan/change/web/controller/ChangeConfigController.java
View file @
5e8d1e78
...
@@ -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
;
/**
/**
...
@@ -107,59 +109,29 @@ public class ChangeConfigController {
...
@@ -107,59 +109,29 @@ public class ChangeConfigController {
return
service
.
queryConfigType
();
return
service
.
queryConfigType
();
}
}
@Autowired
private
IusRpcService
iusRpcService
;
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ChangeConfigController
.
class
);
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ChangeConfigController
.
class
);
@Autowired
@Autowired
private
UasClientService
iEmailService
;
private
IEmailService
iEmailService
;
@Autowired
private
IUasEhcClient
client
;
@GetMapping
(
"/test"
)
@GetMapping
(
"/test"
)
public
void
queryCommanderInfo
(){
public
void
queryCommanderInfo
(){
EmailFactor
emailFactor
=
new
EmailFactor
();
emailFactor
.
setType
(
EmailTypeEnum
.
TEXT
.
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"
);
client
.
sendEmail
(
"bpm_risk_evaluation_11"
,
"{\n"
+
"\n"
+
"\u200B \"itemId\":\"商品id\",\n"
+
"\n"
+
"\u200B \"itemName\":\"商品名称\",\n"
+
"\n"
+
"\u200B \"sqeId\":\"sqeId\",\n"
+
"\n"
+
"\u200B \"sqeName\":\"sqe名称\",\n"
+
"\n"
+
"\u200B \"createTime\":\"开始时间\",\n"
+
"\n"
+
"\u200B \"flowId\":\"工单id\",\n"
+
"\n"
+
"\u200B \"flowUrl\":\"工单链接\",\n"
+
"\n"
+
"\u200B\t”subject“:\"xxx\"\n"
+
"\n"
+
"}"
,
strings
,
null
,
null
);
}
}
}
}
yanxuan-qc-change-system-web/src/main/resources/application.properties
0 → 100644
View file @
5e8d1e78
dschedule.enable
=
true
dschedule.env
=
test
dschedule.app-id
=
yanxuan-sc-ehc
dschedule.job-group
=
235
dschedule.enable-auto-register
=
true
dschedule.executor-fail-strategy
=
fail_alarm
dschedule.alarm-email
=
wb.tanglongwei@mesg.corp.netease.com
dschedule.adminAddresses
=
http://127.0.0.1:8550/proxy/test.dschedule-admin.service.mailsaas/
# mysql
spring.datasource.driver-class-name
=
com.mysql.jdbc.Driver
spring.datasource.url
=
jdbc:mysql://112.74.86.21/tb_yx_link?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai
spring.datasource.username
=
root
spring.datasource.password
=
wangjiaxiang
#tomcat
server.tomcat.max-threads
=
600
server.tomcat.uri-encoding
=
UTF-8
server.tomcat.basedir
=
/home/logs/access
server.tomcat.accesslog.enabled
=
true
server.tomcat.accesslog.pattern
=
%h %l %u %t "%r" %s %b %{X-Forwarded-For}i %D %{P_INFO}c %{Referer}i %{User-Agent}i %{Host}i
# mybatis
mybatis.mapper-locations
=
classpath:mybatis/mapper/*.xml
mybatis.configuration.cache-enabled
=
true
mybatis.configuration.log-impl
=
org.apache.ibatis.logging.stdout.StdOutImpl
mybatis.configuration.map-underscore-to-camel-case
=
true
# redis
spring.redis.host
=
localhost
spring.redis.password
=
spring.redis.database
=
0
spring.redis.port
=
6379
spring.redis.timeout
=
3000
spring.redis.jedis.pool.max-active
=
8
spring.redis.jedis.pool.max-wait
=
-1
spring.redis.jedis.pool.max-idle
=
500
spring.redis.jedis.pool.min-idle
=
0
spring.redis.lettuce.shutdown-timeout
=
0
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment