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
6cd1184e
Commit
6cd1184e
authored
Jun 12, 2020
by
qinxunjia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dmhub发送短信验证码的接口
parent
494b7825
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
118 additions
and
58 deletions
+118
-58
DmHubApi.java
src/main/java/com/bgy/sms/channel/api/DmHubApi.java
+31
-12
DmHubCodeRequest.java
src/main/java/com/bgy/sms/channel/dto/DmHubCodeRequest.java
+30
-0
DmHubResponse.java
src/main/java/com/bgy/sms/channel/dto/DmHubResponse.java
+9
-17
MessageService.java
src/main/java/com/bgy/sms/service/MessageService.java
+7
-5
MessageServiceImpl.java
...ain/java/com/bgy/sms/service/impl/MessageServiceImpl.java
+41
-24
No files found.
src/main/java/com/bgy/sms/channel/api/DmHubApi.java
View file @
6cd1184e
...
@@ -25,17 +25,36 @@ public class DmHubApi {
...
@@ -25,17 +25,36 @@ public class DmHubApi {
* @return
* @return
*/
*/
@PostMapping
(
"/sms/template"
)
@PostMapping
(
"/sms/template"
)
public
DmHub
Template
Response
template
(
@RequestBody
DmHubTemplateRequest
params
)
{
public
DmHubResponse
template
(
@RequestBody
DmHubTemplateRequest
params
)
{
log
.
info
(
"**********创建模板接口入参*******:{}"
,
JSONObject
.
toJSONString
(
params
));
log
.
info
(
"**********创建模板接口入参*******:{}"
,
JSONObject
.
toJSONString
(
params
));
DmHub
TemplateResponse
templat
e
;
DmHub
Response
respons
e
;
try
{
try
{
templat
e
=
messageService
.
createTemplate
(
params
);
respons
e
=
messageService
.
createTemplate
(
params
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"创建模板短信异常"
,
e
);
log
.
error
(
"创建模板短信异常"
,
e
);
template
=
new
DmHubTemplateResponse
(
ResponseCode
.
SYSTEM_ERROR
);
response
=
new
DmHubResponse
(
"999"
,
"创建模板短信异常"
);
}
}
log
.
info
(
"**********创建模板接口出参*******:{}"
,
JSONObject
.
toJSONString
(
template
));
log
.
info
(
"**********创建模板接口出参*******:{}"
,
JSONObject
.
toJSONString
(
response
));
return
template
;
return
response
;
}
/**
* 发送短信验证码
*
* @return
*/
@PostMapping
(
"/sms/verifyCode"
)
public
DmHubResponse
verifyCode
(
@RequestBody
DmHubCodeRequest
params
)
{
log
.
info
(
"**********发送短信验证码*******:{}"
,
JSONObject
.
toJSONString
(
params
));
DmHubResponse
response
;
try
{
response
=
messageService
.
sendCode
(
params
);
}
catch
(
Exception
e
)
{
log
.
error
(
"发送验证码短信异常"
,
e
);
response
=
new
DmHubResponse
(
"999"
,
"发送验证码短信异常"
);
}
log
.
info
(
"**********发送短信验证码出参*******:{}"
,
JSONObject
.
toJSONString
(
response
));
return
response
;
}
}
...
@@ -45,14 +64,14 @@ public class DmHubApi {
...
@@ -45,14 +64,14 @@ public class DmHubApi {
* @return
* @return
*/
*/
@PostMapping
(
"/sms/batch"
)
@PostMapping
(
"/sms/batch"
)
public
DmHub
Send
Response
batch
(
@RequestBody
DmHubBatchSendRequest
request
)
{
public
DmHubResponse
batch
(
@RequestBody
DmHubBatchSendRequest
request
)
{
log
.
info
(
"**********批量发送入参*******:{}"
,
JSONObject
.
toJSONString
(
request
));
log
.
info
(
"**********批量发送入参*******:{}"
,
JSONObject
.
toJSONString
(
request
));
DmHub
Send
Response
response
;
DmHubResponse
response
;
try
{
try
{
response
=
messageService
.
batchSendOneByOne
(
request
);
response
=
messageService
.
batchSendOneByOne
(
request
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"发送批量短信异常"
,
e
);
log
.
error
(
"发送批量短信异常"
,
e
);
response
=
new
DmHub
Send
Response
(
ResponseCode
.
SYSTEM_ERROR
);
response
=
new
DmHubResponse
(
ResponseCode
.
SYSTEM_ERROR
);
}
}
log
.
info
(
"**********批量发送出参*******:{}"
,
response
);
log
.
info
(
"**********批量发送出参*******:{}"
,
response
);
return
response
;
return
response
;
...
@@ -64,14 +83,14 @@ public class DmHubApi {
...
@@ -64,14 +83,14 @@ public class DmHubApi {
* @return
* @return
*/
*/
@RequestMapping
(
"/sms/send"
)
@RequestMapping
(
"/sms/send"
)
public
DmHub
Send
Response
send
(
@RequestBody
DmHubSendRequest
request
)
{
public
DmHubResponse
send
(
@RequestBody
DmHubSendRequest
request
)
{
log
.
info
(
"**********单条发送入参*******:{}"
,
JSONObject
.
toJSONString
(
request
));
log
.
info
(
"**********单条发送入参*******:{}"
,
JSONObject
.
toJSONString
(
request
));
DmHub
Send
Response
response
;
DmHubResponse
response
;
try
{
try
{
response
=
messageService
.
send
(
request
);
response
=
messageService
.
send
(
request
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"发送单条短信异常"
,
e
);
log
.
error
(
"发送单条短信异常"
,
e
);
response
=
new
DmHub
Send
Response
(
ResponseCode
.
SYSTEM_ERROR
);
response
=
new
DmHubResponse
(
ResponseCode
.
SYSTEM_ERROR
);
}
}
log
.
info
(
"**********单条发送出参*******:{}"
,
JSONObject
.
toJSONString
(
response
));
log
.
info
(
"**********单条发送出参*******:{}"
,
JSONObject
.
toJSONString
(
response
));
return
response
;
return
response
;
...
...
src/main/java/com/bgy/sms/channel/dto/DmHub
TemplateResponse
.java
→
src/main/java/com/bgy/sms/channel/dto/DmHub
CodeRequest
.java
View file @
6cd1184e
package
com
.
bgy
.
sms
.
channel
.
dto
;
package
com
.
bgy
.
sms
.
channel
.
dto
;
import
com.bgy.sms.config.ResponseCode
;
import
java.io.Serializable
;
import
java.io.Serializable
;
public
class
DmHub
TemplateResponse
implements
Serializable
{
public
class
DmHub
CodeRequest
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
private
String
mobile
;
private
String
code
;
private
String
code
;
public
DmHubTemplateResponse
()
{
public
String
getMobile
()
{
}
return
mobile
;
public
DmHubTemplateResponse
(
String
code
,
String
msg
)
{
this
.
code
=
code
;
}
}
public
DmHubTemplateResponse
(
ResponseCode
responseCod
e
)
{
public
void
setMobile
(
String
mobil
e
)
{
this
.
code
=
responseCode
.
getCode
()
;
this
.
mobile
=
mobile
;
}
}
public
String
getCode
()
{
public
String
getCode
()
{
...
...
src/main/java/com/bgy/sms/channel/dto/DmHub
Send
Response.java
→
src/main/java/com/bgy/sms/channel/dto/DmHubResponse.java
View file @
6cd1184e
...
@@ -5,7 +5,7 @@ import com.bgy.sms.config.ResponseCode;
...
@@ -5,7 +5,7 @@ import com.bgy.sms.config.ResponseCode;
import
java.io.Serializable
;
import
java.io.Serializable
;
public
class
DmHub
Send
Response
implements
Serializable
{
public
class
DmHubResponse
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
@@ -13,18 +13,18 @@ public class DmHubSendResponse implements Serializable {
...
@@ -13,18 +13,18 @@ public class DmHubSendResponse implements Serializable {
private
JSONObject
error
;
private
JSONObject
error
;
public
DmHubSendResponse
()
{
public
DmHubResponse
()
{
}
}
public
DmHubSendResponse
(
ResponseCode
responseCode
)
{
public
DmHubResponse
(
String
code
,
String
msg
)
{
this
.
code
=
responseCode
.
getCode
();
error
=
new
JSONObject
();
error
.
put
(
"errorCode"
,
code
);
error
.
put
(
"message"
,
msg
);
this
.
code
=
code
;
}
}
public
DmHubSendResponse
(
String
errorCode
,
String
errorMsg
)
{
public
DmHubResponse
(
ResponseCode
responseCode
)
{
error
=
new
JSONObject
();
this
.
code
=
responseCode
.
getCode
();
error
.
put
(
"errorCode"
,
errorCode
);
error
.
put
(
"message"
,
errorMsg
);
}
}
public
String
getCode
()
{
public
String
getCode
()
{
...
@@ -42,12 +42,4 @@ public class DmHubSendResponse implements Serializable {
...
@@ -42,12 +42,4 @@ public class DmHubSendResponse implements Serializable {
public
void
setError
(
JSONObject
error
)
{
public
void
setError
(
JSONObject
error
)
{
this
.
error
=
error
;
this
.
error
=
error
;
}
}
@Override
public
String
toString
()
{
return
"DmHubSendResponse{"
+
"code='"
+
code
+
'\''
+
"error='"
+
error
.
toString
()
+
'\''
+
'}'
;
}
}
}
src/main/java/com/bgy/sms/service/MessageService.java
View file @
6cd1184e
...
@@ -10,7 +10,7 @@ public interface MessageService {
...
@@ -10,7 +10,7 @@ public interface MessageService {
* @param requestDTO
* @param requestDTO
* @return
* @return
*/
*/
DmHub
Template
Response
createTemplate
(
DmHubTemplateRequest
requestDTO
);
DmHubResponse
createTemplate
(
DmHubTemplateRequest
requestDTO
);
/**
/**
* DM hub发送短信接口
* DM hub发送短信接口
...
@@ -18,7 +18,7 @@ public interface MessageService {
...
@@ -18,7 +18,7 @@ public interface MessageService {
* @param requestDTO
* @param requestDTO
* @return
* @return
*/
*/
DmHub
Send
Response
send
(
DmHubSendRequest
requestDTO
);
DmHubResponse
send
(
DmHubSendRequest
requestDTO
);
/**
/**
* DM hub批量发送短信接口
* DM hub批量发送短信接口
...
@@ -26,7 +26,7 @@ public interface MessageService {
...
@@ -26,7 +26,7 @@ public interface MessageService {
* @param requestDTO
* @param requestDTO
* @return
* @return
*/
*/
DmHub
Send
Response
batchSend
(
DmHubBatchSendRequest
requestDTO
);
DmHubResponse
batchSend
(
DmHubBatchSendRequest
requestDTO
);
/**
/**
* DM hub批量发送短信接口
* DM hub批量发送短信接口
...
@@ -34,5 +34,7 @@ public interface MessageService {
...
@@ -34,5 +34,7 @@ public interface MessageService {
* @param requestDTO
* @param requestDTO
* @return
* @return
*/
*/
DmHubSendResponse
batchSendOneByOne
(
DmHubBatchSendRequest
requestDTO
);
DmHubResponse
batchSendOneByOne
(
DmHubBatchSendRequest
requestDTO
);
DmHubResponse
sendCode
(
DmHubCodeRequest
params
);
}
}
src/main/java/com/bgy/sms/service/impl/MessageServiceImpl.java
View file @
6cd1184e
...
@@ -16,6 +16,7 @@ import com.bgy.sms.service.MessageService;
...
@@ -16,6 +16,7 @@ import com.bgy.sms.service.MessageService;
import
com.bgy.sms.service.SmsTemplateService
;
import
com.bgy.sms.service.SmsTemplateService
;
import
com.bgy.sms.service.bean.TemplateChangeBean
;
import
com.bgy.sms.service.bean.TemplateChangeBean
;
import
com.bgy.util.id.IdHandler
;
import
com.bgy.util.id.IdHandler
;
import
com.sun.org.apache.regexp.internal.RE
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -50,10 +51,10 @@ public class MessageServiceImpl implements MessageService {
...
@@ -50,10 +51,10 @@ public class MessageServiceImpl implements MessageService {
* @return
* @return
*/
*/
@Override
@Override
public
DmHub
Template
Response
createTemplate
(
DmHubTemplateRequest
requestDTO
)
{
public
DmHubResponse
createTemplate
(
DmHubTemplateRequest
requestDTO
)
{
log
.
info
(
"进入创建短信模板业务逻辑,入参:{}"
,
requestDTO
);
log
.
info
(
"进入创建短信模板业务逻辑,入参:{}"
,
requestDTO
);
DmHub
TemplateResponse
responseDTO
=
new
DmHubTemplate
Response
(
ResponseCode
.
SUCCESS
);
DmHub
Response
responseDTO
=
new
DmHub
Response
(
ResponseCode
.
SUCCESS
);
try
{
try
{
String
templateContent
=
requestDTO
.
getTemplateContent
();
String
templateContent
=
requestDTO
.
getTemplateContent
();
String
signature
=
requestDTO
.
getSignature
();
String
signature
=
requestDTO
.
getSignature
();
...
@@ -69,7 +70,7 @@ public class MessageServiceImpl implements MessageService {
...
@@ -69,7 +70,7 @@ public class MessageServiceImpl implements MessageService {
SmsTemplateInfo
dbInfo
=
smsTemplateService
.
selectOne
(
new
EntityWrapper
<
SmsTemplateInfo
>().
eq
(
"dm_template_id"
,
templateId
));
SmsTemplateInfo
dbInfo
=
smsTemplateService
.
selectOne
(
new
EntityWrapper
<
SmsTemplateInfo
>().
eq
(
"dm_template_id"
,
templateId
));
if
(
dbInfo
!=
null
)
{
if
(
dbInfo
!=
null
)
{
log
.
error
(
"Dm Hub请求创建模板,模板id已存在,模板id:【{}】"
,
templateId
);
log
.
error
(
"Dm Hub请求创建模板,模板id已存在,模板id:【{}】"
,
templateId
);
return
new
DmHub
Template
Response
(
ResponseCode
.
TEMPLATE_ALREADY_EXISTED
);
return
new
DmHubResponse
(
ResponseCode
.
TEMPLATE_ALREADY_EXISTED
);
}
}
SmsTemplateInfo
info
=
new
SmsTemplateInfo
();
SmsTemplateInfo
info
=
new
SmsTemplateInfo
();
info
.
setContent
(
templateContent
);
info
.
setContent
(
templateContent
);
...
@@ -88,11 +89,11 @@ public class MessageServiceImpl implements MessageService {
...
@@ -88,11 +89,11 @@ public class MessageServiceImpl implements MessageService {
if
(!
insert
)
{
if
(!
insert
)
{
//TODO 发送告警
//TODO 发送告警
log
.
error
(
"模板插入DB异常:【{}】"
,
JSONObject
.
toJSONString
(
info
));
log
.
error
(
"模板插入DB异常:【{}】"
,
JSONObject
.
toJSONString
(
info
));
return
new
DmHub
Template
Response
(
ResponseCode
.
SYSTEM_ERROR
);
return
new
DmHubResponse
(
ResponseCode
.
SYSTEM_ERROR
);
}
}
}
catch
(
Exception
exception
)
{
}
catch
(
Exception
exception
)
{
log
.
error
(
"创建模板业务逻辑异常,错误信息"
,
exception
);
log
.
error
(
"创建模板业务逻辑异常,错误信息"
,
exception
);
responseDTO
=
new
DmHub
Template
Response
(
ResponseCode
.
SYSTEM_ERROR
);
responseDTO
=
new
DmHubResponse
(
ResponseCode
.
SYSTEM_ERROR
);
}
}
return
responseDTO
;
return
responseDTO
;
...
@@ -176,7 +177,7 @@ public class MessageServiceImpl implements MessageService {
...
@@ -176,7 +177,7 @@ public class MessageServiceImpl implements MessageService {
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRED
)
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRED
)
public
DmHub
Send
Response
send
(
DmHubSendRequest
request
)
{
public
DmHubResponse
send
(
DmHubSendRequest
request
)
{
try
{
try
{
String
dmHubBatchId
=
request
.
getBatchId
();
String
dmHubBatchId
=
request
.
getBatchId
();
String
templateId
=
request
.
getTemplateId
();
String
templateId
=
request
.
getTemplateId
();
...
@@ -186,7 +187,7 @@ public class MessageServiceImpl implements MessageService {
...
@@ -186,7 +187,7 @@ public class MessageServiceImpl implements MessageService {
SmsTemplateInfo
templateInfo
=
smsTemplateService
.
selectOne
(
new
EntityWrapper
<
SmsTemplateInfo
>().
eq
(
"dm_template_id"
,
templateId
));
SmsTemplateInfo
templateInfo
=
smsTemplateService
.
selectOne
(
new
EntityWrapper
<
SmsTemplateInfo
>().
eq
(
"dm_template_id"
,
templateId
));
if
(
null
==
templateInfo
)
{
if
(
null
==
templateInfo
)
{
log
.
error
(
"未获取到短信模板"
);
log
.
error
(
"未获取到短信模板"
);
return
new
DmHub
Send
Response
(
"999"
,
"未获取到短信模板"
);
return
new
DmHubResponse
(
"999"
,
"未获取到短信模板"
);
}
}
// 2、根据请求信息获取用户的手机号码(此处不考虑配置DMHUB系统不是SMS的情况),直接拿请求体中的_audienceId字段值,该值为手机号码
// 2、根据请求信息获取用户的手机号码(此处不考虑配置DMHUB系统不是SMS的情况),直接拿请求体中的_audienceId字段值,该值为手机号码
// 模板参数占位符
// 模板参数占位符
...
@@ -199,7 +200,7 @@ public class MessageServiceImpl implements MessageService {
...
@@ -199,7 +200,7 @@ public class MessageServiceImpl implements MessageService {
}
else
if
(
"marketing"
.
equals
(
smsType
))
{
}
else
if
(
"marketing"
.
equals
(
smsType
))
{
areaId
=
BgySMSConfig
.
marketAreaId
;
areaId
=
BgySMSConfig
.
marketAreaId
;
}
else
{
}
else
{
return
new
DmHub
Send
Response
(
"999"
,
"未获取到短信类型"
);
return
new
DmHubResponse
(
"999"
,
"未获取到短信类型"
);
}
}
// 封装参数
// 封装参数
List
<
String
>
paramList
=
new
ArrayList
<>();
List
<
String
>
paramList
=
new
ArrayList
<>();
...
@@ -255,13 +256,29 @@ public class MessageServiceImpl implements MessageService {
...
@@ -255,13 +256,29 @@ public class MessageServiceImpl implements MessageService {
String
code
=
response
.
getCode
();
String
code
=
response
.
getCode
();
String
msg
=
response
.
getMsg
();
String
msg
=
response
.
getMsg
();
// TODO 根据DM hub需要的返回数据封装
// TODO 根据DM hub需要的返回数据封装
return
new
DmHub
SendResponse
(
code
,
msg
);
return
new
DmHub
Response
(
ResponseCode
.
SUCCESS
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"调用短信发送逻辑错误"
,
e
);
log
.
error
(
"调用短信发送逻辑错误"
,
e
);
return
new
DmHub
Send
Response
(
"999"
,
"插件系统异常"
);
return
new
DmHubResponse
(
"999"
,
"插件系统异常"
);
}
}
}
}
@Override
public
DmHubResponse
sendCode
(
DmHubCodeRequest
params
)
{
String
notifyAreaId
=
BgySMSConfig
.
notifyAreaId
;
String
mobile
=
params
.
getMobile
();
String
code
=
params
.
getCode
();
CLBizResponse
response
=
new
CLBizResponse
();
String
content
=
"您的验证码是:"
+
code
;
try
{
bgySmsService
.
sendSms
(
mobile
,
content
,
notifyAreaId
);
}
catch
(
Exception
e
)
{
log
.
error
(
"发送短信异常:"
,
e
);
}
return
new
DmHubResponse
(
ResponseCode
.
SUCCESS
);
}
/**
/**
* 获取可以直接用户发送的短信内容
* 获取可以直接用户发送的短信内容
*
*
...
@@ -277,7 +294,7 @@ public class MessageServiceImpl implements MessageService {
...
@@ -277,7 +294,7 @@ public class MessageServiceImpl implements MessageService {
}
}
@Override
@Override
public
DmHub
Send
Response
batchSend
(
DmHubBatchSendRequest
request
)
{
public
DmHubResponse
batchSend
(
DmHubBatchSendRequest
request
)
{
String
batchId
=
request
.
getBatchId
();
// DM hub 批次号
String
batchId
=
request
.
getBatchId
();
// DM hub 批次号
String
templateId
=
request
.
getTemplateId
();
// 此次短信对应的模板id
String
templateId
=
request
.
getTemplateId
();
// 此次短信对应的模板id
String
audienceIdType
=
request
.
getAudienceIdType
();
String
audienceIdType
=
request
.
getAudienceIdType
();
...
@@ -285,7 +302,7 @@ public class MessageServiceImpl implements MessageService {
...
@@ -285,7 +302,7 @@ public class MessageServiceImpl implements MessageService {
SmsTemplateInfo
templateInfo
=
smsTemplateService
.
selectOne
(
new
EntityWrapper
<
SmsTemplateInfo
>().
eq
(
"dm_template_id"
,
templateId
));
SmsTemplateInfo
templateInfo
=
smsTemplateService
.
selectOne
(
new
EntityWrapper
<
SmsTemplateInfo
>().
eq
(
"dm_template_id"
,
templateId
));
if
(
null
==
templateInfo
)
{
if
(
null
==
templateInfo
)
{
return
new
DmHub
Send
Response
(
ResponseCode
.
SYSTEM_ERROR
);
return
new
DmHubResponse
(
ResponseCode
.
SYSTEM_ERROR
);
}
}
// 模板参数占位符
// 模板参数占位符
String
params
=
templateInfo
.
getParams
();
String
params
=
templateInfo
.
getParams
();
...
@@ -359,14 +376,14 @@ public class MessageServiceImpl implements MessageService {
...
@@ -359,14 +376,14 @@ public class MessageServiceImpl implements MessageService {
String
msg
=
response
.
getMsg
();
String
msg
=
response
.
getMsg
();
// TODO 根据DM hub需要的返回数据封装
// TODO 根据DM hub需要的返回数据封装
if
(
ResponseCode
.
SUCCESS
.
getCode
().
equals
(
code
))
{
if
(
ResponseCode
.
SUCCESS
.
getCode
().
equals
(
code
))
{
return
new
DmHub
SendResponse
(
code
,
msg
);
return
new
DmHub
Response
(
ResponseCode
.
SUCCESS
);
}
else
{
}
else
{
return
new
DmHub
Send
Response
(
code
,
msg
);
return
new
DmHubResponse
(
code
,
msg
);
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"调用创蓝逻辑错误"
,
e
);
log
.
error
(
"调用创蓝逻辑错误"
,
e
);
// TODO 根据DM hub需要的返回数据封装
// TODO 根据DM hub需要的返回数据封装
return
new
DmHub
Send
Response
(
ResponseCode
.
SYSTEM_ERROR
);
return
new
DmHubResponse
(
ResponseCode
.
SYSTEM_ERROR
);
}
}
}
else
{
}
else
{
// 固定短信
// 固定短信
...
@@ -382,16 +399,16 @@ public class MessageServiceImpl implements MessageService {
...
@@ -382,16 +399,16 @@ public class MessageServiceImpl implements MessageService {
// String msg = response.getMsg();
// String msg = response.getMsg();
// }
// }
// TODO 待优化
// TODO 待优化
return
new
DmHub
Send
Response
(
ResponseCode
.
SUCCESS
);
return
new
DmHubResponse
(
ResponseCode
.
SUCCESS
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"调用创蓝逻辑错误:"
,
e
);
log
.
error
(
"调用创蓝逻辑错误:"
,
e
);
return
new
DmHub
Send
Response
(
ResponseCode
.
SYSTEM_ERROR
);
return
new
DmHubResponse
(
ResponseCode
.
SYSTEM_ERROR
);
}
}
}
}
}
}
@Override
@Override
public
DmHub
Send
Response
batchSendOneByOne
(
DmHubBatchSendRequest
request
)
{
public
DmHubResponse
batchSendOneByOne
(
DmHubBatchSendRequest
request
)
{
String
batchId
=
request
.
getBatchId
();
// DM hub 批次号
String
batchId
=
request
.
getBatchId
();
// DM hub 批次号
String
templateId
=
request
.
getTemplateId
();
// 此次短信对应的模板id
String
templateId
=
request
.
getTemplateId
();
// 此次短信对应的模板id
String
audienceIdType
=
request
.
getAudienceIdType
();
String
audienceIdType
=
request
.
getAudienceIdType
();
...
@@ -399,7 +416,7 @@ public class MessageServiceImpl implements MessageService {
...
@@ -399,7 +416,7 @@ public class MessageServiceImpl implements MessageService {
SmsTemplateInfo
templateInfo
=
smsTemplateService
.
selectOne
(
new
EntityWrapper
<
SmsTemplateInfo
>().
eq
(
"dm_template_id"
,
templateId
));
SmsTemplateInfo
templateInfo
=
smsTemplateService
.
selectOne
(
new
EntityWrapper
<
SmsTemplateInfo
>().
eq
(
"dm_template_id"
,
templateId
));
if
(
null
==
templateInfo
)
{
if
(
null
==
templateInfo
)
{
return
new
DmHub
Send
Response
(
"999"
,
"短信插件未获取到模板信息"
);
return
new
DmHubResponse
(
"999"
,
"短信插件未获取到模板信息"
);
}
}
String
smsType
=
templateInfo
.
getType
();
String
smsType
=
templateInfo
.
getType
();
String
areaId
;
String
areaId
;
...
@@ -408,7 +425,7 @@ public class MessageServiceImpl implements MessageService {
...
@@ -408,7 +425,7 @@ public class MessageServiceImpl implements MessageService {
}
else
if
(
"marketing"
.
equals
(
smsType
))
{
}
else
if
(
"marketing"
.
equals
(
smsType
))
{
areaId
=
BgySMSConfig
.
marketAreaId
;
areaId
=
BgySMSConfig
.
marketAreaId
;
}
else
{
}
else
{
return
new
DmHub
Send
Response
(
"999"
,
"未获取到短信类型"
);
return
new
DmHubResponse
(
"999"
,
"未获取到短信类型"
);
}
}
// 模板参数占位符
// 模板参数占位符
String
params
=
templateInfo
.
getParams
();
String
params
=
templateInfo
.
getParams
();
...
@@ -487,7 +504,7 @@ public class MessageServiceImpl implements MessageService {
...
@@ -487,7 +504,7 @@ public class MessageServiceImpl implements MessageService {
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"调用创蓝逻辑错误"
,
e
);
log
.
error
(
"调用创蓝逻辑错误"
,
e
);
// TODO 根据DM hub需要的返回数据封装
// TODO 根据DM hub需要的返回数据封装
return
new
DmHub
Send
Response
(
"999"
,
"插件服务系统异常"
);
return
new
DmHubResponse
(
"999"
,
"插件服务系统异常"
);
}
}
}
else
{
}
else
{
// 变量短信
// 变量短信
...
@@ -507,13 +524,13 @@ public class MessageServiceImpl implements MessageService {
...
@@ -507,13 +524,13 @@ public class MessageServiceImpl implements MessageService {
}
}
// TODO 待优化
// TODO 待优化
return
new
DmHub
Send
Response
(
ResponseCode
.
SUCCESS
);
return
new
DmHubResponse
(
ResponseCode
.
SUCCESS
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"调用创蓝逻辑错误:"
,
e
);
log
.
error
(
"调用创蓝逻辑错误:"
,
e
);
return
new
DmHub
Send
Response
(
"999"
,
"插件服务系统异常"
);
return
new
DmHubResponse
(
"999"
,
"插件服务系统异常"
);
}
}
}
}
return
new
DmHub
Send
Response
(
ResponseCode
.
SUCCESS
);
return
new
DmHubResponse
(
ResponseCode
.
SUCCESS
);
}
}
private
String
getKeyValue
(
Object
value
,
StringBuilder
keyBuffer
)
{
private
String
getKeyValue
(
Object
value
,
StringBuilder
keyBuffer
)
{
...
...
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