package com.rrtx.services.common.constant;

import cn.hutool.core.util.StrUtil;

/**
 * @projectName: services
 * @package: com.rrtx.services.common.constant
 * @className: Constant
 * @description:
 * @author: Jie Zhang
 * @createDate: 2019/12/3 9:31
 */
public class Constant {

    // 总条数
    public static final String MAX_ROWNUMS = "maxRowNums";

    // 排序规则：降序
    public static final String ORDER_DESC = "desc";
    // 排序规则：升序
    public static final String ORDER_ASC = "asc";

    // 前端页面路径前缀
    public static final String VIEW_PREFIX = "fap/views/";

    // 验证码 Session Key
    public static final String CODE_PREFIX = "fap_captcha_";

    // 允许下载的文件类型，根据需求自己添加（小写）
    public static final String[] VALID_FILE_TYPE = {"xlsx", "zip"};

    public static final String APP_MENU_REDIS_PREFIX_KEY = "ebk_log_";

    /**
     * 命名空间
     */
    public static final String NAMESPACE = "wfk";

    public static final String LANGUAGE_ZH = "zh";

    public static final String LANGUAGE_EN = "en";

    public static final String LANGUAGE_ZH_CN = "ZH_CN";

    public final static String DEFAULT_ERROR_MSG = "System Error";

    public static String redisKey4Menu(String code){
        return NAMESPACE + StrUtil.COLON
                + "menu" + StrUtil.COLON
                + code;
    }

    public static String redisKey4Field(String key){
        return NAMESPACE + StrUtil.COLON
                + "filed" + StrUtil.COLON
                + key;
    }

    /**
     * 拼接RedisKey
     * @param dictCode
     * @param type
     * @param dictLang
     * @return
     */
    public static String concatRedisKey(String dictCode, String type, String dictLang) {
        return NAMESPACE + StrUtil.COLON
                + type + StrUtil.COLON
                + dictCode + StrUtil.COLON
                + dictLang;

    }
}
