/*
 * 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.FwhZxzcZxwj;
import com.hst.framework.common.HstSqlMapClientTemplate;
import com.hst.framework.constants.WebConstants;
import com.hst.framework.util.HstEncodeUtil;
import com.hst.taxService.pageProcessor.dao.TaxWxfwZxwjDao;
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 TaxWxfwZxwjDaoImp
implements TaxWxfwZxwjDao {
    @Autowired
    private HstSqlMapClientTemplate ssglSqlMapClientTemplate;

    @Override
    @Transactional(propagation=Propagation.REQUIRED, value="myTransactionManager_Ssgl")
    public void saveWxYhxx(FwhZxzcZxwj bo) throws Exception {
        if (this.getDomainByWjh(bo.getWjh()) == 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("insertFwhZxzcZxwj", bo);
        }
    }

    public FwhZxzcZxwj getDomainByWjh(String wjh) throws Exception {
        HashMap<String, String> map = new HashMap<String, String>();
        map.put("wjh", HstEncodeUtil.GBK2ISO(wjh));
        String databaseUsername = WebConstants.HST_PROP_MAP.get("hst.SCHEMA_TM");
        map.put("databaseUsername", databaseUsername);
        return (FwhZxzcZxwj)this.ssglSqlMapClientTemplate.queryForObject("selectFwhZxzcZxwjByWjh", map);
    }
}
