|
|
@@ -2463,16 +2463,17 @@
|
|
|
<select id="queryDateByType"
|
|
|
resultType="com.ydtech.modules.admin.model.report.financialReceivables.FinancialReceivablesVo">
|
|
|
SELECT
|
|
|
- a.subSigning as "yearAndMonth",
|
|
|
+ a.subSigndate as "yearAndMonth",
|
|
|
a.allAmount as "commissionFeevalue",
|
|
|
- b.commSettLement +c.otherSettlementAmount as "noInvoicCommissionFeevalue",
|
|
|
- a.allAmount-( b.commSettLement +c.otherSettlementAmount) as "readyCommissionFeevalue",
|
|
|
- (c.invoicAmount - c.otherSettlementAmount) + (b.remainingAmount) as "settlementAmount"
|
|
|
+ IFNULL(c.settAmountOther,0) +IFNULL(b.settCommAmount ,0) as "noInvoicCommissionFeevalue",
|
|
|
+ IFNULL(b.remainingAmount,0) +IFNULL(c.invoicNotOther,0) as "settlementAmount",
|
|
|
+ (a.allAmount-(IFNULL(b.invoicComm,0) + IFNULL(c.otherInvoic,0))) as "noSettlementAmount",
|
|
|
+ a.allAmount-(IFNULL(c.settAmountOther,0) +IFNULL(b.settCommAmount ,0)) as "readyCommissionFeevalue"
|
|
|
FROM
|
|
|
(
|
|
|
SELECT
|
|
|
- sum( a.all_fee_value ) AS "allAmount",
|
|
|
- DATE_FORMAT( a.signdate, '%Y-%m' ) AS "subSigning"
|
|
|
+ DATE_FORMAT( a.signdate, '%Y-%m' ) AS subSigndate,
|
|
|
+ IFNULL( sum( a.commission_feevalue ), 0 ) + IFNULL( sum( a.other_feevalue ), 0 ) AS "allAmount"
|
|
|
FROM
|
|
|
ins_ply_income a
|
|
|
LEFT JOIN ptl_agreement pa ON pa.id = a.agreement_id
|
|
|
@@ -2480,29 +2481,26 @@
|
|
|
pa.agreement_type = '2'
|
|
|
GROUP BY
|
|
|
DATE_FORMAT( a.signdate, '%Y-%m' )
|
|
|
- ) a left join (
|
|
|
+ ) a
|
|
|
+ LEFT JOIN (
|
|
|
SELECT
|
|
|
- sum( a.settlement_amount ) as "commSettLement",
|
|
|
- sum( a.remaining_amount ) as "remainingAmount",
|
|
|
- DATE_FORMAT( a.signing_time, '%Y-%m' ) as "subSigning"
|
|
|
+ DATE_FORMAT( a.signing_time, '%Y-%m' ) AS "subSigndate",
|
|
|
+ sum( a.settlement_amount ) AS "settCommAmount",
|
|
|
+ sum(a.remaining_amount) as "remainingAmount",
|
|
|
+ sum(a.total_amount) as "invoicComm"
|
|
|
FROM
|
|
|
sys_insurance_handling_settlement_month a
|
|
|
GROUP BY
|
|
|
DATE_FORMAT( a.signing_time, '%Y-%m' )
|
|
|
- ) b on b.subSigning=a.subSigning
|
|
|
- left join (
|
|
|
- SELECT
|
|
|
- SUM( CASE WHEN a.settlement_status = '2' THEN IFNULL( a.settlement_amount, 0 ) ELSE 0 END ) AS "otherSettlementAmount",
|
|
|
- SUM( CASE WHEN a.settlement_status = '1' THEN IFNULL( a.settlement_amount, 0 ) ELSE 0 END ) AS "invoicAmount",
|
|
|
- DATE_FORMAT( a.signing_time, '%Y-%m' ) AS "subSigning"
|
|
|
- FROM
|
|
|
- settlement_documentary_fees a
|
|
|
- WHERE
|
|
|
- a.handling_fees_status = '1'
|
|
|
- GROUP BY
|
|
|
- DATE_FORMAT( a.signing_time, '%Y-%m' )
|
|
|
- ) c on c.subSigning=a.subSigning
|
|
|
-
|
|
|
+ ) b ON a.subSigndate = b.subSigndate
|
|
|
+ left join (
|
|
|
+ select DATE_FORMAT( a.signing_time, '%Y-%m' ) as "subSigndate" , sum(settlement_amount) as "otherInvoic", sum(invoiced_settled_amount) as "settAmountOther", sum(Invoiced_not_settled_amount) as "invoicNotOther"
|
|
|
+ from
|
|
|
+ settlement_documentary_fees a
|
|
|
+ where a.settlement_status='1'
|
|
|
+ and handling_fees_status ='1'
|
|
|
+ GROUP BY DATE_FORMAT( a.signing_time, '%Y-%m' )
|
|
|
+ ) c on c.subSigndate=a.subSigndate
|
|
|
</select>
|
|
|
|
|
|
<select id="queryDateByTypeMonthSumAmount" resultType="java.math.BigDecimal">
|
|
|
@@ -2539,6 +2537,9 @@
|
|
|
<if test="vo.beginDate != null and vo.beginDate!='' and vo.endDate != null and vo.endDate!=''">
|
|
|
AND a.signdate BETWEEN #{vo.beginDate} AND #{vo.endDate}
|
|
|
</if>
|
|
|
+ <if test="vo.yearAndMonth != null and vo.yearAndMonth!=''">
|
|
|
+ AND DATE_FORMAT(a.signdate, '%Y-%m') =#{vo.yearAndMonth}
|
|
|
+ </if>
|
|
|
</where>
|
|
|
</select>
|
|
|
|
|
|
@@ -2547,74 +2548,64 @@
|
|
|
a.subPathner,
|
|
|
sa.area_cname as "areaName",
|
|
|
eic.namesimple as "companyName",
|
|
|
- a.handlingReceivable as "commissionFeevalue",
|
|
|
a.partnerCompaniesId as "partnerCompaniesId",
|
|
|
+ IFNULL(a.allAmount,0) as "commissionFeevalue",
|
|
|
a.companyId as "companyId",
|
|
|
- IFNULL(a.settleAmount ,0 ) as "settlementAmount",
|
|
|
- a.unlicensedHandlingFee as "noSettlementAmount",
|
|
|
- IFNULL(a.unlicensedHandlingFee ,0 ) + IFNULL(a.settleAmount,0 ) as "noInvoicCommissionFeevalue",
|
|
|
+ IFNULL(b.noSettHandlingFee,0) as "settlementAmount",
|
|
|
+ IFNULL(a.allAmount,0) - IFNULL( b.settAmount,0) as "noSettlementAmount",
|
|
|
+ (IFNULL(a.allAmount,0) - IFNULL( b.settAmount,0)) +IFNULL(b.noSettHandlingFee,0) as "noInvoicCommissionFeevalue",
|
|
|
"手续费" as "isHand",
|
|
|
- IFNULL(a.handlingReceivable ,0 ) - IFNULL((IFNULL(a.unlicensedHandlingFee ,0 ) + IFNULL(a.settleAmount,0 )),0 ) as "readyCommissionFeevalue"
|
|
|
+ IFNULL( b.settAmount,0) as "readyCommissionFeevalue"
|
|
|
+
|
|
|
FROM
|
|
|
- (SELECT
|
|
|
- SUBSTRING( a.partner_companies_id, 6, 11 ) AS "subPathner",
|
|
|
- a.company_id as "companyId",
|
|
|
- a.partner_companies_id as "partnerCompaniesId",
|
|
|
- sum( a.commission_feevalue ) as "handlingReceivable",
|
|
|
- SUM( CASE WHEN a.handling_fees_status = '0' THEN a.commission_feevalue ELSE 0 END ) AS "unlicensedHandlingFee",
|
|
|
- MAX(b.noSettHandlingFee) AS "settleAmount"
|
|
|
- FROM
|
|
|
- ins_ply_income a
|
|
|
- LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
|
|
|
- LEFT JOIN (
|
|
|
- SELECT
|
|
|
- sum(a.commission_feevalue) as "invoicAmount",
|
|
|
- IFNULL(sum(a.commission_feevalue) ,0 ) - IFNULL(max(b.settlementAmount) ,0 ) as "noSettHandlingFee",
|
|
|
- a.signdate,
|
|
|
- a.task_id as "taskId" ,
|
|
|
- a.partner_companies_id as "subPathner"
|
|
|
- FROM
|
|
|
- ins_ply_income a
|
|
|
- LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
|
|
|
- LEFT JOIN (
|
|
|
- select sum(settlement_amount) as "settlementAmount", a.task_id as "taskId" from settlement_documentary_fees a
|
|
|
- <where>
|
|
|
- a.task_id IS NOT NULL
|
|
|
- and a.settlement_status ='2'
|
|
|
- <if test="vo.isNoCar !=null and vo.isNoCar !=''">
|
|
|
- and a.handling_fees_status =#{vo.isNoCar}
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- GROUP BY a.task_id
|
|
|
- ) b on a.task_id=b.taskId
|
|
|
- <where>
|
|
|
- pa.agreement_type = '2'
|
|
|
- AND a.is_not_documentary = '0'
|
|
|
- AND a.task_id is not null
|
|
|
- <if test="vo.beginDate != null and vo.beginDate!='' and vo.endDate != null and vo.endDate!=''">
|
|
|
- AND a.signdate BETWEEN #{vo.beginDate} AND #{vo.endDate}
|
|
|
- </if>
|
|
|
- <if test="vo.isNoCar !=null and vo.isNoCar !=''">
|
|
|
- and a.is_not_car =#{vo.isNoCar}
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- GROUP BY
|
|
|
- a.task_id , a.signdate,a.partner_companies_id
|
|
|
- ) b on b.subPathner = a.partner_companies_id
|
|
|
- <where>
|
|
|
- pa.agreement_type = '2'
|
|
|
- AND a.is_not_documentary = '0'
|
|
|
- <if test="vo.beginDate != null and vo.beginDate!='' and vo.endDate != null and vo.endDate!=''">
|
|
|
- AND a.signdate BETWEEN #{vo.beginDate} AND #{vo.endDate}
|
|
|
- </if>
|
|
|
- <if test="vo.isNoCar !=null and vo.isNoCar !=''">
|
|
|
- and a.is_not_car =#{vo.isNoCar}
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- GROUP BY
|
|
|
- a.partner_companies_id ,a.company_id) a
|
|
|
- LEFT JOIN esm_ins_company eic on eic.id = a.companyId
|
|
|
- LEFT JOIN sys_area sa on sa.area_code = a.subPathner
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ SUBSTRING( a.partner_companies_id, 6, 11 ) AS "subPathner",
|
|
|
+ a.company_id AS "companyId",
|
|
|
+ a.partner_companies_id AS "partnerCompaniesId" ,
|
|
|
+ sum(a.commission_feevalue) as "allAmount"
|
|
|
+ FROM
|
|
|
+ ins_ply_income a
|
|
|
+ LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
|
|
|
+ <where>
|
|
|
+ pa.agreement_type = '2'
|
|
|
+ AND a.is_not_documentary = '0'
|
|
|
+ <if test="vo.isNoCar != null and vo.isNoCar !='' ">
|
|
|
+ and a.is_not_car =#{vo.isNoCar}
|
|
|
+ </if>
|
|
|
+ <if test="vo.yearAndMonth !=null and vo.yearAndMonth != ''">
|
|
|
+ and DATE_FORMAT( a.signdate, '%Y-%m' ) =#{vo.yearAndMonth}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY
|
|
|
+ a.partner_companies_id,
|
|
|
+ a.company_id
|
|
|
+ ) a
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ sum( a.total_amount ) AS "invoicAmount",
|
|
|
+ sum( a.remaining_amount ) AS "noSettHandlingFee",
|
|
|
+ sum( a.settlement_amount ) AS "settAmount",
|
|
|
+ a.task_id AS "taskId",
|
|
|
+ DATE_FORMAT( a.signing_time, '%Y-%m' ) AS "subSigne",
|
|
|
+ a.partner_companies_id AS "subPathner"
|
|
|
+ FROM
|
|
|
+ sys_insurance_handling_settlement_month a
|
|
|
+ <where>
|
|
|
+ <if test="vo.isNoCar != null and vo.isNoCar !='' ">
|
|
|
+ and a.is_not_car =#{vo.isNoCar}
|
|
|
+ </if>
|
|
|
+ <if test="vo.yearAndMonth !=null and vo.yearAndMonth != ''">
|
|
|
+ and DATE_FORMAT( a.signing_time, '%Y-%m' ) =#{vo.yearAndMonth}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY
|
|
|
+ a.partner_companies_id,
|
|
|
+ DATE_FORMAT( a.signing_time, '%Y-%m' ),
|
|
|
+ a.task_id
|
|
|
+ ) b ON b.subPathner = a.partnerCompaniesId
|
|
|
+ LEFT JOIN esm_ins_company eic on eic.id = a.companyId
|
|
|
+ LEFT JOIN sys_area sa on sa.area_code = a.subPathner
|
|
|
</select>
|
|
|
|
|
|
|
|
|
@@ -2642,10 +2633,10 @@
|
|
|
FROM
|
|
|
settlement_documentary_fees a
|
|
|
<where>
|
|
|
- a.settlement_sum_id IS NOT NULL
|
|
|
+ a.handling_fees_status ='1'
|
|
|
AND settlement_status = '1'
|
|
|
- <if test="vo.beginDate != null and vo.beginDate!='' and vo.endDate != null and vo.endDate!=''">
|
|
|
- AND a.signing_time BETWEEN #{vo.beginDate} AND #{vo.endDate}
|
|
|
+ <if test="vo.yearAndMonth !=null and vo.yearAndMonth != ''">
|
|
|
+ and DATE_FORMAT( a.signing_time, '%Y-%m' ) =#{vo.yearAndMonth}
|
|
|
</if>
|
|
|
<if test="vo.isNoCar !=null and vo.isNoCar !=''">
|
|
|
and a.is_not_car =#{vo.isNoCar}
|
|
|
@@ -2659,8 +2650,8 @@
|
|
|
<where>
|
|
|
pa.agreement_type = '2'
|
|
|
AND a.is_not_documentary = '1'
|
|
|
- <if test="vo.beginDate != null and vo.beginDate!='' and vo.endDate != null and vo.endDate!=''">
|
|
|
- AND a.signdate BETWEEN #{vo.beginDate} AND #{vo.endDate}
|
|
|
+ <if test="vo.yearAndMonth !=null and vo.yearAndMonth != ''">
|
|
|
+ and DATE_FORMAT( a.signdate, '%Y-%m' ) =#{vo.yearAndMonth}
|
|
|
</if>
|
|
|
<if test="vo.isNoCar !=null and vo.isNoCar !=''">
|
|
|
and a.is_not_car =#{vo.isNoCar}
|
|
|
@@ -2681,7 +2672,8 @@
|
|
|
SUM(a.commission_feevalue) AS commissionFeevalue,
|
|
|
SUBSTRING( a.partner_companies_id, 6, 11 ) AS "subPathner",
|
|
|
SUM(CASE WHEN a.handling_fees_status = '1' THEN a.commission_feevalue ELSE 0 END) AS "readyCommissionFeevalue",
|
|
|
- SUM(CASE WHEN a.handling_fees_status = '0' THEN a.commission_feevalue ELSE 0 END) AS "noInvoicCommissionFeevalue"
|
|
|
+ SUM(CASE WHEN a.handling_fees_status = '0' THEN a.commission_feevalue ELSE 0 END) AS "noInvoicCommissionFeevalue",
|
|
|
+ SUM(CASE WHEN a.handling_fees_status = '0' THEN a.commission_feevalue ELSE 0 END) AS "noSettlementAmount"
|
|
|
FROM
|
|
|
ins_ply_income a
|
|
|
LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
|
|
|
@@ -2689,7 +2681,6 @@
|
|
|
LEFT JOIN esm_ins_company eic ON eic.id = a.company_id
|
|
|
<where>
|
|
|
pa.agreement_type = '1'
|
|
|
- AND a.is_not_documentary = '1'
|
|
|
<if test="vo.beginDate != null and vo.beginDate!='' and vo.endDate != null and vo.endDate!=''">
|
|
|
AND a.signdate BETWEEN #{vo.beginDate} AND #{vo.endDate}
|
|
|
</if>
|
|
|
@@ -2711,7 +2702,8 @@
|
|
|
SUM(a.other_feevalue) AS commissionFeevalue,
|
|
|
SUBSTRING( a.partner_companies_id, 6, 11 ) AS "subPathner",
|
|
|
SUM(CASE WHEN a.handling_fees_status = '1' THEN a.other_feevalue ELSE 0 END) AS "readyCommissionFeevalue",
|
|
|
- SUM(CASE WHEN a.handling_fees_status = '0' THEN a.other_feevalue ELSE 0 END) AS "noInvoicCommissionFeevalue"
|
|
|
+ SUM(CASE WHEN a.handling_fees_status = '0' THEN a.other_feevalue ELSE 0 END) AS "noInvoicCommissionFeevalue",
|
|
|
+ SUM(CASE WHEN a.handling_fees_status = '0' THEN a.commission_feevalue ELSE 0 END) AS "noSettlementAmount"
|
|
|
FROM
|
|
|
ins_ply_income a
|
|
|
LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
|
|
|
@@ -2738,7 +2730,8 @@
|
|
|
SUM(a.all_fee_value) AS commissionFeevalue,
|
|
|
SUBSTRING( a.partner_companies_id, 6, 11 ) AS "subPathner",
|
|
|
SUM(CASE WHEN a.handling_fees_status = '1' THEN a.all_fee_value ELSE 0 END) AS "readyCommissionFeevalue",
|
|
|
- SUM(CASE WHEN a.handling_fees_status = '0' THEN a.all_fee_value ELSE 0 END) AS "noInvoicCommissionFeevalue"
|
|
|
+ SUM(CASE WHEN a.handling_fees_status = '0' THEN a.all_fee_value ELSE 0 END) AS "noInvoicCommissionFeevalue",
|
|
|
+ SUM(CASE WHEN a.handling_fees_status = '0' THEN a.commission_feevalue ELSE 0 END) AS "noSettlementAmount"
|
|
|
FROM
|
|
|
ins_ply_income a
|
|
|
LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
|
|
|
@@ -2763,73 +2756,94 @@
|
|
|
|
|
|
<select id="queryPrivateCar" resultType="com.ydtech.modules.admin.model.report.financialReceivables.FinancialReceivablesVo">
|
|
|
SELECT
|
|
|
- DATE_FORMAT( a.signdate, '%Y-%m' ) as "yearAndMonth" ,
|
|
|
- sum(a.all_fee_value) as "commissionFeevalue",
|
|
|
- IFNULL(max(b.readyCommissionFeevalue),0) + IFNULL(max(c.readyCommissionFeevalue1),0) as "noInvoicCommissionFeevalue",
|
|
|
- sum(a.all_fee_value) -(IFNULL(max(b.readyCommissionFeevalue),0) + IFNULL(max(c.readyCommissionFeevalue1),0)) as "readyCommissionFeevalue",
|
|
|
- (IFNULL(max(b.inSettlementAmount),0) -IFNULL(sum(b.readyCommissionFeevalue),0)) +IFNULL(max(c.settlementAmount),0) as "settlementAmount",
|
|
|
- IFNULL(max(c.noInvoicCommissionFeevalue),0) + ((SUM( CASE WHEN a.handling_fees_status = '0' and a.is_not_documentary ='0' THEN a.all_fee_value ELSE 0 END ))) as "noSettlementAmount"
|
|
|
+ a.subSigndate as "yearAndMonth",
|
|
|
+ a.allAmount as "commissionFeevalue",
|
|
|
+ IFNULL(c.settAmountOther,0) +IFNULL(b.settCommAmount ,0) as "noInvoicCommissionFeevalue",
|
|
|
+ IFNULL(b.remainingAmount,0) +IFNULL(c.invoicNotOther,0) as "settlementAmount",
|
|
|
+ (a.allAmount-(IFNULL(b.invoicComm,0) + IFNULL(c.otherInvoic,0))) as "noSettlementAmount",
|
|
|
+ a.allAmount-(IFNULL(c.settAmountOther,0) +IFNULL(b.settCommAmount ,0)) as "readyCommissionFeevalue"
|
|
|
FROM
|
|
|
- ins_ply_income a
|
|
|
- LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
|
|
|
- left join (
|
|
|
+ (
|
|
|
SELECT
|
|
|
- SUM( CASE WHEN settlement_status = '2' THEN a.settlement_amount ELSE 0 END ) as "readyCommissionFeevalue",
|
|
|
- SUM( CASE WHEN settlement_status = '1' THEN a.settlement_amount ELSE 0 END ) as "inSettlementAmount",
|
|
|
- a.task_id AS "taskId"
|
|
|
+ DATE_FORMAT( a.signdate, '%Y-%m' ) AS subSigndate,
|
|
|
+ IFNULL( sum( a.commission_feevalue ), 0 ) + IFNULL( sum( a.other_feevalue ), 0 ) AS "allAmount"
|
|
|
FROM
|
|
|
- settlement_documentary_fees a
|
|
|
+ ins_ply_income a
|
|
|
+ LEFT JOIN ptl_agreement pa ON pa.id = a.agreement_id
|
|
|
<where>
|
|
|
- a.task_id IS NOT NULL
|
|
|
+ pa.agreement_type = '2'
|
|
|
<if test="vo.isNotCar !=null and vo.isNotCar !=''">
|
|
|
and a.is_not_car =#{vo.isNotCar}
|
|
|
</if>
|
|
|
</where>
|
|
|
GROUP BY
|
|
|
- a.task_id
|
|
|
- ) b on b .taskId =a.task_id
|
|
|
- left join (
|
|
|
+ DATE_FORMAT( a.signdate, '%Y-%m' )
|
|
|
+ ) a
|
|
|
+ LEFT JOIN (
|
|
|
SELECT
|
|
|
- DATE_FORMAT( a.signing_time, '%Y-%m' ) as "singDateYear",
|
|
|
- sum( a.invoiced_settled_amount ) AS "readyCommissionFeevalue1",
|
|
|
- sum( a.Invoiced_not_settled_amount ) AS "settlementAmount",
|
|
|
- SUM( CASE WHEN settlement_status = '1' THEN a.settlement_amount ELSE 0 END ) as "invoiceAmount",
|
|
|
- IFNULL(sum(b.otherallFeeValue),0) -sum( a.invoiced_settled_amount ) as "noInvoicCommissionFeevalue",
|
|
|
- IFNULL(sum(b.otherallFeeValue),0) -sum( a.invoiced_settled_amount ) - SUM( CASE WHEN settlement_status = '1' THEN a.settlement_amount ELSE 0 END ) as "noSettlementAmount"
|
|
|
+ DATE_FORMAT( a.signing_time, '%Y-%m' ) AS "subSigndate",
|
|
|
+ sum( a.settlement_amount ) AS "settCommAmount",
|
|
|
+ sum(a.remaining_amount) as "remainingAmount",
|
|
|
+ sum(a.total_amount) as "invoicComm"
|
|
|
FROM
|
|
|
- settlement_documentary_fees a
|
|
|
- left join (
|
|
|
- select sum(a.all_fee_value) as "otherallFeeValue", DATE_FORMAT( a.signdate, '%Y-%m' ) as "singDateYear" from ins_ply_income a
|
|
|
- LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
|
|
|
- <where>
|
|
|
- pa.agreement_type= '2'
|
|
|
- and a.is_not_documentary='1'
|
|
|
- <if test="vo.isNotCar !=null and vo.isNotCar !=''">
|
|
|
- and a.is_not_car =#{vo.isNotCar}
|
|
|
- </if>
|
|
|
- <if test="vo.beginDate != null and vo.beginDate!='' and vo.endDate != null and vo.endDate!=''">
|
|
|
- AND a.signdate BETWEEN #{vo.beginDate} AND #{vo.endDate}
|
|
|
- </if>
|
|
|
- </where>
|
|
|
-
|
|
|
- GROUP BY DATE_FORMAT( a.signdate, '%Y-%m' )
|
|
|
- ) b on b.singDateYear = DATE_FORMAT( a.signing_time, '%Y-%m' )
|
|
|
+ sys_insurance_handling_settlement_month a
|
|
|
<where>
|
|
|
- a.settlement_sum_id IS NOT NULL
|
|
|
- AND settlement_status = '1'
|
|
|
+ 1=1
|
|
|
+ <if test="vo.isNotCar !=null and vo.isNotCar !=''">
|
|
|
+ and a.is_not_car =#{vo.isNotCar}
|
|
|
+ </if>
|
|
|
</where>
|
|
|
- GROUP BY DATE_FORMAT( a.signing_time, '%Y-%m' )
|
|
|
- ) c on c.singDateYear=DATE_FORMAT( a.signdate, '%Y-%m' )
|
|
|
+ GROUP BY
|
|
|
+ DATE_FORMAT( a.signing_time, '%Y-%m' )
|
|
|
+ ) b ON a.subSigndate = b.subSigndate
|
|
|
+ left join (
|
|
|
+ select DATE_FORMAT( a.signing_time, '%Y-%m' ) as "subSigndate" , sum(settlement_amount) as "otherInvoic", sum(invoiced_settled_amount) as "settAmountOther", sum(Invoiced_not_settled_amount) as "invoicNotOther"
|
|
|
+ from
|
|
|
+ settlement_documentary_fees a
|
|
|
+ where a.settlement_status='1'
|
|
|
+ and handling_fees_status ='1'
|
|
|
+ GROUP BY DATE_FORMAT( a.signing_time, '%Y-%m' )
|
|
|
+ ) c on c.subSigndate=a.subSigndate
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="queryDateByTypeMonthSumAmount" resultType="java.math.BigDecimal">
|
|
|
+ SELECT
|
|
|
+ SUM(IFNULL(a.commission_feevalue ,0 ) + IFNULL(a.other_feevalue ,0 ))
|
|
|
+ FROM
|
|
|
+ ins_ply_income a
|
|
|
+ LEFT JOIN
|
|
|
+ ptl_agreement pa ON pa.id = a.agreement_id
|
|
|
<where>
|
|
|
- pa.agreement_type ='2'
|
|
|
- <if test="vo.isNotCar !=null and vo.isNotCar !=''">
|
|
|
- and a.is_not_car =#{vo.isNotCar}
|
|
|
+ <if test="vo.type !=null and vo.type !=''">
|
|
|
+ and pa.agreement_type =#{vo.type}
|
|
|
+ </if>
|
|
|
+ <if test="vo.beginDate != null and vo.beginDate!='' and vo.endDate != null and vo.endDate!=''">
|
|
|
+ AND a.create_time BETWEEN #{vo.beginDate} AND #{vo.endDate}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+ <select id="queryDateByTypeByMonth"
|
|
|
+ resultType="com.ydtech.modules.admin.model.report.financialReceivables.FinancialReceivablesAllMonthVo">
|
|
|
+ SELECT
|
|
|
+ SUM(IFNULL(a.commission_feevalue ,0 ) + IFNULL(a.other_feevalue ,0 )) AS ysSumAmount,
|
|
|
+ SUM(CASE WHEN a.handling_fees_status = '0' THEN IFNULL(a.commission_feevalue ,0 ) + IFNULL(a.other_feevalue ,0 ) ELSE 0 END ) AS "yisSumAmount",
|
|
|
+ SUM(CASE WHEN a.handling_fees_status = '1' THEN IFNULL(a.commission_feevalue ,0 ) + IFNULL(a.other_feevalue ,0 ) ELSE 0 END) AS "wsSumAmount"
|
|
|
+ FROM
|
|
|
+ ins_ply_income a
|
|
|
+ LEFT JOIN
|
|
|
+ ptl_agreement pa ON pa.id = a.agreement_id
|
|
|
+ <where>
|
|
|
+ 1=1
|
|
|
+ <if test="vo.type !=null and vo.type !=''">
|
|
|
+ and pa.agreement_type =#{vo.type}
|
|
|
</if>
|
|
|
<if test="vo.beginDate != null and vo.beginDate!='' and vo.endDate != null and vo.endDate!=''">
|
|
|
AND a.signdate BETWEEN #{vo.beginDate} AND #{vo.endDate}
|
|
|
</if>
|
|
|
+ <if test="vo.yearAndMonth != null and vo.yearAndMonth!=''">
|
|
|
+ AND DATE_FORMAT(a.signdate, '%Y-%m') =#{vo.yearAndMonth}
|
|
|
+ </if>
|
|
|
</where>
|
|
|
- GROUP BY DATE_FORMAT( a.signdate, '%Y-%m' )
|
|
|
</select>
|
|
|
<select id="getProfitAnalysisQueryList" resultType="com.ydtech.modules.admin.model.report.profitAnalysis.ProfitAnalysisDto">
|
|
|
SELECT
|
|
|
@@ -3039,4 +3053,61 @@
|
|
|
</where>
|
|
|
group by a.task_id , DATE_FORMAT( a.signdate, '%Y-%m' )
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="queryDateByTypePt" resultType="com.ydtech.modules.admin.model.report.financialReceivables.FinancialReceivablesVo">
|
|
|
+ SELECT IFNULL(a.signingTime, 0) as "yearAndMonth",
|
|
|
+ IFNULL(a.allAmount, 0) as "commissionFeevalue",
|
|
|
+ IFNULL(c.settAmount, 0) as "noInvoicCommissionFeevalue",
|
|
|
+ IFNULL(b.notInvoicAmount, 0) as "noSettlementAmount",
|
|
|
+ IFNULL(c.settAmount, 0) as "readyCommissionFeevalue"
|
|
|
+ FROM (SELECT sum(a.commission_feevalue) + sum(a.other_feevalue) AS "allAmount",
|
|
|
+ DATE_FORMAT(a.signdate, '%Y-%m') as "signingTime"
|
|
|
+ FROM ins_ply_income a
|
|
|
+ LEFT JOIN ptl_agreement pa ON pa.id = a.agreement_id
|
|
|
+ WHERE pa.agreement_type = '1'
|
|
|
+ GROUP BY DATE_FORMAT(a.signdate, '%Y-%m')) a
|
|
|
+ left join (SELECT sum(a.commission_feevalue) + sum(a.other_feevalue) AS "notInvoicAmount",
|
|
|
+ DATE_FORMAT(a.signdate, '%Y-%m') as "signingTime"
|
|
|
+ FROM ins_ply_income a
|
|
|
+ LEFT JOIN ptl_agreement pa ON pa.id = a.agreement_id
|
|
|
+ WHERE pa.agreement_type = '1'
|
|
|
+ and a.handling_fees_status = '0'
|
|
|
+ GROUP BY DATE_FORMAT(a.signdate, '%Y-%m')) b on a.signingTime = b.signingTime
|
|
|
+ left join (SELECT sum(a.commission_feevalue) + sum(a.other_feevalue) AS "settAmount",
|
|
|
+ DATE_FORMAT(a.signdate, '%Y-%m') as "signingTime"
|
|
|
+ FROM ins_ply_income a
|
|
|
+ LEFT JOIN ptl_agreement pa ON pa.id = a.agreement_id
|
|
|
+ WHERE pa.agreement_type = '1'
|
|
|
+ and a.handling_fees_status = '1'
|
|
|
+ GROUP BY DATE_FORMAT(a.signdate, '%Y-%m')) c on c.signingTime = a.signingTime
|
|
|
+ </select>
|
|
|
+ <select id="getPatherId" resultType="com.ydtech.modules.admin.model.report.financialReceivables.FinancialReceivablesMonthVo">
|
|
|
+ SELECT
|
|
|
+ sa.area_cname as "areaName",
|
|
|
+ eic.namesimple as "companyName",
|
|
|
+ SUBSTRING( a.partner_companies_id, 6, 11 ) AS "subPathner",
|
|
|
+ a.company_id AS "companyId",
|
|
|
+ a.partner_companies_id AS "partnerCompaniesId"
|
|
|
+ FROM
|
|
|
+ ins_ply_income a
|
|
|
+ LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
|
|
|
+ LEFT JOIN esm_ins_company eic on eic.id = a.company_id
|
|
|
+ LEFT JOIN sys_area sa on sa.area_code = SUBSTRING( a.partner_companies_id, 6, 11 )
|
|
|
+ <where>
|
|
|
+ <if test="vo.type !=null and vo.type!=''">
|
|
|
+ pa.agreement_type =#{vo.type}
|
|
|
+ </if>
|
|
|
+ <if test="vo.isNoCar != null and vo.isNoCar !='' ">
|
|
|
+ and a.is_not_car =#{vo.isNoCar}
|
|
|
+ </if>
|
|
|
+ <if test="vo.yearAndMonth !=null and vo.yearAndMonth != ''">
|
|
|
+ and DATE_FORMAT( a.signdate, '%Y-%m' ) =#{vo.yearAndMonth}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY
|
|
|
+ a.partner_companies_id,
|
|
|
+ a.company_id,
|
|
|
+ eic.namesimple,
|
|
|
+ sa.area_cname
|
|
|
+ </select>
|
|
|
</mapper>
|