package com.sunxung.factoring.service.settlement;

import com.sunxung.factoring.entity.GridPage;
import com.sunxung.factoring.entity.ResponseJson;
import com.sunxung.factoring.entity.settlement.SettlementApproval;
import com.sunxung.factoring.entity.settlement.SettlementBasicInfo;
import com.sunxung.factoring.entity.settlement.SettlementElectronicInfo;
import com.sunxung.factoring.entity.settlement.SettlementGoodsInfo;
import com.sunxung.factoring.entity.vo.ConditionVo;
import org.springframework.http.ResponseEntity;

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

/**
 * @author liutao
 * @date 2021.09.24
 */
public interface SettlementManagementService {
    /**
     * 添加结算单
     *
     * @param settlementBasicInfo
     * @param request
     */
    void add(SettlementBasicInfo settlementBasicInfo, HttpServletRequest request) throws Exception;

    /**
     * 财务审核
     *
     * @param settlementApproval
     */
    void financeReview(SettlementApproval settlementApproval);

    /**
     * 修改结算单
     *
     * @param settlementBasicInfo
     * @param request
     */
    void updateBill(SettlementBasicInfo settlementBasicInfo, HttpServletRequest request) throws IOException;

    /**
     * 获取业务相关验收单未结算的货物
     *
     * @param conditionVo
     * @return
     */
//    GridPage getCanBeBillGoodsInformation(ConditionVo conditionVo);

    /**
     * 查看详情
     *
     * @param businessKey
     * @return
     */
    SettlementBasicInfo getDetail(Long businessKey);

    /**
     * 获取结算货物信息
     *
     * @param settlementBasicInfoId
     * @return
     */
    List<SettlementGoodsInfo> getGoodsInfoList(Long settlementBasicInfoId);

    /**
     * 计算对账日期
     *
     * @param settlementBasicInfo
     * @return
     */
    SettlementBasicInfo getExpectedSettlementDate(SettlementBasicInfo settlementBasicInfo);

    /**
     * 一件计算质保金
     *
     * @param settlementBasicInfo
     * @return
     */
    ResponseJson calculation(SettlementBasicInfo settlementBasicInfo);

    /**
     * 生成PDF保存并预览(未签署)
     *
     * @param settlementBasicInfo
     * @param response
     */
    String downloadPdf(SettlementBasicInfo settlementBasicInfo, HttpServletResponse response);

    /**
     * 自动签署
     *
     * @param businessKey
     * @param taskId
     * @return
     */
    SettlementElectronicInfo autoSign(Long businessKey, String taskId);

    /**
     * 轮训查签署状态
     *
     * @param electronicInfoId
     * @return
     */
    Boolean getSignTppe(String electronicInfoId, String taskId, String basicId);

    /**
     * 下载已签署
     *
     * @param settlementBasicInfoId
     * @param res
     */
    void downloadPdfSign(Long settlementBasicInfoId, HttpServletResponse res);

    /**
     * 出证文件下载
     *
     * @param settlementBasicInfoId
     * @param res
     * @return
     */
    void downloadReport(Long settlementBasicInfoId, HttpServletResponse res);

    void doSignCallBackByQuery(String contractId, String[] fdds);

    void billUnitPriceAdjust(SettlementBasicInfo settlementBasicInfo);

    Object billSign(String electronicInfoId, String taskId);

    void c_updateBill(SettlementBasicInfo settlementBasicInfo);
}
