package cn.superdesk.uniorder.dubbo.facade.invoice.customer;

import cn.superdesk.uniorder.common.enums.accounting.AccountingOrderTypeDimEnum;
import cn.superdesk.uniorder.common.exception.UnifiedOrderRuntimeException;
import cn.superdesk.uniorder.common.rest.response.R;
import cn.superdesk.uniorder.common.security.dto.LoginSysUser;
import cn.superdesk.uniorder.dao.entity.invoice.customer.InvoiceApply;
import cn.superdesk.uniorder.dao.entity.order.ExpressCompany;
import cn.superdesk.uniorder.dto.param.invoice.customer.*;
import cn.superdesk.uniorder.dto.vo.invoice.customer.*;
import cn.superdesk.uniorder.dto.vo.thirdpart.szhtxx.electronicInvoice.SzhtxxElectronicInvoiceFptxxListItemVo;

import java.util.List;
import java.util.Map;

/**
 * @Description: 发票申请
 * @Author: linjinyu
 * @CreateDate: 7/1/20 2:44 PM
 * @UpdateUser: linjinyu
 * @UpdateDate: 7/1/20 2:44 PM
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public interface DubboInvoiceApplyCustomerService {

    InvoiceApply findById(Long invoiceApplyId);

    List<InvoiceApply> findByIds(List<Long> invoiceApplyIds);

    /**
     * 通过 orderSn 查找 开票状态 单个
     *
     * @param invQuery
     * @return
     */
    List<InvoiceApply> findByOrderSn(Map<String, Object> invQuery);

    List<InvoiceApply> findByAccountingOrderSn(String accountingOrderSn, AccountingOrderTypeDimEnum accountingOrderTypeDimEnum);

    InvoiceApply findByInvoiceApplySn(String invoiceApplySn, LoginSysUser loginSysUser);

    int updateInvoiceApplyByPrimaryKeySelective(InvoiceApply invoiceApply);

    /**
     * 一般订单 发票申请 前的
     *
     * @param params
     * @return
     * @throws UnifiedOrderRuntimeException
     */
    List<InvoiceApplyCustomerSelectScoreVo> invoiceApplySelectFocusUnifiedDimOrder(Map<String, Object> params) throws UnifiedOrderRuntimeException;

    List<InvoiceApplyCustomerSelectScoreVo> invoiceApplySelectFocusUnifiedDimGoods(Map<String, Object> params) throws UnifiedOrderRuntimeException;

    /**
     * 积分订单 发票申请 前的
     *
     * @param criteria
     * @return
     * @throws UnifiedOrderRuntimeException
     */
    List<InvoiceApplyCustomerSelectScoreVo> invoiceApplySelectFocusScoreDimCredit(InvoiceApplyCustomerQueryCriteria criteria) throws UnifiedOrderRuntimeException;

    InvoiceApplyCustomerSelectScoreStruct invoiceApplySelectFocusScoreDimCreditV2_1(InvoiceApplyCustomerQueryCriteria criteria, LoginSysUser loginSysUser) throws UnifiedOrderRuntimeException;

    /**
     * 积分结算2.0 开票申请 提交
     *
     * @param form
     * @param loginSysUser
     * @throws UnifiedOrderRuntimeException
     */
    void opInvoiceApply(InvoiceApplyCommonOpApplyForm form, LoginSysUser loginSysUser) throws UnifiedOrderRuntimeException;

    R<InvoiceApplyFocusScoreOpApplyReportV2_1> opInvoiceApplyV2_1(InvoiceApplyFocusScoreOpApplyFormV2_1 form, LoginSysUser loginSysUser);


    /****************************************** 发票申请管理 start ******************************************/

    R<List<InvoiceApplyCustomerPageVo>> findViewByPageFocusUnified(Map<String, Object> params, int pageNum, int pageSize) throws UnifiedOrderRuntimeException;

    InvoiceApplyCustomerHeadDataVo findViewHeadDataFocusUnified(Map<String, Object> params) throws UnifiedOrderRuntimeException;


    R<List<InvoiceApplyCustomerPageVo>> findViewByPageFocusScore(InvoiceApplyCustomerQueryCriteria queryCriteria, int pageNum, int pageSize) throws UnifiedOrderRuntimeException;

    InvoiceApplyCustomerHeadDataVo findViewHeadDataFocusScore(InvoiceApplyCustomerQueryCriteria queryCriteria) throws UnifiedOrderRuntimeException;


    R<List<InvoiceApplyCustomerPageVo>> findViewByPageFocusScoreV2_1(InvoiceApplyCustomerQueryCriteriaV2_1 queryCriteria, LoginSysUser loginSysUser) throws UnifiedOrderRuntimeException;

    String exportInvoiceApplyListExcelV2_1(InvoiceApplyCustomerQueryCriteriaV2_1 queryCriteria, LoginSysUser loginSysUser);

    InvoiceApplyCustomerHeadDataVoV2_1 findViewHeadDataFocusScoreV2_1(InvoiceApplyCustomerQueryCriteriaV2_1 queryCriteriaV2_1, LoginSysUser loginSysUser) throws UnifiedOrderRuntimeException;



    R<List<InvoiceApplyCustomerPageVo>> findInvoiceListByPageFocusScoreV2_1(InvoiceApplyCustomerQueryCriteriaV2_1 queryCriteriaV2_1, LoginSysUser loginSysUser) throws UnifiedOrderRuntimeException;

    List<InvoiceApplyCustomerPageVo> findInvoiceListFocusScoreV2_1(InvoiceApplyCustomerQueryCriteriaV2_1 queryCriteriaV2_1, LoginSysUser loginSysUser);

    InvoiceApplyCustomerHeadDataVoV2_1 findInvoiceHeadDataFocusScoreV2_1(InvoiceApplyCustomerQueryCriteriaV2_1 queryCriteria, LoginSysUser loginSysUser) throws UnifiedOrderRuntimeException;

    /****************************************** 发票申请管理  end ******************************************/


    List<ExportExcelInvoiceApplyForceUnifiedDimGoodsVo> findInvoiceApplyFocusUnifiedDimGoods(Map<String, Object> params) throws UnifiedOrderRuntimeException;

    /**
     * 积分结算-发票申请管理-opt 导出报表
     *
     * @param criteria
     * @return
     * @throws UnifiedOrderRuntimeException
     */
    List<ExportExcelInvoiceApplyCustomerForceScoreDimCreditVo> findInvoiceApplyFocusScoreDimCredit(InvoiceApplyCustomerQueryCriteria criteria) throws UnifiedOrderRuntimeException;

    String exportExcelInvoiceApplyCustomerFocusUnifiedDimGoods(Map<String, Object> params, LoginSysUser loginSysUser) throws UnifiedOrderRuntimeException;

    String exportExcelInvoiceApplyCustomerFocusScoreDimCredit(InvoiceApplyCustomerQueryCriteria criteria, LoginSysUser loginSysUser) throws UnifiedOrderRuntimeException;


    /****************************************** 发票申请管理 查看详情 start ******************************************/
    /**
     * @param params
     * @return
     * @throws UnifiedOrderRuntimeException
     */
    InvoiceApplyCustomerDetailDimGoodsVo getUnifiedCustomerInvoice2GoodsDetail(Map<String, Object> params) throws UnifiedOrderRuntimeException;

    String exportExcelUnifiedCustomerInvoice2GoodsDetail(Map<String, Object> params, LoginSysUser loginSysUser) throws UnifiedOrderRuntimeException;

    /**
     * @param criteria
     * @return
     * @throws UnifiedOrderRuntimeException
     */
    InvoiceApplyCustomerDetailDimCreditVo getInvoiceApplyCustomerDetailDimCredit(InvoiceApplyCustomerQueryCriteria criteria, LoginSysUser loginSysUser) throws UnifiedOrderRuntimeException;

    InvoiceApplyCustomerDetailDimCreditVoV2_1 getInvoiceApplyCustomerDetailDimCreditV2_1(InvoiceApplyCustomerQueryCriteriaV2_1 criteria, LoginSysUser loginSysUser) throws UnifiedOrderRuntimeException;

    //

    /**
     * mark by linjinyu at 20210223 未开始做
     * mark by linjinyu at 20211112 已完成
     *
     * @param criteria
     * @param loginSysUser
     * @return
     * @throws UnifiedOrderRuntimeException
     */
    String exportExcelUnifiedCustomerInvoice2CreditDetail(InvoiceApplyCustomerQueryCriteria criteria, LoginSysUser loginSysUser) throws UnifiedOrderRuntimeException;

    /****************************************** 发票申请管理 查看详情   end ******************************************/

    /****************************************** 第三方软件导出类 start ******************************************/
    String exportExcelDimUnifiedInvoiceRegister4E6(Long invoiceApplyId, LoginSysUser loginSysUser) throws UnifiedOrderRuntimeException;

    /****************************************** 第三方软件导出类   end ******************************************/


    String importInvoiceExcel(String token, List<Map<String, Object>> list) throws UnifiedOrderRuntimeException;

    String importSendInvoiceExcel(String token, List<Map<String, Object>> list) throws UnifiedOrderRuntimeException;


    List<ExpressCompany> findExpressCompany() throws UnifiedOrderRuntimeException;

    R<List<InvoiceApply>> findInvoiceByPageNew(Map<String, Object> params, int pageNum, int pageSize);


    /**
     * 通过 orderSn 查找 开票状态 批量
     *
     * @param orderSnList
     * @return
     */
    Map<String, InvoiceApply> findByOrderSnList(List<String> orderSnList);


    void validatedInvoiceApplyRelationTable();


    void opAudit(Map<String, Object> params, LoginSysUser loginSysUser) throws UnifiedOrderRuntimeException;

    /**
     * opt 开票登记
     *
     * @param params
     * @param loginSysUser
     * @throws UnifiedOrderRuntimeException
     */
    void opRegister(Map<String, Object> params, LoginSysUser loginSysUser) throws UnifiedOrderRuntimeException;

    int opModifyInvoiceTitle(InvoiceApplyCustomerOpModifyInvoiceTitleForm form, LoginSysUser loginSysUser);

    int opDelete(Long invoiceApplyId, LoginSysUser loginSysUser);

    int opAgainSzhtxxElectronicInvoice(
            InvoiceApplyCustomerOpAgainInvoiceApplyForm form,
            InvoiceApply invoiceApplyEntity,
            SzhtxxElectronicInvoiceFptxxListItemVo fptxxListItemVo,
            LoginSysUser loginSysUser) throws UnifiedOrderRuntimeException;

    int opAgainSzhtxxPaperInvoice(
            InvoiceApplyCustomerOpAgainInvoiceApplyForm form,
            InvoiceApply invoiceApplyEntity,
            SzhtxxElectronicInvoiceFptxxListItemVo fptxxListItemVo,
            LoginSysUser loginSysUser) throws UnifiedOrderRuntimeException;

    /**
     * 操作-opt 寄票登记
     *
     * @param sendInvoiceRegisterList
     * @param loginSysUser
     * @throws UnifiedOrderRuntimeException
     */
    void sendInvoiceRegister(List<Map> sendInvoiceRegisterList, LoginSysUser loginSysUser) throws UnifiedOrderRuntimeException;

    /****************************************** 补丁程序 start ******************************************/

    void patchInvoiceApplyCustomerFixV2_1();


}
