From 7ffef0059ddf3d4a82de4a4a8999b4b2429fcda6 Mon Sep 17 00:00:00 2001
From: shiyunteng <shiyunteng@example.com>
Date: 星期四, 25 六月 2026 16:47:14 +0800
Subject: [PATCH] feat:erp石工泵合同推送
---
platformx-business-finance-biz/src/main/resources/mapper/ContractMapper.xml | 233 ++++++++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 216 insertions(+), 17 deletions(-)
diff --git a/platformx-business-finance-biz/src/main/resources/mapper/ContractMapper.xml b/platformx-business-finance-biz/src/main/resources/mapper/ContractMapper.xml
index 0aea4e5..f21b81e 100644
--- a/platformx-business-finance-biz/src/main/resources/mapper/ContractMapper.xml
+++ b/platformx-business-finance-biz/src/main/resources/mapper/ContractMapper.xml
@@ -184,7 +184,7 @@
<select id="contractIncomeAnalysis"
resultType="com.by4cloud.platformx.business.vo.ContractIncomeAnalysisVo">
SELECT
- compName,
+ compId,
SUM(CASE WHEN month_num = 1 THEN total_amount ELSE 0 END) AS 'srMonth1',
SUM(CASE WHEN month_num = 1 AND pay_type = 1 THEN total_amount ELSE 0 END) AS 'xhMonth1',
SUM(CASE WHEN month_num = 1 AND pay_type = 2 THEN total_amount ELSE 0 END) AS 'cdMonth1',
@@ -202,9 +202,9 @@
SUM(CASE WHEN month_num = 4 AND pay_type = 2 THEN total_amount ELSE 0 END) AS 'cdMonth4',
SUM(CASE WHEN month_num = 4 AND pay_type = 3 THEN total_amount ELSE 0 END) AS 'qtMonth4',
SUM(CASE WHEN month_num = 5 THEN total_amount ELSE 0 END) AS 'srMonth5',
- SUM(CASE WHEN month_num = 5 AND pay_type = 0 THEN total_amount ELSE 0 END) AS 'xhMonth5',
- SUM(CASE WHEN month_num = 5 AND pay_type = 1 THEN total_amount ELSE 0 END) AS 'cdMonth5',
- SUM(CASE WHEN month_num = 5 AND pay_type = 2 THEN total_amount ELSE 0 END) AS 'qtMonth5',
+ SUM(CASE WHEN month_num = 5 AND pay_type = 1 THEN total_amount ELSE 0 END) AS 'xhMonth5',
+ SUM(CASE WHEN month_num = 5 AND pay_type = 2 THEN total_amount ELSE 0 END) AS 'cdMonth5',
+ SUM(CASE WHEN month_num = 5 AND pay_type = 3 THEN total_amount ELSE 0 END) AS 'qtMonth5',
SUM(CASE WHEN month_num = 6 THEN total_amount ELSE 0 END) AS 'srMonth6',
SUM(CASE WHEN month_num = 6 AND pay_type = 1 THEN total_amount ELSE 0 END) AS 'xhMonth6',
SUM(CASE WHEN month_num = 6 AND pay_type = 2 THEN total_amount ELSE 0 END) AS 'cdMonth6',
@@ -235,7 +235,7 @@
SUM(CASE WHEN month_num = 12 AND pay_type = 3 THEN total_amount ELSE 0 END) AS 'qtMonth12'
FROM (
SELECT
- COALESCE(pc.payee_comp_id, '鏈煡鍗曚綅') AS compName,
+ COALESCE(pc.payee_comp_id, '鏈煡鍗曚綅') AS compId,
MONTH(payment_time) AS month_num,
pay_type,
COALESCE(payment_amount, 0) AS total_amount
@@ -250,7 +250,7 @@
#{id}
</foreach>
) AS source_data
- GROUP BY compName
+ GROUP BY compId
</select>
<select id="contractIncomeAnalysisByComp"
@@ -746,9 +746,11 @@
SELECT
SUM( amount )
FROM
- contract
+ contract ct
WHERE
- party_b_id IN
+ ct.del_flag = '0'
+ and ct.supply_attribute = c.supply_attribute
+ and ct.party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
@@ -761,9 +763,11 @@
SELECT
SUM( amount )
FROM
- contract
+ contract ct
WHERE
- party_b_id IN
+ ct.del_flag = '0'
+ and ct.supply_attribute = c.supply_attribute
+ and ct.party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
@@ -776,9 +780,11 @@
SELECT
SUM( amount )
FROM
- contract
+ contract ct
WHERE
- party_b_id IN
+ ct.del_flag = '0'
+ and ct.supply_attribute = c.supply_attribute
+ and ct.party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
@@ -791,9 +797,11 @@
SELECT
SUM( amount )
FROM
- contract
+ contract ct
WHERE
- party_b_id IN
+ ct.del_flag = '0'
+ and ct.supply_attribute = c.supply_attribute
+ and ct.party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
@@ -806,9 +814,11 @@
SELECT
SUM( amount )
FROM
- contract
+ contract ct
WHERE
- party_b_id IN
+ ct.del_flag = '0'
+ and ct.supply_attribute = c.supply_attribute
+ and ct.party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
@@ -818,7 +828,8 @@
FROM
contract c
WHERE
- c.supply_attribute IS NOT NULL
+ c.del_flag = '0'
+ and c.supply_attribute IS NOT NULL
AND YEAR ( sign_date ) = #{queryDTO.year}
GROUP BY
c.supply_attribute
@@ -888,4 +899,192 @@
ORDER BY m.month_num
</select>
+ <select id="contractAmountAnalysisBySaleModel"
+ resultType="com.by4cloud.platformx.business.vo.ContractIncomeAnalysisAreaVo">
+ SELECT
+ b.sales_model area_id,
+ SUM( CASE WHEN c.party_b_id = #{sgbCompId} THEN c.amount ELSE 0 END ) AS sgbze,
+ ROUND(
+ SUM( CASE WHEN c.party_b_id = #{sgbCompId} THEN c.amount ELSE 0 END ) / (
+ SELECT
+ SUM( amount )
+ FROM
+ contract c, business_customer bc
+ WHERE
+ bc.id = c.party_a_id
+ and c.del_flag = '0'
+ and bc.del_flag = '0'
+ and bc.sales_model = b.sales_model
+ and party_b_id IN
+ <foreach collection="compIds" item="id" open="(" close=")" separator=",">
+ #{id}
+ </foreach>
+ ) * 100,
+ 2
+ ) AS sgbzb,
+ SUM( CASE WHEN c.party_b_id = #{jxcCompId} THEN c.amount ELSE 0 END ) AS jxcze,
+ ROUND(
+ SUM( CASE WHEN c.party_b_id = #{jxcCompId} THEN c.amount ELSE 0 END ) / (
+ SELECT
+ SUM( amount )
+ FROM
+ contract c, business_customer bc
+ WHERE
+ bc.id = c.party_a_id
+ and c.del_flag = '0'
+ and bc.del_flag = '0'
+ and bc.sales_model = b.sales_model
+ and party_b_id IN
+ <foreach collection="compIds" item="id" open="(" close=")" separator=",">
+ #{id}
+ </foreach>
+ ) * 100,
+ 2
+ ) AS jxczb ,
+ SUM( CASE WHEN c.party_b_id = #{smjCompId} THEN c.amount ELSE 0 END ) AS smjze,
+ ROUND(
+ SUM( CASE WHEN c.party_b_id = #{smjCompId} THEN c.amount ELSE 0 END ) / (
+ SELECT
+ SUM( amount )
+ FROM
+ contract c, business_customer bc
+ WHERE
+ bc.id = c.party_a_id
+ and c.del_flag = '0'
+ and bc.del_flag = '0'
+ and bc.sales_model = b.sales_model
+ and party_b_id IN
+ <foreach collection="compIds" item="id" open="(" close=")" separator=",">
+ #{id}
+ </foreach>
+ ) * 100,
+ 2
+ ) AS smjzb ,
+ SUM( CASE WHEN c.party_b_id = #{ymjCompId} THEN c.amount ELSE 0 END ) AS ymjze,
+ ROUND(
+ SUM( CASE WHEN c.party_b_id = #{ymjCompId} THEN c.amount ELSE 0 END ) / (
+ SELECT
+ SUM( amount )
+ FROM
+ contract c, business_customer bc
+ WHERE
+ bc.id = c.party_a_id
+ and c.del_flag = '0'
+ and bc.del_flag = '0'
+ and bc.sales_model = b.sales_model
+ and party_b_id IN
+ <foreach collection="compIds" item="id" open="(" close=")" separator=",">
+ #{id}
+ </foreach>
+ ) * 100,
+ 2
+ ) AS ymjzb ,
+ SUM( CASE WHEN c.party_b_id = #{tfCompId} THEN c.amount ELSE 0 END ) AS tfze,
+ ROUND(
+ SUM( CASE WHEN c.party_b_id = #{tfCompId} THEN c.amount ELSE 0 END ) / (
+ SELECT
+ SUM( amount )
+ FROM
+ contract c, business_customer bc
+ WHERE
+ bc.id = c.party_a_id
+ and c.del_flag = '0'
+ and bc.del_flag = '0'
+ and bc.sales_model = b.sales_model
+ and party_b_id IN
+ <foreach collection="compIds" item="id" open="(" close=")" separator=",">
+ #{id}
+ </foreach>
+ ) * 100,
+ 2
+ ) AS tfzb
+ FROM
+ contract c
+ JOIN business_customer b ON c.party_a_id = b.id
+ WHERE
+ b.sales_model IS NOT NULL
+ AND YEAR ( sign_date ) = #{queryDTO.year}
+ GROUP BY
+ b.sales_model
+
+ </select>
+ <select id="pageScope" resultType="com.by4cloud.platformx.business.vo.ContractPageVo">
+ SELECT
+ id,
+ contract_no,
+ contract_name,
+ party_a_id,
+ party_a,
+ party_b_id,
+ party_b,
+ amount,
+ currency,
+ contract_type,
+ supply_attribute,
+ contract_status,
+ contract_attribute,
+ sign_date,
+ sign_place,
+ effective_date,
+ delivery_cycle,
+ expiration_date,
+ attachment_url,
+ remark,
+ parent_id,
+ approve_time,
+ arrival_schedule_id,
+ accept_schedule_id,
+ erp_push_flag,
+ billing_status,
+ billing_amout,
+ next_schedule_name,
+ template_id,
+ sales_model,
+ paid_amount,
+ contract_category,
+ exec_frequency,
+ exec_times,
+ exec_day,
+ environment,
+ standard,
+ use_month,
+ after_ship_month,
+ ship_method,
+ ship_address,
+ packaging,
+ repair_period,
+ repair_breach_amount,
+ goods_short,
+ goods_short_breach_amount,
+ overdue_breach_amount,
+ terminate_contract,
+ court,
+ contract_attchment,
+ city,
+ region,
+ invoice_notice,
+ contract_tax,
+ create_by,
+ update_by,
+ create_time,
+ update_time,
+ del_flag,
+ comp_id,
+ (select sum(delivered_quantity*unit_price) from contract_subject_matter csm where csm.contract_id = c.id) outAmount
+ FROM
+ contract c
+ WHERE
+ del_flag = '0'
+ <if test="queryDTO.contractName !=null and queryDTO.contractName !=''">
+ AND contract_name LIKE CONCAT('%', #{queryDTO.contractName}, '%')
+ </if>
+ <if test="queryDTO.partyA !=null and queryDTO.partyA !=''">
+ AND party_a LIKE CONCAT('%', #{queryDTO.partyA}, '%')
+ </if>
+ <if test="queryDTO.contractStatus !=null and queryDTO.contractStatus !=''">
+ AND contract_status = #{queryDTO.contractStatus}
+ </if>
+ ORDER BY
+ create_time DESC
+ </select>
</mapper>
\ No newline at end of file
--
Gitblit v1.9.1