记得上下班打卡 | 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
922dd1b8
Commit
922dd1b8
authored
Feb 24, 2022
by
jiangxiulong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
重写任务方式发送订阅消息;时间改成10分钟
parent
d74036d4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
69 additions
and
43 deletions
+69
-43
SweetAppletSubMsgOfTypeDto.java
...quidnet/service/sweet/dto/SweetAppletSubMsgOfTypeDto.java
+8
-0
SweetAppletSubMsgMapper.java
...quidnet/service/sweet/mapper/SweetAppletSubMsgMapper.java
+13
-0
FeignSweetWechatClient.java
...dnet/service/feign/sweet/task/FeignSweetWechatClient.java
+1
-1
SweetWechatTaskHandler.java
...service/executor/main/handler/SweetWechatTaskHandler.java
+3
-6
SweetAppletSubMsgServiceImpl.java
...vice/sweet/service/impl/SweetAppletSubMsgServiceImpl.java
+44
-36
No files found.
liquidnet-bus-do/liquidnet-service-sweet-do/src/main/java/com/liquidnet/service/sweet/dto/SweetAppletSubMsgOfTypeDto.java
0 → 100644
View file @
922dd1b8
package
com
.
liquidnet
.
service
.
sweet
.
dto
;
import
lombok.Data
;
@Data
public
class
SweetAppletSubMsgOfTypeDto
{
private
String
targetId
;
}
liquidnet-bus-do/liquidnet-service-sweet-do/src/main/java/com/liquidnet/service/sweet/mapper/SweetAppletSubMsgMapper.java
View file @
922dd1b8
package
com
.
liquidnet
.
service
.
sweet
.
mapper
;
package
com
.
liquidnet
.
service
.
sweet
.
mapper
;
import
com.liquidnet.service.sweet.dto.SweetAppletSubMsgOfTypeDto
;
import
com.liquidnet.service.sweet.entity.SweetAppletSubMsg
;
import
com.liquidnet.service.sweet.entity.SweetAppletSubMsg
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Select
;
import
java.util.List
;
/**
/**
* <p>
* <p>
...
@@ -13,4 +18,12 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
...
@@ -13,4 +18,12 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
*/
public
interface
SweetAppletSubMsgMapper
extends
BaseMapper
<
SweetAppletSubMsg
>
{
public
interface
SweetAppletSubMsgMapper
extends
BaseMapper
<
SweetAppletSubMsg
>
{
@Select
({
"select target_id as targetId "
+
"from sweet_applet_sub_msg "
+
"where is_push = 1 "
+
"and activity_type = #{type} "
+
"group by target_id"
})
List
<
SweetAppletSubMsgOfTypeDto
>
selectListOfType
(
@Param
(
"type"
)
Integer
type
);
}
}
liquidnet-bus-feign/liquidnet-api-feign-sweet/src/main/java/com/liquidnet/service/feign/sweet/task/FeignSweetWechatClient.java
View file @
922dd1b8
...
@@ -18,6 +18,6 @@ public interface FeignSweetWechatClient {
...
@@ -18,6 +18,6 @@ public interface FeignSweetWechatClient {
ResponseDto
send
();
ResponseDto
send
();
@GetMapping
(
"sweet/appletSubMsg/send"
)
@GetMapping
(
"sweet/appletSubMsg/send"
)
ResponseDto
sendSubMsg
(
@RequestParam
(
"type"
)
Integer
type
,
@RequestParam
(
"targetId"
)
String
targetId
);
ResponseDto
sendSubMsg
(
@RequestParam
(
"type"
)
Integer
type
);
}
}
liquidnet-bus-service/liquidnet-service-executor-all/liquidnet-service-executor-main/src/main/java/com/liquidnet/service/executor/main/handler/SweetWechatTaskHandler.java
View file @
922dd1b8
...
@@ -40,15 +40,12 @@ public class SweetWechatTaskHandler {
...
@@ -40,15 +40,12 @@ public class SweetWechatTaskHandler {
try
{
try
{
String
jobParam
=
XxlJobHelper
.
getJobParam
();
//执行参数
String
jobParam
=
XxlJobHelper
.
getJobParam
();
//执行参数
log
.
info
(
"jobParam = "
+
jobParam
);
log
.
info
(
"jobParam = "
+
jobParam
);
String
[]
paramArray
=
jobParam
.
split
(
"
:
"
);
String
[]
paramArray
=
jobParam
.
split
(
"
,
"
);
ReturnT
<
String
>
success
=
ReturnT
.
SUCCESS
;
ReturnT
<
String
>
success
=
ReturnT
.
SUCCESS
;
for
(
String
typeAndTargetId
:
paramArray
)
{
for
(
String
type
:
paramArray
)
{
String
[]
typeAndTargetIdArray
=
typeAndTargetId
.
split
(
","
);
Object
data
=
feignSweetWechatClient
.
sendSubMsg
(
Integer
.
parseInt
(
type
)).
getData
();
Integer
type
=
Integer
.
parseInt
(
typeAndTargetIdArray
[
0
]);
String
targetId
=
typeAndTargetIdArray
[
1
];
Object
data
=
feignSweetWechatClient
.
sendSubMsg
(
type
,
targetId
).
getData
();
log
.
info
(
"sendSubMsgHandler:结果:{}"
,
data
);
log
.
info
(
"sendSubMsgHandler:结果:{}"
,
data
);
success
.
setMsg
(
String
.
valueOf
(
data
));
success
.
setMsg
(
String
.
valueOf
(
data
));
}
}
...
...
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/service/impl/SweetAppletSubMsgServiceImpl.java
View file @
922dd1b8
...
@@ -13,6 +13,7 @@ import com.liquidnet.service.base.constant.MQConst;
...
@@ -13,6 +13,7 @@ import com.liquidnet.service.base.constant.MQConst;
import
com.liquidnet.service.feign.kylin.api.FeignKylinPerformancesClient
;
import
com.liquidnet.service.feign.kylin.api.FeignKylinPerformancesClient
;
import
com.liquidnet.service.kylin.dto.vo.mongo.KylinPerformanceVo
;
import
com.liquidnet.service.kylin.dto.vo.mongo.KylinPerformanceVo
;
import
com.liquidnet.service.sweet.config.WechatMaConfigure
;
import
com.liquidnet.service.sweet.config.WechatMaConfigure
;
import
com.liquidnet.service.sweet.dto.SweetAppletSubMsgOfTypeDto
;
import
com.liquidnet.service.sweet.entity.SweetAppletSubMsg
;
import
com.liquidnet.service.sweet.entity.SweetAppletSubMsg
;
import
com.liquidnet.service.sweet.mapper.SweetAppletSubMsgMapper
;
import
com.liquidnet.service.sweet.mapper.SweetAppletSubMsgMapper
;
import
com.liquidnet.service.sweet.service.ISweetAppletSubMsgService
;
import
com.liquidnet.service.sweet.service.ISweetAppletSubMsgService
;
...
@@ -59,50 +60,57 @@ public class SweetAppletSubMsgServiceImpl extends ServiceImpl<SweetAppletSubMsgM
...
@@ -59,50 +60,57 @@ public class SweetAppletSubMsgServiceImpl extends ServiceImpl<SweetAppletSubMsgM
@Override
@Override
public
ResponseDto
sendMsg
(
Integer
type
)
{
public
ResponseDto
sendMsg
(
Integer
type
)
{
/*List<SweetAppletSubMsg> msgList = subMsgMapper.selectList(
List
<
SweetAppletSubMsgOfTypeDto
>
targetIds
=
subMsgMapper
.
selectListOfType
(
type
);
Wrappers.lambdaQuery(SweetAppletSubMsg.class)
.eq(SweetAppletSubMsg::getIsPush, 1)
.eq(SweetAppletSubMsg::getActivityType, type)
);
KylinPerformanceVo performanceVoData = null;
for
(
SweetAppletSubMsgOfTypeDto
targetIdInfo
:
targetIds
)
{
if (!targetId.isEmpty()) {
String
targetId
=
targetIdInfo
.
getTargetId
();
ResponseDto
<
KylinPerformanceVo
>
kylinPerformanceVo
=
feignKylinPerformancesClient
.
detail
(
targetId
,
0
,
0
,
""
);
ResponseDto
<
KylinPerformanceVo
>
kylinPerformanceVo
=
feignKylinPerformancesClient
.
detail
(
targetId
,
0
,
0
,
""
);
performanceVoData = kylinPerformanceVo.getData();
KylinPerformanceVo
performanceVoData
=
kylinPerformanceVo
.
getData
();
if
(
null
==
performanceVoData
||
ObjectUtils
.
isEmpty
(
performanceVoData
))
{
log
.
info
(
"无演出数据:[performancesId={}]"
,
targetId
);
continue
;
}
Integer
isPush
=
isPush
(
performanceVoData
,
targetId
);
Integer
isPush
=
isPush
(
performanceVoData
,
targetId
);
if
(
isPush
!=
3
)
{
if
(
isPush
!=
3
)
{
return ResponseDto.failure("当前演出还不能推送,状态".concat(String.valueOf(isPush)));
log
.
info
(
"当前演出还不能推送:[状态={}]"
,
isPush
);
continue
;
}
}
}
String title = performanceVoData.getTitle();
List
<
SweetAppletSubMsg
>
msgList
=
subMsgMapper
.
selectList
(
String timeStart = performanceVoData.getTimeStart();
Wrappers
.
lambdaQuery
(
SweetAppletSubMsg
.
class
)
ArrayList<String> msgIdList = CollectionUtil.arrayListString();
.
eq
(
SweetAppletSubMsg:
:
getIsPush
,
1
)
if (!CollectionUtils.isEmpty(msgList)) {
.
eq
(
SweetAppletSubMsg:
:
getActivityType
,
type
)
for (SweetAppletSubMsg info : msgList) {
.
eq
(
SweetAppletSubMsg:
:
getTargetId
,
targetId
)
try {
);
String msgId = info.getMsgId();
// 发送订阅消息接口
String
title
=
performanceVoData
.
getTitle
();
boolean subMessage = sendSubMessage(info, targetId, title, timeStart);
String
timeStart
=
performanceVoData
.
getTimeStart
();
if (subMessage) {
ArrayList
<
String
>
msgIdList
=
CollectionUtil
.
arrayListString
();
msgIdList.add(msgId);
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
);
}
}
} 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
)
);
}
}
}
}
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
();
return
ResponseDto
.
success
();
}
}
...
@@ -297,7 +305,7 @@ public class SweetAppletSubMsgServiceImpl extends ServiceImpl<SweetAppletSubMsgM
...
@@ -297,7 +305,7 @@ public class SweetAppletSubMsgServiceImpl extends ServiceImpl<SweetAppletSubMsgM
String
nowTimeStr
=
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
format
(
nowTime
);
String
nowTimeStr
=
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
format
(
nowTime
);
String
sellTime
=
performanceVoData
.
getSellTime
();
String
sellTime
=
performanceVoData
.
getSellTime
();
LocalDateTime
sellTimeLocal
=
LocalDateTime
.
parse
(
sellTime
,
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
));
LocalDateTime
sellTimeLocal
=
LocalDateTime
.
parse
(
sellTime
,
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
));
LocalDateTime
sellTimeLocalNew
=
sellTimeLocal
.
minusMinutes
(
5
);
LocalDateTime
sellTimeLocalNew
=
sellTimeLocal
.
minusMinutes
(
10
);
String
sellTimeLocalNewStr
=
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
format
(
sellTimeLocalNew
);
String
sellTimeLocalNewStr
=
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
format
(
sellTimeLocalNew
);
String
stopSellTime
=
performanceVoData
.
getStopSellTime
();
String
stopSellTime
=
performanceVoData
.
getStopSellTime
();
...
...
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