Compare commits
5 Commits
dbaba2532c
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| fe48dfe3a1 | |||
| d5c51a80c6 | |||
| aa905d47ac | |||
| 40c0f96518 | |||
| 8ae9dda7e6 |
@@ -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;
|
||||||
}
|
}
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -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 "租户未配置过期时间";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user