|
|
@@ -658,6 +658,73 @@
|
|
|
order by ipiis.create_time desc
|
|
|
</select>
|
|
|
|
|
|
+ <select id="followSettlementExcelDtos" 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 ipii.company_id SEPARATOR ',') AS company_id,
|
|
|
+ GROUP_CONCAT(DISTINCT eic.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,
|
|
|
+ -- 金额/日期这类同一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 AND ipii.is_delete = 0
|
|
|
+ LEFT JOIN ins_ply_follow_invoice_link link ON link.invoice_id = ipiis.invoice_id AND link.is_delete = 0
|
|
|
+ LEFT JOIN ins_fee_follow_order fo ON fo.id = link.follow_id AND fo.is_delete = 0
|
|
|
+ LEFT JOIN esm_ins_company eic ON ipii.company_id = eic.id AND eic.is_delete = 0
|
|
|
+ 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.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,-->
|
|
|
@@ -1196,8 +1263,7 @@
|
|
|
eic.name_simple as companyNameSimple,
|
|
|
sum( ipiis.actual_received_amount ) AS actual_received_amount,
|
|
|
ipii.status,
|
|
|
- ipii.payment_reason,
|
|
|
- ipiis.settlement_payment_reason
|
|
|
+ ipii.payment_reason
|
|
|
FROM
|
|
|
ins_ply_income_invoice ipii
|
|
|
LEFT JOIN ins_ply_income_invoice_settlement ipiis ON ipii.id = ipiis.invoice_id
|