/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  net.sf.json.JSONObject
 *  org.apache.commons.httpclient.Header
 *  org.apache.commons.httpclient.HttpClient
 *  org.apache.commons.httpclient.HttpMethod
 *  org.apache.commons.httpclient.methods.PostMethod
 *  org.apache.commons.logging.Log
 *  org.apache.commons.logging.LogFactory
 */
package com.hst.taxService.service.imp;

import com.hst.common.util.Base64;
import com.hst.common.util.HstJsonUtil;
import com.hst.taxService.domain.wxfwh.PubGetPicReturnDomain;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;
import net.sf.json.JSONObject;
import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class TestWxfwh {
    public static Log _logger = LogFactory.getLog(TestWxfwh.class);

    public static void main(String[] args) throws IOException {
        String url = "http://127.0.0.1:9999/taxService/service/taxWxfwhCommon!doWxAppService";
        url = "http://bskj2016.tpddns.cn:9999/taxService/service/taxWxfwhCommon!doWxAppService";
        url = "http://bs.baishuichina.com/taxZfService/service/taxCommon!doService";
        String charset = "GBK";
        HashMap<String, String> params = new HashMap<String, String>();
        String a = "";
        System.out.println(a.trim());
        params.put("domain.ywId", "wxfwh.WdsxGrszGetPic");
        params.put("domain.ParmJson", "{\"uid\":\"ea16224e51\",\"bid\":\"wxfwh.WdsxGrszGetPic\",\"swjgDm\":\"13301000000\",\"openId\":\"ea16224e51\",\"sid\":\"\",\"kz\":\"\",\"ver\":\"1.0\"}");
        params.put("domain.ywId", "wxfwh.WdsxGrszPutPic");
        params.put("domain.ywId", "wxfwh.YyfwCxWyyyxx");
        params.put("domain.ParmJson", "{\"uid\":\"ea16224e51\",\"bid\":\"wxfwh.YyfwCxWyyyxx\",\"swjgDm\":\"13301000000\",\"openId\":\"ea16224e51\",\"sid\":\"\",\"kz\":\"\",\"ver\":\"1.0\"}");
        params.put("domain.ywId", "wxfwh.FpdkSaveSqxx");
        params.put("domain.ParmJson", "{\"uid\":\"ea16224e51\",\"bid\":\"wxfwh.FpdkSaveSqxx\",\"swjgDm\":\"13301000000\",\"openId\":\"ea16224e51\",\"sid\":\"\",\"kz\":\"\",\"ver\":\"1.0\",nsrsbh:\"330181255711576\",\"ccdw\":\"111\",\"clhm\":\"11111\",\"clzl\":\"11\",\"cwfzr\":\"\",\"dataList\":[{\"bz\":\"\",\"dj\":\"0\",\"dw\":\"\",\"gg\":\"\",\"je\":\"1111\",\"jflc\":\"0\",\"pm\":\"1\",\"se\":\"33.33\",\"sl\":\"0\",\"sli\":\".03\",\"xh\":\"1\"}],\"dkfpSqdbh\":\"C100001168710\",\"dkfpsqlbDm\":\"3\",\"dkfpsqlxDm\":\"2\",\"fddbr\":\"\",\"fhrmc\":\"\u676d\u5dde\u8427\u7136\u5546\u53a6\u6709\u9650\u8d23\u4efb\u516c\u53f8\",\"fhrsbh\":\"330181255711576\",\"fkfdh\":\"\",\"fkfdz\":\"\",\"fkflxDm\":\"\",\"fkfmc\":\"\u676d\u5dde\u8427\u7136\u5546\u53a6\u6709\u9650\u8d23\u4efb\u516c\u53f8\",\"fkfyhmc\":\"\",\"fkfyhzh\":\"\",\"fkfzjhm\":\"330181255711576\",\"fkfzjlxDm\":\"\",\"jmslxMc\":\"\",\"jshj\":\"1144.33\",\"kpje\":\"1111\",\"kplbDm\":\"\",\"lxrGddh\":\"\",\"lxrSjhm\":\"11111111112\",\"lxrXm\":\"bsr\",\"mess\":\"\",\"qzdz\":\"111\",\"sehj\":\"33.33\",\"sfjm\":\"\",\"shrmc\":\"\u676d\u5dde\u8427\u7136\u5546\u53a6\u6709\u9650\u8d23\u4efb\u516c\u53f8\",\"shrsbh\":\"330181255711576\",\"skfdh\":\"\",\"skfdz\":\"\",\"skfmc\":\"\u676d\u5dde\u8427\u7136\u5546\u53a6\u6709\u9650\u8d23\u4efb\u516c\u53f8\",\"skfyhmc\":\"\",\"skfyhzh\":\"\",\"skfzjhm\":\"330181255711576\",\"sqly\":\"\",\"sqrlb\":\"1\",\"sqrmc\":\"\u676d\u5dde\u8427\u7136\u5546\u53a6\u6709\u9650\u8d23\u4efb\u516c\u53f8\",\"sqrq\":\"2016-06-21\",\"sqrzjhm\":\"330181255711576\",\"sqsj\":\"2016-06-21 11:43:09\",\"swjgMc\":\"\",\"txr\":\"\",\"yjdddh\":\"\",\"yjdz\":\"\",\"yjsjhm\":\"\",\"yjxm\":\"\",\"yjyb\":\"\",\"yshwxx\":\"1111\",nsrSwjgDm:\"1330122222\",sjlyDm:\"102\",jbdm:\"222\" ,bcbz:\"1\"}");
        params.put("domain.ywId", "wxfwh.WghNsrJcxxcjCx");
        params.put("domain.ParmJson", "{\"uid\":\"ea16224e51\",\"bid\":\"wxfwh.91330110MA28R7Y78B\",\"nsrsbh\":\"91330110053662139N\",\"sid\":\"\",\"kz\":\"\",\"ver\":\"1.0\",yzm:\"2157\",openId:\"10113301000046649002\",sfzhm:\"330103198004020410\",sjhm:\"13588160603\"}");
        params.put("domain.ywId", "wxfwh.BsyDxSmyz");
        params.put("domain.ParmJson", "{\"uid\":\"ea16224e51\",\"bid\":\"wxfwh.BsyDxSmyz\",\"swjgDm\":\"13301910000\",\"openId\":\"123456\",\"sid\":\"\",\"kz\":\"\",\"ver\":\"1.0\",sfzhm:\"339005199504130317\",sjhm:\"15990029312\",xm:\"xm\",yzm:\"yzm\"}");
        params.put("domain.ywId", "wxfwh.queryDkfpSfzxx");
        params.put("domain.ywId", "wxfwh.queryDkfpSfzxx");
        params.put("domain.ParmJson", "{\"uid\":\"ea16224e51\",\"bid\":\"queryDkfpSfzxx\",\"swjgDm\":\"13301910000\",\"openId\":\"123456\",\"sid\":\"\",\"kz\":\"\",\"ver\":\"1.0\",dkfpSqdbh:\"C88100001170058\",sjhm:\"15990029312\",xm:\"xm\",yzm:\"yzm\",wsDjhzXh:\"\"}");
        params.put("domain.ywId", "wxfwh.FpdkCheckSqzg");
        params.put("domain.ParmJson", "{\"uid\":\"ea16224e51\",\"bid\":\"wxfwh.FpdkCheckSqzg\",\"swjgDm\":\"13301000000\",\"openId\":\"ea16224e51\",\"sid\":\"\",\"kz\":\"\",\"ver\":\"1.0\",nsrsbh:\"91330106MA27W8TH7Y\",dkfpsqlxDm:\"1\"}");
        params.put("domain.ywId", "wxfwh.GlyCxDhhm");
        params.put("domain.ParmJson", "{\"uid\":\"ea16224e51\",\"bid\":\"wxfwh.FpdkCheckSqzg\",\"swjgDm\":\"13301000000\",\"openId\":\"ea16224e51\",\"cxswjgdm\":\"13301040000\",\"xbqybz\":\"N\",\"ver\":\"1.0\",djxh:\"10113301020000080726\",dhhm:\"1\",rows:\"10\",page:\"1\"}");
        params.put("domain.ywId", "wxfwh.SqhdSendMess");
        params.put("domain.ParmJson", "{\"ywId\":\"wxfwh.SqhdSendMess\",\" bid\":\"wxfwh.SqhdSendMess\",\"ver\":\"1.0\",\"swjgDm\":\"13301910000\",\"openId\":\"123456\",\"djxh\":\"10113301020000080726\",\"fsnr\":\"\u6d4b222\u8bd5\",\"xxlx\":\"1\",\"swry_dm\":\"13301913311\"}");
        Base64.byteToString(TestWxfwh.getBytesFromFile("D:\\head\\5.jpg")).replaceAll("\r\n", "");
        String imgae1 = Base64.byteToString(TestWxfwh.getBytesFromFile("D:\\head\\5.jpg")).replaceAll("\r\n", "");
        params.put("domain.ywId", "wxfwh.PubSaveSmrzxx");
        params.put("domain.ParmJson", "{\"ywId\":\"wxfwh.PubSaveSmrzxx\",\" bid\":\"wxfwh.PubSaveSmrzxx\",\"ver\":\"1.0\",\"swjgDm\":\"13301910000\",\"openId\":\"123456\",\"sfzhm\":\"33072619999999\",\"xm\":\"\u6d4b222\u8bd5\",\"sjhm\":\"399991\",\"rxpic\":\"" + imgae1 + "\",\"sfzpic\":\"" + imgae1 + "\"}");
        params.put("domain.ywId", "wxfwh.WdsxTzggList");
        params.put("domain.ParmJson", "{\"uid\":\"ea16224e51\",\"bid\":\"wxfwh.WdsxTzggList\",\"swjgDm\":\"13301910000\",\"openId\":\"123456\",\"sid\":\"\",\"kz\":\"\",\"ver\":\"1.0\"}");
        params.put("domain.ywId", "wxfwh.XxcjGetNsrmd");
        params.put("domain.ParmJson", "{\"uid\":\"ea16224e51\",\"bid\":\"wxfwh.WdsxTzggList\",\"swjgDm\":\"21500000000\",\"openId\":\"$:LWCP_v1:$XvpGA5A+pnBiiHSFCBb4jA==\",\"sid\":\"\",\"kz\":\"\",\"ver\":\"1.0\"}");
        params.put("domain.ywId", "wxfwh.XxcjGetNsrZlscqk");
        params.put("domain.ywId", "wxfwh.XxcjGetNsrZlyscxx");
        params.put("domain.ParmJson", "{\"uid\":\"ea16224e51\",\"bid\":\"wxfwh.WdsxTzggList\",\"swjgDm\":\"21500000000\",\"openId\":\"$:LWCP_v1:$XvpGA5A+pnBiiHSFCBb4jA==\",\"djxh\":\"10113301000047101910\",\"rw_uuid\":\"75BD966D4E03529CE0501450221036C8\",\"bdjzl_xh\":\"1\"}");
        params.put("domain.ywId", "wxfwh.XxcjSaveSczl");
        params.put("domain.ParmJson", "{\"uid\":\"ea16224e51\",\"bid\":\"wxfwh.WdsxTzggList\",\"swjgDm\":\"13301910000\",\"openId\":\"orBW2s1xK5WNwEySM6xdUHc-Zz-A\",\"djxh\":\"10113301000047101910\",\"rw_uuid\":\"75BD966D844B529CE0501450221036C8\",\"bdjzl_xh\":\"1\",zlpic_nr:\"" + imgae1 + "\"}");
        params.put("domain.ywId", "wxfwh.WghJkxxSave");
        params.put("domain.ywId", "wxfwh.XxcjSaveSczl");
        params.put("domain.ParmJson", "{\"ywId\":\"wxfwh.SqhdSendMess\",\" bid\":\"wxfwh.SqhdSendMess\",\"ver\":\"1.0\",\"swjg_dm\":\"13301910000\",\"nsrsbh\":\"123456\",\"djxh\":\"10113301020000080726\",\"sfzhm\":\"330726199998888\",\"zjlx\":\"1\",\"xm\":\"\u624d\u8ba4\u8bc6\",skrdm:\"133999999\",skrmc:\"\u6d4b\u7ed8\u540d\u79f0\",sbbs:\"1002\",dataList:[{gdslb:\"1\",sehj:\"10000\",jkfs:\"1\",jkpzxh:\"1882\",jkrq:\"2017-01-01 12:00\",subList:[{zsxm_dm:\"10101\",zspm_dm:\"\",sli:\"\",se:\"30\"}]},{gdslb:\"2\",sehj:\"9888\",jkfs:\"2\",jkpzxh:\"3123123\",jkrq:\"2017-01-01 12:00\",subList:[{zsxm_dm:\"10106\" ,sli:\"0.3\",se:\"30\"},{zsxm_dm:\"10109\",sli:\"0.3\",se:\"30\"}]}]}");
        params.put("domain.ywId", "wxfwh.XxcjSczlTjsh");
        params.put("domain.ParmJson", "{\"uid\":\"ea16224e51\",\"bid\":\"wxfwh.WdsxTzggList\",\"swjgDm\":\"21500000000\",\"openId\":\"$:LWCP_v1:$XvpGA5A+pnBiiHSFCBb4jA==\",\"djxh\":\"10113301000047101910\",\"rw_uuid\":\"75BD966D4E03529CE0501450221036C8\",\"bdjzl_xh\":\"1\"}");
        String str = TestWxfwh.doPost(url, params, charset, true);
        System.out.println(str);
    }

    public static String doPost(String url, Map<String, String> params, String charset, boolean pretty) {
        StringBuffer response;
        block10: {
            response = new StringBuffer();
            HttpClient client = new HttpClient();
            PostMethod post = new PostMethod(url);
            post.setRequestHeader(new Header("Content-type", "application/x-www-form-urlencoded;charset=gbk"));
            post.setRequestHeader(new Header("User-Agent", "Mozilla/5.0 /Windows; U; Windows NT 4.1; de; rv:1.9.1.5) Gecko/20091102 Firefox/3.0"));
            if (params != null) {
                for (Map.Entry<String, String> entry : params.entrySet()) {
                    post.setParameter(entry.getKey(), entry.getValue());
                }
            }
            try {
                try {
                    client.executeMethod((HttpMethod)post);
                    if (post.getStatusCode() == 200) {
                        String line;
                        BufferedReader reader = new BufferedReader(new InputStreamReader(post.getResponseBodyAsStream(), charset));
                        while ((line = reader.readLine()) != null) {
                            if (pretty) {
                                response.append(line).append(System.getProperty("line.separator"));
                                continue;
                            }
                            response.append(line);
                        }
                        reader.close();
                    }
                }
                catch (IOException e) {
                    _logger.error((Object)("\u6267\u884cHTTP Post\u8bf7\u6c42" + url + "\u65f6\uff0c\u53d1\u751f\u5f02\u5e38\uff01"), (Throwable)e);
                    post.releaseConnection();
                    break block10;
                }
            }
            catch (Throwable throwable) {
                post.releaseConnection();
                throw throwable;
            }
            post.releaseConnection();
        }
        return response.toString();
    }

    protected static void getPic(String imgStr) {
        try {
            JSONObject jsonObject = JSONObject.fromObject((Object)imgStr);
            JSONObject retJson = JSONObject.fromObject((Object)jsonObject.getJSONObject("dsyyqh"));
            String resultJson = retJson.getString("retJson");
            JSONObject jsonObject1 = JSONObject.fromObject((Object)resultJson);
            PubGetPicReturnDomain domain = HstJsonUtil.jsonToBean(jsonObject1.getString("result"), PubGetPicReturnDomain.class);
            byte[] b = Base64.stringToByte(domain.getPic());
            int i = 0;
            while (i < b.length) {
                if (b[i] < 0) {
                    int n = i;
                    b[n] = (byte)(b[n] + 256);
                }
                ++i;
            }
            String imgFilePath = "d:\\Toolbar_h.png";
            FileOutputStream out = new FileOutputStream(imgFilePath);
            ((OutputStream)out).write(b);
            out.flush();
            ((OutputStream)out).close();
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static byte[] getBytesFromFile(String filePath) {
        File f = new File(filePath);
        if (f.isDirectory()) {
            return null;
        }
        try {
            int n;
            FileInputStream stream = new FileInputStream(f);
            ByteArrayOutputStream out = new ByteArrayOutputStream(1024);
            byte[] b = new byte[1024];
            while ((n = stream.read(b)) != -1) {
                out.write(b, 0, n);
            }
            stream.close();
            out.close();
            return out.toByteArray();
        }
        catch (IOException iOException) {
            return null;
        }
    }
}
