package com.palmnest.dao.wechat;

import com.palmnest.dao.GenericDao;
import com.palmnest.model.estateserve.Product;
import com.palmnest.model.estateserve.Recharge;

import java.util.List;
import java.util.Map;

/**
 * 充值数据接口
 *
 * @author xiemin
 */
public interface RechargeDao extends GenericDao<Recharge, Integer> {

	/**
	 * 根据省份、运营商查询产品
	 *
	 * @param province
	 * @param carrieroperator
	 * @param type
	 * @return
	 */
	public List<Product> findProduct(String province, String carrieroperator, String type, String isEnabled);

	/**
	 * 添加充值记录
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public int addRecharge(Map<String, String> map) throws Exception;

	/**
	 * 根据产品id查询产品信息
	 *
	 * @param productId
	 * @return
	 */
	public Map<String, String> findProductById(int productId) throws Exception;

	/**
	 * 根据充值id查询充值信息
	 *
	 * @param id
	 * @return
	 */
	public Recharge findRecharge(String id) throws Exception;

	/**
	 * 更新充值状态
	 *
	 * @param id
	 * @param ststus
	 * @return
	 * @throws Exception
	 */
	public int updateRecharge(Integer id, int ststus) throws Exception;

	/**
	 * 根据订单号查询
	 *
	 * @param ordId
	 * @return
	 * @throws Exception
	 */
	public Recharge findRechargeByOrdId(String ordId) throws Exception;

	/**
	 * 更新充值信息
	 *
	 * @param re
	 * @return
	 */
	public int updateRecharge(Recharge re) throws Exception;

	/**
	 * 根据openId查询订单日期分组
	 *
	 * @param openId
	 * @param 当前月份
	 * @return
	 * @throws Exception
	 */
	public List<Map<String, Object>> getRechareByCreateTime(String openId, String dateTime, String endTime) throws Exception;

	/**
	 * 根据订单分组日期和openId查询订单数据
	 *
	 * @param createTime
	 * @param openId
	 * @return
	 * @throws Exception
	 */
	public List<Map<String, Object>> getRechareRecordList(String createTime, String openId) throws Exception;

	/**
	 * 根据主键ID查询订单详情
	 *
	 * @param id
	 * @return
	 */
	public List<Map<String, Object>> getRechareRecordInfo(Integer id);

	/**
	 * 根据订单号更新
	 *
	 * @param ordId
	 * @param ststus
	 * @return
	 * @throws Exception
	 */
	public int updateRechargeOrdId(String ordId, int ststus) throws Exception;

	/**
	 * 获取无项目的订单信息
	 */
	public List<Recharge> getNoOrgRechargeList(String month);

}
