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
9569744a
Commit
9569744a
authored
Aug 14, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改定时任务
parent
f5228c68
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
64 additions
and
18 deletions
+64
-18
application-test.yml
share-admin/src/main/resources/application-test.yml
+2
-2
application-test.yml
share-front/src/main/resources/application-test.yml
+2
-2
CouponRetryTask.java
...artz/src/main/java/share/quartz/task/CouponRetryTask.java
+8
-0
DeviceTask.java
share-quartz/src/main/java/share/quartz/task/DeviceTask.java
+4
-0
OrderTask.java
share-quartz/src/main/java/share/quartz/task/OrderTask.java
+6
-0
RedisTask.java
share-quartz/src/main/java/share/quartz/task/RedisTask.java
+37
-9
application-test.yml
share-quartz/src/main/resources/application-test.yml
+5
-5
No files found.
share-admin/src/main/resources/application-test.yml
View file @
9569744a
...
...
@@ -90,7 +90,7 @@ spring:
master
:
url
:
jdbc:mysql://129.211.46.84:3306/sharedb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
username
:
root
password
:
whxz
2019
password
:
Whxz@
2019
# 从库数据源
slave
:
# 从数据源开关/默认关闭
...
...
@@ -152,7 +152,7 @@ spring:
# 密码
# password: whxz2019
# password: 123456
password
:
ZmWISp5@
password
:
ErRQcVj1hSwl
# 连接超时时间
timeout
:
10s
lettuce
:
...
...
share-front/src/main/resources/application-test.yml
View file @
9569744a
...
...
@@ -90,7 +90,7 @@ spring:
master
:
url
:
jdbc:mysql://129.211.46.84:3306/sharedb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
username
:
root
password
:
whxz
2019
password
:
Whxz@
2019
# 从库数据源
slave
:
# 从数据源开关/默认关闭
...
...
@@ -152,7 +152,7 @@ spring:
# 密码
# password: whxz2019
# password: 123456
password
:
ZmWISp5@
password
:
ErRQcVj1hSwl
# 连接超时时间
timeout
:
10s
lettuce
:
...
...
share-quartz/src/main/java/share/quartz/task/CouponRetryTask.java
View file @
9569744a
...
...
@@ -42,6 +42,7 @@ public class CouponRetryTask {
@XxlJob
(
"AuToRetryCoupon"
)
public
void
AuToRetryCoupon
()
{
logger
.
debug
(
"AuToRetryCoupon:自动重新验卷开始"
);
LambdaQueryWrapper
<
SConsumerCoupon
>
consumerCouponWrapper
=
new
LambdaQueryWrapper
<>();
consumerCouponWrapper
.
eq
(
SConsumerCoupon:
:
getUseStatus
,
UserStatusEnum
.
UNUSED
.
getCode
());
consumerCouponWrapper
.
eq
(
SConsumerCoupon:
:
getIsDelete
,
YesNoEnum
.
no
.
getIndex
());
...
...
@@ -56,11 +57,13 @@ public class CouponRetryTask {
if
(!
CollectionUtils
.
isEmpty
(
expiredSConsumerCounpons
))
{
sConsumerCouponService
.
updateBatchById
(
expiredSConsumerCounpons
);
}
logger
.
debug
(
"AuToRetryCoupon:自动重新验卷结束"
);
}
// 自动生成优惠卷购买金额
@XxlJob
(
"AutoGenerateCoupon"
)
public
void
AutoGenerateCoupon
()
{
logger
.
debug
(
"AutoGenerateCoupon:自动生成优惠卷购买金额开始"
);
LambdaQueryWrapper
<
SConsumerCoupon
>
consumerCouponWrapper
=
new
LambdaQueryWrapper
<>();
List
<
SStore
>
list
=
storeService
.
list
();
list
=
list
.
stream
().
filter
(
item
->
item
.
getOpenShopUuid
()
!=
null
).
collect
(
Collectors
.
toList
());
...
...
@@ -112,6 +115,7 @@ public class CouponRetryTask {
sConsumerCouponService
.
updateBatchById
(
updatedCoupons
);
}
}
logger
.
debug
(
"AutoGenerateCoupon:自动生成优惠卷购买金额结束"
);
}
private
void
processCoupons
(
List
<
SConsumerCoupon
>
coupons
,
List
<
SStore
>
stores
)
{
...
...
@@ -153,6 +157,7 @@ public class CouponRetryTask {
@XxlJob
(
"AutoUpdateCouponPromotionPrice"
)
public
void
AutoUpdateCouponPromotionPrice
()
{
logger
.
debug
(
"AutoUpdateCouponPromotionPrice:自动更新优惠券促销金额开始"
);
try
{
LambdaQueryWrapper
<
SCoupon
>
sCouponLambdaQueryWrapper
=
Wrappers
.
lambdaQuery
(
SCoupon
.
class
);
sCouponLambdaQueryWrapper
.
isNotNull
(
SCoupon:
:
getSalePrice
);
...
...
@@ -208,12 +213,14 @@ public class CouponRetryTask {
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
logger
.
debug
(
"AutoUpdateCouponPromotionPrice:自动更新优惠券促销金额结束"
);
}
//补齐美团团购id
@XxlJob
(
"AutoGenerateTuangouId"
)
public
void
AutoGenerateTuangouId
()
{
logger
.
debug
(
"AutoGenerateTuangouId:补齐美团团购id开始"
);
LambdaQueryWrapper
<
SConsumerCoupon
>
consumerCouponWrapper
=
new
LambdaQueryWrapper
<>();
consumerCouponWrapper
.
eq
(
SConsumerCoupon:
:
getIsDelete
,
YesNoEnum
.
no
.
getIndex
());
consumerCouponWrapper
.
isNull
(
SConsumerCoupon:
:
getDealgroupId
);
...
...
@@ -240,5 +247,6 @@ public class CouponRetryTask {
}
if
(!
CollectionUtils
.
isEmpty
(
sConsumerCouponList
))
sConsumerCouponService
.
updateBatchById
(
sConsumerCouponList
);
logger
.
debug
(
"AutoGenerateTuangouId:补齐美团团购id结束"
);
}
}
share-quartz/src/main/java/share/quartz/task/DeviceTask.java
View file @
9569744a
...
...
@@ -43,6 +43,7 @@ public class DeviceTask {
*/
@XxlJob
(
"deviceGatewayStatusMonitor"
)
public
void
deviceGatewayStatusMonitor
()
{
log
.
debug
(
"deviceGatewayStatusMonitor:设备网关状态监控开始"
);
// 更新网关状态
List
<
DeviceGateway
>
list
=
deviceGatewayService
.
deviceGatewayStatusMonitor
();
if
(
list
.
size
()
>
0
)
{
...
...
@@ -51,10 +52,12 @@ public class DeviceTask {
deviceGatewayService
.
sendSmsByStatusOff
(
deviceGateway
);
});
}
log
.
debug
(
"deviceGatewayStatusMonitor:设备网关状态监控结束"
);
}
@XxlJob
(
"updateDeviceDoorLockPassword"
)
public
void
updateDeviceDoorLockPassword
()
{
log
.
debug
(
"updateDeviceDoorLockPassword:每周一修改房间门锁密码开始"
);
String
jobParam
=
XxlJobHelper
.
getJobParam
();
Integer
validTime
=
Integer
.
getInteger
(
jobParam
);
log
.
debug
(
"jobParam:"
+
jobParam
);
...
...
@@ -63,6 +66,7 @@ public class DeviceTask {
}
// 更新所有门锁设备开锁密码
deviceService
.
updateDeviceDoorLockPassword
(
validTime
);
log
.
debug
(
"updateDeviceDoorLockPassword:每周一修改房间门锁密码结束"
);
}
}
share-quartz/src/main/java/share/quartz/task/OrderTask.java
View file @
9569744a
...
...
@@ -161,6 +161,7 @@ public class OrderTask {
*/
@XxlJob
(
"refundApply"
)
public
void
refundApply
()
{
logger
.
debug
(
"refundApply:执行 用户退款申请开始"
);
String
redisKey
=
Constants
.
ORDER_TASK_REDIS_KEY_AFTER_REFUND_BY_USER
;
Long
size
=
redisUtil
.
getListSize
(
redisKey
);
logger
.
debug
(
"OrderTask.refundApply | size:"
+
size
);
...
...
@@ -188,6 +189,7 @@ public class OrderTask {
redisUtil
.
lPush
(
redisKey
,
orderId
);
}
}
logger
.
debug
(
"refundApply:执行 用户退款申请结束"
);
}
/**
...
...
@@ -234,6 +236,7 @@ public class OrderTask {
//预约订单到期自动更新订单状态,更新房间状态
@XxlJob
(
"autoToStore"
)
public
void
autoToStore
()
{
logger
.
debug
(
"autoToStore:预约订单到期自动更新订单状态,更新房间状态开始"
);
//查询所有已支付的订单
Set
<
String
>
keys
=
redisTemplate
.
keys
(
ReceiptRdeisEnum
.
ORDER_NO
.
getValue
()
+
"*"
);
if
(
keys
.
size
()
==
0
)
{
...
...
@@ -319,6 +322,7 @@ public class OrderTask {
logger
.
error
(
"预约订单到期自动更新订单状态失败!"
);
throw
new
BaseException
(
"预约订单到期自动更新订单状态失败!"
);
}
logger
.
debug
(
"autoToStore:预约订单到期自动更新订单状态,更新房间状态结束"
);
}
/**
...
...
@@ -327,6 +331,7 @@ public class OrderTask {
*/
@XxlJob
(
"orderCompensate"
)
public
void
orderCompensate
()
{
logger
.
debug
(
"orderCompensate:房间、订单状态监控开始"
);
// 订单状态处理
LambdaQueryWrapper
<
SOrder
>
queryWrapper
=
new
LambdaQueryWrapper
();
queryWrapper
.
le
(
SOrder:
:
getEndDate
,
DateUtil
.
offset
(
DateUtil
.
date
(),
DateField
.
MINUTE
,
-
2
));
...
...
@@ -390,6 +395,7 @@ public class OrderTask {
roomService
.
updateBatchById
(
roomList
,
roomList
.
size
());
}
}
logger
.
debug
(
"orderCompensate:房间、订单状态监控结束"
);
}
}
share-quartz/src/main/java/share/quartz/task/RedisTask.java
View file @
9569744a
...
...
@@ -127,6 +127,7 @@ public class RedisTask {
*/
@XxlJob
(
"AutoDelRefundedCoupon"
)
public
void
AutoDelRefundedCoupon
()
{
logger
.
debug
(
"AutoDelRefundedCoupon:定时自动删除异常优惠券开始"
);
//获取所有待使用的优惠卷
LambdaQueryWrapper
<
SConsumerCoupon
>
wrapper
=
Wrappers
.
lambdaQuery
();
wrapper
.
eq
(
SConsumerCoupon:
:
getUseStatus
,
CouponStatusEnum
.
NORMAL
.
getValue
());
...
...
@@ -171,6 +172,7 @@ public class RedisTask {
}
if
(!
CollectionUtils
.
isEmpty
(
expiredCoupons
))
isConsumerCouponService
.
removeByIdList
(
expiredCoupons
);
}
logger
.
debug
(
"AutoDelRefundedCoupon:定时自动删除异常优惠券结束"
);
}
public
void
processAutoReceiptCode
()
{
...
...
@@ -221,6 +223,7 @@ public class RedisTask {
@XxlJob
(
"AutomaticMtSessionKey"
)
public
void
AutomaticMtSessionKey
()
{
logger
.
debug
(
"AutomaticMtSessionKey:自动续期session开始"
);
Boolean
b
=
redisTemplate
.
hasKey
(
ReceiptRdeisEnum
.
MT_SESSION_KEY
.
getValue
());
if
(!
b
)
{
JSONObject
o
=
new
JSONObject
(
redisTemplate
.
opsForValue
().
get
(
ReceiptRdeisEnum
.
MT_SESSION_OBJECT_KEY
.
getValue
()));
...
...
@@ -236,12 +239,13 @@ public class RedisTask {
tiktokService
.
clientToken
();
}
wechatNewService
.
getPublicAccessToken
();
logger
.
debug
(
"AutomaticMtSessionKey:自动续期session结束"
);
}
//自动添加保洁记录
@XxlJob
(
"AutoAddSCleanRecords"
)
public
void
AutoAddSCleanRecords
()
{
logger
.
debug
(
"AutoAddSCleanRecords:自动添加保洁记录开始"
);
Set
<
String
>
keys
=
redisTemplate
.
keys
(
ReceiptRdeisEnum
.
ORDER_NO_KEY
.
getValue
()
+
"*"
);
if
(
keys
.
size
()
==
0
)
{
return
;
...
...
@@ -351,11 +355,12 @@ public class RedisTask {
logger
.
debug
(
"订单号为:"
+
sOrder
.
getOrderNo
()
+
"的订单已结束,更改订单状态为已使用"
);
}
});
logger
.
debug
(
"AutoAddSCleanRecords:自动添加保洁记录结束"
);
}
@XxlJob
(
"autoRoomExpireTime"
)
public
void
autoRoomExpireTime
()
{
logger
.
debug
(
"autoRoomExpireTime:房间15分钟续单开始"
);
Set
<
String
>
keys
=
redisTemplate
.
keys
(
ReceiptRdeisEnum
.
ROOM_EXPIRE_TIME
.
getValue
()
+
"*"
);
if
(
keys
.
size
()
==
0
)
{
return
;
...
...
@@ -379,6 +384,7 @@ public class RedisTask {
redisUtil
.
delete
(
key
);
}
});
logger
.
debug
(
"autoRoomExpireTime:房间15分钟续单结束"
);
}
private
boolean
extracted
(
String
o
,
List
<
SOrder
>
sOrders
,
SOrder
sOrder
)
{
List
<
SOrder
>
sOrders1
=
sOrders
.
stream
().
filter
(
item
->
...
...
@@ -414,6 +420,7 @@ public class RedisTask {
*/
@XxlJob
(
"monitorDeviceQueue"
)
public
void
monitorDeviceQueue
()
{
logger
.
debug
(
"monitorDeviceQueue:设备消息队列监控开始"
);
Set
<
String
>
keys
=
redisTemplate
.
keys
(
MqttConstants
.
MQTT_STORE_LAST_TIME_KEY
+
"*"
);
if
(
keys
.
size
()
==
0
)
{
return
;
...
...
@@ -454,10 +461,12 @@ public class RedisTask {
}
}
});
logger
.
debug
(
"monitorDeviceQueue:设备消息队列监控结束"
);
}
@XxlJob
(
"AutoOrderCancelPay"
)
public
void
AutoOrderCancelPay
()
{
logger
.
debug
(
"AutoOrderCancelPay:延时订单取消支付开始"
);
Set
<
String
>
keys
=
redisTemplate
.
keys
(
ReceiptRdeisEnum
.
ORDER_CANCEL_PAY
+
"*"
);
if
(
keys
.
size
()
==
0
)
{
return
;
...
...
@@ -480,6 +489,7 @@ public class RedisTask {
}
}
});
logger
.
debug
(
"AutoOrderCancelPay:延时订单取消支付结束"
);
}
/**
...
...
@@ -487,6 +497,7 @@ public class RedisTask {
*/
@XxlJob
(
"AutoEquityMembersSms"
)
public
void
AutoEquityMembersSms
()
{
logger
.
debug
(
"AutoEquityMembersSms:自动发送权益会员过期短信开始"
);
Set
<
String
>
keys
=
redisTemplate
.
keys
(
ReceiptRdeisEnum
.
EQUITY_MEMBERS_TIME
+
"*"
);
if
(
keys
.
size
()
==
0
)
{
return
;
...
...
@@ -503,14 +514,16 @@ public class RedisTask {
SConsumer
sConsumer
=
sConsumerService
.
getById
(
consumerId
);
logger
.
debug
(
"手机号为:{}的用户年度权益会员将在3天后失效"
,
sConsumer
.
getPhone
());
smsService
.
sendOneSms
(
sConsumer
.
getPhone
(),
"年度权益会员将在3天后失效,请及时续约保障权益会员的权益"
);
redisUtil
.
delete
(
key
);
//
redisUtil.delete(key);
}
});
logger
.
debug
(
"AutoEquityMembersSms:自动发送权益会员过期短信结束"
);
}
//权益会员降级
@XxlJob
(
"AutoUpdateEquityMembers"
)
public
void
AutoUpdateEquityMembers
()
{
logger
.
debug
(
"AutoUpdateEquityMembers:权益会员降级开始"
);
Set
<
String
>
keys
=
redisTemplate
.
keys
(
ReceiptRdeisEnum
.
EQUITY_MEMBERS_TIME
+
"*"
);
if
(
keys
.
size
()
==
0
)
{
return
;
...
...
@@ -540,6 +553,7 @@ public class RedisTask {
redisUtil
.
delete
(
key
);
}
});
logger
.
debug
(
"AutoUpdateEquityMembers:权益会员降级结束"
);
}
/**
...
...
@@ -547,6 +561,7 @@ public class RedisTask {
*/
@XxlJob
(
"AutoProgressLog"
)
public
void
AutoProgressLog
()
{
logger
.
debug
(
"AutoProgressLog:会员等级滚动降级开始"
);
//查询1年之前的数据
List
<
MemberProgressLog
>
list
=
memberProgressLogService
.
list
(
new
LambdaQueryWrapper
<
MemberProgressLog
>()
.
lt
(
MemberProgressLog:
:
getExpirationTime
,
new
Date
())
...
...
@@ -564,6 +579,10 @@ public class RedisTask {
if
(
memberProgressLogs
.
size
()
>
0
)
{
//查询会员
ConsumerMember
consumerMember
=
consumerMemberService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerMember
>().
eq
(
ConsumerMember:
:
getConsumerId
,
item
));
if
(
consumerMember
.
getMembershipProgress
().
equals
(
BigDecimal
.
ZERO
))
{
//结束此次循环
return
;
}
//查询会员配置
MemberConfig
memberConfig
=
memberConfigService
.
getById
(
consumerMember
.
getMemberConfigId
());
final
BigDecimal
[]
sum
=
{
BigDecimal
.
ZERO
};
...
...
@@ -575,7 +594,9 @@ public class RedisTask {
sum
[
0
]
=
sum
[
0
].
subtract
(
log
.
getVariableProgress
());
}
});
if
(
consumerMember
.
getMembershipProgress
().
compareTo
(
sum
[
0
])
<
0
)
{
//判断会员进度是否小于扣除进度的绝对值
if
(
consumerMember
.
getMembershipProgress
().
compareTo
(
sum
[
0
].
abs
())
<
0
)
{
//设置为0
consumerMember
.
setMembershipProgress
(
BigDecimal
.
ZERO
);
consumerMember
.
setMembershipLevel
(
0L
);
MemberConfig
memberConfigServiceOne
=
memberConfigService
.
getOne
(
new
LambdaQueryWrapper
<
MemberConfig
>()
...
...
@@ -583,13 +604,17 @@ public class RedisTask {
.
eq
(
MemberConfig:
:
getMembershipLevel
,
consumerMember
.
getMembershipLevel
())
);
consumerMember
.
setMemberConfigId
(
memberConfigServiceOne
.
getId
());
}
else
//判断会员进度是否大于扣除进度
if
(
consumerMember
.
getMembershipProgress
().
compareTo
(
sum
[
0
])
>=
0
)
{
//判断会员进度是否大于扣除进度
}
else
if
(
consumerMember
.
getMembershipProgress
().
compareTo
(
sum
[
0
].
abs
())
>=
0
)
{
//会员进度减去扣除进度
BigDecimal
subtract
=
consumerMember
.
getMembershipProgress
().
subtract
(
sum
[
0
]);
BigDecimal
subtract
=
BigDecimal
.
ZERO
;
if
(
sum
[
0
].
compareTo
(
BigDecimal
.
ZERO
)
<
0
)
{
subtract
=
consumerMember
.
getMembershipProgress
().
add
(
sum
[
0
]);
}
else
if
(
sum
[
0
].
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
subtract
=
consumerMember
.
getMembershipProgress
().
subtract
(
sum
[
0
]);
}
consumerMember
.
setMembershipProgress
(
subtract
);
if
(
subtract
.
compareTo
(
BigDecimal
.
valueOf
(
memberConfig
.
getLimitRequirements
()))
<
0
)
{
if
(
consumerMember
.
getMembershipProgress
()
.
compareTo
(
BigDecimal
.
valueOf
(
memberConfig
.
getLimitRequirements
()))
<
0
)
{
//等级降一级
if
(
consumerMember
.
getMembershipLevel
()
>
0L
)
{
consumerMember
.
setMembershipLevel
(
consumerMember
.
getMembershipLevel
()
-
1
);
...
...
@@ -604,6 +629,7 @@ public class RedisTask {
consumerMemberService
.
updateConsumerMember
(
consumerMember
);
}
});
logger
.
debug
(
"AutoProgressLog:会员等级滚动降级结束"
);
}
...
...
@@ -656,6 +682,7 @@ public class RedisTask {
//自动更新用户unionid
@XxlJob
(
"AutoUpdateOpenid"
)
public
void
AutoUpdateOpenid
()
{
logger
.
debug
(
"AutoUpdateOpenid:自动更新用户unionid开始"
);
List
<
SConsumerToken
>
sConsumerTokenList
=
sConsumerTokenService
.
list
(
new
LambdaQueryWrapper
<
SConsumerToken
>().
isNotNull
(
SConsumerToken:
:
getUnionId
).
isNull
(
SConsumerToken:
:
getOpenId
));
if
(
CollectionUtils
.
isEmpty
(
sConsumerTokenList
))
{
return
;
...
...
@@ -689,5 +716,6 @@ public class RedisTask {
}
}
});
logger
.
debug
(
"AutoUpdateOpenid:自动更新用户unionid结束"
);
}
}
share-quartz/src/main/resources/application-test.yml
View file @
9569744a
...
...
@@ -51,7 +51,7 @@ saobei:
# 开发环境配置
server
:
# 服务器的HTTP端口,默认为8080
port
:
888
2
port
:
888
4
servlet
:
# 应用的访问路径
context-path
:
/
...
...
@@ -151,7 +151,7 @@ spring:
database
:
0
# 密码
# password: whxz2019
password
:
123456
password
:
ErRQcVj1hSwl
# 连接超时时间
timeout
:
10s
lettuce
:
...
...
@@ -246,8 +246,8 @@ xxl:
executor
:
address
:
'
'
#执行器名字,需要和网页中新建的执行器名字一致
appname
:
share-quartz-
test
appname
:
share-quartz-
dev
ip
:
'
'
logpath
:
/var/gxpt/logs/xxl-job/jobhandler
logRetentionDays
:
30
port
:
9998
\ No newline at end of file
port
:
8885
\ No newline at end of file
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