/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  javax.annotation.Resource
 *  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.framework.constants.AppServiceConstants;
import com.hst.framework.constants.WebConstants;
import com.hst.framework.util.HstToolsUtil;
import com.hst.taxService.action.TaxWxCommonAppAction;
import com.hst.taxService.service.TaxWxQttyCommonAppService;
import javax.annotation.Resource;
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/taxQttyCommonApp", results={@Result(name="doQttyService", type="json")})
public class TaxQttyCommonAppAction
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 doQttyService() throws Exception {
        service = (TaxWxQttyCommonAppService)this.getService();
        appDomain = new BaseAppServiceDomain();
        returnDomain = new TaxCommonReturnDomain();
        errorDomain = null;
        ywId = this.getDomain().getYwId();
        try {
            appDomain = DomainUtil.getAppServiceDomain(ywId, this.getDomain().getParmJson());
            if (appDomain == null) {
                this.handleException(returnDomain, AppServiceConstants.TAX_JSONPARSE_ERROR);
                return "doQttyService";
            }
        }
        catch (Exception v0) {
            this.handleException(returnDomain, AppServiceConstants.TAX_JSONPARSE_ERROR);
            return "doQttyService";
        }
        try {
            if (AppServiceConstants.YWID_TAX_QTTY_EMSYDXXCX.equals(ywId)) {
                returnDomain = service.doEmsYdxxcx(appDomain);
            } else if (AppServiceConstants.YWID_TAX_QTTY_EMSYDGX.equals(ywId)) {
                returnDomain = service.doEmsYdgx(appDomain);
            } else if (AppServiceConstants.YWID_TAX_QTTY_SMZZSWJGJBXX.equals(ywId)) {
                returnDomain = service.doSmzzSwjgJbxx(appDomain);
            } else if (AppServiceConstants.YWID_TAX_QTTY_SMZZSWJGYYXT.equals(ywId)) {
                returnDomain = service.doSmzzSwjgYyxt(appDomain);
            } else if (AppServiceConstants.YWID_TAX_QTTY_SMZZBSYNSRXX.equals(ywId)) {
                returnDomain = service.doSmzzBsyNsrxx(appDomain, this.domain);
            } else if (AppServiceConstants.YWID_TAX_QTTY_SMZZBSYLOGINLOG.equals(ywId)) {
                returnDomain = service.doSmzzBsyLoginLog(appDomain);
            } else if (AppServiceConstants.YWID_TAX_QTTY_SMZZBSYLOGOUTLOG.equals(ywId)) {
                returnDomain = service.doSmzzBsyLogoutLog(appDomain);
            }
            if (returnDomain == null) {
                returnDomain = new TaxCommonReturnDomain();
                this.handleException(returnDomain, AppServiceConstants.TAX_APP_ERROR);
                return "doQttyService";
            }
            ** GOTO lbl48
        }
        catch (Exception e) {
            try {
                errorDomain = this.handleException(e);
                e.printStackTrace();
                this.handleServiceException(returnDomain, errorDomain.getCode(), errorDomain.getMess());
                return "doQttyService";
lbl48:
                // 1 sources

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

    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="taxWxQttyAppCommonServiceImp")
    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;
    }
}
