package com.dxhy.core.job.dao;

import java.util.Date;
import java.util.List;

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

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dxhy.core.job.entity.TDxCustomsApplyRecord;
import com.dxhy.api.model.invoice.TDxExportInvoice;
import com.dxhy.api.model.invoice.TDxRecordInvoice;
import com.dxhy.core.job.pojo.LegalizeResult;

/**
 * 功能描述
 *
 * @author 陈刚扬
 * @date 2020/10/30
 */
@SuppressWarnings("AlibabaClassNamingShouldBeCamel")
@Mapper
public interface TDxExportInvoiceJobDao extends BaseMapper<TDxExportInvoice> {
    /**
     * 功能描述
     *
     * @author 陈刚扬
     * @date 2020/10/30
     * @param taxno
     * @return java.lang.String
     */
    String selectLastExportInvoiceDate(@Param("taxno") String taxno);

    /**
     * 查询出口转内销发票
     *
     * @author 陈刚扬
     * @date 2020/10/30
     * @param exportNo
     * @param uuid
     * @param gfTaxNo
     * @return com.dxhy.api.model.invoice.TDxExportInvoice
     */
    TDxExportInvoice findInvoice(@Param("exportNo") String exportNo, @Param("uuid") String uuid,
                                 @Param("gfTaxNo") String gfTaxNo);

    /**
     * 代码号码查询发票
     *
     * @author 陈刚扬
     * @date 2020/10/30
     * @param invoiceCode
     * @param invoiceNo
     * @return com.dxhy.core.job.entity.TDxRecordInvoiceJobEntity
     */
    TDxRecordInvoice findInvoiceByCodeAndNo(String invoiceCode, String invoiceNo);
    TDxRecordInvoice findInvoiceByUUID(String uuid);

    /**
     * 更新出口
     *
     * @author 陈刚扬
     * @date 2020/10/30
     * @param entity
     * @return void
     */
    void updateExportInvoice(TDxExportInvoice entity);

    /**
     * 更新出口转内销标志
     *
     * @author 陈刚扬
     * @date 2020/10/30
     * @param entity
     * @return void
     */
    void updateExportMark(TDxRecordInvoice entity);

    /**
     * 查询需要发送税号
     *
     * @author 陈刚扬
     * @date 2020/10/30
     * @param
     * @return java.util.List<java.lang.String>
     */
    List<String> getNeedSendTaxNo();

    /**
     * 申请认证发票税号
     *
     * @author 陈刚扬
     * @date 2020/10/30
     * @param taxno
     * @return int
     */
    int getApplyInvoiceCount(@Param("taxno") String taxno);

    /**
     * 查询批次号
     *
     * @author 陈刚扬
     * @date 2020/10/30
     * @param type
     * @return java.util.List<com.dxhy.core.job.entity.TDxCustomsApplyRecord>
     */
    List<TDxCustomsApplyRecord> getBatchNo(@Param("type") String type);

    /**
     * 出口发票
     *
     * @author 陈刚扬
     * @date 2020/10/30
     * @param taxno
     * @return java.util.List<com.dxhy.api.model.invoice.TDxExportInvoice>
     */
    List<TDxExportInvoice> getApplyExportInvoice(@Param("taxno") String taxno);

    /**
     * 出口转内销认证申请
     *
     * @author 陈刚扬
     * @date 2020/10/30
     * @param exportNo
     * @param rzlx
     * @param uuid
     * @param gfTaxNo
     * @return void
     */
    void updateExportInvoiceApply(@Param("exportNo") String exportNo, @Param("rzlx") String rzlx,
        @Param("uuid") String uuid, @Param("gfTaxNo") String gfTaxNo);

    /**
     * 更新认证结果
     *
     * @author 陈刚扬
     * @date 2020/10/30
     * @param result
     * @param rzhDate
     * @param gfTaxNo
     * @return void
     */
    void updateRecord(@Param("result") LegalizeResult result, @Param("rzhDate") Date rzhDate,
        @Param("gfTaxNo") String gfTaxNo);

    /**
     * 更新申请信息
     *
     * @author 陈刚扬
     * @date 2020/10/30
     * @param exportNo
     * @param invoiceCode
     * @param invoiceNo
     * @param gfTaxNo
     * @return void
     */
    void updateApply(@Param("exportNo") String exportNo, @Param("invoiceCode") String invoiceCode,
        @Param("invoiceNo") String invoiceNo, @Param("gfTaxNo") String gfTaxNo);

    /**
     * 更新撤销不抵扣状态
     *
     * @author 陈刚扬
     * @date 2020/10/30
     * @param result
     * @param rzhDate
     * @param gfTaxNo
     * @return void
     */
    void updateRecordForRebackNoDeduction(@Param("result") LegalizeResult result, @Param("rzhDate") Date rzhDate,
        @Param("gfTaxNo") String gfTaxNo);

    /**
     * 更新认证不抵扣状态
     *
     * @author 陈刚扬
     * @date 2020/10/30
     * @param result
     * @param rzhDate
     * @param gfTaxNo
     * @return void
     */
    void updateRecordForNoDeduction(@Param("result") LegalizeResult result, @Param("rzhDate") Date rzhDate,
        @Param("gfTaxNo") String gfTaxNo);

    /**
     * 更新撤销认证状态
     *
     * @author 陈刚扬
     * @date 2020/10/30
     * @param result
     * @param rzhDate
     * @param gfTaxNo
     * @return void
     */
    void updateRecordForRebackRz(@Param("result") LegalizeResult result, @Param("rzhDate") Date rzhDate,
        @Param("gfTaxNo") String gfTaxNo);

}
