/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.google.gson.Gson
 *  org.apache.commons.beanutils.BeanUtils
 *  org.apache.http.HttpEntity
 *  org.apache.http.client.ClientProtocolException
 *  org.apache.http.client.methods.CloseableHttpResponse
 *  org.apache.http.client.methods.HttpPost
 *  org.apache.http.client.methods.HttpUriRequest
 *  org.apache.http.entity.StringEntity
 *  org.apache.http.impl.client.CloseableHttpClient
 *  org.apache.http.impl.client.HttpClients
 *  org.apache.http.util.EntityUtils
 *  org.springframework.beans.factory.annotation.Autowired
 *  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.common.util.HstWxServiceUtil;
import com.hst.framework.constants.WebConstants;
import com.hst.framework.util.HstDateUtil;
import com.hst.framework.util.HstToolsUtil;
import com.hst.taxService.dao.TaxBsdtCommonDao;
import com.hst.taxService.domain.bsdt.BsdtDmListRequestDomain;
import com.hst.taxService.domain.bsdt.BsdtLoginRequestDomain;
import com.hst.taxService.domain.bsdt.BsdtPwdResetRequestDomain;
import com.hst.taxService.domain.bsdt.DkfpFpkjRequestDomain;
import com.hst.taxService.domain.bsdt.DkfpFpkjResponseDomain;
import com.hst.taxService.domain.bsdt.DkfpFpkjcx2Domain;
import com.hst.taxService.domain.bsdt.DkfpFpkjcxDomain;
import com.hst.taxService.domain.bsdt.DkfpPubHzkjxxRequestDomain;
import com.hst.taxService.domain.bsdt.DkfpPubImportRequestDomain;
import com.hst.taxService.domain.bsdt.DkfpPubImportResponseDomain;
import com.hst.taxService.domain.bsdt.DkfpSskkRequestDomain;
import com.hst.taxService.domain.bsdt.DkfpSskkResponseDomain;
import com.hst.taxService.domain.bsdt.DkfpSskkcxDomain;
import com.hst.taxService.domain.bsdt.DkfpUpdateZrrDjxhRequestDomain;
import com.hst.taxService.domain.bsdt.DkfpZzsPtfpImportRequestDomain;
import com.hst.taxService.domain.bsdt.DkfpZzsPtfpImportResponseDomain;
import com.hst.taxService.domain.bsdt.DkfpZzsPtfpcxDomain;
import com.hst.taxService.domain.bsdt.DkfpZzsZyfpImportRequestDomain;
import com.hst.taxService.domain.bsdt.DkfpZzsZyfpImportResponseDomain;
import com.hst.taxService.domain.bsdt.DkfpZzsZyfpcxDomain;
import com.hst.taxService.domain.bsdt.DkfpsqxxcxDomain;
import com.hst.taxService.domain.bsdt.WjzImportRequestDomain;
import com.hst.taxService.domain.bsdt.WjzImportResponseDomain;
import com.hst.taxService.domain.bsdt.WjzdrcxDomain;
import com.hst.taxService.domain.bsdt.WsgpFpyjRequestDomain;
import com.hst.taxService.domain.bsdt.WsgpFpyjResponseDomain;
import com.hst.taxService.domain.bsdt.WsgpFpyjcxDomain;
import com.hst.taxService.domain.gt3.HXZGFpdkSfmxGridlbDomain;
import com.hst.taxService.domain.gt3.HXZGFpdkSqVODomain;
import com.hst.taxService.domain.gt3.HXZGFpdkZzsfpHlmxGridlbDomain;
import com.hst.taxService.domain.gt3.HXZGFpdkZzsfpVODomain;
import com.hst.taxService.domain.gt3.HXZGFpdkZzsptfpHlmxGridlbDomain;
import com.hst.taxService.domain.gt3.HXZGFpdkZzsptfpVODomain;
import com.hst.taxService.domain.gt3.HxzgDjCxNsrSfzxxRequestDomain;
import com.hst.taxService.domain.gt3.HxzgDjCxNsrSfzxxResponseDomain;
import com.hst.taxService.domain.gt3.HxzgDjZrrjjDjRequestDomain;
import com.hst.taxService.domain.gt3.HxzgDjZrrjjDjResponseDomain;
import com.hst.taxService.domain.gt3.HxzgFpDkfpkjxxRequestDomain;
import com.hst.taxService.domain.gt3.HxzgFpDksqzzsSaveRequestDomain;
import com.hst.taxService.domain.gt3.HxzgFpDksqzzsSaveResponseDomain;
import com.hst.taxService.domain.gt3.HxzgFpDksqzzsptfpSaveRequestDomain;
import com.hst.taxService.domain.gt3.HxzgFpDksqzzsptfpSaveResponseDomain;
import com.hst.taxService.domain.gt3.HxzgFpFpyjjcyqkMxVOListDomain;
import com.hst.taxService.domain.gt3.HxzgFpFpyjjxxSaveRequestDomain;
import com.hst.taxService.domain.gt3.HxzgFpFpyjjxxSaveResponseDomain;
import com.hst.taxService.domain.gt3.HxzgZmWcjyhdssglzmsqbxxSaveRequestDomain;
import com.hst.taxService.domain.gt3.HxzgZmWcjyhdssglzmsqbxxSaveResponseDomain;
import com.hst.taxService.domain.gt3.HxzgZmWcjyzmhwxxGridlbDomain;
import com.hst.taxService.domain.gt3.HxzgZsDkfpsskkRequestDomain;
import com.hst.taxService.domain.gt3.HxzgZsDkfpsskkResponseDomain;
import com.hst.taxService.service.Gt3CommonAppService;
import com.hst.taxService.service.TaxBsdtCommonAppService;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.http.HttpEntity;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class TaxBsdtCommonAppServiceImp
extends BaseBusinessServiceImp
implements TaxBsdtCommonAppService {
    @Autowired
    private TaxBsdtCommonDao dao;

    @Override
    public TaxCommonReturnDomain wjzImport(BaseAppServiceDomain appDomain) throws Exception {
        WjzImportRequestDomain domain = (WjzImportRequestDomain)appDomain;
        WjzImportResponseDomain response = new WjzImportResponseDomain();
        List<WjzdrcxDomain> dataList = this.dao.wjzdrcx(domain, response);
        if (!"00".equals(response.getCode())) {
            return response;
        }
        if (dataList == null || dataList.isEmpty()) {
            response.setCode("01");
            response.setMess("\u65e0\u6570\u636e\uff0c\u8bf7\u68c0\u67e5!");
            return response;
        }
        HxzgZmWcjyhdssglzmsqbxxSaveRequestDomain wjzRequest = new HxzgZmWcjyhdssglzmsqbxxSaveRequestDomain();
        WjzdrcxDomain drcxDomain = dataList.get(0);
        BeanUtils.copyProperties((Object)wjzRequest, (Object)drcxDomain);
        HxzgZmWcjyzmhwxxGridlbDomain gridlb = null;
        for (WjzdrcxDomain dom : dataList) {
            gridlb = new HxzgZmWcjyzmhwxxGridlbDomain();
            BeanUtils.copyProperties((Object)gridlb, (Object)dom);
            wjzRequest.getDataList().add(gridlb);
        }
        wjzRequest.setSwdjdswjgyj(domain.getSwdjdyj());
        wjzRequest.setJbr(domain.getJbr());
        wjzRequest.setFzr(domain.getFzr());
        wjzRequest.setSwjglxdh(domain.getSwjglxdh());
        Gt3CommonAppService gt3Service = this.getGt3Service();
        HxzgZmWcjyhdssglzmsqbxxSaveResponseDomain wjzResponse = (HxzgZmWcjyhdssglzmsqbxxSaveResponseDomain)gt3Service.hxzgZmWcjyhdssglzmsqbxxSave(wjzRequest);
        if (!"00".equals(wjzResponse.getCode())) {
            response.setCode(wjzResponse.getCode());
            response.setMess(wjzResponse.getMess());
            return response;
        }
        domain.setWjzbm(wjzResponse.getWcjyhdssglzmbh());
        this.dao.wjzdrhxcl(domain, response);
        return response;
    }

    @Override
    public TaxCommonReturnDomain dkfpZzsZyfpImport(BaseAppServiceDomain appDomain) throws Exception {
        DkfpZzsZyfpImportRequestDomain domain = (DkfpZzsZyfpImportRequestDomain)appDomain;
        DkfpZzsZyfpImportResponseDomain response = new DkfpZzsZyfpImportResponseDomain();
        List<DkfpZzsZyfpcxDomain> dataList = this.dao.dkfpZzsZyfpcx(domain, response);
        if (!"00".equals(response.getCode())) {
            return response;
        }
        if (dataList == null || dataList.isEmpty()) {
            response.setCode("01");
            response.setMess("\u65e0\u6570\u636e\uff0c\u8bf7\u68c0\u67e5!");
            return response;
        }
        HxzgFpDksqzzsSaveRequestDomain dkfpZzsZyfpRequest = new HxzgFpDksqzzsSaveRequestDomain();
        DkfpZzsZyfpcxDomain dkfpZzsZyfpcxDomain = dataList.get(0);
        HXZGFpdkSqVODomain fpdkSqVO = new HXZGFpdkSqVODomain();
        HXZGFpdkZzsfpVODomain fpdkZzsfpVO = new HXZGFpdkZzsfpVODomain();
        BeanUtils.copyProperties((Object)dkfpZzsZyfpRequest, (Object)dkfpZzsZyfpcxDomain);
        BeanUtils.copyProperties((Object)fpdkSqVO, (Object)dkfpZzsZyfpcxDomain);
        BeanUtils.copyProperties((Object)fpdkZzsfpVO, (Object)dkfpZzsZyfpcxDomain);
        fpdkZzsfpVO.setBz(dkfpZzsZyfpcxDomain.getBz2());
        fpdkZzsfpVO.setZspmDm(dkfpZzsZyfpcxDomain.getZspmDm2());
        dkfpZzsZyfpRequest.setFpdkSqVO(fpdkSqVO);
        dkfpZzsZyfpRequest.setFpdkZzsfpVO(fpdkZzsfpVO);
        HXZGFpdkSfmxGridlbDomain fpdkSfmxGridlb = new HXZGFpdkSfmxGridlbDomain();
        BeanUtils.copyProperties((Object)fpdkSfmxGridlb, (Object)dkfpZzsZyfpcxDomain);
        fpdkSfmxGridlb.setHyDm(dkfpZzsZyfpcxDomain.getHyDm2());
        fpdkSfmxGridlb.setYbsfe(dkfpZzsZyfpcxDomain.getYbsfe2());
        dkfpZzsZyfpRequest.getFpdkSfmxGridlb().add(fpdkSfmxGridlb);
        HXZGFpdkZzsfpHlmxGridlbDomain fpdkZzsfpHlmxGridlb = null;
        for (DkfpZzsZyfpcxDomain dom : dataList) {
            fpdkZzsfpHlmxGridlb = new HXZGFpdkZzsfpHlmxGridlbDomain();
            BeanUtils.copyProperties((Object)fpdkZzsfpHlmxGridlb, (Object)dom);
            dkfpZzsZyfpRequest.getFpdkZzsfpHlmxGridlb().add(fpdkZzsfpHlmxGridlb);
        }
        Gt3CommonAppService gt3Service = this.getGt3Service();
        HxzgFpDksqzzsSaveResponseDomain dksqzzsSaveResponse = (HxzgFpDksqzzsSaveResponseDomain)gt3Service.hxzgFpDksqzzsSave(dkfpZzsZyfpRequest);
        if (!"00".equals(dksqzzsSaveResponse.getCode())) {
            response.setCode(dksqzzsSaveResponse.getCode());
            response.setMess(dksqzzsSaveResponse.getMess());
            return response;
        }
        domain.setDksquuid(dksqzzsSaveResponse.getDksquuid());
        this.dao.dkfpZzsZyfphxcl(domain, response);
        return response;
    }

    @Override
    public TaxCommonReturnDomain dkfpZzsPtfpImport(BaseAppServiceDomain appDomain) throws Exception {
        DkfpZzsPtfpImportRequestDomain domain = (DkfpZzsPtfpImportRequestDomain)appDomain;
        DkfpZzsPtfpImportResponseDomain response = new DkfpZzsPtfpImportResponseDomain();
        List<DkfpZzsPtfpcxDomain> dataList = this.dao.dkfpZzsPtfpcx(domain, response);
        if (!"00".equals(response.getCode())) {
            return response;
        }
        if (dataList == null || dataList.isEmpty()) {
            response.setCode("01");
            response.setMess("\u65e0\u6570\u636e\uff0c\u8bf7\u68c0\u67e5!");
            return response;
        }
        HxzgFpDksqzzsptfpSaveRequestDomain dkfpZzsPtfpRequest = new HxzgFpDksqzzsptfpSaveRequestDomain();
        DkfpZzsPtfpcxDomain dkfpZzsPtfpcxDomain = dataList.get(0);
        HXZGFpdkSqVODomain fpdkSqVO = new HXZGFpdkSqVODomain();
        HXZGFpdkZzsptfpVODomain fpdkZzsptfpVO = new HXZGFpdkZzsptfpVODomain();
        BeanUtils.copyProperties((Object)dkfpZzsPtfpRequest, (Object)dkfpZzsPtfpcxDomain);
        BeanUtils.copyProperties((Object)fpdkSqVO, (Object)dkfpZzsPtfpcxDomain);
        BeanUtils.copyProperties((Object)fpdkZzsptfpVO, (Object)dkfpZzsPtfpcxDomain);
        fpdkZzsptfpVO.setBz(dkfpZzsPtfpcxDomain.getBz3());
        dkfpZzsPtfpRequest.setFpdkSqVO(fpdkSqVO);
        dkfpZzsPtfpRequest.setFpdkZzsptfpVO(fpdkZzsptfpVO);
        HXZGFpdkSfmxGridlbDomain fpdkSfmxGridlb = new HXZGFpdkSfmxGridlbDomain();
        BeanUtils.copyProperties((Object)fpdkSfmxGridlb, (Object)dkfpZzsPtfpcxDomain);
        fpdkSfmxGridlb.setBz(dkfpZzsPtfpcxDomain.getBz2());
        fpdkSfmxGridlb.setHyDm(dkfpZzsPtfpcxDomain.getHyDm2());
        fpdkSfmxGridlb.setYbsfe(dkfpZzsPtfpcxDomain.getYbsfe2());
        fpdkSfmxGridlb.setZjsrsfft(dkfpZzsPtfpcxDomain.getZjsrsfft2());
        fpdkSfmxGridlb.setQxq(dkfpZzsPtfpcxDomain.getQxq2());
        fpdkSfmxGridlb.setQxz(dkfpZzsPtfpcxDomain.getQxz2());
        fpdkSfmxGridlb.setSfzczf(dkfpZzsPtfpcxDomain.getSfzczf2());
        dkfpZzsPtfpRequest.getFpdkSfmxGridlb().add(fpdkSfmxGridlb);
        HXZGFpdkZzsptfpHlmxGridlbDomain fpdkZzsptfpHlmxGridlb = null;
        for (DkfpZzsPtfpcxDomain dom : dataList) {
            fpdkZzsptfpHlmxGridlb = new HXZGFpdkZzsptfpHlmxGridlbDomain();
            BeanUtils.copyProperties((Object)fpdkZzsptfpHlmxGridlb, (Object)dom);
            dkfpZzsPtfpRequest.getFpdkZzsptfpHlmxGridlb().add(fpdkZzsptfpHlmxGridlb);
        }
        Gt3CommonAppService gt3Service = this.getGt3Service();
        HxzgFpDksqzzsptfpSaveResponseDomain dksqzzsptfpSaveResponse = (HxzgFpDksqzzsptfpSaveResponseDomain)gt3Service.hxzgFpDksqzzsptfpSave(dkfpZzsPtfpRequest);
        if (!"00".equals(dksqzzsptfpSaveResponse.getCode())) {
            response.setCode(dksqzzsptfpSaveResponse.getCode());
            response.setMess(dksqzzsptfpSaveResponse.getMess());
            return response;
        }
        domain.setDksquuid(dksqzzsptfpSaveResponse.getDksquuid());
        this.dao.dkfpZzsPtfphxcl(domain, response);
        return response;
    }

    @Override
    public TaxCommonReturnDomain wsgpFpyj(BaseAppServiceDomain appDomain) throws Exception {
        WsgpFpyjRequestDomain domain = (WsgpFpyjRequestDomain)appDomain;
        WsgpFpyjResponseDomain response = new WsgpFpyjResponseDomain();
        List<WsgpFpyjcxDomain> dataList = this.dao.wsgpFpyjcx(domain, response);
        if (!"00".equals(response.getCode())) {
            return response;
        }
        if (dataList == null || dataList.isEmpty()) {
            response.setCode("01");
            response.setMess("\u65e0\u6570\u636e\uff0c\u8bf7\u68c0\u67e5!");
            return response;
        }
        HxzgFpFpyjjxxSaveRequestDomain wsgpFpyjRequest = new HxzgFpFpyjjxxSaveRequestDomain();
        WsgpFpyjcxDomain drcxDomain = dataList.get(0);
        BeanUtils.copyProperties((Object)wsgpFpyjRequest, (Object)drcxDomain);
        HxzgFpFpyjjcyqkMxVOListDomain gridlb = null;
        for (WsgpFpyjcxDomain dom : dataList) {
            gridlb = new HxzgFpFpyjjcyqkMxVOListDomain();
            BeanUtils.copyProperties((Object)gridlb, (Object)dom);
            gridlb.setSjgsdq(dom.getSjgsdq2());
            gridlb.setLrrDm(dom.getLrrDm2());
            gridlb.setXgrDm(dom.getXgrDm2());
            wsgpFpyjRequest.getDataList().add(gridlb);
        }
        Gt3CommonAppService gt3Service = this.getGt3Service();
        HxzgFpFpyjjxxSaveResponseDomain wsgpFpyjResponse = (HxzgFpFpyjjxxSaveResponseDomain)gt3Service.hxzgFpFpyjjxxSave(wsgpFpyjRequest);
        if (!"00".equals(wsgpFpyjResponse.getCode())) {
            response.setCode(wsgpFpyjResponse.getCode());
            response.setMess(wsgpFpyjResponse.getMess());
            return response;
        }
        domain.setFpcyuuid(wsgpFpyjResponse.getFpcyuuid());
        this.dao.wsgpFpyjhxcl(domain, response);
        return response;
    }

    @Override
    public TaxCommonReturnDomain dkfpSskk(BaseAppServiceDomain appDomain) throws Exception {
        DkfpSskkRequestDomain domain = (DkfpSskkRequestDomain)appDomain;
        DkfpSskkResponseDomain response = new DkfpSskkResponseDomain();
        List<DkfpSskkcxDomain> dataList = this.dao.dkfpSskkcx(domain, response);
        if (!"00".equals(response.getCode())) {
            return response;
        }
        if (dataList == null || dataList.isEmpty()) {
            response.setCode("01");
            response.setMess("\u65e0\u6570\u636e\uff0c\u8bf7\u68c0\u67e5!");
        }
        HxzgZsDkfpsskkRequestDomain dkfpSskkRequest = new HxzgZsDkfpsskkRequestDomain();
        DkfpSskkcxDomain drcxDomain = dataList.get(0);
        BeanUtils.copyProperties((Object)dkfpSskkRequest, (Object)drcxDomain);
        Gt3CommonAppService gt3Service = this.getGt3Service();
        HxzgZsDkfpsskkResponseDomain dkfpSskkResponse = (HxzgZsDkfpsskkResponseDomain)gt3Service.hxzgZsDkfpsskk(dkfpSskkRequest);
        if (!"00".equals(dkfpSskkResponse.getCode())) {
            response.setCode(dkfpSskkResponse.getCode());
            response.setMess(dkfpSskkResponse.getMess());
            return response;
        }
        domain.setDzsphm(dkfpSskkResponse.getDzsphm());
        this.dao.dkfpSskkhxcl(domain, response);
        response.setDzsphm(dkfpSskkResponse.getDzsphm());
        return response;
    }

    @Override
    public TaxCommonReturnDomain dkfpFpkj(BaseAppServiceDomain appDomain) throws Exception {
        DkfpFpkjRequestDomain domain = (DkfpFpkjRequestDomain)appDomain;
        DkfpFpkjResponseDomain response = new DkfpFpkjResponseDomain();
        if ("Y".equals(WebConstants.BSPT_8406_KZ)) {
            List<DkfpFpkjcx2Domain> dataList = this.dao.dkfpFpkjcx2(domain, response);
            if (!"00".equals(response.getCode())) {
                return response;
            }
            if (dataList == null || dataList.isEmpty()) {
                response.setCode("01");
                response.setMess("\u65e0\u6570\u636e\uff0c\u8bf7\u68c0\u67e5!");
                return response;
            }
            DkfpFpkjcx2Domain req = dataList.get(0);
            req.setPwd(domain.getPwd());
            req.setUser_name(domain.getSlrDm());
            Gson gson = new Gson();
            Map<String, String> resMap = TaxBsdtCommonAppServiceImp.sendMess(gson.toJson((Object)req));
            if (!"00".equals(resMap.get("code"))) {
                response.setCode(resMap.get("code"));
                response.setMess(resMap.get("mess"));
                return response;
            }
            DkfpFpkjcx2Domain resDom = (DkfpFpkjcx2Domain)gson.fromJson(resMap.get("mess"), DkfpFpkjcx2Domain.class);
            if (resDom == null) {
                response.setCode("01");
                response.setMess("\u8c03\u7528\u5931\u8d25");
                return response;
            }
            if (!"00".equals(resDom.getRet_code())) {
                response.setCode(resDom.getRet_code());
                response.setMess(resDom.getRet_msg());
                return response;
            }
            domain.setFpzlDm(req.getFpzlDm());
            domain.setFpdm(req.getFpDm());
            domain.setFphm(req.getFphm());
        } else {
            List<DkfpFpkjcxDomain> dataList = this.dao.dkfpFpkjcx(domain, response);
            if (!"00".equals(response.getCode())) {
                return response;
            }
            if (dataList == null || dataList.isEmpty()) {
                response.setCode("01");
                response.setMess("\u65e0\u6570\u636e\uff0c\u8bf7\u68c0\u67e5!");
                return response;
            }
            HxzgFpDkfpkjxxRequestDomain dkfpFpkjRequest = new HxzgFpDkfpkjxxRequestDomain();
            DkfpFpkjcxDomain drcxDomain = dataList.get(0);
            BeanUtils.copyProperties((Object)dkfpFpkjRequest, (Object)drcxDomain);
            Gt3CommonAppService gt3Service = this.getGt3Service();
            TaxCommonReturnDomain dkfpFpkjResponse = gt3Service.hxzgFpKjdkfp(dkfpFpkjRequest);
            if (!"00".equals(dkfpFpkjResponse.getCode())) {
                response.setCode(dkfpFpkjResponse.getCode());
                response.setMess(dkfpFpkjResponse.getMess());
                return response;
            }
            domain.setFpzlDm(drcxDomain.getFpzlDm());
            domain.setFpdm(drcxDomain.getFpDm());
            domain.setFphm(drcxDomain.getFphm());
        }
        this.dao.dkfpFpkjhxcl(domain, response);
        return response;
    }

    @Override
    public TaxCommonReturnDomain dkfpPubImport(BaseAppServiceDomain appDomain) throws Exception {
        DkfpPubImportRequestDomain domain = (DkfpPubImportRequestDomain)appDomain;
        DkfpPubImportResponseDomain response = new DkfpPubImportResponseDomain();
        DkfpsqxxcxDomain sqdxx = null;
        List<DkfpsqxxcxDomain> dataList = this.dao.dkfpsqxxcx(domain, response);
        if ("00".equals(response.getCode()) && (dataList == null || dataList.isEmpty())) {
            response.setCode("01");
            response.setMess("\u65e0\u6570\u636e\uff0c\u8bf7\u68c0\u67e5!\u7533\u8bf7\u5355\u7f16\u53f7\uff1a" + domain.getDkfpsqdbh());
            return response;
        }
        if ("00".equals(response.getCode())) {
            sqdxx = dataList.get(0);
            if ("1".equals(sqdxx.getDkfpsqlxDm()) || "2".equals(sqdxx.getDkfpsqlxDm()) || "5".equals(sqdxx.getDkfpsqlxDm())) {
                this.zzsZyfpSqxxSave(domain, response, sqdxx);
            } else if ("3".equals(sqdxx.getDkfpsqlxDm())) {
                this.zzsPtfpSqxxSave(domain, response, sqdxx);
            }
        } else if ("01".equals(response.getCode())) {
            sqdxx = dataList.get(0);
            if (HstToolsUtil.isNullOrEmpty(sqdxx.getSfzhm())) {
                response.setCode("01");
                response.setMess("\u81ea\u7136\u4eba\u8eab\u4efd\u8bc1\u4ef6\u53f7\u7801\u4e3a\u7a7a\uff0c\u8bf7\u68c0\u67e5!\u7533\u8bf7\u5355\u7f16\u53f7\uff1a" + domain.getDkfpsqdbh());
                return response;
            }
            HxzgDjZrrjjDjRequestDomain zrrReq = new HxzgDjZrrjjDjRequestDomain();
            zrrReq.setSfzjhm(sqdxx.getSfzhm());
            zrrReq.setXm(sqdxx.getXm());
            String xb = "";
            if (sqdxx.getSfzhm().length() == 15) {
                xb = sqdxx.getSfzhm().substring(13, 14);
            } else if (sqdxx.getSfzhm().length() == 18) {
                xb = sqdxx.getSfzhm().substring(16, 17);
            }
            if ("0".equals(xb) || "2".equals(xb) || "4".equals(xb) || "6".equals(xb) || "8".equals(xb)) {
                zrrReq.setXb("2");
            } else {
                zrrReq.setXb("1");
            }
            zrrReq.setSfzjlxDm("201");
            zrrReq.setGjDm("156");
            zrrReq.setSlrDm("13300shhbs0");
            zrrReq.setSlswjgDm("13300000000");
            zrrReq.setCsrq(HstDateUtil.getCurrentDate());
            Gt3CommonAppService gt3Service = this.getGt3Service();
            HxzgDjZrrjjDjResponseDomain zrrRes = (HxzgDjZrrjjDjResponseDomain)gt3Service.hxzgDjZrrjjDj(zrrReq);
            if (!"00".equals(zrrRes.getCode())) {
                response.setCode(zrrRes.getCode());
                response.setMess(zrrRes.getMess());
                return response;
            }
            DkfpUpdateZrrDjxhRequestDomain zrrUpdate = new DkfpUpdateZrrDjxhRequestDomain();
            zrrUpdate.setWsDjhzXh(sqdxx.getWsdjhzxh());
            zrrUpdate.setDjxh(zrrRes.getDjxh());
            TaxCommonReturnDomain zrrResDomain = this.dkfpUpdateZrrDjxh(zrrUpdate);
            if (!"00".equals(zrrResDomain.getCode())) {
                response.setCode(zrrResDomain.getCode());
                response.setMess(zrrResDomain.getMess());
                return response;
            }
            if ("1".equals(sqdxx.getDkfpsqlxDm()) || "2".equals(sqdxx.getDkfpsqlxDm()) || "5".equals(sqdxx.getDkfpsqlxDm())) {
                this.zzsZyfpSqxxSave(domain, response, sqdxx);
            } else if ("3".equals(sqdxx.getDkfpsqlxDm())) {
                this.zzsPtfpSqxxSave(domain, response, sqdxx);
            }
        } else if ("02".equals(response.getCode())) {
            sqdxx = dataList.get(0);
            response.setCode("00");
            response.setMess("\u5df2\u5bfc\u5165\uff0c\u4e0d\u9700\u8981\u5bfc\u5165\u7533\u8bf7\u5355");
            response.setDksquuid(sqdxx.getDksquuid());
            response.setDkfpsqlxdm(sqdxx.getDkfpsqlxDm());
        } else {
            return response;
        }
        return response;
    }

    @Override
    public TaxCommonReturnDomain dkfpPubHzkjxx(BaseAppServiceDomain appDomain) throws Exception {
        DkfpPubHzkjxxRequestDomain domain = (DkfpPubHzkjxxRequestDomain)appDomain;
        TaxCommonReturnDomain response = new TaxCommonReturnDomain();
        this.dao.dkfpHzkjxx(domain, response);
        return response;
    }

    @Override
    public TaxCommonReturnDomain dkfpUpdateZrrDjxh(BaseAppServiceDomain appDomain) throws Exception {
        DkfpUpdateZrrDjxhRequestDomain domain = (DkfpUpdateZrrDjxhRequestDomain)appDomain;
        TaxCommonReturnDomain response = new TaxCommonReturnDomain();
        this.dao.dkfpUpdateZrrDjxh(domain, response);
        return response;
    }

    @Override
    public TaxCommonReturnDomain BsdtLogin(BaseAppServiceDomain appDomain) throws Exception {
        BsdtLoginRequestDomain domain = (BsdtLoginRequestDomain)appDomain;
        return this.dao.BsdtLogin(domain);
    }

    @Override
    public TaxCommonReturnDomain BstdDmList(BaseAppServiceDomain appDomain) throws Exception {
        BsdtDmListRequestDomain domain = (BsdtDmListRequestDomain)appDomain;
        return this.dao.BsdtDmList(domain);
    }

    @Override
    public TaxCommonReturnDomain BsdtPwdReset(BaseAppServiceDomain appDomain) throws Exception {
        BsdtPwdResetRequestDomain domain = (BsdtPwdResetRequestDomain)appDomain;
        return this.dao.BsdtPwdReset(domain);
    }

    public void zzsPtfpSqxxSave(DkfpPubImportRequestDomain domain, DkfpPubImportResponseDomain response, DkfpsqxxcxDomain sqdxx) throws Exception {
        DkfpZzsPtfpImportRequestDomain zzsptfpReq = new DkfpZzsPtfpImportRequestDomain();
        zzsptfpReq.setWsDjhzXh(sqdxx.getWsdjhzxh());
        zzsptfpReq.setZspmDm(sqdxx.getZspmDm());
        zzsptfpReq.setSlrDm(domain.getSlrDm());
        zzsptfpReq.setCfdrBz("N");
        DkfpZzsPtfpImportResponseDomain zzsptfpRes = (DkfpZzsPtfpImportResponseDomain)this.dkfpZzsPtfpImport(zzsptfpReq);
        if (!"00".equals(zzsptfpRes.getCode())) {
            response.setCode("01");
            response.setMess(zzsptfpRes.getMess());
            return;
        }
        response.setCode("00");
        response.setMess("\u64cd\u4f5c\u6210\u529f\uff01");
        response.setDksquuid(zzsptfpReq.getDksquuid());
        response.setDkfpsqlxdm(sqdxx.getDkfpsqlxDm());
    }

    public void zzsZyfpSqxxSave(DkfpPubImportRequestDomain domain, DkfpPubImportResponseDomain response, DkfpsqxxcxDomain sqdxx) throws Exception {
        DkfpZzsZyfpImportRequestDomain zzszyfpReq = new DkfpZzsZyfpImportRequestDomain();
        zzszyfpReq.setWsDjhzXh(sqdxx.getWsdjhzxh());
        zzszyfpReq.setZspmDm(sqdxx.getZspmDm());
        zzszyfpReq.setSlrDm(domain.getSlrDm());
        zzszyfpReq.setCfdrBz("N");
        DkfpZzsZyfpImportResponseDomain zzszyfpRes = (DkfpZzsZyfpImportResponseDomain)this.dkfpZzsZyfpImport(zzszyfpReq);
        if (!"00".equals(zzszyfpRes.getCode())) {
            response.setCode("01");
            response.setMess(zzszyfpRes.getMess());
            return;
        }
        response.setCode("00");
        response.setMess("\u64cd\u4f5c\u6210\u529f\uff01");
        response.setDksquuid(zzszyfpReq.getDksquuid());
        response.setDkfpsqlxdm(sqdxx.getDkfpsqlxDm());
    }

    public Gt3CommonAppService getGt3Service() {
        return (Gt3CommonAppService)WebConstants.WEB_APP_CONTEXT.getBean("gt3CommonAppServiceImp");
    }

    public static Map<String, String> sendMess(String json) {
        HashMap<String, String> sendResMap = new HashMap<String, String>();
        String url = WebConstants.HST_PROP_MAP.get("hst.G3_DKFP2_FWSK_URL");
        HttpPost httppost = new HttpPost(url);
        String strResult = "";
        CloseableHttpClient httpClient = HttpClients.createDefault();
        try {
            httppost.addHeader("Content-type", "application/x-www-form-urlencoded;charset=gbk");
            httppost.setEntity((HttpEntity)new StringEntity(json, "GBK"));
            CloseableHttpResponse response = httpClient.execute((HttpUriRequest)httppost);
            if (response.getStatusLine().getStatusCode() == 200) {
                strResult = EntityUtils.toString((HttpEntity)response.getEntity());
                sendResMap.put("code", "00");
                sendResMap.put("mess", strResult);
            } else {
                String err = String.valueOf(response.getStatusLine().getStatusCode());
                strResult = String.valueOf(strResult) + "\u8bf7\u6c42\u5931\u8d25\uff0c\u9519\u8bef\u4ee3\u7801\uff1a" + err;
                sendResMap.put("code", "01");
                sendResMap.put("mess", strResult);
            }
        }
        catch (ClientProtocolException e) {
            sendResMap.put("code", "01");
            sendResMap.put("mess", e.toString());
        }
        catch (IOException e) {
            sendResMap.put("code", "01");
            sendResMap.put("mess", e.toString());
        }
        return sendResMap;
    }

    @Override
    public TaxCommonReturnDomain ZspmDmList(BaseAppServiceDomain appDomain) throws Exception {
        HxzgDjCxNsrSfzxxRequestDomain sfzxxReq = (HxzgDjCxNsrSfzxxRequestDomain)appDomain;
        sfzxxReq.setBid("GT3.HxzgDjCxNsrSfzxx");
        HxzgDjCxNsrSfzxxResponseDomain sfzxxRes = HstWxServiceUtil.sendMess(WebConstants.GT3JK_SJ_URL, sfzxxReq, "GT3.HxzgDjCxNsrSfzxx", HxzgDjCxNsrSfzxxResponseDomain.class);
        return sfzxxRes;
    }
}
