package cn.iocoder.yudao.module.crm.service.salesperformancesettlement;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.crm.controller.admin.salesperformancesettlement.vo.SalesPerformanceSettlementPageReqVO;
import cn.iocoder.yudao.module.crm.controller.admin.salesperformancesettlement.vo.SalesPerformanceSettlementSaveReqVO;
import cn.iocoder.yudao.module.crm.dal.dataobject.salesperformancesettlement.SalesPerformanceSettlementDO;
import com.baomidou.mybatisplus.extension.service.IService;

import javax.validation.Valid;
import java.time.LocalDateTime;

/**
 * 销售业绩结算记录 Service 接口
 *
 * @author 艾楷
 */
public interface SalesPerformanceSettlementService extends IService<SalesPerformanceSettlementDO> {

    /**
     * 创建 - 这里用户crm新增用户
     *
     * @param now
     * @param userId
     */
    void createSalesPerformanceSettlement(LocalDateTime now, Long userId);

    /**
     * 更新销售业绩结算记录
     *
     * @param updateReqVO 更新信息
     */
    void updateSalesPerformanceSettlement(@Valid SalesPerformanceSettlementSaveReqVO updateReqVO);

    /**
     * 删除销售业绩结算记录
     *
     * @param id 编号
     */
    void deleteSalesPerformanceSettlement(Long id);

    /**
     * 获得销售业绩结算记录
     *
     * @param id 编号
     * @return 销售业绩结算记录
     */
    SalesPerformanceSettlementDO getSalesPerformanceSettlement(Long id);

    /**
     * 获得销售业绩结算记录分页
     *
     * @param pageReqVO 分页查询
     * @return 销售业绩结算记录分页
     */
    PageResult<SalesPerformanceSettlementDO> getSalesPerformanceSettlementPage(SalesPerformanceSettlementPageReqVO pageReqVO);

    /**
     * 每月结算
     */
    void settlement();

    /**
     * 生成下一个月的业绩
     */
    void generateSalesPerformanceJob();

    /**
     * 自动确认上个月的业绩
     */
    void autoConfirmJob();
}
