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
25a9fc00
Commit
25a9fc00
authored
Mar 27, 2021
by
qinxunjia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化
parent
01b28df6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
11 deletions
+21
-11
pom.xml
pom.xml
+1
-1
MessageServiceImpl.java
...ain/java/com/bgy/sms/service/impl/MessageServiceImpl.java
+20
-10
No files found.
pom.xml
View file @
25a9fc00
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
<groupId>
org.example
</groupId>
<groupId>
org.example
</groupId>
<artifactId>
sms-plugin
</artifactId>
<artifactId>
sms-plugin
</artifactId>
<version>
1.0.
4
</version>
<version>
1.0.
5
</version>
<name>
插件服务
</name>
<name>
插件服务
</name>
<description>
DM hub集成插件服务
</description>
<description>
DM hub集成插件服务
</description>
...
...
src/main/java/com/bgy/sms/service/impl/MessageServiceImpl.java
View file @
25a9fc00
...
@@ -66,6 +66,10 @@ public class MessageServiceImpl implements MessageService {
...
@@ -66,6 +66,10 @@ public class MessageServiceImpl implements MessageService {
String
templateId
=
null
;
String
templateId
=
null
;
try
{
try
{
String
templateContent
=
requestDTO
.
getTemplateContent
();
String
templateContent
=
requestDTO
.
getTemplateContent
();
boolean
baseCheck
=
this
.
checkSendContent
(
templateContent
);
if
(
baseCheck
)
{
return
new
DmHubResponse
(
"500"
,
"短信模板不能包含换行符"
);
}
String
signature
=
requestDTO
.
getSignature
();
String
signature
=
requestDTO
.
getSignature
();
String
smsType
=
requestDTO
.
getSmsType
();
String
smsType
=
requestDTO
.
getSmsType
();
String
tenantId
=
requestDTO
.
getTenantId
();
String
tenantId
=
requestDTO
.
getTenantId
();
...
@@ -85,8 +89,9 @@ public class MessageServiceImpl implements MessageService {
...
@@ -85,8 +89,9 @@ public class MessageServiceImpl implements MessageService {
.
eq
(
"tenant_id"
,
tenantId
)
.
eq
(
"tenant_id"
,
tenantId
)
);
);
if
(
dbInfo
!=
null
)
{
if
(
dbInfo
!=
null
)
{
log
.
error
(
"Dm Hub请求创建模板,模板id已存在,模板id:【{}】"
,
templateId
);
// log.error("Dm Hub请求创建模板,模板id已存在,模板id:【{}】", templateId);
return
new
DmHubResponse
(
ResponseCode
.
TEMPLATE_ALREADY_EXISTED
);
// return new DmHubResponse(ResponseCode.TEMPLATE_ALREADY_EXISTED);
smsTemplateService
.
deleteById
(
dbInfo
.
getId
());
}
}
String
areaId
=
messageMapper
.
selectAreaId
();
String
areaId
=
messageMapper
.
selectAreaId
();
if
(
StringUtils
.
isBlank
(
areaId
))
{
if
(
StringUtils
.
isBlank
(
areaId
))
{
...
@@ -130,9 +135,6 @@ public class MessageServiceImpl implements MessageService {
...
@@ -130,9 +135,6 @@ public class MessageServiceImpl implements MessageService {
updateInfo
.
setId
(
pkID
);
updateInfo
.
setId
(
pkID
);
smsTemplateService
.
updateById
(
updateInfo
);
smsTemplateService
.
updateById
(
updateInfo
);
return
new
DmHubResponse
(
ResponseCode
.
SUCCESS
);
return
new
DmHubResponse
(
ResponseCode
.
SUCCESS
);
}
else
{
boolean
b
=
smsTemplateService
.
deleteById
(
info
.
getId
());
return
new
DmHubResponse
(
code
,
msg
);
}
}
}
}
}
catch
(
Exception
exception
)
{
}
catch
(
Exception
exception
)
{
...
@@ -144,13 +146,21 @@ public class MessageServiceImpl implements MessageService {
...
@@ -144,13 +146,21 @@ public class MessageServiceImpl implements MessageService {
return
responseDTO
;
return
responseDTO
;
}
}
/***
* 校验初始模板内容
* @param templateContent
*/
private
boolean
checkSendContent
(
String
templateContent
)
{
return
templateContent
.
contains
(
"\n"
);
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
String
str
=
"dafdsfads
fadfadf]
"
;
String
str
=
"dafdsfads
\nfadfadf
"
;
String
regEx
=
"[\\[\\]()()【】]"
;
String
regEx
=
"[\\[\\]()()【】]"
;
Pattern
p
=
Pattern
.
compile
(
regEx
);
if
(
str
.
contains
(
"\n"
))
{
Matcher
m
=
p
.
matcher
(
str
);
String
a
=
""
;
boolean
b
=
m
.
find
();
}
System
.
out
.
println
(
b
);
}
}
private
boolean
checkContent
(
String
upCreateStr
)
{
private
boolean
checkContent
(
String
upCreateStr
)
{
...
...
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