package com.hzya.frame.plugin.lets.constant;

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

/**
 * lets全局静态参数配置
 */
public class OverallConstant {

    private static final Map<String, String> devOverAll = new HashMap<>();

    private static final Map<String, String> testOverAll = new HashMap<>();

    private static final Map<String, String> prodOverAll = new HashMap<>();

    private static final Map<String, String> prodOverPublic = new HashMap<>();

    static {
        //dev
        loadDev();
        //prod
        loadProd();
        //公共部分
        loadPublic();
    }

    private static void loadPublic() {
        //存货分类
        prodOverPublic.put("bdinvSaveCode", "8000370025");//存货分类新增
        prodOverPublic.put("bdinvUpdateCode", "8000370026");//存货分类修改
        prodOverPublic.put("bdinvDeleteCode", "8000370027");//存货分类删除
        //存货基本档案
        prodOverPublic.put("bdinvclSaveCode", "8000370002");//存货基本档案新增
        prodOverPublic.put("bdinvclUpdateCode", "8000370046");//存货基本档案修改
        prodOverPublic.put("bdinvclSealCode", "8000370058");//存货基本档案封存
        prodOverPublic.put("bdinvclUnsealCode", "8000370059");//存货基本档案取消封存
        prodOverPublic.put("bdinvclAllotCode", "8000370003");//存货基本档案自动分配
        //成套件
        prodOverPublic.put("setpartInsertCode", "8000370063");//成套件新增
        prodOverPublic.put("setpartDeleteCode", "8000370064");//成套件删除
        prodOverPublic.put("setpartQueryCode", "8000370065");//成套件查询
        //组装拆卸
        prodOverPublic.put("special4lSaveCode", "8000370066");//成套件查询


        //调拨
        prodOverPublic.put("approveqzCode", "8000370009");//调拨订单保存即审批
        prodOverPublic.put("approveInqzCode", "8000370054");//调拨入库保存并签字

        //其他出入库
        prodOverPublic.put("otherinqzCode", "8000370007");//库存其他入库保存即签字
        prodOverPublic.put("otheroutqzCode", "8000370008");//库存其他出库保存即签字

        prodOverPublic.put("otheroutsignCode", "8000370067");//库存其他出库即签字
        prodOverPublic.put("otherinsignCode", "8000370068");//库存其他入库即签字

        prodOverPublic.put("custdocSaveCode", "8000370062");//客商档案新增
        prodOverPublic.put("custdocSave", "/u8cloud/api/uapbd/custdoc/insert");//客商档案新增
        prodOverPublic.put("custdocQuery", "/u8cloud/api/uapbd/custdoc/query");//客商档案查询
        prodOverPublic.put("custdocUpdate", "/u8cloud/api/uapbd/custdoc/update");//客商档案修改
        prodOverPublic.put("custdocAssignCode", "8000370001");//客商档案分配
        prodOverPublic.put("custdocAssign", "/u8cloud/api/uapbd/custdoc/assign");//客商档案分配
        prodOverPublic.put("custmandocSave", "/u8cloud/api/uapbd/custmandoc/insert");//客商档案新增
        prodOverPublic.put("bdcorpQueryCode", "8000370060");//公司档案查询
        prodOverPublic.put("bdcorpQuery", "/u8cloud/api/uapbd/bdcorp/query");//公司档案查询
        prodOverPublic.put("bddefdoclistsaveCode", "8000370061");//自定义档案内容查询
        prodOverPublic.put("bddefdoclistsave", "/u8cloud/api/uapbd/bddefdoc/insert");//自定义档案内容查询

        prodOverPublic.put("appId", "800037");//数智中台
        prodOverPublic.put("publicKey", "ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj");//数智中台
        prodOverPublic.put("secretKey", "fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=");//数智中台
    }

    private static void loadDev() {
        devOverAll.put("u8cApiUrl", "http://39.170.109.90:9099");//测试U8C

        devOverAll.put("u8cApiUsercodePK", "admin");
        devOverAll.put("u8cApiPasswordPK", "83f1ad3e7fa3617f1aae62ae7413c810");
        devOverAll.put("u8cApiTrantypePK", "pk");
        devOverAll.put("u8cApiSystemPK", "lz");
        devOverAll.put("u8cApiNeedStackTracePK", "Y");
        devOverAll.put("u8cApiZdrPK", "TB_NEW100000000004OP");//单据制单人---测试环境：tbadmin

        devOverAll.put("u8cApiUsercodeCode", "admin1");
        devOverAll.put("u8cApiPasswordCode", "83f1ad3e7fa3617f1aae62ae7413c810");
        devOverAll.put("u8cApiTrantypeCode", "code");
        devOverAll.put("u8cApiSystemCode", "lz1");
        devOverAll.put("u8cApiNeedStackTraceCode", "Y");
        devOverAll.put("u8cApiZdrCode", "tbadmin");//单据制单人---测试环境：tbadmin

        devOverAll.put("u8c自定义项档案-店铺主键", "0001A110000000000EBX");
        devOverAll.put("u8c自定义项档案-平台主键", "0001A110000000000EEU");

        //中台地址
        devOverAll.put("u8c_url", "http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface");
    }

    private static void loadProd() {
        prodOverAll.put("u8cApiUrl", "http://192.168.10.118:9099");//测试U8C

        //主键
        prodOverAll.put("u8cApiUsercodePK", "admin");
        prodOverAll.put("u8cApiPasswordPK", "83f1ad3e7fa3617f1aae62ae7413c810");
        prodOverAll.put("u8cApiTrantypePK", "pk");
        prodOverAll.put("u8cApiSystemPK", "lz");
        prodOverAll.put("u8cApiNeedStackTracePK", "N");
        prodOverAll.put("u8cApiZdrPK", "TB_NEW100000000004OP");//单据制单人---测试环境：tbadmin

        //编码
        prodOverAll.put("u8cApiUsercodeCode", "admin1");
        prodOverAll.put("u8cApiPasswordCode", "83f1ad3e7fa3617f1aae62ae7413c810");
        prodOverAll.put("u8cApiTrantypeCode", "code");
        prodOverAll.put("u8cApiSystemCode", "lz1");
        prodOverAll.put("u8cApiNeedStackTraceCode", "N");
        prodOverAll.put("u8cApiZdrCode", "tbadmin");//单据制单人---测试环境：tbadmin

        prodOverAll.put("u8c自定义项档案-店铺主键", "0001A110000000000EBX");
        prodOverAll.put("u8c自定义项档案-平台主键", "0001A110000000000EEU");

        //中台地址
        prodOverAll.put("u8c_url", "http://127.0.0.1:8081/kangarooDataCenterV3/entranceController/externalCallInterface");
    }

    /**
     * 根据key获取全局变量值
     *
     * @param key key值
     * @return 返回String
     */
    public static String getOverAllValue(String key) {
        String value = null;
        if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals("dev")) {
            value = devOverAll.get(key);
        } else if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals("test")) {
            value = testOverAll.get(key);
        } else if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals("prod")) {
            value = prodOverAll.get(key);
        }
        if (value == null) {
            value = prodOverPublic.get(key);
        }
        return value;
    }
}
