5 changed files with 105 additions and 5 deletions
			
			
		| @ -0,0 +1,39 @@ | |||||
|  | package com.epmet.datareport.redis; | ||||
|  | 
 | ||||
|  | import cn.hutool.core.bean.BeanUtil; | ||||
|  | import cn.hutool.core.map.MapUtil; | ||||
|  | import com.epmet.commons.tools.redis.RedisUtils; | ||||
|  | import com.epmet.dto.result.AgencyDetailMulticResultDTO; | ||||
|  | import org.springframework.beans.factory.annotation.Autowired; | ||||
|  | import org.springframework.stereotype.Component; | ||||
|  | 
 | ||||
|  | import java.util.Map; | ||||
|  | 
 | ||||
|  | /** | ||||
|  |  * 描述一下 | ||||
|  |  * | ||||
|  |  * @author yinzuomei@elink-cn.com | ||||
|  |  * @date 2021/6/29 15:46 | ||||
|  |  */ | ||||
|  | @Component | ||||
|  | public class DataReportRedis { | ||||
|  |     @Autowired | ||||
|  |     private RedisUtils redisUtils; | ||||
|  |     private String agencyDetailKeyPrefix="epmet:screen:"; | ||||
|  | 
 | ||||
|  |     public AgencyDetailMulticResultDTO queryAgencyDetailMulticResultDTO(String customerId, String agencyId) { | ||||
|  |         String agencyDetailKey=agencyDetailKeyPrefix.concat(customerId).concat(":").concat(agencyId); | ||||
|  |         Map<String, Object> map = redisUtils.hGetAll(agencyDetailKey); | ||||
|  |         if (MapUtil.isEmpty(map)) { | ||||
|  |             return null; | ||||
|  |         } | ||||
|  |         AgencyDetailMulticResultDTO dto = BeanUtil.mapToBean(map, AgencyDetailMulticResultDTO.class, true); | ||||
|  |         return dto; | ||||
|  |     } | ||||
|  | 
 | ||||
|  |     public void setAgencyDetailMulticResultDTO(String customerId, String agencyId, AgencyDetailMulticResultDTO agencysResultDTO) { | ||||
|  |         String agencyDetailKey = agencyDetailKeyPrefix.concat(customerId).concat(":").concat(agencyId); | ||||
|  |         Map<String, Object> map = BeanUtil.beanToMap(agencysResultDTO); | ||||
|  |         redisUtils.hMSet(agencyDetailKey, map, RedisUtils.DEFAULT_EXPIRE); | ||||
|  |     } | ||||
|  | } | ||||
					Loading…
					
					
				
		Reference in new issue