package com.ym.mec.biz.dal.dao;


import com.ym.mec.biz.dal.dto.FeeFlagNumDto;
import com.ym.mec.biz.dal.dto.StudentPaymentOrderExportDto;
import com.ym.mec.biz.dal.dto.StudentPaymentRouteOrderDto;
import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
import com.ym.mec.biz.dal.entity.StudentPaymentRouteOrder;
import com.ym.mec.biz.dal.enums.PaymentChannelEnum;
import com.ym.mec.common.dal.BaseDAO;

import org.apache.ibatis.annotations.Param;

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

public interface StudentPaymentRouteOrderDao extends BaseDAO<Long, StudentPaymentRouteOrder> {

    List<StudentPaymentRouteOrderDto> queryPageOrder(Map<String, Object> params);

    StudentPaymentRouteOrderDto getOrderMoneyAmount(Map<String, Object> params);

    /**
     * 统计充值金额
     *
     * @param params
     * @return
     */
    BigDecimal getChargeAmount(Map<String, Object> params);

    int batchAdd(@Param("routeOrders") List<StudentPaymentRouteOrder> routeOrders);

    List<StudentPaymentRouteOrder> getRouteOrders(@Param("orderNo") String orderNo);

    /**
     * 获取分部分润金额
     *
     * @param routeOrganId
     * @param paymentChannelEnumList
     * @return
     */
    BigDecimal getRouteOrderAmount(@Param("routeOrganId") Integer routeOrganId,
                                   @Param("paymentChannelEnumList") List<PaymentChannelEnum> paymentChannelEnumList,
                                   @Param("startTime") Date startTime
    );

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

    /**
     * 根据订单号删除
     *
     * @param orderNo
     * @return
     */
    Boolean deleteByOrderNo(@Param("orderNo") String orderNo);

    /**
     * 插入外部订单
     *
     * @return
     */
    int insertOrder(StudentPaymentOrder order);

    int queryAuditCount(Map<String, Object> params);

    List<StudentPaymentRouteOrder> queryAuditPage(Map<String, Object> params);

    /**
     * 是否有重复到订单号
     *
     * @param transNos
     * @return
     */
    List<String> countByTransNo(@Param("transNos") List<Object> transNos);

    /**
     * 获取审核通过的学校缴费金额
     *
     * @param calenderId
     * @return
     */
    BigDecimal sumAmountByCalenderId(Long calenderId);

    /**
     * 更换订单号获取
     *
     * @param orderNo
     * @return
     */
    StudentPaymentRouteOrder getByOrderNo(String orderNo);

    FeeFlagNumDto getCountFeeFlagNum(@Param("orderNo") String orderNo);
}