Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gxpt_ht
Overview
Overview
Details
Activity
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
pseer
gxpt_ht
Commits
ea136a42
Commit
ea136a42
authored
Aug 01, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改自动发送权益会员过期短信自动任务
parent
6de6e84a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
19 deletions
+24
-19
RedisTask.java
share-quartz/src/main/java/share/quartz/task/RedisTask.java
+18
-13
MqttConfig.java
share-system/src/main/java/share/system/mqtt/MqttConfig.java
+2
-2
MqttMessageHandler.java
...m/src/main/java/share/system/mqtt/MqttMessageHandler.java
+1
-1
MqttTopicHandler.java
...tem/src/main/java/share/system/mqtt/MqttTopicHandler.java
+2
-2
MultiMqttMessageHandler.java
.../main/java/share/system/mqtt/MultiMqttMessageHandler.java
+1
-1
No files found.
share-quartz/src/main/java/share/quartz/task/RedisTask.java
View file @
ea136a42
...
...
@@ -476,6 +476,9 @@ public class RedisTask {
});
}
/**
* 自动发送权益会员过期短信
*/
public
void
AutoEquityMembersSms
()
{
Set
<
String
>
keys
=
redisTemplate
.
keys
(
ReceiptRdeisEnum
.
EQUITY_MEMBERS_TIME
+
"*"
);
if
(
keys
.
size
()
==
0
)
{
...
...
@@ -487,7 +490,7 @@ public class RedisTask {
Date
expirationTime
=
jsonObject
.
getDate
(
"expirationTime"
);
Long
consumerId
=
jsonObject
.
getLong
(
"consumerId"
);
//判断当前的日期是否在第3天和第2天中
long
expire
=
(
expirationTime
.
getTime
()
-
new
Date
().
getTime
())
/
1000
/
60
/
60
;
long
expire
=
(
expirationTime
.
getTime
()
-
new
Date
().
getTime
())
/
1000
/
60
;
if
(
THREE_DAY
<
expire
&&
expire
<
FOUR_DAY
)
{
SConsumer
sConsumer
=
sConsumerService
.
getById
(
consumerId
);
logger
.
debug
(
"手机号为:{}的用户年度权益会员将在3天后失效"
,
sConsumer
.
getPhone
());
...
...
@@ -530,6 +533,9 @@ public class RedisTask {
});
}
/**
* 会员等级滚动降级
*/
public
void
AutoProgressLog
()
{
//查询1年之前的数据
List
<
MemberProgressLog
>
list
=
memberProgressLogService
.
list
(
new
LambdaQueryWrapper
<
MemberProgressLog
>()
...
...
@@ -559,32 +565,31 @@ public class RedisTask {
sum
[
0
]
=
sum
[
0
].
subtract
(
log
.
getVariableProgress
());
}
});
if
(
consumerMember
.
getMembershipProgress
().
compareTo
(
sum
[
0
])
<
0
)
{
consumerMember
.
setMembershipProgress
(
BigDecimal
.
ZERO
);
consumerMember
.
setMembershipLevel
(
0L
);
MemberConfig
memberConfigServiceOne
=
memberConfigService
.
getOne
(
new
LambdaQueryWrapper
<
MemberConfig
>()
.
eq
(
MemberConfig:
:
getMemberType
,
consumerMember
.
getMemberType
())
.
eq
(
MemberConfig:
:
getMembershipLevel
,
consumerMember
.
getMembershipLevel
())
);
consumerMember
.
setMemberConfigId
(
memberConfigServiceOne
.
getId
());
}
else
//判断会员进度是否大于扣除进度
if
(
consumerMember
.
getMembershipProgress
().
compareTo
(
sum
[
0
])
>
0
)
{
if
(
consumerMember
.
getMembershipProgress
().
compareTo
(
sum
[
0
])
>=
0
)
{
//会员进度减去扣除进度
BigDecimal
subtract
=
consumerMember
.
getMembershipProgress
().
subtract
(
sum
[
0
]);
consumerMember
.
setMembershipProgress
(
subtract
);
if
(
subtract
.
compareTo
(
BigDecimal
.
valueOf
(
memberConfig
.
getLimitRequirements
()))
<
0
)
{
//等级降一级
if
(
consumerMember
.
getMembershipLevel
()
>
0L
)
{
consumerMember
.
setMembershipLevel
(
memberConfig
.
getMembershipLevel
()
-
1
);
consumerMember
.
setMembershipLevel
(
consumerMember
.
getMembershipLevel
()
-
1
);
MemberConfig
memberConfigServiceOne
=
memberConfigService
.
getOne
(
new
LambdaQueryWrapper
<
MemberConfig
>()
.
eq
(
MemberConfig:
:
getMemberType
,
consumerMember
.
getMemberType
())
.
eq
(
MemberConfig:
:
getMembershipLevel
,
consumerMember
.
getMembershipLevel
())
);
consumerMember
.
setMemberConfigId
(
memberConfigServiceOne
.
getId
());
}
}
}
else
if
(
consumerMember
.
getMembershipProgress
().
compareTo
(
sum
[
0
])
==
0
)
{
consumerMember
.
setMembershipProgress
(
BigDecimal
.
ZERO
);
consumerMember
.
setMembershipLevel
(
0L
);
MemberConfig
memberConfigServiceOne
=
memberConfigService
.
getOne
(
new
LambdaQueryWrapper
<
MemberConfig
>()
.
eq
(
MemberConfig:
:
getMemberType
,
consumerMember
.
getMemberType
())
.
eq
(
MemberConfig:
:
getMembershipLevel
,
consumerMember
.
getMembershipLevel
())
);
consumerMember
.
setMemberConfigId
(
memberConfigServiceOne
.
getId
());
}
consumerMemberService
.
updateConsumerMember
(
consumerMember
);
}
...
...
share-system/src/main/java/share/system/mqtt/MqttConfig.java
View file @
ea136a42
...
...
@@ -186,7 +186,7 @@ public class MqttConfig {
@EventListener
(
MqttMessageSentEvent
.
class
)
public
void
mqttMessageSentEvent
(
MqttMessageSentEvent
event
)
{
log
.
info
(
"mqttMessageSentEvent发送信息: date={}, info={}"
,
new
Date
(),
event
.
toString
());
log
.
debug
(
"mqttMessageSentEvent发送信息: date={}, info={}"
,
new
Date
(),
event
.
toString
());
}
// @EventListener(MqttMessageDeliveredEvent.class)
...
...
@@ -196,7 +196,7 @@ public class MqttConfig {
@EventListener
(
MqttSubscribedEvent
.
class
)
public
void
mqttSubscribedEvent
(
MqttSubscribedEvent
event
)
{
log
.
info
(
"mqttSubscribedEvent订阅成功信息: date={}, info={}"
,
new
Date
(),
event
.
toString
());
log
.
debug
(
"mqttSubscribedEvent订阅成功信息: date={}, info={}"
,
new
Date
(),
event
.
toString
());
}
...
...
share-system/src/main/java/share/system/mqtt/MqttMessageHandler.java
View file @
ea136a42
...
...
@@ -36,7 +36,7 @@ public class MqttMessageHandler implements MessageHandler {
String
topic
=
message
.
getHeaders
().
get
(
MqttHeaders
.
RECEIVED_TOPIC
).
toString
();
boolean
exist
=
topic
.
startsWith
(
"ydlink"
);
if
(!
exist
)
{
log
.
info
(
"当前topic:{}未注册!不做处理!"
,
topic
);
log
.
debug
(
"当前topic:{}未注册!不做处理!"
,
topic
);
return
;
}
//MqttTopicHandler topicHandler = SpringUtil.getBean(mqttTopicEnum.getTopicHandlerBeanName(), TopicHandler.class);
...
...
share-system/src/main/java/share/system/mqtt/MqttTopicHandler.java
View file @
ea136a42
...
...
@@ -27,7 +27,7 @@ public class MqttTopicHandler {
*/
public
void
handler
(
Message
<?>
message
)
{
String
topic
=
message
.
getHeaders
().
get
(
MqttHeaders
.
RECEIVED_TOPIC
).
toString
();
log
.
info
(
"topic:{}-->message received!"
,
topic
);
log
.
debug
(
"topic:{}-->message received!"
,
topic
);
String
payload
=
new
String
((
byte
[])
message
.
getPayload
());
Assert
.
notNull
(
payload
,
"接收到的消息为空!"
);
dispose
(
payload
,
topic
);
...
...
@@ -41,7 +41,7 @@ public class MqttTopicHandler {
if
(!
ObjectUtil
.
isNull
(
payload
)){
try
{
mqttxService
.
mqttReport
(
topic
,
payload
);
log
.
info
(
"来自topic:{}的消息处理完毕!"
,
topic
);
log
.
debug
(
"来自topic:{}的消息处理完毕!"
,
topic
);
}
catch
(
Exception
e
)
{
log
.
error
(
"来自topic:{}的消息处理异常!原因:{}"
,
topic
,
e
);
}
...
...
share-system/src/main/java/share/system/mqtt/MultiMqttMessageHandler.java
View file @
ea136a42
...
...
@@ -74,7 +74,7 @@ public class MultiMqttMessageHandler extends AbstractMessageHandler implements L
//负载均衡
Random
random
=
new
Random
();
MyMqttPahoMessageHandler
messageHandler
=
(
MyMqttPahoMessageHandler
)
mqttHandlerMap
.
get
(
random
.
nextInt
(
handlerCount
));
log
.
info
(
"开始处理信息:{}"
,
message
.
toString
());
log
.
debug
(
"开始处理信息:{}"
,
message
.
toString
());
messageHandler
.
handleMessageInternal
(
message
);
}
...
...
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