[bug]删除使用缓存时的使用的key中租户ID

master
liuqingkun 3 years ago
parent fceb043321
commit 1acc17d15b
  1. 12
      src/main/java/org/springblade/common/cache/DictBizCache.java
  2. 8
      src/main/java/org/springblade/modules/business/controller/CommonApiController.java
  3. 1
      src/main/java/org/springblade/modules/business/service/impl/ApmRecordServiceImpl.java

@ -54,7 +54,8 @@ public class DictBizCache {
* @return DictBiz
*/
public static DictBiz getById(Long id) {
String keyPrefix = DICT_ID.concat(StringPool.DASH).concat(AuthUtil.getTenantId()).concat(StringPool.COLON);
// String keyPrefix = DICT_VALUE.concat(StringPool.DASH).concat(AuthUtil.getTenantId()).concat(StringPool.COLON);
String keyPrefix = DICT_VALUE;
return CacheUtil.get(DICT_CACHE, keyPrefix, id, () -> dictService.getById(id), BusinessConstant.TENANT_MODE);
}
@ -77,7 +78,8 @@ public class DictBizCache {
* @return String
*/
public static String getValue(String code, Integer dictKey) {
String keyPrefix = DICT_VALUE.concat(StringPool.DASH).concat(AuthUtil.getTenantId()).concat(StringPool.COLON);
// String keyPrefix = DICT_VALUE.concat(StringPool.DASH).concat(AuthUtil.getTenantId()).concat(StringPool.COLON);
String keyPrefix = DICT_VALUE;
return CacheUtil.get(DICT_CACHE, keyPrefix + code + StringPool.COLON, String.valueOf(dictKey), () -> dictService.getValue(code, String.valueOf(dictKey)), BusinessConstant.TENANT_MODE);
}
@ -100,7 +102,8 @@ public class DictBizCache {
* @return String
*/
public static String getValue(String code, String dictKey) {
String keyPrefix = DICT_VALUE.concat(StringPool.DASH).concat(AuthUtil.getTenantId()).concat(StringPool.COLON);
// String keyPrefix = DICT_VALUE.concat(StringPool.DASH).concat(AuthUtil.getTenantId()).concat(StringPool.COLON);
String keyPrefix = DICT_VALUE;
return CacheUtil.get(DICT_CACHE, keyPrefix + code + StringPool.COLON, dictKey, () -> dictService.getValue(code, dictKey), BusinessConstant.TENANT_MODE);
}
@ -111,7 +114,8 @@ public class DictBizCache {
* @return List<DictBiz>
*/
public static List<DictBiz> getList(String code) {
String keyPrefix = DICT_LIST.concat(StringPool.DASH).concat(AuthUtil.getTenantId()).concat(StringPool.COLON);
// String keyPrefix = DICT_VALUE.concat(StringPool.DASH).concat(AuthUtil.getTenantId()).concat(StringPool.COLON);
String keyPrefix = DICT_VALUE;
return CacheUtil.get(DICT_CACHE, keyPrefix, code, () -> dictService.getList(code), BusinessConstant.TENANT_MODE);
}

@ -42,8 +42,8 @@ public class CommonApiController extends BladeController {
return R.data(CommonDateUtil.getNowString());
}
@GetMapping("/test")
public R test() {
return R.data(DictBizCache.getDictValueWithOffset(BusinessConstant.DICT_KEY_BLACKLIST_OUTDATE));
}
// @GetMapping("/test")
// public R test() {
// return R.data(DictBizCache.getDictValueWithOffset(BusinessConstant.DICT_KEY_BLACKLIST_OUTDATE));
// }
}

@ -121,7 +121,6 @@ public class ApmRecordServiceImpl extends BaseServiceImpl<ApmRecordMapper, ApmRe
String cupCardNo = apmRecordList.get(0).getCupCardNo();
Date apmDay = apmRecordList.get(0).getApmDay();
System.out.println(DictBizCache.getDictValueWithOffset("save check : "+BusinessConstant.DICT_KEY_BLACKLIST_OUTDATE));
// 判断用户是否正在被拉黑
Blacklist blacklist = blacklistService.getLatelyRecord(cupCardNo);
if (Func.isNotEmpty(blacklist) && CommonDateUtil.daysBetweenWithoutStartDay(blacklist.getCreateTime(), DateUtil.now()) < DictBizCache.getDictValueWithOffset(BusinessConstant.DICT_KEY_BLACKLIST_OUTDATE)) {

Loading…
Cancel
Save