From d7d9b601b2e4fdb663375993e2cfbdbd363df421 Mon Sep 17 00:00:00 2001
From: Your Name <you@example.com>
Date: 星期二, 11 七月 2023 22:17:37 +0800
Subject: [PATCH] Merge branch 'master' of http://git.homecommunity.cn/supervip/MicroCommunity
---
java110-db/src/main/resources/mapper/report/ReportFeeMonthStatisticsServiceDaoImplMapper.xml | 836 ++++++++++++++++++++++++++++++++---------------------------
1 files changed, 452 insertions(+), 384 deletions(-)
diff --git a/java110-db/src/main/resources/mapper/report/ReportFeeMonthStatisticsServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/report/ReportFeeMonthStatisticsServiceDaoImplMapper.xml
index 69fa5aa..37f8a1b 100755
--- a/java110-db/src/main/resources/mapper/report/ReportFeeMonthStatisticsServiceDaoImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/report/ReportFeeMonthStatisticsServiceDaoImplMapper.xml
@@ -7,17 +7,17 @@
<!-- 淇濆瓨璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
<insert id="saveReportFeeMonthStatisticsInfo" parameterType="Map">
insert into report_fee_month_statistics(receivable_amount, statistics_id, update_time, remark, obj_name,
- received_amount, fee_year, fee_month, fee_id, config_id,
- obj_id, fee_name, owe_amount, community_id, fee_create_time, obj_type,
- deadline_time, cur_max_time,
- his_owe_amount, cur_receivable_amount, cur_received_amount,
- his_owe_received_amount, pre_received_amount, obj_name_num)
+ received_amount, fee_year, fee_month, fee_id, config_id,
+ obj_id, fee_name, owe_amount, community_id, fee_create_time, obj_type,
+ deadline_time, cur_max_time,
+ his_owe_amount, cur_receivable_amount, cur_received_amount,
+ his_owe_received_amount, pre_received_amount, obj_name_num)
values (#{receivableAmount}, #{statisticsId}, #{updateTime}, #{remark}, #{objName}, #{receivedAmount},
- #{feeYear}, #{feeMonth},
- #{feeId}, #{configId}, #{objId}, #{feeName}, #{oweAmount}, #{communityId}, #{feeCreateTime}, #{objType},
- #{deadlineTime}, #{curMaxTime},
- #{hisOweAmount}, #{curReceivableAmount}, #{curReceivedAmount}, #{hisOweReceivedAmount},
- #{preReceivedAmount}, #{objNameNum})
+ #{feeYear}, #{feeMonth},
+ #{feeId}, #{configId}, #{objId}, #{feeName}, #{oweAmount}, #{communityId}, #{feeCreateTime}, #{objType},
+ #{deadlineTime}, #{curMaxTime},
+ #{hisOweAmount}, #{curReceivableAmount}, #{curReceivedAmount}, #{hisOweReceivedAmount},
+ #{preReceivedAmount}, #{objNameNum})
</insert>
<!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
@@ -286,6 +286,12 @@
<if test="unitId !=null and unitId != ''">
and bu.unit_id= #{unitId}
</if>
+ <if test="unitIds !=null ">
+ and bu.unit_id in
+ <foreach collection="unitIds" item="item" open="(" close=")" separator=",">
+ #{item}
+ </foreach>
+ </if>
<if test="floorId !=null and floorId != ''">
and f.floor_id = #{floorId}
</if>
@@ -334,7 +340,7 @@
<!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
<select id="queryReportFeeSummary" parameterType="Map" resultType="Map">
- select t.fee_year feeYear,t.fee_month feeMonth,t.create_time createTime
+ select t.fee_year feeYear,t.fee_month feeMonth,max(t.create_time) createTime
<if test="configIds !=null">
,t.config_id configId
</if>
@@ -354,6 +360,12 @@
</if>
<if test="unitId !=null and unitId != ''">
and bu.unit_id= #{unitId}
+ </if>
+ <if test="unitIds !=null ">
+ and bu.unit_id in
+ <foreach collection="unitIds" item="item" open="(" close=")" separator=",">
+ #{item}
+ </foreach>
</if>
<if test="floorId !=null and floorId != ''">
and f.floor_id = #{floorId}
@@ -421,6 +433,12 @@
<if test="unitId !=null and unitId != ''">
and bu.unit_id= #{unitId}
</if>
+ <if test="unitIds !=null ">
+ and bu.unit_id in
+ <foreach collection="unitIds" item="item" open="(" close=")" separator=",">
+ #{item}
+ </foreach>
+ </if>
<if test="floorId !=null and floorId != ''">
and f.floor_id = #{floorId}
</if>
@@ -485,6 +503,12 @@
<if test="unitId !=null and unitId != ''">
and bu.unit_id= #{unitId}
</if>
+ <if test="unitIds !=null ">
+ and bu.unit_id in
+ <foreach collection="unitIds" item="item" open="(" close=")" separator=",">
+ #{item}
+ </foreach>
+ </if>
<if test="floorId !=null and floorId != ''">
and f.floor_id = #{floorId}
</if>
@@ -548,6 +572,12 @@
</if>
<if test="unitId !=null and unitId != ''">
and bu.unit_id= #{unitId}
+ </if>
+ <if test="unitIds !=null ">
+ and bu.unit_id in
+ <foreach collection="unitIds" item="item" open="(" close=")" separator=",">
+ #{item}
+ </foreach>
</if>
<if test="floorId !=null and floorId != ''">
and f.floor_id = #{floorId}
@@ -987,7 +1017,7 @@
<if test="yearMonth !=null and yearMonth != ''">
and concat(t.fee_year,lpad(t.fee_month,2,0)) = #{yearMonth}
</if>
- group by t.config_id,t.fee_name,pfc.start_time
+ group by t.fee_name ,td.name ,pfc.fee_type_cd,pfc.start_time ,t.create_time
) t
</select>
@@ -1059,7 +1089,7 @@
<if test="yearMonth !=null and yearMonth != ''">
and concat(t.fee_year,lpad(t.fee_month,2,0)) = #{yearMonth}
</if>
- group by t.config_id,t.fee_name,pfc.start_time
+ group by t.fee_name,td.name ,pfc.fee_type_cd,t.config_id ,t.create_time
order by t.create_time desc
<if test="page != -1 and page != null ">
limit #{page}, #{row}
@@ -1323,15 +1353,19 @@
<if test="endTime !=null and endTime != ''">
and t.deadline_time <= #{endTime}
</if>
+ <if test="feeTypeCd !=null and feeTypeCd != ''">
+ and pfc.fee_type_cd = #{feeTypeCd}
+ </if>
group by t.config_id,t.fee_name,t.fee_create_time,t.obj_id,t.obj_name,t.deadline_time
) t
</select>
<!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
<select id="queryFeeDetail" parameterType="Map" resultType="Map">
- select t.config_id configId,t.obj_id objId,t.obj_name objName,t.obj_type objType,t.fee_name feeName,t.fee_create_time feeCreateTime,pfa.`value`
+ select t.config_id configId,t.obj_id objId,t.obj_name objName,t.obj_type objType,t.fee_name
+ feeName,t.fee_create_time feeCreateTime,pfa.`value`
ownerName,br.built_up_area builtUpArea ,max(t.deadline_time)
- deadlineTime,t.create_time createTime,max(t.update_time) updateTime,SUM(t.his_owe_amount)
+ deadlineTime,max(t.create_time) createTime,max(t.update_time) updateTime,SUM(t.his_owe_amount)
hisOweAmount,SUM(t.cur_receivable_amount) curReceivableAmount,
SUM(t.cur_received_amount) curReceivedAmount,SUM(t.his_owe_received_amount)
hisOweReceivedAmount,SUM(t.pre_received_amount) preReceivedAmount,
@@ -1388,6 +1422,9 @@
</if>
<if test="endTime !=null and endTime != ''">
and t.deadline_time <= #{endTime}
+ </if>
+ <if test="feeTypeCd !=null and feeTypeCd != ''">
+ and pfc.fee_type_cd = #{feeTypeCd}
</if>
group by t.config_id,t.fee_name,t.fee_create_time,t.obj_id,t.obj_type,t.obj_name,pfa.`value`,br.built_up_area
order by pfa.`value`
@@ -1502,15 +1539,15 @@
and t.create_time <= #{endTime}
</if>
and t.amount_owed > 0 and pf.end_time < now()
- group by t.fee_name,t.payer_obj_id,t.payer_obj_name
+ group by t.payer_obj_name ,t.fee_name ,pf.end_time ,t.create_time
HAVING oweAmount > 0
) t
</select>
<!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
<select id="queryOweFeeDetail" parameterType="Map" resultType="Map">
- select t.payer_obj_name objName,t.fee_name feeName,pf.end_time feeCreateTime,t.update_time
- updateTime,pfa.`value` ownerName,br.built_up_area builtUpArea ,SUM(t.amount_owed) oweAmount,max(t.deadline_time)
+ select t.payer_obj_name objName,t.fee_name feeName,pf.end_time feeCreateTime,t.update_time updateTime,
+ pfa.`value` ownerName,br.built_up_area builtUpArea ,SUM(t.amount_owed) oweAmount,max(t.deadline_time)
deadlineTime
from report_owe_fee t
inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
@@ -1560,7 +1597,7 @@
and t.create_time <= #{endTime}
</if>
and t.amount_owed > 0 and pf.end_time < now()
- group by t.fee_name,t.payer_obj_id,t.payer_obj_name,pfa.`value`,br.built_up_area
+ group by t.payer_obj_name ,t.fee_name ,pf.end_time ,t.update_time,pfa.`value` ,br.built_up_area
HAVING oweAmount > 0
order by t.payer_obj_name
<if test="page != -1 and page != null ">
@@ -1633,7 +1670,8 @@
= "fee_type_cd"
left join t_dict d3 on t.state = d3.status_cd and d3.table_name = "pay_fee_detail" and d3.table_columns =
"state"
- where t.status_cd = '0' and pf.status_cd = '0'
+ where t.status_cd = '0' and pf.status_cd = '0'
+ and t.state != '1500'
<if test="roomNum !=null and roomNum != ''">
and br.room_num= #{roomNum}
</if>
@@ -1688,6 +1726,18 @@
<if test="endTime !=null and endTime != ''">
and t.create_time <= #{endTime}
</if>
+ <if test="feeStartTime !=null and feeStartTime != ''">
+ and t.start_time >= #{feeStartTime}
+ </if>
+ <if test="feeEndTime !=null and feeEndTime != ''">
+ and t.end_time <= #{feeEndTime}
+ </if>
+ <if test="cashierId !=null and cashierId != ''">
+ and t.cashier_id= #{cashierId}
+ </if>
+ <if test="cashierName !=null and cashierName != ''">
+ and t.cashier_name= #{cashierName}
+ </if>
) t
</select>
@@ -1700,7 +1750,8 @@
importFeeName,t.prime_rate,d.name primeRate,fdr.discount_small_type discountSmallType,fdr.rule_name
ruleName,pfdd.discount_price discountPrice,co.contract_code contractCode,pfo.`value` ownerName,cb.o_id oId,
d2.name feeTypeCdName,pfc.fee_type_cd feeTypeCd,t.state,d3.name stateName,t.fee_id feeId,pft.`value` repairId,
- t.detail_id,t.detail_id detailId,pf.payer_obj_id,pfb.value ownerId,concat(pa.num,'鍋滆溅鍦�',ps.num,'杞︿綅') psName
+ t.detail_id,t.detail_id detailId,pf.payer_obj_id,pfb.value ownerId,concat(pa.num,'鍋滆溅鍦�',ps.num,'杞︿綅') psName,
+ fad.amount withholdAmount,t.cashier_id cashierId,t.cashier_name cashierName,t.payable_amount payableAmount,pfc.fee_flag feeFlag
from pay_fee_detail t
left JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
left join pay_fee_config pfc on pf.config_id = pfc.config_id and pfc.status_cd = '0'
@@ -1725,7 +1776,11 @@
"state"
LEFT JOIN contract co on pf.payer_obj_id = co.contract_id and co.status_cd = '0' and pf.payer_obj_type='7777'
LEFT JOIN c_business cb on t.b_id = cb.b_id
- where t.status_cd = '0' and pf.status_cd = '0'
+ left join fee_account_detail fad on t.detail_id = fad.detail_id and t.community_id = fad.community_id and
+ fad.status_cd = '0' and fad.state = '1002'
+ where t.status_cd = '0'
+ and pf.status_cd = '0'
+ and t.state != '1500'
<if test="roomNum !=null and roomNum != ''">
and br.room_num= #{roomNum}
</if>
@@ -1779,6 +1834,18 @@
</if>
<if test="endTime !=null and endTime != ''">
and t.create_time <= #{endTime}
+ </if>
+ <if test="feeStartTime !=null and feeStartTime != ''">
+ and t.start_time >= #{feeStartTime}
+ </if>
+ <if test="feeEndTime !=null and feeEndTime != ''">
+ and t.end_time <= #{feeEndTime}
+ </if>
+ <if test="cashierId !=null and cashierId != ''">
+ and t.cashier_id= #{cashierId}
+ </if>
+ <if test="cashierName !=null and cashierName != ''">
+ and t.cashier_name= #{cashierName}
</if>
order by t.create_time desc
<if test="page != -1 and page != null ">
@@ -1916,119 +1983,65 @@
<if test="endTime !=null and endTime != ''">
and t.create_time <= #{endTime}
</if>
- group by fdr.discount_small_type
+ group by pfc.fee_name,f.floor_num,bu.unit_num ,br.room_num ,oc.car_num ,
+ pf.payer_obj_type ,t.start_time ,t.end_time ,t.create_time ,
+ t.receivable_amount ,t.received_amount ,pfa.`value`
+ ,t.prime_rate,d.name ,fdr.discount_small_type ,fdr.rule_name,pfdd.discount_price
order by t.create_time desc
</select>
<select id="queryDeadlineFeeCount" parameterType="Map" resultType="Map">
select count(1) count
- from (
- SELECT
- t.obj_name objName,
- t.fee_name feeName,
- t.deadline_time deadlineTime
- FROM
- report_fee_month_statistics t
- inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
- left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
- left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
- left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
- inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
- where t.status_cd = '0'
- <if test="roomNum !=null and roomNum != ''">
- and br.room_num= #{roomNum}
- </if>
- <if test="unitId !=null and unitId != ''">
- and bu.unit_id= #{unitId}
- </if>
- <if test="floorId !=null and floorId != ''">
- and f.floor_id = #{floorId}
+ from pay_fee_detail_month t
+ inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
+ where 1=1
+ and t.detail_id = '-1'
+ <if test="configId !=null and configId != ''">
+ and t.config_id = #{configId}
</if>
<if test="objName !=null and objName != ''">
- and t.obj_name= #{objName}
+ and t.obj_name like CONCAT('%',#{objName},'%')
</if>
- <if test="objNameNum != null and objNameNum != ''">
- and t.obj_name_num= #{objNameNum}
+ <if test="ownerName !=null and ownerName != ''">
+ and t.owner_name like CONCAT('%',#{ownerName},'%')
</if>
- <if test="feeYear !=null and feeYear != ''">
- and t.fee_year= #{feeYear}
- </if>
- <if test="feeMonth !=null and feeMonth != ''">
- and t.fee_month= #{feeMonth}
- </if>
- <if test="feeId !=null and feeId != ''">
- and t.fee_id= #{feeId}
- </if>
- <if test="configId !=null and configId != ''">
- and t.config_id= #{configId}
- </if>
- <if test="objId !=null and objId != ''">
- and t.obj_id= #{objId}
- </if>
- <if test="feeName !=null and feeName != ''">
- and t.fee_name= #{feeName}
+ <if test="link !=null and link != ''">
+ and t.link = #{link}
</if>
<if test="communityId !=null and communityId != ''">
and t.community_id= #{communityId}
</if>
- <if test="startTime !=null and startTime != ''">
+ <if test="startTime !=null and startTime !=''">
and t.deadline_time >= #{startTime}
</if>
<if test="endTime !=null and endTime != ''">
and t.deadline_time <= #{endTime}
</if>
- ) t
</select>
<!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
<select id="queryDeadlineFee" parameterType="Map" resultType="Map">
- SELECT
+
+ select
t.obj_name objName,
- t.obj_name_num objNameNum,
- t.obj_type objType,
+ pf.payer_obj_type objType,
t.fee_name feeName,
- t.deadline_time deadlineTime,
- t.update_time updateTime
- FROM
- report_fee_month_statistics t
- inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
- left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
- left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
- left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
- inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
- where t.status_cd = '0'
- <if test="roomNum !=null and roomNum != ''">
- and br.room_num= #{roomNum}
- </if>
- <if test="unitId !=null and unitId != ''">
- and bu.unit_id= #{unitId}
- </if>
- <if test="floorId !=null and floorId != ''">
- and f.floor_id = #{floorId}
+ t.deadline_time deadlineTime
+ from pay_fee_detail_month t
+ inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
+ where 1=1
+ and t.detail_id = '-1'
+ <if test="configId !=null and configId != ''">
+ and t.config_id = #{configId}
</if>
<if test="objName !=null and objName != ''">
- and t.obj_name= #{objName}
+ and t.obj_name like CONCAT('%',#{objName},'%')
</if>
- <if test="objNameNum != null and objNameNum != ''">
- and t.obj_name_num= #{objNameNum}
+ <if test="ownerName !=null and ownerName != ''">
+ and t.owner_name like CONCAT('%',#{ownerName},'%')
</if>
- <if test="feeYear !=null and feeYear != ''">
- and t.fee_year= #{feeYear}
- </if>
- <if test="feeMonth !=null and feeMonth != ''">
- and t.fee_month= #{feeMonth}
- </if>
- <if test="feeId !=null and feeId != ''">
- and t.fee_id= #{feeId}
- </if>
- <if test="configId !=null and configId != ''">
- and t.config_id= #{configId}
- </if>
- <if test="objId !=null and objId != ''">
- and t.obj_id= #{objId}
- </if>
- <if test="feeName !=null and feeName != ''">
- and t.fee_name= #{feeName}
+ <if test="link !=null and link != ''">
+ and t.link = #{link}
</if>
<if test="communityId !=null and communityId != ''">
and t.community_id= #{communityId}
@@ -2048,24 +2061,34 @@
<select id="queryPrePaymentNewCount" parameterType="Map" resultType="Map">
select count(1) count
from (
- select pfc.fee_name feeName, f.floor_num floorNum,bu.unit_num unitNum,br.room_num roomNum,t.end_time endTime
- ,oc.car_num carNum
+ select pfc.fee_name feeName,pfa.`value` objName,pfa1.`value` link,pfa2.`value` ownerName, t.end_time endTime ,
+ t.payer_obj_type payerObjType
from pay_fee t
inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
- left join building_room br on t.payer_obj_id = br.room_id and t.payer_obj_type = '3333' and br.status_cd = '0'
- left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
- left join f_floor f on f.floor_id = bu.floor_id and f.status_cd = '0'
- left join owner_car oc on t.payer_obj_id = oc.car_id and t.payer_obj_type = '6666' and oc.status_cd = '0' and
- oc.car_type_cd='1001'
+ LEFT JOIN pay_fee_attrs pfa on t.fee_id = pfa.fee_id and pfa.spec_cd = '390012' and pfa.status_cd = '0'
+ LEFT JOIN pay_fee_attrs pfa1 on t.fee_id = pfa1.fee_id and pfa1.spec_cd = '390009' and pfa1.status_cd = '0'
+ LEFT JOIN pay_fee_attrs pfa2 on t.fee_id = pfa2.fee_id and pfa2.spec_cd = '390008' and pfa2.status_cd = '0'
where t.state = '2008001'
and t.status_cd = '0'
+ <if test="ownerName != null and ownerName != ''">
+ and pfa2.value like concat('%' #{ownerName} ,'%')
+ </if>
+ <if test="objName != null and objName != ''">
+ and pfa.`value` like concat('%',#{objName},'%')
+ </if>
+ <if test="link != null and link != ''">
+ and pfa1.`value` = #{link}
+ </if>
+ <if test="configId !=null and configId != ''">
+ and t.config_id = #{configId}
+ </if>
<if test="communityId !=null and communityId != ''">
and t.community_id= #{communityId}
</if>
<if test="startTime !=null and startTime != ''">
and t.end_time >= #{startTime}
</if>
- <if test="endTime !=null and endTime != ''">
+ <if test="endTime !=null and endTime != ''">
and t.end_time <= #{endTime}
</if>
) t
@@ -2073,17 +2096,27 @@
<!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
<select id="queryPrePayment" parameterType="Map" resultType="Map">
- select pfc.fee_name feeName, f.floor_num floorNum,bu.unit_num unitNum,br.room_num roomNum,t.end_time endTime ,
- oc.car_num carNum,t.payer_obj_type payerObjType
+ select pfc.fee_name feeName,pfa.`value` objName,pfa1.`value` link,pfa2.`value` ownerName, t.end_time endTime ,
+ t.payer_obj_type payerObjType
from pay_fee t
inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
- left join building_room br on t.payer_obj_id = br.room_id and t.payer_obj_type = '3333' and br.status_cd = '0'
- left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
- left join f_floor f on f.floor_id = bu.floor_id and f.status_cd = '0'
- left join owner_car oc on t.payer_obj_id = oc.car_id and t.payer_obj_type = '6666' and oc.status_cd = '0' and
- oc.car_type_cd='1001'
+ LEFT JOIN pay_fee_attrs pfa on t.fee_id = pfa.fee_id and pfa.spec_cd = '390012' and pfa.status_cd = '0'
+ LEFT JOIN pay_fee_attrs pfa1 on t.fee_id = pfa1.fee_id and pfa1.spec_cd = '390009' and pfa1.status_cd = '0'
+ LEFT JOIN pay_fee_attrs pfa2 on t.fee_id = pfa2.fee_id and pfa2.spec_cd = '390008' and pfa2.status_cd = '0'
where t.state = '2008001'
and t.status_cd = '0'
+ <if test="ownerName != null and ownerName != ''">
+ and pfa2.value like concat('%' #{ownerName} ,'%')
+ </if>
+ <if test="objName != null and objName != ''">
+ and pfa.`value` like concat('%',#{objName},'%')
+ </if>
+ <if test="link != null and link != ''">
+ and pfa1.`value` = #{link}
+ </if>
+ <if test="configId !=null and configId != ''">
+ and t.config_id = #{configId}
+ </if>
<if test="communityId !=null and communityId != ''">
and t.community_id= #{communityId}
</if>
@@ -2101,12 +2134,12 @@
<select id="queryPrePaymentCount" parameterType="Map" resultType="Map">
select pfc.fee_name feeName, count(t.payer_obj_id) objCount
from pay_fee t
- inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
+ inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
where t.state = '2008001'
- and t.status_cd = '0'
- and t.end_time > #{startTime}
- and t.end_time < #{endTime}
- and t.community_id = #{communityId}
+ and t.status_cd = '0'
+ and t.end_time > #{startTime}
+ and t.end_time < #{endTime}
+ and t.community_id = #{communityId}
group by pfc.fee_name, pfc.config_id
order by objCount
</select>
@@ -2114,13 +2147,13 @@
<select id="queryDeadlinePaymentCount" parameterType="Map" resultType="Map">
SELECT t.fee_name feeName, count(t.obj_id) objCount
FROM report_fee_month_statistics t
- inner join pay_fee pf on t.fee_id = pf.fee_id
- and pf.community_id = t.community_id and pf.status_cd = '0'
+ inner join pay_fee pf on t.fee_id = pf.fee_id
+ and pf.community_id = t.community_id and pf.status_cd = '0'
WHERE 1 = 1
- AND t.status_cd = '0'
- and t.community_id = #{communityId}
- AND t.deadline_time > #{startTime}
- AND t.deadline_time < #{endTime}
+ AND t.status_cd = '0'
+ and t.community_id = #{communityId}
+ AND t.deadline_time > #{startTime}
+ AND t.deadline_time < #{endTime}
group by t.config_id, t.fee_name
order by objCount desc
</select>
@@ -2128,10 +2161,10 @@
<select id="queryOwePaymentCount" parameterType="Map" resultType="Map">
select t.fee_name feeName, count(distinct t.obj_id) objCount
from report_fee_month_statistics t
- inner join pay_fee pf
- on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
+ inner join pay_fee pf
+ on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
where t.community_id = #{communityId}
- and t.owe_amount > 0
+ and t.owe_amount > 0
group by t.config_id, t.fee_name
order by objCount desc
</select>
@@ -2139,26 +2172,26 @@
<select id="queryAllPaymentCount" parameterType="Map" resultType="Map">
select t.fee_name feeName, count(distinct t.obj_id) objCount
from report_fee_month_statistics t
- inner join pay_fee pf
- on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
+ inner join pay_fee pf
+ on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
where t.community_id = #{communityId}
group by t.config_id, t.fee_name
order by objCount desc
</select>
<select id="queryFinishOweFee" parameterType="Map" resultType="Map">
- select t.config_id configId,
- t.fee_id feeId,
- t.statistics_id statisticsId,
- t.fee_year feeYear,
- fee_month feeMonth
+ select t.config_id configId,
+ t.fee_id feeId,
+ t.statistics_id statisticsId,
+ t.fee_year feeYear,
+ fee_month feeMonth
from report_fee_month_statistics t
- inner join pay_fee pf
- on t.fee_id = pf.fee_id and pf.state = '2009001' and pf.community_id = #{communityId} and
- pf.status_cd = '0'
+ inner join pay_fee pf
+ on t.fee_id = pf.fee_id and pf.state = '2009001' and pf.community_id = #{communityId} and
+ pf.status_cd = '0'
where t.owe_amount > 0
- and t.status_cd = '0'
- and t.community_id = #{communityId} limit 100
+ and t.status_cd = '0'
+ and t.community_id = #{communityId} limit 100
</select>
<!-- 鏌ヨ璐圭敤閰嶇疆淇℃伅 add by wuxw 2018-07-03 -->
@@ -2437,16 +2470,16 @@
<select id="queryNoFeeRoomsCount" parameterType="Map" resultType="Map">
select count(1) count
from building_room t
- inner join building_unit bu
+ inner join building_unit bu
on t.unit_id = bu.unit_id and bu.status_cd = '0'
- inner join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
+ inner join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
where t.status_cd = '0'
- and not exists (
- select 1 from pay_fee pf where t.room_id = pf.payer_obj_id
- and pf.status_cd = '0'
- and pf.state = '2008001'
- )
- and t.community_id = #{communityId}
+ and not exists (
+ select 1 from pay_fee pf where t.room_id = pf.payer_obj_id
+ and pf.status_cd = '0'
+ and pf.state = '2008001'
+ )
+ and t.community_id = #{communityId}
</select>
<!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
@@ -2728,125 +2761,207 @@
<select id="queryHuaningOweFeeCount" parameterType="Map" resultType="Map">
select count(1) count
- from (
- select a.floorNum,a.oweAmount,b.curOweAmount
- from
- (select t.floor_num floorNum,SUM(rfms.owe_amount) oweAmount
- from f_floor t
- left join building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
- left join building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
- LEFT JOIN report_fee_month_statistics rfms on rfms.obj_id = br.room_id and rfms.obj_type = '3333' and
- rfms.status_cd = '0'
- where t.status_cd = '0'
- <if test="communityId !=null and communityId != ''">
- and t.community_id= #{communityId}
- </if>
- <if test="roomNum !=null and roomNum != ''">
- and br.room_num= #{roomNum}
- </if>
- <if test="objName !=null and objName != ''">
- and rfms.obj_name= #{objName}
- </if>
- <if test="feeYear !=null and feeYear != ''">
- and t.fee_year= #{feeYear}
- </if>
- <if test="feeMonth !=null and feeMonth != ''">
- and t.fee_month= #{feeMonth}
- </if>
- GROUP BY t.floor_num
- ) a,
- (select t.floor_num floorNum,SUM(curT.owe_amount) curOweAmount
- from f_floor t
- left join building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
- left join building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
- inner join report_fee_month_statistics curT on curT.obj_id = br.room_id and curT.obj_type = '3333' and
- curT.status_cd = '0' and curT.community_id = t.community_id
- where t.status_cd = '0'
- <if test="communityId !=null and communityId != ''">
- and t.community_id= #{communityId}
- </if>
- <if test="roomNum !=null and roomNum != ''">
- and br.room_num= #{roomNum}
- </if>
- <if test="feeYear !=null and feeYear != ''">
- and curT.fee_year= #{feeYear}
- </if>
- GROUP BY t.floor_num
- ) b
- where a.floorNum = b.floorNum
- <if test="floorId !=null and floorId != ''">
- and a.floor_id = #{floorId}
- </if>
- ) t
+ from f_floor f
+ where 1=1
+ and f.community_id = #{communityId}
+ and f.status_cd = '0'
+
</select>
<!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
<select id="queryHuaningOweFee" parameterType="Map" resultType="Map">
- select a.floorNum,a.oweAmount,b.curOweAmount
- from
- (select t.floor_num floorNum,SUM(rfms.owe_amount) oweAmount
- from f_floor t
- left join building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
- left join building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
- LEFT JOIN report_fee_month_statistics rfms on rfms.obj_id = br.room_id and rfms.obj_type = '3333' and
- rfms.status_cd = '0'
- where t.status_cd = '0'
- <if test="communityId !=null and communityId != ''">
- and t.community_id= #{communityId}
+ select
+ f.floor_num floorNum,
+ (
+ select ifnull(SUM(t.receivable_amount),0)
+ from pay_fee_detail_month t
+ inner join building_room br on t.obj_id = br.room_id and br.status_cd = '0'
+ inner join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
+ inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
+ where
+ 1=1
+ and bu.floor_id = f.floor_id
+ and t.community_id = f.community_id
+ <if test="feeTypeCd != null and feeTypeCd != ''">
+ and pf.fee_type_cd = #{feeTypeCd}
</if>
- <if test="roomNum !=null and roomNum != ''">
- and br.room_num= #{roomNum}
+ and t.detail_id = '-1'
+ and t.cur_month_time <= #{endTime}
+ ) oweAmount,
+ (
+ select ifnull(SUM(t.receivable_amount),0)
+ from pay_fee_detail_month t
+ inner join building_room br on t.obj_id = br.room_id and br.status_cd = '0'
+ inner join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
+ inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
+ where
+ 1=1
+ and bu.floor_id = f.floor_id
+ and t.community_id = f.community_id
+ <if test="feeTypeCd != null and feeTypeCd != ''">
+ and pf.fee_type_cd = #{feeTypeCd}
</if>
- <if test="objName !=null and objName != ''">
- and rfms.obj_name= #{objName}
+ and t.detail_id = '-1'
+ and t.cur_month_time <= #{endTime}
+ and t.cur_month_time >= #{startTime}
+ ) curOweAmount,
+ (
+ select ifnull(SUM(t.receivable_amount),0)
+ from pay_fee_detail_month t
+ inner join building_room br on t.obj_id = br.room_id and br.status_cd = '0'
+ inner join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
+ inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
+ where
+ 1=1
+ and bu.floor_id = f.floor_id
+ and t.community_id = f.community_id
+ <if test="feeTypeCd != null and feeTypeCd != ''">
+ and pf.fee_type_cd = #{feeTypeCd}
</if>
- GROUP BY t.floor_num
- ) a,
- (select t.floor_num floorNum,SUM(curT.owe_amount) curOweAmount
- from f_floor t
- left join building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
- left join building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
- inner join report_fee_month_statistics curT on curT.obj_id = br.room_id and curT.obj_type = '3333' and
- curT.status_cd = '0' and curT.community_id = t.community_id
- where t.status_cd = '0'
- <if test="communityId !=null and communityId != ''">
- and t.community_id= #{communityId}
- </if>
- <if test="roomNum !=null and roomNum != ''">
- and br.room_num= #{roomNum}
- </if>
- <if test="feeYear !=null and feeYear != ''">
- and curT.fee_year= #{feeYear}
- </if>
- GROUP BY t.floor_num
- ) b
- where a.floorNum = b.floorNum
- <if test="floorId !=null and floorId != ''">
- and a.floor_id = #{floorId}
- </if>
- <if test="page != -1 and page != null ">
- limit #{page}, #{row}
- </if>
+ and t.detail_id = '-1'
+ and t.cur_month_time < #{startTime}
+ ) preOweAmount
+ from f_floor f
+ where 1=1
+ and f.community_id = #{communityId}
+ and f.status_cd = '0'
</select>
<select id="queryHuaningPayFeeCount" parameterType="Map" resultType="Map">
select count(1) count
from (
- select t.floor_num
- from f_floor t
- where 1=1
- and t.community_id= #{communityId}
- GROUP BY t.floor_num
- ) tt
+ select t.floor_num
+ from f_floor t
+ where 1=1
+ and t.community_id= #{communityId}
+ GROUP BY t.floor_num
+ ) tt
</select>
<!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
<select id="queryHuaningPayFee" parameterType="Map" resultType="Map">
+
select
- a.floorNum,f.receivableAmount,a.receivedAmount,b.receivedAmount1,c.receivedAmount2,d.receivedAmount3,e.receivedAmount4
+ f.floor_num floorNum,
+ (
+ select ifnull(SUM(t.receivable_amount),0)
+ from pay_fee_detail_month t
+ inner join building_room br on t.obj_id = br.room_id and br.status_cd = '0'
+ inner join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
+ inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
+ where
+ 1=1
+ <if test="feeTypeCd != null and feeTypeCd != ''">
+ and pf.fee_type_cd = #{feeTypeCd}
+ </if>
+ and bu.floor_id = f.floor_id
+ and t.community_id = f.community_id
+ and t.cur_month_time = #{endTime}
+ ) receivableAmount,
+ (
+ select ifnull(SUM(t.received_amount),0)
+ from pay_fee_detail_month t
+ inner join building_room br on t.obj_id = br.room_id and br.status_cd = '0'
+ inner join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
+ inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
+ where
+ 1=1
+ <if test="feeTypeCd != null and feeTypeCd != ''">
+ and pf.fee_type_cd = #{feeTypeCd}
+ </if>
+ and bu.floor_id = f.floor_id
+ and t.community_id = f.community_id
+ and t.pay_fee_time >= #{endTime}
+ and t.pay_fee_time < #{nextMonthTime}
+ and t.detail_id != '-1'
+ ) receivedAmount,
+ (
+ select ifnull(SUM(t.received_amount),0)
+ from pay_fee_detail_month t
+ inner join building_room br on t.obj_id = br.room_id and br.status_cd = '0'
+ inner join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
+ inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
+ where
+ 1=1
+ <if test="feeTypeCd != null and feeTypeCd != ''">
+ and pf.fee_type_cd = #{feeTypeCd}
+ </if>
+ and bu.floor_id = f.floor_id
+ and t.community_id = f.community_id
+ and t.pay_fee_time >= #{endTime}
+ and t.pay_fee_time < #{nextMonthTime}
+ and t.cur_month_time < #{endTime}
+ and t.cur_month_time >= #{startTime}
+ and t.detail_id != '-1'
+ ) receivedAmount1,
+ (
+ select ifnull(SUM(t.received_amount),0)
+ from pay_fee_detail_month t
+ inner join building_room br on t.obj_id = br.room_id and br.status_cd = '0'
+ inner join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
+ inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
+ where
+ 1=1
+ <if test="feeTypeCd != null and feeTypeCd != ''">
+ and pf.fee_type_cd = #{feeTypeCd}
+ </if>
+ and bu.floor_id = f.floor_id
+ and t.community_id = f.community_id
+ and t.pay_fee_time >= #{endTime}
+ and t.pay_fee_time < #{nextMonthTime}
+ and t.cur_month_time = #{endTime}
+ and t.detail_id != '-1'
+ ) receivedAmount2,
+ (
+ select ifnull(SUM(t.received_amount),0)
+ from pay_fee_detail_month t
+ inner join building_room br on t.obj_id = br.room_id and br.status_cd = '0'
+ inner join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
+ inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
+ where
+ 1=1
+ <if test="feeTypeCd != null and feeTypeCd != ''">
+ and pf.fee_type_cd = #{feeTypeCd}
+ </if>
+ and bu.floor_id = f.floor_id
+ and t.community_id = f.community_id
+ and t.pay_fee_time >= #{endTime}
+ and t.pay_fee_time < #{nextMonthTime}
+ and t.cur_month_time >= #{nextMonthTime}
+ and t.detail_id != '-1'
+ ) receivedAmount3,
+ (
+ select ifnull(SUM(t.received_amount),0)
+ from pay_fee_detail_month t
+ inner join building_room br on t.obj_id = br.room_id and br.status_cd = '0'
+ inner join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
+ inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
+ where
+ 1=1
+ <if test="feeTypeCd != null and feeTypeCd != ''">
+ and pf.fee_type_cd = #{feeTypeCd}
+ </if>
+ and bu.floor_id = f.floor_id
+ and t.community_id = f.community_id
+ and t.pay_fee_time >= #{endTime}
+ and t.pay_fee_time < #{nextMonthTime}
+ and t.cur_month_time < #{startTime}
+ and t.detail_id != '-1'
+ ) receivedAmount4
+ from f_floor f
+ where 1=1
+ and f.community_id = #{communityId}
+ and f.status_cd = '0'
+ </select>
+ <select id="queryHuaningPayFeeTwoCount" parameterType="Map" resultType="Map">
+ select count(1) count
+ from (
+ select a.floorNum, d.receivableAmount,
+ a.receivedAmount, b.receivedAmount1,
+ c.receivedAmount2
from
- (select t.floor_num floorNum,sum(pfd.received_amount) receivedAmount
+ (select t.floor_num floorNum, sum (pfd.received_amount) receivedAmount
from f_floor t
inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
@@ -2854,11 +2969,11 @@
inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
where 1=1
and t.status_cd = '0'
- and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth}
+ and DATE_FORMAT(pfd.create_time, '%Y-%m') = #{yearMonth}
and t.community_id= #{communityId}
GROUP BY floor_num
) a,
- (select t.floor_num floorNum,sum(pfdm1.received_amount ) receivedAmount1
+ (select t.floor_num floorNum, SUM (pfdm1.discount_amount) receivedAmount1
from f_floor t
inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
@@ -2868,130 +2983,36 @@
pfdm1.status_cd = '0' and pfdm1.detail_year = #{year} and pfdm1.detail_month < #{month}
where 1=1
and t.status_cd = '0'
- and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth}
+ and DATE_FORMAT(pfd.create_time, '%Y-%m') = #{yearMonth}
and t.community_id= #{communityId}
GROUP BY floor_num
) b,
- (select t.floor_num floorNum,sum(pfdm2.received_amount ) receivedAmount2
+ (select t.floor_num floorNum, SUM (pfdm2.received_amount) receivedAmount2
from f_floor t
inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
LEFT JOIN pay_fee_detail_month pfdm2 on pf.fee_id = pfdm2.fee_id and pfd.detail_id = pfdm2.detail_id and
- pfdm2.status_cd = '0' and pfdm2.detail_year = #{year} and pfdm2.detail_month = #{month}
+ pfdm2.status_cd = '0' and pfdm2.detail_year = #{year} and pfdm2.detail_month > #{month}
where 1=1
and t.status_cd = '0'
- and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth}
+ and DATE_FORMAT(pfd.create_time, '%Y-%m') = #{yearMonth}
and t.community_id= #{communityId}
GROUP BY floor_num
) c,
- (select t.floor_num floorNum,sum(pfdm3.received_amount ) receivedAmount3
- from f_floor t
- inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
- inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
- inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
- inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
- LEFT JOIN pay_fee_detail_month pfdm3 on pf.fee_id = pfdm3.fee_id and pfd.detail_id = pfdm3.detail_id and
- pfdm3.status_cd = '0' and pfdm3.detail_year = #{nextYear} and pfdm3.detail_month = #{nextMonth}
- where 1=1
- and t.status_cd = '0'
- and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth}
- and t.community_id= #{communityId}
- GROUP BY floor_num
- ) d,
- (select t.floor_num floorNum,sum(pfdm4.received_amount ) receivedAmount4
- from f_floor t
- inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
- inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
- inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
- inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
- LEFT JOIN pay_fee_detail_month pfdm4 on pf.fee_id = pfdm4.fee_id and pfd.detail_id = pfdm4.detail_id and
- pfdm4.status_cd = '0' and pfdm4.detail_year < #{year}
- where 1=1
- and t.status_cd = '0'
- and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth}
- and t.community_id= #{communityId}
- GROUP BY floor_num
- ) e,
- (select t.floor_num floorNum,SUM(rfms.receivable_amount) receivableAmount
+ (select t.floor_num floorNum, SUM (rfms.owe_amount) receivableAmount
from f_floor t
inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
inner JOIN report_fee_month_statistics rfms on rfms.obj_id = br.room_id and rfms.status_cd = '0'
- where t.community_id = #{communityId}
- and rfms.fee_year = #{year}
- and rfms.fee_month = #{month}
+ where t.community_id= #{communityId}
group by t.floor_num
- ) f
+ ) d
where a.floorNum = b.floorNum
and b.floorNum = c.floorNum
and c.floorNum = d.floorNum
- and d.floorNum = e.floorNum
- and e.floorNum = f.floorNum
- <if test="page != -1 and page != null ">
- limit #{page}, #{row}
- </if>
- </select>
- <select id="queryHuaningPayFeeTwoCount" parameterType="Map" resultType="Map">
- select count(1) count
- from (
- select a.floorNum, d.receivableAmount,
- a.receivedAmount, b.receivedAmount1,
- c.receivedAmount2
- from
- (select t.floor_num floorNum, sum (pfd.received_amount) receivedAmount
- from f_floor t
- inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
- inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
- inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
- inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
- where 1=1
- and t.status_cd = '0'
- and DATE_FORMAT(pfd.create_time, '%Y-%m') = #{yearMonth}
- and t.community_id= #{communityId}
- GROUP BY floor_num
- ) a,
- (select t.floor_num floorNum, SUM (pfdm1.discount_amount) receivedAmount1
- from f_floor t
- inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
- inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
- inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
- inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
- LEFT JOIN pay_fee_detail_month pfdm1 on pf.fee_id = pfdm1.fee_id and pfd.detail_id = pfdm1.detail_id and
- pfdm1.status_cd = '0' and pfdm1.detail_year = #{year} and pfdm1.detail_month < #{month}
- where 1=1
- and t.status_cd = '0'
- and DATE_FORMAT(pfd.create_time, '%Y-%m') = #{yearMonth}
- and t.community_id= #{communityId}
- GROUP BY floor_num
- ) b,
- (select t.floor_num floorNum, SUM (pfdm2.received_amount) receivedAmount2
- from f_floor t
- inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
- inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
- inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
- inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
- LEFT JOIN pay_fee_detail_month pfdm2 on pf.fee_id = pfdm2.fee_id and pfd.detail_id = pfdm2.detail_id and
- pfdm2.status_cd = '0' and pfdm2.detail_year = #{year} and pfdm2.detail_month > #{month}
- where 1=1
- and t.status_cd = '0'
- and DATE_FORMAT(pfd.create_time, '%Y-%m') = #{yearMonth}
- and t.community_id= #{communityId}
- GROUP BY floor_num
- ) c,
- (select t.floor_num floorNum, SUM (rfms.owe_amount) receivableAmount
- from f_floor t
- inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
- inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
- inner JOIN report_fee_month_statistics rfms on rfms.obj_id = br.room_id and rfms.status_cd = '0'
- where t.community_id= #{communityId}
- group by t.floor_num
- ) d
- where a.floorNum = b.floorNum
- and b.floorNum = c.floorNum
- and c.floorNum = d.floorNum
- ) tt
+ ) tt
</select>
<!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
@@ -3056,32 +3077,79 @@
</if>
</select>
<select id="queryHuaningOweFeeDetailCount" parameterType="Map" resultType="Map">
- select count(1) count
- from (
- select t.payer_obj_name payerObjName,br.built_up_area builtUpArea,pfc.square_price squarePrice, t.fee_id
- feeId,t.end_time startTime,t.deadline_time endTime,t.amount_owed oweAmount
- from report_owe_fee t
- left join building_room br on t.payer_obj_id = br.room_id and br.status_cd = '0'
- left join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
- where t.amount_owed > 0
- and pfc.fee_type_cd = '888800010001'
- <if test="communityId !=null and communityId != ''">
- and t.community_id= #{communityId}
+ select
+ count(1) count
+ from building_room br
+ inner join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
+ inner join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
+ inner join report_owe_fee rof on br.room_id = rof.payer_obj_id
+ inner join pay_fee pf on rof.fee_id = pf.fee_id and pf.status_cd = '0'
+ where 1=1
+ and br.community_id = #{communityId}
+ and br.status_cd = '0'
+ and rof.amount_owed > 0
+ <if test="feeTypeCd != null and feeTypeCd != ''">
+ and pf.fee_type_cd = #{feeTypeCd}
</if>
- ) tt
+ <if test="floorId != null and floorId != ''">
+ and f.floor_id = #{floorId}
+ </if>
+
</select>
<!-- 鏌ヨ璐圭敤鏈堢粺璁′俊鎭� add by wuxw 2018-07-03 -->
<select id="queryHuaningOweFeeDetail" parameterType="Map" resultType="Map">
- select t.payer_obj_name payerObjName,br.built_up_area builtUpArea,pfc.square_price squarePrice, t.fee_id
- feeId,t.end_time startTime,t.deadline_time endTime,t.amount_owed oweAmount
- from report_owe_fee t
- left join building_room br on t.payer_obj_id = br.room_id and br.status_cd = '0'
- left join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
- where t.amount_owed > 0
- and pfc.fee_type_cd = '888800010001'
- <if test="communityId !=null and communityId != ''">
- and t.community_id= #{communityId}
+ select
+ concat(f.floor_num,'-',bu.unit_num,'-',br.room_num) roomName,
+ br.built_up_area builtUpArea,
+ rof.fee_name feeName,
+ rof.end_time endTime,
+ rof.deadline_time deadlineTime,
+ (
+ select ifnull(SUM(t.receivable_amount),0)
+ from pay_fee_detail_month t
+ where
+ 1=1
+ and t.fee_id = rof.fee_id
+ and t.community_id = f.community_id
+ and t.detail_id = '-1'
+ and t.cur_month_time <= #{startTime}
+ ) oweAmount,
+ (
+ select ifnull(SUM(t.receivable_amount),0)
+ from pay_fee_detail_month t
+ where
+ 1=1
+ and t.fee_id = rof.fee_id
+ and t.community_id = f.community_id
+ and t.detail_id = '-1'
+ and t.cur_month_time <= #{startTime}
+ and t.cur_month_time >= #{endTime}
+ ) curOweAmount,
+ (
+ select ifnull(SUM(t.receivable_amount),0)
+ from pay_fee_detail_month t
+ where
+ 1=1
+ and t.fee_id = rof.fee_id
+ and t.community_id = f.community_id
+ and t.detail_id = '-1'
+ and t.cur_month_time <= #{startTime}
+ ) preOweAmount
+ from building_room br
+ inner join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
+ inner join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
+ inner join report_owe_fee rof on br.room_id = rof.payer_obj_id
+ inner join pay_fee pf on rof.fee_id = pf.fee_id and pf.status_cd = '0'
+ where 1=1
+ and br.community_id = #{communityId}
+ and br.status_cd = '0'
+ and rof.amount_owed > 0
+ <if test="feeTypeCd != null and feeTypeCd != ''">
+ and pf.fee_type_cd = #{feeTypeCd}
+ </if>
+ <if test="floorId != null and floorId != ''">
+ and f.floor_id = #{floorId}
</if>
<if test="page != -1 and page != null ">
limit #{page}, #{row}
@@ -3128,10 +3196,10 @@
<select id="queryInvalidFeeMonthStatistics" parameterType="Map" resultType="Map">
select t.fee_id feeId
from pay_fee t
- inner join pay_fee_config pfc on t.config_id = pfc.config_id
- inner join report_fee_month_statistics rfms on t.fee_id = rfms.fee_id and rfms.status_cd = '0'
+ inner join pay_fee_config pfc on t.config_id = pfc.config_id
+ inner join report_fee_month_statistics rfms on t.fee_id = rfms.fee_id and rfms.status_cd = '0'
where (t.status_cd = '1' or pfc.status_cd = '1')
- and t.community_id = #{communityId}
+ and t.community_id = #{communityId}
</select>
<!--娓呯悊鎶ヨ〃 鏃犳晥鏁版嵁-->
--
Gitblit v1.8.0