package com.ssj.service.sys.cardinfo.service;


import com.ssj.bean.sys.cardinfo.domain.Card;
import com.ssj.bean.sys.cardinfo.domain.CardAward;
import com.ssj.bean.sys.cardinfo.domain.CardAwardLog;
import com.ssj.framework.core.common.service.BaseService;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

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

public interface CardService extends BaseService<Card, String> {
	
    public  Page<Card>  findByPage(Map<String, Object> params, Pageable sp);
    
    Page<Map<String, Object>> findBylist(Map<String, Object> searchParams, Pageable pageable);
    /**
     * 生成中奖code
     * @param id
     */
    public void generatingSncode(String id);
    
    /**
     * sncode码 某个活动的sncode
     * @param searchParams
     * @param pageable
     * @return
     */
    Page<Map<String, Object>> findCardAward(Map<String, Object> searchParams, Pageable pageable);
    
    public List<Map<String,Object>> zhongjiang(Map<String, Object> searchParams);
    public List<Map<String,Object>> exportCJlog(Map<String, Object> searchParams);
    /**
     * 查询活动对应的抽奖日志
     * @param searchParams
     * @param pageable
     * @return
     */
    Page<Map<String, Object>> findAwardLog(Map<String, Object> searchParams, Pageable pageable);
    
    /**
     * 删除活动以及活动奖品
     * @param id
     */
    public  void deleteCardAndCardAward(String id);
    /**
     * 查询某个活动，兑奖的sncode未领取的个数。
     * @param cardId
     * @return
     */
    public Integer getCountCardAward(String cardId);
    /**
     * 随机给个数计算有没有机会获得奖品
     * @param Card
     * @return
     */
    public boolean getPrizeByPercent(Card card);
    
	/**
	 * 记录抽奖日志
	 */
	public void saveCardAwardLog(CardAwardLog cardAwardLog);
	
	public int getPlayStatus(Card card, String userId);
	public int getPlayStatusLib(Card card, String userId);
	
	/**
	 * 回复奖品  推送客服消息
	 * @param fromUserName
	 */
	public void pushCustomer(Map<String, Object> map, String fromUserName);
	/**
	 * 回复关键字查询活动ID
	 * @param keyword
	 * @return
	 */
	public  Map<String,Object> getCardByKeyword(String keyword);
	
	/**
	 * 大转盘，滚动，获取中奖的信息
	 * @param cardId
	 * @return
	 */
	public List<Map<String,Object>> getWinning(String cardId);
	
	
	public Integer  getUserZJLog(String cardId, String userId);
	/**
	 * 根据抽奖的次数随机给奖品
	* @param card
	* @return
	* 创建人：ZhangCaibao 
	* 2017年8月14日 下午3:19:19 
	* @CardAward
	 */
	public CardAward getCardAwardRand(String cardId, Integer count);
	
	public Integer  getCardAwardLog(String cardId, String userId, String begenTime, String endTime);


}
