From 6c4f952841aadfc36960f5a90b334fd684741e81 Mon Sep 17 00:00:00 2001 From: stylefeng Date: Fri, 12 Jul 2024 15:18:24 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=908.1.9=E3=80=91=E3=80=90sys=E3=80=91?= =?UTF-8?q?=E6=95=B4=E7=90=86sys=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sys/modular/user/entity/SysUser.java | 2 +- .../user/service/impl/SysUserServiceImpl.java | 36 ++++++++++++++----- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/kernel-s-system/system-business-hr/src/main/java/cn/stylefeng/roses/kernel/sys/modular/user/entity/SysUser.java b/kernel-s-system/system-business-hr/src/main/java/cn/stylefeng/roses/kernel/sys/modular/user/entity/SysUser.java index e127eafcb..5bfc39519 100644 --- a/kernel-s-system/system-business-hr/src/main/java/cn/stylefeng/roses/kernel/sys/modular/user/entity/SysUser.java +++ b/kernel-s-system/system-business-hr/src/main/java/cn/stylefeng/roses/kernel/sys/modular/user/entity/SysUser.java @@ -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; diff --git a/kernel-s-system/system-business-hr/src/main/java/cn/stylefeng/roses/kernel/sys/modular/user/service/impl/SysUserServiceImpl.java b/kernel-s-system/system-business-hr/src/main/java/cn/stylefeng/roses/kernel/sys/modular/user/service/impl/SysUserServiceImpl.java index e9cc63952..ffa9d0119 100644 --- a/kernel-s-system/system-business-hr/src/main/java/cn/stylefeng/roses/kernel/sys/modular/user/service/impl/SysUserServiceImpl.java +++ b/kernel-s-system/system-business-hr/src/main/java/cn/stylefeng/roses/kernel/sys/modular/user/service/impl/SysUserServiceImpl.java @@ -497,14 +497,9 @@ public class SysUserServiceImpl extends ServiceImpl 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 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 objectLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); + objectLambdaUpdateWrapper.set(SysUser::getStatusFlag, UserStatusEnum.ENABLE.getCode()); + objectLambdaUpdateWrapper.set(SysUser::getFreezeDeadlineTime, null); + objectLambdaUpdateWrapper.eq(SysUser::getAccount, account); + this.update(objectLambdaUpdateWrapper); + } + } + } + } \ No newline at end of file