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
53c312a4
Commit
53c312a4
authored
Jul 09, 2020
by
fuwanli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
"单条部分"
parent
f0999109
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
14 deletions
+25
-14
DmHubApi.java
src/main/java/com/bgy/sms/channel/api/DmHubApi.java
+3
-1
BgySmsService.java
...n/java/com/bgy/sms/channel/bgy/service/BgySmsService.java
+1
-2
BgySmsServiceImpl.java
...m/bgy/sms/channel/bgy/service/impl/BgySmsServiceImpl.java
+3
-2
MessageServiceImpl.java
...ain/java/com/bgy/sms/service/impl/MessageServiceImpl.java
+18
-9
No files found.
src/main/java/com/bgy/sms/channel/api/DmHubApi.java
View file @
53c312a4
...
...
@@ -101,6 +101,9 @@ public class DmHubApi {
if
(!
checkResult
)
{
return
new
DmHubResponse
(
"555"
,
"接口请求签名校验不通过"
);
}
response
=
messageService
.
batchSendOneByOne
(
request
);
response
.
setCode
(
response
.
getError
().
getString
(
"errorCode"
));
}
catch
(
Exception
e
)
{
...
...
@@ -137,7 +140,6 @@ public class DmHubApi {
if
(!
checkResult
)
{
return
new
DmHubResponse
(
"555"
,
"签名校验不通过"
);
}
response
=
messageService
.
send
(
request
);
response
.
setCode
(
response
.
getError
().
getString
(
"errorCode"
));
}
catch
(
Exception
e
)
{
...
...
src/main/java/com/bgy/sms/channel/bgy/service/BgySmsService.java
View file @
53c312a4
...
...
@@ -9,10 +9,9 @@ public interface BgySmsService {
CLBizResponse
sendSms
(
String
mobile
,
String
content
,
String
areaId
,
String
api
)
throws
Exception
;
CLBizResponse
sendbatchSms
(
String
mobile
,
String
areaId
,
String
api
)
throws
Exception
;
CLBizResponse
sendbatchSms
(
String
data
,
String
areaId
,
String
api
,
String
templateId
)
throws
Exception
;
CLBizResponse
createTemplate
(
String
content
,
String
account
,
String
templateType
,
String
pkID
)
throws
Exception
;
void
asyncNotify
(
TemplateNotify
templateNotify
);
}
src/main/java/com/bgy/sms/channel/bgy/service/impl/BgySmsServiceImpl.java
View file @
53c312a4
...
...
@@ -84,7 +84,7 @@ public class BgySmsServiceImpl implements BgySmsService {
}
@Override
public
CLBizResponse
sendbatchSms
(
String
data
,
String
areaId
,
String
api
)
throws
Exception
{
public
CLBizResponse
sendbatchSms
(
String
data
,
String
areaId
,
String
api
,
String
templateId
)
throws
Exception
{
log
.
info
(
"进入碧桂园短信发送接口"
);
String
appId
=
BgySMSConfig
.
appId
;
// String areaId = BgySMSConfig.areaId;
...
...
@@ -96,8 +96,9 @@ public class BgySmsServiceImpl implements BgySmsService {
requestParams
.
put
(
"appId"
,
appId
);
requestParams
.
put
(
"security"
,
Md5Util
.
encrypt
(
appId
+
securityCode
.
toUpperCase
()));
requestParams
.
put
(
"areaId"
,
areaId
);
requestParams
.
put
(
"templateId"
,
templateId
);
requestParams
.
put
(
"data"
,
data
);
log
.
info
(
"碧桂园短信接口参数:{}"
,
requestParams
);
log
.
info
(
"碧桂园短信接口参数:{}"
,
requestParams
);
//TODO
String
retStr
=
SendSmsUtil
.
sendSmsByPost
(
url
,
JSONObject
.
toJSONString
(
requestParams
));
log
.
info
(
"碧桂园短信接口返回信息:{}"
,
retStr
);
if
(
retStr
==
null
)
{
...
...
src/main/java/com/bgy/sms/service/impl/MessageServiceImpl.java
View file @
53c312a4
...
...
@@ -383,13 +383,18 @@ public class MessageServiceImpl implements MessageService {
return
new
DmHubResponse
(
"999"
,
"短信插件未获取到模板信息"
);
}
if
(
templateInfo
.
getTemplateRecordId
()
==
null
){
return
new
DmHubResponse
(
"1001"
,
"当前模板暂未审核,请重新选择"
);
}
String
api
=
""
;
if
(
"marketing"
.
equals
(
templateInfo
.
getType
()))
{
api
=
"SendYXSMS"
;
}
else
{
api
=
"SendNotifySMS"
;
}
//模板流水号
String
templateRecordId
=
templateInfo
.
getTemplateRecordId
();
String
smsType
=
templateInfo
.
getType
();
String
templateName
=
templateInfo
.
getTemplateName
();
String
[]
split
=
templateName
.
split
(
"_"
);
...
...
@@ -474,11 +479,13 @@ public class MessageServiceImpl implements MessageService {
sysRecordInfo
.
setAreaId
(
channelAccount
);
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
();
String
content
=
templateInfo
.
getUpContent
();
for
(
String
mobile
:
mobileList
)
{
JSONObject
jsonObject
=
new
JSONObject
();
//JSONObject jsonObject = new JSONObject();
Map
<
String
,
String
>
jsonObject
=
new
HashMap
<>();
mobiles
.
append
(
mobile
+
","
);
jsonObject
.
put
(
"mobile"
,
mobile
);
jsonObject
.
put
(
"content"
,
content
);
...
...
@@ -486,7 +493,7 @@ public class MessageServiceImpl implements MessageService {
}
try
{
if
(!
list
.
isEmpty
())
{
response
=
bgySmsService
.
sendbatchSms
(
list
.
toString
(),
areaId
,
api
);
response
=
bgySmsService
.
sendbatchSms
(
list
.
toString
(),
areaId
,
api
,
templateRecordId
);
String
code
=
response
.
getCode
();
if
(
code
.
equals
(
ResponseCode
.
SUCCESS
.
getCode
()))
{
sysRecordInfo
.
setChargeNum
(
list
.
size
());
...
...
@@ -519,7 +526,8 @@ public class MessageServiceImpl implements MessageService {
}
else
{
// 变量短信
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
<>();
StringBuilder
mobiles
=
new
StringBuilder
();
String
content
=
templateInfo
.
getUpContent
();
for
(
Map
.
Entry
<
String
,
List
<
String
>>
entry
:
entries
)
{
...
...
@@ -527,15 +535,16 @@ public class MessageServiceImpl implements MessageService {
List
<
String
>
paramsList
=
entry
.
getValue
();
String
sendMsg
=
getMsg
(
templateInfo
.
getUpContent
(),
paramsList
);
JSONObject
jsonObject
=
new
JSONObject
();
// JSONObject jsonObject = new JSONObject();
Map
<
String
,
String
>
jsonObject
=
new
HashMap
<>();
mobiles
.
append
(
mobile
+
","
);
jsonObject
.
put
(
"
m
obile"
,
mobile
);
jsonObject
.
put
(
"
c
ontent"
,
sendMsg
);
jsonObject
.
put
(
"
M
obile"
,
mobile
);
jsonObject
.
put
(
"
C
ontent"
,
sendMsg
);
list
.
add
(
jsonObject
);
}
try
{
response
=
bgySmsService
.
sendbatchSms
(
list
.
toString
(),
areaId
,
api
);
response
=
bgySmsService
.
sendbatchSms
(
list
.
toString
(),
areaId
,
api
,
templateRecordId
);
String
code
=
response
.
getCode
();
if
(
code
.
equals
(
ResponseCode
.
SUCCESS
.
getCode
()))
{
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