Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dmhub-plugin
Project
Project
Details
Activity
Releases
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
qinxunjia
dmhub-plugin
Commits
3290e610
Commit
3290e610
authored
Feb 26, 2021
by
qinxunjia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
日志记录
parent
03019183
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
DmHubApi.java
src/main/java/com/bgy/sms/channel/api/DmHubApi.java
+7
-0
BgySmsServiceImpl.java
...m/bgy/sms/channel/bgy/service/impl/BgySmsServiceImpl.java
+12
-0
No files found.
src/main/java/com/bgy/sms/channel/api/DmHubApi.java
View file @
3290e610
...
...
@@ -41,6 +41,7 @@ public class DmHubApi {
*/
@PostMapping
(
"/sms/template"
)
public
String
template
(
@RequestBody
DmHubTemplateRequest
params
,
String
appId
,
String
timestamp
,
String
signature
)
{
log
.
info
(
"**********创建模板接口入参*******:{},\r\n appId:{},timestamp:{},signature:{}"
,
JSONObject
.
toJSONString
(
params
),
appId
,
timestamp
,
signature
);
try
{
boolean
checkResult
=
this
.
checkSignature
(
timestamp
,
signature
);
...
...
@@ -95,6 +96,7 @@ public class DmHubApi {
public
DmHubResponse
batch
(
@RequestBody
DmHubBatchSendRequest
request
,
String
appId
,
String
timestamp
,
String
signature
)
{
log
.
info
(
"**********批量发送入参*******:{},\r\n appId:{},timestamp:{},signature:{}"
,
JSONObject
.
toJSONString
(
request
),
appId
,
timestamp
,
signature
);
DmHubResponse
response
;
long
start
=
System
.
currentTimeMillis
();
try
{
boolean
checkResult
=
this
.
checkSignature
(
timestamp
,
signature
);
if
(!
checkResult
)
{
...
...
@@ -105,7 +107,9 @@ public class DmHubApi {
log
.
error
(
"发送批量短信异常"
,
e
);
response
=
new
DmHubResponse
(
ResponseCode
.
SYSTEM_ERROR
);
}
long
end
=
System
.
currentTimeMillis
();
log
.
info
(
"**********批量发送出参*******:{}"
,
JSONObject
.
toJSONString
(
response
));
log
.
info
(
"**********批量发送耗时*******:{}ms"
,
end
-
start
);
return
response
;
}
...
...
@@ -129,6 +133,7 @@ public class DmHubApi {
@RequestMapping
(
"/sms/send"
)
public
DmHubResponse
send
(
@RequestBody
DmHubSendRequest
request
,
String
appId
,
String
timestamp
,
String
signature
)
{
log
.
info
(
"**********单条发送入参*******:{},\r\n appId:{},timestamp:{},signature:{}"
,
JSONObject
.
toJSONString
(
request
),
appId
,
timestamp
,
signature
);
long
start
=
System
.
currentTimeMillis
();
DmHubResponse
response
;
try
{
boolean
checkResult
=
this
.
checkSignature
(
timestamp
,
signature
);
...
...
@@ -140,7 +145,9 @@ public class DmHubApi {
log
.
error
(
"发送单条短信异常"
,
e
);
response
=
new
DmHubResponse
(
ResponseCode
.
SYSTEM_ERROR
);
}
long
end
=
System
.
currentTimeMillis
();
log
.
info
(
"**********单条发送出参*******:{}"
,
JSONObject
.
toJSONString
(
response
));
log
.
info
(
"**********单条发送耗时*******:{}ms"
,
end
-
start
);
return
response
;
}
...
...
src/main/java/com/bgy/sms/channel/bgy/service/impl/BgySmsServiceImpl.java
View file @
3290e610
...
...
@@ -61,6 +61,7 @@ public class BgySmsServiceImpl implements BgySmsService {
@Override
public
CLBizResponse
sendSms
(
String
mobile
,
String
content
,
String
areaId
,
String
subModule
,
String
api
)
throws
Exception
{
log
.
info
(
"进入碧桂园短信发送接口"
);
String
appId
=
BgySMSConfig
.
appId
;
String
securityCode
=
BgySMSConfig
.
securityCode
;
String
url
=
BgySMSConfig
.
url
;
...
...
@@ -76,8 +77,11 @@ public class BgySmsServiceImpl implements BgySmsService {
requestParams
.
put
(
"content"
,
content
);
requestParams
.
put
(
"mobile"
,
mobile
);
log
.
info
(
"碧桂园短信接口参数:{}"
,
JSONObject
.
toJSONString
(
requestParams
));
long
start
=
System
.
currentTimeMillis
();
String
retStr
=
SendSmsUtil
.
sendSmsByPost
(
url
,
JSONObject
.
toJSONString
(
requestParams
));
log
.
info
(
"碧桂园短信接口返回信息:{}"
,
retStr
);
long
end
=
System
.
currentTimeMillis
();
log
.
info
(
"**********碧桂园短信接口耗时*******:{}ms"
,
end
-
start
);
if
(
retStr
==
null
)
{
return
new
CLBizResponse
(
ResponseCode
.
UPSTREAM_BLANK
);
}
...
...
@@ -95,6 +99,11 @@ public class BgySmsServiceImpl implements BgySmsService {
}
}
public
static
void
main
(
String
[]
args
)
{
String
encrypt
=
Md5Util
.
encrypt
(
"1023"
+
"f80a1c5c-8f90-401a-98a1-221af5db0a9b"
.
toUpperCase
());
System
.
out
.
println
(
encrypt
);
}
@Override
public
CLBizResponse
sendBatchSms
(
List
<
JSONObject
>
data
,
String
areaId
,
String
subModule
,
String
api
,
String
templateId
)
throws
Exception
{
log
.
info
(
"进入碧桂园短信发送接口"
);
...
...
@@ -110,9 +119,12 @@ public class BgySmsServiceImpl implements BgySmsService {
requestParams
.
put
(
"templateId"
,
templateId
);
requestParams
.
put
(
"data"
,
data
);
log
.
info
(
"碧桂园短信接口参数:{}"
,
JSONObject
.
toJSONString
(
requestParams
));
long
start
=
System
.
currentTimeMillis
();
String
reqStr
=
JSONObject
.
toJSONString
(
requestParams
);
String
retStr
=
SendSmsUtil
.
sendSmsByPost
(
url
,
reqStr
);
log
.
info
(
"碧桂园短信接口返回信息:{}"
,
retStr
);
long
end
=
System
.
currentTimeMillis
();
log
.
info
(
"**********碧桂园短信接口耗时*******:{}ms"
,
end
-
start
);
if
(
retStr
==
null
)
{
return
new
CLBizResponse
(
ResponseCode
.
UPSTREAM_BLANK
);
}
...
...
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