<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dxhy.extend.dao.ExtIndexStatisticsMapper">
    <!--发票采集 -->
    <resultMap id="IndexInvoiceCollectionMap"
               type="com.dxhy.extend.entity.ExtIndexInvoiceCollectionModel">
        <result column="id" jdbcType="BIGINT" property="id"/>
        <result column="invoice_type" jdbcType="VARCHAR"
                property="invoiceType"/>
        <result column="invoice_code" jdbcType="VARCHAR"
                property="invoiceCode"/>
        <result column="invoice_no" jdbcType="VARCHAR"
                property="invoiceNo"/>
        <result column="invoice_date" jdbcType="TIMESTAMP"
                property="invoiceDate"/>
        <result column="gf_tax_no" jdbcType="VARCHAR"
                property="gfTaxNo"/>
        <result column="gf_name" jdbcType="VARCHAR" property="gfName"/>
        <result column="gf_address_and_phone" jdbcType="VARCHAR"
                property="gfAddressAndPhone"/>
        <result column="gf_bank_and_no" jdbcType="VARCHAR"
                property="gfBankAndNo"/>
        <result column="xf_tax_no" jdbcType="VARCHAR"
                property="xfTaxNo"/>
        <result column="xf_name" jdbcType="VARCHAR" property="xfName"/>
        <result column="xf_address_and_phone" jdbcType="VARCHAR"
                property="xfAddressAndPhone"/>
        <result column="xf_bank_and_no" jdbcType="VARCHAR"
                property="xfBankAndNo"/>
        <result column="invoice_amount" jdbcType="DECIMAL"
                property="invoiceAmount"/>
        <result column="tax_amount" jdbcType="DECIMAL"
                property="taxAmount"/>
        <result column="total_amount" jdbcType="DECIMAL"
                property="totalAmount"/>
        <result column="invoice_status" jdbcType="VARCHAR"
                property="invoiceStatus"/>
        <result column="status_update_date" jdbcType="TIMESTAMP"
                property="statusUpdateDate"/>
        <result column="last_update_date" jdbcType="TIMESTAMP"
                property="lastUpdateDate"/>
        <result column="rzh_date" jdbcType="TIMESTAMP"
                property="rzhDate"/>
        <result column="qs_date" jdbcType="TIMESTAMP" property="qsDate"/>
        <result column="rzh_belong_date_late" jdbcType="VARCHAR"
                property="rzhBelongDateLate"/>
        <result column="rzh_belong_date" jdbcType="VARCHAR"
                property="rzhBelongDate"/>
        <result column="confirm_date" jdbcType="TIMESTAMP"
                property="confirmDate"/>
        <result column="rzh_type" jdbcType="VARCHAR" property="rzhType"/>
        <result column="rzh_yesorno" jdbcType="VARCHAR"
                property="rzhYesorno"/>
        <result column="gx_user_account" jdbcType="VARCHAR"
                property="gxUserAccount"/>
        <result column="gx_user_name" jdbcType="VARCHAR"
                property="gxUserName"/>
        <result column="source_system" jdbcType="VARCHAR"
                property="sourceSystem"/>
        <result column="valid" jdbcType="VARCHAR" property="valid"/>
        <result column="uuid" jdbcType="VARCHAR" property="uuid"/>
        <result column="create_date" jdbcType="TIMESTAMP"
                property="createDate"/>
        <result column="gx_date" jdbcType="TIMESTAMP" property="gxDate"/>
        <result column="rzh_back_msg" jdbcType="VARCHAR"
                property="rzhBackMsg"/>
        <result column="dqskssq" jdbcType="VARCHAR" property="dqskssq"/>
        <result column="gxjzr" jdbcType="VARCHAR" property="gxjzr"/>
        <result column="gxfwq" jdbcType="VARCHAR" property="gxfwq"/>
        <result column="gxfwz" jdbcType="VARCHAR" property="gxfwz"/>
        <result column="sfygx" jdbcType="VARCHAR" property="sfygx"/>
        <result column="detail_yesorno" jdbcType="VARCHAR"
                property="detailYesorno"/>
        <result column="gx_type" jdbcType="VARCHAR" property="gxType"/>
        <result column="auth_status" jdbcType="VARCHAR"
                property="authStatus"/>
        <result column="send_date" jdbcType="TIMESTAMP"
                property="sendDate"/>
        <result column="rzlx" jdbcType="VARCHAR" property="rzlx"/>
        <result column="sfdbts" jdbcType="VARCHAR" property="sfdbts"/>
        <result column="qs_type" jdbcType="VARCHAR" property="qsType"/>
        <result column="qs_status" jdbcType="VARCHAR"
                property="qsStatus"/>
        <result column="check_code" jdbcType="VARCHAR"
                property="checkCode"/>
        <result column="txfbz" jdbcType="VARCHAR" property="txfbz"/>
        <result column="lslbz" jdbcType="VARCHAR" property="lslbz"/>
        <result column="out_status" jdbcType="VARCHAR"
                property="outStatus"/>
        <result column="out_invoice_amout" jdbcType="DECIMAL"
                property="outInvoiceAmout"/>
        <result column="out_tax_amount" jdbcType="DECIMAL"
                property="outTaxAmount"/>
        <result column="out_reason" jdbcType="VARCHAR"
                property="outReason"/>
        <result column="out_date" jdbcType="TIMESTAMP"
                property="outDate"/>
        <result column="remark" jdbcType="LONGVARCHAR"
                property="remark"/>
        <result column="out_remark" jdbcType="LONGVARCHAR"
                property="outRemark"/>
        <result column="dk_tax_amount" jdbcType="DECIMAL"
                property="dkse"/>
        <result column="bdk_status" jdbcType="VARCHAR" property="bdkStatus"/>
        <result column="authenticationType"
                property="authenticationType"/>
    </resultMap>

    <!--今日发票采集map -->
    <resultMap id="indexInvoiceCollectionCountMap"
               type="com.dxhy.extend.entity.ExtIndexInvoiceCollectionModel">
        <result column="countNum" property="countNum"/>
        <result column="invoiceType" property="invoiceType"/>
    </resultMap>
    <!--发票扫描 -->
    <resultMap id="IndexInvoiceScanningMap"
               type="com.dxhy.extend.entity.ExtIndexInvoiceScanningModel">
        <result column="id" jdbcType="BIGINT" property="id"/>
        <result column="invoice_type" jdbcType="VARCHAR"
                property="invoiceType"/>
        <result column="invoice_code" jdbcType="VARCHAR"
                property="invoiceCode"/>
        <result column="invoice_no" jdbcType="VARCHAR"
                property="invoiceNo"/>
        <result column="invoice_serial_no" jdbcType="VARCHAR"
                property="invoiceSerialNo"/>
        <result column="gf_tax_no" jdbcType="VARCHAR"
                property="gfTaxNo"/>
        <result column="gf_name" jdbcType="VARCHAR" property="gfName"/>
        <result column="xf_tax_no" jdbcType="VARCHAR"
                property="xfTaxNo"/>
        <result column="xf_name" jdbcType="VARCHAR" property="xfName"/>
        <result column="invoice_amount" jdbcType="DECIMAL"
                property="invoiceAmount"/>
        <result column="tax_amount" jdbcType="DECIMAL"
                property="taxAmount"/>
        <result column="total_amount" jdbcType="DECIMAL"
                property="totalAmount"/>
        <result column="invoice_date" jdbcType="TIMESTAMP"
                property="invoiceDate"/>
        <result column="user_account" jdbcType="VARCHAR"
                property="userAccount"/>
        <result column="user_name" jdbcType="VARCHAR"
                property="userName"/>
        <result column="qs_type" jdbcType="VARCHAR" property="qsType"/>
        <result column="qs_status" jdbcType="VARCHAR"
                property="qsStatus"/>
        <result column="valid" jdbcType="VARCHAR" property="valid"/>
        <result column="uuid" jdbcType="VARCHAR" property="uuid"/>
        <result column="create_date" jdbcType="TIMESTAMP"
                property="createDate"/>
        <result column="update_date" jdbcType="TIMESTAMP"
                property="updateDate"/>
        <result column="qs_date" jdbcType="TIMESTAMP" property="qsDate"/>
        <result column="scan_id" jdbcType="VARCHAR" property="scanId"/>
        <result column="notes" jdbcType="VARCHAR" property="notes"/>
        <result column="check_code" jdbcType="VARCHAR"
                property="checkCode"/>
    </resultMap>
    <!--今日发票扫描map -->
    <resultMap id="indexInvoiceScanningCountMap"
               type="com.dxhy.extend.entity.ExtIndexInvoiceScanningCountModel">
        <result column="qsType" property="qsType"/>
        <result column="countNum" property="countNum"/>
    </resultMap>


    <!--今日发票认证map -->
    <resultMap id="indexInvoiceAuthenticationCountMap"
               type="com.dxhy.extend.entity.ExtIndexInvoiceAuthenticationCountModel">
        <result column="authenticationType"
                property="authenticationType"/>
        <result column="countNum" property="countNum"/>
    </resultMap>

    <!--本月新增发票信息 -->
    <resultMap id="indexInvoiceInformationOfMonthMap"
               type="com.dxhy.extend.entity.ExtIndexInvoiceMonthInformationModel">
        <result column="xzInvoice" property="xzInvoice"/>
        <result column="yrzInvoice" property="yrzInvoice"/>
        <result column="taxAmountCount" property="taxAmountCount"/>
        <result column="invoiceAmountCount"
                property="invoiceAmountCount"/>
    </resultMap>
    <!--月度统计 -->
    <resultMap id="indexInvoiceChartStatisticsMap"
               type="com.dxhy.extend.entity.ExtIndexInvoiceChartStatisticsModel">
        <result column="xzInvoiceCount" property="xzInvoiceCount"/>
        <result column="rzcgInvoiceCount" property="rzcgInvoiceCount"/>
        <result column="rzsbInvoiceCount" property="rzsbInvoiceCount"/>
        <result column="dayOfMonthInYear" property="dayOfMonthInYear"/>
        <result column="rzcgDayOfMonthInYear"
                property="rzcgDayOfMonthInYear"/>
        <result column="rzsbDayOfMonthInYear"
                property="rzsbDayOfMonthInYear"/>
    </resultMap>

    <!--任务提醒 -->
    <resultMap id="indexInvoiceTaskRemindingMap"
               type="com.dxhy.extend.entity.ExtIndexInvoiceTaskRemindingModel">
        <result column="countNum" property="countNum"/>
        <result column="warningType" property="warningType"/>

    </resultMap>

    <select id="getOrgType" resultType="Integer">
        select count(1) from t_dx_tax_current where company_type in ('WM','ZF') and taxno in
        <foreach item="item" index="index" collection="orgs" open="(" separator="," close=")">
            #{item}
        </foreach>
    </select>

    <sql id="indexInvoiceCollectionList">
        id, invoice_type, invoice_code, invoice_no, invoice_date, gf_tax_no,
		gf_name, gf_address_and_phone,
		gf_bank_and_no, xf_tax_no, xf_name, xf_address_and_phone, xf_bank_and_no,
		invoice_amount,
		tax_amount, total_amount, invoice_status, status_update_date, last_update_date,
		rzh_date,
		qs_date, rzh_belong_date_late, rzh_belong_date, confirm_date, rzh_type,
		rzh_yesorno,
		gx_user_account, gx_user_name, source_system, valid, uuid, create_date, gx_date,
		rzh_back_msg, dqskssq, gxjzr, gxfwq, gxfwz, sfygx, detail_yesorno,
		gx_type, auth_status,
		send_date, rzlx, sfdbts, qs_type, qs_status, check_code, txfbz, lslbz,
		out_status,
		out_invoice_amout, out_tax_amount, out_reason, out_date ,remark, out_remark
    </sql>

    <sql id="indexInvoiceScanningList">
        id, invoice_type, invoice_code, invoice_no, invoice_serial_no, gf_tax_no,
		gf_name,
		xf_tax_no, xf_name, invoice_amount, tax_amount, total_amount, invoice_date,
		user_account,
		user_name, qs_type, qs_status, valid, uuid, create_date, update_date, qs_date,
		scan_id,
		notes, check_code
    </sql>


    <select id="getInvoiceCollectionSituationMap" resultType="map"
            databaseId="mysql">
        SELECT
        sum(case when tdri.invoice_type = '01' then 1 else 0 end) as 'zpInvoiceCount',
        sum(case when tdri.invoice_type = '31' then 1 else 0 end) as 'qdInvoiceCount',
        sum(case when tdri.invoice_type = '03' then 1 else 0 end) as 'jdcInvoiceCount',
        sum(case when tdri.invoice_type = '08' then 1 else 0 end) as 'dzzpInvoiceCount',
        sum(case when (tdri.invoice_type = '14' or (tdri.invoice_type = '32' and tdri.lq_tdyslxDm='08') ) then 1 else 0 end) as 'txfInvoiceCount',
        sum(case when tdri.detail_yesorno = '0' then 1 else 0 end) as 'wbmxInvoiceCount',
        sum(case when tdri.invoice_type = '283' then 1 else 0 end) as 'dzkpInvoiceCount',
        <!--
        sum(case when tdri.invoice_type = '32' and tdri.lq_tdyslxDm='08' then 1 else 0 end) as 'qdpInvoiceCount',
        -->
        sum(case when tdri.invoice_type = '183' then 1 else 0 end) as 'jdcdzInvoiceCount',
        sum(case when tdri.invoice_type = '161' then 1 else 0 end) as 'xcdInvoiceCount',
        sum(case when tdri.invoice_type = '185' then 1 else 0 end) as 'qdzzInvoiceCount'
        FROM t_dx_record_invoice tdri
        where tdri.gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and tdri.source_system = '0'
        and (tdri.invoice_type in(${krzpz}) or (tdri.invoice_type ='32' and tdri.lq_tdyslxDm='08'))
        AND date_format(tdri.create_date,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')

    </select>

    <select id="getInvoiceCollectionSituationMap" resultType="map"
            databaseId="oracle">
        SELECT
        sum(decode(tdri.invoice_type, '01', '1', '0'))as "zpInvoiceCount",
        sum(decode(tdri.invoice_type, '03', '1', '0'))as "jdcInvoiceCount",
        sum(decode(tdri.invoice_type, '08', '1', '0'))as "dzzpInvoiceCount",
        <!--
        sum(decode(tdri.invoice_type, '14', '1', '0'))as "txfInvoiceCount",
        -->
        sum( case when (tdri.invoice_type = '14' or (tdri.invoice_type = '32' and tdri.lq_tdyslxDm='08') ) then 1 else 0 end  )as "txfInvoiceCount",
        sum(decode(tdri.invoice_type, '31', '1', '0'))as "qdInvoiceCount",
        sum(decode(tdri.detail_yesorno, '0', '1', '0'))as "wbmxInvoiceCount",
        sum(decode(tdri.invoice_type, '283', '1', '0'))as "dzkpInvoiceCount",
        sum(decode(tdri.invoice_type, '183', '1', '0'))as "jdcdzInvoiceCount",
        sum(decode(tdri.invoice_type, '161', '1', '0'))as "xcdInvoiceCount",
        sum(decode(tdri.invoice_type, '185', '1', '0'))as "qdzzInvoiceCount"
        <!--
        sum(decode(tdri.invoice_type, '32',decode(tdri.lq_tdyslxDm, '08','1' , '0') , '0'))as "qdpInvoiceCount"
        -->
        FROM t_dx_record_invoice tdri
        where tdri.gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and tdri.source_system = '0'
        and (tdri.invoice_type in(${krzpz}) or (tdri.invoice_type ='32' and tdri.lq_tdyslxDm='08'))
        AND to_char(tdri.create_date,'yyyy-MM-dd') = to_char(SYSDATE,'yyyy-MM-dd')
    </select>

    <select id="getCustomsCollectionSituationMap" resultType="map"
            databaseId="mysql">
        SELECT
        sum(case when tdcr.data_type = '17' then 1 else 0 end) as 'jksInvoiceCount'
        FROM t_dx_customs_record tdcr
        where tdcr.gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and tdcr.data_sources = '0'
        AND date_format(tdcr.create_date,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')

    </select>

    <select id="getCustomsCollectionSituationMap" resultType="map"
            databaseId="oracle">
        SELECT
        sum(decode(tdcr.data_type, '17', '1', '0'))as "jksInvoiceCount"
        FROM t_dx_customs_record tdcr
        where tdcr.gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and tdcr.data_sources = '0'
        AND tdcr.data_type = '17'
        AND to_char(tdcr.create_date,'yyyy-MM-dd') = to_char(SYSDATE,'yyyy-MM-dd')
    </select>


    <!--今日发票采集列表 -->
    <select id="getInvoiceCollectionSituationList"
            resultMap="IndexInvoiceCollectionMap" databaseId="mysql">
        SELECT
        tdri.*
        FROM t_dx_record_invoice tdri
        where tdri.gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        <if test="paramsData.startDate != null and paramsData.startDate != ''">
            <![CDATA[ AND  date_format(tdri.create_date,'%Y-%m-%d') >= date_format(#{paramsData.startDate},'%Y-%m-%d') ]]>
        </if>
        <if test="paramsData.endDate != null and paramsData.endDate != ''">
            <![CDATA[ AND date_format(tdri.create_date,'%Y-%m-%d') <= date_format(#{paramsData.endDate},'%Y-%m-%d') ]]>
        </if>

        <if test="paramsData.monthCount==null">
            and tdri.source_system = '0'
        </if>
        <if test="paramsData.invoiceType != null and paramsData.invoiceType != ''">
            AND tdri.invoice_type = #{paramsData.invoiceType}
        </if>
        <if test="paramsData.invoiceType == null or paramsData.invoiceType == ''">
            AND tdri.invoice_type IN ('01','03','08','14')
        </if>
        <if test="paramsData.detailYesOrNo != null and paramsData.detailYesOrNo != ''">
            AND tdri.detail_yesorno = '0'
        </if>
    </select>
    <!--今日缴款书采集列表 -->
    <select id="getCustomsCollectionSituationList"
            resultType="com.dxhy.extend.entity.ExtIndexCustomsCollectionModel" databaseId="mysql">
        SELECT
        tdcr.gf_tax_no gfTaxNo,tdcr.gf_name gfName,tdcr.customs_code
        customsNo,date_format(tdcr.fill_in_date,'%Y-%m-%d')
        fillInDate,
        tdcr.tax_amount taxAmount,tdcr.glzt glzt,tdcr.entry_discrepancy
        entryDiscrepancy,date_format(tdcr.create_date,'%Y-%m-%d') createDate
        FROM t_dx_customs_record tdcr
        where tdcr.gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        <if test="paramsData.startDate != null and paramsData.startDate != ''">
            <![CDATA[ AND  date_format(tdcr.create_date,'%Y-%m-%d') >= date_format(#{paramsData.startDate},'%Y-%m-%d') ]]>
        </if>
        <if test="paramsData.endDate != null and paramsData.endDate != ''">
            <![CDATA[ AND date_format(tdcr.create_date,'%Y-%m-%d') <= date_format(#{paramsData.endDate},'%Y-%m-%d') ]]>
        </if>

        <if test="paramsData.monthCount==null">
            and tdcr.data_sources = '0'
        </if>
        <if test="paramsData.invoiceType != null and paramsData.invoiceType != ''">
            AND tdcr.data_type = #{paramsData.invoiceType}
        </if>

    </select>

    <select id="getInvoiceCollectionSituationList"
            resultMap="IndexInvoiceCollectionMap" databaseId="oracle">
        SELECT
        tdri.*
        FROM t_dx_record_invoice tdri
        where tdri.gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        <if test="paramsData.startDate != null and paramsData.startDate != ''">
            <![CDATA[ AND tdri.create_date  >= to_date(#{paramsData.startDate},'yyyy-mm-dd') ]]>
        </if>
        <if test="paramsData.endDate != null and paramsData.endDate != ''">
            <![CDATA[ AND tdri.create_date  <= to_date(#{paramsData.endDate},'yyyy-mm-dd') ]]>
        </if>

        <if test="paramsData.monthCount==null">
            and tdri.source_system = '0'
        </if>
        <if test="paramsData.invoiceType != null and paramsData.invoiceType != ''">
            AND tdri.invoice_type = #{paramsData.invoiceType}
        </if>
        <if test="paramsData.invoiceType == null or paramsData.invoiceType == ''">
            AND tdri.invoice_type IN ('01','03','14','31')
        </if>

        <if test="paramsData.detailYesOrNo != null and paramsData.detailYesOrNo != ''">
            AND tdri.detail_yesorno = '0'
        </if>
    </select>

    <select id="getCustomsCollectionSituationList"
            resultType="com.dxhy.extend.entity.ExtIndexCustomsCollectionModel" databaseId="oracle">
        SELECT
        tdcr.gf_tax_no gfTaxNo,tdcr.gf_name gfName,tdcr.customs_code
        customsNo,to_char(tdcr.fill_in_date,'yyyy-mm-dd')
        fillInDate,
        tdcr.tax_amount taxAmount,tdcr.glzt glzt,tdcr.entry_discrepancy
        entryDiscrepancy,to_char(tdcr.create_date,'yyyy-mm-dd') createDate
        FROM t_dx_customs_record tdcr
        where tdcr.gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        <if test="paramsData.startDate != null and paramsData.startDate != ''">
            <![CDATA[ AND tdcr.create_date  >= to_date(#{paramsData.startDate},'yyyy-mm-dd') ]]>
        </if>
        <if test="paramsData.endDate != null and paramsData.endDate != ''">
            <![CDATA[ AND tdcr.create_date  <= to_date(#{paramsData.endDate},'yyyy-mm-dd') ]]>
        </if>

        <if test="paramsData.monthCount==null">
            and tdcr.data_sources = '0'
        </if>
        <if test="paramsData.invoiceType != null and paramsData.invoiceType != ''">
            AND tdcr.data_type = #{paramsData.invoiceType}
        </if>

    </select>
    <!--今日发票扫描情况 -->
    <select id="getInvoiceScanningSituation"
            resultMap="indexInvoiceScanningCountMap" databaseId="oracle">
        SELECT COUNT(1) countNum,
        decode(tdi.qs_status, '0', 'wqsCount', '1', 'yqsCount', 'Unknown') AS
        qsType
        FROM t_dx_invoice tdi
        where
        to_char(tdi.qs_date,'yyyy-mm-dd') = to_char(sysdate,'yyyy-mm-dd')
        <if test="paramsData.userName != null">
            AND tdi.user_name = #{paramsData.userName}
        </if>
        GROUP BY tdi.qs_status
        UNION
        SELECT COUNT(1) "countNum",'totalCount' AS "qsType"
        FROM t_dx_invoice tdi
        where to_char(tdi.qs_date,'yyyy-mm-dd') = to_char(sysdate,'yyyy-mm-dd')
        <if test="paramsData.userName != null">
            AND tdi.user_name = #{paramsData.userName}
        </if>
    </select>

    <select id="getInvoiceScanningSituation"
            resultMap="indexInvoiceScanningCountMap" databaseId="mysql">
        SELECT COUNT(1) countNum,
        CASE WHEN
        tdi.qs_status = '0' THEN 'wqsCount'
        WHEN tdi.qs_status = '1' THEN 'yqsCount'
        END AS 'qsType'
        FROM t_dx_invoice tdi
        where
        date_format(tdi.qs_date,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')
        <if test="paramsData.userName != null">
            AND tdi.user_name = #{paramsData.userName}
        </if>
        GROUP BY tdi.qs_status
        UNION
        SELECT COUNT(1) countNum,'totalCount' AS qsType
        FROM t_dx_invoice tdi
        where date_format(tdi.qs_date,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')
        <if test="paramsData.userName != null">
            AND tdi.user_name = #{paramsData.userName}
        </if>
    </select>
    <!--今日发票扫描情况 -->
    <select id="getCustomsScanningSituation"
            resultMap="indexInvoiceScanningCountMap" databaseId="oracle">
        SELECT COUNT(1) countNum,
        decode(tdc.qs_status, '0', 'wqsCount', '1', 'yqsCount', 'Unknown') AS
        qsType
        FROM t_dx_customs tdc
        where
        to_char(tdc.qs_date,'yyyy-mm-dd') = to_char(sysdate,'yyyy-mm-dd')
        <if test="paramsData.userName != null">
            AND tdc.user_name = #{paramsData.userName}
        </if>
        GROUP BY tdc.qs_status
        UNION
        SELECT COUNT(1) "countNum",'totalCount' AS "qsType"
        FROM t_dx_customs tdc
        where to_char(tdc.qs_date,'yyyy-mm-dd') = to_char(sysdate,'yyyy-mm-dd')
        <if test="paramsData.userName != null">
            AND tdc.user_name = #{paramsData.userName}
        </if>
    </select>

    <select id="getCustomsScanningSituation"
            resultMap="indexInvoiceScanningCountMap" databaseId="mysql">
        SELECT COUNT(1) countNum,
        CASE WHEN
        tdc.qs_status = '0' THEN 'wqsCount'
        WHEN tdc.qs_status = '1' THEN 'yqsCount'
        END AS 'qsType'
        FROM t_dx_customs tdc
        where
        date_format(tdc.qs_date,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')
        <if test="paramsData.userName != null">
            AND tdc.user_name = #{paramsData.userName}
        </if>
        GROUP BY tdc.qs_status
        UNION
        SELECT COUNT(1) countNum,'totalCount' AS qsType
        FROM t_dx_customs tdc
        where date_format(tdc.qs_date,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')
        <if test="paramsData.userName != null">
            AND tdc.user_name = #{paramsData.userName}
        </if>
    </select>


    <!--今日发票扫描列表 -->
    <select id="getInvoiceScanningSituationList"
            resultMap="IndexInvoiceScanningMap" databaseId="mysql">
        SELECT
        tdi.*
        FROM t_dx_invoice tdi
        where
        date_format(tdi.qs_date,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')
        <if test="paramsData.userName != null">
            AND tdi.user_name = #{paramsData.userName}
        </if>
        <if test="paramsData.qsStatus != null and paramsData.qsStatus != ''">
            AND tdi.qs_status = #{paramsData.qsStatus}
        </if>
    </select>

    <select id="getInvoiceScanningSituationList"
            resultMap="IndexInvoiceScanningMap" databaseId="oracle">
        SELECT
        tdi.*
        FROM t_dx_invoice tdi
        where
        to_char(tdi.qs_date,'yyyy-mm-dd') = to_char(sysdate,'yyyy-mm-dd')
        <if test="paramsData.userName != null">
            AND tdi.user_name = #{paramsData.userName}
        </if>
        <if test="paramsData.qsStatus != null and paramsData.qsStatus != ''">
            AND tdi.qs_status = #{paramsData.qsStatus}
        </if>
    </select>


    <!--今日发票认证列表 -->
    <select id="getInvoiceAuthenticationSituationList"
            resultMap="IndexInvoiceCollectionMap" databaseId="oracle">
        SELECT tdri.* from t_dx_record_invoice tdri
        where tdri.gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        <if test="paramsData.rzStatus == 'cgList'.toString()">
            AND tdri.auth_status='4'
        </if>
        <if test="paramsData.rzStatus == 'sbList'.toString()">
            AND tdri.auth_status='5'
        </if>
        <if test="paramsData.rzStatus == 'all'.toString()">
            and tdri.auth_status > 2
        </if>
        AND to_char(tdri.rzh_date,'yyyy-mm-dd') = to_char(sysdate,'yyyy-mm-dd')

    </select>

    <select id="getInvoiceAuthenticationSituationList"
            resultMap="IndexInvoiceCollectionMap" databaseId="mysql">
        SELECT tdri.* from t_dx_record_invoice tdri
        where tdri.gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        <if test="paramsData.rzStatus == 'cgList'.toString()">
            AND tdri.auth_status='4'
        </if>
        <if test="paramsData.rzStatus == 'sbList'.toString()">
            AND tdri.auth_status='5'
        </if>
        <if test="paramsData.rzStatus == 'all'.toString()">
            and tdri.auth_status in ('4','5')
        </if>
        AND date_format(tdri.rzh_date,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')

    </select>
    <!--今日退税认证情况 -->
    <select id="getDrawbackAuthenticationSituation"
            resultMap="indexInvoiceAuthenticationCountMap" databaseId="mysql">
        select sum(t.countNum) countNum,t.authenticationType from (
        SELECT count(1) countNum,
        CASE
        WHEN auth_status = '5' THEN 'rzsbType'
        WHEN auth_status = '4' THEN 'rzcgType'
        END authenticationType
        from t_dx_record_invoice
        where export_mark = '0' and bdk_status = '3' and gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        AND date_format(rzh_date,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')
        GROUP BY authenticationType
        UNION ALL
        SELECT
        COUNT(1) countNum,
        'fsrzType' authenticationType
        FROM
        t_dx_record_invoice
        where export_mark = '0' and bdk_status = '3' and
        gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and auth_status in ('4','5')
        AND date_format(rzh_date,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')
        union all
        SELECT count(1) countNum,
        CASE
        WHEN auth_status = '5' THEN 'rzsbType'
        WHEN auth_status = '4' THEN 'rzcgType'
        END authenticationType
        from t_dx_customs_record
        where export_mark = '0' and bdk_status = '3' and gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        AND date_format(rzh_date,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')
        GROUP BY authenticationType
        UNION ALL
        SELECT
        COUNT(1) countNum,
        'fsrzType' authenticationType
        FROM
        t_dx_customs_record
        where export_mark = '0' and bdk_status = '3' and
        gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and auth_status in ('4','5')
        AND date_format(rzh_date,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')
        )t group by authenticationType
    </select>

    <select id="getDrawbackAuthenticationSituation"
            resultMap="indexInvoiceAuthenticationCountMap" databaseId="oracle">
        select sum(t.countNum),t.authenticationType from (
        SELECT
        count(1) countNum,
        t.authenticationType
        from
        (
        select
        CASE
        WHEN tdri.auth_status = '5' THEN 'rzsbType'
        WHEN tdri.auth_status = '4' THEN 'rzcgType'
        END authenticationType
        from
        t_dx_record_invoice tdri
        where tdri.export_mark = '0' and tdri.bdk_status = '3' and
        tdri.gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        AND to_char(tdri.rzh_date,'yyyy-MM-dd') = to_char(sysdate,'yyyy-MM-dd')
        ) t GROUP BY t.authenticationType

        UNION all

        SELECT
        COUNT(1) countNum,
        'fsrzType' authenticationType
        FROM
        t_dx_record_invoice tdri
        where tdri.export_mark = '0' and tdri.bdk_status = '1' and
        tdri.gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and tdri.auth_status in ('4','5')
        AND to_char(tdri.rzh_date,'yyyy-MM-dd') = to_char(sysdate,'yyyy-MM-dd')
        union all
        SELECT
        count(1) countNum,
        t.authenticationType
        from
        (
        select
        CASE
        WHEN tdri.auth_status = '5' THEN 'rzsbType'
        WHEN tdri.auth_status = '4' THEN 'rzcgType'
        END authenticationType
        from
        t_dx_customs_record tdri
        where tdri.export_mark = '0' and tdri.bdk_status = '3' and
        tdri.gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        AND to_char(tdri.rzh_date,'yyyy-MM-dd') = to_char(sysdate,'yyyy-MM-dd')
        ) t GROUP BY t.authenticationType

        UNION all

        SELECT
        COUNT(1) countNum,
        'fsrzType' authenticationType
        FROM
        t_dx_customs_record tdri
        where tdri.export_mark = '0' and tdri.bdk_status = '3' and
        tdri.gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and tdri.auth_status in ('4','5')
        AND to_char(tdri.rzh_date,'yyyy-MM-dd') = to_char(sysdate,'yyyy-MM-dd')
        ) t group by authenticationType
    </select>

    <!--今日发票认证情况 -->
    <select id="getInvoiceAuthenticationSituation"
            resultMap="indexInvoiceAuthenticationCountMap" databaseId="mysql">
        select sum(t.countNum) countNum,t.authenticationType from (
        SELECT count(1) countNum,
        CASE
        WHEN auth_status = '5' THEN 'rzsbType'
        WHEN auth_status = '4' THEN 'rzcgType'
        END authenticationType
        from t_dx_record_invoice
        where export_mark = '0' and bdk_status = '1' and gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        AND date_format(confirm_date,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')
        GROUP BY authenticationType
        UNION ALL
        SELECT
        COUNT(1) countNum,
        'fsrzType' authenticationType
        FROM
        t_dx_record_invoice
        where export_mark = '0' and bdk_status = '1' and
        gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and auth_status in ('4','5')
        AND date_format(confirm_date,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')
        union all
        SELECT count(1) countNum,
        CASE
        WHEN auth_status = '5' THEN 'rzsbType'
        WHEN auth_status = '4' THEN 'rzcgType'
        END authenticationType
        from t_dx_export_invoice
        where bdk_status = '1' and gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        AND date_format(confirm_date,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')
        GROUP BY authenticationType
        UNION ALL
        SELECT
        COUNT(1) countNum,
        'fsrzType' authenticationType
        FROM
        t_dx_export_invoice
        where bdk_status = '1' and
        gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and auth_status in ('4','5')
        AND date_format(confirm_date,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')
        union all
        SELECT count(1) countNum,
        CASE
        WHEN auth_status = '5' THEN 'rzsbType'
        WHEN auth_status = '4' THEN 'rzcgType'
        END authenticationType
        from t_dx_customs_record
        where export_mark = '0' and bdk_status = '1' and gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        AND date_format(confirm_date,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')
        GROUP BY authenticationType
        UNION ALL
        SELECT
        COUNT(1) countNum,
        'fsrzType' authenticationType
        FROM
        t_dx_customs_record
        where export_mark = '0' and bdk_status = '1' and
        gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and auth_status in ('4','5')
        AND date_format(confirm_date,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')
        union all
        SELECT count(1) countNum,
        CASE
        WHEN auth_status = '5' THEN 'rzsbType'
        WHEN auth_status = '4' THEN 'rzcgType'
        END authenticationType
        from t_dx_export_customs
        where bdk_status = '1' and gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        AND date_format(confirm_date,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')
        GROUP BY authenticationType
        UNION ALL
        SELECT
        COUNT(1) countNum,
        'fsrzType' authenticationType
        FROM
        t_dx_export_customs
        where bdk_status = '1' and
        gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and auth_status in ('4','5')
        AND date_format(confirm_date,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')
        ) t group by authenticationType
    </select>

    <select id="getInvoiceAuthenticationSituation"
            resultMap="indexInvoiceAuthenticationCountMap" databaseId="oracle">
        select sum(t.countNum) countNum,t.authenticationType from (
        SELECT
        count(1) countNum,
        t.authenticationType
        from
        (
        select
        CASE
        WHEN tdri.auth_status = '5' THEN 'rzsbType'
        WHEN tdri.auth_status = '4' THEN 'rzcgType'
        END authenticationType
        from
        t_dx_record_invoice tdri
        where tdri.export_mark = '0' and tdri.bdk_status = '1' and
        tdri.gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        AND to_char(tdri.confirm_date,'yyyy-MM-dd') = to_char(sysdate,'yyyy-MM-dd')
        ) t GROUP BY t.authenticationType

        UNION all

        SELECT
        COUNT(1) countNum,
        'fsrzType' authenticationType
        FROM
        t_dx_record_invoice tdri
        where tdri.export_mark = '0' and tdri.bdk_status = '1' and
        tdri.gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and tdri.auth_status in ('4','5')
        AND to_char(tdri.confirm_date,'yyyy-MM-dd') = to_char(sysdate,'yyyy-MM-dd')
        union all
        SELECT
        count(1) countNum,
        t.authenticationType
        from
        (
        select
        CASE
        WHEN tdri.auth_status = '5' THEN 'rzsbType'
        WHEN tdri.auth_status = '4' THEN 'rzcgType'
        END authenticationType
        from
        t_dx_export_invoice tdri
        where tdri.bdk_status = '1' and
        tdri.gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        AND to_char(tdri.confirm_date,'yyyy-MM-dd') = to_char(sysdate,'yyyy-MM-dd')
        ) t GROUP BY t.authenticationType

        UNION all

        SELECT
        COUNT(1) countNum,
        'fsrzType' authenticationType
        FROM
        t_dx_export_invoice tdri
        where tdri.bdk_status = '1' and
        tdri.gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and tdri.auth_status in ('4','5')
        AND to_char(tdri.confirm_date,'yyyy-MM-dd') = to_char(sysdate,'yyyy-MM-dd')
        union all
        SELECT
        count(1) countNum,
        t.authenticationType
        from
        (
        select
        CASE
        WHEN tdri.auth_status = '5' THEN 'rzsbType'
        WHEN tdri.auth_status = '4' THEN 'rzcgType'
        END authenticationType
        from
        t_dx_customs_record tdri
        where tdri.export_mark = '0' and tdri.bdk_status = '1' and
        tdri.gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        AND to_char(tdri.confirm_date,'yyyy-MM-dd') = to_char(sysdate,'yyyy-MM-dd')
        ) t GROUP BY t.authenticationType

        UNION all

        SELECT
        COUNT(1) countNum,
        'fsrzType' authenticationType
        FROM
        t_dx_customs_record tdri
        where tdri.export_mark = '0' and tdri.bdk_status = '1' and
        tdri.gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and tdri.auth_status in ('4','5')
        AND to_char(tdri.confirm_date,'yyyy-MM-dd') = to_char(sysdate,'yyyy-MM-dd')
        union all
        SELECT
        count(1) countNum,
        t.authenticationType
        from
        (
        select
        CASE
        WHEN tdri.auth_status = '5' THEN 'rzsbType'
        WHEN tdri.auth_status = '4' THEN 'rzcgType'
        END authenticationType
        from
        t_dx_export_customs tdri
        where tdri.bdk_status = '1' and
        tdri.gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        AND to_char(tdri.confirm_date,'yyyy-MM-dd') = to_char(sysdate,'yyyy-MM-dd')
        ) t GROUP BY t.authenticationType

        UNION all

        SELECT
        COUNT(1) countNum,
        'fsrzType' authenticationType
        FROM
        t_dx_export_customs tdri
        where tdri.bdk_status = '1' and
        tdri.gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and tdri.auth_status in ('4','5')
        AND to_char(tdri.confirm_date,'yyyy-MM-dd') = to_char(sysdate,'yyyy-MM-dd')
        ) t group by authenticationType
    </select>


    <select id="getInvoiceInformationOfMonthCj" resultMap="indexInvoiceInformationOfMonthMap"
            databaseId="mysql">
        select sum(t.xzInvoice) xzInvoice from (
        SELECT
        COUNT( 1 ) xzInvoice
        FROM
        t_dx_record_invoice
        WHERE
        DATE_FORMAT(create_date, '%Y-%m') = DATE_FORMAT(now( ), '%Y-%m')
        and (invoice_type in(${krzpz}) or (invoice_type ='32' and lq_tdyslxDm='08'))
        and gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        union all
        SELECT
        COUNT( 1 ) xzInvoice
        FROM
        t_dx_customs_record
        WHERE
        DATE_FORMAT(create_date, '%Y-%m') = DATE_FORMAT(now( ), '%Y-%m')
        and data_type = '17'
        and gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        ) t
    </select>

    <select id="getInvoiceInformationOfMonthRz" resultMap="indexInvoiceInformationOfMonthMap"
            databaseId="mysql">
        select sum(t.yrzInvoice) yrzInvoice,format(sum(t.taxamountcount),2) taxamountcount from (
        SELECT
        COUNT( 1 ) yrzInvoice,
        sum( dk_tax_amount ) taxamountcount
        FROM
        t_dx_record_invoice
        WHERE
        DATE_FORMAT(rzh_date, '%Y-%m') = DATE_FORMAT(now(), '%Y-%m')
        and export_mark = '0'
        and (invoice_type in(${krzpz}) or (invoice_type ='32' and lq_tdyslxDm='08'))
        and rzh_yesorno = '1'
        and gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        union all
        SELECT
        COUNT( 1 ) yrzInvoice,
        sum(export_yxse) taxamountcount
        FROM
        t_dx_export_invoice
        WHERE
        DATE_FORMAT(rzh_date, '%Y-%m') = DATE_FORMAT(now(), '%Y-%m')
        and invoice_type IN ( '01', '03','08', '14','31')
        and rzh_yesorno = '1'
        and gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        union all
        SELECT
        COUNT( 1 ) yrzInvoice,
        sum( yx_tax_amount ) taxamountcount
        FROM
        t_dx_customs_record
        WHERE
        DATE_FORMAT(rzh_date, '%Y-%m') = DATE_FORMAT(now(), '%Y-%m')
        and export_mark = '0'
        and data_type='17'
        and rzh_yesorno = '1'
        and gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        union all
        SELECT
        COUNT( 1 ) yrzInvoice,
        sum(yx_export_tax_amount) taxamountcount
        FROM
        t_dx_export_customs
        WHERE
        DATE_FORMAT(rzh_date, '%Y-%m') = DATE_FORMAT(now(), '%Y-%m')
        and data_type='17'
        and rzh_yesorno = '1'
        and gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>

        ) t
    </select>
    <select id="getDrawbackInformationOfMonthRz" resultMap="indexInvoiceInformationOfMonthMap"
            databaseId="mysql">
        select sum(t.yrzInvoice) yrzInvoice,format(sum(t.taxamountcount),2) taxamountcount from (
        SELECT
        COUNT( 1 ) yrzInvoice,
        sum( dk_tax_amount ) taxamountcount
        FROM
        t_dx_record_invoice
        WHERE
        DATE_FORMAT(rzh_date, '%Y-%m') = DATE_FORMAT(now(), '%Y-%m')
        and export_mark = '0'
        and (invoice_type in(${krzpz}) or (invoice_type ='32' and lq_tdyslxDm='08'))
        and rzh_yesorno = '3'
        and gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        union all
        SELECT
        COUNT( 1 ) yrzInvoice,
        sum(yx_tax_amount) taxamountcount
        FROM
        t_dx_customs_record
        WHERE
        DATE_FORMAT(rzh_date, '%Y-%m') = DATE_FORMAT(now(), '%Y-%m')
        and data_type='17'
        and rzh_yesorno = '3'
        and gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        ) t
    </select>

    <select id="getInvoiceInformationOfMonthCj" resultMap="indexInvoiceInformationOfMonthMap"
            databaseId="oracle">
        select sum(t.xzInvoice) xzInvoice from (
        SELECT
        COUNT( 1 ) xzInvoice
        FROM
        t_dx_record_invoice
        WHERE
        to_char( create_date, 'yyyyMM' ) = to_char( sysdate, 'yyyyMM' )
        and (invoice_type in(${krzpz}) or (invoice_type ='32' and lq_tdyslxDm='08'))
        and gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        union all
        SELECT
        COUNT( 1 ) xzInvoice
        FROM
        t_dx_customs_record
        WHERE
        to_char( create_date, 'yyyyMM' ) = to_char( sysdate, 'yyyyMM' )
        and data_type = '17'
        and gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        ) t
    </select>

    <select id="getInvoiceInformationOfMonthRz" resultMap="indexInvoiceInformationOfMonthMap"
            databaseId="oracle">
        select sum(t.yrzInvoice) yrzInvoice,sum(t.taxamountcount) taxamountcount from (
        SELECT
        COUNT( 1 ) yrzInvoice,
        trunc ( sum( tax_amount ), 2 ) taxamountcount
        FROM
        t_dx_record_invoice
        WHERE
        to_char( rzh_date, 'yyyyMM' ) = to_char( sysdate, 'yyyyMM' )
        and export_mark = '0'
        and (invoice_type in(${krzpz}) or (invoice_type ='32' and lq_tdyslxDm='08'))
        and rzh_yesorno = '1'
        and gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        union all
        SELECT
        COUNT( 1 ) yrzInvoice,
        trunc ( sum( export_yxse ), 2 ) taxamountcount
        FROM
        t_dx_export_invoice
        WHERE
        to_char( rzh_date, 'yyyyMM' ) = to_char( sysdate, 'yyyyMM' )
        and invoice_type IN ( '01', '03','08', '14' ,'31')
        and rzh_yesorno = '1'
        and gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        union all
        SELECT
        COUNT( 1 ) yrzInvoice,
        trunc ( sum( tax_amount ), 2 ) taxamountcount
        FROM
        t_dx_customs_record
        WHERE
        to_char( rzh_date, 'yyyyMM' ) = to_char( sysdate, 'yyyyMM' )
        and export_mark = '0'
        and data_type='17'
        and rzh_yesorno = '1'
        and gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        union all
        SELECT
        COUNT( 1 ) yrzInvoice,
        trunc ( sum( yx_export_tax_amount ), 2 ) taxamountcount
        FROM
        t_dx_export_customs
        WHERE
        to_char( rzh_date, 'yyyyMM' ) = to_char( sysdate, 'yyyyMM' )
        and data_type='17'
        and rzh_yesorno = '1'
        and gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        )t
    </select>

    <select id="getDrawbackInformationOfMonthRz" resultMap="indexInvoiceInformationOfMonthMap"
            databaseId="oracle">
        select sum(t.yrzInvoice) yrzInvoice,sum(t.taxamountcount) taxamountcount from (
        SELECT
        COUNT( 1 ) yrzInvoice,
        trunc ( sum( tax_amount ), 2 ) taxamountcount
        FROM
        t_dx_record_invoice
        WHERE
        to_char( rzh_date, 'yyyyMM' ) = to_char( sysdate, 'yyyyMM' )
        and export_mark = '0'
        and (invoice_type in(${krzpz}) or (invoice_type ='32' and lq_tdyslxDm='08'))
        and rzh_yesorno = '3'
        and gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        union all
        SELECT
        COUNT( 1 ) yrzInvoice,
        trunc ( sum( tax_amount ), 2 ) taxamountcount
        FROM
        t_dx_customs_record
        WHERE
        to_char( rzh_date, 'yyyyMM' ) = to_char( sysdate, 'yyyyMM' )
        and export_mark = '0'
        and data_type='17'
        and rzh_yesorno = '3'
        and gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        )t
    </select>


    <!--月度统计图表getInvoiceChartStatistics -->
    <select id="getInvoiceChartStatistics"
            resultMap="indexInvoiceChartStatisticsMap" databaseId="mysql">
        SELECT ifnull(outter_outter_tdri.xzCount,0) AS 'xzInvoiceCount',
        outter_outter_tdri.dateTime AS 'dayOfMonthInYear',
        outter_outter_tdri_rzcg.dateTime AS 'rzcgDayOfMonthInYear',
        ifnull(outter_outter_tdri_rzcg.rzcgCount,0) AS 'rzcgInvoiceCount'
        FROM (
        SELECT COUNT(outter_tdri.InvoiceType) AS 'xzCount',outter_tdri.dateTime FROM
        (SELECT 'xzType' AS
        'InvoiceType',DATE_FORMAT(tdri.create_date,'%Y-%m-%d') AS dateTime
        FROM t_dx_record_invoice tdri
        where tdri.gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and (tdri.invoice_type in(${krzpz}) or (tdri.invoice_type ='32' and tdri.lq_tdyslxDm='08'))
        <![CDATA[ AND date_format(tdri.create_date,'%Y-%m-%d')>= (select DATE_FORMAT(#{paramsData.firstDay},'%Y-%m-%d')) ]]>
        <if test="paramsData.endDate != null">
            <![CDATA[ AND date_format(tdri.create_date,'%Y-%m-%d')<= #{paramsData.endDate} ]]>
        </if>
        ) outter_tdri GROUP BY outter_tdri.dateTime
        ) outter_outter_tdri
        LEFT JOIN
        (SELECT COUNT(outter_tdri.InvoiceType) AS 'rzcgCount',outter_tdri.dateTime
        FROM
        (SELECT 'rzcgType' AS 'InvoiceType',DATE_FORMAT(tdri.rzh_date,'%Y-%m-%d') AS
        dateTime from
        t_dx_record_invoice tdri
        where tdri.gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and tdri.auth_status='4'
        <![CDATA[ AND date_format(tdri.rzh_date,'%Y-%m-%d')>=  (select DATE_FORMAT(#{paramsData.firstDay},'%Y-%m-%d'))  ]]>
        <if test="paramsData.endDate != null">
            <![CDATA[ AND date_format(tdri.rzh_date,'%Y-%m-%d')<= #{paramsData.endDate}  ]]>
        </if>
        ) outter_tdri GROUP BY outter_tdri.dateTime) outter_outter_tdri_rzcg
        ON outter_outter_tdri.dateTime=outter_outter_tdri_rzcg.dateTime

        UNION

        SELECT ifnull(outter_outter_tdri.xzCount,0) AS 'xzInvoiceCount',
        outter_outter_tdri.dateTime AS 'dayOfMonthInYear',
        outter_outter_tdri_rzcg.dateTime AS 'rzcgDayOfMonthInYear',
        ifnull(outter_outter_tdri_rzcg.rzcgCount,0) AS 'rzcgInvoiceCount'
        FROM (
        SELECT COUNT(outter_tdri.InvoiceType) AS 'xzCount',outter_tdri.dateTime FROM
        (SELECT 'xzType' AS
        'InvoiceType',DATE_FORMAT(tdri.create_date,'%Y-%m-%d') AS dateTime
        FROM t_dx_record_invoice tdri
        where tdri.gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and (tdri.invoice_type in(${krzpz}) or (tdri.invoice_type ='32' and tdri.lq_tdyslxDm='08'))
        <![CDATA[ AND DATE_FORMAT(tdri.create_date,'%Y-%m-%d')>= (select DATE_FORMAT(#{paramsData.firstDay},'%Y-%m-%d')) ]]>
        <if test="paramsData.endDate != null">
            <![CDATA[ AND DATE_FORMAT(tdri.create_date,'%Y-%m-%d')<= #{paramsData.endDate} ]]>
        </if>
        ) outter_tdri GROUP BY outter_tdri.dateTime
        ) outter_outter_tdri
        RIGHT JOIN
        (SELECT COUNT(outter_tdri.InvoiceType) AS 'rzcgCount',outter_tdri.dateTime
        FROM
        (SELECT 'rzcgType' AS 'InvoiceType',DATE_FORMAT(tdri.rzh_date,'%Y-%m-%d') AS
        dateTime from
        t_dx_record_invoice tdri
        where tdri.gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and tdri.auth_status='4'
        <![CDATA[ AND DATE_FORMAT(tdri.rzh_date,'%Y-%m-%d')>=  (select DATE_FORMAT(#{paramsData.firstDay},'%Y-%m-%d'))  ]]>
        <if test="paramsData.endDate != null">
            <![CDATA[ AND DATE_FORMAT(tdri.rzh_date,'%Y-%m-%d')<= #{paramsData.endDate}  ]]>
        </if>
        ) outter_tdri GROUP BY outter_tdri.dateTime) outter_outter_tdri_rzcg
        ON outter_outter_tdri.dateTime=outter_outter_tdri_rzcg.dateTime
    </select>


    <select id="getInvoiceChartStatistics"
            resultMap="indexInvoiceChartStatisticsMap" databaseId="oracle">
        SELECT outter_outter_tdri.xzCount AS xzInvoiceCount,
        outter_outter_tdri.dateTime AS dayOfMonthInYear,
        outter_outter_tdri_rzcg.dateTime AS rzcgDayOfMonthInYear,
        outter_outter_tdri_rzcg.rzcgCount AS rzcgInvoiceCount
        FROM (
        SELECT COUNT(outter_tdri.InvoiceType) AS xzCount,outter_tdri.dateTime FROM
        (SELECT 'xzType' AS InvoiceType,to_char(tdri.create_date,'yyyy-mm-dd')
        AS dateTime
        FROM t_dx_record_invoice tdri
        where tdri.gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and (tdri.invoice_type in(${krzpz}) or (tdri.invoice_type ='32' and tdri.lq_tdyslxDm='08'))
        <![CDATA[ AND tdri.create_date >= to_date(#{paramsData.firstDay},'yyyy-mm-dd')]]>
        <if test="paramsData.endDate != null">
            <![CDATA[ AND tdri.create_date <= to_date(#{paramsData.endDate},'yyyy-mm-dd')  ]]>
        </if>
        ) outter_tdri GROUP BY outter_tdri.dateTime
        ) outter_outter_tdri
        LEFT JOIN
        (SELECT COUNT(outter_tdri.InvoiceType) AS rzcgCount,outter_tdri.dateTime FROM
        (SELECT 'rzcgType' AS InvoiceType,to_char(tdri.rzh_date,'yyyy-mm-dd')
        AS dateTime from
        t_dx_record_invoice tdri
        where tdri.gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and tdri.auth_status='4'
        <![CDATA[ AND tdri.rzh_date>=  to_date(#{paramsData.firstDay},'yyyy-mm-dd')  ]]>
        <if test="paramsData.endDate != null">
            <![CDATA[ AND tdri.rzh_date<= to_date(#{paramsData.endDate},'yyyy-mm-dd')   ]]>
        </if>
        ) outter_tdri GROUP BY outter_tdri.dateTime) outter_outter_tdri_rzcg
        ON outter_outter_tdri.dateTime=outter_outter_tdri_rzcg.dateTime

        UNION

        SELECT outter_outter_tdri.xzCount AS xzInvoiceCount,
        outter_outter_tdri.dateTime AS dayOfMonthInYear,
        outter_outter_tdri_rzcg.dateTime AS rzcgDayOfMonthInYear,
        outter_outter_tdri_rzcg.rzcgCount AS rzcgInvoiceCount
        FROM (
        SELECT COUNT(outter_tdri.InvoiceType) AS xzCount,outter_tdri.dateTime FROM
        (SELECT 'xzType' AS InvoiceType,to_char(tdri.create_date,'yyyy-mm-dd')
        AS dateTime
        FROM t_dx_record_invoice tdri
        where tdri.gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and (tdri.invoice_type in(${krzpz}) or (tdri.invoice_type ='32' and tdri.lq_tdyslxDm='08'))
        <![CDATA[ AND tdri.create_date >= to_date(#{paramsData.firstDay},'yyyy-mm-dd') ]]>
        <if test="paramsData.endDate != null">
            <![CDATA[ AND tdri.create_date <= to_date(#{paramsData.endDate},'yyyy-mm-dd') ]]>
        </if>
        ) outter_tdri GROUP BY outter_tdri.dateTime
        ) outter_outter_tdri
        RIGHT JOIN
        (SELECT COUNT(outter_tdri.InvoiceType) AS rzcgCount,outter_tdri.dateTime FROM
        (SELECT 'rzcgType' AS
        InvoiceType,to_char(tdri.rzh_date,'yyyy-mm-dd') AS dateTime from
        t_dx_record_invoice tdri
        where tdri.gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and tdri.auth_status='4'
        <![CDATA[ AND tdri.rzh_date >=  to_date(#{paramsData.firstDay},'yyyy-mm-dd')  ]]>
        <if test="paramsData.endDate != null">
            <![CDATA[ AND tdri.rzh_date <= to_date(#{paramsData.endDate},'yyyy-mm-dd')  ]]>
        </if>
        ) outter_tdri GROUP BY outter_tdri.dateTime) outter_outter_tdri_rzcg
        ON outter_outter_tdri.dateTime=outter_outter_tdri_rzcg.dateTime
    </select>


    <!-- 逾期发票 -->
    <select id="getInvoiceTaskRemindingYq" resultMap="indexInvoiceTaskRemindingMap"
            databaseId="mysql">
        select
        count( 1 ) countnum,
        'yqWarning' warningtype
        from
        t_dx_record_invoice as t
        left join t_dx_tax_current tdtc on t.gf_tax_no = tdtc.taxno
        where
        (t.rzh_belong_date is null or t.rzh_belong_date = '')
        and t.invoice_amount > 0
        and invoice_status = 0
        and t.rzh_yesorno = 0
        and (t.invoice_type in(${krzpz}) or (t.invoice_type ='32' and t.lq_tdyslxDm='08'))
        and t.confirm_date is null
        and t.rzh_date is null
        and t.tax_amount >= 0
        and period_add(tdtc.current_tax_period, 1) >= date_format (date_add(invoice_date, interval 360
        day), '%Y%m')
        and date_format(invoice_date, '%Y%m%d') >= tdtc.select_start_date
        AND t.gf_tax_no IN
        <foreach collection="paramsData.taxno" index="index" item="item" open="(" separator=","
                 close=")">
            #{item}
        </foreach>
    </select>
    <!-- 异常发票 -->
    <select id="getInvoiceTaskRemindingYc" resultMap="indexInvoiceTaskRemindingMap"
            databaseId="mysql">
        select
        count(1) countNum,
        'ycfpWarning' warningType
        from
        t_dx_record_invoice
        where gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and invoice_status != 0
        and DATE_FORMAT( status_update_date, '%Y-%m' ) = DATE_FORMAT( now( ), '%Y-%m' )
    </select>
    <!-- 普票跨年度发票 -->
    <select id="getInvoiceTaskRemindingPpknd" resultMap="indexInvoiceTaskRemindingMap"
            databaseId="mysql">
        SELECT
        count(1) countNum,
        'ptkndWarning' warningType
        from
        t_dx_record_invoice
        where
        gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and qs_status = '1'
        and invoice_type in ('04','10','11','32','186')
        and date_format(invoice_date,'%Y') = #{paramsData.billingYear}
        and date_format(qs_date,'%Y-%m') >= date_format(now(),'%Y-%m')
    </select>
    <!-- 认证后异常发票 -->
    <select id="getInvoiceTaskRemindingRzyc" resultMap="indexInvoiceTaskRemindingMap"
            databaseId="mysql">

        select
        COUNT(1) countNum,
        'rzhyc' warningType
        from
        t_dx_record_invoice
        where
        gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and invoice_status != '0'
        and (invoice_type in(${krzpz}) or (invoice_type ='32' and lq_tdyslxDm='08'))
        and auth_status = '4'
        and date_format(rzh_date,'%Y-%m') = date_format(now(),'%Y-%m')

    </select>
    <!-- 签收异常发票 -->
    <select id="getInvoiceTaskRemindingQsyc" resultMap="indexInvoiceTaskRemindingMap"
            databaseId="mysql">
        select
        COUNT(1) countNum,
        'qshyc' warningType
        from
        t_dx_record_invoice
        where
        gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and invoice_status != '0'
        and qs_status = '1'
        and date_format(qs_date,'%Y-%m') = date_format(now(),'%Y-%m')
    </select>


    <!-- 逾期发票 -->
    <select id="getInvoiceTaskRemindingYq" resultMap="indexInvoiceTaskRemindingMap"
            databaseId="oracle">
        select
        count( 1 ) countnum,
        'yqWarning' warningtype
        from
        t_dx_record_invoice t
        left join t_dx_tax_current tdtc on t.gf_tax_no = tdtc.taxno
        where
        (t.rzh_belong_date IS NULL OR t.rzh_belong_date = '')
        AND t.invoice_amount > 0
        AND invoice_status = 0
        AND t.rzh_yesorno = 0
        and (t.invoice_type in(${krzpz}) or (t.invoice_type ='32' and t.lq_tdyslxDm='08'))
        AND t.confirm_date IS NULL
        AND t.rzh_date IS NULL
        AND t.tax_amount >= 0
        AND add_months(to_date(tdtc.current_tax_period,'yyyyMM'), 1) >= to_date(to_char(invoice_date +
        360,
        'yyyyMM'),'yyyyMM')
        AND to_char(invoice_date, 'yyyyMMdd') >= tdtc.select_start_date
        AND t.gf_tax_no IN
        <foreach collection="paramsData.taxno" index="index" item="item" open="(" separator=","
                 close=")">
            #{item}
        </foreach>
    </select>
    <!-- 异常发票 -->
    <select id="getInvoiceTaskRemindingYc" resultMap="indexInvoiceTaskRemindingMap"
            databaseId="oracle">
        select
        count(1) countNum,
        'ycfpWarning' warningType
        from
        t_dx_record_invoice
        where gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and invoice_status != 0
        and to_char( status_update_date, 'yyyyMM' ) = to_char( sysdate, 'yyyyMM' )
    </select>
    <!-- 普票跨年度发票 -->
    <select id="getInvoiceTaskRemindingPpknd" resultMap="indexInvoiceTaskRemindingMap"
            databaseId="oracle">
        SELECT
        count(1) countNum,
        'ptkndWarning' warningType
        from
        t_dx_record_invoice
        where
        gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and qs_status = '1'
        and invoice_type in ('04','10','11','32','186')
        and to_char(invoice_date,'yyyy') = #{paramsData.billingYear}
        and to_char(qs_date,'yyyy-MM') >= to_char(sysdate,'yyyy-MM')
    </select>
    <!-- 认证后异常发票 -->
    <select id="getInvoiceTaskRemindingRzyc" resultMap="indexInvoiceTaskRemindingMap"
            databaseId="oracle">

        select
        COUNT(1) countNum,
        'rzhyc' warningType
        from
        t_dx_record_invoice
        where
        gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and invoice_status != '0'
        and (invoice_type in(${krzpz}) or (invoice_type ='32' and lq_tdyslxDm='08'))
        and auth_status = '4'
        and to_char(rzh_date,'yyyy-MM') = to_char(sysdate,'yyyy-MM')
    </select>
    <!-- 签收异常发票 -->
    <select id="getInvoiceTaskRemindingQsyc" resultMap="indexInvoiceTaskRemindingMap"
            databaseId="oracle">
        select
        COUNT(1) countNum,
        'qshyc' warningType
        from
        t_dx_record_invoice
        where
        gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and invoice_status != '0'
        and qs_status = '1'
        and to_char(qs_date,'yyyy-MM') = to_char(sysdate,'yyyy-MM')
    </select>


    <!--年度统计图表 -->
    <select id="getInvoiceChartStatisticsYear"
            resultMap="indexInvoiceChartStatisticsMap" databaseId="oracle">
        SELECT outter_outter_tdri.xzCount AS xzInvoiceCount,
        outter_outter_tdri.dateTime AS dayOfMonthInYear,
        outter_outter_tdri_rzcg.rzcgCount AS rzcgInvoiceCount,
        outter_outter_tdri_rzcg.dateTime AS rzcgDayOfMonthInYear
        FROM (
        SELECT COUNT(outter_tdri.InvoiceType) AS xzCount,outter_tdri.dateTime FROM
        (SELECT 'xzType' AS InvoiceType,to_char(tdri.create_date,'yyyy-mm') AS
        dateTime
        FROM t_dx_record_invoice tdri
        where tdri.gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and (tdri.invoice_type in(${krzpz}) or (tdri.invoice_type ='32' and tdri.lq_tdyslxDm='08'))
        <if test="paramsData.endDate != null">
            AND to_char(tdri.create_date,'yyyy') = substr(#{paramsData.endDate},1,4)
        </if>
        ) outter_tdri GROUP BY outter_tdri.dateTime
        ) outter_outter_tdri
        LEFT JOIN
        (SELECT COUNT(outter_tdri.InvoiceType) AS rzcgCount,outter_tdri.dateTime FROM
        (SELECT 'rzcgType' AS
        InvoiceType,to_char(tdri.rzh_date,'yyyy-MM') AS dateTime
        from
        t_dx_record_invoice tdri
        where tdri.gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and tdri.auth_status='4'
        <if test="paramsData.endDate != null">
            AND to_char(tdri.rzh_date,'yyyy') =
            to_char(to_date(#{paramsData.endDate},'yyyy-mm-dd'),'yyyy')
        </if>
        ) outter_tdri GROUP BY outter_tdri.dateTime) outter_outter_tdri_rzcg
        ON outter_outter_tdri.dateTime=
        outter_outter_tdri_rzcg.dateTime

        UNION

        SELECT outter_outter_tdri.xzCount AS xzInvoiceCount,
        outter_outter_tdri.dateTime AS dayOfMonthInYear,
        outter_outter_tdri_rzcg.rzcgCount AS rzcgInvoiceCount,
        outter_outter_tdri_rzcg.dateTime AS rzcgDayOfMonthInYear
        FROM (
        SELECT COUNT(outter_tdri.InvoiceType) AS xzCount,outter_tdri.dateTime FROM
        (SELECT 'xzType' AS InvoiceType,to_char(tdri.create_date,'yyyy-mm') AS
        dateTime
        FROM t_dx_record_invoice tdri
        where tdri.gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and (tdri.invoice_type in(${krzpz}) or (tdri.invoice_type ='32' and tdri.lq_tdyslxDm='08'))
        <if test="paramsData.endDate != null">
            AND to_char(tdri.create_date,'yyyy') = substr(#{paramsData.endDate},1,4)
        </if>
        ) outter_tdri GROUP BY outter_tdri.dateTime
        ) outter_outter_tdri
        RIGHT JOIN
        (SELECT COUNT(outter_tdri.InvoiceType) AS rzcgCount,outter_tdri.dateTime FROM
        (SELECT 'rzcgType' AS
        InvoiceType,to_char(tdri.rzh_date,'yyyy-MM') AS dateTime
        from
        t_dx_record_invoice tdri
        where tdri.gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and tdri.auth_status='4'
        <if test="paramsData.endDate != null">
            AND to_char(tdri.rzh_date,'yyyy') =
            to_char(to_date(#{paramsData.endDate},'yyyy-mm-dd'),'yyyy')
        </if>
        ) outter_tdri GROUP BY outter_tdri.dateTime) outter_outter_tdri_rzcg
        ON outter_outter_tdri.dateTime=
        outter_outter_tdri_rzcg.dateTime


    </select>


    <select id="getInvoiceChartStatisticsYear"
            resultMap="indexInvoiceChartStatisticsMap" databaseId="mysql">
        SELECT ifnull(outter_outter_tdri.xzCount,0) AS 'xzInvoiceCount', #发票新增
        outter_outter_tdri.dateTime AS 'dayOfMonthInYear', #时间
        ifnull(outter_outter_tdri_rzcg.rzcgCount,0) AS 'rzcgInvoiceCount', #认证成功
        outter_outter_tdri_rzcg.dateTime AS 'rzcgDayOfMonthInYear'
        FROM (
        SELECT COUNT(outter_tdri.InvoiceType) AS 'xzCount',outter_tdri.dateTime FROM
        (SELECT 'xzType' AS
        'InvoiceType',DATE_FORMAT(tdri.create_date,'%Y-%m') AS dateTime
        FROM t_dx_record_invoice tdri
        where tdri.gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and (tdri.invoice_type in(${krzpz}) or (tdri.invoice_type ='32' and tdri.lq_tdyslxDm='08'))
        <if test="paramsData.endDate != null">
            AND DATE_FORMAT(tdri.create_date,'%Y') = substring(#{paramsData.endDate},1,4)
        </if>
        ) outter_tdri GROUP BY outter_tdri.dateTime
        ) outter_outter_tdri
        LEFT JOIN
        (SELECT COUNT(outter_tdri.InvoiceType) AS 'rzcgCount',outter_tdri.dateTime
        FROM
        (SELECT 'rzcgType' AS
        'InvoiceType',DATE_FORMAT(tdri.rzh_date,'%Y-%m')
        AS dateTime from
        t_dx_record_invoice tdri
        where tdri.gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and tdri.auth_status='4'
        <if test="paramsData.endDate != null">
            AND DATE_FORMAT(tdri.rzh_date,'%Y') = substring(#{paramsData.endDate},1,4)
        </if>
        ) outter_tdri GROUP BY outter_tdri.dateTime) outter_outter_tdri_rzcg
        ON outter_outter_tdri.dateTime=
        outter_outter_tdri_rzcg.dateTime

        UNION

        SELECT ifnull(outter_outter_tdri.xzCount,0) AS 'xzInvoiceCount', #发票新增
        outter_outter_tdri.dateTime AS 'dayOfMonthInYear', #时间
        ifnull(outter_outter_tdri_rzcg.rzcgCount,0) AS 'rzcgInvoiceCount', #认证成功
        outter_outter_tdri_rzcg.dateTime AS 'rzcgDayOfMonthInYear'
        FROM (
        SELECT COUNT(outter_tdri.InvoiceType) AS 'xzCount',outter_tdri.dateTime FROM
        (SELECT 'xzType' AS
        'InvoiceType',DATE_FORMAT(tdri.create_date,'%Y-%m') AS dateTime
        FROM t_dx_record_invoice tdri
        where tdri.gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and (tdri.invoice_type in(${krzpz}) or (tdri.invoice_type ='32' and tdri.lq_tdyslxDm='08'))
        <if test="paramsData.endDate != null">
            AND DATE_FORMAT(tdri.create_date,'%Y') = substring(#{paramsData.endDate},1,4)
        </if>
        ) outter_tdri GROUP BY outter_tdri.dateTime
        ) outter_outter_tdri
        RIGHT JOIN
        (SELECT COUNT(outter_tdri.InvoiceType) AS 'rzcgCount',outter_tdri.dateTime
        FROM
        (SELECT 'rzcgType' AS
        'InvoiceType',DATE_FORMAT(tdri.rzh_date,'%Y-%m')
        AS dateTime from
        t_dx_record_invoice tdri
        where tdri.gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and tdri.auth_status='4'
        <if test="paramsData.endDate != null">
            AND DATE_FORMAT(tdri.rzh_date,'%Y') =substring(#{paramsData.endDate},1,4)

        </if>
        ) outter_tdri GROUP BY outter_tdri.dateTime) outter_outter_tdri_rzcg
        ON outter_outter_tdri.dateTime=
        outter_outter_tdri_rzcg.dateTime


    </select>


    <!-- 本月已认证发票列表 -->
    <select id="getCurrentMonthAuthList"
            resultMap="IndexInvoiceCollectionMap" databaseId="mysql">
        SELECT
        *
        FROM
        t_dx_record_invoice
        where
        gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        AND (rzh_yesorno='1' or rzh_yesorno = '2')
        AND invoice_type IN ( '01','03','14','31' )
        and date_format(rzh_date,'%Y-%m') >= date_format(now() ,'%Y-%m')

    </select>

    <select id="getCurrentMonthAuthList"
            resultMap="IndexInvoiceCollectionMap" databaseId="oracle">
        SELECT
        *
        FROM
        t_dx_record_invoice
        where
        gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and (rzh_yesorno='1' or rzh_yesorno = '2')
        and invoice_type IN ( '01','03','14' ,'31')
        and to_char(rzh_date,'yyyy-MM') >= to_char(sysdate ,'yyyy-MM')
    </select>

    <!-- #认证后异常 -->
    <select id="getRzhycList"
            resultMap="IndexInvoiceCollectionMap" databaseId="mysql">
        SELECT
        *
        from
        t_dx_record_invoice
        where
        gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and invoice_status!='0'
        and invoice_type IN('01','03','14','31')
        and auth_status='4'
        and date_format(rzh_date,'%Y-%m') >= date_format(now() ,'%Y-%m')

    </select>

    <!-- #认证后异常 -->
    <select id="getRzhycList"
            resultMap="IndexInvoiceCollectionMap" databaseId="oracle">
        SELECT
        *
        from
        t_dx_record_invoice
        where gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and invoice_status != '0'
        and invoice_type in ('01','03','14','31')
        and auth_status='4'
        and to_char(rzh_date,'yyyy-MM') >= to_char(sysdate ,'yyyy-MM')

    </select>


    <!-- #签收后异常 -->
    <select id="getQshycList"
            resultMap="IndexInvoiceCollectionMap" databaseId="mysql">
        SELECT
        *
        from
        t_dx_record_invoice
        where
        gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and invoice_status!='0'
        and qs_status='1'
        and date_format(qs_date,'%Y-%m') >= date_format(now() ,'%Y-%m')
    </select>


    <!-- #签收后异常 -->
    <select id="getQshycList"
            resultMap="IndexInvoiceCollectionMap" databaseId="oracle">
        SELECT
        *
        from
        t_dx_record_invoice
        where
        gf_tax_no in
        <if test="paramsData.taxno != null">
            <foreach item="item" index="index" collection="paramsData.taxno" open="(" separator=","
                     close=")">
                #{item}
            </foreach>
        </if>
        and invoice_status !='0'
        and qs_status='1'
        and to_char(qs_date,'yyyy-MM') >= to_char(sysdate ,'yyyy-MM')

    </select>
</mapper>
