package com.jkcredit.invoice;

import net.sf.json.JSONObject;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.methods.PostMethod;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Iterator;

/**
 * Created by zhangqingxin Date : 16/11/6 Time : 10:41
 * <p/>
 * 参考一(HttpClient)：http://mvnrepository.com/artifact/commons-httpclient/commons-
 * httpclient/3.1
 * 参考一(json-lib)：http://mvnrepository.com/artifact/net.sf.json-lib/json-lib/2.4
 */
public class QueryDemo_Test1 {

	/**
	 * 测试地址
	 */
          private static final String URL = "http://etc.jkcredit.com:9999/api/rest";

	 	//private static final String URL = "http://110.88.150.74:80/credit?api=credit.sec.data_test";
	  	//private static final String URL = "http://110.88.150.74/credit?api=credit.sec.data";
		//private static final String URL = "http://123.57.186.204/gateway?api=credit.sec.data_test";
		//private static final String URL = "http://123.57.186.204/gateway?api=credit.sec.data";
	//	private static final String URL = "http://www1.h11.site/gateway?api=credit.sec.data";
	//	private static final String URL = "http://110.88.150.68:8000/gateway?api=credit.sec.data";
		//private static final String URL = "http://60.205.114.163:8000/gateway?api=credit.sec.data";
	 	//private static final String URL = " http://45.126.120.88/gateway?api=credit.sec.data";
		//private static final String URL = "http://119.18.195.163/gateway?api=credit.sec.data";

	/**
	 * 分配的appKey
	 */
	 	//private static final String appKey = "junxin_test";
	
		private static final String appKey = "dzka";
	 	//private static final String appKey = "ccx";

	/**
	 * 方法入口
	 *
	 * @param args
	 */
	public static void main(String args[]) throws Exception {
		   QueryDemo_Test1 demo = new QueryDemo_Test1();
		demo.runMainService();
	}

	/**
	 * 调用主接口
	 */
	public void runMainService() {
		try {
			/**
			 * 实名demo
			 */
			String [] nums = {
					"33012205230200043866"
			};
			for(int i=0;i<nums.length;i++){
//				JSONObject paramJsonObj202109 = initParamJsonObj_Realname202109(nums[i]);
//				String ret202109 = postClient(URL, paramJsonObj202109);
//				System.out.println(ret202109);
//
//
//				JSONObject paramJsonObj202110 = initParamJsonObj_Realname202110(nums[i]);
//				String ret202110 = postClient(URL, paramJsonObj202110);
//				System.out.println(ret202110);
//
//
//
//				JSONObject paramJsonObj202111 = initParamJsonObj_Realname202111(nums[i]);
//				String ret202111 = postClient(URL, paramJsonObj202111);
//				System.out.println(ret202111);
//
//
//
//				JSONObject paramJsonObj202112 = initParamJsonObj_Realname202112(nums[i]);
//				String ret202112 = postClient(URL, paramJsonObj202112);
//				System.out.println(ret202112);
//
//
//
//				JSONObject paramJsonObj202201 = initParamJsonObj_Realname202201(nums[i]);
//				String ret202201 = postClient(URL, paramJsonObj202201);
//				System.out.println(ret202201);
//
//
//
//
//				JSONObject paramJsonObj202202 = initParamJsonObj_Realname202202(nums[i]);
//				String ret202202 = postClient(URL, paramJsonObj202202);
//				System.out.println(ret202202);
//
//
//
//				JSONObject paramJsonObj202203 = initParamJsonObj_Realname202203(nums[i]);
//				String ret202203= postClient(URL, paramJsonObj202203);
//				System.out.println(ret202203);
//
//
//
//				JSONObject paramJsonObj202204 = initParamJsonObj_Realname202204(nums[i]);
//				String ret202204 = postClient(URL, paramJsonObj202204);
//				System.out.println(ret202204);
//
//
//				JSONObject paramJsonObj202205 = initParamJsonObj_Realname202205(nums[i]);
//				String ret202205 = postClient(URL, paramJsonObj202205);
//				System.out.println(ret202205);
//
//
//				JSONObject paramJsonObj202206 = initParamJsonObj_Realname202206(nums[i]);
//				String ret202206 = postClient(URL, paramJsonObj202206);
//				System.out.println(ret202206);


				/*JSONObject paramJsonObj202207 = initParamJsonObj_Realname202207(nums[i]);
				String ret202207 = postClient(URL, paramJsonObj202207);
				System.out.println(ret202207);*/

//
			JSONObject paramJsonObj202208 = initParamJsonObj_Realname202208(nums[i]);
			String ret202208 = postClient(URL, paramJsonObj202208);
			System.out.println(ret202208);
//
//				JSONObject paramJsonObj202209 = initParamJsonObj_Realname202209(nums[i]);
//				String ret202209 = postClient(URL, paramJsonObj202209);
//				System.out.println(ret202209);
//
//				JSONObject paramJsonObj202210 = initParamJsonObj_Realname202210(nums[i]);
//				String ret202210 = postClient(URL, paramJsonObj202210);
//				System.out.println(ret202210);
//
//				JSONObject paramJsonObj202211 = initParamJsonObj_Realname202211(nums[i]);
//				String ret202211 = postClient(URL, paramJsonObj202211);
//				System.out.println(ret202211);
//
//				JSONObject paramJsonObj202212 = initParamJsonObj_Realname202212(nums[i]);
//				String ret202212 = postClient(URL, paramJsonObj202212);
//				System.out.println(ret202212);
//
//				JSONObject paramJsonObj202301 = initParamJsonObj_Realname202301(nums[i]);
//				String ret202301 = postClient(URL, paramJsonObj202301);
//				System.out.println(ret202301);

			}

		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * 整合参数(实名认证)
	 *
	 * @return
	 */
	public JSONObject initParamJsonObj_Realname202109(String num) {
		/**
		 * 基本参数
		 */
		JSONObject paramJsonObj = new JSONObject();
		paramJsonObj.put("api", "B2B_INVOICE_QUERY_V1");//CTCC_3RD_DETAIL_V11//CTCC_STATUS_CHECK_V11//CUCC_STATUS_CHECK_V11//CMCC_3RD_DETAIL_V15//CMCC_3RD_V2//CTCC_3RD_DETAIL_V11//
		 //paramJsonObj.put("api", "MSISDNMD5TOIMEI");//MOBILE_CHECK_V1//CMCC_3RD_VERIFY_V4//CTCC_CHECK_V1
		paramJsonObj.put("appKey", appKey);
	    paramJsonObj.put("appSecret",
		"CA02EAB3CAE8A89CD61359244CD971BBABDB44D5");
		//"84C1CE24EDF361F28072E313BD87EAB24CC727CF");

	   

		/**
		 * 业务参数
		 */
		JSONObject dataJson = new JSONObject();
		dataJson.put("companyNum","11171249");
		dataJson.put("cardId",num);
		dataJson.put("startInvoiceMakeTime","2021-09-01T00:00:00");
		dataJson.put("endInvoiceMakeTime","2021-10-01T00:00:00");
		paramJsonObj.put("data", dataJson);
		return paramJsonObj;
	}


	public JSONObject initParamJsonObj_Realname202110(String num) {
		/**
		 * 基本参数
		 */
		JSONObject paramJsonObj = new JSONObject();
		paramJsonObj.put("api", "B2B_INVOICE_QUERY_V1");//CTCC_3RD_DETAIL_V11//CTCC_STATUS_CHECK_V11//CUCC_STATUS_CHECK_V11//CMCC_3RD_DETAIL_V15//CMCC_3RD_V2//CTCC_3RD_DETAIL_V11//
		//paramJsonObj.put("api", "MSISDNMD5TOIMEI");//MOBILE_CHECK_V1//CMCC_3RD_VERIFY_V4//CTCC_CHECK_V1
		paramJsonObj.put("appKey", appKey);
		paramJsonObj.put("appSecret",
				"CA02EAB3CAE8A89CD61359244CD971BBABDB44D5");
		//"84C1CE24EDF361F28072E313BD87EAB24CC727CF");



		/**
		 * 业务参数
		 */
		JSONObject dataJson = new JSONObject();
		dataJson.put("companyNum","11171249");
		dataJson.put("cardId",num);
		dataJson.put("startInvoiceMakeTime","2021-10-01T00:00:00");
		dataJson.put("endInvoiceMakeTime","2021-11-01T00:00:00");
		paramJsonObj.put("data", dataJson);
		return paramJsonObj;
	}


	public JSONObject initParamJsonObj_Realname202111(String num) {
		/**
		 * 基本参数
		 */
		JSONObject paramJsonObj = new JSONObject();
		paramJsonObj.put("api", "B2B_INVOICE_QUERY_V1");//CTCC_3RD_DETAIL_V11//CTCC_STATUS_CHECK_V11//CUCC_STATUS_CHECK_V11//CMCC_3RD_DETAIL_V15//CMCC_3RD_V2//CTCC_3RD_DETAIL_V11//
		//paramJsonObj.put("api", "MSISDNMD5TOIMEI");//MOBILE_CHECK_V1//CMCC_3RD_VERIFY_V4//CTCC_CHECK_V1
		paramJsonObj.put("appKey", appKey);
		paramJsonObj.put("appSecret",
				"CA02EAB3CAE8A89CD61359244CD971BBABDB44D5");
		//"84C1CE24EDF361F28072E313BD87EAB24CC727CF");



		/**
		 * 业务参数
		 */
		JSONObject dataJson = new JSONObject();
		dataJson.put("companyNum","11171249");
		dataJson.put("cardId",num);
		dataJson.put("startInvoiceMakeTime","2021-11-01T00:00:00");
		dataJson.put("endInvoiceMakeTime","2021-12-01T00:00:00");
		paramJsonObj.put("data", dataJson);
		return paramJsonObj;
	}


	public JSONObject initParamJsonObj_Realname202112(String num) {
		/**
		 * 基本参数
		 */
		JSONObject paramJsonObj = new JSONObject();
		paramJsonObj.put("api", "B2B_INVOICE_QUERY_V1");//CTCC_3RD_DETAIL_V11//CTCC_STATUS_CHECK_V11//CUCC_STATUS_CHECK_V11//CMCC_3RD_DETAIL_V15//CMCC_3RD_V2//CTCC_3RD_DETAIL_V11//
		//paramJsonObj.put("api", "MSISDNMD5TOIMEI");//MOBILE_CHECK_V1//CMCC_3RD_VERIFY_V4//CTCC_CHECK_V1
		paramJsonObj.put("appKey", appKey);
		paramJsonObj.put("appSecret",
				"CA02EAB3CAE8A89CD61359244CD971BBABDB44D5");
		//"84C1CE24EDF361F28072E313BD87EAB24CC727CF");



		/**
		 * 业务参数
		 */
		JSONObject dataJson = new JSONObject();
		dataJson.put("companyNum","11171249");
		dataJson.put("cardId",num);
		dataJson.put("startInvoiceMakeTime","2021-12-01T00:00:00");
		dataJson.put("endInvoiceMakeTime","2022-01-01T00:00:00");
		paramJsonObj.put("data", dataJson);
		return paramJsonObj;
	}

	public JSONObject initParamJsonObj_Realname202201(String num) {
		/**
		 * 基本参数
		 */
		JSONObject paramJsonObj = new JSONObject();
		paramJsonObj.put("api", "B2B_INVOICE_QUERY_V1");//CTCC_3RD_DETAIL_V11//CTCC_STATUS_CHECK_V11//CUCC_STATUS_CHECK_V11//CMCC_3RD_DETAIL_V15//CMCC_3RD_V2//CTCC_3RD_DETAIL_V11//
		//paramJsonObj.put("api", "MSISDNMD5TOIMEI");//MOBILE_CHECK_V1//CMCC_3RD_VERIFY_V4//CTCC_CHECK_V1
		paramJsonObj.put("appKey", appKey);
		paramJsonObj.put("appSecret",
				"CA02EAB3CAE8A89CD61359244CD971BBABDB44D5");
		//"84C1CE24EDF361F28072E313BD87EAB24CC727CF");



		/**
		 * 业务参数
		 */
		JSONObject dataJson = new JSONObject();
		dataJson.put("companyNum","11171249");
		dataJson.put("cardId",num);
		dataJson.put("startInvoiceMakeTime","2022-01-01T00:00:00");
		dataJson.put("endInvoiceMakeTime","2022-02-01T00:00:00");
		paramJsonObj.put("data", dataJson);
		return paramJsonObj;
	}


	public JSONObject initParamJsonObj_Realname202202(String num) {
		/**
		 * 基本参数
		 */
		JSONObject paramJsonObj = new JSONObject();
		paramJsonObj.put("api", "B2B_INVOICE_QUERY_V1");//CTCC_3RD_DETAIL_V11//CTCC_STATUS_CHECK_V11//CUCC_STATUS_CHECK_V11//CMCC_3RD_DETAIL_V15//CMCC_3RD_V2//CTCC_3RD_DETAIL_V11//
		//paramJsonObj.put("api", "MSISDNMD5TOIMEI");//MOBILE_CHECK_V1//CMCC_3RD_VERIFY_V4//CTCC_CHECK_V1
		paramJsonObj.put("appKey", appKey);
		paramJsonObj.put("appSecret",
				"CA02EAB3CAE8A89CD61359244CD971BBABDB44D5");
		//"84C1CE24EDF361F28072E313BD87EAB24CC727CF");



		/**
		 * 业务参数
		 */
		JSONObject dataJson = new JSONObject();
		dataJson.put("companyNum","11171249");
		dataJson.put("cardId",num);
		dataJson.put("startInvoiceMakeTime","2022-02-01T00:00:00");
		dataJson.put("endInvoiceMakeTime","2022-03-01T00:00:00");
		paramJsonObj.put("data", dataJson);
		return paramJsonObj;
	}


	public JSONObject initParamJsonObj_Realname202203(String num) {
		/**
		 * 基本参数
		 */
		JSONObject paramJsonObj = new JSONObject();
		paramJsonObj.put("api", "B2B_INVOICE_QUERY_V1");//CTCC_3RD_DETAIL_V11//CTCC_STATUS_CHECK_V11//CUCC_STATUS_CHECK_V11//CMCC_3RD_DETAIL_V15//CMCC_3RD_V2//CTCC_3RD_DETAIL_V11//
		//paramJsonObj.put("api", "MSISDNMD5TOIMEI");//MOBILE_CHECK_V1//CMCC_3RD_VERIFY_V4//CTCC_CHECK_V1
		paramJsonObj.put("appKey", appKey);
		paramJsonObj.put("appSecret",
				"CA02EAB3CAE8A89CD61359244CD971BBABDB44D5");
		//"84C1CE24EDF361F28072E313BD87EAB24CC727CF");



		/**
		 * 业务参数
		 */
		JSONObject dataJson = new JSONObject();
		dataJson.put("companyNum","11171249");
		dataJson.put("cardId",num);
		dataJson.put("startInvoiceMakeTime","2022-03-01T00:00:00");
		dataJson.put("endInvoiceMakeTime","2022-04-01T00:00:00");
		paramJsonObj.put("data", dataJson);
		return paramJsonObj;
	}


	public JSONObject initParamJsonObj_Realname202204(String num) {
		/**
		 * 基本参数
		 */
		JSONObject paramJsonObj = new JSONObject();
		paramJsonObj.put("api", "B2B_INVOICE_QUERY_V1");//CTCC_3RD_DETAIL_V11//CTCC_STATUS_CHECK_V11//CUCC_STATUS_CHECK_V11//CMCC_3RD_DETAIL_V15//CMCC_3RD_V2//CTCC_3RD_DETAIL_V11//
		//paramJsonObj.put("api", "MSISDNMD5TOIMEI");//MOBILE_CHECK_V1//CMCC_3RD_VERIFY_V4//CTCC_CHECK_V1
		paramJsonObj.put("appKey", appKey);
		paramJsonObj.put("appSecret",
				"CA02EAB3CAE8A89CD61359244CD971BBABDB44D5");
		//"84C1CE24EDF361F28072E313BD87EAB24CC727CF");



		/**
		 * 业务参数
		 */
		JSONObject dataJson = new JSONObject();
		dataJson.put("companyNum","11171249");
		dataJson.put("cardId",num);
		dataJson.put("startInvoiceMakeTime","2022-04-01T00:00:00");
		dataJson.put("endInvoiceMakeTime","2022-05-01T00:00:00");
		paramJsonObj.put("data", dataJson);
		return paramJsonObj;
	}

	public JSONObject initParamJsonObj_Realname202205(String num) {
		/**
		 * 基本参数
		 */
		JSONObject paramJsonObj = new JSONObject();
		paramJsonObj.put("api", "B2B_INVOICE_QUERY_V1");//CTCC_3RD_DETAIL_V11//CTCC_STATUS_CHECK_V11//CUCC_STATUS_CHECK_V11//CMCC_3RD_DETAIL_V15//CMCC_3RD_V2//CTCC_3RD_DETAIL_V11//
		//paramJsonObj.put("api", "MSISDNMD5TOIMEI");//MOBILE_CHECK_V1//CMCC_3RD_VERIFY_V4//CTCC_CHECK_V1
		paramJsonObj.put("appKey", appKey);
		paramJsonObj.put("appSecret",
				"CA02EAB3CAE8A89CD61359244CD971BBABDB44D5");
		//"84C1CE24EDF361F28072E313BD87EAB24CC727CF");



		/**
		 * 业务参数
		 */
		JSONObject dataJson = new JSONObject();
		dataJson.put("companyNum","11171249");
		dataJson.put("cardId",num);
		dataJson.put("startInvoiceMakeTime","2022-05-01T00:00:00");
		dataJson.put("endInvoiceMakeTime","2022-06-01T00:00:00");
		paramJsonObj.put("data", dataJson);
		return paramJsonObj;
	}

	public JSONObject initParamJsonObj_Realname202206(String num) {
		/**
		 * 基本参数
		 */
		JSONObject paramJsonObj = new JSONObject();
		paramJsonObj.put("api", "B2B_INVOICE_QUERY_V1");//CTCC_3RD_DETAIL_V11//CTCC_STATUS_CHECK_V11//CUCC_STATUS_CHECK_V11//CMCC_3RD_DETAIL_V15//CMCC_3RD_V2//CTCC_3RD_DETAIL_V11//
		//paramJsonObj.put("api", "MSISDNMD5TOIMEI");//MOBILE_CHECK_V1//CMCC_3RD_VERIFY_V4//CTCC_CHECK_V1
		paramJsonObj.put("appKey", appKey);
		paramJsonObj.put("appSecret",
				"CA02EAB3CAE8A89CD61359244CD971BBABDB44D5");
		//"84C1CE24EDF361F28072E313BD87EAB24CC727CF");



		/**
		 * 业务参数
		 */
		JSONObject dataJson = new JSONObject();
		dataJson.put("companyNum","11171249");
		dataJson.put("cardId",num);
		dataJson.put("startInvoiceMakeTime","2022-06-01T00:00:00");
		dataJson.put("endInvoiceMakeTime","2022-07-01T00:00:00");
		paramJsonObj.put("data", dataJson);
		return paramJsonObj;
	}

	public JSONObject initParamJsonObj_Realname202207(String num) {
		/**
		 * 基本参数
		 */
		JSONObject paramJsonObj = new JSONObject();
		paramJsonObj.put("api", "WAY_BILL_NUM_FIND_OWNER_INVOICE");//CTCC_3RD_DETAIL_V11//CTCC_STATUS_CHECK_V11//CUCC_STATUS_CHECK_V11//CMCC_3RD_DETAIL_V15//CMCC_3RD_V2//CTCC_3RD_DETAIL_V11//
		//paramJsonObj.put("api", "MSISDNMD5TOIMEI");//MOBILE_CHECK_V1//CMCC_3RD_VERIFY_V4//CTCC_CHECK_V1
		paramJsonObj.put("appKey", appKey);
		paramJsonObj.put("appSecret",
				"8898A0EACB6D51419A4C801A2CE509FC0C31D90B");
		//"84C1CE24EDF361F28072E313BD87EAB24CC727CF");



		/**
		 * 业务参数
		 */
		JSONObject dataJson = new JSONObject();
		dataJson.put("num",num);
		paramJsonObj.put("data", dataJson);
		return paramJsonObj;
	}

	public JSONObject initParamJsonObj_Realname202208(String num) {
		/**
		 * 基本参数
		 */
		JSONObject paramJsonObj = new JSONObject();
		paramJsonObj.put("api", "B2B_INVOICE_QUERY_V1");//CTCC_3RD_DETAIL_V11//CTCC_STATUS_CHECK_V11//CUCC_STATUS_CHECK_V11//CMCC_3RD_DETAIL_V15//CMCC_3RD_V2//CTCC_3RD_DETAIL_V11//
		//paramJsonObj.put("api", "MSISDNMD5TOIMEI");//MOBILE_CHECK_V1//CMCC_3RD_VERIFY_V4//CTCC_CHECK_V1
		paramJsonObj.put("appKey", appKey);
		paramJsonObj.put("appSecret",

								"0551954004ED4EED99B40E0E5023E7966AC084DB");
		//"84C1CE24EDF361F28072E313BD87EAB24CC727CF");



		/**
		 * 业务参数
		 */
		JSONObject dataJson = new JSONObject();
		dataJson.put("companyNum","11198580");
		dataJson.put("cardId",num);
		dataJson.put("startInvoiceMakeTime","2023-05-01T00:00:00");
		dataJson.put("endInvoiceMakeTime","2023-06-01T00:00:00");
		paramJsonObj.put("data", dataJson);
		return paramJsonObj;
	}

	public JSONObject initParamJsonObj_Realname202209(String num) {
		/**
		 * 基本参数
		 */
		JSONObject paramJsonObj = new JSONObject();
		paramJsonObj.put("api", "B2B_INVOICE_QUERY_V1");//CTCC_3RD_DETAIL_V11//CTCC_STATUS_CHECK_V11//CUCC_STATUS_CHECK_V11//CMCC_3RD_DETAIL_V15//CMCC_3RD_V2//CTCC_3RD_DETAIL_V11//
		//paramJsonObj.put("api", "MSISDNMD5TOIMEI");//MOBILE_CHECK_V1//CMCC_3RD_VERIFY_V4//CTCC_CHECK_V1
		paramJsonObj.put("appKey", appKey);
		paramJsonObj.put("appSecret",
				"CA02EAB3CAE8A89CD61359244CD971BBABDB44D5");
		//"84C1CE24EDF361F28072E313BD87EAB24CC727CF");



		/**
		 * 业务参数
		 */
		JSONObject dataJson = new JSONObject();
		dataJson.put("companyNum","11171249");
		dataJson.put("cardId",num);
		dataJson.put("startInvoiceMakeTime","2022-09-01T00:00:00");
		dataJson.put("endInvoiceMakeTime","2022-10-01T00:00:00");
		paramJsonObj.put("data", dataJson);
		return paramJsonObj;
	}
	public JSONObject initParamJsonObj_Realname202210(String num) {
		/**
		 * 基本参数
		 */
		JSONObject paramJsonObj = new JSONObject();
		paramJsonObj.put("api", "B2B_INVOICE_QUERY_V1");//CTCC_3RD_DETAIL_V11//CTCC_STATUS_CHECK_V11//CUCC_STATUS_CHECK_V11//CMCC_3RD_DETAIL_V15//CMCC_3RD_V2//CTCC_3RD_DETAIL_V11//
		//paramJsonObj.put("api", "MSISDNMD5TOIMEI");//MOBILE_CHECK_V1//CMCC_3RD_VERIFY_V4//CTCC_CHECK_V1
		paramJsonObj.put("appKey", appKey);
		paramJsonObj.put("appSecret",
				"CA02EAB3CAE8A89CD61359244CD971BBABDB44D5");
		//"84C1CE24EDF361F28072E313BD87EAB24CC727CF");



		/**
		 * 业务参数
		 */
		JSONObject dataJson = new JSONObject();
		dataJson.put("companyNum","11171249");
		dataJson.put("cardId",num);
		dataJson.put("startInvoiceMakeTime","2022-10-01T00:00:00");
		dataJson.put("endInvoiceMakeTime","2022-11-01T00:00:00");
		paramJsonObj.put("data", dataJson);
		return paramJsonObj;
	}

	public JSONObject initParamJsonObj_Realname202211(String num) {
		/**
		 * 基本参数
		 */
		JSONObject paramJsonObj = new JSONObject();
		paramJsonObj.put("api", "B2B_INVOICE_QUERY_V1");//CTCC_3RD_DETAIL_V11//CTCC_STATUS_CHECK_V11//CUCC_STATUS_CHECK_V11//CMCC_3RD_DETAIL_V15//CMCC_3RD_V2//CTCC_3RD_DETAIL_V11//
		//paramJsonObj.put("api", "MSISDNMD5TOIMEI");//MOBILE_CHECK_V1//CMCC_3RD_VERIFY_V4//CTCC_CHECK_V1
		paramJsonObj.put("appKey", appKey);
		paramJsonObj.put("appSecret",
				"CA02EAB3CAE8A89CD61359244CD971BBABDB44D5");
		//"84C1CE24EDF361F28072E313BD87EAB24CC727CF");



		/**
		 * 业务参数
		 */
		JSONObject dataJson = new JSONObject();
		dataJson.put("companyNum","11171249");
		dataJson.put("cardId",num);
		dataJson.put("startInvoiceMakeTime","2022-11-01T00:00:00");
		dataJson.put("endInvoiceMakeTime","2022-12-01T00:00:00");
		paramJsonObj.put("data", dataJson);
		return paramJsonObj;
	}

	public JSONObject initParamJsonObj_Realname202212(String num) {
		/**
		 * 基本参数
		 */
		JSONObject paramJsonObj = new JSONObject();
		paramJsonObj.put("api", "B2B_INVOICE_QUERY_V1");//CTCC_3RD_DETAIL_V11//CTCC_STATUS_CHECK_V11//CUCC_STATUS_CHECK_V11//CMCC_3RD_DETAIL_V15//CMCC_3RD_V2//CTCC_3RD_DETAIL_V11//
		//paramJsonObj.put("api", "MSISDNMD5TOIMEI");//MOBILE_CHECK_V1//CMCC_3RD_VERIFY_V4//CTCC_CHECK_V1
		paramJsonObj.put("appKey", appKey);
		paramJsonObj.put("appSecret",
				"CA02EAB3CAE8A89CD61359244CD971BBABDB44D5");
		//"84C1CE24EDF361F28072E313BD87EAB24CC727CF");



		/**
		 * 业务参数
		 */
		JSONObject dataJson = new JSONObject();
		dataJson.put("companyNum","11171249");
		dataJson.put("cardId",num);
		dataJson.put("startInvoiceMakeTime","2022-12-01T00:00:00");
		dataJson.put("endInvoiceMakeTime","2023-01-01T00:00:00");
		paramJsonObj.put("data", dataJson);
		return paramJsonObj;
	}

	public JSONObject initParamJsonObj_Realname202301(String num) {
		/**
		 * 基本参数
		 */
		JSONObject paramJsonObj = new JSONObject();
		paramJsonObj.put("api", "B2B_INVOICE_QUERY_V1");//CTCC_3RD_DETAIL_V11//CTCC_STATUS_CHECK_V11//CUCC_STATUS_CHECK_V11//CMCC_3RD_DETAIL_V15//CMCC_3RD_V2//CTCC_3RD_DETAIL_V11//
		//paramJsonObj.put("api", "MSISDNMD5TOIMEI");//MOBILE_CHECK_V1//CMCC_3RD_VERIFY_V4//CTCC_CHECK_V1
		paramJsonObj.put("appKey", appKey);
		paramJsonObj.put("appSecret",
				"CA02EAB3CAE8A89CD61359244CD971BBABDB44D5");
		//"84C1CE24EDF361F28072E313BD87EAB24CC727CF");



		/**
		 * 业务参数
		 */
		JSONObject dataJson = new JSONObject();
		dataJson.put("companyNum","11171249");
		dataJson.put("cardId",num);
		dataJson.put("startInvoiceMakeTime","2023-01-01T00:00:00");
		dataJson.put("endInvoiceMakeTime","2023-02-01T00:00:00");
		paramJsonObj.put("data", dataJson);
		return paramJsonObj;
	}


	/**
	 * 实现http post请求 注意编码 UTF-8
	 *
	 * @param url
	 * @param paramObj
	 * @return
	 */
	public String postClient(String url, JSONObject paramObj) {
		String str = "";
		HttpClient client = null;
		PostMethod method = null;
		try {
			client = new HttpClient();
			method = new PostMethod(url);
			method.setRequestHeader("Content-Type", "application/json;charset=utf-8");
			NameValuePair[] param = new NameValuePair[paramObj.size()];
			@SuppressWarnings("unchecked")
			Iterator<String> keys = paramObj.keys();
			int i = 0;
			while (keys.hasNext()) {
				String key = (String) keys.next();
				String value = paramObj.getString(key);
				param[i] = new NameValuePair(key, value);
				i++;
			}
			method.setRequestBody(param);
			client.executeMethod(method);
			str = convertStreamToString(method.getResponseBodyAsStream());
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			if (method != null) {
				method.releaseConnection();
			}
		}
		return str;
	}

	/**
	 * 流转字符串
	 *
	 * @param is
	 * @return
	 */
	public static String convertStreamToString(InputStream is) {
		BufferedReader reader = new BufferedReader(new InputStreamReader(is));
		StringBuilder builder = new StringBuilder();
		String line = null;
		try {
			while ((line = reader.readLine()) != null) {
				builder.append(line + "\n");
			}
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			try {
				is.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return builder.toString();
	}

}
