【8.1.9】【sys】整理sys代码

dev-8.1.9
stylefeng 2024-07-12 15:18:24 +08:00
parent c88622cec4
commit 6c4f952841
2 changed files with 29 additions and 9 deletions

View File

@ -135,7 +135,7 @@ public class SysUser extends BaseExpandFieldEntity implements GetSortKey {
/**
*
*/
@TableField("freeze_deadline_time")
@TableField(value = "freeze_deadline_time", updateStrategy = FieldStrategy.IGNORED, insertStrategy = FieldStrategy.IGNORED)
@ChineseDescription("冻结截止时间")
private Date freezeDeadlineTime;

View File

@ -497,14 +497,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
throw new ServiceException(SysUserExceptionEnum.ACCOUNT_NOT_EXIST);
}
// 判断用户状态是否被临时冻结,如果超过了临时冻结时间,将用户状态改为正常态
if (UserStatusEnum.TEMP_FREEZE.getCode().equals(sysUserServiceOne.getStatusFlag())) {
Date freezeDeadlineTime = sysUserServiceOne.getFreezeDeadlineTime();
if (freezeDeadlineTime != null && freezeDeadlineTime.before(new Date())) {
sysUserServiceOne.setStatusFlag(UserStatusEnum.ENABLE.getCode());
this.updateById(sysUserServiceOne);
}
}
// 更新用户的冻结状态
this.updateSysUserFreezeStatus(account, sysUserServiceOne);
} finally {
TenantIdHolder.remove();
}
@ -953,4 +948,29 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
}
}
/**
*
*
* @author fengshuonan
* @since 2024/7/12 15:11
*/
private void updateSysUserFreezeStatus(String account, SysUser sysUserServiceOne) {
// 判断用户状态是否被临时冻结,如果超过了临时冻结时间,将用户状态改为正常态
if (UserStatusEnum.TEMP_FREEZE.getCode().equals(sysUserServiceOne.getStatusFlag())) {
Date freezeDeadlineTime = sysUserServiceOne.getFreezeDeadlineTime();
if (freezeDeadlineTime != null && freezeDeadlineTime.before(new Date())) {
// 修改用户状态为启用
sysUserServiceOne.setStatusFlag(UserStatusEnum.ENABLE.getCode());
// 修改库中的状态,并设置截止冻结日期为空
LambdaUpdateWrapper<SysUser> objectLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
objectLambdaUpdateWrapper.set(SysUser::getStatusFlag, UserStatusEnum.ENABLE.getCode());
objectLambdaUpdateWrapper.set(SysUser::getFreezeDeadlineTime, null);
objectLambdaUpdateWrapper.eq(SysUser::getAccount, account);
this.update(objectLambdaUpdateWrapper);
}
}
}
}