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
03962140
Commit
03962140
authored
Jul 13, 2020
by
qinxunjia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改格式
parent
53c312a4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
15 deletions
+12
-15
MessageServiceImpl.java
...ain/java/com/bgy/sms/service/impl/MessageServiceImpl.java
+12
-15
No files found.
src/main/java/com/bgy/sms/service/impl/MessageServiceImpl.java
View file @
03962140
...
@@ -291,7 +291,7 @@ public class MessageServiceImpl implements MessageService {
...
@@ -291,7 +291,7 @@ public class MessageServiceImpl implements MessageService {
api
=
"SendNotifySMS"
;
api
=
"SendNotifySMS"
;
}
}
response
=
bgySmsService
.
sendSms
(
mobile
,
content
,
areaId
,
api
);
response
=
bgySmsService
.
sendSms
(
mobile
,
content
,
areaId
,
api
);
//4.短信发送记录
//4.短信发送记录
SysRecordInfo
sysRecordInfo
=
new
SysRecordInfo
();
SysRecordInfo
sysRecordInfo
=
new
SysRecordInfo
();
...
@@ -343,7 +343,7 @@ public class MessageServiceImpl implements MessageService {
...
@@ -343,7 +343,7 @@ public class MessageServiceImpl implements MessageService {
codeInfo
.
setMobile
(
mobile
);
codeInfo
.
setMobile
(
mobile
);
codeInfo
.
setDateCreated
(
new
Date
());
codeInfo
.
setDateCreated
(
new
Date
());
dmCodeService
.
insert
(
codeInfo
);
dmCodeService
.
insert
(
codeInfo
);
response
=
bgySmsService
.
sendSms
(
mobile
,
content
,
BgySMSConfig
.
areaId
,
null
);
response
=
bgySmsService
.
sendSms
(
mobile
,
content
,
BgySMSConfig
.
areaId
,
null
);
String
retCode
=
response
.
getCode
();
String
retCode
=
response
.
getCode
();
if
(
retCode
.
equals
(
ResponseCode
.
SUCCESS
.
getCode
()))
{
if
(
retCode
.
equals
(
ResponseCode
.
SUCCESS
.
getCode
()))
{
return
new
DmHubResponse
(
ResponseCode
.
SUCCESS
);
return
new
DmHubResponse
(
ResponseCode
.
SUCCESS
);
...
@@ -383,7 +383,7 @@ public class MessageServiceImpl implements MessageService {
...
@@ -383,7 +383,7 @@ public class MessageServiceImpl implements MessageService {
return
new
DmHubResponse
(
"999"
,
"短信插件未获取到模板信息"
);
return
new
DmHubResponse
(
"999"
,
"短信插件未获取到模板信息"
);
}
}
if
(
templateInfo
.
getTemplateRecordId
()
==
null
){
if
(
templateInfo
.
getTemplateRecordId
()
==
null
)
{
return
new
DmHubResponse
(
"1001"
,
"当前模板暂未审核,请重新选择"
);
return
new
DmHubResponse
(
"1001"
,
"当前模板暂未审核,请重新选择"
);
}
}
...
@@ -479,21 +479,19 @@ public class MessageServiceImpl implements MessageService {
...
@@ -479,21 +479,19 @@ public class MessageServiceImpl implements MessageService {
sysRecordInfo
.
setAreaId
(
channelAccount
);
sysRecordInfo
.
setAreaId
(
channelAccount
);
if
(
paramsArr
==
null
||
paramsArr
.
isEmpty
())
{
if
(
paramsArr
==
null
||
paramsArr
.
isEmpty
())
{
// List<JSONObject> list = new ArrayList<>();
List
<
JSONObject
>
list
=
new
ArrayList
<>();
List
<
Map
<
String
,
String
>>
list
=
new
ArrayList
<>();
StringBuilder
mobiles
=
new
StringBuilder
();
StringBuilder
mobiles
=
new
StringBuilder
();
String
content
=
templateInfo
.
getUpContent
();
String
content
=
templateInfo
.
getUpContent
();
for
(
String
mobile
:
mobileList
)
{
for
(
String
mobile
:
mobileList
)
{
//JSONObject jsonObject = new JSONObject();
JSONObject
jsonObject
=
new
JSONObject
();
Map
<
String
,
String
>
jsonObject
=
new
HashMap
<>();
mobiles
.
append
(
mobile
+
","
);
mobiles
.
append
(
mobile
+
","
);
jsonObject
.
put
(
"
m
obile"
,
mobile
);
jsonObject
.
put
(
"
M
obile"
,
mobile
);
jsonObject
.
put
(
"
c
ontent"
,
content
);
jsonObject
.
put
(
"
C
ontent"
,
content
);
list
.
add
(
jsonObject
);
list
.
add
(
jsonObject
);
}
}
try
{
try
{
if
(!
list
.
isEmpty
())
{
if
(!
list
.
isEmpty
())
{
response
=
bgySmsService
.
sendbatchSms
(
list
.
toString
(),
areaId
,
api
,
templateRecordId
);
response
=
bgySmsService
.
sendbatchSms
(
JSONObject
.
toJSONString
(
list
),
areaId
,
api
,
templateRecordId
);
String
code
=
response
.
getCode
();
String
code
=
response
.
getCode
();
if
(
code
.
equals
(
ResponseCode
.
SUCCESS
.
getCode
()))
{
if
(
code
.
equals
(
ResponseCode
.
SUCCESS
.
getCode
()))
{
sysRecordInfo
.
setChargeNum
(
list
.
size
());
sysRecordInfo
.
setChargeNum
(
list
.
size
());
...
@@ -527,7 +525,7 @@ public class MessageServiceImpl implements MessageService {
...
@@ -527,7 +525,7 @@ public class MessageServiceImpl implements MessageService {
// 变量短信
// 变量短信
Set
<
Map
.
Entry
<
String
,
List
<
String
>>>
entries
=
paramsMap
.
entrySet
();
Set
<
Map
.
Entry
<
String
,
List
<
String
>>>
entries
=
paramsMap
.
entrySet
();
// List<JSONObject> list = new ArrayList<>();
// List<JSONObject> list = new ArrayList<>();
List
<
Map
<
String
,
String
>
>
list
=
new
ArrayList
<>();
List
<
JSONObject
>
list
=
new
ArrayList
<>();
StringBuilder
mobiles
=
new
StringBuilder
();
StringBuilder
mobiles
=
new
StringBuilder
();
String
content
=
templateInfo
.
getUpContent
();
String
content
=
templateInfo
.
getUpContent
();
for
(
Map
.
Entry
<
String
,
List
<
String
>>
entry
:
entries
)
{
for
(
Map
.
Entry
<
String
,
List
<
String
>>
entry
:
entries
)
{
...
@@ -535,8 +533,7 @@ public class MessageServiceImpl implements MessageService {
...
@@ -535,8 +533,7 @@ public class MessageServiceImpl implements MessageService {
List
<
String
>
paramsList
=
entry
.
getValue
();
List
<
String
>
paramsList
=
entry
.
getValue
();
String
sendMsg
=
getMsg
(
templateInfo
.
getUpContent
(),
paramsList
);
String
sendMsg
=
getMsg
(
templateInfo
.
getUpContent
(),
paramsList
);
// JSONObject jsonObject = new JSONObject();
JSONObject
jsonObject
=
new
JSONObject
();
Map
<
String
,
String
>
jsonObject
=
new
HashMap
<>();
mobiles
.
append
(
mobile
+
","
);
mobiles
.
append
(
mobile
+
","
);
jsonObject
.
put
(
"Mobile"
,
mobile
);
jsonObject
.
put
(
"Mobile"
,
mobile
);
jsonObject
.
put
(
"Content"
,
sendMsg
);
jsonObject
.
put
(
"Content"
,
sendMsg
);
...
@@ -544,7 +541,7 @@ public class MessageServiceImpl implements MessageService {
...
@@ -544,7 +541,7 @@ public class MessageServiceImpl implements MessageService {
}
}
try
{
try
{
response
=
bgySmsService
.
sendbatchSms
(
list
.
toString
(),
areaId
,
api
,
templateRecordId
);
response
=
bgySmsService
.
sendbatchSms
(
JSONObject
.
toJSONString
(
list
),
areaId
,
api
,
templateRecordId
);
String
code
=
response
.
getCode
();
String
code
=
response
.
getCode
();
if
(
code
.
equals
(
ResponseCode
.
SUCCESS
.
getCode
()))
{
if
(
code
.
equals
(
ResponseCode
.
SUCCESS
.
getCode
()))
{
sysRecordInfo
.
setChargeNum
(
list
.
size
());
sysRecordInfo
.
setChargeNum
(
list
.
size
());
...
...
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