Commit 0d730371 by 吕明尚

增加自动增加月卡时长定时任务

parent e58da9e4
......@@ -802,6 +802,31 @@ public class RedisTask {
logger.debug("AutomaticallyMonthlyCard:自动结束月卡结束");
}
//每日00:00:00增加时长
@XxlJob("AutoMonthlyCardTime")
public void AutoMonthlyCardTime() {
logger.debug("AutoMonthlyCardTime:自动增加月卡时长开始");
Set<String> keys = redisTemplate.keys(ReceiptRdeisEnum.MONTHLY_CARD.getValue() + "*");
if (keys.size() == 0) return;
List<ConsumerMonthlyCard> consumerMonthlyCards = new ArrayList<>();
String monthlyCardTime = sysConfigService.selectConfigByKey("monthlyCardTime");
keys.stream().forEach(key -> {
String value = redisUtil.get(String.valueOf(key));
JSONObject jsonObject = new JSONObject(value);
Date expirationTime = jsonObject.getDate("expirationTime");
Long consumerMonthlyCardId = jsonObject.getLong("consumerMonthlyCardId");
if (expirationTime.getTime() > new Date().getTime()) {
ConsumerMonthlyCard consumerMonthlyCard = new ConsumerMonthlyCard();
consumerMonthlyCard.setFreeDuration(new BigDecimal(monthlyCardTime));
consumerMonthlyCard.setId(consumerMonthlyCardId);
consumerMonthlyCards.add(consumerMonthlyCard);
}
});
if (!CollectionUtils.isEmpty(consumerMonthlyCards))
consumerMonthlyCardService.updateBatchById(consumerMonthlyCards);
logger.debug("AutoMonthlyCardTime:自动增加月卡时长结束");
}
@XxlJob("AutomaticallySecondaryCard")
public void AutomaticallySecondaryCard() {
logger.debug("AutomaticallySecondaryCard:自动结束次卡开始");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment