/*
 * 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.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.logging.Log;
import org.apache.commons.logging.LogFactory;

public class ZhdtServlet
extends HttpServlet {
    public static Log _logger = LogFactory.getLog(ZhdtServlet.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 {
        block8: {
            String ywId = request.getParameter("ywId");
            String parJson = request.getParameter("parJson");
            String url = request.getParameter("url");
            response.setContentType("text/json; charset=utf-8");
            TaxCommonReturnDomain returnDomain = new TaxCommonReturnDomain();
            HashMap<String, String> params = new HashMap<String, String>();
            params.put("domain.ywId", ywId);
            params.put("domain.ParmJson", parJson);
            params.put("url", url);
            String resultJson = "";
            _logger.debug((Object)("\u667a\u6167\u5927\u5385\u8f6c\u53d1" + params));
            try {
                try {
                    Map<String, String> res = HstWxServiceUtil.sendMess(url, params, "utf-8");
                    _logger.debug((Object)("\u667a\u6167\u5927\u5385\u8f6c\u53d1" + res));
                    if ("00".equals(res.get("code"))) {
                        resultJson = res.get("mess");
                        break block8;
                    }
                    returnDomain.setCode("01");
                    returnDomain.setMess(res.get("mess"));
                    resultJson = new Gson().toJson((Object)returnDomain);
                }
                catch (Exception e) {
                    _logger.error((Object)"\u8f6c\u53d1\u51fa\u9519", (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);
            }
        }
    }
}
