package com.sunxung.factoring.service.invoicemanage;

import com.baomidou.mybatisplus.extension.service.IService;
import com.sunxung.factoring.entity.GridPage;
import com.sunxung.factoring.entity.invoicemanage.InvoiceBasicInfo;
import com.sunxung.factoring.entity.invoicemanage.InvoiceCustomerInfo;
import com.sunxung.factoring.entity.invoicemanage.InvoiceHisInfo;
import com.sunxung.factoring.entity.invoicemanage.vo.SearchGoodsVo;
import com.sunxung.factoring.entity.project.vo.BusinessProcessingTaskVo;
import com.sunxung.factoring.entity.project.vo.SearchBusinessProcessingTask;
import com.sunxung.factoring.entity.settlement.SettlementGoodsInfo;
import org.springframework.ui.Model;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * @Author : liutao
 * @Date: 2022-3-22
 */
public interface InvoiceBasicInfoService extends IService<InvoiceBasicInfo> {

    /**
     * 获取列表页信息
     *
     * @param id
     * @return
     */
    InvoiceBasicInfo get(Long id);

    /**
     * 销售发票我已处理列表页查询
     *
     * @param search
     * @return
     */
    List<BusinessProcessingTaskVo> findMyCompletedList(SearchBusinessProcessingTask search);

    /**
     * 销售发票全部列表页查询
     *
     * @param search
     * @return
     */
    List<BusinessProcessingTaskVo> findAllList(SearchBusinessProcessingTask search);

    /**
     * 添加销售发票
     *
     * @param invoiceBasicInfo
     * @param request
     * @return
     */
    void add(InvoiceBasicInfo invoiceBasicInfo, HttpServletRequest request) throws IOException;

    /**
     * 获取销售发票添加页面详细信息
     *
     * @param businessKey 销售发票信息ID
     * @return
     */
    InvoiceHisInfo getDetail(Long businessKey);

    /**
     * 修改销售发票
     *
     * @param invoiceBasicInfo
     * @param request
     */
    void doUpdate(InvoiceBasicInfo invoiceBasicInfo, String taskId, HttpServletRequest request) throws IOException;


    /**
     * 获取货款的货物信息
     *
     * @param searchGoodsVo
     * @return
     */
    GridPage saleSelectGoodsOfPayment(SearchGoodsVo searchGoodsVo);

    /**
     * 获取贴现费用的货物信息
     *
     * @param searchGoodsVo
     * @return
     */
    GridPage<SettlementGoodsInfo> saleSelectGoodsOfDiscount(SearchGoodsVo searchGoodsVo);

    /**
     * 获取销售发票添加页面详细信息
     *
     * @param businessKey 销售发票信息ID
     * @return
     */
    InvoiceBasicInfo getUpdateDetail(Long businessKey);

    /**
     * 初始化信息
     *
     * @param businessBasicId
     * @param model
     */
    void init(Long businessBasicId, Model model);

    /**
     * 获取核心企业开票信息
     *
     * @param customerId
     * @param businessBasicInfoId
     * @return
     */
    InvoiceCustomerInfo findByCustomer(Long customerId, Long businessBasicInfoId);

    /**
     * 一键下载
     * @param id
     * @param response
     */
    void downloadAllInvoiceFile(Long id, HttpServletResponse response);

    Long addHistorySaleInvoice(InvoiceBasicInfo invoiceBasicInfo, HttpServletRequest request);

    void c_doUpdate(InvoiceBasicInfo invoiceBasicInfo, String taskId, HttpServletRequest request) throws IOException;
}
