/*
package com.njcn.prepare.harmonic.constant;

import com.njcn.redis.utils.RedisUtil;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.pojo.po.DictData;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import java.util.List;
import java.util.Set;

*/
/**
 * Description:
 * 接口文档访问地址：http://serverIP:port/swagger-ui.html
 * Date: 2022/11/25  16:21【需求编号】
 *
 * @author clam
 * @version V1.0.0
 *//*


@Component
@Slf4j
public class DictCache {

    public static final String NAME_KEY = "DicCache:";
    public static final String SPLIT_SIGN = "-";

    private @Autowired
    DicDataFeignClient dicDataFeignClient;

    private @Autowired
    RedisUtil redisUtil;
    private @Autowired
    RedisTemplate<String, Object> redisTemplate;

    @PostConstruct
    public void init(){
        log.info("系统启动中。。。加载dictDataMap");
        */
/*todo 后续将字典表全部加载*//*

        List<DictData> data = dicDataFeignClient.getDicDataByTypeCode (DicDataTypeEnum.LINE_STATE.getCode ( )).getData ( );
        List<DictData> data2 = dicDataFeignClient.getDicDataByTypeCode (DicDataTypeEnum.DEV_STATUS.getCode ( )).getData ( );
        List<DictData> data3 = dicDataFeignClient.getDicDataByTypeCode (DicDataTypeEnum.LINE_SORT.getCode ( )).getData ( );

        */
/*
        * key:NAME_KEY前缀（清缓存使用）+SPLIT_SIGN（拼接符号）+DicDataTypeEnum+SPLIT_SIGN（拼接符号）+Code
        * Value:id
        * *//*

        data.forEach (temp->{
            redisUtil.saveByKey (NAME_KEY+SPLIT_SIGN+DicDataTypeEnum.LINE_STATE.getCode ( )+SPLIT_SIGN+temp.getCode (),temp.getId ());
        });

        data2.forEach (temp->{
            redisUtil.saveByKey (NAME_KEY+SPLIT_SIGN+DicDataTypeEnum.DEV_STATUS.getCode ( )+SPLIT_SIGN+temp.getCode (),temp.getId ());
        });

        data3.forEach (temp->{
            redisUtil.saveByKey (NAME_KEY+SPLIT_SIGN+DicDataTypeEnum.LINE_SORT.getCode ( )+SPLIT_SIGN+temp.getCode (),temp.getId ());
        });


    }

    @PreDestroy
    public void destroy(){
        log.info("系统运行结束");
        Set<String> keys = redisTemplate.keys(NAME_KEY + "*");

        redisTemplate.delete(keys);

    }

}
*/
