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
4651db99
Commit
4651db99
authored
Jul 29, 2020
by
qinxunjia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
短信插件的优化
parent
b90775e7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
13 deletions
+30
-13
DmHubApi.java
src/main/java/com/bgy/sms/channel/api/DmHubApi.java
+11
-5
TemplateResponse.java
src/main/java/com/bgy/sms/channel/dto/TemplateResponse.java
+17
-0
MessageServiceImpl.java
...ain/java/com/bgy/sms/service/impl/MessageServiceImpl.java
+0
-6
application.yml
src/main/resources/application.yml
+2
-2
No files found.
src/main/java/com/bgy/sms/channel/api/DmHubApi.java
View file @
4651db99
...
@@ -40,19 +40,25 @@ public class DmHubApi {
...
@@ -40,19 +40,25 @@ public class DmHubApi {
* @return
* @return
*/
*/
@PostMapping
(
"/sms/template"
)
@PostMapping
(
"/sms/template"
)
public
void
template
(
@RequestBody
DmHubTemplateRequest
params
,
String
appId
,
String
timestamp
,
String
signature
)
{
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
);
log
.
info
(
"**********创建模板接口入参*******:{},\r\n appId:{},timestamp:{},signature:{}"
,
JSONObject
.
toJSONString
(
params
),
appId
,
timestamp
,
signature
);
DmHubResponse
response
;
try
{
try
{
boolean
checkResult
=
this
.
checkSignature
(
timestamp
,
signature
);
boolean
checkResult
=
this
.
checkSignature
(
timestamp
,
signature
);
if
(!
checkResult
)
{
if
(!
checkResult
)
{
xiaoShuService
.
updateDmhubSmsTempStatus
(
REJECTED
,
params
.
getTemplateId
(),
"接口请求签名校验不通过"
);
log
.
info
(
"**********创建模板接口出参*******:{}"
,
"接口请求签名校验不通过"
);
log
.
info
(
"**********创建模板接口出参*******:{}"
,
"接口请求签名校验不通过"
);
return
JSONObject
.
toJSONString
(
new
DmHubResponse
(
"999"
,
"接口请求签名校验不通过"
));
}
DmHubResponse
dmHubResponse
=
messageService
.
createTemplate
(
params
);
if
(
ResponseCode
.
SUCCESS
.
getCode
().
equals
(
dmHubResponse
.
getCode
()))
{
String
retJson
=
JSONObject
.
toJSONString
(
new
TemplateResponse
());
log
.
info
(
"返回内容:{}"
,
retJson
);
return
retJson
;
}
else
{
return
JSONObject
.
toJSONString
(
dmHubResponse
);
}
}
messageService
.
createTemplate
(
params
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"创建模板短信异常"
,
e
);
log
.
error
(
"创建模板短信异常"
,
e
);
new
DmHubResponse
(
"999"
,
"创建模板短信异常"
);
return
JSONObject
.
toJSONString
(
new
DmHubResponse
(
"999"
,
"创建模板短信异常"
)
);
}
}
}
}
...
...
src/main/java/com/bgy/sms/channel/dto/TemplateResponse.java
0 → 100644
View file @
4651db99
package
com
.
bgy
.
sms
.
channel
.
dto
;
public
class
TemplateResponse
{
private
String
status
;
public
TemplateResponse
()
{
status
=
"applying"
;
}
public
void
setStatus
(
String
status
)
{
this
.
status
=
status
;
}
public
String
getStatus
()
{
return
status
;
}
}
src/main/java/com/bgy/sms/service/impl/MessageServiceImpl.java
View file @
4651db99
...
@@ -81,7 +81,6 @@ public class MessageServiceImpl implements MessageService {
...
@@ -81,7 +81,6 @@ public class MessageServiceImpl implements MessageService {
);
);
if
(
dbInfo
!=
null
)
{
if
(
dbInfo
!=
null
)
{
log
.
error
(
"Dm Hub请求创建模板,模板id已存在,模板id:【{}】"
,
templateId
);
log
.
error
(
"Dm Hub请求创建模板,模板id已存在,模板id:【{}】"
,
templateId
);
xiaoShuService
.
updateDmhubSmsTempStatus
(
REJECTED
,
templateId
,
"模板id已存在,请重新创建"
);
return
new
DmHubResponse
(
ResponseCode
.
TEMPLATE_ALREADY_EXISTED
);
return
new
DmHubResponse
(
ResponseCode
.
TEMPLATE_ALREADY_EXISTED
);
}
}
SmsTemplateInfo
info
=
new
SmsTemplateInfo
();
SmsTemplateInfo
info
=
new
SmsTemplateInfo
();
...
@@ -99,8 +98,6 @@ public class MessageServiceImpl implements MessageService {
...
@@ -99,8 +98,6 @@ public class MessageServiceImpl implements MessageService {
info
.
setParams
(
params
);
info
.
setParams
(
params
);
boolean
insert
=
smsTemplateService
.
insert
(
info
);
boolean
insert
=
smsTemplateService
.
insert
(
info
);
if
(!
insert
)
{
if
(!
insert
)
{
log
.
error
(
"模板插入DB异常:【{}】"
,
JSONObject
.
toJSONString
(
info
));
xiaoShuService
.
updateDmhubSmsTempStatus
(
REJECTED
,
templateId
,
"插件系统异常"
);
return
new
DmHubResponse
(
ResponseCode
.
SYSTEM_ERROR
);
return
new
DmHubResponse
(
ResponseCode
.
SYSTEM_ERROR
);
}
else
{
}
else
{
String
pkID
=
info
.
getId
();
String
pkID
=
info
.
getId
();
...
@@ -113,7 +110,6 @@ public class MessageServiceImpl implements MessageService {
...
@@ -113,7 +110,6 @@ public class MessageServiceImpl implements MessageService {
CLBizResponse
response
=
new
CLBizResponse
();
CLBizResponse
response
=
new
CLBizResponse
();
String
account
=
xiaoShuService
.
selectUserIdByTemplate
(
templateId
);
String
account
=
xiaoShuService
.
selectUserIdByTemplate
(
templateId
);
if
(
StringUtils
.
isBlank
(
account
))
{
if
(
StringUtils
.
isBlank
(
account
))
{
xiaoShuService
.
updateDmhubSmsTempStatus
(
REJECTED
,
templateId
,
"未找到当前登录用户的售楼系统ID"
);
return
new
DmHubResponse
(
ResponseCode
.
NO_USER_ID
);
return
new
DmHubResponse
(
ResponseCode
.
NO_USER_ID
);
}
}
response
=
bgySmsService
.
createTemplate
(
upCreateStr
,
account
,
TEMPLATETYPE
,
pkID
);
response
=
bgySmsService
.
createTemplate
(
upCreateStr
,
account
,
TEMPLATETYPE
,
pkID
);
...
@@ -126,14 +122,12 @@ public class MessageServiceImpl implements MessageService {
...
@@ -126,14 +122,12 @@ public class MessageServiceImpl implements MessageService {
smsTemplateService
.
updateById
(
updateInfo
);
smsTemplateService
.
updateById
(
updateInfo
);
return
new
DmHubResponse
(
ResponseCode
.
SUCCESS
);
return
new
DmHubResponse
(
ResponseCode
.
SUCCESS
);
}
else
{
}
else
{
xiaoShuService
.
updateDmhubSmsTempStatus
(
REJECTED
,
templateId
,
msg
);
return
new
DmHubResponse
(
code
,
msg
);
return
new
DmHubResponse
(
code
,
msg
);
}
}
}
}
}
catch
(
Exception
exception
)
{
}
catch
(
Exception
exception
)
{
log
.
error
(
"创建模板业务逻辑异常,错误信息"
,
exception
);
log
.
error
(
"创建模板业务逻辑异常,错误信息"
,
exception
);
if
(!
StringUtils
.
isBlank
(
templateId
))
{
if
(!
StringUtils
.
isBlank
(
templateId
))
{
xiaoShuService
.
updateDmhubSmsTempStatus
(
REJECTED
,
templateId
,
"插件系统异常"
);
}
}
responseDTO
=
new
DmHubResponse
(
ResponseCode
.
SYSTEM_ERROR
);
responseDTO
=
new
DmHubResponse
(
ResponseCode
.
SYSTEM_ERROR
);
}
}
...
...
src/main/resources/application.yml
View file @
4651db99
...
@@ -8,8 +8,8 @@ info:
...
@@ -8,8 +8,8 @@ info:
spring
:
spring
:
profiles
:
profiles
:
#
active: test
active
:
test
active
:
${sms-active}
#
active: ${sms-active}
mybatis-plus
:
mybatis-plus
:
mapper-locations
:
classpath:mapper/*.xml
mapper-locations
:
classpath:mapper/*.xml
...
...
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