/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.google.gson.Gson
 *  javax.servlet.ServletException
 *  javax.servlet.http.HttpServlet
 *  javax.servlet.http.HttpServletRequest
 *  javax.servlet.http.HttpServletResponse
 *  org.apache.commons.lang3.StringUtils
 *  org.apache.commons.logging.Log
 *  org.apache.commons.logging.LogFactory
 */
package com.hst.servlet;

import com.google.gson.Gson;
import com.hst.common.domain.TaxCommonReturnDomain;
import com.hst.common.util.HstWxServiceUtil;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class TransferServlet
extends HttpServlet {
    public static Log _logger = LogFactory.getLog(TransferServlet.class);

    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doGet(request, response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        block9: {
            String url = request.getParameter("zfurl");
            if (StringUtils.isBlank((CharSequence)url)) {
                url = "http://80.16.70.6:8084/zhdt/zhdt";
            }
            response.setContentType("text/json; charset=utf-8");
            TaxCommonReturnDomain returnDomain = new TaxCommonReturnDomain();
            HashMap<String, String> params = new HashMap<String, String>();
            params.put("ywId", request.getParameter("ywId"));
            params.put("parJson", request.getParameter("parJson"));
            String resultJson = "";
            try {
                try {
                    Map<String, String> res = HstWxServiceUtil.sendMess(url, params, "utf-8");
                    if ("00".equals(res.get("code"))) {
                        resultJson = res.get("mess");
                        break block9;
                    }
                    returnDomain.setCode("01");
                    returnDomain.setMess(res.get("mess"));
                    resultJson = new Gson().toJson((Object)returnDomain);
                    _logger.debug((Object)("TransferServle\u8f6c\u53d1\u9519\u8bef" + res));
                }
                catch (Exception e) {
                    e.printStackTrace();
                    _logger.error((Object)"TransferServle\u8f6c\u53d1\u9519\u8bef", (Throwable)e);
                    returnDomain.setCode("01");
                    if (e.getMessage().length() > 2000) {
                        returnDomain.setMess(e.getMessage().substring(0, 2000));
                    } else {
                        returnDomain.setMess(e.getMessage());
                    }
                    resultJson = new Gson().toJson((Object)returnDomain);
                    e.printStackTrace();
                    PrintWriter out = response.getWriter();
                    out.write(resultJson);
                }
            }
            finally {
                PrintWriter out = response.getWriter();
                out.write(resultJson);
            }
        }
    }
}
