package com.ssj.service.sys.award.service;

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

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import com.ssj.bean.sys.award.domain.AwardActivity;
import com.ssj.bean.sys.award.domain.AwardSncode;
import com.ssj.framework.core.common.service.BaseService;

public interface AwardSncodeService extends BaseService<AwardSncode, String> {
	
	Page<Map<String, Object>> findAwardSncodeBylist(Map<String, Object> searchParams, Pageable pageable);
	
	//查出活动中所有的奖品code
	List<AwardSncode> findAwardSncodeByAwardActivityId(String awardActivityId,Integer status);
	
	//查出活动中指定等奖的奖品code
	List<AwardSncode> findAwardSncodeByAwardMaterialId(String awardActivityId,String awardMaterialId,Integer status);
	
	//通过活动，生成sn_code列表
	public void createAwardSncodeByCode(AwardActivity awardActivity);
	
	//取消活动，不通过活动，把没未中奖的sn_code取消，库存添加到商户的奖品库存下。
	public void cleanAwardSncodeByCode(AwardActivity awardActivity);
	
	//通过活动id和奖品的id,随机查询出一条"未使用"的sncode
	public AwardSncode randomAwardSncodeByActivityIdAndMaterialId(String awardActivityId,String materialId);
	
	//我的奖品列表
	Page<Map<String, Object>> findAwardSncodeByVipList(Map<String, Object> searchParams, Pageable pageable);
	
	//查询sncode
	public AwardSncode getAwardSncodeBySnCode(String snCode);
	
	//加载sncode到redis
	public boolean loadAwardSncodeToRedisByActivityId(String awardActivityId);
	
	//从redis抽奖一条返回，从redis中删除记录。
	public AwardSncode randomAwardSncodeRedisByActivityId(String awardActivityId);
	
	//抽奖的各种业务
	public AwardSncode awardSncodeByActivityId(String userId,String vipId,String awardActivityId);
	
	//兑换奖品，从redis中删除sncode奖信息
	public void cleanAwardSncodeResisByCode(String awardActivityId,String snCode);
	
	//更新兑换码的图片
	public void updateSnCodeImgBySnCode(String snCode,String snCodeImg);
	

}
