Browse Source

菜单放缓存加强判断 避免空的被放进缓存

dev
jianjun 3 years ago
parent
commit
38f340b37c
  1. 4
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/GovCustomerMenuRedis.java

4
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.NumConstant;
import com.epmet.commons.tools.constant.StrConstant; 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;
@ -25,6 +26,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.util.List; import java.util.List;
@ -46,7 +48,7 @@ public class GovCustomerMenuRedis {
* @see com.epmet.enums.MenuTypeEnum * @see com.epmet.enums.MenuTypeEnum
*/ */
public void setCustomerMenuList(String customerId, Integer type, List<GovMenuDTO> govMenuDTOS) { public void setCustomerMenuList(String customerId, Integer type, List<GovMenuDTO> govMenuDTOS) {
if (checkParam(customerId, type)) { if (checkParam(customerId, type) && !CollectionUtils.isEmpty(govMenuDTOS) && StringUtils.isNotBlank(govMenuDTOS.get(NumConstant.ZERO).getName())) {
String key = RedisKeys.getCustomerMenuList(customerId, type); String key = RedisKeys.getCustomerMenuList(customerId, type);
redisUtils.set(key, govMenuDTOS, RedisUtils.DEFAULT_EXPIRE); redisUtils.set(key, govMenuDTOS, RedisUtils.DEFAULT_EXPIRE);
} }

Loading…
Cancel
Save