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

import com.hst.common.bo.FwhZxzcZcjd;
import com.hst.framework.common.HstSqlMapClientTemplate;
import com.hst.framework.constants.WebConstants;
import com.hst.framework.util.HstEncodeUtil;
import com.hst.taxService.pageProcessor.dao.TaxWxfwZcjdDao;
import java.util.HashMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Repository
public class TaxWxfwZcjdDaoImp
implements TaxWxfwZcjdDao {
    @Autowired
    private HstSqlMapClientTemplate ssglSqlMapClientTemplate;

    @Override
    @Transactional(propagation=Propagation.REQUIRED, value="myTransactionManager_Ssgl")
    public void saveWxYhxx(FwhZxzcZcjd bo) throws Exception {
        if (this.getDomainByWBt(bo.getBt()) == null) {
            String databaseUsername = WebConstants.HST_PROP_MAP.get("hst.SCHEMA_TM");
            bo.setDatabaseUsername(databaseUsername);
            bo.setYxbz("Y");
            bo.setNr(bo.getNr().replaceAll("%", "%25"));
            this.ssglSqlMapClientTemplate.insert("insertFwhZxzcZcjd", bo);
        }
    }

    public FwhZxzcZcjd getDomainByWBt(String bt) throws Exception {
        HashMap<String, String> map = new HashMap<String, String>();
        map.put("bt", HstEncodeUtil.GBK2ISO(bt));
        String databaseUsername = WebConstants.HST_PROP_MAP.get("hst.SCHEMA_TM");
        map.put("databaseUsername", databaseUsername);
        return (FwhZxzcZcjd)this.ssglSqlMapClientTemplate.queryForObject("selectFwhZxzcZcjdByBt", map);
    }
}
