/*
 * Copyright (c) 2018-2999 广州亚米信息科技有限公司 All rights reserved.
 *
 * https://www.gz-yami.com/
 *
 * 未经允许，不可做商业用途！
 *
 * 版权所有，侵权必究！
 */

package com.yami.shop.distribution.comment.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yami.shop.bean.model.OrderItem;
import com.yami.shop.bean.param.OfflineHandleEventAuditParam;
import com.yami.shop.common.util.PageParam;
import com.yami.shop.distribution.comment.model.DistributionProdLog;
import com.yami.shop.distribution.comment.model.DistributionUser;
import com.yami.shop.distribution.comment.po.DistributionProdPO;
import com.yami.shop.distribution.comment.dto.DistributionProdDto;
import com.yami.shop.distribution.comment.model.DistributionProd;
import com.yami.shop.distribution.comment.vo.DistributionAwardDataVO;

import java.util.List;

/**
 * @author lgh on 2019/04/01.
 */
public interface DistributionProdService extends IService<DistributionProd> {

    IPage<DistributionProd> distributionProdsPage(Page page, DistributionProd distributionProd, String prodName);

//    List<DistributionProdDto> distributionProdDtoPageDistributionUserId(Page page, Long shopId, Long distributionUserId, String prodName, Integer sort, Integer orderBy);


//    DistributionAwardDataVO getAwardDataVO(DistributionProdPO distributionProdPO, Long distributionUserId);

    /**
     * 根据获得商品id获得po对象
     *
     * @param prodId
     * @return
     */
    DistributionProdPO getDistributionProdPOByProdId(Long prodId);

    void removeDistributionProdPOCacheByProdId(Long prodId);

    /**
     * 根据分销员id获得分销商品 分页
     *
     * @param page
     * @param distributionUser
     * @return
     */
    List<DistributionProdDto> distributionProdDtoPage(Page<DistributionProdDto> page, String prodName, Integer sort, Integer orderBy, DistributionUser distributionUser);

    /**
     * 计算佣金金额
     *
     * @param distributionProdPO
     * @param distributionUserId
     * @param orderItem
     * @return
     */
    DistributionAwardDataVO getAwardDataVO(DistributionProdPO distributionProdPO, Long distributionUserId, OrderItem orderItem);

    /**
     * 下线分销商品
     */
    void offline(DistributionProd distributionProd, String offlineReason, Long sysUserId);

    /**
     * 审核活动商品
     */
    void auditDistributionProd(OfflineHandleEventAuditParam offlineHandleEventAuditParam, Long sysUserId);

    /**
     * 提交审核
     */
    void auditApply(Long eventId, Long distributionProdId, String reapplyReason);

    /**
     * 获取分销商品记录
     * @param page
     * @param distributionProdLog
     * @return
     */
    IPage<DistributionProdLog> getDistributionProdLogPage(PageParam<DistributionProdLog> page, DistributionProdLog distributionProdLog);
}
