/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  org.apache.commons.lang.StringUtils
 *  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.dao.BaseDao;
import com.hst.framework.util.HstEncodeUtil;
import com.hst.framework.util.HstToolsUtil;
import com.hst.taxService.domain.ZxrdwtAppDomain;
import com.hst.taxService.domain.ZxrdwtDomain;
import com.hst.taxService.domain.ZxrdwtReturnDomain;
import com.hst.taxService.domain.ZxrdwtTimeAppDomain;
import com.hst.taxService.domain.ZxrdwtmxAppDomain;
import com.hst.taxService.domain.ZxrdwtmxReturnDomain;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.apache.commons.lang.StringUtils;
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 TaxWxZxrdAppDaoImp
implements BaseDao {
    @Autowired
    private HstSqlMapClientTemplate sqlMapClientTemplate;

    @Transactional(propagation=Propagation.REQUIRED)
    public TaxCommonReturnDomain queryZxrdGetList(ZxrdwtAppDomain domain) throws Exception {
        ZxrdwtReturnDomain returnDomain = null;
        HashMap<String, Object> map = new HashMap<String, Object>();
        map.put("swjgDm", domain.getSwjgDm());
        if (HstToolsUtil.isNullOrEmpty(domain.getStr())) {
            map.put("str", "");
        } else {
            map.put("str", HstEncodeUtil.GBK2ISO(domain.getStr()));
        }
        if (StringUtils.isBlank((String)domain.getZxrdYwflDm())) {
            map.put("zxrdYwflDm", "0001");
        } else {
            map.put("zxrdYwflDm", domain.getZxrdYwflDm());
        }
        map.put("count", 0);
        map.put("zxrdGetList", null);
        if (StringUtils.isBlank((String)domain.getPage())) {
            map.put("index", 1);
        } else {
            map.put("index", Integer.valueOf(domain.getPage()));
        }
        if (StringUtils.isBlank((String)domain.getRows())) {
            map.put("size", 10);
        } else {
            map.put("size", Integer.valueOf(domain.getRows()));
        }
        this.sqlMapClientTemplate.queryForObjectByCurr("queryZxrdGetList", "zxrdGetList", map);
        List<ZxrdwtDomain> dataList = new ArrayList();
        dataList = (List)map.get("zxrdGetList");
        returnDomain = new ZxrdwtReturnDomain();
        returnDomain.setCode("00");
        if (dataList == null || dataList.isEmpty()) {
            return returnDomain;
        }
        returnDomain.setDataList(dataList);
        return returnDomain;
    }

    public TaxCommonReturnDomain queryZxrdGetMess(ZxrdwtmxAppDomain domain) throws Exception {
        ZxrdwtmxReturnDomain returnDomain = null;
        HashMap<String, String> map = new HashMap<String, String>();
        map.put("zxrdXh", domain.getZxrdXh());
        map.put("ZxrdGetMess", null);
        map.put("code", null);
        map.put("mess", null);
        this.sqlMapClientTemplate.queryForObjectByCurr("queryZxrdGetMess", "zxrdGetMess", map);
        List dataList = new ArrayList();
        dataList = (List)map.get("zxrdGetMess");
        returnDomain = dataList == null || dataList.isEmpty() ? new ZxrdwtmxReturnDomain() : (ZxrdwtmxReturnDomain)dataList.get(0);
        returnDomain.setCode((String)map.get("code"));
        returnDomain.setMess(HstToolsUtil.ISO2GBK((String)map.get("mess")));
        return returnDomain;
    }

    public TaxCommonReturnDomain zxrdPutViewTime(ZxrdwtTimeAppDomain domain) throws Exception {
        TaxCommonReturnDomain returnDomain = new TaxCommonReturnDomain();
        HashMap<String, String> map = new HashMap<String, String>();
        map.put("zxrdXh", domain.getZxrdXh());
        map.put("sjm", domain.getSjm());
        map.put("wxh", domain.getWxh());
        if (StringUtils.isNotBlank((String)domain.getOpenTime())) {
            map.put("openDate", domain.getOpenTime().substring(0, 10));
        } else {
            map.put("openDate", "");
        }
        map.put("openTime", domain.getOpenTime());
        map.put("closeTime", domain.getCloseTime());
        map.put("code", null);
        map.put("mess", null);
        this.sqlMapClientTemplate.queryForObject("queryZxrdPutViewTime", map);
        returnDomain.setCode((String)map.get("code"));
        returnDomain.setMess(HstToolsUtil.ISO2GBK((String)map.get("mess")));
        return returnDomain;
    }
}
