package com.ssj.service.weixin.order.service.impl;

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

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.transaction.annotation.Transactional;

import com.alibaba.dubbo.config.annotation.Service;
import com.ssj.bean.weixin.order.domain.OrderDetails;
import com.ssj.dao.weixin.order.dao.OrderDetailsDao;
import com.ssj.dao.weixin.order.dao.OrderQueryDao;
import com.ssj.framework.core.common.service.BaseServiceImpl;
import com.ssj.service.weixin.order.service.OrderDetailsService;

@Service(version="1.0")
@Transactional
public class OrderDetailsServiceImpl extends BaseServiceImpl<OrderDetails, String> implements OrderDetailsService{
	@Autowired
	private OrderDetailsDao  orderDetailsDao;
	@Autowired
	private OrderQueryDao  orderQueryDao;
	
	@Override
	public PagingAndSortingRepository<OrderDetails, String> getDao() {
		return orderDetailsDao;
	}

	@Override
	public List<Map<String, Object>> countOrderDetailsNum() {
		return orderQueryDao.countOrderDetailsNum();
	}

	@Override
	public List<Map<String, Object>> countOrderDetailsPriceByDay() {
		return orderQueryDao.countOrderDetailsPriceByDay();
	}
	
	@Override
	public List<Map<String, Object>> countOrderDetailsPriceByCount() {
		return orderQueryDao.countOrderDetailsPriceByCount();
	}
	
	@Override
	public List<Map<String, Object>> countOrderDetailsByTop(String libId) {
		return orderQueryDao.countOrderDetailsByTop(libId);
	}
	
	@Override
	public List<Map<String, Object>> countOrderDetailsByUser(String libId) {
		return orderQueryDao.countOrderDetailsByUser(libId);
	}

	@Override
	public List<Map<String, Object>> countOrderDetailsByDayUser(String libId) {
		return orderQueryDao.countOrderDetailsByDayUser(libId);
	}

	@Override
	public Integer signSubscribCounter(String libId,Integer day,String compare){
		return orderQueryDao.signSubscribCounter( libId, day, compare);
	}

	@Override
	public Integer signSubscribCount(String libId) {
		return orderQueryDao.signSubscribCount( libId);
	}
	
	@Override
	public Integer signSubscribByDayCounter(String libId,Date selectDate,Integer type){
		return orderQueryDao.signSubscribByDayCounter( libId, selectDate, type);
	}
	
	@Override
	public Integer signSubscribByMonthCounter(String libId,Date selectDate,Integer type){
		return orderQueryDao.signSubscribByMonthCounter( libId, selectDate, type);
	}
	
	@Override
	public Integer signSubscribByActiveCounter(String libId,Date selectDate){
		return orderQueryDao.signSubscribByActiveCounter( libId, selectDate);
	}

	@Override
	public List<Map<String, Object>> countActivityByDayUser(String libId,String startDate, String endDate, String type) {
		return orderQueryDao.countActivityByDayUser(libId, startDate, endDate, type);
	}

	@Override
	public List<Map<String, Object>> queryWeekGrOrderDetails(String userId) {
		return orderQueryDao.queryWeekGrOrderDetails(userId);
	}

	@Override
	public List<Map<String, Object>> queryOrderDetailsByIsbn(String isbn13) {
		return orderQueryDao.queryOrderDetailsByIsbn(isbn13);
	}

	@Override
	public Integer countOrderDetailsByIsbn(String isbn13) {
		return orderQueryDao.countOrderDetailsByIsbn(isbn13);
	}

	@Override
	public Page<Map<String, Object>> findHotOrderDetailsPage(
			Map<String, Object> searchParams, Pageable pageable) {
		return orderQueryDao.findHotOrderDetailsPage(searchParams,pageable);
	}

	@Override
	public Page<Map<String, Object>> findNewOrderDetailsPage(
			Map<String, Object> searchParams, Pageable pageable) {
		return orderQueryDao.findNewOrderDetailsPage(searchParams, pageable);
	}
	
	@Override
	public Page<Map<String, Object>> findSearchBooksPage(
			Map<String, Object> searchParams, Pageable pageable) {
		return orderQueryDao.findSearchBooksPage(searchParams, pageable);
	}

	@Override
	public List<Map<String, Object>> findLibIdByUserId(String userId) {
		return orderQueryDao.findLibIdByUserId(userId);
	}

	@Override
	public OrderDetails findbyBookDetailId(String bookDetailId){
		return  orderDetailsDao.findbyBookDetailId(bookDetailId);
	}

}
