/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  org.apache.commons.logging.Log
 *  org.apache.commons.logging.LogFactory
 */
package com.hst.common.util;

import com.hst.common.util.Base64;
import com.hst.taxService.service.imp.TestPost;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.HashMap;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

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

    public static void doInitSmbd() throws InterruptedException {
        Thread.sleep(1000L);
        String url = "http://localhost:9999/taxService/service/taxSmzCommonApp!doSmzService";
        String imgae2 = Base64.byteToString(SmbdInitTask.getBytesFromFile("D:\\BSKJ\\taxService\\WEB-INF\\1.png")).replaceAll("\r\n", "");
        String imgae1 = Base64.byteToString(SmbdInitTask.getBytesFromFile("D:\\BSKJ\\taxService\\WEB-INF\\1.png")).replaceAll("\r\n", "");
        HashMap<String, String> params = new HashMap<String, String>();
        params.put("domain.ywId", "smz.rxsfzBd");
        params.put("domain.ParmJson", "{\"uid\":\"ea16224e51\",\"bid\":\"smz.rxsfzBd\",\"sid\":\"\",\"kz\":\"\",\"ver\":\"1.0\",xm:\"xm\",sfzhm:\"330102198512220615\",sfzzmPic:\"" + imgae1 + "\",headPic:\"" + imgae2 + "\",sjlyDm:\"2\",csrq:\"1963-01-25\",yxq_q:\"2017-01-01\",yxq_z:\"2017-01-01\",bsdt_djxh:\"1330100000\"}");
        _logger.debug((Object)"\u5f00\u59cb\u521d\u59cb\u5316\u5b9e\u540d\u6bd4\u5bf9\u63a5\u53e3");
        int i = 0;
        while (i < 5) {
            String str = TestPost.doPost(url, params, "GBK", true);
            _logger.debug((Object)str);
            ++i;
        }
    }

    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;
        }
    }
}
