From cd11bc80579a629e8ab6f9ee9e1cd982f4396408 Mon Sep 17 00:00:00 2001
From: shiyunteng <shiyunteng@example.com>
Date: 星期三, 12 八月 2026 10:02:07 +0800
Subject: [PATCH] feat:银行流水绑定合同问题 出库单据查看 历史当前逾期新增删除去掉 完成开票隐藏开票按钮  出库业务单据文件类型

---
 platformx-business-finance-biz/src/main/resources/mapper/ContractMapper.xml |  132 ++++++++++++++++++++++++++++++--------------
 1 files changed, 90 insertions(+), 42 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 12793f6..5936e13 100644
--- a/platformx-business-finance-biz/src/main/resources/mapper/ContractMapper.xml
+++ b/platformx-business-finance-biz/src/main/resources/mapper/ContractMapper.xml
@@ -338,6 +338,7 @@
 							and c.del_flag = '0'
 							and bc.del_flag = '0'
 							and bc.area_id = b.area_id
+							AND YEAR( c.sign_date ) = #{queryDTO.year}
 							and party_b_id IN
 							<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 								#{id}
@@ -357,6 +358,7 @@
 								and c.del_flag = '0'
 								and bc.del_flag = '0'
 								and bc.area_id = b.area_id
+								AND YEAR( c.sign_date ) = #{queryDTO.year}
 								and party_b_id IN
 								<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 									#{id}
@@ -376,6 +378,7 @@
 								and c.del_flag = '0'
 								and bc.del_flag = '0'
 								and bc.area_id = b.area_id
+								AND YEAR( c.sign_date ) = #{queryDTO.year}
 								and party_b_id IN
 								<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 									#{id}
@@ -395,6 +398,7 @@
 							and c.del_flag = '0'
 							and bc.del_flag = '0'
 							and bc.area_id = b.area_id
+							AND YEAR( c.sign_date ) = #{queryDTO.year}
 							and party_b_id IN
 							<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 								#{id}
@@ -414,6 +418,7 @@
 		and c.del_flag = '0'
 		and bc.del_flag = '0'
 		and bc.area_id = b.area_id
+		AND YEAR( c.sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -425,7 +430,8 @@
 			contract c
 				JOIN business_customer b ON c.party_a_id = b.id
 		WHERE
-			b.area_id IS NOT NULL
+		c.del_flag='0'
+		AND b.area_id IS NOT NULL
 		AND YEAR ( sign_date ) = #{queryDTO.year}
 		GROUP BY
 			b.area_id
@@ -434,19 +440,18 @@
 	<select id="contractAmountAnalysisByIndustry"
 			resultType="com.by4cloud.platformx.business.vo.ContractIncomeAnalysisAreaVo">
 		SELECT
-		b.industry_id area_id,
+		c.industry_code 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.industry_id = b.industry_id
+		contract c1
+		where
+		c1.del_flag = '0'
+		and c1.industry_code = c.industry_code
+		AND YEAR( sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -460,12 +465,11 @@
 		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.industry_id = b.industry_id
+		contract c1
+		where
+		c1.del_flag = '0'
+		and c1.industry_code = c.industry_code
+		AND YEAR( sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -479,12 +483,11 @@
 		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.industry_id = b.industry_id
+		contract c1
+		where
+		c1.del_flag = '0'
+		and c1.industry_code = c.industry_code
+		AND YEAR( sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -498,12 +501,11 @@
 		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.industry_id = b.industry_id
+		contract c1
+		where
+		c1.del_flag = '0'
+		and c1.industry_code = c.industry_code
+		AND YEAR( sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -517,12 +519,11 @@
 		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.industry_id = b.industry_id
+		contract c1
+		where
+		      c1.del_flag = '0'
+		and c1.industry_code = c.industry_code
+		AND YEAR( sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -532,12 +533,12 @@
 		) AS tfzb
 		FROM
 		contract c
-		JOIN business_customer b ON c.party_a_id = b.id
-		WHERE
-		b.industry_id IS NOT NULL
+		where
+		c.del_flag='0'
+		AND c.industry_code  is not null
 		AND YEAR ( sign_date ) = #{queryDTO.year}
 		GROUP BY
-		b.industry_id
+		c.industry_code
 
 	</select>
 	<select id="contractAmountAnalysisByMarket"
@@ -556,6 +557,7 @@
 		and c.del_flag = '0'
 		and bc.del_flag = '0'
 		and bc.class_id = b.class_id
+		AND YEAR( c.sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -575,6 +577,7 @@
 		and c.del_flag = '0'
 		and bc.del_flag = '0'
 		and bc.class_id = b.class_id
+		AND YEAR( c.sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -594,6 +597,7 @@
 		and c.del_flag = '0'
 		and bc.del_flag = '0'
 		and bc.class_id = b.class_id
+		AND YEAR( c.sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -613,6 +617,7 @@
 		and c.del_flag = '0'
 		and bc.del_flag = '0'
 		and bc.class_id = b.class_id
+		AND YEAR( c.sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -632,6 +637,7 @@
 		and c.del_flag = '0'
 		and bc.del_flag = '0'
 		and bc.class_id = b.class_id
+		AND YEAR( c.sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -643,7 +649,8 @@
 		contract c
 		JOIN business_customer b ON c.party_a_id = b.id
 		WHERE
-		b.class_id IS NOT NULL
+		c.del_flag='0'
+		AND b.class_id IS NOT NULL
 		AND YEAR ( sign_date ) = #{queryDTO.year}
 		GROUP BY
 		b.class_id
@@ -666,6 +673,7 @@
 		and c.del_flag = '0'
 		and bc.del_flag = '0'
 		and bc.export_service_attr = b.export_service_attr
+		AND YEAR( c.sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -685,6 +693,7 @@
 		and c.del_flag = '0'
 		and bc.del_flag = '0'
 		and bc.export_service_attr = b.export_service_attr
+		AND YEAR( c.sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -704,6 +713,7 @@
 		and c.del_flag = '0'
 		and bc.del_flag = '0'
 		and bc.export_service_attr = b.export_service_attr
+		AND YEAR( c.sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -723,6 +733,7 @@
 		and c.del_flag = '0'
 		and bc.del_flag = '0'
 		and bc.export_service_attr = b.export_service_attr
+		AND YEAR( c.sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -742,6 +753,7 @@
 		and c.del_flag = '0'
 		and bc.del_flag = '0'
 		and bc.export_service_attr = b.export_service_attr
+		AND YEAR( c.sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -753,7 +765,8 @@
 		contract c
 		JOIN business_customer b ON c.party_a_id = b.id
 		WHERE
-		b.export_service_attr IS NOT NULL
+		c.del_flag='0'
+		AND b.export_service_attr IS NOT NULL
 		AND YEAR ( sign_date ) = #{queryDTO.year}
 		GROUP BY
 		b.export_service_attr
@@ -773,6 +786,7 @@
 		WHERE
 		      ct.del_flag = '0'
 		and  ct.supply_attribute = c.supply_attribute
+		AND YEAR ( sign_date ) = #{queryDTO.year}
 		and ct.party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -790,6 +804,7 @@
 		WHERE
 		ct.del_flag = '0'
 		and  ct.supply_attribute = c.supply_attribute
+		AND YEAR ( sign_date ) = #{queryDTO.year}
 		and ct.party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -807,6 +822,7 @@
 		WHERE
 		ct.del_flag = '0'
 		and  ct.supply_attribute = c.supply_attribute
+		AND YEAR ( sign_date ) = #{queryDTO.year}
 		and ct.party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -824,6 +840,7 @@
 		WHERE
 		ct.del_flag = '0'
 		and  ct.supply_attribute = c.supply_attribute
+		AND YEAR ( sign_date ) = #{queryDTO.year}
 		and ct.party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -841,6 +858,7 @@
 		WHERE
 		ct.del_flag = '0'
 		and  ct.supply_attribute = c.supply_attribute
+		AND YEAR ( sign_date ) = #{queryDTO.year}
 		and ct.party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -896,7 +914,9 @@
 				DATE_FORMAT(sign_date, '%Y-%m') AS stat_month,
 				SUM(amount) AS total_amount
 			FROM contract
-			WHERE YEAR(sign_date) = #{queryDTO.year}
+			WHERE
+				del_flag='0'
+				AND YEAR(sign_date) = #{queryDTO.year}
 				 AND party_b_id = #{compId}
 			GROUP BY DATE_FORMAT(sign_date, '%Y-%m')
 		) curr ON m.stat_month = curr.stat_month
@@ -906,7 +926,8 @@
 				MONTH(sign_date) AS month_num,
 				SUM(amount) AS total_amount
 			FROM contract
-			WHERE YEAR(sign_date) = YEAR(CURDATE())
+			WHERE del_flag='0'
+			AND YEAR(sign_date) = YEAR(CURDATE())
 	  		AND party_b_id = #{compId}
 			GROUP BY DATE_FORMAT(sign_date, '%Y-%m'), MONTH(sign_date)
 		) prev ON m.month_num = prev.month_num + 1
@@ -915,7 +936,8 @@
 				MONTH(sign_date) AS month_num,
 				SUM(amount) AS total_amount
 			FROM contract
-			WHERE YEAR(sign_date) = YEAR(CURDATE()) - 1
+			WHERE del_flag='0'
+			AND YEAR(sign_date) = YEAR(CURDATE()) - 1
 			AND party_b_id = #{compId}
 			GROUP BY MONTH(sign_date)
 		) last_year ON m.month_num = last_year.month_num
@@ -938,6 +960,7 @@
 		and c.del_flag = '0'
 		and bc.del_flag = '0'
 		and bc.sales_model = b.sales_model
+		AND YEAR( c.sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -957,6 +980,7 @@
 		and c.del_flag = '0'
 		and bc.del_flag = '0'
 		and bc.sales_model = b.sales_model
+		AND YEAR( c.sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -976,6 +1000,7 @@
 		and c.del_flag = '0'
 		and bc.del_flag = '0'
 		and bc.sales_model = b.sales_model
+		AND YEAR( c.sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -995,6 +1020,7 @@
 		and c.del_flag = '0'
 		and bc.del_flag = '0'
 		and bc.sales_model = b.sales_model
+		AND YEAR( c.sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -1014,6 +1040,7 @@
 		and c.del_flag = '0'
 		and bc.del_flag = '0'
 		and bc.sales_model = b.sales_model
+		AND YEAR( c.sign_date ) = #{queryDTO.year}
 		and party_b_id IN
 		<foreach collection="compIds" item="id" open="(" close=")" separator=",">
 			#{id}
@@ -1025,7 +1052,8 @@
 		contract c
 		JOIN business_customer b ON c.party_a_id = b.id
 		WHERE
-		b.sales_model IS NOT NULL
+		c.del_flag='0'
+		AND b.sales_model IS NOT NULL
 		AND YEAR ( sign_date ) = #{queryDTO.year}
 		GROUP BY
 		b.sales_model
@@ -1063,6 +1091,8 @@
 			c.paid_amount,
 			c.contract_category,
 			c.exec_frequency,
+		   	c.next_schedule_name,
+		    c.warranty_schedule_id,
 			c.comp_id,
 			(select sum(delivered_quantity*unit_price) from contract_subject_matter csm where csm.contract_id = c.id) outAmount
 			FROM
@@ -1559,4 +1589,22 @@
 		AND c.sign_date &gt;= DATE_FORMAT( CURDATE(), '%Y-01-01' )
 		AND c.sign_date &lt; DATE_FORMAT( DATE_ADD( CURDATE(), INTERVAL 1 YEAR ), '%Y-01-01' )) hwbn
 	</select>
+	<select id="fourAssociation" resultType="com.by4cloud.platformx.business.vo.FourAssociationPageVo">
+		SELECT
+			c.id,
+			c.contract_no,
+			c.sign_date,
+		    c.amount,
+		    c.paid_amount,
+			c.billing_amout,
+			c.comp_id
+		FROM
+			contract c
+		where
+			c.del_flag = '0'
+		and c.contract_status = 2
+		order by
+			c.create_time
+
+	</select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.1