|
|
@ -38,14 +38,15 @@ public class CustomerStaffRedis { |
|
|
|
private static final String ROLE_MAP_KEY = "roleMap"; |
|
|
|
|
|
|
|
@PostConstruct |
|
|
|
public void init(){ |
|
|
|
public void init() { |
|
|
|
customerStaffRedis = this; |
|
|
|
customerStaffRedis.redisUtils = this.redisUtils; |
|
|
|
customerStaffRedis.commonAggFeignClient = this.commonAggFeignClient; |
|
|
|
} |
|
|
|
|
|
|
|
public static void initTest() { |
|
|
|
CustomerStaffInfoCacheResult role = getStaffInfo("45687aa479955f9d06204d415238f7cc", "9e37adcce6472152e6508a19d3683e02"); |
|
|
|
role = getStaffInfo("45687aa479955f9d06204d415238f7cc", "e08316376c972b5cb3f085bb39a3680f"); |
|
|
|
role = getStaffInfo("45687aa479955f9d06204d415238f7cc", "e08316376c972b5cb3f085bb39a3680f"); |
|
|
|
System.out.println(JSON.toJSONString(role)); |
|
|
|
role = getStaffInfo("45687aa479955f9d06204d415238f7cc", "ec524bbbc41d0662cbb36236161005e9"); |
|
|
|
System.out.println(JSON.toJSONString(role)); |
|
|
@ -66,7 +67,7 @@ public class CustomerStaffRedis { |
|
|
|
String key = RedisKeys.getCustomerStaffInfoKey(customerId, staffId); |
|
|
|
Map<String, Object> roleMap = customerStaffRedis.redisUtils.hGetAll(key); |
|
|
|
if (!CollectionUtils.isEmpty(roleMap)) { |
|
|
|
return ConvertUtils.mapToEntity(roleMap, CustomerStaffInfoCacheResult.class); |
|
|
|
return ConvertUtils.mapToEntity(roleMap, CustomerStaffInfoCacheResult.class); |
|
|
|
} |
|
|
|
|
|
|
|
CustomerStaffInfoCache resultData = reloadStaffCache(staffId, key); |
|
|
@ -74,7 +75,7 @@ public class CustomerStaffRedis { |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
return ConvertUtils.sourceToTarget(resultData,CustomerStaffInfoCacheResult.class); |
|
|
|
return ConvertUtils.sourceToTarget(resultData, CustomerStaffInfoCacheResult.class); |
|
|
|
} |
|
|
|
|
|
|
|
@Nullable |
|
|
@ -99,20 +100,16 @@ public class CustomerStaffRedis { |
|
|
|
* |
|
|
|
* @param customerId |
|
|
|
* @param staffId |
|
|
|
* @return com.epmet.commons.tools.redis.common.bean.CustomerStaffInfoCache |
|
|
|
* @author LiuJanJun |
|
|
|
* @date 2021/8/19 10:29 下午 |
|
|
|
* @remark 此方法仅用于 获取某个工作人员的信息,不用于获取客户下所有工作人员信息 |
|
|
|
*/ |
|
|
|
public static Map<String,String> getStaffRoleMap(String customerId, String staffId) { |
|
|
|
public static Map<String, String> getStaffRoleMap(String customerId, String staffId) { |
|
|
|
String key = RedisKeys.getCustomerStaffInfoKey(customerId, staffId); |
|
|
|
Map<String, String> roleMap = (Map<String, String>) customerStaffRedis.redisUtils.hGet(key,ROLE_MAP_KEY); |
|
|
|
Map<String, String> roleMap = (Map<String, String>) customerStaffRedis.redisUtils.hGet(key, ROLE_MAP_KEY); |
|
|
|
if (!CollectionUtils.isEmpty(roleMap)) { |
|
|
|
return roleMap; |
|
|
|
return roleMap; |
|
|
|
} |
|
|
|
|
|
|
|
reloadStaffCache(staffId, key); |
|
|
|
return getStaffRoleMap(customerId,staffId); |
|
|
|
return getStaffRoleMap(customerId, staffId); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|