|
|
@@ -512,6 +512,7 @@
|
|
|
ipii.tax_point,
|
|
|
ipi.order_no as orderNo,
|
|
|
ipiis.actual_received_amount,
|
|
|
+ ipii.receivable_supervise_premium,
|
|
|
ipiis.receive_payment_date,
|
|
|
ipiis.create_by ,
|
|
|
ipiis.create_time
|
|
|
@@ -572,6 +573,78 @@
|
|
|
order by ipiis.create_time desc
|
|
|
</select>
|
|
|
|
|
|
+ <select id="platformSettlementExcelDtos" resultType="com.jzg.commons.entity.finance.dto.ExportSuperviseSettlementExcelDto">
|
|
|
+ SELECT
|
|
|
+ ipiis.id AS settlementId,
|
|
|
+ -- 拼接需要合并的字段,DISTINCT 去重,SEPARATOR '、' 用顿号分隔
|
|
|
+ GROUP_CONCAT(DISTINCT ipiis.invoice_id SEPARATOR ',') AS invoiceId,
|
|
|
+ GROUP_CONCAT(DISTINCT io.company_id SEPARATOR ',') AS company_id,
|
|
|
+ GROUP_CONCAT(DISTINCT io.company_name SEPARATOR ',') AS company_name,
|
|
|
+ GROUP_CONCAT(DISTINCT ipii.invoice_type SEPARATOR ',') AS invoice_type,
|
|
|
+ GROUP_CONCAT(DISTINCT ipii.invoice_party SEPARATOR ',') AS invoice_party,
|
|
|
+ GROUP_CONCAT(DISTINCT ipii.tax_point SEPARATOR ',') AS tax_point,
|
|
|
+ GROUP_CONCAT(DISTINCT ipi.order_no SEPARATOR ',') AS orderNo,
|
|
|
+ -- 金额/日期这类同一settlementId相同的字段,直接取任意一个即可
|
|
|
+ MAX(ipiis.actual_received_amount) AS actual_received_amount,
|
|
|
+ MAX(ipiis.receive_payment_date) AS receive_payment_date,
|
|
|
+ MAX(ipiis.create_by) AS create_by,
|
|
|
+ MAX(ipiis.create_time) AS create_time
|
|
|
+ FROM ins_ply_income_invoice_settlement ipiis
|
|
|
+ LEFT JOIN ins_ply_income_invoice ipii ON ipii.id = ipiis.invoice_id
|
|
|
+ LEFT JOIN ins_ply_income_invoice_link ipil ON ipil.invoice_id = ipiis.invoice_id
|
|
|
+ LEFT JOIN ins_ply_income ipi ON ipi.id = ipil.income_id
|
|
|
+ LEFT JOIN ins_orders io ON ipi.order_no = io.id
|
|
|
+ LEFT JOIN ptl_agreement agree ON io.agreement_id = agree.id
|
|
|
+ WHERE 1 = 1
|
|
|
+ <if test="settlementQueryVo.settlementIds != null and settlementQueryVo.settlementIds != ''">
|
|
|
+ AND ipiis.id IN
|
|
|
+ <foreach collection="settlementQueryVo.settlementIds" item="settlementId" open="(" separator="," close=")">
|
|
|
+ #{settlementId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="settlementQueryVo.invoiceTypes != null and settlementQueryVo.invoiceTypes != ''">
|
|
|
+ AND ipii.invoice_type IN
|
|
|
+ <foreach collection="settlementQueryVo.invoiceTypes" item="invoiceType" open="(" separator="," close=")">
|
|
|
+ #{invoiceType}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="settlementQueryVo.companyId != null and settlementQueryVo.companyId != ''">
|
|
|
+ and io.company_id = #{settlementQueryVo.companyId}
|
|
|
+ </if>
|
|
|
+ <if test="settlementQueryVo.invoiceParty != null and settlementQueryVo.invoiceParty != ''">
|
|
|
+ and ipii.invoice_party = #{settlementQueryVo.invoiceParty}
|
|
|
+ </if>
|
|
|
+ <if test="settlementQueryVo.invoiceRiskType != null and settlementQueryVo.invoiceRiskType != ''">
|
|
|
+ and ipii.invoice_risk_type = #{settlementQueryVo.invoiceRiskType}
|
|
|
+ </if>
|
|
|
+ <if test="settlementQueryVo.status != null and settlementQueryVo.status != ''">
|
|
|
+ and ipii.status = #{settlementQueryVo.status}
|
|
|
+ </if>
|
|
|
+ <if test="settlementQueryVo.settlementPerson != null and settlementQueryVo.settlementPerson != ''">
|
|
|
+ and ipiis.create_by = #{settlementQueryVo.settlementPerson}
|
|
|
+ </if>
|
|
|
+ <if test="settlementQueryVo.agreementType != null and settlementQueryVo.agreementType != ''">
|
|
|
+ AND (agree.agreement_type = #{settlementQueryVo.agreementType} or agree.agreement_type is null)
|
|
|
+ </if>
|
|
|
+ <if test="settlementQueryVo.invoiceId != null and settlementQueryVo.invoiceId != ''">
|
|
|
+ AND ipiis.invoice_id = #{settlementQueryVo.invoiceId}
|
|
|
+ </if>
|
|
|
+ <if test="settlementQueryVo.settlementId != null and settlementQueryVo.settlementId != ''">
|
|
|
+ AND ipiis.id = #{settlementQueryVo.settlementId}
|
|
|
+ </if>
|
|
|
+ <if test="settlementQueryVo.settlementDateStart != null and settlementQueryVo.settlementDateStart != ''">
|
|
|
+ and ipiis.create_time >= date(#{settlementQueryVo.settlementDateStart})
|
|
|
+ </if>
|
|
|
+ <if test="settlementQueryVo.settlementDateEndStr != null and settlementQueryVo.settlementDateEndStr != ''">
|
|
|
+ and ipiis.create_time <= date(#{settlementQueryVo.settlementDateEndStr})
|
|
|
+ </if>
|
|
|
+ <if test="settlementQueryVo.settlementId != null and settlementQueryVo.settlementId != ''">
|
|
|
+ AND ipiis.id = #{settlementQueryVo.settlementId}
|
|
|
+ </if>
|
|
|
+ GROUP BY ipiis.id
|
|
|
+ order by ipiis.create_time desc
|
|
|
+ </select>
|
|
|
+
|
|
|
<!-- <select id="getSuperviseSettlementExcelDtos" resultType="com.jzg.commons.entity.finance.dto.ExportSuperviseSettlementExcelDto">-->
|
|
|
<!-- select-->
|
|
|
<!-- ipiis.id as settlementId,-->
|
|
|
@@ -639,7 +712,10 @@
|
|
|
LEFT JOIN ins_ply_income ipi ON ipi.id = ipil.income_id
|
|
|
LEFT JOIN ins_orders io ON ipi.order_no = io.id
|
|
|
WHERE
|
|
|
- 1=1
|
|
|
+ 1 = 1
|
|
|
+ <if test="settlementQueryVo.settlementId != null and settlementQueryVo.settlementId != ''">
|
|
|
+ and ipiis.id = #{settlementQueryVo.settlementId}
|
|
|
+ </if>
|
|
|
<if test="settlementQueryVo.settlementIds != null and settlementQueryVo.settlementIds != ''">
|
|
|
AND ipiis.id IN
|
|
|
<foreach collection="settlementQueryVo.settlementIds" item="settlementId" open="(" separator="," close=")">
|