package com.iamberry.wechat.service.statistics;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.iamberry.wechat.core.entity.drp.PlaceRoleInfo;
import com.iamberry.wechat.core.entity.statictics.ActivateInfo;
import com.iamberry.wechat.core.entity.statictics.AttentionInfo;
import com.iamberry.wechat.core.entity.statictics.EarningsInfo;
import com.iamberry.wechat.core.entity.statictics.MarketInfo;
import com.iamberry.wechat.core.entity.statictics.StatisticsInfo;
import com.iamberry.wechat.core.entity.statictics.UerActivateInfo;
import com.iamberry.wechat.face.statistics.AdminStatisticsService;
import com.iamberry.wechat.service.mapper.DrpRoleInfoMapper;
import com.iamberry.wechat.service.statistics.dao.AdminStatisticsDao;

@Service
public class AdminStatisticsServiceImpl implements AdminStatisticsService {
	
	@Autowired
	private AdminStatisticsDao adminStatisticsDao;
	
	@Autowired
	private DrpRoleInfoMapper drpRoleInfoMapper;

	@Override
	public List<AttentionInfo> selectStoreAttentionList(AttentionInfo attentionInfo) {
		// TODO Auto-generated method stub
		return adminStatisticsDao.selectStoreAttentionList(attentionInfo);
	}

	@Override
	public List<EarningsInfo> selectProvinceEarningsList(
			EarningsInfo earningsInfo) {
		// TODO Auto-generated method stub
		return adminStatisticsDao.selectProvinceEarningsList(earningsInfo);
	}

	@Override
	public Integer selectStoreAttentionListCount(AttentionInfo attentionInfo) {
		// TODO Auto-generated method stub
		Integer count = adminStatisticsDao.selectStoreAttentionListCount(attentionInfo);
		return	count = count % attentionInfo.getPage().getPageSize() == 0? count/attentionInfo.getPage().getPageSize():(count/attentionInfo.getPage().getPageSize())+1;
	}

	@Override
	public Integer selectProvinceEarningsListCount(EarningsInfo earningsInfo) {
		// TODO Auto-generated method stub
		Integer count =  adminStatisticsDao.selectProvinceEarningsListCount(earningsInfo);
		return	count = count % earningsInfo.getPage().getPageSize() == 0? count/earningsInfo.getPage().getPageSize():(count/earningsInfo.getPage().getPageSize())+1;
	}

	@Override
	public List<ActivateInfo> selectActivateList(ActivateInfo activateInfo) {
		// TODO Auto-generated method stub
		return adminStatisticsDao.selectActivateList(activateInfo);
	}

	@Override
	public Integer selectActivateListCount(ActivateInfo activateInfo) {
		// TODO Auto-generated method stub
		Integer count = adminStatisticsDao.selectActivateListCount(activateInfo);
		return	count = count % activateInfo.getPage().getPageSize() == 0? count/activateInfo.getPage().getPageSize():(count/activateInfo.getPage().getPageSize())+1;
	}

	@Override
	public List<UerActivateInfo> selectUserActivateList(
			UerActivateInfo uerActivateInfo) {
		// TODO Auto-generated method stub
		return adminStatisticsDao.selectUserActivateList(uerActivateInfo);
	}

	@Override
	public Integer selectUserActivateListCount(UerActivateInfo uerActivateInfo) {
		// TODO Auto-generated method stub
		Integer count = adminStatisticsDao.selectUserActivateListCount(uerActivateInfo);
		return	count = count % uerActivateInfo.getPage().getPageSize() == 0? count/uerActivateInfo.getPage().getPageSize():(count/uerActivateInfo.getPage().getPageSize())+1;
	}

	@Override
	public List<MarketInfo> selectMarketList(MarketInfo marketInfo) {
		// TODO Auto-generated method stub
		return adminStatisticsDao.selectMarketList(marketInfo);
	}

	@Override
	public List<MarketInfo> selectPlaceList() {
		// TODO Auto-generated method stub
		return adminStatisticsDao.selectPlaceList();
	}

	@Override
	public Integer selectMarketListCount(MarketInfo marketInfo) {
		// TODO Auto-generated method stub
		Integer count = adminStatisticsDao.selectMarketListCount(marketInfo);
		return	count = count % marketInfo.getPage().getPageSize() == 0? count/marketInfo.getPage().getPageSize():(count/marketInfo.getPage().getPageSize())+1;
	}

	@Override
	public List<PlaceRoleInfo> selectRoleName(PlaceRoleInfo placeRoleInfo) {
		// TODO Auto-generated method stub
		return drpRoleInfoMapper.selectRoleName(placeRoleInfo);
	}

	@Override
	public Integer selectAttentionSum() {
		// TODO Auto-generated method stub
		return adminStatisticsDao.selectAttentionSum();
	}

	@Override
	public StatisticsInfo selectSalesAmount() {
		// TODO Auto-generated method stub
		return adminStatisticsDao.selectSalesAmount();
	}

	@Override
	public StatisticsInfo selectCurrentAttentionNum() {
		// TODO Auto-generated method stub
		return adminStatisticsDao.selectCurrentAttentionNum();
	}

	@Override
	public List<ActivateInfo> selectPlaceActivate() {
		// TODO Auto-generated method stub
		return adminStatisticsDao.selectPlaceActivate();
	}

	@Override
	public Integer selectQrCodeNum() {
		// TODO Auto-generated method stub
		return adminStatisticsDao.selectQrCodeNum();
	}

	@Override
	public StatisticsInfo selectStoreSalesInfo() {
		// TODO Auto-generated method stub
		return adminStatisticsDao.selectStoreSalesInfo();
	}

}
