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
509a4926
Commit
509a4926
authored
Apr 23, 2020
by
qinxunjia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
发送短信的逻辑
parent
e32b047a
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
191 additions
and
90 deletions
+191
-90
BizController.java
src/main/java/com/jz/sms/api/BizController.java
+8
-9
CLSendSMSResponse.java
...main/java/com/jz/sms/chuanglan/dto/CLSendSMSResponse.java
+3
-3
ChuangLanSmsService.java
...ava/com/jz/sms/chuanglan/service/ChuangLanSmsService.java
+4
-12
ChuangLanSmsServiceImpl.java
...z/sms/chuanglan/service/impl/ChuangLanSmsServiceImpl.java
+12
-25
DmBatchMapper.java
...main/java/com/jz/sms/repository/mapper/DmBatchMapper.java
+7
-0
DmBatchService.java
src/main/java/com/jz/sms/service/DmBatchService.java
+8
-0
MessageService.java
src/main/java/com/jz/sms/service/MessageService.java
+1
-1
SysBatchService.java
src/main/java/com/jz/sms/service/SysBatchService.java
+4
-1
TemplateChangeBean.java
...main/java/com/jz/sms/service/bean/TemplateChangeBean.java
+4
-4
DmBatchServiceImpl.java
...main/java/com/jz/sms/service/impl/DmBatchServiceImpl.java
+11
-0
MessageServiceImpl.java
...main/java/com/jz/sms/service/impl/MessageServiceImpl.java
+129
-35
No files found.
src/main/java/com/jz/sms/api/BizController.java
View file @
509a4926
package
com
.
jz
.
sms
.
api
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jz.sms.dto.DmHubBatchSendRequest
;
import
com.jz.sms.dto.DmHubBatchSendResponse
;
import
com.jz.sms.dto.DmHubTemplateRequest
;
import
com.jz.sms.dto.DmHubTemplateResponse
;
import
com.jz.sms.dto.*
;
import
com.jz.sms.service.MessageService
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -44,11 +41,11 @@ public class BizController {
* @return
*/
@PostMapping
(
"/sms/batch"
)
public
String
batch
(
@RequestBody
DmHubBatchSendRequest
request
)
{
public
DmHubBatchSendResponse
batch
(
@RequestBody
DmHubBatchSendRequest
request
)
{
log
.
info
(
"**********批量发送入参*******:{}"
,
JSONObject
.
toJSONString
(
request
));
DmHubBatchSendResponse
response
=
messageService
.
batchSend
(
request
);
// log.info("**********批量发送入参*******:{}", response);
return
"fail"
;
return
response
;
}
...
...
@@ -58,10 +55,12 @@ public class BizController {
* @return
*/
@RequestMapping
(
"/sms/send"
)
public
String
send
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
public
DmHubSendResponse
send
(
@RequestBody
DmHubSendRequest
request
)
{
log
.
info
(
"**********单条发送入参*******:{}"
,
JSONObject
.
toJSONString
(
params
));
return
"fail"
;
log
.
info
(
"**********单条发送入参*******:{}"
,
JSONObject
.
toJSONString
(
request
));
DmHubSendResponse
response
=
messageService
.
send
(
request
);
log
.
info
(
"**********单条发送出参*******:{}"
,
JSONObject
.
toJSONString
(
response
));
return
response
;
}
...
...
src/main/java/com/jz/sms/chuanglan/dto/CLSend
Fixed
Response.java
→
src/main/java/com/jz/sms/chuanglan/dto/CLSend
SMS
Response.java
View file @
509a4926
package
com
.
jz
.
sms
.
chuanglan
.
dto
;
public
class
CLSend
Fixed
Response
{
public
class
CLSend
SMS
Response
{
/**
* 响应时间
*/
...
...
@@ -19,9 +19,9 @@ public class CLSendFixedResponse {
private
String
code
;
public
CLSend
Fixed
Response
(){}
public
CLSend
SMS
Response
(){}
public
CLSend
Fixed
Response
(
String
code
,
String
errorMsg
){
public
CLSend
SMS
Response
(
String
code
,
String
errorMsg
){
this
.
code
=
code
;
this
.
errorMsg
=
errorMsg
;
}
...
...
src/main/java/com/jz/sms/chuanglan/service/ChuangLanSmsService.java
View file @
509a4926
package
com
.
jz
.
sms
.
chuanglan
.
service
;
import
com.jz.sms.chuanglan.dto.CLNotifyRequest
;
import
com.jz.sms.chuanglan.dto.CLSend
Fixed
Response
;
import
com.jz.sms.chuanglan.dto.CLSend
SMS
Response
;
import
com.jz.sms.chuanglan.dto.CLTemplateResponse
;
import
com.jz.sms.dto.*
;
import
java.util.List
;
public
interface
ChuangLanSmsService
{
CLTemplateResponse
createTemplate
(
String
content
,
String
type
)
throws
Exception
;
CLSendFixedResponse
sendByFixed
(
String
batchId
,
String
content
,
List
<
String
>
phoneList
,
String
type
)
throws
Exception
;
CLSendFixedResponse
sendByVariable
(
String
batchId
,
String
content
,
List
<
String
>
phoneList
,
String
type
)
throws
Exception
;
DmHubSendResponse
sendBatchByFixed
(
DmHubSendRequest
requestDTO
);
CLSendSMSResponse
sendByFixed
(
String
batchId
,
String
content
,
String
sendParams
,
String
type
)
throws
Exception
;
DmHubBatchSendResponse
sendBatchByVariable
(
DmHubBatchSendRequest
requestDTO
);
CLSendSMSResponse
sendByVariable
(
String
batchId
,
String
content
,
String
sendParams
,
String
type
)
throws
Exception
;
void
asyncNotify
(
CLNotifyRequest
notifyInfo
);
}
src/main/java/com/jz/sms/chuanglan/service/impl/ChuangLanSmsServiceImpl.java
View file @
509a4926
...
...
@@ -7,7 +7,7 @@ import com.baomidou.mybatisplus.mapper.EntityWrapper;
import
com.jz.sms.api.BizController
;
import
com.jz.sms.chuanglan.dto.CLNotifyRequest
;
import
com.jz.sms.chuanglan.dto.CLSendFixedRequest
;
import
com.jz.sms.chuanglan.dto.CLSend
Fixed
Response
;
import
com.jz.sms.chuanglan.dto.CLSend
SMS
Response
;
import
com.jz.sms.chuanglan.dto.CLTemplateResponse
;
import
com.jz.sms.chuanglan.service.ChuangLanSmsService
;
import
com.jz.sms.chuanglan.utils.ChuangLanSmsUtil
;
...
...
@@ -85,7 +85,7 @@ public class ChuangLanSmsServiceImpl implements ChuangLanSmsService {
}
@Override
public
CLSend
FixedResponse
sendByFixed
(
String
batchId
,
String
content
,
List
<
String
>
phoneList
,
String
type
)
throws
Exception
{
public
CLSend
SMSResponse
sendByFixed
(
String
batchId
,
String
content
,
String
sendParams
,
String
type
)
throws
Exception
{
String
account
;
String
password
;
if
(
"notification"
.
equals
(
type
))
{
...
...
@@ -101,7 +101,8 @@ public class ChuangLanSmsServiceImpl implements ChuangLanSmsService {
throw
new
Exception
(
"123"
);
}
CLSendFixedRequest
request
=
new
CLSendFixedRequest
(
account
,
password
,
content
,
listToString
(
phoneList
),
"true"
,
batchId
);
content
=
"【九章数据】"
+
content
;
CLSendFixedRequest
request
=
new
CLSendFixedRequest
(
account
,
password
,
content
,
sendParams
,
"true"
,
batchId
);
String
requestJson
=
JSONObject
.
toJSONString
(
request
);
log
.
info
(
"【{}】发送固定内容短信,请求上游数据为:{}"
,
batchId
,
requestJson
);
...
...
@@ -109,19 +110,14 @@ public class ChuangLanSmsServiceImpl implements ChuangLanSmsService {
log
.
info
(
"【{}】发送固定内容短信,上游返回数据为:{}"
,
batchId
,
requestJson
);
if
(
StringUtils
.
isBlank
(
responseStr
))
{
return
new
CLSend
Fixed
Response
(
"500"
,
"渠道同步响应为空"
);
return
new
CLSend
SMS
Response
(
"500"
,
"渠道同步响应为空"
);
}
CLSend
FixedResponse
response
=
JSON
.
parseObject
(
responseStr
,
CLSendFixed
Response
.
class
);
CLSend
SMSResponse
response
=
JSON
.
parseObject
(
responseStr
,
CLSendSMS
Response
.
class
);
return
response
;
}
private
String
listToString
(
List
<
String
>
list
)
{
String
s
=
list
.
toString
();
return
s
;
}
@Override
public
CLSend
FixedResponse
sendByVariable
(
String
batchId
,
String
content
,
List
<
String
>
params
,
String
type
)
throws
Exception
{
public
CLSend
SMSResponse
sendByVariable
(
String
batchId
,
String
content
,
String
params
,
String
type
)
throws
Exception
{
String
account
;
String
password
;
if
(
"notification"
.
equals
(
type
))
{
...
...
@@ -136,31 +132,22 @@ public class ChuangLanSmsServiceImpl implements ChuangLanSmsService {
log
.
info
(
"发送短信的模式为:{未知类型}"
);
throw
new
Exception
(
"123"
);
}
content
=
"【九章数据】"
+
content
;
CLSendFixedRequest
request
=
new
CLSendFixedRequest
(
account
,
password
,
content
,
listToString
(
params
)
,
"true"
,
batchId
);
CLSendFixedRequest
request
=
new
CLSendFixedRequest
(
account
,
password
,
content
,
params
,
"true"
,
batchId
);
String
requestJson
=
JSONObject
.
toJSONString
(
request
);
log
.
info
(
"【{}】发送固定内容短信,请求上游数据为:{}"
,
batchId
,
requestJson
);
String
responseStr
=
ChuangLanSmsUtil
.
sendSmsByPost
(
ChuangLanSMSConfig
.
sendFixed
,
requestJson
);
log
.
info
(
"【{}】发送固定内容短信,上游返回数据为:{}"
,
batchId
,
re
questJson
);
log
.
info
(
"【{}】发送固定内容短信,上游返回数据为:{}"
,
batchId
,
re
sponseStr
);
if
(
StringUtils
.
isBlank
(
responseStr
))
{
return
new
CLSend
Fixed
Response
(
"500"
,
"渠道同步响应为空"
);
return
new
CLSend
SMS
Response
(
"500"
,
"渠道同步响应为空"
);
}
CLSend
FixedResponse
response
=
JSON
.
parseObject
(
responseStr
,
CLSendFixed
Response
.
class
);
CLSend
SMSResponse
response
=
JSON
.
parseObject
(
responseStr
,
CLSendSMS
Response
.
class
);
return
response
;
}
@Override
public
DmHubSendResponse
sendBatchByFixed
(
DmHubSendRequest
requestDTO
)
{
return
null
;
}
@Override
public
DmHubBatchSendResponse
sendBatchByVariable
(
DmHubBatchSendRequest
requestDTO
)
{
return
null
;
}
@Override
public
void
asyncNotify
(
CLNotifyRequest
notifyInfo
)
{
...
...
src/main/java/com/jz/sms/repository/mapper/DmBatchMapper.java
0 → 100644
View file @
509a4926
package
com
.
jz
.
sms
.
repository
.
mapper
;
import
com.baomidou.mybatisplus.mapper.BaseMapper
;
import
com.jz.sms.repository.domain.DmBatchInfo
;
public
interface
DmBatchMapper
extends
BaseMapper
<
DmBatchInfo
>
{
}
src/main/java/com/jz/sms/service/DmBatchService.java
0 → 100644
View file @
509a4926
package
com
.
jz
.
sms
.
service
;
import
com.baomidou.mybatisplus.service.IService
;
import
com.jz.sms.repository.domain.DmBatchInfo
;
public
interface
DmBatchService
extends
IService
<
DmBatchInfo
>
{
}
src/main/java/com/jz/sms/service/MessageService.java
View file @
509a4926
...
...
@@ -2,7 +2,7 @@ package com.jz.sms.service;
import
com.jz.sms.dto.*
;
public
interface
MessageService
{
public
interface
MessageService
{
/**
* DM hub创建模板同步插件接口
...
...
src/main/java/com/jz/sms/service/SysBatchService.java
View file @
509a4926
package
com
.
jz
.
sms
.
service
;
public
interface
SysBatchService
{
import
com.baomidou.mybatisplus.service.IService
;
import
com.jz.sms.repository.domain.SysBatchInfo
;
public
interface
SysBatchService
extends
IService
<
SysBatchInfo
>
{
}
src/main/java/com/jz/sms/service/bean/TemplateChangeBean.java
View file @
509a4926
...
...
@@ -9,14 +9,14 @@ public class TemplateChangeBean {
private
String
newStr
;
private
List
<
String
>
params
;
private
JSONArray
params
;
public
TemplateChangeBean
()
{
}
public
TemplateChangeBean
(
String
newStr
,
List
<
String
>
params
)
{
public
TemplateChangeBean
(
String
newStr
,
JSONArray
params
)
{
this
.
newStr
=
newStr
;
this
.
params
=
params
;
}
...
...
@@ -29,11 +29,11 @@ public class TemplateChangeBean {
this
.
newStr
=
newStr
;
}
public
List
<
String
>
getParams
()
{
public
JSONArray
getParams
()
{
return
params
;
}
public
void
setParams
(
List
<
String
>
params
)
{
public
void
setParams
(
JSONArray
params
)
{
this
.
params
=
params
;
}
}
src/main/java/com/jz/sms/service/impl/DmBatchServiceImpl.java
0 → 100644
View file @
509a4926
package
com
.
jz
.
sms
.
service
.
impl
;
import
com.baomidou.mybatisplus.service.impl.ServiceImpl
;
import
com.jz.sms.repository.domain.DmBatchInfo
;
import
com.jz.sms.repository.mapper.DmBatchMapper
;
import
com.jz.sms.service.DmBatchService
;
import
org.springframework.stereotype.Service
;
@Service
public
class
DmBatchServiceImpl
extends
ServiceImpl
<
DmBatchMapper
,
DmBatchInfo
>
implements
DmBatchService
{
}
src/main/java/com/jz/sms/service/impl/MessageServiceImpl.java
View file @
509a4926
...
...
@@ -3,13 +3,15 @@ package com.jz.sms.service.impl;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.mapper.EntityWrapper
;
import
com.jz.sms.chuanglan.dto.CLSend
Fixed
Response
;
import
com.jz.sms.chuanglan.dto.CLSend
SMS
Response
;
import
com.jz.sms.chuanglan.dto.CLTemplateResponse
;
import
com.jz.sms.chuanglan.service.ChuangLanSmsService
;
import
com.jz.sms.config.ResponseCode
;
import
com.jz.sms.dto.*
;
import
com.jz.sms.repository.domain.DmBatchInfo
;
import
com.jz.sms.repository.domain.SmsTemplateInfo
;
import
com.jz.sms.repository.domain.SysBatchInfo
;
import
com.jz.sms.service.DmBatchService
;
import
com.jz.sms.service.MessageService
;
import
com.jz.sms.service.SmsTemplateService
;
import
com.jz.sms.service.bean.TemplateChangeBean
;
...
...
@@ -39,6 +41,9 @@ public class MessageServiceImpl implements MessageService {
@Autowired
private
ChuangLanSmsService
chuangLanSmsService
;
@Autowired
private
DmBatchService
dmBatchService
;
/**
* 短信模板创建
*
...
...
@@ -120,8 +125,9 @@ public class MessageServiceImpl implements MessageService {
String
group
=
matcher
.
group
();
groups
.
add
(
group
);
}
JSONArray
arr
=
new
JSONArray
();
if
(
groups
.
isEmpty
())
{
return
new
TemplateChangeBean
(
content
,
groups
);
return
new
TemplateChangeBean
(
content
,
arr
);
}
int
idx
=
content
.
indexOf
(
"${surl!'"
);
if
(
idx
>=
0
)
{
...
...
@@ -144,11 +150,13 @@ public class MessageServiceImpl implements MessageService {
content
=
content
.
replaceAll
(
g
,
"\\{\\$var\\}"
);
}
return
new
TemplateChangeBean
(
content
,
groups
);
arr
.
addAll
(
groups
);
return
new
TemplateChangeBean
(
content
,
arr
);
}
public
String
dmHub2ChuangLanCreate
(
String
content
)
{
// TODO 简单处理,没有处理长度
content
=
content
.
replaceAll
(
"\\{\\$var\\}"
,
"\\{s20\\}"
);
return
content
;
...
...
@@ -179,10 +187,41 @@ public class MessageServiceImpl implements MessageService {
return
null
;
}
// 2、根据请求信息获取用户的手机号码(此处不考虑配置DMHUB系统不是SMS的情况),直接拿请求体中的_audienceId字段值,该值为手机号码
String
phone
=
data
.
getString
(
"_audienceId"
);
List
<
String
>
phoneList
=
new
ArrayList
<>();
phoneList
.
add
(
phone
);
// 模板参数占位符
String
params
=
templateInfo
.
getParams
();
JSONArray
paramsArr
=
JSONArray
.
parseArray
(
params
);
// 封装参数
StringBuilder
sendParams
=
new
StringBuilder
();
Set
<
String
>
keys
=
data
.
keySet
();
String
mobile
=
data
.
getString
(
"_audienceId"
);
data
.
remove
(
"name"
);
data
.
remove
(
"id"
);
data
.
remove
(
"_audienceId"
);
sendParams
.
append
(
mobile
);
if
(!
data
.
isEmpty
())
{
for
(
Object
parm
:
paramsArr
)
{
String
s
=
parm
.
toString
();
for
(
String
key
:
keys
)
{
String
newKey
=
key
;
Object
value
=
data
.
get
(
key
);
if
(
value
instanceof
JSONObject
||
value
instanceof
Map
)
{
StringBuilder
keyBuffer
=
new
StringBuilder
(
key
);
value
=
test
(
value
,
keyBuffer
);
newKey
=
keyBuffer
.
toString
();
}
if
(
s
.
contains
(
newKey
))
{
sendParams
.
append
(
","
).
append
(
value
.
toString
());
}
}
}
sendParams
.
append
(
";"
);
}
else
{
sendParams
.
append
(
","
);
}
String
type
=
templateInfo
.
getType
();
// 3、记录批次信息
...
...
@@ -199,33 +238,13 @@ public class MessageServiceImpl implements MessageService {
// 判断模板是固定短信还是变量短信
String
content
=
templateInfo
.
getContent
();
// String content2 = "亲爱的${name@6!\"\"},您的手机号码:${mobile@12!\"\"}参与了优惠活动,详见: ${surl!'https://www.baidu.com/?cl_sr=短消息'} 回TD退订";
String
regex
=
"\\$\\{[^}]+\\}"
;
Pattern
pattern
=
Pattern
.
compile
(
regex
);
Matcher
matcher
=
pattern
.
matcher
(
content
);
List
<
String
>
list
=
new
ArrayList
<>();
while
(
matcher
.
find
())
{
String
group
=
matcher
.
group
();
list
.
add
(
group
);
}
log
.
info
(
"模板变量参数为:{}"
,
list
.
toString
());
if
(
list
.
size
()
>
0
)
{
// 变量模板
// 3、模板参数文本替换。获取模板中的动态参内容,替换成创蓝需要的格式${var}.将请求中的参数信息和模板中的变量名对应起来,封装创蓝请求参数
for
(
String
str
:
list
)
{
}
CLSendFixedResponse
chuanglanResponse
=
chuangLanSmsService
.
sendByFixed
(
dmHubBatchId
,
content
,
phoneList
,
type
);
if
(
paramsArr
==
null
||
paramsArr
.
isEmpty
())
{
CLSendSMSResponse
chuanglanResponse
=
chuangLanSmsService
.
sendByFixed
(
dmHubBatchId
,
templateInfo
.
getUpContent
(),
sendParams
.
toString
(),
type
);
}
else
{
// 固定模板
// 4、封裝數據
chuangLanSmsService
.
sendByVariable
(
dmHubBatchId
,
content
,
phoneList
,
type
);
CLSendSMSResponse
response
=
chuangLanSmsService
.
sendByVariable
(
dmHubBatchId
,
templateInfo
.
getUpContent
(),
sendParams
.
toString
()
,
type
);
}
...
...
@@ -249,26 +268,101 @@ public class MessageServiceImpl implements MessageService {
return
new
DmHubBatchSendResponse
(
"500"
,
"模板不存在"
);
}
// 模板参数占位符
String
params
=
templateInfo
.
getParams
();
JSONArray
paramsArr
=
JSONArray
.
parseArray
(
params
);
// 封装参数
StringBuilder
sendParams
=
new
StringBuilder
();
for
(
JSONObject
json
:
data
)
{
Set
<
String
>
keys
=
json
.
keySet
();
StringBuilder
sb
=
new
StringBuilder
();
String
mobile
=
json
.
getString
(
"_audienceId"
);
json
.
remove
(
"name"
);
json
.
remove
(
"id"
);
json
.
remove
(
"_audienceId"
);
s
b
.
append
(
mobile
);
s
endParams
.
append
(
mobile
);
if
(!
json
.
isEmpty
())
{
for
(
String
key
:
keys
)
{
String
value
=
json
.
getString
(
key
);
for
(
Object
parm
:
paramsArr
)
{
String
s
=
parm
.
toString
();
for
(
String
key
:
keys
)
{
String
newKey
=
key
;
Object
value
=
json
.
get
(
key
);
if
(
value
instanceof
JSONObject
||
value
instanceof
Map
)
{
StringBuilder
keyBuffer
=
new
StringBuilder
(
key
);
value
=
test
(
value
,
keyBuffer
);
newKey
=
keyBuffer
.
toString
();
}
if
(
s
.
contains
(
newKey
))
{
sendParams
.
append
(
","
).
append
(
value
.
toString
());
}
}
}
sendParams
.
append
(
";"
);
}
else
{
sendParams
.
append
(
","
);
}
}
System
.
out
.
println
(
sendParams
.
toString
());
DmBatchInfo
dmInfo
=
new
DmBatchInfo
();
dmInfo
.
setDmBatchId
(
batchId
);
dmInfo
.
setDmTemplateId
(
templateId
);
dmInfo
.
setSmsNum
(
data
.
size
());
dmInfo
.
setId
(
IdHandler
.
nextId
());
dmInfo
.
setDateCreated
(
new
Date
());
dmInfo
.
setLastUpdated
(
new
Date
());
dmBatchService
.
insert
(
dmInfo
);
SysBatchInfo
info
=
new
SysBatchInfo
();
info
.
setId
(
info
.
getBatchId
());
info
.
setDmBatchId
(
batchId
);
info
.
setSmsNum
(
data
.
size
());
info
.
setDmTemplateId
(
templateId
);
Long
sysBatchId
=
IdHandler
.
nextId
();
info
.
setBatchId
(
sysBatchId
);
info
.
setDateCreated
(
new
Date
());
info
.
setLastUpdated
(
new
Date
());
sysBatchService
.
insert
(
info
);
if
(
paramsArr
==
null
||
paramsArr
.
isEmpty
())
{
try
{
CLSendSMSResponse
response
=
chuangLanSmsService
.
sendByFixed
(
batchId
,
templateInfo
.
getUpContent
(),
sendParams
.
toString
(),
templateInfo
.
getType
());
}
catch
(
Exception
e
)
{
log
.
error
(
"调用创蓝逻辑错误:{}"
,
e
);
return
null
;
}
}
else
{
try
{
CLSendSMSResponse
response
=
chuangLanSmsService
.
sendByVariable
(
batchId
,
templateInfo
.
getUpContent
(),
sendParams
.
toString
(),
templateInfo
.
getType
());
}
catch
(
Exception
e
)
{
log
.
error
(
"调用创蓝逻辑错误:{}"
,
e
);
return
null
;
}
}
return
null
;
}
public
String
test
(
Object
value
,
StringBuilder
keyBuffer
)
{
String
s
=
JSONObject
.
toJSONString
(
value
);
JSONObject
valueJson
=
JSONObject
.
parseObject
(
s
);
Set
<
String
>
set
=
valueJson
.
keySet
();
if
(
set
.
isEmpty
())
{
return
value
.
toString
();
}
for
(
String
str
:
set
)
{
keyBuffer
.
append
(
"."
).
append
(
str
);
Object
info
=
valueJson
.
get
(
str
);
if
(
info
instanceof
JSONObject
||
info
instanceof
Map
)
{
String
test
=
test
(
info
,
keyBuffer
);
return
test
;
}
else
{
return
info
.
toString
();
}
}
return
value
.
toString
();
}
}
...
...
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