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

import com.hst.common.domain.TaxCommonReturnDomain;
import com.hst.framework.common.HstSqlMapClientTemplate;
import com.hst.framework.constants.WebConstants;
import com.hst.framework.dao.BaseDao;
import com.hst.framework.util.HstDateUtil;
import com.hst.framework.util.HstToolsUtil;
import com.hst.taxService.domain.qtty.NsfwZzfwBsyLogDomain;
import com.hst.taxService.domain.qtty.QttySmzzBsyLoginLogAppDomain;
import com.hst.taxService.domain.qtty.QttySmzzBsyLoginLogReturnDomain;
import com.hst.taxService.domain.qtty.QttySmzzBsyLogoutLogAppDomain;
import com.hst.taxService.domain.qtty.QttySmzzBsyLogoutLogReturnDomain;
import com.hst.taxService.domain.qtty.QttySmzzBsyNsrxxReturnDomain;
import com.hst.taxService.domain.qtty.QttySmzzSwjgJbxxAppDomain;
import com.hst.taxService.domain.qtty.QttySmzzSwjgJbxxReturnDomain;
import com.hst.taxService.domain.qtty.QttySmzzSwjgYyxtAppDomain;
import com.hst.taxService.domain.qtty.QttySmzzSwjgYyxtReturnDomain;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import org.apache.commons.beanutils.BeanUtils;
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 TaxQttySmzzAppDaoImp
implements BaseDao {
    @Autowired
    private HstSqlMapClientTemplate sqlMapClientTemplate;

    public TaxCommonReturnDomain doSmzzSwjgJbxx(QttySmzzSwjgJbxxAppDomain domain) throws Exception {
        QttySmzzSwjgJbxxReturnDomain returnDomain = new QttySmzzSwjgJbxxReturnDomain();
        HashMap<String, String> map = new HashMap<String, String>();
        map.put("swjgDm", domain.getSwjgDm());
        returnDomain = (QttySmzzSwjgJbxxReturnDomain)this.sqlMapClientTemplate.queryForObject("queryQttySmzzSwjgJbxx", map);
        if (returnDomain != null) {
            returnDomain.setCode("00");
        } else {
            returnDomain = new QttySmzzSwjgJbxxReturnDomain();
            returnDomain.setCode("01");
            returnDomain.setMess("\u672a\u6ce8\u518c");
        }
        return returnDomain;
    }

    public TaxCommonReturnDomain doSmzzSwjgYyxt(QttySmzzSwjgYyxtAppDomain domain) throws Exception {
        QttySmzzSwjgYyxtReturnDomain returnDomain = new QttySmzzSwjgYyxtReturnDomain();
        HashMap<String, String> map = new HashMap<String, String>();
        map.put("swjgDm", domain.getSwjgDm());
        List dataList = this.sqlMapClientTemplate.queryForList("querySmzzSwjgYyxt", map);
        returnDomain.setDataList(dataList);
        returnDomain.setCode("00");
        return returnDomain;
    }

    public TaxCommonReturnDomain doSmzzBsyLoginLog(QttySmzzBsyLoginLogAppDomain domain) throws Exception {
        QttySmzzBsyLoginLogReturnDomain returnDomain = new QttySmzzBsyLoginLogReturnDomain();
        NsfwZzfwBsyLogDomain bo = new NsfwZzfwBsyLogDomain();
        BeanUtils.copyProperties((Object)bo, (Object)domain);
        bo.setRq(HstDateUtil.getCurrentDate());
        this.sqlMapClientTemplate.insert("insertNsfwZzfwBsyLog", bo);
        returnDomain.setLogxh(bo.getLogxh());
        returnDomain.setCode("00");
        return returnDomain;
    }

    public TaxCommonReturnDomain doSmzzBsyLogoutLog(QttySmzzBsyLogoutLogAppDomain domain) throws Exception {
        QttySmzzBsyLogoutLogReturnDomain returnDomain = new QttySmzzBsyLogoutLogReturnDomain();
        HashMap<String, String> map = new HashMap<String, String>();
        map.put("logxh", domain.getLogxh());
        map.put("exittype", domain.getExittype());
        this.sqlMapClientTemplate.update("updateNsfwZzfwBsyLog", map);
        returnDomain.setCode("00");
        return returnDomain;
    }

    public String doGetBsdtDjxh(String swjgDm) throws Exception {
        HashMap<String, String> map = new HashMap<String, String>();
        map.put("swjgDm", swjgDm);
        map.put("bsdtDjxh", "");
        map.put("code", null);
        map.put("mess", null);
        this.sqlMapClientTemplate.queryForObjectByCurr("pWebjkGetBsdtDjxh", map, new String[0]);
        if ("00".equals(map.get("code"))) {
            return (String)map.get("bsdtDjxh");
        }
        return (String)map.get("code");
    }

    public List<String> queryNsrsbhsFromTm(String sfzhm) throws Exception {
        HashMap<String, String> map = new HashMap<String, String>();
        map.put("sfzhm", sfzhm);
        String databaseUsername = WebConstants.HST_PROP_MAP.get("hst.SCHEMA_TM");
        map.put("databaseUsername", databaseUsername);
        List dataList = this.sqlMapClientTemplate.queryForList("selectSmzzBsyNsrsbhs", map);
        return dataList;
    }

    @Transactional(propagation=Propagation.REQUIRED)
    public TaxCommonReturnDomain querySmzzBsyNsrxx(Set<String> nsrsbhs, String yyxtdm) throws Exception {
        QttySmzzBsyNsrxxReturnDomain returnDomain = new QttySmzzBsyNsrxxReturnDomain();
        HashMap<String, String> map = new HashMap<String, String>();
        for (String nsrsbh : nsrsbhs) {
            map.put("nsrsbh", nsrsbh);
            this.sqlMapClientTemplate.insert("insertSmzzBsyNsrxxLsb", map);
        }
        map.put("yyxtdm", yyxtdm);
        map.put("code", null);
        map.put("mess", null);
        map.put("dataList", null);
        this.sqlMapClientTemplate.queryForObjectByCurr("pWebjkQtty533SmzzBsynsrxx", "dataList", map);
        if ("00".equals((String)map.get("code"))) {
            List dataList = (List)map.get("dataList");
            returnDomain.setCode((String)map.get("code"));
            returnDomain.setDataList(dataList);
            return returnDomain;
        }
        returnDomain.setCode((String)map.get("code"));
        returnDomain.setMess(HstToolsUtil.ISO2GBK((String)map.get("mess")));
        return returnDomain;
    }
}
