记得上下班打卡 | 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
26cc581a
Commit
26cc581a
authored
Dec 02, 2021
by
jiangxiulong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
发送订阅消息优化
parent
79d85aee
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
61 deletions
+55
-61
SweetAppletSubMsgController.java
...service/sweet/controller/SweetAppletSubMsgController.java
+1
-1
SweetAppletSubMsgServiceImpl.java
...vice/sweet/service/impl/SweetAppletSubMsgServiceImpl.java
+54
-60
No files found.
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/controller/SweetAppletSubMsgController.java
View file @
26cc581a
...
@@ -39,7 +39,7 @@ public class SweetAppletSubMsgController {
...
@@ -39,7 +39,7 @@ public class SweetAppletSubMsgController {
return
subMsgService
.
sendMsg
(
type
,
targetId
);
return
subMsgService
.
sendMsg
(
type
,
targetId
);
}
}
@
Ge
tMapping
(
"sendOfMid"
)
@
Pos
tMapping
(
"sendOfMid"
)
@ApiOperation
(
"发送模版消息OfMid"
)
@ApiOperation
(
"发送模版消息OfMid"
)
public
ResponseDto
sendOfMid
(
public
ResponseDto
sendOfMid
(
@RequestParam
Integer
type
,
@RequestParam
Integer
type
,
...
...
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/service/impl/SweetAppletSubMsgServiceImpl.java
View file @
26cc581a
...
@@ -66,35 +66,32 @@ public class SweetAppletSubMsgServiceImpl extends ServiceImpl<SweetAppletSubMsgM
...
@@ -66,35 +66,32 @@ public class SweetAppletSubMsgServiceImpl extends ServiceImpl<SweetAppletSubMsgM
KylinPerformanceVo
performanceVoData
=
kylinPerformanceVo
.
getData
();
KylinPerformanceVo
performanceVoData
=
kylinPerformanceVo
.
getData
();
if
(
null
==
performanceVoData
||
ObjectUtils
.
isEmpty
(
performanceVoData
))
{
if
(
null
==
performanceVoData
||
ObjectUtils
.
isEmpty
(
performanceVoData
))
{
log
.
info
(
"无演出数据:[getPerformancesId=[{}]"
,
targetId
);
log
.
info
(
"无演出数据:[getPerformancesId=[{}]"
,
targetId
);
return
ResponseDto
.
success
();
return
ResponseDto
.
success
(
"无演出数据"
);
}
LocalDateTime
nowTime
=
LocalDateTime
.
now
();
String
nowTimeStr
=
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
format
(
nowTime
);
String
sellTime
=
performanceVoData
.
getSellTime
();
LocalDateTime
sellTimeLocal
=
LocalDateTime
.
parse
(
sellTime
,
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
));
LocalDateTime
sellTimeLocalNew
=
sellTimeLocal
.
minusMinutes
(
5
);
String
sellTimeLocalNewStr
=
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
format
(
sellTimeLocalNew
);
String
stopSellTime
=
performanceVoData
.
getStopSellTime
();
if
(
1
==
DateUtil
.
compareStrDay
(
nowTimeStr
,
stopSellTime
))
{
// 超过售卖期 不推 删redis
log
.
info
(
"超过售卖期:[nowTimeStr=[{}], [stopSellTime=[{}]"
,
nowTimeStr
,
stopSellTime
);
return
ResponseDto
.
success
(
"超过售卖期"
);
}
if
(-
1
==
DateUtil
.
compareStrDay
(
nowTimeStr
,
sellTimeLocalNewStr
))
{
// 还没到售卖期
log
.
info
(
"还没到售卖期:[nowTimeStr=[{}], [sellTimeLocalNewStr=[{}]"
,
nowTimeStr
,
sellTimeLocalNewStr
);
return
ResponseDto
.
success
(
"还没到售卖期"
);
}
}
KylinTicketTimesVo
kylinTicketTimesVo
=
performanceVoData
.
getTicketTimeList
().
get
(
0
);
ArrayList
<
String
>
msgIdList
=
CollectionUtil
.
arrayListString
();
ArrayList
<
String
>
msgIdList
=
CollectionUtil
.
arrayListString
();
if
(!
CollectionUtils
.
isEmpty
(
msgList
))
{
if
(!
CollectionUtils
.
isEmpty
(
msgList
))
{
for
(
SweetAppletSubMsg
info
:
msgList
)
{
for
(
SweetAppletSubMsg
info
:
msgList
)
{
try
{
try
{
String
msgId
=
info
.
getMsgId
();
String
msgId
=
info
.
getMsgId
();
LocalDateTime
nowTime
=
LocalDateTime
.
now
();
String
nowTimeStr
=
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
format
(
nowTime
);
String
sellTime
=
performanceVoData
.
getSellTime
();
LocalDateTime
sellTimeLocal
=
LocalDateTime
.
parse
(
sellTime
,
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
));
LocalDateTime
sellTimeLocalNew
=
sellTimeLocal
.
minusMinutes
(
5
);
String
sellTimeLocalNewStr
=
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
format
(
sellTimeLocalNew
);
String
stopSellTime
=
performanceVoData
.
getStopSellTime
();
if
(
1
==
DateUtil
.
compareStrDay
(
nowTimeStr
,
stopSellTime
))
{
// 超过售卖期 不推 删redis
log
.
info
(
"超过售卖期:[nowTimeStr=[{}], [stopSellTime=[{}]"
,
nowTimeStr
,
stopSellTime
);
msgIdList
.
add
(
msgId
);
continue
;
}
if
(-
1
==
DateUtil
.
compareStrDay
(
nowTimeStr
,
sellTimeLocalNewStr
))
{
// 还没到售卖期
log
.
info
(
"还没到售卖期:[nowTimeStr=[{}], [sellTimeLocalNewStr=[{}]"
,
nowTimeStr
,
sellTimeLocalNewStr
);
continue
;
}
// 发送订阅消息接口
// 发送订阅消息接口
boolean
subMessage
=
sendSubMessage
(
info
,
performanceVoData
);
boolean
subMessage
=
sendSubMessage
(
info
,
performanceVoData
);
if
(
subMessage
)
{
if
(
subMessage
)
{
...
@@ -119,23 +116,6 @@ public class SweetAppletSubMsgServiceImpl extends ServiceImpl<SweetAppletSubMsgM
...
@@ -119,23 +116,6 @@ public class SweetAppletSubMsgServiceImpl extends ServiceImpl<SweetAppletSubMsgM
return
ResponseDto
.
success
();
return
ResponseDto
.
success
();
}
}
@Override
public
ResponseDto
<
Boolean
>
create
(
String
openId
,
String
templateId
,
String
targetId
,
Integer
appletType
,
Integer
activityType
)
{
String
[]
templateIdArray
=
templateId
.
split
(
","
);
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
,
id
,
targetId
,
appletType
,
activityType
});
}
queueUtils
.
sendMsgByRedis
(
MQConst
.
SweetQueue
.
SWEET_REMIND_INSERT
.
getKey
(),
SqlMapping
.
gets
(
sqls
,
sqlsDataA
));
return
ResponseDto
.
success
();
}
@Override
@Override
public
ResponseDto
sendOfMid
(
Integer
type
,
String
midList
,
String
targetId
)
{
public
ResponseDto
sendOfMid
(
Integer
type
,
String
midList
,
String
targetId
)
{
String
[]
midListArray
=
midList
.
split
(
","
);
String
[]
midListArray
=
midList
.
split
(
","
);
...
@@ -152,33 +132,30 @@ public class SweetAppletSubMsgServiceImpl extends ServiceImpl<SweetAppletSubMsgM
...
@@ -152,33 +132,30 @@ public class SweetAppletSubMsgServiceImpl extends ServiceImpl<SweetAppletSubMsgM
log
.
info
(
"无演出数据:[getPerformancesId=[{}]"
,
targetId
);
log
.
info
(
"无演出数据:[getPerformancesId=[{}]"
,
targetId
);
return
ResponseDto
.
failure
(
"无演出数据"
);
return
ResponseDto
.
failure
(
"无演出数据"
);
}
}
KylinTicketTimesVo
kylinTicketTimesVo
=
performanceVoData
.
getTicketTimeList
().
get
(
0
);
LocalDateTime
nowTime
=
LocalDateTime
.
now
();
String
nowTimeStr
=
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
format
(
nowTime
);
String
sellTime
=
performanceVoData
.
getSellTime
();
LocalDateTime
sellTimeLocal
=
LocalDateTime
.
parse
(
sellTime
,
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
));
LocalDateTime
sellTimeLocalNew
=
sellTimeLocal
.
minusMinutes
(
5
);
String
sellTimeLocalNewStr
=
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
format
(
sellTimeLocalNew
);
String
stopSellTime
=
performanceVoData
.
getStopSellTime
();
if
(
1
==
DateUtil
.
compareStrDay
(
nowTimeStr
,
stopSellTime
))
{
// 超过售卖期 不推 删redis
log
.
info
(
"超过售卖期:[nowTimeStr=[{}], [stopSellTime=[{}]"
,
nowTimeStr
,
stopSellTime
);
return
ResponseDto
.
failure
(
"超过售卖期"
);
}
if
(-
1
==
DateUtil
.
compareStrDay
(
nowTimeStr
,
sellTimeLocalNewStr
))
{
// 还没到售卖期
log
.
info
(
"还没到售卖期:[nowTimeStr=[{}], [sellTimeLocalNewStr=[{}]"
,
nowTimeStr
,
sellTimeLocalNewStr
);
return
ResponseDto
.
failure
(
"还没到售卖期"
);
}
ArrayList
<
String
>
msgIdList
=
CollectionUtil
.
arrayListString
();
ArrayList
<
String
>
msgIdList
=
CollectionUtil
.
arrayListString
();
if
(!
CollectionUtils
.
isEmpty
(
msgList
))
{
if
(!
CollectionUtils
.
isEmpty
(
msgList
))
{
for
(
SweetAppletSubMsg
info
:
msgList
)
{
for
(
SweetAppletSubMsg
info
:
msgList
)
{
try
{
try
{
String
msgId
=
info
.
getMsgId
();
String
msgId
=
info
.
getMsgId
();
LocalDateTime
nowTime
=
LocalDateTime
.
now
();
String
nowTimeStr
=
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
format
(
nowTime
);
String
sellTime
=
performanceVoData
.
getSellTime
();
LocalDateTime
sellTimeLocal
=
LocalDateTime
.
parse
(
sellTime
,
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
));
LocalDateTime
sellTimeLocalNew
=
sellTimeLocal
.
minusMinutes
(
5
);
String
sellTimeLocalNewStr
=
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
format
(
sellTimeLocalNew
);
String
stopSellTime
=
performanceVoData
.
getStopSellTime
();
if
(
1
==
DateUtil
.
compareStrDay
(
nowTimeStr
,
stopSellTime
))
{
// 超过售卖期 不推 删redis
log
.
info
(
"超过售卖期:[nowTimeStr=[{}], [stopSellTime=[{}]"
,
nowTimeStr
,
stopSellTime
);
msgIdList
.
add
(
msgId
);
continue
;
}
if
(-
1
==
DateUtil
.
compareStrDay
(
nowTimeStr
,
sellTimeLocalNewStr
))
{
// 还没到售卖期
log
.
info
(
"还没到售卖期:[nowTimeStr=[{}], [sellTimeLocalNewStr=[{}]"
,
nowTimeStr
,
sellTimeLocalNewStr
);
continue
;
}
// 发送订阅消息接口
// 发送订阅消息接口
boolean
subMessage
=
sendSubMessage
(
info
,
performanceVoData
);
boolean
subMessage
=
sendSubMessage
(
info
,
performanceVoData
);
if
(
subMessage
)
{
if
(
subMessage
)
{
...
@@ -203,6 +180,23 @@ public class SweetAppletSubMsgServiceImpl extends ServiceImpl<SweetAppletSubMsgM
...
@@ -203,6 +180,23 @@ public class SweetAppletSubMsgServiceImpl extends ServiceImpl<SweetAppletSubMsgM
return
ResponseDto
.
success
();
return
ResponseDto
.
success
();
}
}
@Override
public
ResponseDto
<
Boolean
>
create
(
String
openId
,
String
templateId
,
String
targetId
,
Integer
appletType
,
Integer
activityType
)
{
String
[]
templateIdArray
=
templateId
.
split
(
","
);
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
,
id
,
targetId
,
appletType
,
activityType
});
}
queueUtils
.
sendMsgByRedis
(
MQConst
.
SweetQueue
.
SWEET_REMIND_INSERT
.
getKey
(),
SqlMapping
.
gets
(
sqls
,
sqlsDataA
));
return
ResponseDto
.
success
();
}
/**
/**
* 微信小程序推送订阅消息
* 微信小程序推送订阅消息
*/
*/
...
...
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