package com.dxhy.core.job.dao;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dxhy.core.entity.TDxRecordInvoice;
import com.dxhy.core.job.entity.*;

/**
 * @author user
 */

@SuppressWarnings({"AlibabaLowerCamelCaseVariableNaming", "AlibabaClassNamingShouldBeCamel"})
@Mapper
public interface TDxRecordInvoiceJobDao extends BaseMapper<TDxRecordInvoiceJobEntity> {
    /**
     * 根据发票代码和发票号码查询发票底账信息
     *
     * @param invoiceCode
     * @param invoiceNo
     * @return
     */
    TDxRecordInvoiceJobEntity findInvoiceByCodeAndNo(String invoiceCode, String invoiceNo);

    /**
     * 保存底账
     *
     * @param recordInvoices
     */
    void insertRecordInvoice(TDxRecordInvoiceJobEntity recordInvoices);

    /**
     * 更新底账
     *
     * @param recordInvoices
     */
    void updateRecordInvoice(TDxRecordInvoiceJobEntity recordInvoices);

    /**
     * 更新发票状态
     *
     * @author 陈刚扬
     * @date 2020/10/30
     * @param state
     * @param rzFlag
     * @return
     */
    int updateInvoiceByState(@Param("state") State state, @Param("rzFlag") String rzFlag);

    /**
     * 勾选发票入库
     *
     * @author 陈刚扬
     * @date 2020/10/30
     * @param invoiceSelectInfo
     * @return void
     */
    void insertBySelect(@Param("invoiceSelectInfo") InvoiceSelectInfo invoiceSelectInfo);

    /**
     * 功能描述
     *
     * @author 陈刚扬
     * @date 2020/10/30
     * @param invoiceCode
     * @param invoiceNo
     * @param linkName
     * @return int
     */
    int findCountInvoiceByCodeAndNo(@Param("invoice_code") String invoiceCode, @Param("invoice_no") String invoiceNo,
        @Param("linkName") String linkName);

    /**
     * 功能描述
     *
     * @author 陈刚扬
     * @date 2020/10/30
     * @param invoiceInfo
     * @return void
     */
    void updateInvoiceByCodeAndNo(@Param("invoiceInfo") TDxRecordInvoiceJobEntity invoiceInfo);

    /**
     * 功能描述
     *
     * @author 陈刚扬
     * @date 2020/10/30
     * @param invoiceInfo
     * @param linkName
     * @return void
     */
    void updateSignData(@Param("invoiceInfo") TDxRecordInvoiceJobEntity invoiceInfo,
        @Param("linkName") String linkName);

    /**
     * 功能描述
     *
     * @author 陈刚扬
     * @date 2020/10/30
     * @param code
     * @param no
     * @return com.dxhy.core.job.entity.InvoiceScanEntity
     */
    InvoiceScanEntity selectSign(@Param("code") String code, @Param("no") String no);

    /**
     * 查询是否推送艺龙结算平台
     *
     * @param uuid
     * @return
     */
    InvoiceScanEntity selectByScan(@Param("uuid") String uuid, @Param("dxhyAdmin") String dxhyAdmin);

    /**
     * 功能描述
     *
     * @author 陈刚扬
     * @date 2020/10/30
     * @param taxno
     * @param linkName
     * @param type
     * @return java.lang.String
     */
    String selectLastInvoiceDate(@Param("taxno") String taxno, @Param("linkName") String linkName,
        @Param("type") String type);

    /**
     * 获取需要采集的税号信息
     *
     * @param taxno
     *            税号信息
     * @return 返回
     */
    TAcOrg selectOrgCollectDate(@Param("taxno") String taxno);

    /**
     * 功能描述
     *
     * @author 陈刚扬
     * @date 2020/10/30
     * @param uuid
     * @return com.dxhy.core.job.entity.TDxRecordInvoiceJobEntity
     */
    TDxRecordInvoiceJobEntity findInvoiceByUUid(@Param("uuid") String uuid);

    /**
     * 功能描述
     *
     * @author 陈刚扬
     * @date 2020/10/30
     * @param invoice
     * @param taxno
     * @return void
     */
    void updateInvoice(@Param("invoiceInfo") TDxRecordInvoiceJobEntity invoice, @Param("taxno") String taxno);

    /**
     * 功能描述
     *
     * @author 陈刚扬
     * @date 2020/10/30
     * @param taxno
     * @param linkName
     * @param type
     * @return java.lang.String
     */
    String selectLastInvoiceDateQPM(@Param("taxno") String taxno, @Param("linkName") String linkName,
        @Param("type") String type);

    /**
     * 功能描述
     *
     * @author 陈刚扬
     * @date 2020/10/30
     * @param buyerTaxNo
     * @return java.lang.String
     */
    String getGfNameByTaxno(@Param("taxno") String buyerTaxNo);

    /**
     * 功能描述
     *
     * @author 陈刚扬
     * @date 2020/10/30
     * @param recordInvoices
     * @return void
     */
    void updateInvoiceDetail(@Param("invoiceInfo") TDxRecordInvoice recordInvoices);

    /**
     * 功能描述
     *
     * @author 陈刚扬
     * @date 2020/10/30
     * @param rs
     * @return void
     */
    void saveStatistics(@Param("rs") TDxRecordInvoiceStatistics rs);

    /**
     * 功能描述
     *
     * @author 陈刚扬
     * @date 2020/10/30
     * @param tDxInvoiceLog
     * @return void
     */
    void insertInvoiceLog(@Param("tDxInvoiceLog") TDxInvoiceLogJobEntity tDxInvoiceLog);

    /**
     * 查询集团编码
     *
     * @author 陈刚扬
     * @date 2020/10/30
     * @param gfTaxNo
     * @return java.lang.String
     */
    String findCompany(@Param("gfTaxNo") String gfTaxNo);

    /**
     * 功能描述
     *
     * @author 陈刚扬
     * @date 2020/10/30
     * @param invoiceCode
     * @param invoiceNo
     * @param type
     * @return java.lang.Integer
     */
    Integer getInvoiceLog(@Param("invoiceCode") String invoiceCode, @Param("invoiceNo") String invoiceNo,
        @Param("type") String type);

    /**
     * 修改销项数据信息
     *
     * @param invoice
     *            发票信息
     * @param gfTaxNo
     *            税号
     */

    void updateSaleInvoice(@Param("invoiceInfo") TDxRecordInvoiceJobEntity invoice, @Param("taxno") String gfTaxNo);

    /**
     * 查询销项数据
     *
     * @param invoiceCode
     *            发票代码
     * @param invoiceNo
     *            发票号码
     * @return 发票信息
     */
    TDxRecordInvoiceJobEntity findSaleInvoiceByCodeAndNo(String invoiceCode, String invoiceNo);

    /**
     * 根据销方税号信息，更新供应商状态标识
     */
    void  updateInvoiceByxfTaxNo(String xfsh);
}
