From f67f1ea1f66b40a0d4205a29f83872e80a04cb58 Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 20 Aug 2021 17:39:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../redis/common/CustomerStaffRedis.java | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) 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 97e545f98f..831d2f177d 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 @@ -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 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 getStaffRoleMap(String customerId, String 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); + Map roleMap = (Map) 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); } /**