package com.inkasso.factoring.acceptanceManagement.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.inkasso.factoring.acceptanceManagement.entity.AcceptanceSearch;
import com.inkasso.factoring.acceptanceManagement.entity.CAcceptanceBasicInfo;
import com.inkasso.factoring.acceptanceManagement.entity.CAcceptancePersonInfo;
import com.inkasso.factoring.acceptanceManagement.entity.vo.AcceptanceListVo;
import com.inkasso.factoring.acceptanceManagement.entity.vo.CAcceptanceGoodsExcelInfo;
import com.inkasso.factoring.common.entity.GridPage;
import com.inkasso.factoring.common.entity.ResponseJson;
import com.inkasso.factoring.common.util.xml.XMlToDoc;
import com.inkasso.factoring.file.entity.FileStorage;
import com.inkasso.factoring.file.entity.FileStorageDO;
import org.springframework.web.multipart.MultipartFile;

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

/**
 * <p>
 * 下游验收单-基础信息表 服务类
 * </p>
 *
 * @author yafan
 * @since 2023-11-30
 */
public interface ICAcceptanceBasicInfoService extends IService<CAcceptanceBasicInfo> {

    /**
     * 获取采购合同  和销售合同处理人
     *
     * @param businessNumber
     * @return
     */
    List<CAcceptancePersonInfo> personInfoList(String businessNumber);

    /**
     * 根据id查询验收单信息
     *
     * @param acceptanceBasicInfoId
     * @return
     */
    CAcceptanceBasicInfo findDetail(Long acceptanceBasicInfoId);


    /**
     * 查询b端的 时间轴
     *
     * @param id
     */
    ResponseJson timeLine(Long id);

    /**
     * 新建验收单
     *
     * @param acceptanceBasicInfo
     * @param request
     * @return
     */
    ResponseJson add(CAcceptanceBasicInfo acceptanceBasicInfo, HttpServletRequest request) throws Exception;


    void deleteAcceptance(Long id);

    /**
     * 申请审核
     *
     * @param id
     * @return
     */
    ResponseJson applyApprval(Long id,Long taskId);

    /**
     * 创建验收单文件
     * basicInfoId
     */
    List<FileStorageDO> createAcceptance(Long basicInfoId);

    List<File> inputData(CAcceptanceBasicInfo acceptanceBasicInfo, XMlToDoc xmlDoc);

    /**
     * 根据条件查询
     *
     * @param basicInfo
     * @return
     */
    List<CAcceptanceBasicInfo> findByCondition(CAcceptanceBasicInfo basicInfo, Boolean financing);

    /**
     * 获取模板中的货物
     *
     * @param file
     * @return
     */
    List<CAcceptanceGoodsExcelInfo> importGoodsInfo(MultipartFile file);


    /**
     * 下载验收单货物信息模板
     *
     * @return
     */
    void downloadFile(HttpServletResponse response);


    /**
     * 修改验收单
     *
     * @param acceptanceBasicInfo
     * @param request
     * @throws IOException
     */
    ResponseJson updateDetail(CAcceptanceBasicInfo acceptanceBasicInfo, HttpServletRequest request) throws IOException;


    /**
     *
     */
    GridPage<AcceptanceListVo> getBySearch(AcceptanceSearch search);

    /**
     * 下载带货物的模板
     *
     * @param id
     * @param response
     */
    void downLoadGoodsFile(Long id, HttpServletResponse response);


    /**
     * 预览pdf
     *
     * @param acceptanceBasicInfo
     * @return
     */
    List<String> downloadPdf(CAcceptanceBasicInfo acceptanceBasicInfo);

    /**
     * 根绝验收单id
     *
     * @param acceptanceId
     * @return
     */
    List<FileStorage> viewSignFile(Long acceptanceId);

    /**
     * 下载签署后的 上游验收单
     *
     * @param acceptanceId
     */
    void downloadSignFile(Long acceptanceId, HttpServletResponse response);


}
