package org.jeecg.common.constant;

import org.jeecg.common.util.JsonResourceUtil;

import java.util.HashMap;
import java.util.Map;

/**
 *  Created by JQ.bi on 2020.5.30
 */
public class AccountReportConstants {

    /**
     * 私有构造器
     */
    private AccountReportConstants(){

    }

    /** 单体实例 */
    private static AccountReportConstants instance;

    /**
     * @return 返回 instance
     */
    public static AccountReportConstants getInstance() {
        if (instance == null) {
            instance = new AccountReportConstants();
        }
        return instance;
    }

    /**
     * 字典数据
     */
    //头条字段映射
    public static Map<String, Map<String,Object>> dicMapBy = new HashMap<>();
    //快手字段映射
    public static Map<String, Map<String,Object>> dicMapKs = new HashMap<>();
    //头条视频报表字段映射
    public static Map<String, Map<String,Object>> dicMapByVideo= new HashMap<>();
    /**
     * 初始化字典
     */
    public void init(){
        //加载json文件
        Object jsonBy=JsonResourceUtil.getJsonObjFromResource("/json_template/bytedance_filed_mapping.json");
        Object jsonKs=JsonResourceUtil.getJsonObjFromResource("/json_template/kuaishou_filed_mapping.json");
        Object jsonByVideo=JsonResourceUtil.getJsonObjFromResource("/json_template/bytedance_video_report_mapping.json");
        //json 转为map存为静态常量
        dicMapBy=JsonResourceUtil.jsonToMap(jsonBy);
        dicMapKs=JsonResourceUtil.jsonToMap(jsonKs);
        dicMapByVideo=JsonResourceUtil.jsonToMap(jsonByVideo);
    }
}
