Compare commits

...

5 Commits

Author SHA1 Message Date
fe48dfe3a1 feat(newhosts): 新增最近7天直播场次筛选条件
在主播分页查询中支持按「有无直播记录」过滤。
2025-12-19 15:49:44 +08:00
d5c51a80c6 fix(system): 修正WebAI过期账号禁用逻辑中的字段引用错误 2025-12-15 21:09:33 +08:00
aa905d47ac refactor(system): 修正类名大小写规范 2025-12-11 21:03:11 +08:00
40c0f96518 feat(system): 新增定时任务禁用过期WebAI账号 2025-12-11 20:58:23 +08:00
8ae9dda7e6 fix(system): 修正租户余额与套餐价格比较逻辑 2025-12-05 21:16:45 +08:00
4 changed files with 95 additions and 1 deletions

View File

@@ -148,4 +148,7 @@ public class NewHostsPageReqVO extends PageParam {
@Schema(description = "国家英文名", example = "United States") @Schema(description = "国家英文名", example = "United States")
private String countryEng; private String countryEng;
@Schema(description = "最近 7天 是否存在直播场次", example = "0")
private Integer hasLiveRecoder;
} }

View File

@@ -107,6 +107,29 @@
<if test="req.invitationType != null"> <if test="req.invitationType != null">
and ns.Invitation_type =#{req.invitationType,jdbcType=INTEGER} and ns.Invitation_type =#{req.invitationType,jdbcType=INTEGER}
</if> </if>
<!-- 判断主播是否有直播场次 -->
<if test="req.hasLiveRecoder != null">
<choose>
<when test="req.hasLiveRecoder == 0">
AND EXISTS (
SELECT 1
FROM server_live_host_detail ld
WHERE ld.deleted = 0
AND ld.tenant_id = ns.tenant_id
AND ld.hosts_id = ns.hosts_id
)
</when>
<when test="req.hasLiveRecoder == 1">
AND NOT EXISTS (
SELECT 1
FROM server_live_host_detail ld
WHERE ld.deleted = 0
AND ld.tenant_id = ns.tenant_id
AND ld.hosts_id = ns.hosts_id
)
</when>
</choose>
</if>
<!-- 排序类型 --> <!-- 排序类型 -->
group by group by
ns.hosts_id ns.hosts_id

View File

@@ -0,0 +1,68 @@
package cn.iocoder.yudao.module.system.job;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantDO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.yudao.module.system.dal.mysql.tenant.TenantMapper;
import cn.iocoder.yudao.module.system.dal.mysql.user.AdminUserMapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.List;/*
* @author: ziin
* @date: 2025/12/11 20:55
*/
@Slf4j
@Component
public class DisableWebAIExpiredAccount implements JobHandler{
/**
* 租户数据访问对象
* 用于查询租户信息和过期时间
*/
@Resource
TenantMapper tenantMapper;
/**
* 管理员用户数据访问对象
* 用于查询和更新用户权限状态
*/
@Resource
private AdminUserMapper userMapper;
@Override
@TenantJob
public String execute(String param) throws Exception {
Long tenantId = TenantContextHolder.getTenantId();
TenantDO tenant = tenantMapper.selectById(tenantId);
if (tenant.getExpireTime()!=null) {
Duration brotherDuration = LocalDateTimeUtil.between(tenant.getAiExpireTime(), LocalDateTime.now());
long minutes = brotherDuration.toMinutes();
LambdaQueryWrapper<AdminUserDO> aiUserQueryWrapper = new LambdaQueryWrapper<>();
aiUserQueryWrapper.eq(AdminUserDO::getTenantId, tenantId);
aiUserQueryWrapper.eq(AdminUserDO::getWebAi, 1);
List<AdminUserDO> aiUserList = userMapper.selectList(aiUserQueryWrapper);
int aiAccountNum = 0 ;
if (minutes >= 0) {
for (AdminUserDO adminUserDO : aiUserList) {
adminUserDO.setWebAi((byte) 0);
userMapper.updateById(adminUserDO);
aiAccountNum++;
log.info("禁用过期WebAI账号账号ID{}", adminUserDO.getId());
}
}
// 返回操作结果包含禁用的AI账号和大哥账号数量统计
return "禁用过期账号成功,禁用了 " + aiAccountNum + " 个 WebAI 账号。";
}
return "租户未配置过期时间";
}
}

View File

@@ -162,7 +162,7 @@ public class TenantServiceImpl implements TenantService {
throw exception(TENANT_USER_NOT_EXISTS); throw exception(TENANT_USER_NOT_EXISTS);
} }
if (tenantBalance.getBalance()<=tenantAgencyPackage.getPrice()){ if (tenantBalance.getBalance() < tenantAgencyPackage.getPrice()){
throw exception(TENANT_BALANCE_NOT_ENOUGH); throw exception(TENANT_BALANCE_NOT_ENOUGH);
} }