|
@@ -66,6 +66,7 @@
|
|
|
AND psd.site_id = #{siteId} AND psd.customer_id = #{ customerId}
|
|
|
WHERE
|
|
|
ppt.canceledrecord_id IS NULL AND ( ppt.iscanceled = 0 OR ppt.iscanceled IS NULL )
|
|
|
+ and ppt.payway !=5
|
|
|
<if test="customerId != null">and ppt.customer_id = #{customerId}</if>
|
|
|
<if test="siteId != null"> and ppt.site_id = #{siteId}</if>
|
|
|
<if test ="officeId != null"> and ppt.office_id = #{officeId}</if>
|
|
@@ -200,24 +201,36 @@
|
|
|
ORDER BY accountnumber asc
|
|
|
</select>
|
|
|
<select id="getTranInfoReport" resultType="com.bz.smart_city.dto.pay.PayWaterPropertyReportDto">
|
|
|
- SELECT
|
|
|
- p.id as "waterpropertyId",
|
|
|
- p.name as "waterpropertyName",
|
|
|
- ifnull(count(distinct a.payseriesno),0) "frequency",
|
|
|
- ifnull(round(sum(a.transamount),3),'0.000') as "receivedamount",
|
|
|
- ifnull(FLOOR(sum(a.transamount)/p.totalprice_l1),0) as "amount",
|
|
|
- round(ifnull((FLOOR(sum(a.transamount)/p.totalprice_l1))*(max(tab.p1 )),0 ),3)as "sfee",
|
|
|
- round(ifnull((FLOOR(sum(a.transamount)/p.totalprice_l1))*(max(tab.p4 )),0 ),3) as "wsfee",
|
|
|
- '0.000' as "ysfee",
|
|
|
- '0.000' as "fjfee"
|
|
|
- FROM
|
|
|
- pay_pay_transactiondetails a
|
|
|
- left join pay_pay_received r on a.received_id = r.id
|
|
|
- left join pay_base_customerandmeterrela c on c.account_id = a.account_id
|
|
|
- left join pay_base_waterproperty p on p.id = c.waterproperty_id
|
|
|
- left join pay_base_watercategory w on w.id = p.category_id
|
|
|
- left join
|
|
|
+ select
|
|
|
+ tab.waterpropertyName,
|
|
|
+ tab.waterpropertyId,
|
|
|
+ sum(tab.frequency) "frequency",
|
|
|
+ sum(tab.receivedamount) "receivedamount",
|
|
|
+ sum(tab.amount) "amount",
|
|
|
+ sum(tab.sfee) "sfee",
|
|
|
+ sum(tab.wsfee) "wsfee",
|
|
|
+ '0.000' as "ysfee",
|
|
|
+ '0.000' as "fjfee"
|
|
|
+ from
|
|
|
(
|
|
|
+ SELECT
|
|
|
+ p.id as "waterpropertyId",
|
|
|
+ p.name as "waterpropertyName",
|
|
|
+ ifnull(count(distinct a.payseriesno),0) "frequency",
|
|
|
+ ifnull(round(sum(a.transamount),3),'0.000') as "receivedamount",
|
|
|
+ ifnull(FLOOR(sum(a.transamount)/p.totalprice_l1),0) as "amount",
|
|
|
+ round(ifnull((FLOOR(sum(a.transamount)/p.totalprice_l1))*(max(tab.p1 )),0 ),3)as "sfee",
|
|
|
+ round(ifnull((FLOOR(sum(a.transamount)/p.totalprice_l1))*(max(tab.p4 )),0 ),3) as "wsfee",
|
|
|
+ '0.000' as "ysfee",
|
|
|
+ '0.000' as "fjfee"
|
|
|
+ FROM
|
|
|
+ pay_pay_transactiondetails a
|
|
|
+ left join pay_pay_received r on a.received_id = r.id
|
|
|
+ left join pay_base_customerandmeterrela c on c.account_id = a.account_id
|
|
|
+ left join pay_base_waterproperty p on p.id = c.waterproperty_id
|
|
|
+ left join pay_base_watercategory w on w.id = p.category_id
|
|
|
+ left join
|
|
|
+ (
|
|
|
select
|
|
|
w.id,
|
|
|
max(case when e.feetype = 1 then e.price end) as "p1",
|
|
@@ -227,37 +240,93 @@
|
|
|
left join pay_base_waterprice e on e.id = p.waterprice_id
|
|
|
where e.ladderlevel = '1'
|
|
|
GROUP BY w.id
|
|
|
- )tab on tab.id = p.id
|
|
|
- left join sc_organization o on o.id = c.office_id
|
|
|
- left join sc_user u on u.id = a.create_by
|
|
|
- <where>
|
|
|
- a.payway != 5
|
|
|
- AND a.state = 1
|
|
|
- AND a.canceledrecord_id IS NULL
|
|
|
- and (a.iscanceled = 0 or a.iscanceled is null)
|
|
|
- <if test="inParams.customerId != null and inParams.customerId != ''">
|
|
|
- AND a.customer_id =#{inParams.customerId}
|
|
|
- </if>
|
|
|
- <if test="inParams.siteId != null and inParams.siteId != ''">
|
|
|
- AND a.site_id =#{inParams.siteId}
|
|
|
- </if>
|
|
|
- <if test="inParams.startDate != null and inParams.startDate != null">
|
|
|
- AND DATE_FORMAT(a.transtime,'%Y-%m-%d') >=#{inParams.startDate}
|
|
|
- </if>
|
|
|
- <if test="inParams.endDate != null and inParams.endDate != null">
|
|
|
- AND DATE_FORMAT(a.transtime,'%Y-%m-%d') <=#{inParams.endDate}
|
|
|
- </if>
|
|
|
- <if test="inParams.officeId != null and inParams.officeId != ''">
|
|
|
- and o.id =#{inParams.officeId}
|
|
|
- </if>
|
|
|
- <if test="inParams.userId != null and inParams.userId != ''">
|
|
|
- and u.id =#{inParams.userId}
|
|
|
- </if>
|
|
|
- <if test="inParams.watercategoryId != null and inParams.watercategoryId != ''">
|
|
|
- and w.id =#{inParams.watercategoryId}
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- GROUP BY c.waterproperty_id
|
|
|
+ )tab on tab.id = p.id
|
|
|
+ left join sc_organization o on o.id = c.office_id
|
|
|
+ left join sc_user u on u.id = a.create_by
|
|
|
+ <where>
|
|
|
+ a.payway != 5
|
|
|
+ AND a.state = 1
|
|
|
+ AND a.canceledrecord_id IS NULL
|
|
|
+ and (a.iscanceled = 0 or a.iscanceled is null)
|
|
|
+ <if test="inParams.customerId != null and inParams.customerId != ''">
|
|
|
+ AND a.customer_id =#{inParams.customerId}
|
|
|
+ </if>
|
|
|
+ <if test="inParams.siteId != null and inParams.siteId != ''">
|
|
|
+ AND a.site_id =#{inParams.siteId}
|
|
|
+ </if>
|
|
|
+ <if test="inParams.startDate != null and inParams.startDate != null">
|
|
|
+ AND DATE_FORMAT(a.transtime,'%Y-%m-%d') >=#{inParams.startDate}
|
|
|
+ </if>
|
|
|
+ <if test="inParams.endDate != null and inParams.endDate != null">
|
|
|
+ AND DATE_FORMAT(a.transtime,'%Y-%m-%d') <=#{inParams.endDate}
|
|
|
+ </if>
|
|
|
+ <if test="inParams.officeId != null and inParams.officeId != ''">
|
|
|
+ and o.id =#{inParams.officeId}
|
|
|
+ </if>
|
|
|
+ <if test="inParams.userId != null and inParams.userId != ''">
|
|
|
+ and u.id =#{inParams.userId}
|
|
|
+ </if>
|
|
|
+ <if test="inParams.watercategoryId != null and inParams.watercategoryId != ''">
|
|
|
+ and w.id =#{inParams.watercategoryId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY c.waterproperty_id
|
|
|
+ union all
|
|
|
+ select
|
|
|
+ p.id as "waterpropertyId",
|
|
|
+ p.name as "waterpropertyName",
|
|
|
+ ifnull(count(distinct a.payseriesno),0) "frequency",
|
|
|
+ ifnull(round(sum(a.receivedamount),3),'0.000') as "receivedamount",
|
|
|
+ ifnull(FLOOR(sum(a.receivedamount)/p.totalprice_l1),0) as "amount",
|
|
|
+ round(ifnull((FLOOR(sum(a.receivedamount)/p.totalprice_l1))*(max(tab.p1 )),0 ),3)as "sfee",
|
|
|
+ round(ifnull((FLOOR(sum(a.receivedamount)/p.totalprice_l1))*(max(tab.p4 )),0 ),3) as "wsfee",
|
|
|
+ '0.000' as "ysfee",
|
|
|
+ '0.000' as "fjfee"
|
|
|
+ from pay_pay_received a
|
|
|
+ left join pay_base_customerandmeterrela c on c.account_id = a.account_id
|
|
|
+ left join pay_base_waterproperty p on p.id = c.waterproperty_id
|
|
|
+ left join pay_base_watercategory w on w.id = p.category_id
|
|
|
+ left join
|
|
|
+ (
|
|
|
+ select
|
|
|
+ w.id,
|
|
|
+ max(case when e.feetype = 1 then e.price end) as "p1",
|
|
|
+ max(case when e.feetype = 4 then e.price end) as "p4"
|
|
|
+ from pay_base_waterproperty w
|
|
|
+ left join pay_base_priceofwaterproperty p on p.waterproperty_id = w.id
|
|
|
+ left join pay_base_waterprice e on e.id = p.waterprice_id
|
|
|
+ where e.ladderlevel = '1'
|
|
|
+ GROUP BY w.id
|
|
|
+ )tab on tab.id = p.id
|
|
|
+ left join sc_organization o on o.id = c.office_id
|
|
|
+ left join sc_user u on u.id = a.create_by
|
|
|
+ <where>
|
|
|
+ a.payway != 5 and a.state = 1 and canceledrecord_id is null and iscanceled = 0
|
|
|
+ <if test="inParams.customerId != null and inParams.customerId != ''">
|
|
|
+ AND a.customer_id =#{inParams.customerId}
|
|
|
+ </if>
|
|
|
+ <if test="inParams.siteId != null and inParams.siteId != ''">
|
|
|
+ AND a.site_id =#{inParams.siteId}
|
|
|
+ </if>
|
|
|
+ <if test="inParams.startDate != null and inParams.startDate != null">
|
|
|
+ AND DATE_FORMAT(a.create_date,'%Y-%m-%d') >=#{inParams.startDate}
|
|
|
+ </if>
|
|
|
+ <if test="inParams.endDate != null and inParams.endDate != null">
|
|
|
+ AND DATE_FORMAT(a.create_date,'%Y-%m-%d') <=#{inParams.endDate}
|
|
|
+ </if>
|
|
|
+ <if test="inParams.officeId != null and inParams.officeId != ''">
|
|
|
+ and o.id =#{inParams.officeId}
|
|
|
+ </if>
|
|
|
+ <if test="inParams.userId != null and inParams.userId != ''">
|
|
|
+ and u.id =#{inParams.userId}
|
|
|
+ </if>
|
|
|
+ <if test="inParams.watercategoryId != null and inParams.watercategoryId != ''">
|
|
|
+ and w.id =#{inParams.watercategoryId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY c.waterproperty_id
|
|
|
+ )tab
|
|
|
+ GROUP BY tab.waterpropertyId,waterpropertyName
|
|
|
</select>
|
|
|
|
|
|
<select id="getReceviceInfoReport" resultType="com.bz.smart_city.dto.pay.PayWaterPropertyReportDto">
|