package com.rrtx.services;

import com.rrtx.services.common.constant.HostConstant;
import com.rrtx.services.common.hostenv.HostCipherEnvelope;
import com.rrtx.services.common.http.HostSendMsg;
import com.rrtx.services.common.http.HttpClientUtilsExt;
import com.rrtx.services.common.utils.CommonUtil;
import com.rrtx.services.common.utils.DateUtil;
import org.apache.commons.lang.StringUtils;
import org.springframework.util.ClassUtils;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

public class TestMain {

    public static void main(String[] args) throws IOException {

        System.out.println(CommonUtil.formatCurrency("123.226"));
//        String str = "10101";
//        for(int i = 0; i < 5; i++) {
//            System.out.println(StringUtils.substring(str, i, i+1));
//        }


//        System.out.println(DateUtil.formatDate("20191219091122", DateUtil.FULL_TIME_SPLIT_PATTERN));
//        String jsonStr = "{code:123,MINView:\"JSON\"}";
//
//        String miwen = HostCipherEnvelope.enCode("F:\\temp\\publicKey.keystore", jsonStr);
//        System.out.println("加密后报文：" + miwen);
//        String jiemihou = HostCipherEnvelope.deCode("F:\\temp\\privateKey.keystore",
//                "", "BOA_BANK", miwen);
//
//        System.out.println("解密后：" + jiemihou);
//        Map<String, String> map = new HashMap<String, String>();
//        map.put("key", "login2");
//        HttpClientUtilsExt.postReturnBodyAsString("http://www.baidu.com", map, "utf-8");
        // 自定义短信
//        String backStr = HostSendMsg.sendMsg(HostConstant.SMS_SEND, "{\"mobilePhoneNumber\":\"8618654574122\"" +
//                ",\"msgContext\":\"ceshiduanxin\"" +
//                ",\"language\":\"zh_CN\"}");
        // 状态查询
//        String backStr2 = HostSendMsg.sendMsg(HostConstant.ORDER_STT_QUERY, "{\"orderNo\":\"F279659266401370112\"}");
        // 汇率
//        String backStr2 = HostSendMsg.sendMsg(HostConstant.EX_AMOUNT_TRANS, "{\"amount\":\"123\"" +
//                ",\"firstCurrency\":\"USD\"" +
//                ",\"secondCurrency\":\"CNY\"}");
        // 月结单查询
//        String backStr2 = HostSendMsg.sendMsg(HostConstant.QUERY_STATEMENT, "{\"electronicCardNo\":\"03000014\",\n" +
//                "\t\t\"stateMentPdfList\":[{\n" +
//                "            \"year\":\"2019\",\n" +
//                "\"month\":\"11\"\n" +
//                "\t\t}]\n}");

        // 3.9 交易通知查询
//        String backStr2 = HostSendMsg.sendMsg(HostConstant.QUERY_TX_ADVICE, "{\"electronicCardNo\":\"0010404671578181378048\",\n" +
//                ",\"txnDateBegin\":\"2019-11-10\"" +
//                ",\"txnDateEnd\":\"2019-11-23\"}");


//        System.out.println(backStr2);
//        System.out.println(CommonUtil.maskMobile("186123456789"));
//        System.out.println(CommonUtil.maskMobile("18612345678"));
//        System.out.println(CommonUtil.maskMobile("1861234567"));
//        System.out.println(CommonUtil.maskMobile("18612345"));
//        System.out.println(CommonUtil.maskMobile("1861234"));
//        System.out.println(CommonUtil.maskMobile("18612"));
    }
}

