package cn.pluss.platform.merchantProfit;

import cn.pluss.platform.entity.MerchantOrder;
import cn.pluss.platform.entity.MerchantProfit;
import cn.pluss.platform.entity.UserApp;
import cn.pluss.platform.mapper.MerchantProfitMapper;
import com.baomidou.mybatisplus.extension.service.IService;

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

/**
 * 直接调用dao层能完成的直接用
 */
public interface MerchantProfitService extends IService<MerchantProfit> {

    default BigDecimal getSumValidProfit(String userId) {
        return ((MerchantProfitMapper) getBaseMapper()).selectSumValidProfit(userId);
    }

    default MerchantProfit queryMerchantProfit(MerchantProfit merchantProfit) {
        return ((MerchantProfitMapper) getBaseMapper()).queryMerchantProfit(merchantProfit);
    }

    default List<MerchantProfit> queryMerchantProfitList(MerchantProfit merchantProfit) {
        return ((MerchantProfitMapper) getBaseMapper()).queryMerchantProfitList(merchantProfit);
    }

    default void saveMerchantProfit(MerchantProfit merchantProfit) {
        getBaseMapper().insert(merchantProfit);
    }

    default void updateMerchantProfit(MerchantProfit merchantProfit) {
        getBaseMapper().updateById(merchantProfit);
    }

    default void deleteMerchantProfit(MerchantProfit merchantProfit) {
        getBaseMapper().deleteById(merchantProfit.getId());
    }

    default List<MerchantProfit> queryMerchantProfitPage(Map map) {
        return ((MerchantProfitMapper) getBaseMapper()).queryMerchantProfitPage(map);
    }

    default Integer queryMerchantProfitPageCount(Map map) {
        return ((MerchantProfitMapper) getBaseMapper()).queryMerchantProfitPageCount(map);
    }

    default Double queryMerchantProfitSumConsumeFee(Map map) {
        return  ((MerchantProfitMapper) getBaseMapper()).queryMerchantProfitSumConsumeFee(map);
    }

    default Double queryMerchantProfitSumPrice(Map map) {
        return  ((MerchantProfitMapper) getBaseMapper()).queryMerchantProfitSumPrice(map);
    }

    default Map<String, Object> getProfitCount(Map<String,Object> map){
        return ((MerchantProfitMapper) getBaseMapper()).getProfitCount(map);
    }

    /**
     * 批量插入
     * @param profitList
     */
    void batchInsert(Vector<MerchantProfit> profitList);

    /**
     * 创建分润V2.0模式
     * @date: 2022/1/21 15:14
     * @param order:
     * @param type
     */
    void createOrderProfitV2(MerchantOrder order,String type);

    /**
     * 统计按条件分润信息
     * @date: 2022/2/9 19:38
     * @param condition:
     * @return java.util.Map<java.lang.String,java.math.BigDecimal>
     */
    Map<String, BigDecimal> getProfitAmtCount(MerchantProfit condition);

    /**
     * 推送收益消息
     * @param userApp
     * @param profitMoney
     * @param orderNumber
     */
    void sendProfitMessage(UserApp userApp, BigDecimal profitMoney, String orderNumber);
}

