Browse Source

优化定时任务逻辑

tags/v2.5.0
xiaoying 1 year ago
parent
commit
e2d5892a80
1 changed files with 5 additions and 7 deletions
  1. +5
    -7
      tuoheng_oidc_admin/src/main/java/com/tuoheng/task/StatusTask.java

+ 5
- 7
tuoheng_oidc_admin/src/main/java/com/tuoheng/task/StatusTask.java View File

//判断项目是否已过有效期 //判断项目是否已过有效期
boolean falg = date.after(tenantItem.getEndTime()); boolean falg = date.after(tenantItem.getEndTime());
if (falg) { if (falg) {
log.info("开始禁用对应租户及其用户状态,对应租户id:{}", tenantItem.getTenantId());
//过了则更新租户对应项目状态 //过了则更新租户对应项目状态
TenantPo tenantPo = tenantMapper.selectById(tenantItem.getTenantId()); TenantPo tenantPo = tenantMapper.selectById(tenantItem.getTenantId());
UserPo userPo = clientUserMapper.selectByUserId(tenantPo.getUserId()); UserPo userPo = clientUserMapper.selectByUserId(tenantPo.getUserId());
if (0 != userPo.getIsExpire()) { if (0 != userPo.getIsExpire()) {
log.info("开始禁用对应租户及其用户状态,对应租户id:{}", tenantItem.getTenantId());
userPo.setIsExpire(0); userPo.setIsExpire(0);
//租户状态完毕 //租户状态完毕
clientUserMapper.updatePass(userPo); clientUserMapper.updatePass(userPo);
}
//租户更新完毕 更新对应租户下的用户
List<UserPo> userPoList = clientUserMapper.selectByTenantId(userPo.getId());
for (UserPo po : userPoList) {
if (0 != userPo.getIsExpire()) {
//租户更新完毕 更新对应租户下的用户
List<UserPo> userPoList = clientUserMapper.selectByTenantId(userPo.getId());
for (UserPo po : userPoList) {
po.setIsExpire(0); po.setIsExpire(0);
clientUserMapper.updatePass(userPo); clientUserMapper.updatePass(userPo);
} }
log.info("禁用对应租户及其用户状态完毕");
} }
log.info("禁用对应租户及其用户状态完毕");
} }
} }
} }

Loading…
Cancel
Save