This commit is contained in:
18792927508
2024-02-23 14:25:37 +08:00
parent ba20a9d807
commit e00d61949b
10 changed files with 136 additions and 57 deletions
@@ -1,5 +1,10 @@
package com.ruoyi.framework.config;
import cn.hutool.core.util.StrUtil;
import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.wisdomarbitrate.service.mscase.MsCaseApplicationService;
import org.springframework.cache.annotation.CachingConfigurerSupport;
import org.springframework.cache.annotation.EnableCaching;
@@ -75,10 +80,32 @@ public class RedisConfig extends CachingConfigurerSupport
public ApplicationListener applicationListener() {
return (ApplicationListener<RedisKeyExpiredEvent>) event -> {
String key = new String(event.getSource());
// 根据key查询案件表
caseApplicationService.notAccept(key,"已超过案件受理期限五日,");
if(key.startsWith(CacheConstants.CASE_KEY)) {
String[] split = key.split(CacheConstants.CASE_KEY);
if(split.length>1 && StrUtil.isNotEmpty(split[1])) {
caseApplicationService.notAccept(split[1], "已超过案件受理期限五日,");
}
}
};
}
/**
* 获取字典缓存
*
* @param key 参数键
* @return dictDatas 字典数据列表
*/
public static String getCodeCache(String key)
{
String codeCache = SpringUtils.getBean(RedisCache.class).getCacheObject(getVerifyCodeCacheKey(key));
if (StringUtils.isNotNull(codeCache))
{
return codeCache;
}
return null;
}
private static String getVerifyCodeCacheKey(String key) {
return CacheConstants.CASE_KEY + key;
}
/**
* 限流脚本
*/