Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-notifycenter
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit b1936c9f
authored
Apr 12, 2022
by
levphon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
通知服务-新增发短信接口
1 parent
058263c8
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
10 deletions
src/main/java/cn/com/glsx/notify/modules/api/NotifyApiController.java
src/main/java/cn/com/glsx/notify/modules/utils/RopHttpUtil.java
src/main/java/cn/com/glsx/notify/modules/utils/RopUtils.java
src/test/java/cn/com/glsx/test/NotifyApplicationTests.java
src/main/java/cn/com/glsx/notify/modules/api/NotifyApiController.java
View file @
b1936c9
...
@@ -37,7 +37,7 @@ public class NotifyApiController implements NotifyCenterFeignClient {
...
@@ -37,7 +37,7 @@ public class NotifyApiController implements NotifyCenterFeignClient {
@PostMapping
(
value
=
"/sendSms"
)
@PostMapping
(
value
=
"/sendSms"
)
@ResponseBody
@ResponseBody
public
R
sendSms
(
@RequestBody
SmsMessageRequest
messageRequest
)
{
public
R
sendSms
(
@RequestBody
SmsMessageRequest
messageRequest
)
{
smsService
.
sendSms
(
messageRequest
.
getPhone
(),
messageRequest
.
getTemplate
(),
messageRequest
.
getArgs
().
values
());
smsService
.
sendSms
(
messageRequest
.
getPhone
(),
messageRequest
.
getTemplate
(),
messageRequest
.
getArgs
().
values
()
.
toArray
()
);
return
R
.
ok
();
return
R
.
ok
();
}
}
...
@@ -49,7 +49,7 @@ public class NotifyApiController implements NotifyCenterFeignClient {
...
@@ -49,7 +49,7 @@ public class NotifyApiController implements NotifyCenterFeignClient {
args
.
put
(
"arg1"
,
"刘宇峰"
);
args
.
put
(
"arg1"
,
"刘宇峰"
);
args
.
put
(
"arg2"
,
"B73493098765"
);
args
.
put
(
"arg2"
,
"B73493098765"
);
args
.
put
(
"arg3"
,
1234
);
args
.
put
(
"arg3"
,
1234
);
mailService
.
sendSimpleMail
(
"liuyf@didihu.com.cn"
,
"notifycenter test"
,
"MAIL_TEMPLATE_ORDER_PAID_NOTIFY_OPERATOR"
,
args
.
values
());
mailService
.
sendSimpleMail
(
"liuyf@didihu.com.cn"
,
"notifycenter test"
,
"MAIL_TEMPLATE_ORDER_PAID_NOTIFY_OPERATOR"
,
args
.
values
()
.
toArray
()
);
return
R
.
ok
();
return
R
.
ok
();
}
}
...
...
src/main/java/cn/com/glsx/notify/modules/utils/RopHttpUtil.java
View file @
b1936c9
...
@@ -34,7 +34,7 @@ public class RopHttpUtil {
...
@@ -34,7 +34,7 @@ public class RopHttpUtil {
paramsMap
.
add
(
"method"
,
method
);
paramsMap
.
add
(
"method"
,
method
);
}
}
public
static
<
T
>
T
get
(
MultiValueMap
<
String
,
String
>
paramsMap
,
Class
<
T
>
responseType
,
String
baseurl
,
String
method
)
throws
Exception
{
public
static
<
T
>
T
get
(
MultiValueMap
<
String
,
String
>
paramsMap
,
Class
<
T
>
responseType
,
String
baseurl
,
String
method
)
{
addBaseParam
(
paramsMap
,
method
);
addBaseParam
(
paramsMap
,
method
);
MultiValueMap
<
String
,
String
>
params
=
getSysParams
();
MultiValueMap
<
String
,
String
>
params
=
getSysParams
();
params
.
putAll
(
paramsMap
);
params
.
putAll
(
paramsMap
);
...
@@ -53,7 +53,7 @@ public class RopHttpUtil {
...
@@ -53,7 +53,7 @@ public class RopHttpUtil {
return
forObject
;
return
forObject
;
}
}
public
static
<
T
>
T
post
(
MultiValueMap
<
String
,
String
>
paramsMap
,
Class
<
T
>
responseType
,
String
baseurl
,
String
method
)
throws
Exception
{
public
static
<
T
>
T
post
(
MultiValueMap
<
String
,
String
>
paramsMap
,
Class
<
T
>
responseType
,
String
baseurl
,
String
method
)
{
addBaseParam
(
paramsMap
,
method
);
addBaseParam
(
paramsMap
,
method
);
MultiValueMap
<
String
,
String
>
params
=
getSysParams
();
MultiValueMap
<
String
,
String
>
params
=
getSysParams
();
params
.
putAll
(
paramsMap
);
params
.
putAll
(
paramsMap
);
...
@@ -67,7 +67,7 @@ public class RopHttpUtil {
...
@@ -67,7 +67,7 @@ public class RopHttpUtil {
return
new
RestTemplate
().
postForObject
(
baseurl
,
params
,
responseType
);
return
new
RestTemplate
().
postForObject
(
baseurl
,
params
,
responseType
);
}
}
public
static
<
T
>
T
postE
(
MultiValueMap
<
String
,
String
>
paramsMap
,
Class
<
T
>
responseType
,
String
baseurl
,
String
method
)
throws
Exception
{
public
static
<
T
>
T
postE
(
MultiValueMap
<
String
,
String
>
paramsMap
,
Class
<
T
>
responseType
,
String
baseurl
,
String
method
)
{
addBaseParamE
(
paramsMap
,
method
);
addBaseParamE
(
paramsMap
,
method
);
MultiValueMap
<
String
,
String
>
params
=
getSysParamsE
();
MultiValueMap
<
String
,
String
>
params
=
getSysParamsE
();
params
.
putAll
(
paramsMap
);
params
.
putAll
(
paramsMap
);
...
...
src/main/java/cn/com/glsx/notify/modules/utils/RopUtils.java
View file @
b1936c9
...
@@ -27,7 +27,7 @@ public class RopUtils {
...
@@ -27,7 +27,7 @@ public class RopUtils {
* @return
* @return
*/
*/
public
static
String
signByMd5
(
Map
<
String
,
String
>
paramValues
,
String
secret
)
{
public
static
String
signByMd5
(
Map
<
String
,
String
>
paramValues
,
String
secret
)
{
return
sign
(
paramValues
,
null
,
secret
);
return
sign
ByMd5
(
paramValues
,
null
,
secret
);
}
}
/**
/**
...
...
src/test/java/cn/com/glsx/test/NotifyApplicationTests.java
View file @
b1936c9
...
@@ -3,6 +3,7 @@ package cn.com.glsx.test;
...
@@ -3,6 +3,7 @@ package cn.com.glsx.test;
import
cn.com.glsx.Application
;
import
cn.com.glsx.Application
;
import
cn.com.glsx.notify.dto.request.WechatMessageRequest
;
import
cn.com.glsx.notify.dto.request.WechatMessageRequest
;
import
cn.com.glsx.notify.modules.service.MailService
;
import
cn.com.glsx.notify.modules.service.MailService
;
import
cn.com.glsx.notify.modules.service.SmsService
;
import
com.glsx.plat.common.utils.DateUtils
;
import
com.glsx.plat.common.utils.DateUtils
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
import
org.assertj.core.util.Lists
;
import
org.assertj.core.util.Lists
;
...
@@ -21,8 +22,8 @@ import java.util.Map;
...
@@ -21,8 +22,8 @@ import java.util.Map;
@SpringBootTest
(
classes
=
Application
.
class
,
webEnvironment
=
SpringBootTest
.
WebEnvironment
.
RANDOM_PORT
)
@SpringBootTest
(
classes
=
Application
.
class
,
webEnvironment
=
SpringBootTest
.
WebEnvironment
.
RANDOM_PORT
)
public
class
NotifyApplicationTests
{
public
class
NotifyApplicationTests
{
/*
@Autowired
@Autowired
private SmsService smsService;
*/
private
SmsService
smsService
;
@Autowired
@Autowired
private
MailService
mailService
;
private
MailService
mailService
;
...
@@ -33,12 +34,12 @@ public class NotifyApplicationTests {
...
@@ -33,12 +34,12 @@ public class NotifyApplicationTests {
// @Autowired
// @Autowired
// private WeixinService weixinService;
// private WeixinService weixinService;
/*
@Test
@Test
public
void
testSms
()
{
public
void
testSms
()
{
Map
<
String
,
Object
>
args
=
new
HashMap
<>();
Map
<
String
,
Object
>
args
=
new
HashMap
<>();
args
.
put
(
"code"
,
1234
);
args
.
put
(
"code"
,
1234
);
smsService
.
sendSms
(
"18682185876"
,
"SMS_TEMPLATE_VERIFY_CODE"
,
args
.
values
());
smsService
.
sendSms
(
"18682185876"
,
"SMS_TEMPLATE_VERIFY_CODE"
,
args
.
values
());
}
*/
}
@Test
@Test
public
void
testMail
()
throws
Exception
{
public
void
testMail
()
throws
Exception
{
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment