package com.friday.custody.service.trustService.cmsc.common;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;

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

/**
 * @Description
 * @Author wulifeng
 * @Date: 2022/2/16
 */
@Slf4j
public class CmscConstants {
    public static final String ENV_TEST = "TEST";
    public static final String ENV_TY = "TY";
    public static final String ENV_YC = "YC";
    public static final String TEST_PATH= "D:\\interfacePlatform\\taie-helson\\custody-data-provider\\src\\main\\resources\\cmsc";

    public static final String PROD_PATH = "D:\\interfacePlatform\\taie-helson\\custody-data-provider\\src\\main\\resources\\cmsc";




    public static final String TEST_URL = "http://210.21.237.135:27011/v1/request";
    public static final String PRD_URL = "https://tgjjapi.newone.com.cn/v1/request";

    //general
    public  String UAP_SERVER_TYPE ;
    public  String UAP_REQUEST_ID ;
    public  String URL;
    public  String COMPYID ;
    public  String UAP_LICENCE_KEY ;
    public  String UAP_USER_NO ;
    public  String UNZIP_CODE ;
    public  String PXF_FILE_PATH ;

    //通怡
    public static final String TY_COMPYID = "6a715957cfd842b19c18bfae1470d4c7";
    public static final String TY_UAP_LICENCE_KEY = "2155bab2-ad76-4721-929f-c6325d46b205";
    public static final String TY_UAP_USER_NO = "client_ShangHaiTongYiTouZi";
    public static final String TY_UNZIP_CODE = "shty123";
    public static final String TY_PXF_FILE_PATH = "/上海通怡投资管理有限公司.pfx";

    //一村
    public static final String YC_COMPYID = "20f45d0f27789868e055000000000001";
    public static final String YC_UAP_LICENCE_KEY = "2170f2aa-f86f-422f-910c-be87fa169fa8";
    public static final String YC_UAP_USER_NO = "client_ShangHaiYiCunTouZi";
    public static final String YC_UNZIP_CODE = "yctz123";
    public static final String YC_PXF_FILE_PATH = "/上海一村投资管理有限公司.pfx";

    //测试
    public static final String TEST_COMPYID = "b759a8a2afef4a2788c5050b4ac6d9f6";
    public static final String TEST_UAP_LICENCE_KEY = "dbb5b1ee-ab91-41fe-b9d3-47ceef6d4a30";
    public static final String TEST_UAP_USER_NO = "test001";
    public static final String TEST_UNZIP_CODE = "lxtz123";
    public static final String TEST_PXF_FILE_PATH = "/test.pfx";

    public  void setPropertyFromJson(String mapJson){
        Map map = JSONObject.toJavaObject(JSONObject.parseObject(mapJson), Map.class);
        log.info("setPropertyFromJson设置托管信息为{}",JSON.toJSONString(map));

        UAP_SERVER_TYPE =(String) map.get("uapServerType");
        URL =(String) map.get("url");
        UAP_REQUEST_ID =(String) map.get("uapRequestId");
        COMPYID =(String) map.get("compyid");
        UAP_LICENCE_KEY =(String) map.get("uapLicenceKey");
        UAP_USER_NO =(String) map.get("uapUserNo");
        UNZIP_CODE =(String) map.get("unzipCode");
        PXF_FILE_PATH =(String) map.get("pxfFilePath");
    }

    public static void main(String[] args) throws InterruptedException {
        HashMap<String,String> map = new HashMap<>();
        //测试
        map.put("uapServerType","668");
        map.put("uapRequestId","20211109000001");
        map.put("url","http://210.21.237.135:27011/v1/request");
        map.put("compyid","b759a8a2afef4a2788c5050b4ac6d9f6");
        map.put("uapLicenceKey","dbb5b1ee-ab91-41fe-b9d3-47ceef6d4a30");
        map.put("uapUserNo","test001");
        map.put("unzipCode","lxtz123");
        map.put("pxfFilePath","/test.pfx");

        //通怡
//        map.put("uapServerType","668");
//        map.put("uapRequestId","20211109000001");
//        map.put("url","https://tgjjapi.newone.com.cn/v1/request");
//        map.put("compyid","6a715957cfd842b19c18bfae1470d4c7");
//        map.put("uapLicenceKey","2155bab2-ad76-4721-929f-c6325d46b205");
//        map.put("uapUserNo","client_ShangHaiTongYiTouZi");
//        map.put("unzipCode","shty123");
//        map.put("pxfFilePath","/上海通怡投资管理有限公司.pfx");

        //一村
//        map.put("uapServerType","668");
//        map.put("uapRequestId","20211109000001");
//        map.put("url","https://tgjjapi.newone.com.cn/v1/request");
//        map.put("compyid","20f45d0f27789868e055000000000001");
//        map.put("uapLicenceKey","2170f2aa-f86f-422f-910c-be87fa169fa8");
//        map.put("uapUserNo","client_ShangHaiYiCunTouZi");
//        map.put("unzipCode","yctz123");
//        map.put("pxfFilePath","/上海一村投资管理有限公司.pfx");

        String s = JSON.toJSONString(map);
        System.out.println(s);
        Map map1 = JSON.parseObject(s, Map.class);
        System.out.println(JSON.toJSONString(map1));
    }
}
