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