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
35c1f910
Commit
35c1f910
authored
Jun 17, 2020
by
qinxunjia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
短信插件优化
parent
6cd1184e
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
70 additions
and
382 deletions
+70
-382
BgyApi.java
src/main/java/com/bgy/sms/channel/api/BgyApi.java
+3
-3
DmHubApi.java
src/main/java/com/bgy/sms/channel/api/DmHubApi.java
+1
-1
BgySMSConfig.java
...ain/java/com/bgy/sms/channel/bgy/config/BgySMSConfig.java
+5
-12
ContentEnum.java
...main/java/com/bgy/sms/channel/bgy/config/ContentEnum.java
+5
-5
CLSendFixedRequest.java
.../java/com/bgy/sms/channel/bgy/dto/CLSendFixedRequest.java
+0
-150
CLSendVariableRequest.java
...va/com/bgy/sms/channel/bgy/dto/CLSendVariableRequest.java
+0
-146
BgySmsService.java
...n/java/com/bgy/sms/channel/bgy/service/BgySmsService.java
+1
-1
BgySmsServiceImpl.java
...m/bgy/sms/channel/bgy/service/impl/BgySmsServiceImpl.java
+10
-4
DmHubResponse.java
src/main/java/com/bgy/sms/channel/dto/DmHubResponse.java
+0
-1
TemplateChangeBean.java
...ain/java/com/bgy/sms/service/bean/TemplateChangeBean.java
+2
-2
MessageServiceImpl.java
...ain/java/com/bgy/sms/service/impl/MessageServiceImpl.java
+29
-41
application-dev.yml
src/main/resources/application-dev.yml
+1
-2
application-prod.yml
src/main/resources/application-prod.yml
+1
-2
application-test.yml
src/main/resources/application-test.yml
+0
-2
application.yml
src/main/resources/application.yml
+1
-1
logback-spring.xml
src/main/resources/logback-spring.xml
+11
-9
No files found.
src/main/java/com/bgy/sms/channel/api/BgyApi.java
View file @
35c1f910
...
...
@@ -18,7 +18,7 @@ public class BgyApi {
@PostMapping
(
"/notify"
)
public
String
notify
(
@RequestParam
CLNotifyRequest
notifyInfo
)
{
log
.
info
(
"
创蓝
异步通知接口入参:{}"
,
JSONObject
.
toJSONString
(
notifyInfo
));
log
.
info
(
"
碧桂园
异步通知接口入参:{}"
,
JSONObject
.
toJSONString
(
notifyInfo
));
String
response
=
"success"
;
try
{
// bgySmsService.asyncNotify(notifyInfo);
...
...
@@ -26,7 +26,7 @@ public class BgyApi {
log
.
error
(
"处理创建模板异步通知异常:"
,
e
);
response
=
"fail"
;
}
log
.
info
(
"
创蓝
异步通知接口出参:{}"
,
response
);
log
.
info
(
"
碧桂园
异步通知接口出参:{}"
,
response
);
return
response
;
}
...
...
@@ -40,7 +40,7 @@ public class BgyApi {
log
.
error
(
"处理回执逻辑异常:"
,
e
);
response
=
"fail"
;
}
log
.
info
(
"
创蓝
异步通知接口出参:{}"
,
response
);
log
.
info
(
"
碧桂园
异步通知接口出参:{}"
,
response
);
return
response
;
}
...
...
src/main/java/com/bgy/sms/channel/api/DmHubApi.java
View file @
35c1f910
...
...
@@ -73,7 +73,7 @@ public class DmHubApi {
log
.
error
(
"发送批量短信异常"
,
e
);
response
=
new
DmHubResponse
(
ResponseCode
.
SYSTEM_ERROR
);
}
log
.
info
(
"**********批量发送出参*******:{}"
,
response
);
log
.
info
(
"**********批量发送出参*******:{}"
,
JSONObject
.
toJSONString
(
response
)
);
return
response
;
}
...
...
src/main/java/com/bgy/sms/channel/bgy/config/BgySMSConfig.java
View file @
35c1f910
...
...
@@ -14,10 +14,8 @@ public class BgySMSConfig {
public
static
String
securityCode
;
// 请求地址
public
static
String
url
;
// 通知类项目楼盘ID
public
static
String
notifyAreaId
;
// 营销类项目楼盘ID
public
static
String
marketAreaId
;
// 项目楼盘ID
public
static
String
areaId
;
// api
public
static
String
api
;
...
...
@@ -37,14 +35,9 @@ public class BgySMSConfig {
BgySMSConfig
.
url
=
url
;
}
@Value
(
"${system.config.bgy.notifyAreaId}"
)
public
void
setNotifyAreaId
(
String
notifyAreaId
)
{
BgySMSConfig
.
notifyAreaId
=
notifyAreaId
;
}
@Value
(
"${system.config.bgy.marketAreaId}"
)
public
void
setMarketAreaId
(
String
marketAreaId
)
{
BgySMSConfig
.
marketAreaId
=
marketAreaId
;
@Value
(
"${system.config.bgy.areaId}"
)
public
void
setAreaId
(
String
areaId
)
{
BgySMSConfig
.
areaId
=
areaId
;
}
@Value
(
"${system.config.bgy.api}"
)
...
...
src/main/java/com/bgy/sms/channel/bgy/config/ContentEnum.java
View file @
35c1f910
...
...
@@ -10,11 +10,11 @@ public enum ContentEnum {
SMS_TYPE_MARKETING
(
"marketing"
,
"营销类短信标识"
),
SMS_STATUS_SUCCESS
(
"DELIVRD"
,
"
创蓝
短信发送状态--成功"
),
SMS_STATUS_UNKNOWN
(
"UNKNOWN"
,
"
创蓝
短信发送状态--未知"
),
SMS_STATUS_REFUSE
(
"REJECTD"
,
"
创蓝
短信发送状态--短信中心拒绝"
),
SMS_STATUS_MBBLACK
(
"MBBLACK"
,
"
创蓝
短信发送状态--黑名单号码"
),
SMS_STATUS_REJECT
(
"REJECT"
,
"
创蓝
短信发送状态--驳回"
);
SMS_STATUS_SUCCESS
(
"DELIVRD"
,
"
碧桂园
短信发送状态--成功"
),
SMS_STATUS_UNKNOWN
(
"UNKNOWN"
,
"
碧桂园
短信发送状态--未知"
),
SMS_STATUS_REFUSE
(
"REJECTD"
,
"
碧桂园
短信发送状态--短信中心拒绝"
),
SMS_STATUS_MBBLACK
(
"MBBLACK"
,
"
碧桂园
短信发送状态--黑名单号码"
),
SMS_STATUS_REJECT
(
"REJECT"
,
"
碧桂园
短信发送状态--驳回"
);
private
final
String
value
;
...
...
src/main/java/com/bgy/sms/channel/bgy/dto/CLSendFixedRequest.java
deleted
100644 → 0
View file @
6cd1184e
package
com
.
bgy
.
sms
.
channel
.
bgy
.
dto
;
import
java.io.Serializable
;
public
class
CLSendFixedRequest
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 创蓝API账号,必填
*/
private
String
account
;
/**
* 创蓝API密码,必填
*/
private
String
password
;
/**
* 短信内容。长度不能超过536个字符,必填
*/
private
String
msg
;
/**
* 机号码。多个手机号码使用英文逗号分隔,必填
*/
private
String
phone
;
/**
* 定时发送短信时间。格式为yyyyMMddHHmm,值小于或等于当前时间则立即发送,默认立即发送,选填
*/
private
String
sendtime
;
/**
* 是否需要状态报告(默认false),选填
*/
private
String
report
;
/**
* 下发短信号码扩展码,纯数字,建议1-3位,选填
*/
private
String
extend
;
/**
* 该条短信在您业务系统内的ID,如订单号或者短信发送记录流水号,选填
*/
private
String
uid
;
public
CLSendFixedRequest
()
{
}
public
CLSendFixedRequest
(
String
account
,
String
password
,
String
msg
,
String
phone
)
{
super
();
this
.
account
=
account
;
this
.
password
=
password
;
this
.
msg
=
msg
;
this
.
phone
=
phone
;
}
public
CLSendFixedRequest
(
String
account
,
String
password
,
String
msg
,
String
phone
,
String
report
)
{
super
();
this
.
account
=
account
;
this
.
password
=
password
;
this
.
msg
=
msg
;
this
.
phone
=
phone
;
this
.
report
=
report
;
}
public
CLSendFixedRequest
(
String
account
,
String
password
,
String
msg
,
String
phone
,
String
report
,
String
uid
)
{
super
();
this
.
account
=
account
;
this
.
password
=
password
;
this
.
msg
=
msg
;
this
.
phone
=
phone
;
this
.
report
=
report
;
this
.
uid
=
uid
;
}
public
CLSendFixedRequest
(
String
account
,
String
password
,
String
msg
,
String
phone
,
String
sendtime
,
String
report
,
String
uid
)
{
super
();
this
.
account
=
account
;
this
.
password
=
password
;
this
.
msg
=
msg
;
this
.
phone
=
phone
;
this
.
sendtime
=
sendtime
;
this
.
report
=
report
;
this
.
uid
=
uid
;
}
public
String
getAccount
()
{
return
account
;
}
public
void
setAccount
(
String
account
)
{
this
.
account
=
account
;
}
public
String
getPassword
()
{
return
password
;
}
public
void
setPassword
(
String
password
)
{
this
.
password
=
password
;
}
public
String
getMsg
()
{
return
msg
;
}
public
void
setMsg
(
String
msg
)
{
this
.
msg
=
msg
;
}
public
String
getPhone
()
{
return
phone
;
}
public
void
setPhone
(
String
phone
)
{
this
.
phone
=
phone
;
}
public
String
getSendtime
()
{
return
sendtime
;
}
public
void
setSendtime
(
String
sendtime
)
{
this
.
sendtime
=
sendtime
;
}
public
String
getReport
()
{
return
report
;
}
public
void
setReport
(
String
report
)
{
this
.
report
=
report
;
}
public
String
getExtend
()
{
return
extend
;
}
public
void
setExtend
(
String
extend
)
{
this
.
extend
=
extend
;
}
public
String
getUid
()
{
return
uid
;
}
public
void
setUid
(
String
uid
)
{
this
.
uid
=
uid
;
}
}
src/main/java/com/bgy/sms/channel/bgy/dto/CLSendVariableRequest.java
deleted
100644 → 0
View file @
6cd1184e
package
com
.
bgy
.
sms
.
channel
.
bgy
.
dto
;
import
java.io.Serializable
;
public
class
CLSendVariableRequest
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 创蓝API账号,必填
*/
private
String
account
;
/**
* 创蓝API密码,必填
*/
private
String
password
;
/**
* 短信内容。长度不能超过536个字符,必填
*/
private
String
msg
;
/**
* 手机号码和变量参数,多组参数使用英文分号;区分,必填
*/
private
String
params
;
/**
* 定时发送短信时间。格式为yyyyMMddHHmm,值小于或等于当前时间则立即发送,默认立即发送,选填
*/
private
String
sendtime
;
/**
* 是否需要状态报告(默认false),选填
*/
private
String
report
;
/**
* 下发短信号码扩展码,纯数字,建议1-3位,选填
*/
private
String
extend
;
/**
* 该条短信在您业务系统内的ID,如订单号或者短信发送记录流水号,选填
*/
private
String
uid
;
public
CLSendVariableRequest
()
{
}
public
CLSendVariableRequest
(
String
account
,
String
password
,
String
msg
,
String
params
)
{
super
();
this
.
account
=
account
;
this
.
password
=
password
;
this
.
msg
=
msg
;
this
.
params
=
params
;
}
public
CLSendVariableRequest
(
String
account
,
String
password
,
String
msg
,
String
params
,
String
report
)
{
super
();
this
.
account
=
account
;
this
.
password
=
password
;
this
.
msg
=
msg
;
this
.
params
=
params
;
this
.
report
=
report
;
}
public
CLSendVariableRequest
(
String
account
,
String
password
,
String
msg
,
String
params
,
String
report
,
String
uid
)
{
super
();
this
.
account
=
account
;
this
.
password
=
password
;
this
.
msg
=
msg
;
this
.
params
=
params
;
this
.
report
=
report
;
this
.
uid
=
uid
;
}
// public SmsVarableRequest(String account, String password, String msg, String params, String sendtime) {
// super();
// this.account = account;
// this.password = password;
// this.msg = msg;
// this.params = params;
// this.sendtime = sendtime;
// }
public
String
getAccount
()
{
return
account
;
}
public
void
setAccount
(
String
account
)
{
this
.
account
=
account
;
}
public
String
getPassword
()
{
return
password
;
}
public
void
setPassword
(
String
password
)
{
this
.
password
=
password
;
}
public
String
getMsg
()
{
return
msg
;
}
public
void
setMsg
(
String
msg
)
{
this
.
msg
=
msg
;
}
public
String
getSendtime
()
{
return
sendtime
;
}
public
void
setSendtime
(
String
sendtime
)
{
this
.
sendtime
=
sendtime
;
}
public
String
getReport
()
{
return
report
;
}
public
void
setReport
(
String
report
)
{
this
.
report
=
report
;
}
public
String
getExtend
()
{
return
extend
;
}
public
void
setExtend
(
String
extend
)
{
this
.
extend
=
extend
;
}
public
String
getUid
()
{
return
uid
;
}
public
void
setUid
(
String
uid
)
{
this
.
uid
=
uid
;
}
public
String
getParams
()
{
return
params
;
}
public
void
setParams
(
String
params
)
{
this
.
params
=
params
;
}
}
src/main/java/com/bgy/sms/channel/bgy/service/BgySmsService.java
View file @
35c1f910
...
...
@@ -6,7 +6,7 @@ public interface BgySmsService {
CLBizResponse
sendSms
(
String
mobile
,
String
content
,
String
areaId
)
throws
Exception
;
CLBizResponse
sendSms
(
String
mobile
,
String
content
)
throws
Exception
;
}
src/main/java/com/bgy/sms/channel/bgy/service/impl/BgySmsServiceImpl.java
View file @
35c1f910
...
...
@@ -30,8 +30,8 @@ public class BgySmsServiceImpl implements BgySmsService {
private
static
final
String
retMsg
=
"msg"
;
// 响应描述
private
static
final
String
createTemplateData
=
"data"
;
// 创建模板响应数据
private
static
final
String
notificationId
=
"49"
;
//
创蓝
通知类短信ID
private
static
final
String
marketingId
=
"52"
;
//
创蓝
营销类短信ID
private
static
final
String
notificationId
=
"49"
;
//
碧桂园
通知类短信ID
private
static
final
String
marketingId
=
"52"
;
//
碧桂园
营销类短信ID
@Autowired
private
SmsTemplateService
templateService
;
...
...
@@ -39,8 +39,10 @@ public class BgySmsServiceImpl implements BgySmsService {
private
DmHubService
dmHubService
;
@Override
public
CLBizResponse
sendSms
(
String
mobile
,
String
content
,
String
areaId
)
throws
Exception
{
public
CLBizResponse
sendSms
(
String
mobile
,
String
content
)
throws
Exception
{
log
.
info
(
"进入碧桂园短信发送接口"
);
String
appId
=
BgySMSConfig
.
appId
;
String
areaId
=
BgySMSConfig
.
areaId
;
String
securityCode
=
BgySMSConfig
.
securityCode
;
String
url
=
BgySMSConfig
.
url
;
String
api
=
BgySMSConfig
.
api
;
...
...
@@ -51,7 +53,9 @@ public class BgySmsServiceImpl implements BgySmsService {
requestParams
.
put
(
"areaId"
,
areaId
);
requestParams
.
put
(
"content"
,
content
);
requestParams
.
put
(
"mobile"
,
mobile
);
log
.
info
(
"碧桂园短信接口参数:{}"
,
requestParams
);
String
retStr
=
SendSmsUtil
.
sendSmsByPost
(
url
,
JSONObject
.
toJSONString
(
requestParams
));
log
.
info
(
"碧桂园短信接口返回信息:{}"
,
retStr
);
if
(
retStr
==
null
)
{
return
new
CLBizResponse
(
ResponseCode
.
UPSTREAM_BLANK
);
}
...
...
@@ -59,8 +63,10 @@ public class BgySmsServiceImpl implements BgySmsService {
String
err
=
retJson
.
getString
(
"err"
);
String
retPack
=
retJson
.
getString
(
"package"
);
String
retCode
=
retJson
.
getString
(
"ret"
);
if
(!
sendSuccessCode
.
equals
(
retCode
))
{
if
(
err
.
contains
(
"成功"
))
{
return
new
CLBizResponse
(
ResponseCode
.
SUCCESS
);
}
return
new
CLBizResponse
(
ResponseCode
.
UPSTREAM_FAIL
.
getCode
(),
err
);
}
else
{
return
new
CLBizResponse
(
ResponseCode
.
SUCCESS
);
...
...
src/main/java/com/bgy/sms/channel/dto/DmHubResponse.java
View file @
35c1f910
...
...
@@ -20,7 +20,6 @@ public class DmHubResponse implements Serializable {
error
=
new
JSONObject
();
error
.
put
(
"errorCode"
,
code
);
error
.
put
(
"message"
,
msg
);
this
.
code
=
code
;
}
public
DmHubResponse
(
ResponseCode
responseCode
)
{
...
...
src/main/java/com/bgy/sms/service/bean/TemplateChangeBean.java
View file @
35c1f910
...
...
@@ -5,10 +5,10 @@ import com.alibaba.fastjson.JSONArray;
public
class
TemplateChangeBean
{
//
创蓝
发送短信时需要用的模板内容
//
碧桂园
发送短信时需要用的模板内容
private
String
upSendStr
;
//
创蓝
创建短信模板需要的模板内容
//
碧桂园
创建短信模板需要的模板内容
private
String
upCreateStr
;
private
JSONArray
params
;
...
...
src/main/java/com/bgy/sms/service/impl/MessageServiceImpl.java
View file @
35c1f910
...
...
@@ -63,7 +63,7 @@ public class MessageServiceImpl implements MessageService {
String
templateId
=
requestDTO
.
getTemplateId
();
String
templateName
=
requestDTO
.
getTemplateName
();
// 替换模板格式,保存适合
创蓝
发送短信的模板,避免发送时修改模板格式
// 替换模板格式,保存适合
碧桂园
发送短信的模板,避免发送时修改模板格式
TemplateChangeBean
bean
=
dmHub2BgyTemplateSend
(
templateContent
);
String
chuanglanSend
=
bean
.
getUpSendStr
();
String
params
=
bean
.
getParams
().
toString
();
...
...
@@ -194,14 +194,6 @@ public class MessageServiceImpl implements MessageService {
String
params
=
templateInfo
.
getParams
();
JSONArray
paramsArr
=
JSONArray
.
parseArray
(
params
);
String
smsType
=
templateInfo
.
getType
();
String
areaId
;
if
(
"notification"
.
equals
(
smsType
))
{
areaId
=
BgySMSConfig
.
notifyAreaId
;
}
else
if
(
"marketing"
.
equals
(
smsType
))
{
areaId
=
BgySMSConfig
.
marketAreaId
;
}
else
{
return
new
DmHubResponse
(
"999"
,
"未获取到短信类型"
);
}
// 封装参数
List
<
String
>
paramList
=
new
ArrayList
<>();
Set
<
String
>
keys
=
data
.
keySet
();
...
...
@@ -252,11 +244,14 @@ public class MessageServiceImpl implements MessageService {
String
upContent
=
templateInfo
.
getUpContent
();
content
=
getMsg
(
upContent
,
paramList
);
}
response
=
bgySmsService
.
sendSms
(
mobile
,
content
,
areaId
);
response
=
bgySmsService
.
sendSms
(
mobile
,
content
);
String
code
=
response
.
getCode
();
String
msg
=
response
.
getMsg
();
// TODO 根据DM hub需要的返回数据封装
return
new
DmHubResponse
(
ResponseCode
.
SUCCESS
);
if
(
code
.
equals
(
ResponseCode
.
SUCCESS
.
getCode
()))
{
return
new
DmHubResponse
(
ResponseCode
.
SUCCESS
);
}
else
{
return
new
DmHubResponse
(
code
,
response
.
getMsg
());
}
}
catch
(
Exception
e
)
{
log
.
error
(
"调用短信发送逻辑错误"
,
e
);
return
new
DmHubResponse
(
"999"
,
"插件系统异常"
);
...
...
@@ -265,18 +260,23 @@ public class MessageServiceImpl implements MessageService {
@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
);
response
=
bgySmsService
.
sendSms
(
mobile
,
content
);
String
retCode
=
response
.
getCode
();
if
(
retCode
.
equals
(
ResponseCode
.
SUCCESS
.
getCode
()))
{
return
new
DmHubResponse
(
ResponseCode
.
SUCCESS
);
}
else
{
return
new
DmHubResponse
(
retCode
,
response
.
getMsg
());
}
}
catch
(
Exception
e
)
{
log
.
error
(
"发送短信异常:"
,
e
);
return
new
DmHubResponse
(
"999"
,
"发送通道异常"
);
}
return
new
DmHubResponse
(
ResponseCode
.
SUCCESS
);
}
/**
...
...
@@ -371,7 +371,6 @@ public class MessageServiceImpl implements MessageService {
if
(
paramsArr
==
null
||
paramsArr
.
isEmpty
())
{
try
{
// response = bgySmsService.sendSms("", templateInfo.getUpContent());
String
code
=
response
.
getCode
();
String
msg
=
response
.
getMsg
();
// TODO 根据DM hub需要的返回数据封装
...
...
@@ -381,7 +380,7 @@ public class MessageServiceImpl implements MessageService {
return
new
DmHubResponse
(
code
,
msg
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"调用
创蓝
逻辑错误"
,
e
);
log
.
error
(
"调用
碧桂园
逻辑错误"
,
e
);
// TODO 根据DM hub需要的返回数据封装
return
new
DmHubResponse
(
ResponseCode
.
SYSTEM_ERROR
);
}
...
...
@@ -390,18 +389,15 @@ public class MessageServiceImpl implements MessageService {
Set
<
Map
.
Entry
<
String
,
List
<
String
>>>
entries
=
paramsMap
.
entrySet
();
try
{
// 此处不做拆分操作
// for (Map.Entry<String, List<String>> entry : entries) {
// String mobile = entry.getKey().toString();
// List<String> paramsList = entry.getValue();
// String sendMsg = getMsg(templateInfo.getUpContent(), paramsList);
// response = bgySmsService.sendSms(mobile, sendMsg);
// String code = response.getCode();
// String msg = response.getMsg();
// }
// TODO 待优化
for
(
Map
.
Entry
<
String
,
List
<
String
>>
entry
:
entries
)
{
String
mobile
=
entry
.
getKey
().
toString
();
List
<
String
>
paramsList
=
entry
.
getValue
();
String
sendMsg
=
getMsg
(
templateInfo
.
getUpContent
(),
paramsList
);
response
=
bgySmsService
.
sendSms
(
mobile
,
sendMsg
);
}
return
new
DmHubResponse
(
ResponseCode
.
SUCCESS
);
}
catch
(
Exception
e
)
{
log
.
error
(
"调用
创蓝
逻辑错误:"
,
e
);
log
.
error
(
"调用
碧桂园
逻辑错误:"
,
e
);
return
new
DmHubResponse
(
ResponseCode
.
SYSTEM_ERROR
);
}
}
...
...
@@ -419,14 +415,6 @@ public class MessageServiceImpl implements MessageService {
return
new
DmHubResponse
(
"999"
,
"短信插件未获取到模板信息"
);
}
String
smsType
=
templateInfo
.
getType
();
String
areaId
;
if
(
"notification"
.
equals
(
smsType
))
{
areaId
=
BgySMSConfig
.
notifyAreaId
;
}
else
if
(
"marketing"
.
equals
(
smsType
))
{
areaId
=
BgySMSConfig
.
marketAreaId
;
}
else
{
return
new
DmHubResponse
(
"999"
,
"未获取到短信类型"
);
}
// 模板参数占位符
String
params
=
templateInfo
.
getParams
();
JSONArray
paramsArr
=
JSONArray
.
parseArray
(
params
);
...
...
@@ -496,13 +484,13 @@ public class MessageServiceImpl implements MessageService {
try
{
for
(
String
mobile
:
mobileList
)
{
try
{
response
=
bgySmsService
.
sendSms
(
mobile
,
templateInfo
.
getUpContent
()
,
areaId
);
response
=
bgySmsService
.
sendSms
(
mobile
,
templateInfo
.
getUpContent
());
}
catch
(
Exception
e
)
{
log
.
error
(
"
除0"
);
log
.
error
(
"
短信发送异常"
,
e
);
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
"调用
创蓝
逻辑错误"
,
e
);
log
.
error
(
"调用
碧桂园
逻辑错误"
,
e
);
// TODO 根据DM hub需要的返回数据封装
return
new
DmHubResponse
(
"999"
,
"插件服务系统异常"
);
}
...
...
@@ -515,7 +503,7 @@ public class MessageServiceImpl implements MessageService {
String
mobile
=
entry
.
getKey
().
toString
();
List
<
String
>
paramsList
=
entry
.
getValue
();
String
sendMsg
=
getMsg
(
templateInfo
.
getUpContent
(),
paramsList
);
response
=
bgySmsService
.
sendSms
(
mobile
,
sendMsg
,
areaId
);
response
=
bgySmsService
.
sendSms
(
mobile
,
sendMsg
);
String
code
=
response
.
getCode
();
String
msg
=
response
.
getMsg
();
}
catch
(
Exception
e
)
{
...
...
@@ -526,7 +514,7 @@ public class MessageServiceImpl implements MessageService {
// TODO 待优化
return
new
DmHubResponse
(
ResponseCode
.
SUCCESS
);
}
catch
(
Exception
e
)
{
log
.
error
(
"调用
创蓝
逻辑错误:"
,
e
);
log
.
error
(
"调用
碧桂园
逻辑错误:"
,
e
);
return
new
DmHubResponse
(
"999"
,
"插件服务系统异常"
);
}
}
...
...
src/main/resources/application-dev.yml
View file @
35c1f910
...
...
@@ -33,8 +33,7 @@ system:
appId
:
2021
# 系统id
securityCode
:
930844c7-7985-435b-af47-142b59b299c3
# 鉴权码
url
:
https://xstest.bgy.com.cn/ApiBgyTest/Open/Sms.ashx
notifyAreaId
:
XXJSB
marketAreaId
:
XXJSB
areaId
:
XXJSB
api
:
SendSms
dmHub
:
applicationId
:
cl0300171a6012c21
...
...
src/main/resources/application-prod.yml
View file @
35c1f910
...
...
@@ -34,8 +34,7 @@ system:
appId
:
2021
# 系统id
securityCode
:
930844c7-7985-435b-af47-142b59b299c3
# 鉴权码
url
:
https://xstest.bgy.com.cn/ApiBgyTest/Open/Sms.ashx
notifyAreaId
:
XXJSB
marketAreaId
:
XXJSB
areaId
:
XXJSB
api
:
SendSms
dmHub
:
applicationId
:
cl0300171a6012c21
...
...
src/main/resources/application-test.yml
View file @
35c1f910
...
...
@@ -34,8 +34,6 @@ system:
securityCode
:
930844c7-7985-435b-af47-142b59b299c3
# 鉴权码
url
:
https://xstest.bgy.com.cn/ApiBgyTest/Open/Sms.ashx
areaId
:
XXJSB
notifyAreaId
:
XXJSB
marketAreaId
:
XXJSB
api
:
SendSms
dmHub
:
applicationId
:
cl0300171a6012c21
...
...
src/main/resources/application.yml
View file @
35c1f910
...
...
@@ -8,7 +8,7 @@ info:
spring
:
profiles
:
active
:
test
active
:
dev
mybatis-plus
:
mapper-locations
:
classpath:mapper/*.xml
...
...
src/main/resources/logback-spring.xml
View file @
35c1f910
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include
resource=
"org/springframework/boot/logging/logback/defaults.xml"
/>
<include
resource=
"org/springframework/boot/logging/logback/console-appender.xml"
/>
<!--定义日志文件的存储地址 -->
<property
name=
"LOG_PATH"
value=
"/opt/log/stash/sms-plug"
/>
<include
resource=
"org/springframework/boot/logging/logback/defaults.xml"
/>
<include
resource=
"org/springframework/boot/logging/logback/console-appender.xml"
/>
<appender
name=
"FILE"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<File>
${LOG_PATH}
</File>
<File>
${LOG_PATH}
/smsplug.log
</File>
<encoder>
<pattern>
%date [%level] [%thread] %logger{60} [%file : %line] %msg%n
</pattern>
</encoder>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<fileNamePattern>
${LOG_PATH}daily/
${LOG_FILE}
.%d{yyyy-MM-dd}.gz
</fileNamePattern>
<maxHistory>
18
0
</maxHistory>
<!-- 保留180天 -->
<fileNamePattern>
${LOG_PATH}daily/
sms-plug
.%d{yyyy-MM-dd}.gz
</fileNamePattern>
<maxHistory>
3
0
</maxHistory>
<!-- 保留180天 -->
</rollingPolicy>
</appender>
...
...
@@ -21,13 +23,13 @@
</root>
<!-- 开发、测试环境 -->
<springProfile
name=
"dev,test"
>
<logger
name=
"org.springboot.sample"
level=
"DEBUG"
/>
<logger
name=
"com.bgy"
level=
"DEBUG"
/>
<logger
name=
"org.springboot.sample"
level=
"DEBUG"
/>
<logger
name=
"com.bgy"
level=
"DEBUG"
/>
</springProfile>
<!-- 生产环境 -->
<springProfile
name=
"prod"
>
<logger
name=
"org.springframework.web"
level=
"ERROR"
/>
<logger
name=
"org.springboot.sample"
level=
"ERROR"
/>
<logger
name=
"com.bgy"
level=
"ERROR"
/>
<logger
name=
"org.springboot.sample"
level=
"ERROR"
/>
<logger
name=
"com.bgy"
level=
"ERROR"
/>
</springProfile>
</configuration>
\ No newline at end of file
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