/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  org.apache.commons.beanutils.BeanUtils
 *  org.apache.commons.logging.Log
 *  org.apache.commons.logging.LogFactory
 *  org.springframework.beans.factory.annotation.Autowired
 *  org.springframework.stereotype.Repository
 */
package com.hst.taxService.dao.imp;

import com.hst.business.domain.DmbGgDomain;
import com.hst.framework.common.HstGt3SqlMapClientTemplate;
import com.hst.framework.util.HstToolsUtil;
import com.hst.taxService.dao.Gt3CommonDao;
import com.hst.taxService.domain.gt3.DmZspmDomain;
import com.hst.taxService.domain.gt3.HXZGZS_HD_DQDEHD_JGDomain;
import com.hst.taxService.domain.gt3.HxzgDjCxNsrdjxxResponseDomain;
import com.hst.taxService.domain.gt3.HxzgDjCxWbnsrjydbydjxxRequestDomain;
import com.hst.taxService.domain.gt3.HxzgDjNsrjyxxDomain;
import com.hst.taxService.domain.gt3.HxzgDjWbnsrjydbydjxxDomain;
import com.hst.taxService.domain.gt3.HxzgFpCxTdzsbmDjxhDomain;
import com.hst.taxService.domain.gt3.HxzgFpCxTdzsbmDjxhRequestDomain;
import com.hst.taxService.domain.gt3.HxzgFpCxZrrDkfpRequestDomain;
import com.hst.taxService.domain.gt3.HxzgFpCxZrrDkfpResponseDomain;
import com.hst.taxService.domain.gt3.HxzgPzSwrySpjcDomain;
import com.hst.taxService.domain.gt3.HxzgPzSwrySpjcRequestDomain;
import com.hst.taxService.domain.gt3.HxzgSbSbZfRequestDomain;
import com.hst.taxService.domain.gt3.HxzgSbZfYzpzxhRequestDomain;
import com.hst.taxService.domain.gt3.HxzgZrrDjExistsDomain;
import com.hst.taxService.domain.gt3.HxzgZrrDjExistsRequestDomain;
import com.hst.taxService.domain.gt3.HxzgZrrDjExistsResponseDomain;
import com.hst.taxService.domain.gt3.HxzgZsCxRjtsshDomain;
import com.hst.taxService.domain.gt3.HxzgZsCxnNsrdkfpyjxxDomain;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class Gt3CommonDaoImp
implements Gt3CommonDao {
    public static Log _logger = LogFactory.getLog(Gt3CommonDaoImp.class);
    @Autowired
    private HstGt3SqlMapClientTemplate gt3SqlMapClientTemplate;

    @Override
    public HxzgDjNsrjyxxDomain queyrNsrJyxx(String nsrsbh) throws Exception {
        List dataList = new ArrayList();
        HxzgDjNsrjyxxDomain domain = null;
        if (HstToolsUtil.isNullOrEmpty(nsrsbh)) {
            return domain;
        }
        HashMap<String, String> map = new HashMap<String, String>();
        map.put("nsrsbh", nsrsbh);
        dataList = this.gt3SqlMapClientTemplate.queryForList("selectDjNsrxxJyxxByNsrsbh", map);
        if (dataList != null && !dataList.isEmpty()) {
            domain = (HxzgDjNsrjyxxDomain)dataList.get(0);
            domain.setNsrsbh(nsrsbh);
        }
        return domain;
    }

    @Override
    public void queyrNsrQtxx(HxzgDjCxNsrdjxxResponseDomain domain) throws Exception {
        HxzgDjCxNsrdjxxResponseDomain dom = null;
        if (HstToolsUtil.isNullOrEmpty(domain.getDJXH())) {
            return;
        }
        HashMap<String, String> map = new HashMap<String, String>();
        map.put("djxh", domain.getDJXH());
        dom = (HxzgDjCxNsrdjxxResponseDomain)this.gt3SqlMapClientTemplate.queryForObject("selectDjNsrxxQtxxByDjxh", map);
        if (dom != null) {
            domain.setNSRLX(dom.getNSRLX());
            domain.setZGSWRY_MC(dom.getZGSWRY_MC());
            domain.setLRR_MC(dom.getLRR_MC());
            domain.setXGR_MC(dom.getXGR_MC());
        }
        if ((dom = (HxzgDjCxNsrdjxxResponseDomain)this.gt3SqlMapClientTemplate.queryForObject("selectDjNsrxxQtxx2ByDjxh", map)) != null) {
            domain.setCPHM(dom.getCPHM());
            domain.setSGPBZ(dom.getSGPBZ());
        }
    }

    @Override
    public List<HXZGZS_HD_DQDEHD_JGDomain> queyrNsrdqdexx(String djxh) throws Exception {
        ArrayList<HXZGZS_HD_DQDEHD_JGDomain> dataList = new ArrayList();
        HashMap<String, String> map = new HashMap<String, String>();
        map.put("djxh", djxh);
        dataList = this.gt3SqlMapClientTemplate.queryForList("selectNsrDqDexxByDjxh", map);
        return dataList;
    }

    @Override
    public List<HxzgDjWbnsrjydbydjxxDomain> queyrWbnsrjydbydjxx(HxzgDjCxWbnsrjydbydjxxRequestDomain request) throws Exception {
        List dataList = null;
        HashMap<String, String> map = new HashMap<String, String>();
        String swjgLike = this.querySwjgLike(request.getSwjgDm());
        map.put("nsrsbh", request.getNsrsbh());
        map.put("swjgLike", swjgLike);
        map.put("byrqq", request.getByrqq());
        map.put("byrqz", request.getByrqz());
        String wjzbh = "%" + request.getWjzbh() + "%";
        map.put("wjzbh", wjzbh);
        dataList = this.gt3SqlMapClientTemplate.queryForList("selectWbnsrjydbydjBynsrsbh", map);
        return dataList;
    }

    @Override
    public HxzgZsCxnNsrdkfpyjxxDomain queryNsrDkfpYjxx(String djxh, String sssqq, String sssqz) throws Exception {
        HxzgZsCxnNsrdkfpyjxxDomain dom;
        HxzgZsCxnNsrdkfpyjxxDomain domain = null;
        if (HstToolsUtil.isNullOrEmpty(djxh)) {
            return domain;
        }
        HashMap<String, String> map = new HashMap<String, String>();
        map.put("djxh", djxh);
        map.put("sssqq", sssqq);
        map.put("sssqz", sssqz);
        domain = (HxzgZsCxnNsrdkfpyjxxDomain)this.gt3SqlMapClientTemplate.queryForObject("selectNsrDkfpYjxxHwlwByDjxh", map);
        if (domain == null) {
            domain = new HxzgZsCxnNsrdkfpyjxxDomain();
            domain.setKpjeDkfpHwlw("0.00");
            domain.setSeDkfpHwlw("0.00");
        }
        if ((dom = (HxzgZsCxnNsrdkfpyjxxDomain)this.gt3SqlMapClientTemplate.queryForObject("selectNsrDkfpYjxxYsfwByDjxh", map)) != null) {
            domain.setKpjeDkfpYsfw(dom.getKpjeDkfpYsfw());
            domain.setSeDkfpYsfw(dom.getSeDkfpYsfw());
        } else {
            domain.setKpjeDkfpYsfw("0.00");
            domain.setSeDkfpYsfw("0.00");
        }
        if (HstToolsUtil.isNullOrEmpty(domain.getKpjeDkfpHwlw())) {
            domain.setKpjeDkfpHwlw("0.00");
        }
        if (HstToolsUtil.isNullOrEmpty(domain.getSeDkfpHwlw())) {
            domain.setSeDkfpHwlw("0.00");
        }
        if (HstToolsUtil.isNullOrEmpty(domain.getKpjeDkfpYsfw())) {
            domain.setKpjeDkfpYsfw("0.00");
        }
        if (HstToolsUtil.isNullOrEmpty(domain.getSeDkfpYsfw())) {
            domain.setSeDkfpYsfw("0.00");
        }
        return domain;
    }

    @Override
    public HxzgZsCxRjtsshDomain queryRjtssh(String djxh, String sssqq, String sssqz) throws Exception {
        HxzgZsCxRjtsshDomain domain = null;
        if (HstToolsUtil.isNullOrEmpty(djxh)) {
            return domain;
        }
        HashMap<String, String> map = new HashMap<String, String>();
        map.put("djxh", djxh);
        map.put("sssqq", sssqq);
        map.put("sssqz", sssqz);
        domain = new HxzgZsCxRjtsshDomain();
        domain.setAsysljsxse_yb("0.00");
        domain.setAsysljsxse_jzjt("0.00");
        domain.setXxse_jzjt("0.00");
        domain.setJxse_jzjt("0.00");
        domain.setYnsehj_jzjt("0.00");
        domain.setAsysljsxse_jzjt_bnlj("0.00");
        domain.setYnsehj_jzjt_bnlj("0.00");
        domain.setRkse_jzjt("0.00");
        domain.setTsse_bnlj("0.00");
        domain.setQsye("0.00");
        HxzgZsCxRjtsshDomain dom = (HxzgZsCxRjtsshDomain)this.gt3SqlMapClientTemplate.queryForObject("selectRjtsshBysByDjxh", map);
        if (dom != null) {
            domain.setAsysljsxse_yb(this.getNullDouble(dom.getAsysljsxse_yb()));
            domain.setAsysljsxse_jzjt(this.getNullDouble(dom.getAsysljsxse_jzjt()));
            domain.setXxse_jzjt(this.getNullDouble(dom.getXxse_jzjt()));
            domain.setJxse_jzjt(this.getNullDouble(dom.getJxse_jzjt()));
            domain.setYnsehj_jzjt(this.getNullDouble(dom.getYnsehj_jzjt()));
        }
        if ((dom = (HxzgZsCxRjtsshDomain)this.gt3SqlMapClientTemplate.queryForObject("selectRjtsshBnljsByDjxh", map)) != null) {
            domain.setAsysljsxse_jzjt_bnlj(this.getNullDouble(dom.getAsysljsxse_jzjt_bnlj()));
            domain.setYnsehj_jzjt_bnlj(this.getNullDouble(dom.getYnsehj_jzjt_bnlj()));
        }
        if ((dom = (HxzgZsCxRjtsshDomain)this.gt3SqlMapClientTemplate.queryForObject("selectRjtsshRkseByDjxh", map)) != null) {
            domain.setRkse_jzjt(this.getNullDouble(dom.getRkse_jzjt()));
        }
        if ((dom = (HxzgZsCxRjtsshDomain)this.gt3SqlMapClientTemplate.queryForObject("selectRjtsshLjtseByDjxh", map)) != null) {
            domain.setTsse_bnlj(this.getNullDouble(dom.getTsse_bnlj()));
        }
        if ((dom = (HxzgZsCxRjtsshDomain)this.gt3SqlMapClientTemplate.queryForObject("selectRjtsshQseByDjxh", map)) != null) {
            domain.setQsye(this.getNullDouble(dom.getQsye()));
        }
        return domain;
    }

    @Override
    public List<HxzgFpCxTdzsbmDjxhDomain> queyrTdzsbmDjxh(HxzgFpCxTdzsbmDjxhRequestDomain request) throws Exception {
        ArrayList<HxzgFpCxTdzsbmDjxhDomain> dataList = new ArrayList();
        HashMap<String, String> map = new HashMap<String, String>();
        map.put("swryDm", request.getSwryDm());
        dataList = this.gt3SqlMapClientTemplate.queryForList("selectDkfpTdzsbmDjxhBySwryDm", map);
        return dataList;
    }

    @Override
    public List<HxzgPzSwrySpjcDomain> queyrHxzgPzSwrySpjc(HxzgPzSwrySpjcRequestDomain request) throws Exception {
        ArrayList<HxzgPzSwrySpjcDomain> dataList = new ArrayList();
        HashMap<String, String> map = new HashMap<String, String>();
        map.put("swryDm", request.getSwryDm());
        map.put("pzzlDm", request.getPzzlDm());
        dataList = this.gt3SqlMapClientTemplate.queryForList("queyrHxzgPzSwrySpjcBySwryDm", map);
        return dataList;
    }

    @Override
    public void hxzgZrrDjExists(HxzgZrrDjExistsRequestDomain request, HxzgZrrDjExistsResponseDomain response) throws Exception {
        HashMap<String, String> map = new HashMap<String, String>();
        map.put("djxh", request.getDjxh());
        HxzgZrrDjExistsDomain dom = (HxzgZrrDjExistsDomain)this.gt3SqlMapClientTemplate.queryForObject("queryGsywDjzrrByDjxh", map);
        if (dom != null) {
            BeanUtils.copyProperties((Object)response, (Object)dom);
            response.setCode("00");
        } else {
            response.setCode("01");
            response.setMess("\u81ea\u7136\u4eba\u4f5c\u5e9f\u6216\u4e0d\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u767b\u8bb0\u3002");
        }
    }

    public String querySwjgLike(String swjgDm) throws Exception {
        HashMap<String, String> map = new HashMap<String, String>();
        map.put("swjgDm", swjgDm);
        return (String)this.gt3SqlMapClientTemplate.queryForObject("selectSwjgLikeBySwjgDm", map);
    }

    @Override
    public Map<String, String> queryPzzlMap() throws Exception {
        HashMap<String, String> map = new HashMap<String, String>();
        List<DmbGgDomain> dataList = this.queryPzzlList();
        for (DmbGgDomain dom : dataList) {
            map.put(dom.getDm(), dom.getMc());
        }
        return map;
    }

    public List<DmbGgDomain> queryPzzlList() throws Exception {
        return this.gt3SqlMapClientTemplate.queryForList("selectHxzgPzPzzlList");
    }

    @Override
    public Map<String, String> queryPzzgMap() throws Exception {
        HashMap<String, String> map = new HashMap<String, String>();
        List<DmbGgDomain> dataList = this.queryPzzgList();
        for (DmbGgDomain dom : dataList) {
            if (map.containsKey(dom.getDm())) continue;
            map.put(dom.getDm(), dom.getMc());
        }
        return map;
    }

    @Override
    public Map<String, String> queryZsxmMap() throws Exception {
        HashMap<String, String> map = new HashMap<String, String>();
        List<DmbGgDomain> dataList = this.queryZsxmList();
        for (DmbGgDomain dom : dataList) {
            if (map.containsKey(dom.getDm())) continue;
            map.put(dom.getDm(), dom.getMc());
        }
        return map;
    }

    @Override
    public Map<String, DmZspmDomain> queryZspmxxMap() throws Exception {
        HashMap<String, DmZspmDomain> map = new HashMap<String, DmZspmDomain>();
        List<DmZspmDomain> dataList = this.queryZspmList();
        String key = null;
        for (DmZspmDomain dom : dataList) {
            key = String.valueOf(dom.getZsxmDm()) + dom.getZspmDm();
            if (map.containsKey(key)) continue;
            map.put(key, dom);
        }
        return map;
    }

    public List<DmbGgDomain> queryPzzgList() throws Exception {
        return this.gt3SqlMapClientTemplate.queryForList("selectHxzgPzPzzgList");
    }

    public List<DmbGgDomain> queryZsxmList() throws Exception {
        return this.gt3SqlMapClientTemplate.queryForList("selectHxzgDmZsxmList");
    }

    public List<DmZspmDomain> queryZspmList() throws Exception {
        return this.gt3SqlMapClientTemplate.queryForList("selectHxzgDmZspmList");
    }

    @Override
    public HxzgSbSbZfRequestDomain querySbxxByZf(HxzgSbZfYzpzxhRequestDomain domain) throws Exception {
        HashMap<String, String> map = new HashMap<String, String>();
        map.put("yzpzxh", domain.getYzpzxh());
        HxzgSbSbZfRequestDomain dom = (HxzgSbSbZfRequestDomain)this.gt3SqlMapClientTemplate.queryForObject("selectHxsbSbbByYzpzxh", map);
        return dom;
    }

    @Override
    public void queryZrrDkfpqk(HxzgFpCxZrrDkfpRequestDomain request, HxzgFpCxZrrDkfpResponseDomain response) throws Exception {
        HashMap<String, String> map = new HashMap<String, String>();
        map.put("sfzjhm", request.getSfzhm());
        HxzgFpCxZrrDkfpResponseDomain dom = (HxzgFpCxZrrDkfpResponseDomain)this.gt3SqlMapClientTemplate.queryForObject("queryZrrDkfpqkBySfzjhm", map);
        if (dom != null) {
            BeanUtils.copyProperties((Object)response, (Object)dom);
            response.setCode("00");
            if (HstToolsUtil.isNullOrEmpty(response.getYdljcs())) {
                response.setYdljcs("0");
            }
            if (HstToolsUtil.isNullOrEmpty(response.getYdljje())) {
                response.setYdljje("0.00");
            }
            if (HstToolsUtil.isNullOrEmpty(response.getDayljcs())) {
                response.setDayljcs("0");
            }
            if (HstToolsUtil.isNullOrEmpty(response.getDayljje())) {
                response.setDayljje("0.00");
            }
        } else {
            response.setCode("00");
            response.setMess("\u81ea\u7136\u4eba\u4e0d\u5b58\u5728\u4ee3\u5f00\u53d1\u7968\u3002");
            response.setYdljcs("0");
            response.setYdljje("0.00");
            response.setDayljcs("0");
            response.setDayljje("0.00");
        }
    }

    @Override
    public Connection getGt3Conn() throws Exception {
        return this.gt3SqlMapClientTemplate.getDataSource().getConnection();
    }

    public String getNullDouble(String str) {
        if (HstToolsUtil.isNullOrEmpty(str)) {
            return "0.00";
        }
        return str;
    }
}
