package com.iamberry.wechat.service.order.dao.impl;

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

import com.iamberry.wechat.core.entity.statictics.StatisticsSalesOrder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.iamberry.wechat.core.entity.admin.ShopSystemRule;
import com.iamberry.wechat.core.entity.drp.PlaceInfo;
import com.iamberry.wechat.core.entity.drp.PlaceLogs;
import com.iamberry.wechat.core.entity.member.Member;
import com.iamberry.wechat.core.entity.order.Order;
import com.iamberry.wechat.core.entity.order.OrderItem;
import com.iamberry.wechat.core.entity.order.OrderRebackMoney;
import com.iamberry.wechat.service.mapper.AdminOrderMapper;
import com.iamberry.wechat.service.mapper.PlaceLogsMapper;
import com.iamberry.wechat.service.order.dao.AdminOrderDao;

@Repository
public class AdminOrderDaoImpl implements AdminOrderDao {
	
	@Autowired
	private AdminOrderMapper adminOrderMapper;
	
	@Autowired
	private PlaceLogsMapper placeLogsMapper;

	
	@Override
	public List<OrderRebackMoney> selectOrderRebackByOrderId(String orderId) {
		// TODO Auto-generated method stub
		return adminOrderMapper.selectOrderRebackByOrderId(orderId);
	}
	
	
	@Override
	public List<Order> selectShopOrder(Order order) {
		// TODO Auto-generated method stub
		return this.adminOrderMapper.selectShopOrder(order);
	}

	@Override
	public List<Order> selectShopOrderByOrderId(Order order) {
		// TODO Auto-generated method stub
		return this.adminOrderMapper.selectShopOrderByOrderId(order);
	}


	@Override
	public Order getShopOrderByOrderId(String orderId) {
		// TODO Auto-generated method stub
		return this.adminOrderMapper.getShopOrderByOrderId(orderId);
	}

	@Override
	public List<OrderItem> getShopOrderItemByOrderId(String orderId) {
		// TODO Auto-generated method stub
		return this.adminOrderMapper.getShopOrderItemByOrderId(orderId);
	}

	@Override
	public Integer selectShopOrderCount(Order order) {
		// TODO Auto-generated method stub
		return this.adminOrderMapper.selectShopOrderCount(order);
	}

	@Override
	public Order selectOrderStatusByOrderId(String orderId) {
		// TODO Auto-generated method stub
		return this.adminOrderMapper.selectOrderStatusByOrderId(orderId);
	}

	@Override
	public Integer updateOrderStatusByOrderId(Order order) {
		// TODO Auto-generated method stub
		return this.adminOrderMapper.updateOrderStatusByOrderId(order);
	}

	@Override
	public Integer deliverOrderByOrderId(Order order) {
		// TODO Auto-generated method stub
		return this.adminOrderMapper.deliverOrderByOrderId(order);
	}

	@Override
	public Integer updateOrderAdminRemarkByOrderId(Order order) {
		// TODO Auto-generated method stub
		return this.adminOrderMapper.updateOrderAdminRemarkByOrderId(order);
	}

	@Override
	public List<Order> selectOrderByIntegral(Order order) {
		// TODO Auto-generated method stub
		return this.adminOrderMapper.selectOrderByIntegral(order);
	}

	@Override
	public Integer updateOrderIntegral(String orderId) {
		// TODO Auto-generated method stub
		return this.adminOrderMapper.updateOrderIntegral(orderId);
	}

	@Override
	public Integer addplaceLogs(Order order) {
		// TODO Auto-generated method stub
		return this.adminOrderMapper.addplaceLogs(order);
	}

	@Override
	public Integer getOrderNum(Order order) {
		// TODO Auto-generated method stub
		return this.adminOrderMapper.getOrderNum(order);
	}

	@Override
	public Member getUserByOpenId(String openId) {
		// TODO Auto-generated method stub
		return this.adminOrderMapper.getUserByOpenId(openId);
	}

	@Override
	public Member getUserByUserRefereeid(Integer userId) {
		// TODO Auto-generated method stub
		return this.adminOrderMapper.getUserByUserRefereeid(userId);
	}

	@Override
	public Integer updateUserByUserId(Member member) {
		// TODO Auto-generated method stub
		return this.adminOrderMapper.updateUserByUserId(member);
	}

	@Override
	public ShopSystemRule getReluByRid(Integer rId) {
		// TODO Auto-generated method stub
		return this.adminOrderMapper.getReluByRid(rId);
	}

	@Override
	public ShopSystemRule getReluByRtype(Integer ruleType) {
		// TODO Auto-generated method stub
		return this.adminOrderMapper.getReluByRtype(ruleType);
	}

	@Override
	public PlaceInfo getOnePlaceInfo(int id) {
		// TODO Auto-generated method stub
		return this.adminOrderMapper.getPlaceInfoByPlaceId(id);
	}

	@Override
	public int insertPlaceLogs(PlaceLogs placeLogs) {
		// TODO Auto-generated method stub
		return this.placeLogsMapper.insert(placeLogs);
	}

	@Override
	public Integer updatePlaceInfo(PlaceInfo placeInfo) {
		// TODO Auto-generated method stub
		return this.adminOrderMapper.updatePlaceInfo(placeInfo);
	}

	@Override
	public String selectSalesOpenIdByOrderId(String orderId) {
		// TODO Auto-generated method stub
		return adminOrderMapper.selectSalesOpenIdByOrderId(orderId);
	}

	@Override
	public List<Order> getOrderByCreateTime(Order order) {
		// TODO Auto-generated method stub
		return adminOrderMapper.getOrderByCreateTime(order);
	}
	
	@Override
	public List<Order> getOrderByCreateTimeAndFiveMinutes(Order order) {
		// TODO Auto-generated method stub
		return adminOrderMapper.getOrderByCreateTimeAndFiveMinutes(order);
	}
	
	
	
	@Override
	public Integer updateOrderByOrderId(List<String> list) {
		// TODO Auto-generated method stub
		return adminOrderMapper.updateOrderByOrderId(list);
	}

	@Override
	public Integer updateOrderStatusByOrderIdAndToStatus(Order order) {
		// TODO Auto-generated method stub
		return adminOrderMapper.updateOrderStatusByOrderIdAndToStatus(order);
	}

	@Override
	public List<OrderItem> getItemsNumByOrderId(String orderId) {
		// TODO Auto-generated method stub
		return adminOrderMapper.getItemsNumByOrderId(orderId);
	}

	@Override
	public Integer updateOrderDeliver(Order order) {
		// TODO Auto-generated method stub
		return adminOrderMapper.updateOrderDeliver(order);
	}

	@Override
	public List<Order> getOrderList(Order order) {
		// TODO Auto-generated method stub
		return adminOrderMapper.getOrderList(order);
	}

	@Override
	public Integer updateOrderListStatus(List<Order> list) {
		// TODO Auto-generated method stub
		return adminOrderMapper.updateOrderListStatus(list);
	}


	@Override
	public PlaceLogs selectPlaceLogInfo(PlaceLogs PlaceLogs) {
		// TODO Auto-generated method stub
		return placeLogsMapper.selectPlaceLogInfo(PlaceLogs);
	}

	@Override
	public Integer updatePlaceLogs(PlaceLogs placeLogs) {
		// TODO Auto-generated method stub
		return placeLogsMapper.updatePlaceLogs(placeLogs);
	}

	/**
	 * 获取销售数量
	 * @param map
	 * @return
	 */
	public Integer getSalesVolumes(Map map){
		return adminOrderMapper.getSalesVolumes(map);
	}

	/**
	 * 获取个人已购买的机器台数
	 * @param map
	 * @return
	 */
	public Integer getPersonalPurchase(Map map){
		return  adminOrderMapper.getPersonalPurchase(map);
	}

	/**
	 * 获取个人消费总额
	 * @param map
	 * @return
	 */
	public Integer getTotalConsume(Map map){
		return  adminOrderMapper.getTotalConsume(map);
	}

	/**
	 * 获取已购买的总人数
	 * @param member
	 * @return
	 */
	public Integer getAlreadyNumber(Member member){
		return  adminOrderMapper.getAlreadyNumber(member);
	}

	/**
	 * 获取购买的机器台数
	 * @param member
	 * @return
	 */
	public Integer getUnitsNumber(Member member){
		return  adminOrderMapper.getUnitsNumber(member);
	}

	/**
	 * 获取总的消费金额
	 * @param member
	 * @return
	 */
	public Integer getTotalAmount(Member member){
		return  adminOrderMapper.getTotalAmount(member);
	}

	@Override
	public List<StatisticsSalesOrder> listWeekNum() {
		return adminOrderMapper.listWeekNum();
	}

	@Override
	public List<StatisticsSalesOrder> listLastWeekNum() {
		return adminOrderMapper.listLastWeekNum();
	}

	@Override
	public List<StatisticsSalesOrder> listMonthNum(StatisticsSalesOrder salesOrder) {
		return adminOrderMapper.listMonthNum(salesOrder);
	}

	@Override
	public List<StatisticsSalesOrder> listYearNum(StatisticsSalesOrder salesOrder) {
		return adminOrderMapper.listYearNum(salesOrder);
	}
}
