Browse Source

给客户勾选菜单时,删除缓存

dev
zxc 3 years ago
parent
commit
0e38202423
  1. 10
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
  2. 9
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java
  3. 5
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/GovCustomerMenuRedis.java
  4. 1
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/GovCustomerMenuServiceImpl.java

10
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java

@ -766,6 +766,16 @@ public class RedisKeys {
return rootPrefix.concat("gov:access:nav:");
}
/**
* Desc: 新五大图层获取菜单缓存key
* @param
* @author zxc
* @date 2022/7/27 13:42
*/
public static String getCustomerMenuListFiveCoverage() {
return rootPrefix.concat("customer:govMenu:");
}
/**
* 如果是省列表epmet:areacode:parentCode:0
* 山东省的下一级epmet:areacode:parentCode:37

9
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java

@ -375,6 +375,15 @@ public class RedisUtils {
return redisTemplate.opsForSet().add(key,value);
}
public void listAdd(String key,Object value){
redisTemplate.opsForList().rightPush(key,value);
}
public Object listGetAll(String key,Integer start, Integer end){
List<Object> result = redisTemplate.opsForList().range(key, start, end);
return result;
}
/**
* @Description 获取 zset 中带score的集合
* @param key

5
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/GovCustomerMenuRedis.java

@ -78,6 +78,11 @@ public class GovCustomerMenuRedis {
redisUtils.deleteByPattern(key);
}
public void delAllCustomerMenuFiveCoverage(String customerId){
String key = RedisKeys.getCustomerMenuListFiveCoverage().concat(customerId);
redisUtils.delete(key);
}
private boolean checkParam(String customerId, Integer type) {
if (StringUtils.isBlank(customerId) || type == null){
log.warn("checkParam fail, param is null");

1
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/GovCustomerMenuServiceImpl.java

@ -115,6 +115,7 @@ public class GovCustomerMenuServiceImpl extends BaseServiceImpl<GovCustomerMenuD
entity.setCustomerId(customerId);
entity.setTableId(formDTO.getTableId());
entities.add(entity);
govCustomerMenuRedis.delAllCustomerMenuFiveCoverage(customerId);
}
insertBatch(entities);
}

Loading…
Cancel
Save