|  |  | @ -17,31 +17,72 @@ | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | package com.epmet.redis; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.redis.RedisKeys; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.redis.RedisUtils; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.GovMenuDTO; | 
			
		
	
		
			
				
					|  |  |  | import lombok.extern.slf4j.Slf4j; | 
			
		
	
		
			
				
					|  |  |  | import org.apache.commons.lang3.StringUtils; | 
			
		
	
		
			
				
					|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
			
		
	
		
			
				
					|  |  |  | import org.springframework.stereotype.Component; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | import java.util.List; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | /** | 
			
		
	
		
			
				
					|  |  |  |  * 客户菜单配置表 | 
			
		
	
		
			
				
					|  |  |  |  * | 
			
		
	
		
			
				
					|  |  |  |  * @author generator generator@elink-cn.com | 
			
		
	
		
			
				
					|  |  |  |  * @since v1.0.0 2021-03-16 | 
			
		
	
		
			
				
					|  |  |  |  */ | 
			
		
	
		
			
				
					|  |  |  | @Slf4j | 
			
		
	
		
			
				
					|  |  |  | @Component | 
			
		
	
		
			
				
					|  |  |  | public class GovCustomerMenuRedis { | 
			
		
	
		
			
				
					|  |  |  |     @Autowired | 
			
		
	
		
			
				
					|  |  |  |     private RedisUtils redisUtils; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     public void delete(Object[] ids) { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * desc:保存客户菜单缓存 | 
			
		
	
		
			
				
					|  |  |  |      * @param customerId | 
			
		
	
		
			
				
					|  |  |  |      * @param type | 
			
		
	
		
			
				
					|  |  |  |      * @see com.epmet.enums.MenuTypeEnum | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     public void setCustomerMenuList(String customerId, Integer type, List<GovMenuDTO> govMenuDTOS) { | 
			
		
	
		
			
				
					|  |  |  |         if (checkParam(customerId, type)) { | 
			
		
	
		
			
				
					|  |  |  |             String key = RedisKeys.getCustomerMenuList(customerId, type); | 
			
		
	
		
			
				
					|  |  |  |             redisUtils.set(key, govMenuDTOS, RedisUtils.DEFAULT_EXPIRE); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * desc:获取客户菜单缓存 | 
			
		
	
		
			
				
					|  |  |  |      * @param customerId | 
			
		
	
		
			
				
					|  |  |  |      * @param type | 
			
		
	
		
			
				
					|  |  |  |      * @see com.epmet.enums.MenuTypeEnum | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     public List<GovMenuDTO> getCustomerMenuList(String customerId, Integer type) { | 
			
		
	
		
			
				
					|  |  |  |         if (checkParam(customerId, type)) { | 
			
		
	
		
			
				
					|  |  |  |             String key = RedisKeys.getCustomerMenuList(customerId, type); | 
			
		
	
		
			
				
					|  |  |  |             return (List<GovMenuDTO>) redisUtils.get(key); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         return null; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     public void set(){ | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * desc:删除客户菜单缓存 | 
			
		
	
		
			
				
					|  |  |  |      * @param customerId | 
			
		
	
		
			
				
					|  |  |  |      * @param type | 
			
		
	
		
			
				
					|  |  |  |      * @see com.epmet.enums.MenuTypeEnum | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     public void delCustomerMenu(String customerId, Integer type) { | 
			
		
	
		
			
				
					|  |  |  |         if (checkParam(customerId, type)) { | 
			
		
	
		
			
				
					|  |  |  |             String key = RedisKeys.getCustomerMenuList(customerId, type); | 
			
		
	
		
			
				
					|  |  |  |             redisUtils.delete(key); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     public String get(String id){ | 
			
		
	
		
			
				
					|  |  |  |         return null; | 
			
		
	
		
			
				
					|  |  |  |     private boolean checkParam(String customerId, Integer type) { | 
			
		
	
		
			
				
					|  |  |  |         if (StringUtils.isBlank(customerId) || type == null){ | 
			
		
	
		
			
				
					|  |  |  |             log.warn("checkParam fail, param is null"); | 
			
		
	
		
			
				
					|  |  |  |             return false; | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         return true; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | } | 
			
		
	
		
			
				
					|  |  |  | } | 
			
		
	
	
		
			
				
					|  |  | 
 |