package com.ssj.service.weixin.library.service;

import com.ssj.bean.weixin.libmy.domain.TbLibSubscribe;
import com.ssj.framework.core.common.service.BaseService;
import com.ssj.framework.core.util.ResponseEntity;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;

public interface ILibSubscribeService extends BaseService<TbLibSubscribe, String> {

	TbLibSubscribe findByUserId(String userId);

	TbLibSubscribe findByUserIdAndStat(String userId, String string);

	TbLibSubscribe findByVipIdAndStat(String userId, String string); 
	//当天昨日到馆人数数据
	List<Map<String, Object>> countLibSubscribeNum();
	//开卡总数
	List<Map<String, Object>> countCurOpenCard(boolean iscount);
	

	Map<String, Object> findSubCount(String id, TbLibSubscribe subsccribe);

	Map<String, Object> findInAndBorrow(String id);

	Map<String, Object> findOneManager(String id);
	
	Page<Map<String, Object>> findByPage(Map<String, Object> searchParams,Pageable pageable);
	
	Page<Map<String, Object>> findByConfirmPage(Map<String, Object> searchParams,Pageable pageable);
	
	Page<Map<String, Object>> findLibByVipPage(Map<String, Object> searchParams, Pageable pageable);
	
	Page<Map<String, Object>> findLibByRykeAndLeavePage(Map<String, Object> searchParams, Pageable pageable);
	
	List<Map<String, Object>> findByRykeList(String libId,String date);
	
	List<Map<String, Object>> querySalesUserCounter(String libId);
	
	Integer queryTyperCounter(String libId,String type);
	
	Integer queryPriceTypeCounter(String libId,String priceType);
	
	
	/**
	 * 以下周报统计
	 */
	Map<String, Object> countWeeklyRead(String vipId,String startTime,String endTime);
	
	Map<String,Object> queryRankingByVip(String vipId,String startTime,String endTime);
	
	List<Map<String,Object>> queryCompanionByVip(String vipId,String startTime,String endTime);
	
	Map<String, Object> queryBookTagByVip(String vipId,String startTime,String endTime);
	
	List<Map<String,Object>> queryBorrowByVip(String startTime,String endTime);
	
	Map<String,Object> queryEffectiveByVip(String vipId);
	
	Long countBorrowByVip(String vipId,String startTime,String endTime);
	
	List<Map<String,Object>> countLivelyByVip(String vipId,String startTime,String endTime);
	
	Long countSubscribeByVip(String vipId,String startTime,String endTime);

	Map<String, Object> findComeLibInfo(String id);

	Map<String, Object> findWeekReadInfo(String id);

	Map<String, Object> findworkInfo(String vipId, String libId);

	Map<String, Object> findWorkSug(String pushId);

	Map<String, Object> findTheMonthCountAndTime(String vipId, String beginTime, String endTime);

	void pushBorrowTask();

	ResponseEntity signIn(Set<String> vipIdSet, String libId, String confirmUserId);

	/**
	 * 签到增加push记录
	 * @param vipId
	 * @param libId
	 * @param map 记录当前时间累积使用，用于多用户分配循环+1
	 */
	void signInCreatePush(String vipId, String libId, Map<String, Date> map);

	ResponseEntity signOff(Set<String> vipIdSet, String confirmUserId);

	/**
	 * 查询某一天学生的一个签到签离记录，不管是否已经签离的记录
	 * @param vipId
	 * @return
	 */
	TbLibSubscribe findTheDayByVipId (String vipId, Date date);

    TbLibSubscribe findTodaySignedHistoryByVipId(String vipId);

	/**
	 * 查询时间段内的签到签离记录
	 * @param vipId
	 * @param beginDate
	 * @param endDate
	 * @return
	 */
	List<TbLibSubscribe> findDaysByVipId (String vipId, Date beginDate, Date endDate);
}
