| 
						
						
							
								
							
						
						
					 | 
					@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.springframework.stereotype.Component; | 
					 | 
					 | 
					import org.springframework.stereotype.Component; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.springframework.util.CollectionUtils; | 
					 | 
					 | 
					import org.springframework.util.CollectionUtils; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import javax.annotation.PostConstruct; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import java.util.Map; | 
					 | 
					 | 
					import java.util.Map; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					/** | 
					 | 
					 | 
					/** | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -32,14 +33,24 @@ public class CustomerStaffRedis { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    private RedisUtils redisUtils; | 
					 | 
					 | 
					    private RedisUtils redisUtils; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Autowired | 
					 | 
					 | 
					    @Autowired | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    private CommonAggFeignClient commonAggFeignClient; | 
					 | 
					 | 
					    private CommonAggFeignClient commonAggFeignClient; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    private static CustomerStaffRedis customerStaffRedis; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    private static final String ROLE_MAP_KEY = "roleMap"; | 
					 | 
					 | 
					    private static final String ROLE_MAP_KEY = "roleMap"; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					    //@PostConstruct
 | 
					 | 
					 | 
					    @PostConstruct | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					    public void init() { | 
					 | 
					 | 
					    public void init() { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        CustomerStaffInfoCacheResult role = this.getStaffInfo("45687aa479955f9d06204d415238f7cc", "9e37adcce6472152e6508a19d3683e02"); | 
					 | 
					 | 
					        customerStaffRedis = this; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					         role = this.getStaffInfo("45687aa479955f9d06204d415238f7cc", "7f694a66efe60a47c2114875f310248a"); | 
					 | 
					 | 
					        customerStaffRedis.redisUtils = this.redisUtils; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        customerStaffRedis.commonAggFeignClient = this.commonAggFeignClient; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    public static void initTest() { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        CustomerStaffInfoCacheResult role = getStaffInfo("45687aa479955f9d06204d415238f7cc", "9e37adcce6472152e6508a19d3683e02"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        role = getStaffInfo("45687aa479955f9d06204d415238f7cc", "e08316376c972b5cb3f085bb39a3680f"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        System.out.println(JSON.toJSONString(role)); | 
					 | 
					 | 
					        System.out.println(JSON.toJSONString(role)); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        System.out.println(JSON.toJSONString(this.getStaffRoleMap("45687aa479955f9d06204d415238f7cc", "7f694a66efe60a47c2114875f310248a"))); | 
					 | 
					 | 
					        role = getStaffInfo("45687aa479955f9d06204d415238f7cc", "ec524bbbc41d0662cbb36236161005e9"); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        System.out.println(JSON.toJSONString(role)); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        System.out.println(JSON.toJSONString(getStaffRoleMap("45687aa479955f9d06204d415238f7cc", "7f694a66efe60a47c2114875f310248a"))); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    /** | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -52,22 +63,24 @@ public class CustomerStaffRedis { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @date 2021/8/19 10:29 下午 | 
					 | 
					 | 
					     * @date 2021/8/19 10:29 下午 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @remark 此方法仅用于 获取某个工作人员的信息,不用于获取客户下所有工作人员信息 | 
					 | 
					 | 
					     * @remark 此方法仅用于 获取某个工作人员的信息,不用于获取客户下所有工作人员信息 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     */ | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					    public CustomerStaffInfoCacheResult getStaffInfo(String customerId, String staffId) { | 
					 | 
					 | 
					    public static CustomerStaffInfoCacheResult getStaffInfo(String customerId, String staffId) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        String key = RedisKeys.getCustomerStaffInfoKey(customerId, staffId); | 
					 | 
					 | 
					        String key = RedisKeys.getCustomerStaffInfoKey(customerId, staffId); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        Map<String, Object> roleMap = redisUtils.hGetAll(key); | 
					 | 
					 | 
					        Map<String, Object> roleMap = customerStaffRedis.redisUtils.hGetAll(key); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        if (!CollectionUtils.isEmpty(roleMap)) { | 
					 | 
					 | 
					        if (!CollectionUtils.isEmpty(roleMap)) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            return ConvertUtils.mapToEntity(roleMap, CustomerStaffInfoCacheResult.class); | 
					 | 
					 | 
					            return ConvertUtils.mapToEntity(roleMap, CustomerStaffInfoCacheResult.class); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        CustomerStaffInfoCache resultData = reloadStaffCache(staffId, key); | 
					 | 
					 | 
					        CustomerStaffInfoCache resultData = reloadStaffCache(staffId, key); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        if (resultData == null) return null; | 
					 | 
					 | 
					        if (resultData == null) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            return null; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        return ConvertUtils.sourceToTarget(resultData, CustomerStaffInfoCacheResult.class); | 
					 | 
					 | 
					        return ConvertUtils.sourceToTarget(resultData, CustomerStaffInfoCacheResult.class); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Nullable | 
					 | 
					 | 
					    @Nullable | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					    private CustomerStaffInfoCache reloadStaffCache(String staffId, String key) { | 
					 | 
					 | 
					    private static CustomerStaffInfoCache reloadStaffCache(String staffId, String key) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        Result<CustomerStaffInfoCache> staffResult = commonAggFeignClient.getStaffInfo(staffId); | 
					 | 
					 | 
					        Result<CustomerStaffInfoCache> staffResult = customerStaffRedis.commonAggFeignClient.getStaffInfo(staffId); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        if (staffResult == null || !staffResult.success()) { | 
					 | 
					 | 
					        if (staffResult == null || !staffResult.success()) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            throw new RenException("获取工作人员信息失败"); | 
					 | 
					 | 
					            throw new RenException("获取工作人员信息失败"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -78,7 +91,7 @@ public class CustomerStaffRedis { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        Map<String, Object> map = BeanUtil.beanToMap(resultData, false, true); | 
					 | 
					 | 
					        Map<String, Object> map = BeanUtil.beanToMap(resultData, false, true); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        redisUtils.hMSet(key, map); | 
					 | 
					 | 
					        customerStaffRedis.redisUtils.hMSet(key, map); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        return resultData; | 
					 | 
					 | 
					        return resultData; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -87,14 +100,10 @@ public class CustomerStaffRedis { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * | 
					 | 
					 | 
					     * | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @param customerId | 
					 | 
					 | 
					     * @param customerId | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @param staffId | 
					 | 
					 | 
					     * @param staffId | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @return com.epmet.commons.tools.redis.common.bean.CustomerStaffInfoCache | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @author LiuJanJun | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @date 2021/8/19 10:29 下午 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @remark 此方法仅用于 获取某个工作人员的信息,不用于获取客户下所有工作人员信息 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     */ | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					    public Map<String,String> getStaffRoleMap(String customerId, String staffId) { | 
					 | 
					 | 
					    public static Map<String, String> getStaffRoleMap(String customerId, String staffId) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        String key = RedisKeys.getCustomerStaffInfoKey(customerId, staffId); | 
					 | 
					 | 
					        String key = RedisKeys.getCustomerStaffInfoKey(customerId, staffId); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        Map<String, String> roleMap = (Map<String, String>) redisUtils.hGet(key,ROLE_MAP_KEY); | 
					 | 
					 | 
					        Map<String, String> roleMap = (Map<String, String>) customerStaffRedis.redisUtils.hGet(key, ROLE_MAP_KEY); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        if (!CollectionUtils.isEmpty(roleMap)) { | 
					 | 
					 | 
					        if (!CollectionUtils.isEmpty(roleMap)) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            return roleMap; | 
					 | 
					 | 
					            return roleMap; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -112,13 +121,13 @@ public class CustomerStaffRedis { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @author LiuJanJun | 
					 | 
					 | 
					     * @author LiuJanJun | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @date 2021/8/19 10:39 下午 | 
					 | 
					 | 
					     * @date 2021/8/19 10:39 下午 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     */ | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					    public boolean delStaffInfoFormCache(String customerId, String staffId) { | 
					 | 
					 | 
					    public static Boolean delStaffInfoFormCache(String customerId, String staffId) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        if (StringUtils.isBlank(customerId) || StringUtils.isBlank(staffId)) { | 
					 | 
					 | 
					        if (StringUtils.isBlank(customerId) || StringUtils.isBlank(staffId)) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            log.warn("delStaffInfoFormCache param is blank,customerId:{},staffId:{}", customerId, staffId); | 
					 | 
					 | 
					            log.warn("delStaffInfoFormCache param is blank,customerId:{},staffId:{}", customerId, staffId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            return false; | 
					 | 
					 | 
					            return false; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        String key = RedisKeys.getCustomerStaffInfoKey(customerId, staffId); | 
					 | 
					 | 
					        String key = RedisKeys.getCustomerStaffInfoKey(customerId, staffId); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        return redisUtils.delete(key); | 
					 | 
					 | 
					        return customerStaffRedis.redisUtils.delete(key); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					} | 
					 | 
					 | 
					} | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
					 | 
					
  |