修复:系统设置的Redis缓存不同步的bug
This commit is contained in:
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||||
import com.gxwebsoft.common.core.exception.BusinessException;
|
import com.gxwebsoft.common.core.exception.BusinessException;
|
||||||
import com.gxwebsoft.common.core.utils.CommonUtil;
|
import com.gxwebsoft.common.core.utils.CommonUtil;
|
||||||
|
import com.gxwebsoft.common.core.utils.RedisUtil;
|
||||||
import com.gxwebsoft.common.core.web.*;
|
import com.gxwebsoft.common.core.web.*;
|
||||||
import com.gxwebsoft.common.system.entity.Company;
|
import com.gxwebsoft.common.system.entity.Company;
|
||||||
import com.gxwebsoft.common.system.entity.Tenant;
|
import com.gxwebsoft.common.system.entity.Tenant;
|
||||||
@@ -51,6 +52,8 @@ public class CompanyController extends BaseController {
|
|||||||
private TenantMapper tenantMapper;
|
private TenantMapper tenantMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private UserCollectionService userCollectionService;
|
private UserCollectionService userCollectionService;
|
||||||
|
@Resource
|
||||||
|
private RedisUtil redisUtil;
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation("分页查询企业信息不限租户")
|
@ApiOperation("分页查询企业信息不限租户")
|
||||||
@@ -141,6 +144,8 @@ public class CompanyController extends BaseController {
|
|||||||
@PutMapping()
|
@PutMapping()
|
||||||
public ApiResult<?> update(@RequestBody Company company) {
|
public ApiResult<?> update(@RequestBody Company company) {
|
||||||
if (companyService.updateById(company)) {
|
if (companyService.updateById(company)) {
|
||||||
|
// 清除缓存
|
||||||
|
redisUtil.delete("TenantInfo:".concat(company.getTenantId().toString()));
|
||||||
return success("修改成功");
|
return success("修改成功");
|
||||||
}
|
}
|
||||||
return fail("修改失败");
|
return fail("修改失败");
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.gxwebsoft.common.system.controller;
|
package com.gxwebsoft.common.system.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
@@ -88,19 +89,14 @@ public class SettingController extends BaseController {
|
|||||||
public ApiResult<?> update(@RequestBody Setting setting) {
|
public ApiResult<?> update(@RequestBody Setting setting) {
|
||||||
if (settingService.updateById(setting)) {
|
if (settingService.updateById(setting)) {
|
||||||
// 更新系统设置信息到缓存
|
// 更新系统设置信息到缓存
|
||||||
String key = "setting:" + setting.getSettingKey() + ":" + getTenantId();
|
String key = StrUtil.upperFirst(setting.getSettingKey()).concat(":").concat(getTenantId().toString());
|
||||||
System.out.println("key = " + key);
|
|
||||||
redisUtil.set(key, JSON.parseObject(setting.getContent()));
|
redisUtil.set(key, JSON.parseObject(setting.getContent()));
|
||||||
// 创建微信支付Bean
|
|
||||||
// settingService.initConfig(setting);
|
|
||||||
// 更新租户信息
|
// 更新租户信息
|
||||||
if (setting.getSettingKey().equals("setting")) {
|
if (setting.getSettingKey().equals("setting")) {
|
||||||
System.out.println("修改系统设置 = " + setting.getContent());
|
|
||||||
final String content = setting.getContent();
|
final String content = setting.getContent();
|
||||||
final JSONObject jsonObject = JSONObject.parseObject(content);
|
final JSONObject jsonObject = JSONObject.parseObject(content);
|
||||||
final String siteName = jsonObject.getString("siteName");
|
final String siteName = jsonObject.getString("siteName");
|
||||||
final String logo = jsonObject.getString("logo");
|
final String logo = jsonObject.getString("logo");
|
||||||
System.out.println("siteName = " + siteName);
|
|
||||||
final Tenant tenant = new Tenant();
|
final Tenant tenant = new Tenant();
|
||||||
tenant.setTenantName(siteName);
|
tenant.setTenantName(siteName);
|
||||||
tenant.setTenantId(getTenantId());
|
tenant.setTenantId(getTenantId());
|
||||||
|
|||||||
Reference in New Issue
Block a user