/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.google.gson.Gson
 *  org.apache.axis.client.Call
 *  org.apache.axis.client.Service
 *  org.springframework.stereotype.Service
 */
package com.hst.taxService.service.imp;

import com.google.gson.Gson;
import com.hst.common.domain.BaseAppServiceDomain;
import com.hst.common.domain.TaxCommonReturnDomain;
import com.hst.common.service.imp.BaseBusinessServiceImp;
import com.hst.framework.constants.WebConstants;
import com.hst.framework.dao.BaseDao;
import com.hst.framework.util.HstToolsUtil;
import com.hst.taxService.dao.imp.DzswjCommonDaoImp;
import com.hst.taxService.domain.zjzk.ZjzkDxSendItemDomain;
import com.hst.taxService.domain.zjzk.ZjzkDxSendReqDomain;
import com.hst.taxService.domain.zjzk.ZjzkDxSendRequestDomain;
import com.hst.taxService.domain.zjzk.ZjzkResponseDomain;
import com.hst.taxService.domain.zjzk.ZjzkYzpsCxslxxAppDoamin;
import com.hst.taxService.domain.zjzk.ZjzkYzpsMdwhAppDoamin;
import com.hst.taxService.service.ZjzkCommonService;
import java.net.URL;
import java.util.ArrayList;
import javax.xml.namespace.QName;
import org.apache.axis.client.Call;
import org.springframework.stereotype.Service;

@Service
public class ZjzkCommonServiceImp
extends BaseBusinessServiceImp
implements ZjzkCommonService {
    private BaseDao dao;

    @Override
    public TaxCommonReturnDomain dxsend(BaseAppServiceDomain baseDomain) throws Exception {
        ZjzkDxSendRequestDomain request = (ZjzkDxSendRequestDomain)baseDomain;
        TaxCommonReturnDomain response = new TaxCommonReturnDomain();
        Call call = null;
        org.apache.axis.client.Service service = null;
        ZjzkDxSendReqDomain domain = null;
        ArrayList<ZjzkDxSendItemDomain> xxnr = null;
        ZjzkDxSendItemDomain item = null;
        String data = null;
        String strResult = "";
        Gson gson = null;
        response.setCode("00");
        if (HstToolsUtil.isNullOrEmpty(request.getSjhm())) {
            _logger.error((Object)"\u4f20\u5165\u624b\u673a\u53f7\u7801\u4e3a\u7a7a\uff0c\u8bf7\u60a8\u68c0\u67e5\uff01");
            response.setCode("01");
            response.setMess("\u4f20\u5165\u624b\u673a\u53f7\u7801\u4e3a\u7a7a\uff0c\u8bf7\u60a8\u68c0\u67e5\uff01");
            return response;
        }
        if (HstToolsUtil.isNullOrEmpty(request.getTsnr())) {
            _logger.error((Object)"\u4f20\u5165\u77ed\u4fe1\u5185\u5bb9\u4e3a\u7a7a\uff0c\u8bf7\u60a8\u68c0\u67e5\uff01");
            response.setCode("01");
            response.setMess("\u4f20\u5165\u77ed\u4fe1\u5185\u5bb9\u4e3a\u7a7a\uff0c\u8bf7\u60a8\u68c0\u67e5\uff01");
            return response;
        }
        if (HstToolsUtil.isNullOrEmpty(request.getType())) {
            request.setType("112");
        }
        if (HstToolsUtil.isNullOrEmpty(request.getXxlx())) {
            request.setXxlx("112");
        }
        try {
            String endpoint = WebConstants.HST_PROP_MAP.get("hst.ZJZK_DX_URL");
            service = new org.apache.axis.client.Service();
            call = (Call)service.createCall();
            call.setOperationName(new QName("server", "getData"));
            call.setTargetEndpointAddress(new URL(endpoint));
            domain = new ZjzkDxSendReqDomain();
            domain.setType(request.getType());
            xxnr = new ArrayList<ZjzkDxSendItemDomain>();
            item = new ZjzkDxSendItemDomain();
            item.setSjhm(request.getSjhm());
            item.setTsnr(request.getTsnr());
            item.setXxlx(request.getXxlx());
            xxnr.add(item);
            domain.setXxnr(xxnr);
            gson = new Gson();
            data = gson.toJson((Object)domain);
            strResult = (String)call.invoke(new Object[]{data});
            if (HstToolsUtil.isNullOrEmpty(strResult)) {
                _logger.error((Object)"\u8c03\u7528\u77ed\u4fe1\u63a5\u53e3\u8fd4\u56de\u4e3a\u7a7a\uff0c\u8bf7\u60a8\u68c0\u67e5\uff01");
                response.setCode("01");
                response.setMess("\u8c03\u7528\u77ed\u4fe1\u63a5\u53e3\u8fd4\u56de\u4e3a\u7a7a\uff0c\u8bf7\u60a8\u68c0\u67e5\uff01");
                TaxCommonReturnDomain taxCommonReturnDomain = response;
                return taxCommonReturnDomain;
            }
            ZjzkResponseDomain res = (ZjzkResponseDomain)gson.fromJson(strResult, ZjzkResponseDomain.class);
            if (!"00".equals(res.getReturncode())) {
                response.setCode("01");
                response.setMess(res.getReturnmessage());
                TaxCommonReturnDomain taxCommonReturnDomain = response;
                return taxCommonReturnDomain;
            }
            try {
                response.setMess("\u53d1\u9001\u6210\u529f!");
            }
            catch (Exception e) {
                e.getStackTrace();
                _logger.error((Object)("\u8c03\u7528\u77ed\u4fe1\u63a5\u53e3\u62a5\u9519\uff1a" + e.toString()));
                response.setCode("01");
                response.setMess("\u8c03\u7528\u77ed\u4fe1\u63a5\u53e3\u62a5\u9519\uff1a" + e.toString());
            }
        }
        finally {
            call = null;
            service = null;
            strResult = null;
            gson = null;
            domain = null;
            item = null;
            xxnr = null;
        }
        return response;
    }

    @Override
    public TaxCommonReturnDomain yzpsMdwh(ZjzkYzpsMdwhAppDoamin appDoamin) throws Exception {
        return ((DzswjCommonDaoImp)this.getDao("dzswjCommonDaoImp")).yzpsMdwh(appDoamin);
    }

    @Override
    public TaxCommonReturnDomain yzpsCxslxx(ZjzkYzpsCxslxxAppDoamin appDoamin) throws Exception {
        return ((DzswjCommonDaoImp)this.getDao("dzswjCommonDaoImp")).yzpsCxslxx(appDoamin);
    }

    public BaseDao getDao(String daoName) {
        this.dao = (BaseDao)WebConstants.WEB_APP_CONTEXT.getBean(daoName);
        return this.dao;
    }
}
