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
01b28df6
Commit
01b28df6
authored
Mar 19, 2021
by
qinxunjia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化
parent
3290e610
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
0 deletions
+31
-0
BgySmsServiceImpl.java
...m/bgy/sms/channel/bgy/service/impl/BgySmsServiceImpl.java
+5
-0
MessageServiceImpl.java
...ain/java/com/bgy/sms/service/impl/MessageServiceImpl.java
+26
-0
No files found.
src/main/java/com/bgy/sms/channel/bgy/service/impl/BgySmsServiceImpl.java
View file @
01b28df6
...
...
@@ -133,6 +133,11 @@ public class BgySmsServiceImpl implements BgySmsService {
String
retCode
=
retJson
.
getString
(
"ret"
);
String
retPack
=
retJson
.
getString
(
"package"
);
if
(!
sendSuccessCode
.
equals
(
retCode
))
{
if
(
err
.
contains
(
"成功0条"
))
{
return
new
CLBizResponse
(
ResponseCode
.
UPSTREAM_FAIL
.
getCode
(),
StringUtils
.
isNotBlank
(
err
)
?
"碧桂园短信发送接口返回:"
+
err
:
"碧桂园短信发送接口返回空"
);
}
else
if
(
err
.
contains
(
"成功"
))
{
return
new
CLBizResponse
(
ResponseCode
.
SUCCESS
);
}
return
new
CLBizResponse
(
ResponseCode
.
UPSTREAM_FAIL
.
getCode
(),
StringUtils
.
isNotBlank
(
err
)
?
"碧桂园短信发送接口返回:"
+
err
:
"碧桂园短信发送接口返回空"
);
}
else
{
return
new
CLBizResponse
(
ResponseCode
.
SUCCESS
);
...
...
src/main/java/com/bgy/sms/service/impl/MessageServiceImpl.java
View file @
01b28df6
...
...
@@ -75,6 +75,10 @@ public class MessageServiceImpl implements MessageService {
TemplateChangeBean
bean
=
dmHub2BgyTemplateSend
(
templateContent
);
String
bgySendStr
=
bean
.
getUpSendStr
();
String
upCreateStr
=
bean
.
getUpCreateStr
();
boolean
check
=
checkContent
(
upCreateStr
);
if
(!
check
)
{
return
new
DmHubResponse
(
"500"
,
"短信模板不能包含以下特殊内容:()()【】[]"
);
}
String
params
=
bean
.
getParams
().
toString
();
SmsTemplateInfo
dbInfo
=
smsTemplateService
.
selectOne
(
new
EntityWrapper
<
SmsTemplateInfo
>()
.
eq
(
"dm_template_id"
,
templateId
)
...
...
@@ -127,6 +131,7 @@ public class MessageServiceImpl implements MessageService {
smsTemplateService
.
updateById
(
updateInfo
);
return
new
DmHubResponse
(
ResponseCode
.
SUCCESS
);
}
else
{
boolean
b
=
smsTemplateService
.
deleteById
(
info
.
getId
());
return
new
DmHubResponse
(
code
,
msg
);
}
}
...
...
@@ -139,6 +144,27 @@ public class MessageServiceImpl implements MessageService {
return
responseDTO
;
}
public
static
void
main
(
String
[]
args
)
{
String
str
=
"dafdsfadsfadfadf]"
;
String
regEx
=
"[\\[\\]()()【】]"
;
Pattern
p
=
Pattern
.
compile
(
regEx
);
Matcher
m
=
p
.
matcher
(
str
);
boolean
b
=
m
.
find
();
System
.
out
.
println
(
b
);
}
private
boolean
checkContent
(
String
upCreateStr
)
{
String
regEx
=
"[\\[\\]()()【】]"
;
Pattern
p
=
Pattern
.
compile
(
regEx
);
Matcher
m
=
p
.
matcher
(
upCreateStr
);
boolean
b
=
m
.
find
();
if
(
b
)
{
log
.
error
(
"Dm Hub请求创建模板,模板包含特殊内容:()()【】"
);
return
false
;
}
return
true
;
}
/**
* 将DM HUb的模板装成可以简单模式模板,用户后续参数封装
...
...
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