From dd6687b118561100e1677e88a9c2f5842a54c531 Mon Sep 17 00:00:00 2001
From: jialh <1972868360@qq.com>
Date: 星期四, 16 四月 2026 18:14:14 +0800
Subject: [PATCH] 水电话费

---
 java110-db/src/main/resources/mapper/center/MaintenancePaymentDAOImplMapper.xml |  247 +++++++++++++++++++++++++++++++++++++------------
 1 files changed, 185 insertions(+), 62 deletions(-)

diff --git a/java110-db/src/main/resources/mapper/center/MaintenancePaymentDAOImplMapper.xml b/java110-db/src/main/resources/mapper/center/MaintenancePaymentDAOImplMapper.xml
index eb1dc3c..65e794c 100644
--- a/java110-db/src/main/resources/mapper/center/MaintenancePaymentDAOImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/center/MaintenancePaymentDAOImplMapper.xml
@@ -21,7 +21,7 @@
         </if>
     </delete>
 
-    <!-- 淇濆瓨璐圭敤瀵煎叆鏄庣粏淇℃伅 add by wuxw 2018-07-03 -->
+    <!-- 淇濆瓨璐圭敤瀵煎叆鏄庣粏淇℃伅 -->
     <insert id="saveImportFeeDetailInfo" parameterType="Map">
         insert into maintenance_payment(
         auxiliary_column, flow_number, serial_number, project_code, project_name,
@@ -36,7 +36,10 @@
         quota, owners_committee_resolution, owners_committee_consultation,
         withdrawal_encountered_problem, shortage_or_arrears, road_name, lane,
         `door`, room, door_room_number, owner_address, start_date, end_date,
-        payee_name, id_card_number, bank_name, bank_account, remarks, acceptance_date, audit_date, id
+        payee_name, id_card_number, bank_name, bank_account, remarks, acceptance_date, audit_date,
+        id, payment_target, payable_amount_d, advanced_payment, specific_announcement_status,
+        management_fee_ratio, first_planned_payment_amount, planned_payment_date, category,
+        reimburser, actual_payment_amount, actual_payment_date
         ) values (
         #{auxiliaryColumn}, #{flowNumber}, #{serialNumber}, #{projectCode}, #{projectName},
         <if test="year == null">null,</if>
@@ -71,71 +74,128 @@
         <if test="shortageOrArrears == null">0,</if>
         <if test="shortageOrArrears != null">#{shortageOrArrears},</if>
         #{roadName}, #{lane}, #{door}, #{room}, #{doorRoomNumber}, #{ownerAddress}, #{startDate}, #{endDate},
-        #{payeeName}, #{idCardNumber}, #{bankName}, #{bankAccount}, #{remarks}, #{acceptanceDate}, #{auditDate}, #{id}
+        #{payeeName}, #{idCardNumber}, #{bankName}, #{bankAccount}, #{remarks}, #{acceptanceDate}, #{auditDate},
+        #{id}, #{paymentTarget}, #{payableAmountD}, #{advancedPayment}, #{specificAnnouncementStatus},
+        <if test="managementFeeRatio == null">0,</if>
+        <if test="managementFeeRatio != null">#{managementFeeRatio},</if>
+        <if test="firstPlannedPaymentAmount == null">0,</if>
+        <if test="firstPlannedPaymentAmount != null">#{firstPlannedPaymentAmount},</if>
+        #{plannedPaymentDate}, #{category}, #{reimburser},
+        <if test="actualPaymentAmount == null">0,</if>
+        <if test="actualPaymentAmount != null">#{actualPaymentAmount},</if>
+        #{actualPaymentDate}
         )
     </insert>
 
-
-    <!-- 鏌ヨ璐圭敤瀵煎叆鏄庣粏淇℃伅 add by wuxw 2018-07-03 -->
+    <!-- 鏌ヨ璐圭敤瀵煎叆鏄庣粏淇℃伅 -->
     <select id="getImportFeeDetailInfo" parameterType="Map" resultType="Map">
         select
-        t.auxiliary_column,t.auxiliary_column auxiliaryColumn,
-        t.flow_number,t.flow_number flowNumber,
-        t.serial_number,t.serial_number serialNumber,
-        t.project_code,t.project_code projectCode,
-        t.project_name,t.project_name projectName,
+        t.auxiliary_column, t.auxiliary_column auxiliaryColumn,
+        t.flow_number, t.flow_number flowNumber,
+        t.serial_number, t.serial_number serialNumber,
+        t.project_code, t.project_code projectCode,
+        t.project_name, t.project_name projectName,
         t.`year`,
         t.`month`,
         t.`day`,
         t.`date`,
-        t.project_content,t.project_content projectContent,
-        t.management_office_amount,t.management_office_amount managementOfficeAmount,
-        t.management_office_seal,t.management_office_seal managementOfficeSeal,
-        t.owners_committee_amount,t.owners_committee_amount ownersCommitteeAmount,
-        t.audit_amount,t.audit_amount auditAmount,
-        t.owners_committee_seal,t.owners_committee_seal ownersCommitteeSeal,
-        t.report_department,t.report_department reportDepartment,
-        t.fund_type_level1,t.fund_type_level1 fundTypeLevel1,
-        t.fund_type_level2,t.fund_type_level2 fundTypeLevel2,
-        t.building_or_all,t.building_or_all buildingOrAll,
-        t.maintenance_type,t.maintenance_type maintenanceType,
-        t.quality_guarantee_period1,t.quality_guarantee_period1 qualityGuaranteePeriod1,
-        t.public_income_announcement,t.public_income_announcement publicIncomeAnnouncement,
-        t.owners_committee_convention,t.owners_committee_convention ownersCommitteeConvention,
-        t.withdrawal_problem,t.withdrawal_problem withdrawalProblem,
-        t.problem_difficulty,t.problem_difficulty problemDifficulty,
-        t.available_withdrawal_date,t.available_withdrawal_date availableWithdrawalDate,
-        t.quality_guarantee_period2,t.quality_guarantee_period2 qualityGuaranteePeriod2,
-        t.quality_guarantee_ratio,t.quality_guarantee_ratio qualityGuaranteeRatio,
-        t.quality_guarantee_amount,t.quality_guarantee_amount qualityGuaranteeAmount,
-        t.received_quality_guarantee,t.received_quality_guarantee receivedQualityGuarantee,
-        t.planned_announcement_start,t.planned_announcement_start plannedAnnouncementStart,
-        t.planned_announcement_end,t.planned_announcement_end plannedAnnouncementEnd,
-        t.published_announcement_start,t.published_announcement_start publishedAnnouncementStart,
-        t.published_announcement_end,t.published_announcement_end publishedAnnouncementEnd,
+        t.project_content, t.project_content projectContent,
+        t.management_office_amount, t.management_office_amount managementOfficeAmount,
+        t.management_office_seal, t.management_office_seal managementOfficeSeal,
+        t.owners_committee_amount, t.owners_committee_amount ownersCommitteeAmount,
+        t.audit_amount, t.audit_amount auditAmount,
+        t.owners_committee_seal, t.owners_committee_seal ownersCommitteeSeal,
+        t.report_department, t.report_department reportDepartment,
+        t.fund_type_level1, t.fund_type_level1 fundTypeLevel1,
+        t.fund_type_level2, t.fund_type_level2 fundTypeLevel2,
+        t.building_or_all, t.building_or_all buildingOrAll,
+        t.maintenance_type, t.maintenance_type maintenanceType,
+        t.quality_guarantee_period1, t.quality_guarantee_period1 qualityGuaranteePeriod1,
+        t.public_income_announcement, t.public_income_announcement publicIncomeAnnouncement,
+        t.owners_committee_convention, t.owners_committee_convention ownersCommitteeConvention,
+        t.withdrawal_problem, t.withdrawal_problem withdrawalProblem,
+        t.problem_difficulty, t.problem_difficulty problemDifficulty,
+        t.available_withdrawal_date, t.available_withdrawal_date availableWithdrawalDate,
+        t.quality_guarantee_period2, t.quality_guarantee_period2 qualityGuaranteePeriod2,
+        t.quality_guarantee_ratio, t.quality_guarantee_ratio qualityGuaranteeRatio,
+        t.quality_guarantee_amount, t.quality_guarantee_amount qualityGuaranteeAmount,
+        t.received_quality_guarantee, t.received_quality_guarantee receivedQualityGuarantee,
+        t.planned_announcement_start, t.planned_announcement_start plannedAnnouncementStart,
+        t.planned_announcement_end, t.planned_announcement_end plannedAnnouncementEnd,
+        t.published_announcement_start, t.published_announcement_start publishedAnnouncementStart,
+        t.published_announcement_end, t.published_announcement_end publishedAnnouncementEnd,
         t.quota,
-        t.owners_committee_resolution,t.owners_committee_resolution ownersCommitteeResolution,
-        t.owners_committee_consultation,t.owners_committee_consultation ownersCommitteeConsultation,
-        t.withdrawal_encountered_problem,t.withdrawal_encountered_problem withdrawalEncounteredProblem,
-        t.shortage_or_arrears,t.shortage_or_arrears shortageOrArrears,
-        t.road_name,t.road_name roadName,
+        t.owners_committee_resolution, t.owners_committee_resolution ownersCommitteeResolution,
+        t.owners_committee_consultation, t.owners_committee_consultation ownersCommitteeConsultation,
+        t.withdrawal_encountered_problem, t.withdrawal_encountered_problem withdrawalEncounteredProblem,
+        t.shortage_or_arrears, t.shortage_or_arrears shortageOrArrears,
+        t.road_name, t.road_name roadName,
         t.lane,
         t.`door`,
         t.room,
-        t.door_room_number,t.door_room_number doorRoomNumber,
-        t.owner_address,t.owner_address ownerAddress,
-        t.start_date,t.start_date startDate,
-        t.end_date,t.end_date endDate,
-        t.payee_name,t.payee_name payeeName,
-        t.id_card_number,t.id_card_number idCardNumber,
-        t.bank_name,t.bank_name bankName,
-        t.bank_account,t.bank_account bankAccount,
+        t.door_room_number, t.door_room_number doorRoomNumber,
+        t.owner_address, t.owner_address ownerAddress,
+        t.start_date, t.start_date startDate,
+        t.end_date, t.end_date endDate,
+        t.payee_name, t.payee_name payeeName,
+        t.id_card_number, t.id_card_number idCardNumber,
+        t.bank_name, t.bank_name bankName,
+        t.bank_account, t.bank_account bankAccount,
         t.remarks,
-        t.acceptance_date,t.acceptance_date acceptanceDate,
-        t.audit_date,t.audit_date auditDate,
-        t.id
+        t.acceptance_date, t.acceptance_date acceptanceDate,
+        t.audit_date, t.audit_date auditDate,
+        t.id,
+        t.payment_target, t.payment_target paymentTarget,
+        t.specific_announcement_status, t.specific_announcement_status specificAnnouncementStatus,
+        t.management_fee_ratio, t.management_fee_ratio managementFeeRatio,
+        t.first_planned_payment_amount, t.first_planned_payment_amount firstPlannedPaymentAmount,
+        t.planned_payment_date, t.planned_payment_date plannedPaymentDate,
+        t.category, t.category category,
+        t.reimburser, t.reimburser reimburser,
+        t.actual_payment_amount, t.actual_payment_amount actualPaymentAmount,
+        t.actual_payment_date, t.actual_payment_date actualPaymentDate,
+        t.payable_amount_d, t.payable_amount_d payableAmountD,
+        t.advanced_payment, t.advanced_payment advancedPayment,
+        IFNULL(SUM(sum_print_amount), 0) AS dyhj,
+        IFNULL(SUM(sum_arrival_amount), 0) AS dzhj,
+        CASE WHEN IFNULL(SUM(sum_arrival_amount), 0) &lt;> 0 THEN IFNULL(SUM(sum_arrival_amount), 0) / t.owners_committee_amount * 100 ELSE 0 END AS wxjjdzl,
+        CASE WHEN t.fund_type_level1 &lt;> '缁翠慨鍩洪噾' THEN 0 ELSE t.owners_committee_amount - IFNULL(SUM(sum_arrival_amount), 0) END AS wxjjsqje,
+        CASE WHEN t.owners_committee_amount &lt;> 0 THEN t.management_fee_ratio / t.owners_committee_amount * 100 ELSE 0 END AS glfzb,
+        t.owners_committee_amount - t.management_fee_ratio AS yfjeA,
+        IFNULL(SUM(sum_fifth_planned), 0) AS nfhj,
+        IFNULL(SUM(sum_actual_payment), 0) AS sfhj,
+        (t.owners_committee_amount - t.management_fee_ratio) - IFNULL(SUM(sum_actual_payment), 0) AS wfhj,
+        CASE
+        WHEN t.fund_type_level1 IN ('鍏叡鏀剁泭閲�','缁翠慨鍩洪噾') THEN
+        CASE
+        WHEN IFNULL(SUM(sum_arrival_amount),0) &lt;> 0 THEN
+        CASE WHEN (t.owners_committee_amount - t.management_fee_ratio - IFNULL(SUM(sum_actual_payment),0)) > IFNULL(SUM(sum_arrival_amount),0)
+        THEN (t.owners_committee_amount - t.management_fee_ratio - IFNULL(SUM(sum_actual_payment),0)) - IFNULL(SUM(sum_arrival_amount),0)
+        ELSE 0 END
+        ELSE
+        CASE WHEN t.specific_announcement_status LIKE '%鍏竷%' AND t.specific_announcement_status NOT LIKE '%鎷�%'
+        THEN 0
+        ELSE (t.owners_committee_amount - t.management_fee_ratio - IFNULL(SUM(sum_actual_payment),0)) END
+        END
+        ELSE 0 END AS dfje
         from maintenance_payment t
-        where 1 =1
+        -- 宸﹁繛鎺� 鎵撳嵃璁板綍琛紝淇濊瘉涓昏〃鏁版嵁涓嶄涪澶�
+        left join (
+        select mp_id,
+        SUM(print_amount) as sum_print_amount,
+        SUM(arrival_amount) as sum_arrival_amount
+        from mp_payment_record
+        group by mp_id
+        ) m on t.id = m.mp_id
+        left join (
+        select mp_id,
+        SUM(fifth_planned_payment_amount) as sum_fifth_planned,
+        SUM(actual_payment_amount) as sum_actual_payment
+        from mp_fifth_payment_record
+        group by mp_id
+        ) f on t.id = f.mp_id
+        where 1 = 1
+        -- 鎸変富琛ㄦ墍鏈夐潪鑱氬悎瀛楁鍒嗙粍
         <if test="auxiliaryColumn !=null and auxiliaryColumn != ''">
             and t.auxiliary_column = #{auxiliaryColumn}
         </if>
@@ -187,15 +247,26 @@
         <if test="id !=null">
             and t.id = #{id}
         </if>
+        <if test="paymentTarget !=null and paymentTarget != ''">
+            and t.payment_target = #{paymentTarget}
+        </if>
+        <if test="specificAnnouncementStatus !=null and specificAnnouncementStatus != ''">
+            and t.specific_announcement_status = #{specificAnnouncementStatus}
+        </if>
+        <if test="category !=null and category != ''">
+            and t.category = #{category}
+        </if>
+        <if test="reimburser !=null and reimburser != ''">
+            and t.reimburser like concat('%', #{reimburser}, '%')
+        </if>
+        group by t.id
         order by t.id desc
         <if test="page != -1 and page != null ">
             limit #{page}, #{row}
         </if>
-
     </select>
 
-
-    <!-- 淇敼璐圭敤瀵煎叆鏄庣粏淇℃伅 add by wuxw 2018-07-03 -->
+    <!-- 淇敼璐圭敤瀵煎叆鏄庣粏淇℃伅 -->
     <update id="updateImportFeeDetailInfo" parameterType="Map">
         update maintenance_payment t
         <!-- 娉ㄦ剰锛歩d浣滀负涓婚敭锛岄�氬父涓嶅缓璁洿鏂帮紝杩欓噷淇濈暀浣嗘爣娉紝寤鸿鏍规嵁涓氬姟鍐冲畾鏄惁鍒犻櫎 -->
@@ -281,7 +352,6 @@
         <if test="auditDate !=null and auditDate != ''">
             , t.audit_date = #{auditDate}
         </if>
-        <!-- 浠ヤ笅涓鸿ˉ鍏呯殑缂哄け瀛楁 -->
         <if test="maintenanceType !=null and maintenanceType != ''">
             , t.maintenance_type = #{maintenanceType}
         </if>
@@ -339,7 +409,7 @@
         <if test="withdrawalEncounteredProblem !=null and withdrawalEncounteredProblem != ''">
             , t.withdrawal_encountered_problem = #{withdrawalEncounteredProblem}
         </if>
-        <if test="shortageOrArrears !=null and shortageOrArrears != ''">
+        <if test="shortageOrArrears !=null">
             , t.shortage_or_arrears = #{shortageOrArrears}
         </if>
         <if test="roadName !=null and roadName != ''">
@@ -366,6 +436,39 @@
         <if test="endDate !=null">
             , t.end_date = #{endDate}
         </if>
+        <if test="paymentTarget !=null and paymentTarget != ''">
+            , t.payment_target = #{paymentTarget}
+        </if>
+        <if test="specificAnnouncementStatus !=null and specificAnnouncementStatus != ''">
+            , t.specific_announcement_status = #{specificAnnouncementStatus}
+        </if>
+        <if test="managementFeeRatio !=null">
+            , t.management_fee_ratio = #{managementFeeRatio}
+        </if>
+        <if test="firstPlannedPaymentAmount !=null">
+            , t.first_planned_payment_amount = #{firstPlannedPaymentAmount}
+        </if>
+        <if test="plannedPaymentDate !=null">
+            , t.planned_payment_date = #{plannedPaymentDate}
+        </if>
+        <if test="category !=null and category != ''">
+            , t.category = #{category}
+        </if>
+        <if test="reimburser !=null and reimburser != ''">
+            , t.reimburser = #{reimburser}
+        </if>
+        <if test="actualPaymentAmount !=null">
+            , t.actual_payment_amount = #{actualPaymentAmount}
+        </if>
+        <if test="actualPaymentDate !=null">
+            , t.actual_payment_date = #{actualPaymentDate}
+        </if>
+        <if test="payableAmountD !=null">
+            , t.payable_amount_d = #{payableAmountD}
+        </if>
+        <if test="advancedPayment !=null">
+            , t.advanced_payment = #{advancedPayment}
+        </if>
 
         where 1=1
         <if test="id !=null">
@@ -373,11 +476,11 @@
         </if>
     </update>
 
-    <!-- 鏌ヨ璐圭敤瀵煎叆鏄庣粏鏁伴噺 add by wuxw 2018-07-03 -->
+    <!-- 鏌ヨ璐圭敤瀵煎叆鏄庣粏鏁伴噺 -->
     <select id="queryImportFeeDetailsCount" parameterType="Map" resultType="Map">
         select count(1) count
         from maintenance_payment t
-        where 1 =1
+        where 1 = 1
         <if test="auxiliaryColumn !=null and auxiliaryColumn != ''">
             and t.auxiliary_column = #{auxiliaryColumn}
         </if>
@@ -429,7 +532,18 @@
         <if test="id !=null">
             and t.id = #{id}
         </if>
-
+        <if test="paymentTarget !=null and paymentTarget != ''">
+            and t.payment_target = #{paymentTarget}
+        </if>
+        <if test="specificAnnouncementStatus !=null and specificAnnouncementStatus != ''">
+            and t.specific_announcement_status = #{specificAnnouncementStatus}
+        </if>
+        <if test="category !=null and category != ''">
+            and t.category = #{category}
+        </if>
+        <if test="reimburser !=null and reimburser != ''">
+            and t.reimburser like concat('%', #{reimburser}, '%')
+        </if>
     </select>
 
     <!-- 鎵归噺鎻掑叆璐圭敤 -->
@@ -447,7 +561,10 @@
         quota, owners_committee_resolution, owners_committee_consultation,
         withdrawal_encountered_problem, shortage_or_arrears, road_name, lane,
         `door`, room, door_room_number, owner_address, start_date, end_date,
-        payee_name, id_card_number, bank_name, bank_account, remarks, acceptance_date, audit_date
+        payee_name, id_card_number, bank_name, bank_account, remarks, acceptance_date, audit_date,
+        id, payment_target, payable_amount_d, advanced_payment, specific_announcement_status,
+        management_fee_ratio, first_planned_payment_amount, planned_payment_date, category,
+        reimburser, actual_payment_amount, actual_payment_date
         ) values
         <foreach collection="importFeeDetailPos" item="item" separator=",">
             ( #{item.auxiliaryColumn}, #{item.flowNumber}, #{item.serialNumber}, #{item.projectCode}, #{item.projectName},
@@ -472,7 +589,13 @@
             #{item.withdrawalEncounteredProblem},
             <if test="item.shortageOrArrears == null">0</if><if test="item.shortageOrArrears != null">#{item.shortageOrArrears}</if>,
             #{item.roadName}, #{item.lane}, #{item.door}, #{item.room}, #{item.doorRoomNumber}, #{item.ownerAddress}, #{item.startDate}, #{item.endDate},
-            #{item.payeeName}, #{item.idCardNumber}, #{item.bankName}, #{item.bankAccount}, #{item.remarks}, #{item.acceptanceDate}, #{item.auditDate})
+            #{item.payeeName}, #{item.idCardNumber}, #{item.bankName}, #{item.bankAccount}, #{item.remarks}, #{item.acceptanceDate}, #{item.auditDate},
+            #{item.id}, #{item.paymentTarget}, #{item.payableAmountD}, #{item.advancedPayment}, #{item.specificAnnouncementStatus},
+            <if test="item.managementFeeRatio == null">0</if><if test="item.managementFeeRatio != null">#{item.managementFeeRatio}</if>,
+            <if test="item.firstPlannedPaymentAmount == null">0</if><if test="item.firstPlannedPaymentAmount != null">#{item.firstPlannedPaymentAmount}</if>,
+            #{item.plannedPaymentDate}, #{item.category}, #{item.reimburser},
+            <if test="item.actualPaymentAmount == null">0</if><if test="item.actualPaymentAmount != null">#{item.actualPaymentAmount}</if>,
+            #{item.actualPaymentDate})
         </foreach>
     </insert>
 

--
Gitblit v1.8.0