From b9f00f26027d02840fabcf6f67ecc11d0d828dfd Mon Sep 17 00:00:00 2001 From: emcchui Date: Tue, 25 Mar 2025 08:47:19 +0800 Subject: [PATCH] =?UTF-8?q?SZX-927=EF=BC=9A=E5=AD=A6=E5=91=98=E7=AB=AF-?= =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E8=AE=BE=E7=BD=AE-=E6=89=8B=E6=9C=BA?= =?UTF-8?q?=E5=8F=B7=E6=9C=AA=E5=90=8C=E6=AD=A5=E5=88=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/service/impl/DataUserSyncServiceImpl.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/servers/boe-server-all/src/main/java/com/xboe/data/service/impl/DataUserSyncServiceImpl.java b/servers/boe-server-all/src/main/java/com/xboe/data/service/impl/DataUserSyncServiceImpl.java index a32b544b..c2fa67ec 100644 --- a/servers/boe-server-all/src/main/java/com/xboe/data/service/impl/DataUserSyncServiceImpl.java +++ b/servers/boe-server-all/src/main/java/com/xboe/data/service/impl/DataUserSyncServiceImpl.java @@ -11,6 +11,7 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.Cache; import org.springframework.cache.CacheManager; +import org.springframework.cache.annotation.Cacheable; import org.springframework.retry.annotation.Recover; import org.springframework.retry.annotation.Retryable; import org.springframework.stereotype.Service; @@ -86,12 +87,6 @@ public class DataUserSyncServiceImpl implements IDataUserSyncService { log.info("账号不存在,新添加账号【" + user.getId() + "】"); } - Cache cache = cacheManager.getCache(CacheName.NAME_USER); - if(cache != null) { - String key = CacheName.KEY_ACCOUNT + user.getId(); - cache.evict(key); - } - if (u != null) { //更新部分用户字段 u.setDepartId(user.getDepartId()); @@ -129,6 +124,13 @@ public class DataUserSyncServiceImpl implements IDataUserSyncService { userDao.save(u); log.info("添加新用户"); } + + Cache cache = cacheManager.getCache(CacheName.NAME_USER); + if(cache != null) { + cache.evict(CacheName.KEY_ACCOUNT + user.getId()); + cache.evict(CacheName.KEY_USER + user.getId()); + } + //对机构的判断,不为空时才会处理,为空时不处理 if (StringUtils.isNotBlank(user.getDepartId())) { org = orgDao.get(user.getDepartId());