package com.ruoyi.demo.utils;


import com.ruoyi.demo.constant.RedisInitContant;
import com.ruoyi.demo.entity.ManageType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.concurrent.*;

@Component
public class InitMapUtil {
    @Autowired
    RedisTemplate redisTemplate;

    public String getInitCityTierMap(String addrCode){
        //redis -> hash(addrCode,城市等级)
        return (String) redisTemplate.boundHashOps(RedisInitContant.INIT_CITY_TIER_MAP).get(addrCode.substring(0,4));
    }

    public List<String> getInitCityTierListMap(String cityTier){
        return (List<String>) redisTemplate.boundHashOps(RedisInitContant.INIT_CITY_TIER_LIST_MAP).get(cityTier);
    }

    public ManageType getInitManageType(String manageTypeCode){
        return (ManageType) redisTemplate.boundHashOps(RedisInitContant.INIT_MANAGE_TYPE).get(manageTypeCode);
    }

    public String getInitAddrCodeMap(String addrCode){
        return (String) redisTemplate.boundHashOps(RedisInitContant.INIT_ADDR_CODE_MAP).get(addrCode);
    }

    public String getInitTypeByMap(String typeCodeBy){
        return (String) redisTemplate.boundHashOps(RedisInitContant.INIT_TYPE_BY_MAP).get(typeCodeBy);
    }

}
