Browse Source

菜单缓存必须全干掉

release
jianjun 3 years ago
parent
commit
d46e8e1154
  1. 10
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
  2. 12
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/GovCustomerMenuRedis.java
  3. 5
      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

@ -734,6 +734,14 @@ public class RedisKeys {
} }
public static String getCustomerMenuList(String customerId, Integer type) { public static String getCustomerMenuList(String customerId, Integer type) {
return rootPrefix.concat("oper:access:nav:customerId:").concat(customerId).concat(":type:")+type; return getCustomerMenuListPrefix().concat(customerId).concat(":type:")+type;
}
/**
* desc:菜单缓存前缀
* @return
*/
public static String getCustomerMenuListPrefix() {
return rootPrefix.concat("oper:access:nav:customerId:");
} }
} }

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

@ -17,6 +17,7 @@
package com.epmet.redis; package com.epmet.redis;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.dto.GovMenuDTO; import com.epmet.dto.GovMenuDTO;
@ -66,16 +67,11 @@ public class GovCustomerMenuRedis {
/** /**
* desc:删除客户菜单缓存 * desc:删除客户菜单缓存
* @param customerId
* @param type
* @see com.epmet.enums.MenuTypeEnum * @see com.epmet.enums.MenuTypeEnum
*/ */
public void delCustomerMenu(String customerId, Integer type) { public void delAllCustomerMenu() {
if (checkParam(customerId, type)) { String key = RedisKeys.getCustomerMenuListPrefix().concat(StrConstant.STAR);
String key = RedisKeys.getCustomerMenuList(customerId, type); redisUtils.delete(key);
redisUtils.delete(key);
}
} }
private boolean checkParam(String customerId, Integer type) { private boolean checkParam(String customerId, Integer type) {

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

@ -28,7 +28,6 @@ import com.epmet.dao.GovCustomerMenuDao;
import com.epmet.dto.GovCustomerMenuDTO; import com.epmet.dto.GovCustomerMenuDTO;
import com.epmet.dto.form.MenuConfigFormDTO; import com.epmet.dto.form.MenuConfigFormDTO;
import com.epmet.entity.GovCustomerMenuEntity; import com.epmet.entity.GovCustomerMenuEntity;
import com.epmet.enums.MenuTypeEnum;
import com.epmet.redis.GovCustomerMenuRedis; import com.epmet.redis.GovCustomerMenuRedis;
import com.epmet.service.GovCustomerMenuService; import com.epmet.service.GovCustomerMenuService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -119,8 +118,8 @@ public class GovCustomerMenuServiceImpl extends BaseServiceImpl<GovCustomerMenuD
} }
insertBatch(entities); insertBatch(entities);
} }
//删除缓存 //删除全部客户缓存
formDTO.getCustomerIds().forEach(customerId-> govCustomerMenuRedis.delCustomerMenu(customerId, MenuTypeEnum.MENU.value())); govCustomerMenuRedis.delAllCustomerMenu();
} }
@Override @Override

Loading…
Cancel
Save