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

import com.hst.common.bo.SzrsSjtb;
import com.hst.framework.common.HstSqlMapClientTemplate;
import com.hst.framework.constants.WebConstants;
import com.hst.framework.util.HstToolsUtil;
import com.hst.taxService.dao.SzrsCommonDao;
import com.hst.taxService.domain.szrs.SwrySzxxDomain;
import com.hst.taxService.domain.szrs.SzrsGzjsDomain;
import com.hst.taxService.domain.szrs.SzrsSjtbDomain;
import com.hst.taxService.domain.szrs.WdsxGztxDomain;
import java.util.HashMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class SzrsCommonDaoImp
implements SzrsCommonDao {
    @Autowired
    private HstSqlMapClientTemplate sqlMapClientTemplate;

    @Override
    public SwrySzxxDomain querySzrsUserxx(String swryDm) throws Exception {
        SwrySzxxDomain domain = null;
        HashMap<String, String> map = new HashMap<String, String>();
        if (HstToolsUtil.isNullOrEmpty(swryDm)) {
            return domain;
        }
        map.put("swryDm", swryDm);
        String tm_user = WebConstants.HST_PROP_MAP.get("hst.SCHEMA_TM");
        map.put("tm_user", tm_user);
        domain = (SwrySzxxDomain)this.sqlMapClientTemplate.queryForObject("querySwrySzsrUserxxBykey", map);
        return domain;
    }

    @Override
    public void updateSzrsSjtb(SzrsSjtbDomain domain) throws Exception {
        if (domain == null) {
            return;
        }
        SzrsSjtb bo = new SzrsSjtb();
        bo.setSjtbrwXh(domain.getSjtbrwXh());
        bo.setTbbz(domain.getTbbz());
        bo.setTbsj(domain.getTbsj());
        bo.setSzrsYwid(HstToolsUtil.isNullOrEmpty(domain.getSzrsYwid()) ? "" : domain.getSzrsYwid());
        if (HstToolsUtil.isNullOrEmpty(domain.getErrMess())) {
            bo.setErrMess("");
        } else {
            bo.setErrMess(domain.getErrMess().replaceAll("%", "%25"));
        }
        String tm_user = WebConstants.HST_PROP_MAP.get("hst.SCHEMA_TM");
        bo.setTm_user(tm_user);
        this.sqlMapClientTemplate.update("updateSzrsSjtbByKey", bo);
    }

    @Override
    public SzrsGzjsDomain querySzrsGzjsByKey(String rzdjXh) throws Exception {
        SzrsGzjsDomain domain = null;
        if (HstToolsUtil.isNullOrEmpty(rzdjXh)) {
            return domain;
        }
        HashMap<String, String> map = new HashMap<String, String>();
        map.put("rzdjXh", rzdjXh);
        String tm_user = WebConstants.HST_PROP_MAP.get("hst.SCHEMA_TM");
        map.put("tm_user", tm_user);
        domain = (SzrsGzjsDomain)this.sqlMapClientTemplate.queryForObject("querySdsxRzByKey", map);
        return domain;
    }

    @Override
    public void insertGztx(WdsxGztxDomain domain) throws Exception {
        if (domain == null) {
            return;
        }
        if (HstToolsUtil.isNullOrEmpty(domain.getTxnr())) {
            domain.setTxnr("");
        } else {
            domain.setTxnr(domain.getTxnr().replaceAll("%", "%25"));
        }
        String tm_user = WebConstants.HST_PROP_MAP.get("hst.SCHEMA_TM");
        domain.setTm_user(tm_user);
        this.sqlMapClientTemplate.insert("insertWdsxGztx", domain);
    }

    @Override
    public void sjtSuncessHxcl(SzrsSjtbDomain domain) throws Exception {
        if (domain == null) {
            return;
        }
        HashMap<String, String> map = new HashMap<String, String>();
        map.put("sjtbrwXh", domain.getSjtbrwXh());
        String tm_user = WebConstants.HST_PROP_MAP.get("hst.SCHEMA_TM");
        map.put("tm_user", tm_user);
        this.sqlMapClientTemplate.queryForObject("sjtbSuncessHxcl", map);
    }
}
