记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
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
董敬伟
liquidnet-bus-v1
Commits
8d0a37dc
Commit
8d0a37dc
authored
Mar 01, 2022
by
jiangxiulong
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/jxl_0223_msg' into pre
parents
68ec260a
c42e317a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
203 additions
and
193 deletions
+203
-193
SweetAppletSubMsgSendServiceImpl.java
.../sweet/service/impl/SweetAppletSubMsgSendServiceImpl.java
+109
-0
SweetAppletSubMsgServiceImpl.java
...vice/sweet/service/impl/SweetAppletSubMsgServiceImpl.java
+94
-193
No files found.
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/service/impl/SweetAppletSubMsgSendServiceImpl.java
0 → 100644
View file @
8d0a37dc
package
com
.
liquidnet
.
service
.
sweet
.
service
.
impl
;
import
cn.binarywang.wx.miniapp.api.WxMaService
;
import
cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.liquidnet.commons.lang.util.CollectionUtil
;
import
com.liquidnet.service.sweet.config.WechatMaConfigure
;
import
com.liquidnet.service.sweet.entity.SweetAppletSubMsg
;
import
com.liquidnet.service.sweet.mapper.SweetAppletSubMsgMapper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* <p>
* 小程序订阅消息记录表 服务实现类
* </p>
*
* @author jiangxiulong
* @since 2021-11-22
*/
@Service
@Slf4j
public
class
SweetAppletSubMsgSendServiceImpl
{
@Autowired
private
SweetAppletSubMsgMapper
subMsgMapper
;
@Autowired
WechatMaConfigure
wechatMaConfigure
;
@Async
public
void
toSend
(
List
<
SweetAppletSubMsg
>
msgList
,
String
targetId
,
String
title
,
String
timeStart
)
{
ArrayList
<
String
>
msgIdList
=
CollectionUtil
.
arrayListString
();
if
(!
CollectionUtils
.
isEmpty
(
msgList
))
{
for
(
SweetAppletSubMsg
info
:
msgList
)
{
try
{
String
msgId
=
info
.
getMsgId
();
// 发送订阅消息接口
boolean
subMessage
=
sendSubMessage
(
info
,
targetId
,
title
,
timeStart
);
if
(
subMessage
)
{
msgIdList
.
add
(
msgId
);
}
}
catch
(
Exception
e
)
{
// log.error("小程序演出订阅提醒消息处理异常", e);
}
}
if
(!
CollectionUtils
.
isEmpty
(
msgIdList
))
{
SweetAppletSubMsg
update
=
new
SweetAppletSubMsg
();
update
.
setIsPush
(
2
);
update
.
setUpdatedAt
(
LocalDateTime
.
now
());
subMsgMapper
.
update
(
update
,
Wrappers
.
lambdaUpdate
(
SweetAppletSubMsg
.
class
)
.
in
(
SweetAppletSubMsg:
:
getMsgId
,
msgIdList
)
);
}
}
}
/**
* 微信小程序推送订阅消息
*/
private
boolean
sendSubMessage
(
SweetAppletSubMsg
info
,
String
performancesId
,
String
title
,
String
timeStart
)
{
WxMaSubscribeMessage
subscribeMessage
=
new
WxMaSubscribeMessage
();
subscribeMessage
.
setPage
(
"pages/webview?query=showdetails&id="
.
concat
(
performancesId
));
subscribeMessage
.
setTemplateId
(
info
.
getTemplateId
());
subscribeMessage
.
setToUser
(
info
.
getOpenId
());
ArrayList
<
WxMaSubscribeMessage
.
MsgData
>
wxMaSubscribeData
=
new
ArrayList
<>();
WxMaSubscribeMessage
.
MsgData
wxMaSubscribeData1
=
new
WxMaSubscribeMessage
.
MsgData
();
wxMaSubscribeData1
.
setName
(
"thing1"
);
wxMaSubscribeData1
.
setValue
(
title
);
//每个参数 存放到大集合中
wxMaSubscribeData
.
add
(
wxMaSubscribeData1
);
// 第二个内容:用户昵称
WxMaSubscribeMessage
.
MsgData
wxMaSubscribeData2
=
new
WxMaSubscribeMessage
.
MsgData
();
wxMaSubscribeData2
.
setName
(
"time2"
);
wxMaSubscribeData2
.
setValue
(
timeStart
);
wxMaSubscribeData
.
add
(
wxMaSubscribeData2
);
// 第三个内容:领取方式
WxMaSubscribeMessage
.
MsgData
wxMaSubscribeData3
=
new
WxMaSubscribeMessage
.
MsgData
();
wxMaSubscribeData3
.
setName
(
"thing3"
);
wxMaSubscribeData3
.
setValue
(
"您关注的演出活动门票即将开售,请准备购票"
);
wxMaSubscribeData
.
add
(
wxMaSubscribeData3
);
subscribeMessage
.
setData
(
wxMaSubscribeData
);
try
{
//获取微信小程序配置:
WxMaService
wxService
=
wechatMaConfigure
.
getWxMaService
(
info
.
getAppletType
());
//进行推送
wxService
.
getMsgService
().
sendSubscribeMsg
(
subscribeMessage
);
return
true
;
}
catch
(
Exception
e
)
{
// log.error("sendSubMessageException e{}", e);
}
return
false
;
}
}
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/service/impl/SweetAppletSubMsgServiceImpl.java
View file @
8d0a37dc
package
com
.
liquidnet
.
service
.
sweet
.
service
.
impl
;
import
cn.binarywang.wx.miniapp.api.WxMaService
;
import
cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.liquidnet.commons.lang.util.CollectionUtil
;
...
...
@@ -19,17 +18,14 @@ import com.liquidnet.service.sweet.entity.SweetAppletSubMsg;
import
com.liquidnet.service.sweet.mapper.SweetAppletSubMsgMapper
;
import
com.liquidnet.service.sweet.service.ISweetAppletSubMsgService
;
import
com.liquidnet.service.sweet.utils.QueueUtils
;
import
com.liquidnet.service.sweet.utils.RedisActivityUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.ArrayList
;
import
java.util.LinkedList
;
import
java.util.List
;
...
...
@@ -58,12 +54,32 @@ public class SweetAppletSubMsgServiceImpl extends ServiceImpl<SweetAppletSubMsgM
private
QueueUtils
queueUtils
;
@Autowired
private
RedisActivityUtils
redisActivityUtils
;
private
SweetAppletSubMsgSendServiceImpl
sweetAppletSubMsgSendService
;
private
static
final
int
pageSize
=
2000
;
@Override
public
ResponseDto
<
Boolean
>
create
(
String
openId
,
String
unionId
,
String
templateId
,
String
targetId
,
Integer
appletType
,
Integer
activityType
)
{
String
[]
templateIdArray
=
templateId
.
split
(
","
);
String
uid
=
StringUtils
.
defaultString
(
CurrentUtil
.
getCurrentUid
(),
""
);
LinkedList
<
String
>
sqls
=
CollectionUtil
.
linkedListString
();
LinkedList
<
Object
[]>
sqlsDataA
=
CollectionUtil
.
linkedListObjectArr
();
sqls
.
add
(
SqlMapping
.
get
(
"sweet_applet_sub_msg.insert"
));
for
(
String
id
:
templateIdArray
)
{
sqlsDataA
.
add
(
new
Object
[]{
IDGenerator
.
nextSnowId
(),
openId
,
unionId
,
uid
,
id
,
targetId
,
appletType
,
activityType
});
}
queueUtils
.
sendMsgByRedis
(
MQConst
.
SweetQueue
.
SWEET_REMIND_INSERT
.
getKey
(),
SqlMapping
.
gets
(
sqls
,
sqlsDataA
));
return
ResponseDto
.
success
();
}
public
ResponseDto
sendMsg
(
Integer
type
)
{
List
<
SweetAppletSubMsgOfTypeDto
>
targetIds
=
subMsgMapper
.
selectListOfType
(
type
);
for
(
SweetAppletSubMsgOfTypeDto
targetIdInfo
:
targetIds
)
{
String
targetId
=
targetIdInfo
.
getTargetId
();
ResponseDto
<
KylinPerformanceVo
>
kylinPerformanceVo
=
feignKylinPerformancesClient
.
detail
(
targetId
,
0
,
0
,
""
);
...
...
@@ -77,40 +93,25 @@ public class SweetAppletSubMsgServiceImpl extends ServiceImpl<SweetAppletSubMsgM
log
.
info
(
"当前演出还不能推送:[状态={}]"
,
isPush
);
continue
;
}
List
<
SweetAppletSubMsg
>
msgList
=
subMsgMapper
.
selectList
(
Wrappers
.
lambdaQuery
(
SweetAppletSubMsg
.
class
)
.
eq
(
SweetAppletSubMsg:
:
getIsPush
,
1
)
.
eq
(
SweetAppletSubMsg:
:
getActivityType
,
type
)
.
eq
(
SweetAppletSubMsg:
:
getTargetId
,
targetId
)
);
String
title
=
performanceVoData
.
getTitle
();
String
timeStart
=
performanceVoData
.
getTimeStart
();
ArrayList
<
String
>
msgIdList
=
CollectionUtil
.
arrayListString
();
if
(!
CollectionUtils
.
isEmpty
(
msgList
))
{
for
(
SweetAppletSubMsg
info
:
msgList
)
{
try
{
String
msgId
=
info
.
getMsgId
();
// 发送订阅消息接口
boolean
subMessage
=
sendSubMessage
(
info
,
targetId
,
title
,
timeStart
);
if
(
subMessage
)
{
msgIdList
.
add
(
msgId
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"小程序演出订阅提醒消息处理异常"
,
e
);
}
}
if
(!
CollectionUtils
.
isEmpty
(
msgIdList
))
{
SweetAppletSubMsg
update
=
new
SweetAppletSubMsg
();
update
.
setIsPush
(
2
);
update
.
setUpdatedAt
(
LocalDateTime
.
now
());
subMsgMapper
.
update
(
update
,
Wrappers
.
lambdaUpdate
(
SweetAppletSubMsg
.
class
)
.
in
(
SweetAppletSubMsg:
:
getMsgId
,
msgIdList
)
);
}
LambdaQueryWrapper
<
SweetAppletSubMsg
>
queryWrapper
=
Wrappers
.
lambdaQuery
(
SweetAppletSubMsg
.
class
)
.
eq
(
SweetAppletSubMsg:
:
getIsPush
,
1
)
.
eq
(
SweetAppletSubMsg:
:
getActivityType
,
type
)
.
eq
(
SweetAppletSubMsg:
:
getTargetId
,
targetId
);
Integer
count
=
subMsgMapper
.
selectCount
(
queryWrapper
);
int
countPage
=
(
int
)
Math
.
ceil
(
count
/
pageSize
);
countPage
=
countPage
+
1
;
for
(
int
page
=
0
;
page
<
countPage
;
page
++)
{
List
<
SweetAppletSubMsg
>
msgList
=
subMsgMapper
.
selectList
(
queryWrapper
.
last
(
"LIMIT "
.
concat
(
String
.
valueOf
(
page
*
pageSize
))
.
concat
(
","
.
concat
(
String
.
valueOf
(
pageSize
)))
)
);
sweetAppletSubMsgSendService
.
toSend
(
msgList
,
targetId
,
title
,
timeStart
);
}
}
return
ResponseDto
.
success
();
...
...
@@ -118,179 +119,78 @@ public class SweetAppletSubMsgServiceImpl extends ServiceImpl<SweetAppletSubMsgM
@Override
public
ResponseDto
sendOfActivityType
(
Integer
activityType
,
String
targetId
,
Integer
timeType
)
{
List
<
SweetAppletSubMsg
>
msgList
=
subMsgMapper
.
selectList
(
Wrappers
.
lambdaQuery
(
SweetAppletSubMsg
.
class
)
.
eq
(
SweetAppletSubMsg:
:
getIsPush
,
1
)
.
eq
(
SweetAppletSubMsg:
:
getActivityType
,
activityType
)
.
eq
(
SweetAppletSubMsg:
:
getTargetId
,
targetId
)
);
KylinPerformanceVo
performanceVoData
=
null
;
if
(!
targetId
.
isEmpty
())
{
ResponseDto
<
KylinPerformanceVo
>
kylinPerformanceVo
=
feignKylinPerformancesClient
.
detail
(
targetId
,
0
,
0
,
""
);
performanceVoData
=
kylinPerformanceVo
.
getData
();
if
(
null
==
performanceVoData
||
ObjectUtils
.
isEmpty
(
performanceVoData
))
{
log
.
info
(
"无演出数据:[performancesId={}]"
,
targetId
);
return
ResponseDto
.
failure
(
"无演出数据"
);
}
if
(
timeType
==
1
)
{
Integer
isPush
=
isPush
(
performanceVoData
,
targetId
);
if
(
isPush
!=
3
)
{
return
ResponseDto
.
failure
(
"当前演出还不能推送,状态"
.
concat
(
String
.
valueOf
(
isPush
)));
}
ResponseDto
<
KylinPerformanceVo
>
kylinPerformanceVo
=
feignKylinPerformancesClient
.
detail
(
targetId
,
0
,
0
,
""
);
KylinPerformanceVo
performanceVoData
=
kylinPerformanceVo
.
getData
();
if
(
null
==
performanceVoData
||
ObjectUtils
.
isEmpty
(
performanceVoData
))
{
log
.
info
(
"无演出数据:[performancesId={}]"
,
targetId
);
return
ResponseDto
.
failure
(
"无演出数据"
);
}
if
(
timeType
==
1
)
{
Integer
isPush
=
isPush
(
performanceVoData
,
targetId
);
if
(
isPush
!=
3
)
{
return
ResponseDto
.
failure
(
"当前演出还不能推送,状态"
.
concat
(
String
.
valueOf
(
isPush
)));
}
}
String
title
=
performanceVoData
.
getTitle
();
String
timeStart
=
performanceVoData
.
getTimeStart
();
ArrayList
<
String
>
msgIdList
=
CollectionUtil
.
arrayListString
();
if
(!
CollectionUtils
.
isEmpty
(
msgList
))
{
for
(
SweetAppletSubMsg
info
:
msgList
)
{
try
{
String
msgId
=
info
.
getMsgId
();
// 发送订阅消息接口
boolean
subMessage
=
sendSubMessage
(
info
,
targetId
,
title
,
timeStart
);
if
(
subMessage
)
{
msgIdList
.
add
(
msgId
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"小程序演出订阅提醒消息处理异常"
,
e
);
}
}
if
(!
CollectionUtils
.
isEmpty
(
msgIdList
))
{
SweetAppletSubMsg
update
=
new
SweetAppletSubMsg
();
update
.
setIsPush
(
2
);
update
.
setTargetId
(
targetId
);
update
.
setUpdatedAt
(
LocalDateTime
.
now
());
subMsgMapper
.
update
(
update
,
Wrappers
.
lambdaUpdate
(
SweetAppletSubMsg
.
class
)
.
in
(
SweetAppletSubMsg:
:
getMsgId
,
msgIdList
)
);
}
LambdaQueryWrapper
<
SweetAppletSubMsg
>
queryWrapper
=
Wrappers
.
lambdaQuery
(
SweetAppletSubMsg
.
class
)
.
eq
(
SweetAppletSubMsg:
:
getIsPush
,
1
)
.
eq
(
SweetAppletSubMsg:
:
getActivityType
,
activityType
)
.
eq
(
SweetAppletSubMsg:
:
getTargetId
,
targetId
);
Integer
count
=
subMsgMapper
.
selectCount
(
queryWrapper
);
int
countPage
=
(
int
)
Math
.
ceil
(
count
/
pageSize
);
countPage
=
countPage
+
1
;
for
(
int
page
=
0
;
page
<
countPage
;
page
++)
{
List
<
SweetAppletSubMsg
>
msgList
=
subMsgMapper
.
selectList
(
queryWrapper
.
last
(
"LIMIT "
.
concat
(
String
.
valueOf
(
page
*
pageSize
))
.
concat
(
","
.
concat
(
String
.
valueOf
(
pageSize
)))
)
);
sweetAppletSubMsgSendService
.
toSend
(
msgList
,
targetId
,
title
,
timeStart
);
}
return
ResponseDto
.
success
();
}
@Override
public
ResponseDto
sendOfMid
(
String
midList
,
String
targetId
,
Integer
timeType
)
{
String
[]
midListArray
=
midList
.
split
(
","
);
List
<
SweetAppletSubMsg
>
msgList
=
subMsgMapper
.
selectList
(
Wrappers
.
lambdaQuery
(
SweetAppletSubMsg
.
class
)
.
eq
(
SweetAppletSubMsg:
:
getIsPush
,
1
)
.
in
(
SweetAppletSubMsg:
:
getMid
,
midListArray
)
);
KylinPerformanceVo
performanceVoData
=
null
;
if
(!
targetId
.
isEmpty
())
{
ResponseDto
<
KylinPerformanceVo
>
kylinPerformanceVo
=
feignKylinPerformancesClient
.
detail
(
targetId
,
0
,
0
,
""
);
performanceVoData
=
kylinPerformanceVo
.
getData
();
if
(
null
==
performanceVoData
||
ObjectUtils
.
isEmpty
(
performanceVoData
))
{
log
.
info
(
"无演出数据:[performancesId={}]"
,
targetId
);
return
ResponseDto
.
failure
(
"无演出数据"
);
}
if
(
timeType
==
1
)
{
Integer
isPush
=
isPush
(
performanceVoData
,
targetId
);
if
(
isPush
!=
3
)
{
return
ResponseDto
.
failure
(
"当前演出还不能推送,状态"
.
concat
(
String
.
valueOf
(
isPush
)));
}
ResponseDto
<
KylinPerformanceVo
>
kylinPerformanceVo
=
feignKylinPerformancesClient
.
detail
(
targetId
,
0
,
0
,
""
);
KylinPerformanceVo
performanceVoData
=
kylinPerformanceVo
.
getData
();
if
(
null
==
performanceVoData
||
ObjectUtils
.
isEmpty
(
performanceVoData
))
{
log
.
info
(
"无演出数据:[performancesId={}]"
,
targetId
);
return
ResponseDto
.
failure
(
"无演出数据"
);
}
if
(
timeType
==
1
)
{
Integer
isPush
=
isPush
(
performanceVoData
,
targetId
);
if
(
isPush
!=
3
)
{
return
ResponseDto
.
failure
(
"当前演出还不能推送,状态"
.
concat
(
String
.
valueOf
(
isPush
)));
}
}
String
title
=
performanceVoData
.
getTitle
();
String
timeStart
=
performanceVoData
.
getTimeStart
();
ArrayList
<
String
>
msgIdList
=
CollectionUtil
.
arrayListString
();
if
(!
CollectionUtils
.
isEmpty
(
msgList
))
{
for
(
SweetAppletSubMsg
info
:
msgList
)
{
try
{
String
msgId
=
info
.
getMsgId
();
// 发送订阅消息接口
boolean
subMessage
=
sendSubMessage
(
info
,
targetId
,
title
,
timeStart
);
if
(
subMessage
)
{
msgIdList
.
add
(
msgId
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"小程序演出订阅提醒消息处理异常"
,
e
);
}
}
if
(!
CollectionUtils
.
isEmpty
(
msgIdList
))
{
SweetAppletSubMsg
update
=
new
SweetAppletSubMsg
();
update
.
setIsPush
(
2
);
update
.
setTargetId
(
targetId
);
update
.
setUpdatedAt
(
LocalDateTime
.
now
());
subMsgMapper
.
update
(
update
,
Wrappers
.
lambdaUpdate
(
SweetAppletSubMsg
.
class
)
.
in
(
SweetAppletSubMsg:
:
getMsgId
,
msgIdList
)
);
}
}
return
ResponseDto
.
success
();
}
@Override
public
ResponseDto
<
Boolean
>
create
(
String
openId
,
String
unionId
,
String
templateId
,
String
targetId
,
Integer
appletType
,
Integer
activityType
)
{
String
[]
templateIdArray
=
templateId
.
split
(
","
);
String
uid
=
StringUtils
.
defaultString
(
CurrentUtil
.
getCurrentUid
(),
""
);
LinkedList
<
String
>
sqls
=
CollectionUtil
.
linkedListString
();
LinkedList
<
Object
[]>
sqlsDataA
=
CollectionUtil
.
linkedListObjectArr
();
sqls
.
add
(
SqlMapping
.
get
(
"sweet_applet_sub_msg.insert"
));
for
(
String
id
:
templateIdArray
)
{
sqlsDataA
.
add
(
new
Object
[]{
IDGenerator
.
nextSnowId
(),
openId
,
unionId
,
uid
,
id
,
targetId
,
appletType
,
activityType
});
String
[]
midListArray
=
midList
.
split
(
","
);
LambdaQueryWrapper
<
SweetAppletSubMsg
>
queryWrapper
=
Wrappers
.
lambdaQuery
(
SweetAppletSubMsg
.
class
)
.
eq
(
SweetAppletSubMsg:
:
getIsPush
,
1
)
.
in
(
SweetAppletSubMsg:
:
getMid
,
midListArray
);
Integer
count
=
subMsgMapper
.
selectCount
(
queryWrapper
);
int
countPage
=
(
int
)
Math
.
ceil
(
count
/
pageSize
);
countPage
=
countPage
+
1
;
for
(
int
page
=
0
;
page
<
countPage
;
page
++)
{
List
<
SweetAppletSubMsg
>
msgList
=
subMsgMapper
.
selectList
(
queryWrapper
.
last
(
"LIMIT "
.
concat
(
String
.
valueOf
(
page
*
pageSize
))
.
concat
(
","
.
concat
(
String
.
valueOf
(
pageSize
)))
)
);
sweetAppletSubMsgSendService
.
toSend
(
msgList
,
targetId
,
title
,
timeStart
);
}
queueUtils
.
sendMsgByRedis
(
MQConst
.
SweetQueue
.
SWEET_REMIND_INSERT
.
getKey
(),
SqlMapping
.
gets
(
sqls
,
sqlsDataA
));
return
ResponseDto
.
success
();
}
/**
* 微信小程序推送订阅消息
*/
private
boolean
sendSubMessage
(
SweetAppletSubMsg
info
,
String
performancesId
,
String
title
,
String
timeStart
)
{
WxMaSubscribeMessage
subscribeMessage
=
new
WxMaSubscribeMessage
();
subscribeMessage
.
setPage
(
"pages/webview?query=showdetails&id="
.
concat
(
performancesId
));
subscribeMessage
.
setTemplateId
(
info
.
getTemplateId
());
subscribeMessage
.
setToUser
(
info
.
getOpenId
());
ArrayList
<
WxMaSubscribeMessage
.
MsgData
>
wxMaSubscribeData
=
new
ArrayList
<>();
WxMaSubscribeMessage
.
MsgData
wxMaSubscribeData1
=
new
WxMaSubscribeMessage
.
MsgData
();
wxMaSubscribeData1
.
setName
(
"thing1"
);
wxMaSubscribeData1
.
setValue
(
title
);
//每个参数 存放到大集合中
wxMaSubscribeData
.
add
(
wxMaSubscribeData1
);
// 第二个内容:用户昵称
WxMaSubscribeMessage
.
MsgData
wxMaSubscribeData2
=
new
WxMaSubscribeMessage
.
MsgData
();
wxMaSubscribeData2
.
setName
(
"time2"
);
wxMaSubscribeData2
.
setValue
(
timeStart
);
wxMaSubscribeData
.
add
(
wxMaSubscribeData2
);
// 第三个内容:领取方式
WxMaSubscribeMessage
.
MsgData
wxMaSubscribeData3
=
new
WxMaSubscribeMessage
.
MsgData
();
wxMaSubscribeData3
.
setName
(
"thing3"
);
wxMaSubscribeData3
.
setValue
(
"您关注的演出活动门票即将开售,请准备购票"
);
wxMaSubscribeData
.
add
(
wxMaSubscribeData3
);
subscribeMessage
.
setData
(
wxMaSubscribeData
);
try
{
//获取微信小程序配置:
WxMaService
wxService
=
wechatMaConfigure
.
getWxMaService
(
info
.
getAppletType
());
//进行推送
wxService
.
getMsgService
().
sendSubscribeMsg
(
subscribeMessage
);
return
true
;
}
catch
(
Exception
e
)
{
log
.
error
(
"sendSubMessageException e{}"
,
e
);
}
return
false
;
}
/**
* 判断演出时间 是否可以推送
*/
...
...
@@ -313,4 +213,5 @@ public class SweetAppletSubMsgServiceImpl extends ServiceImpl<SweetAppletSubMsgM
}
return
3
;
}
}
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