/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  javax.annotation.Resource
 *  org.apache.commons.lang.StringUtils
 *  org.apache.commons.logging.Log
 *  org.apache.commons.logging.LogFactory
 *  org.apache.struts2.convention.annotation.Action
 *  org.apache.struts2.convention.annotation.Result
 *  org.springframework.context.annotation.Scope
 *  org.springframework.stereotype.Controller
 */
package com.hst.taxService.action;

import com.hst.common.action.ExtendAction;
import com.hst.common.domain.BaseAppServiceDomain;
import com.hst.common.domain.TaxCommonAppServiceDomain;
import com.hst.common.domain.TaxCommonReturnDomain;
import com.hst.common.service.BaseBusinessService;
import com.hst.common.util.DomainUtil;
import com.hst.common.util.HstJsonUtil;
import com.hst.common.util.HstWxServiceUtil;
import com.hst.framework.constants.AppServiceConstants;
import com.hst.framework.constants.WebConstants;
import com.hst.framework.util.HstEncodeUtil;
import com.hst.framework.util.HstToolsUtil;
import com.hst.taxService.service.TaxWxCommonAppService;
import javax.annotation.Resource;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

@Controller
@Scope(value="prototype")
@Action(value="/service/taxWxCommonApp", results={@Result(name="doWxAppService", type="json")})
public class TaxWxCommonAppAction
extends ExtendAction {
    private static final long serialVersionUID = 1L;
    public static Log _logger = LogFactory.getLog(TaxWxCommonAppAction.class);
    private TaxCommonAppServiceDomain domain;

    /*
     * Unable to fully structure code
     * Enabled aggressive block sorting
     * Enabled unnecessary exception pruning
     * Enabled aggressive exception aggregation
     */
    public String doWxAppService() throws Exception {
        block123: {
            service = (TaxWxCommonAppService)this.getService();
            appDomain = null;
            returnDomain = null;
            errorDomain = null;
            ywId = this.getDomain().getYwId();
            this.getDomain().getParmJson();
            returnDomain = DomainUtil.getDomain(ywId);
            if (!WebConstants.TAX_ZFSZ_MAP.containsKey(ywId)) break block123;
            try {
                appDomain = DomainUtil.getAppServiceDomain(ywId, this.getDomain().getParmJson());
                if (appDomain == null) {
                    this.handleException(returnDomain, AppServiceConstants.TAX_JSONPARSE_ERROR);
                    return "doWxAppService";
                }
            }
            catch (Exception v0) {
                this.handleException(returnDomain, AppServiceConstants.TAX_JSONPARSE_ERROR);
                return "doWxAppService";
            }
            url = WebConstants.TAX_ZFSZ_MAP.get(ywId);
            returnDomain = DomainUtil.getDomain(ywId);
            returnDomain = HstWxServiceUtil.sendMess(url, appDomain, ywId, returnDomain.getClass());
            ** GOTO lbl209
        }
        try {
            appDomain = DomainUtil.getAppServiceDomain(ywId, this.getDomain().getParmJson());
            if (appDomain == null) {
                this.handleException(returnDomain, AppServiceConstants.TAX_JSONPARSE_ERROR);
                return "doWxAppService";
            }
            if (StringUtils.isBlank((String)this.request.getHeader("Content-type")) || this.request.getHeader("Content-type").toLowerCase().indexOf("gbk") < 0 && this.request.getHeader("Content-type").toLowerCase().indexOf("utf") < 0) {
                HstEncodeUtil.decodeURL(appDomain);
            }
        }
        catch (Exception v1) {
            this.handleException(returnDomain, AppServiceConstants.TAX_JSONPARSE_ERROR);
            return "doWxAppService";
        }
        try {
            if (AppServiceConstants.YWID_TAX_ZXRDGETLIST.equals(ywId)) {
                returnDomain = service.queryZxrdGetList(appDomain);
            } else if (AppServiceConstants.YWID_TAX_ZXRDGETMESS.equals(ywId)) {
                returnDomain = service.queryZxrdGetMess(appDomain);
            } else if (AppServiceConstants.YWID_TAX_ZXRDPUTVIEWTIME.equals(ywId)) {
                returnDomain = service.zxrdPutViewTime(appDomain);
            } else if (AppServiceConstants.YWID_TAX_WSXTGETLIST.equals(ywId)) {
                returnDomain = service.queryWsxtGetList(appDomain);
            } else if (AppServiceConstants.YWID_TAX_WSXTGETMESS.equals(ywId)) {
                returnDomain = service.queryWsxtGetMess(appDomain);
            } else if (AppServiceConstants.YWID_TAX_WSXTPUTDWNLOG.equals(ywId)) {
                returnDomain = service.WsxtPutDownLog(appDomain);
            } else if (AppServiceConstants.YWID_TAX_WSXTGETJSNR.equals(ywId)) {
                returnDomain = service.queryWsxtGetJsnr(appDomain);
            } else if (AppServiceConstants.YWID_TAX_BSZNGETSXFL.equals(ywId)) {
                returnDomain = service.queryBsznGetSxfl(appDomain);
            } else if (AppServiceConstants.YWID_TAX_BSZNGETSSSXLIST.equals(ywId)) {
                returnDomain = service.queryBsznGetSssxList(appDomain);
            } else if (AppServiceConstants.YWID_TAX_BSZNGETSSSXSM.equals(ywId)) {
                returnDomain = service.queryBsznGetSssxSm(appDomain);
            } else if (AppServiceConstants.YWID_TAX_BSWDGETBSDTLIST.equals(ywId)) {
                returnDomain = service.queryBswdGetBsdtList(appDomain);
            } else if (AppServiceConstants.YWID_TAX_BSWDGETBSDTMESS.equals(ywId)) {
                returnDomain = service.queryBswdGetBsdtMess(appDomain);
            } else if (AppServiceConstants.YWID_TAX_BSWDGETBSDTLSDHXX.equals(ywId)) {
                returnDomain = service.queryBswdGetBsdtLsDhxx(appDomain);
            } else if (AppServiceConstants.YWID_TAX_BSWDGETSHHWDLIST.equals(ywId)) {
                returnDomain = service.queryBswdGetShhwdList(appDomain);
            } else if (AppServiceConstants.YWID_TAX_BSWDGETSHHWDMESS.equals(ywId)) {
                returnDomain = service.queryBswdGetShhwdMess(appDomain);
            } else if (AppServiceConstants.YWID_TAX_SJQHGETBSDTLIST.equals(ywId)) {
                returnDomain = service.querySjqhGetBsdtList(appDomain);
            } else if (AppServiceConstants.YWID_TAX_SJQHGETDRYQHXX.equals(ywId)) {
                returnDomain = service.querySjqhGetDryqhxx(appDomain);
            } else if (AppServiceConstants.YWID_TAX_SJQHGETDHRS.equals(ywId)) {
                returnDomain = service.querySjqhGetDhrs(appDomain, this.domain);
            } else if (AppServiceConstants.YWID_TAX_SJQHGETJHXTYWFL.equals(ywId)) {
                returnDomain = service.querySjqhGetJhxtYwfl(appDomain, this.domain);
            } else if (AppServiceConstants.YWID_TAX_SJQHGETSJQHHM.equals(ywId)) {
                returnDomain = service.querySjqhGetSjqhhm(appDomain, this.domain);
            } else if (AppServiceConstants.YWID_TAX_SJQHZFSJQH.equals(ywId)) {
                returnDomain = service.querySjqhZfSjqh(appDomain, this.domain);
            } else if (AppServiceConstants.YWID_TAX_FPCYGETDZFP.equals(ywId) || AppServiceConstants.YWID_TAX_FPCYGETFWLFP.equals(ywId) || AppServiceConstants.YWID_TAX_FPCYGETKYFP.equals(ywId) || AppServiceConstants.YWID_TAX_FPCYGETWLFP.equals(ywId)) {
                returnDomain = service.queryFpcy(appDomain, this.domain);
            } else if (AppServiceConstants.YWID_TAX_YYBSGETYYSJ.equals(ywId)) {
                returnDomain = service.queryYybsYysj(appDomain, this.domain);
            } else if (AppServiceConstants.YWID_TAX_YYBSSFYZ.equals(ywId)) {
                returnDomain = service.queryYybsSfyz(appDomain, this.domain);
            } else if (AppServiceConstants.YWID_TAX_YYBSGETYYQHHM.equals(ywId)) {
                returnDomain = service.queryYybsYyqh(appDomain, this.domain);
            } else if (AppServiceConstants.YWID_TAX_SJCXGETNSRXX.equals(ywId)) {
                returnDomain = service.querySjcxGetNsrxx(appDomain);
            } else if (AppServiceConstants.YWID_TAX_SJCXGETSBQX.equals(ywId)) {
                returnDomain = service.querySjcxGetSbqx(appDomain);
            } else if (AppServiceConstants.YWID_TAX_JHXTGXBSDTJHYXGZ.equals(ywId)) {
                returnDomain = service.doGxBsdtJhyxgz(appDomain, this.domain);
            } else if (AppServiceConstants.YWID_TAX_JHXTGXBSDTYHFL.equals(ywId)) {
                returnDomain = service.doGxBsdtYhfl(appDomain, this.domain);
            } else if (AppServiceConstants.YWID_TAX_SJCXYGZPXDJ.equals(ywId)) {
                returnDomain = service.doYgzPxdj(appDomain);
            } else if (AppServiceConstants.YWID_TAX_YYBSGETYYSJ2.equals(ywId)) {
                returnDomain = service.queryYybsGetYysj2(appDomain);
            } else if (AppServiceConstants.YWID_TAX_YYBSGETYYQHHM2.equals(ywId)) {
                returnDomain = service.queryYybsGetYyqhhm2(appDomain);
            } else if (AppServiceConstants.YWID_TAX_YYBSQXYYQHHM.equals(ywId)) {
                returnDomain = service.doQxyyqhhm(appDomain);
            } else if (AppServiceConstants.YWID_TAX_YYBSGETYYGZR.equals(ywId)) {
                returnDomain = service.queryYybsGetYyGzr(appDomain);
            } else if (AppServiceConstants.YWID_TAX_YYBSGETJHXTYWFL2.equals(ywId)) {
                returnDomain = service.queryYybsGetJhxtYwfl2(appDomain);
            } else if (AppServiceConstants.YWID_TAX_YYBSGETJHXTYWFLYY.equals(ywId)) {
                returnDomain = service.queryYybsGetJhxtYwflYy(appDomain, this.domain);
            } else if (AppServiceConstants.YWID_TAX_SJCXYGZZXDTJ.equals(ywId)) {
                returnDomain = service.saveYgzZxd(appDomain);
            } else if (AppServiceConstants.YWID_TAX_SJCXYGZZXDCX.equals(ywId)) {
                returnDomain = service.queryYgzZxd(appDomain);
            } else if (AppServiceConstants.YWID_TAX_WX_YYQHGETBSDTLIST.equals(ywId)) {
                returnDomain = service.yyqhGetBsdtList(appDomain);
            } else if (AppServiceConstants.YWID_TAX_WX_YYBSGETYYYXX.equals(ywId)) {
                returnDomain = service.yybsGetYyyxx(appDomain);
            } else if (AppServiceConstants.YWID_TAX_WX_GZHTZGGLIST.equals(ywId)) {
                returnDomain = service.gzhTzggList(appDomain);
            } else if (AppServiceConstants.YWID_TAX_WX_GZHTZGGNR.equals(ywId)) {
                returnDomain = service.gzhTzggNr(appDomain);
            } else if (AppServiceConstants.YWID_TAX_WX_GZHSYTZGGLIST.equals(ywId)) {
                returnDomain = service.gzhSytzggList(appDomain);
            } else if (AppServiceConstants.YWID_TAX_SHQHDRYQHXXALL.equals(ywId)) {
                returnDomain = service.SjqhGetDryqhxxAll(appDomain);
            } else if (AppServiceConstants.YWID_TAX_WX_YYBSGETYYYXXALL.equals(ywId)) {
                returnDomain = service.YybsGetYyyxxAll(appDomain);
            } else if (AppServiceConstants.YWID_TAX_WX_YYBSFSDXYZM.equals(ywId)) {
                returnDomain = service.yybsFsdxyzm(appDomain);
            } else if (AppServiceConstants.YWID_TAX_WX_YYBSDXYZMJY.equals(ywId)) {
                returnDomain = service.yybsDxyzmxy(appDomain);
            } else if (AppServiceConstants.YWID_TAX_WX_YYBSCXLSYYXX.equals(ywId)) {
                returnDomain = service.yybsCxlsyyqhxx(appDomain);
            } else if (AppServiceConstants.YWID_TAX_WX_SJQHGETDAYQHTJ.equals(ywId)) {
                returnDomain = service.SjqhGetDayQhtj(appDomain);
            } else if (AppServiceConstants.YWID_TAX_WX_YYBSDAYYYQHTJ.equals(ywId)) {
                returnDomain = service.YybsDayYyqhtj(appDomain);
            } else if (AppServiceConstants.YWID_TAX_WX_SJQHPUTQHXX.equals(ywId)) {
                returnDomain = service.SjqhPutqhxx(appDomain);
            } else if (AppServiceConstants.YWID_TAX_WX_SJQHGETPHXX.equals(ywId)) {
                returnDomain = service.SjqhGetPhxx(appDomain);
            } else if (AppServiceConstants.YWID_TAX_WX_SJQHGETJHLIST.equals(ywId)) {
                returnDomain = service.SjqhGetJhList(appDomain);
            } else if (AppServiceConstants.YWID_TAX_WX_SJQHPJ.equals(ywId)) {
                returnDomain = service.SjqhPj(appDomain);
            }
            if (returnDomain == null) {
                returnDomain = new TaxCommonReturnDomain();
                this.handleException(returnDomain, AppServiceConstants.TAX_APP_ERROR);
                return "doWxAppService";
            }
            ** GOTO lbl209
        }
        catch (Exception e) {
            try {
                errorDomain = this.handleException(e);
                e.printStackTrace();
                this.handleServiceException(returnDomain, errorDomain.getCode(), errorDomain.getMess());
                return "doWxAppService";
lbl209:
                // 2 sources

                if (!AppServiceConstants.TAX_APP_SUCCESS.equals(returnDomain.getCode())) {
                    this.handleServiceException(returnDomain, returnDomain.getCode(), returnDomain.getMess());
                    return "doWxAppService";
                }
                try {
                    this.domain.setRetJson(HstJsonUtil.beanToJson(returnDomain));
                    return "doWxAppService";
                }
                catch (Exception v2) {
                    this.handleException(returnDomain, AppServiceConstants.TAX_BEAN_TO_JSON_ERROR);
                    return "doWxAppService";
                }
            }
            catch (Exception e) {
                errorDomain = this.handleException(e);
                this.handleException(returnDomain, errorDomain.getCode(), errorDomain.getMess());
            }
        }
        return "doWxAppService";
    }

    public String commonHandle(BaseAppServiceDomain appDomain) throws Exception {
        return AppServiceConstants.TAX_APP_SUCCESS;
    }

    public void handleException(TaxCommonReturnDomain returnDomain, String code) throws Exception {
        if (returnDomain == null) {
            returnDomain = new TaxCommonReturnDomain();
        }
        returnDomain.setCode(code);
        String message = this.handleExceptionMessage(returnDomain.getCode());
        returnDomain.setMess(message);
        this.domain.setRetJson(HstJsonUtil.beanToJson(returnDomain));
        if (WebConstants.LOG_KZ_ERRORS.equals("Y")) {
            _logger.error((Object)message);
        }
    }

    public void handleException(TaxCommonReturnDomain returnDomain, String code, String error) throws Exception {
        if (returnDomain == null) {
            returnDomain = new TaxCommonReturnDomain();
        }
        returnDomain.setCode(code);
        String message = this.handleExceptionMessage(returnDomain.getCode());
        if (HstToolsUtil.isNullOrEmpty(error)) {
            returnDomain.setMess(message);
        } else {
            returnDomain.setMess(String.valueOf(message) + error);
        }
        this.domain.setRetJson(HstJsonUtil.beanToJson(returnDomain));
    }

    public void handleServiceException(TaxCommonReturnDomain returnDomain, String code, String error) throws Exception {
        returnDomain.setCode(code);
        String message = this.handleExceptionMessage(returnDomain.getCode());
        if (HstToolsUtil.isNullOrEmpty(error)) {
            returnDomain.setMess(message);
        } else {
            returnDomain.setMess(String.valueOf(message) + error);
        }
        this.domain.setRetJson(HstJsonUtil.beanToJson(returnDomain));
    }

    public String handleExceptionMessage(String code) throws Exception {
        String message = "";
        if (HstToolsUtil.isNullOrEmpty(code)) {
            return message;
        }
        message = AppServiceConstants.TAX_CODE_MESS_MAP.containsKey(code) ? AppServiceConstants.TAX_CODE_MESS_MAP.get(code) : (code.length() <= 2 ? "" : "\u672a\u5b9a\u4e49\u7684\u9519\u8bef\uff01");
        return message;
    }

    @Override
    @Resource(name="taxWxCommonAppServiceImp")
    public void setService(BaseBusinessService service) {
        super.setService(service);
    }

    @Override
    public TaxCommonAppServiceDomain getDomain() {
        if (this.domain == null) {
            this.domain = new TaxCommonAppServiceDomain();
        }
        return this.domain;
    }

    public void setDomain(TaxCommonAppServiceDomain domain) {
        this.domain = domain;
    }
}
