From 0f02e687dfe99d783c6deec25475b7caba6b4266 Mon Sep 17 00:00:00 2001 From: mash Date: Thu, 2 Nov 2023 11:32:55 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E6=97=B6=E9=97=B41?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../handler/CustomMetaObjectHandler.java | 18 +++++++++++------- .../system/service/impl/AuthServiceImpl.java | 3 ++- src/main/resources/ehcache.xml | 6 +++--- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/ydool/platform/mybatis/handler/CustomMetaObjectHandler.java b/src/main/java/com/ydool/platform/mybatis/handler/CustomMetaObjectHandler.java index 16d6a2f..b6fea7f 100644 --- a/src/main/java/com/ydool/platform/mybatis/handler/CustomMetaObjectHandler.java +++ b/src/main/java/com/ydool/platform/mybatis/handler/CustomMetaObjectHandler.java @@ -25,10 +25,10 @@ public class CustomMetaObjectHandler implements MetaObjectHandler { */ @Override public void insertFill(MetaObject metaObject) { - String scheduled = getScheduled(); - this.setFieldValByName("createdId", StrUtil.isNotBlank(scheduled) ? "":StpUtil.getLoginIdAsString(), metaObject); + Boolean flag = getScheduled(); + this.setFieldValByName("createdId", flag ? null:StpUtil.getLoginIdAsString(), metaObject); this.setFieldValByName("createdAt", LocalDateTime.now(), metaObject); - this.setFieldValByName("updatedId", StrUtil.isNotBlank(scheduled) ? "":StpUtil.getLoginIdAsString(), metaObject); + this.setFieldValByName("updatedId", flag ? null:StpUtil.getLoginIdAsString(), metaObject); this.setFieldValByName("updatedAt", LocalDateTime.now(), metaObject); } @@ -39,14 +39,18 @@ public class CustomMetaObjectHandler implements MetaObjectHandler { */ @Override public void updateFill(MetaObject metaObject) { - String scheduled = getScheduled(); - this.setFieldValByName("updatedId", StrUtil.isNotBlank(scheduled) ? "":StpUtil.getLoginIdAsString(), metaObject); + Boolean flag = getScheduled(); + this.setFieldValByName("updatedId", flag ? null:StpUtil.getLoginIdAsString(), metaObject); this.setFieldValByName("updatedAt", LocalDateTime.now(), metaObject); } - public String getScheduled() { + public Boolean getScheduled() { + Boolean flag= false; String scheduled = CacheUtil.get(ConfigCache.SCHEDULED_CODE_PERSONNEL_RETIRE, ConfigCache.SCHEDULED_CODE_PERSONNEL_RETIRE, "scheduled").toString(); - return scheduled; + if ("true".equals(scheduled)){ + return flag = true; + } + return flag; } } diff --git a/src/main/java/com/ydool/system/service/impl/AuthServiceImpl.java b/src/main/java/com/ydool/system/service/impl/AuthServiceImpl.java index 518f891..82d1c22 100644 --- a/src/main/java/com/ydool/system/service/impl/AuthServiceImpl.java +++ b/src/main/java/com/ydool/system/service/impl/AuthServiceImpl.java @@ -12,6 +12,7 @@ import com.ydool.common.base.BaseService; import com.ydool.common.cache.ConfigCache; import com.ydool.common.constant.UrlConstant; import com.ydool.common.data.dto.AjaxResult; +import com.ydool.common.utils.CacheUtil; import com.ydool.common.utils.HttpServletUtil; import com.ydool.common.utils.PasswordUtil; import com.ydool.common.utils.RsaUtil; @@ -84,7 +85,7 @@ public class AuthServiceImpl extends BaseService implements IA // 第1步,先登录上 StpUtil.login(loginUser.getId()); - + CacheUtil.put(ConfigCache.SCHEDULED_CODE_PERSONNEL_RETIRE, ConfigCache.SCHEDULED_CODE_PERSONNEL_RETIRE, "scheduled", false); boolean flag = updateById(loginUser); if (flag) { diff --git a/src/main/resources/ehcache.xml b/src/main/resources/ehcache.xml index 8bafcae..13c5bcd 100644 --- a/src/main/resources/ehcache.xml +++ b/src/main/resources/ehcache.xml @@ -97,13 +97,13 @@ overflowToDisk="false"> - +