diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerStaffRedis.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerStaffRedis.java index 831d2f177d..509b12339f 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerStaffRedis.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerStaffRedis.java @@ -2,6 +2,7 @@ package com.epmet.commons.tools.redis.common; import cn.hutool.core.bean.BeanUtil; import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.feign.CommonAggFeignClient; @@ -102,14 +103,17 @@ public class CustomerStaffRedis { * @param staffId */ public static Map getStaffRoleMap(String customerId, String staffId) { - String key = RedisKeys.getCustomerStaffInfoKey(customerId, staffId); - Map roleMap = (Map) customerStaffRedis.redisUtils.hGet(key, ROLE_MAP_KEY); - if (!CollectionUtils.isEmpty(roleMap)) { - return roleMap; - } - - reloadStaffCache(staffId, key); - return getStaffRoleMap(customerId, staffId); + int retryTime = 0; + do { + String key = RedisKeys.getCustomerStaffInfoKey(customerId, staffId); + Map roleMap = (Map) customerStaffRedis.redisUtils.hGet(key, ROLE_MAP_KEY); + if (!CollectionUtils.isEmpty(roleMap)) { + return roleMap; + } + retryTime++; + reloadStaffCache(staffId, key); + } while (retryTime < NumConstant.TWO); + return null; } /**