装扮商城过期刷新定时任务同意为每个小时刷新一次
This commit is contained in:
@@ -150,6 +150,9 @@ public class CarportService extends BaseService {
|
||||
CarCarportExample example = new CarCarportExample();
|
||||
example.createCriteria().andExpireTimeLessThan(current).andStatusEqualTo(Constant.CarportStatus.valid);
|
||||
List<CarCarport> carports = this.carCarportMapper.selectByExample(example);
|
||||
if (CollectionUtils.isEmpty(carports)) {
|
||||
return;
|
||||
}
|
||||
for (CarCarport carport : carports) {
|
||||
Byte originUsed = carport.getUsed();
|
||||
carport.setStatus(Constant.CarportStatus.expire);
|
||||
|
@@ -62,17 +62,14 @@ public class UserChatBubbleTaskService {
|
||||
if (CollectionUtils.isEmpty(expireUserInfoCards)) {
|
||||
return;
|
||||
}
|
||||
ExecutorService executorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 2 - 1);
|
||||
for (UserChatBubble chatBubble : expireUserInfoCards) {
|
||||
executorService.execute(() -> {
|
||||
boolean used = Constant.UserInfoCardUsed.USING.equals(chatBubble.getUsed());
|
||||
chatBubble.setUsed(Constant.UserInfoCardUsed.NOT_USING);
|
||||
chatBubble.setUpdateTime(new Date());
|
||||
userChatBubbleService.updateById(chatBubble);
|
||||
if (used) {
|
||||
jedisService.hdel(RedisKey.user_using_chat_bubble.getKey(), chatBubble.getUid().toString());
|
||||
}
|
||||
});
|
||||
boolean used = Constant.UserInfoCardUsed.USING.equals(chatBubble.getUsed());
|
||||
chatBubble.setUsed(Constant.UserInfoCardUsed.NOT_USING);
|
||||
chatBubble.setUpdateTime(new Date());
|
||||
userChatBubbleService.updateById(chatBubble);
|
||||
if (used) {
|
||||
jedisService.hdel(RedisKey.user_using_chat_bubble.getKey(), chatBubble.getUid().toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -318,18 +318,15 @@ public class UserPersonalBackgroundService extends ServiceImpl<UserPersonalBackg
|
||||
if (CollectionUtils.isEmpty(expirePersonalBackground)) {
|
||||
return;
|
||||
}
|
||||
ExecutorService executorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 2 - 1);
|
||||
for (UserPersonalBackground background : expirePersonalBackground) {
|
||||
executorService.execute(() -> {
|
||||
boolean used = Constant.UserPersonalBackgroundUsed.USING.equals(background.getUsed());
|
||||
background.setStatus(Constant.UserPersonalBackgroundStatus.EXPIRED);
|
||||
background.setUsed(Constant.UserPersonalBackgroundUsed.NOT_USING);
|
||||
background.setUpdateTime(new Date());
|
||||
baseMapper.updateById(background);
|
||||
if (used) {
|
||||
jedisService.hdel(RedisKey.user_using_personal_background.getKey(), background.getUid().toString());
|
||||
}
|
||||
});
|
||||
boolean used = Constant.UserPersonalBackgroundUsed.USING.equals(background.getUsed());
|
||||
background.setStatus(Constant.UserPersonalBackgroundStatus.EXPIRED);
|
||||
background.setUsed(Constant.UserPersonalBackgroundUsed.NOT_USING);
|
||||
background.setUpdateTime(new Date());
|
||||
baseMapper.updateById(background);
|
||||
if (used) {
|
||||
jedisService.hdel(RedisKey.user_using_personal_background.getKey(), background.getUid().toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -602,19 +602,19 @@ public class HeadwearService extends BaseService {
|
||||
List<UserHeadwear> userHeadwears = this.userHeadwearMapper.selectByExample(example);
|
||||
logger.info("cleanExpiredUserHeadwear(), size={}", userHeadwears != null ? userHeadwears.size() : 0);
|
||||
|
||||
ExecutorService executorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 2 - 1);
|
||||
if (CollectionUtils.isEmpty(userHeadwears)) {
|
||||
return;
|
||||
}
|
||||
for (UserHeadwear userHeadwear : userHeadwears) {
|
||||
executorService.execute(() -> {
|
||||
boolean used = userHeadwear.getUsed();
|
||||
userHeadwear.setStatus(HeadwearConstant.Status.EXPIRED);
|
||||
userHeadwear.setUsed(Boolean.FALSE);
|
||||
userHeadwear.setUpdateTime(current);
|
||||
this.userHeadwearMapper.updateByPrimaryKeySelective(userHeadwear);
|
||||
boolean used = userHeadwear.getUsed();
|
||||
userHeadwear.setStatus(HeadwearConstant.Status.EXPIRED);
|
||||
userHeadwear.setUsed(Boolean.FALSE);
|
||||
userHeadwear.setUpdateTime(current);
|
||||
this.userHeadwearMapper.updateByPrimaryKeySelective(userHeadwear);
|
||||
|
||||
if (used) {
|
||||
this.jedisService.hset(RedisKey.user_using_headwear.getKey(), userHeadwear.getUid().toString(), ApplicationConstant.NULL_JSON_OBJECT);
|
||||
}
|
||||
});
|
||||
if (used) {
|
||||
this.jedisService.hset(RedisKey.user_using_headwear.getKey(), userHeadwear.getUid().toString(), ApplicationConstant.NULL_JSON_OBJECT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
package com.accompany.scheduler.task;
|
||||
package com.accompany.scheduler.task.dress;
|
||||
|
||||
import com.accompany.business.service.car.CarportService;
|
||||
import com.accompany.scheduler.base.BaseTask;
|
||||
@@ -21,7 +21,7 @@ public class CarTask extends BaseTask {
|
||||
/**
|
||||
* 清除过期,凌晨10分和15分
|
||||
*/
|
||||
@Scheduled(cron = "0 20,35 0 * * ?")
|
||||
@Scheduled(cron = "0 0 */1 * * ?")
|
||||
public void clearExpireCar() {
|
||||
logger.info("clearExpireCar start ===============");
|
||||
carportService.releaseAllExpireCar();
|
@@ -1,4 +1,4 @@
|
||||
package com.accompany.scheduler.task;
|
||||
package com.accompany.scheduler.task.dress;
|
||||
|
||||
import com.accompany.business.service.headwear.HeadwearService;
|
||||
import org.slf4j.Logger;
|
||||
@@ -20,7 +20,7 @@ public class HeadwearTask {
|
||||
@Autowired
|
||||
private HeadwearService headwearService;
|
||||
|
||||
@Scheduled(cron = "0 0 1 * * ?")
|
||||
@Scheduled(cron = "0 0 */1 * * ?")
|
||||
public void clearExpireUserHeadwear() {
|
||||
logger.info("BEGIN CLEAN EXPIRED USER HEADWEAR...");
|
||||
this.headwearService.cleanExpiredUserHeadwear();
|
Reference in New Issue
Block a user