/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.google.gson.Gson
 *  org.apache.http.HttpEntity
 *  org.apache.http.client.entity.UrlEncodedFormEntity
 *  org.apache.http.client.methods.CloseableHttpResponse
 *  org.apache.http.client.methods.HttpPost
 *  org.apache.http.client.methods.HttpUriRequest
 *  org.apache.http.impl.client.CloseableHttpClient
 *  org.apache.http.impl.client.HttpClients
 *  org.apache.http.message.BasicNameValuePair
 *  org.apache.http.util.EntityUtils
 */
package com.hst.common.util;

import com.google.gson.Gson;
import com.hst.common.util.AESUtil;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import org.apache.http.HttpEntity;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;

public class SendMessUtil {
    private static String userName = "baishuikj";
    private static String userPass = "q5CEjBfp";
    private static String key = "d9a3576670edc672";
    private static String url = "http://120.26.125.243/sms/openCard";

    public static void main(String[] args) throws IOException {
        HttpPost httppost = new HttpPost(url);
        CloseableHttpClient httpClient = HttpClients.createDefault();
        httppost.addHeader("Content-type", "application/x-www-form-urlencoded;charset=utf-8");
        AESUtil.getTradeNo();
        HashMap<String, String> parameters = new HashMap<String, String>();
        parameters.put("compId", "FJDKSFJDS5R4955943U5TUI435K43J");
        parameters.put("privateKey", "d9a3576670edc672");
        parameters.put("accessId", "FJDSK9REWRFDSFJDS2349023849234DDSFS");
        parameters.put("randNum", "123456");
        parameters.put("mobile", "15658005187");
        parameters.put("content", "\u3010\u6b65\u957f\u79d1\u6280\u3011\u60a8\u7684\u9a8c\u8bc1\u7801\u662f123456\uff0c\u5982\u975e\u672c\u4eba\u53d1\u9001\u8bf7\u5ffd\u7565\u8be5\u4fe1\u606f\u3002");
        ArrayList<BasicNameValuePair> par = new ArrayList<BasicNameValuePair>();
        if (parameters != null) {
            for (Map.Entry entry : parameters.entrySet()) {
                par.add(new BasicNameValuePair((String)entry.getKey(), (String)entry.getValue()));
            }
        }
        Gson gson = new Gson();
        System.out.println("\u8bf7\u6c42\u53c2\u6570:" + gson.toJson(parameters) + new UrlEncodedFormEntity(par, "utf-8"));
        httppost.setEntity((HttpEntity)new UrlEncodedFormEntity(par, "utf-8"));
        CloseableHttpResponse response = httpClient.execute((HttpUriRequest)httppost);
        if (response.getStatusLine().getStatusCode() == 200) {
            System.out.println("\u8fd4\u56de\u7ed3\u679c" + EntityUtils.toString((HttpEntity)response.getEntity()));
        }
    }
}
