package com.ym.mec.biz.service;

import java.util.*;

import com.ym.mec.biz.dal.dto.PageInfoOrder;
import com.ym.mec.biz.dal.dto.SporadicChargeInfoDto;
import com.ym.mec.biz.dal.dto.StudentPaymentOrderExportDto;
import com.ym.mec.biz.dal.entity.Goods;
import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
import com.ym.mec.biz.dal.enums.DealStatusEnum;
import com.ym.mec.biz.dal.enums.GroupType;
import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
import com.ym.mec.biz.dal.enums.OrderTypeEnum;
import com.ym.mec.biz.dal.page.SporadicOrderQueryInfo;
import com.ym.mec.biz.dal.page.StudentPaymentOrderQueryInfo;
import com.ym.mec.common.page.PageInfo;
import com.ym.mec.common.page.QueryInfo;
import com.ym.mec.common.service.BaseService;
import com.ym.mec.util.collection.MapUtil;
import org.apache.poi.ss.formula.functions.T;

public interface StudentPaymentOrderService extends BaseService<Long, StudentPaymentOrder> {

	/**
	 * 查询商品列表
	 * @param musicGroupId
	 * @param type
	 * @return
	 */
	List<Goods> queryApplyGoodsList(String musicGroupId, OrderDetailTypeEnum type);

	/**
	 * 查询订单列表
	 * @param groupType
	 * @param musicGroupId
	 * @param userId
	 * @param status
	 * @param type
	 * @return
	 */
	List<StudentPaymentOrder> queryByCondition(GroupType groupType, String musicGroupId, Integer userId, DealStatusEnum status, OrderTypeEnum type);

	/**
	 * 查询报名缴费订单
	 * @param musicGroupId
	 * @param status
	 * @return
	 */
	StudentPaymentOrder findMusicGroupApplyOrderByStatus(Integer userId, String musicGroupId, DealStatusEnum status);

	/**
	 * 根据orderNo查询订单
	 * @param orderNo
	 * @return
	 */
	StudentPaymentOrder findOrderByOrderNo(String orderNo);

	/**
	 * 查找支付成功和支付中订单
	 * @return
	 */
	int findPayOrderNum();

	/**
	 * 查询支付中订单
	 *
	 * @param status
	 * @return
	 */
	List<StudentPaymentOrder> findOrdersByStatus(DealStatusEnum status, String paymentChannel);

	/**
	 * 查询支付中超时的订单
	 * @param orderNoList
	 * @param status
	 * @param beforeTime
	 * @return
	 */
	List<StudentPaymentOrder> findOrdersOverTime(List<String> orderNoList, DealStatusEnum status, Date beforeTime);

	void queryOrderStatus() throws Exception;

	void updateOrder(Map<String, String> rpMap) throws Exception;

	/**
	 * 获取零星订单
	 * @param userId
	 * @param sporadicId
	 * @param sporadic
	 * @param status
	 * @return
	 */
	Integer findOrderByGroupType(Integer userId, Integer sporadicId, String sporadic, DealStatusEnum status);

	List<StudentPaymentOrderExportDto> ExportQueryPage(Map<String, Object> params);

	/**
	 * 获取零星收费订单列表
	 * @param queryInfo
	 * @return
	 */
	PageInfo<SporadicChargeInfoDto> sporadicQueryPage(SporadicOrderQueryInfo queryInfo);


	StudentPaymentOrder getOrderMoneyAmount(StudentPaymentOrderQueryInfo queryInfo);


	PageInfoOrder<StudentPaymentOrder> OrderQueryPage(StudentPaymentOrderQueryInfo queryInfo);


	/**
	 * 获取订单第三方状态
	 * @param id
	 * @return
	 */
	Boolean getOrderStatus(Long id) throws Exception;

	/**
	 * 获取分部支付成功支付中订单数量
	 * @param organId
	 * @return
	 */
	Integer findOrganPayOrderNum(Integer organId);

	/**
	 * 获取用户某种类型的订单
	 * @param userId
	 * @param type
	 * @param status
	 * @return
	 */
	List<StudentPaymentOrder> getUserOrderByType(Integer userId, OrderTypeEnum type, DealStatusEnum status);


	/**
	 * 从新提交分账信息
	 * @param startTime
	 * @param endTime
	 * @return
	 */
	List<StudentPaymentOrder> reConfirmOrder(Date startTime,Date endTime);
}