package com.sqx.modules.datacentre.dao;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sqx.datasource.annotation.DataSource;
import com.sqx.modules.app.entity.UserEntity;
import com.sqx.modules.app.entity.UserMoneyDetails;
import com.sqx.modules.datacentre.query.DataCenterQuery;
import com.sqx.modules.datacentre.query.RankListQuery;
import com.sqx.modules.datacentre.query.ShopCenterQuery;
import com.sqx.modules.errand.entity.Feedback;
import com.sqx.modules.errand.entity.TbIndent;
import com.sqx.modules.order.entity.TbOrder;
import com.sqx.modules.pay.entity.CashOut;
import com.sqx.modules.pay.entity.PayDetails;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

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

@Mapper
public interface DataCentreDao {

    int findAllCount();

    int findDayAddUser(String format);

    int findMonthAddUser(String format);

    int findYearAddUser(String format);

    BigDecimal findDayIncome(String starTime,String endTime);

//    BigDecimal findMonthIncome(String format);

//    BigDecimal findYearIncome(String format);

    int findIndentCount(String starTime,String endTime);

    IPage<TbOrder> selectPayOrderAnalyze(Page<TbOrder> pages, @Param("query") DataCenterQuery query);

    int sumOrderMonth(Long userId, String date);

    BigDecimal sumTopUpMonth(Long userId, String date);

    BigDecimal selectTopUpStatistics(@Param("date") String date,@Param("dateType") String dateType);

    IPage<UserEntity> findAllCertification(Page<UserEntity> pages, String userName, String phone, String checkCertification,Integer riderStationId);

    int checkCertification(@Param("userId") Long userId, @Param("checkCertification") String checkCertification,@Param("checkCertificationMessage") String checkCertificationMessage);

    UserEntity findCertification(Long userId);

    IPage<TbIndent> rankingList(Page<TbIndent> pages, String address, String date, String dateType,Integer riderStationId);

    int selectNewShopCount(@Param("query")ShopCenterQuery query);

    IPage<TbOrder> selectRankingList(Page<TbOrder> pages, @Param("query")ShopCenterQuery query);

    int allUserCount(@Param("query") DataCenterQuery query);

    int phoneUserCount(@Param("query") DataCenterQuery query);

    IPage<Feedback> selectUserFeedback(Page<Feedback> pages, String userEmail);

    IPage<TbIndent> findUserAddIndent(Page<TbIndent> pages, Long userId);

    IPage<TbIndent> findUserReceivingIndent(Page<TbIndent> pages, Long userId);

    IPage<PayDetails> findTopUpMoney(Page<PayDetails> pages, Long userId, String startTime, String endTime);

    IPage<CashOut> findWithdrawMoney(Page<CashOut> pages, Long userId);

    BigDecimal billMoney(String dateType, String date);

    BigDecimal riderMoney(String dateType, String date);

    BigDecimal platformMoney(String dateType, String date);

    IPage<UserMoneyDetails> selectCashDeposit(Page<UserMoneyDetails> pages, String phone, Integer type, Long userId);

    BigDecimal tcwmplatformMoney(String date, String dateType);

    BigDecimal tcwmShopMoney(String date, String dateType);

    IPage<Feedback> selectFeedbackList(Page<Feedback> pages, Integer type);

    Integer sumJoinOrderMonth(Long userId, String date);

    BigDecimal sumRiderMoney(Long userId);

    BigDecimal sumCashMoney(Long userId, String date);

    @DataSource("dynamic")
    int selectTakeCount(Integer orderType,@Param("query") DataCenterQuery query);

    @DataSource("dynamic")
    BigDecimal selectTakeMoney(Integer orderType,@Param("query") DataCenterQuery query);

    @DataSource("dynamic")
    int cancelOrderCount(@Param("query") DataCenterQuery query);

    @DataSource("dynamic")
    BigDecimal cancelOrderMoney(@Param("query") DataCenterQuery query);

    List<TbOrder> excelShopCenter(@Param("query")ShopCenterQuery query);

    List<TbIndent> excelRankList(@Param("query") RankListQuery query);

    TbOrder selectRankingListAmount(@Param("query")ShopCenterQuery query);
}
