From 377960536d9646ac9d5b2a6c157325682b732e42 Mon Sep 17 00:00:00 2001 From: smallchill Date: Tue, 20 Jul 2021 22:28:07 +0800 Subject: [PATCH] =?UTF-8?q?:zap:=20=E4=BC=98=E5=8C=96=E7=A7=9F=E6=88=B7?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E6=B8=85=E7=A9=BA=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/service/impl/TenantServiceImpl.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/blade-service/blade-system/src/main/java/org/springblade/system/service/impl/TenantServiceImpl.java b/blade-service/blade-system/src/main/java/org/springblade/system/service/impl/TenantServiceImpl.java index 858ed3ce..5fcbc3cb 100644 --- a/blade-service/blade-system/src/main/java/org/springblade/system/service/impl/TenantServiceImpl.java +++ b/blade-service/blade-system/src/main/java/org/springblade/system/service/impl/TenantServiceImpl.java @@ -81,7 +81,6 @@ public class TenantServiceImpl extends BaseServiceImpl imp @Override @Transactional(rollbackFor = Exception.class) public boolean submitTenant(Tenant tenant) { - CacheUtil.clear(SYS_CACHE); if (Func.isEmpty(tenant.getId())) { List tenants = baseMapper.selectList(Wrappers.query().lambda().eq(Tenant::getIsDeleted, BladeConstant.DB_NOT_DELETED)); List codes = tenants.stream().map(Tenant::getTenantId).collect(Collectors.toList()); @@ -158,6 +157,7 @@ public class TenantServiceImpl extends BaseServiceImpl imp } return temp; } else { + CacheUtil.clear(SYS_CACHE, tenant.getTenantId()); return super.saveOrUpdate(tenant); } } @@ -165,9 +165,9 @@ public class TenantServiceImpl extends BaseServiceImpl imp @Override @Transactional(rollbackFor = Exception.class) public boolean removeTenant(List ids) { - CacheUtil.clear(SYS_CACHE); - List tenantList = this.list(Wrappers.query().lambda().in(Tenant::getId, ids)); - List tenantIds = tenantList.stream().map(tenant -> Func.toStr(tenant.getTenantId())).distinct().collect(Collectors.toList()); + List tenantIds = this.list(Wrappers.query().lambda().in(Tenant::getId, ids)) + .stream().map(tenant -> Func.toStr(tenant.getTenantId())).distinct().collect(Collectors.toList()); + CacheUtil.clear(SYS_CACHE, tenantIds); if (tenantIds.contains(BladeConstant.ADMIN_TENANT_ID)) { throw new ServiceException("不可删除管理租户!"); } @@ -181,7 +181,9 @@ public class TenantServiceImpl extends BaseServiceImpl imp @Override public boolean setting(Integer accountNumber, Date expireTime, String ids) { - CacheUtil.clear(SYS_CACHE); + List tenantIds = this.list(Wrappers.query().lambda().in(Tenant::getId, ids)) + .stream().map(tenant -> Func.toStr(tenant.getTenantId())).distinct().collect(Collectors.toList()); + CacheUtil.clear(SYS_CACHE, tenantIds); Func.toLongList(ids).forEach(id -> { Kv kv = Kv.create().set("accountNumber", accountNumber).set("expireTime", expireTime).set("id", id); String licenseKey = DesUtil.encryptToHex(JsonUtil.toJson(kv), DES_KEY);