Compare commits
6 Commits
8cf9ad4436
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| ba86ac45f4 | |||
| d1f1e72732 | |||
| ab09d0ee74 | |||
| 407438fb99 | |||
| d0f4ad25c0 | |||
| da7bfbc9ce |
@@ -51,11 +51,9 @@ public class KeyboardAiCompanionSaveReqVO {
|
||||
private Integer popularityScore;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "创建时间不能为空")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "更新时间不能为空")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
@Schema(description = "开场白")
|
||||
|
||||
@@ -52,4 +52,7 @@ public class KeyboardProductItemsPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "订阅等级")
|
||||
private Integer level;
|
||||
|
||||
@Schema(description = "平台")
|
||||
private String platform;
|
||||
}
|
||||
@@ -67,4 +67,7 @@ public class KeyboardProductItemsRespVO {
|
||||
|
||||
@Schema(description = "订阅等级")
|
||||
private Integer level;
|
||||
|
||||
@Schema(description = "平台")
|
||||
private String platform;
|
||||
}
|
||||
@@ -59,4 +59,7 @@ public class KeyboardProductItemsSaveReqVO {
|
||||
|
||||
@Schema(description = "订阅等级")
|
||||
private Integer level;
|
||||
|
||||
@Schema(description = "平台")
|
||||
private String platform;
|
||||
}
|
||||
@@ -57,4 +57,7 @@ public class AiCompanionI18nDO {
|
||||
*/
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
private String prologue;
|
||||
|
||||
private String prologueAudio;
|
||||
}
|
||||
@@ -83,14 +83,6 @@ public class KeyboardAiCompanionDO {
|
||||
* 更新时间
|
||||
*/
|
||||
private LocalDateTime updatedAt;
|
||||
/**
|
||||
* 开场白
|
||||
*/
|
||||
private String prologue;
|
||||
/**
|
||||
* 开场白音频
|
||||
*/
|
||||
private String prologueAudio;
|
||||
/**
|
||||
* 音频Id
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.yolo.keyboard.dal.dataobject.productitems;
|
||||
|
||||
import com.yolo.keyboard.framework.tenant.core.aop.TenantIgnore;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
@@ -81,4 +82,6 @@ public class KeyboardProductItemsDO{
|
||||
* 订阅等级
|
||||
*/
|
||||
private Integer level;
|
||||
|
||||
private String platform;
|
||||
}
|
||||
@@ -32,8 +32,6 @@ public interface KeyboardAiCompanionMapper extends BaseMapperX<KeyboardAiCompani
|
||||
.eqIfPresent(KeyboardAiCompanionDO::getPopularityScore, reqVO.getPopularityScore())
|
||||
.eqIfPresent(KeyboardAiCompanionDO::getCreatedAt, reqVO.getCreatedAt())
|
||||
.eqIfPresent(KeyboardAiCompanionDO::getUpdatedAt, reqVO.getUpdatedAt())
|
||||
.eqIfPresent(KeyboardAiCompanionDO::getPrologue, reqVO.getPrologue())
|
||||
.eqIfPresent(KeyboardAiCompanionDO::getPrologueAudio, reqVO.getPrologueAudio())
|
||||
.eqIfPresent(KeyboardAiCompanionDO::getVoiceId, reqVO.getVoiceId())
|
||||
.orderByDesc(KeyboardAiCompanionDO::getId));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.yolo.keyboard.job;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.yolo.keyboard.dal.dataobject.user.KeyboardUserDO;
|
||||
import com.yolo.keyboard.dal.mysql.user.KeyboardUserMapper;
|
||||
import com.yolo.keyboard.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.yolo.keyboard.framework.quartz.core.handler.JobHandler;
|
||||
import com.yolo.keyboard.framework.tenant.core.aop.TenantIgnore;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* VIP 到期检查定时任务
|
||||
* 定期执行,将 VIP 已过期的用户关闭 VIP 权限
|
||||
*
|
||||
* @author ziin
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class VipExpiryCheckJob implements JobHandler {
|
||||
|
||||
@Resource
|
||||
private KeyboardUserMapper userMapper;
|
||||
|
||||
@Override
|
||||
@TenantIgnore
|
||||
public String execute(String param) {
|
||||
log.info("[VipExpiryCheckJob] 开始执行 VIP 到期检查任务");
|
||||
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
|
||||
// 查询 VIP 已过期且仍处于 VIP 状态的用户
|
||||
List<KeyboardUserDO> expiredUsers = userMapper.selectList(
|
||||
new LambdaQueryWrapperX<KeyboardUserDO>()
|
||||
.eq(KeyboardUserDO::getIsVip, true)
|
||||
.le(KeyboardUserDO::getVipExpiry, now)
|
||||
);
|
||||
|
||||
if (CollUtil.isEmpty(expiredUsers)) {
|
||||
log.info("[VipExpiryCheckJob] 没有需要处理的过期 VIP 用户");
|
||||
return "没有需要处理的过期 VIP 用户";
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
for (KeyboardUserDO user : expiredUsers) {
|
||||
user.setIsVip(false);
|
||||
user.setUpdatedAt(now);
|
||||
userMapper.updateById(user);
|
||||
count++;
|
||||
|
||||
log.info("[VipExpiryCheckJob] 用户 {} VIP 已过期,已关闭 VIP 权限,过期时间: {}",
|
||||
user.getUid(), user.getVipExpiry());
|
||||
}
|
||||
|
||||
String result = String.format("共处理 %d 个过期 VIP 用户", count);
|
||||
log.info("[VipExpiryCheckJob] 任务执行完成: {}", result);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user