|
@@ -33,26 +33,6 @@
|
|
|
|
|
|
</select>
|
|
|
|
|
|
- <select id="getPayTransactiondetailsReportCount" resultType="com.bz.smart_city.dto.pay.PayTransactiondetailsReportDto">
|
|
|
- SELECT
|
|
|
- '合计' as accountNumber,
|
|
|
- SUM(ppt.transamount) as transAmount
|
|
|
- FROM
|
|
|
- pay_pay_transactiondetails ppt
|
|
|
- LEFT JOIN pay_base_account ppa ON ppt.accountnumber = ppa.accountnumber
|
|
|
- LEFT JOIN sc_user scu ON ppt.create_by = scu.id
|
|
|
- WHERE
|
|
|
- ppt.transtype =1 and (ppt.iscanceled = 0 or ppt.iscanceled is null) and ppt.canceledrecord_id is null
|
|
|
- <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>
|
|
|
- <if test="createBy != null"> and ppt.create_by = #{createBy}</if>
|
|
|
- <if test="beginTime != null"> and ppt.transtime >= #{beginTime,jdbcType=TIMESTAMP}</if>
|
|
|
- <if test="endTime != null"> and ppt.transtime <= #{endTime,jdbcType=TIMESTAMP}</if>
|
|
|
- <if test="payWay != null"> and ppt.payway = #{payWay}</if>
|
|
|
-
|
|
|
-
|
|
|
- </select>
|
|
|
|
|
|
<select id="getPayOperatordetailsReportList" resultType="com.bz.smart_city.dto.pay.PayOperatordetailsReportDto">
|
|
|
SELECT * from
|
|
@@ -83,6 +63,31 @@
|
|
|
|
|
|
</where>
|
|
|
GROUP BY pba.`name`,pba.accountnumber,pba.address,scc.`name`
|
|
|
+ union all
|
|
|
+
|
|
|
+ SELECT
|
|
|
+ pba.`name` as accountName,
|
|
|
+ pba.accountnumber as accountNumber,
|
|
|
+ pba.address as accountAddr,
|
|
|
+ scc.`name` communityName,
|
|
|
+ 0 as receivedCount,
|
|
|
+ sum(ppt.transamount) transamount,
|
|
|
+ sum(ppt.transamount) subtotal,
|
|
|
+ min(ppt.create_date) transTime,
|
|
|
+ min(scu.`name`) createByName
|
|
|
+ FROM pay_pay_transactiondetails ppt
|
|
|
+ LEFT JOIN pay_base_account pba on ppt.account_id = pba.id
|
|
|
+ LEFT JOIN sc_community scc on scc.`code` = substring(ppt.accountnumber,1,3)
|
|
|
+ LEFT JOIN sc_user scu on scu.id = ppt.create_by
|
|
|
+ WHERE ppt.canceledrecord_id is null and ppt.iscanceled =0 and ppt.transtype != 4 AND ppt.transtype != 2 and ppt.transamount>0
|
|
|
+ <if test="customerId != null"> and ppt.customer_id = #{customerId}</if>
|
|
|
+ <if test="siteId != null"> and ppt.site_id = #{siteId}</if>
|
|
|
+ <if test="community != null and community != ''"> and scc.code = #{community,jdbcType=VARCHAR} </if>
|
|
|
+ <if test="createBy != null"> and ppt.create_by = #{createBy} </if>
|
|
|
+ <if test="beginTime != null"> and ppt.create_date >= #{beginTime,jdbcType=TIMESTAMP}</if>
|
|
|
+ <if test="endTime != null"> and ppt.create_date <= #{endTime,jdbcType=TIMESTAMP}</if>
|
|
|
+ GROUP BY pba.`name`,pba.accountnumber,pba.address,scc.`name`
|
|
|
+
|
|
|
) tb
|
|
|
<where>
|
|
|
<if test="dataType != null and subtotal != null">
|
|
@@ -93,54 +98,11 @@
|
|
|
</if>
|
|
|
</where>
|
|
|
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="getPayOperatordetailsReportCount" resultType="com.bz.smart_city.dto.pay.PayOperatordetailsReportDto">
|
|
|
- SELECT
|
|
|
- '合计' as accountName,
|
|
|
- sum(receivedCount) receivedCount,
|
|
|
- sum(transamount) transamount,
|
|
|
- sum(subtotal) subtotal
|
|
|
- from
|
|
|
- (
|
|
|
- SELECT
|
|
|
- pba.`name` as accountName,
|
|
|
- pba.accountnumber as accountNumber,
|
|
|
- pba.address as accountAddr,
|
|
|
- scc.`name` communityName,
|
|
|
- SUM(ppr.receivedamount) receivedCount,
|
|
|
- max(ifnull(ppt.transamount,0)) transamount,
|
|
|
- sum(ppr.receivedamount) + max(ifnull(ppt.transamount,0)) subtotal,
|
|
|
- min(ppr.create_date) transTime,
|
|
|
- min(scu.`name`) createByName
|
|
|
- FROM pay_pay_received ppr
|
|
|
- LEFT JOIN pay_base_account pba on ppr.account_id = pba.id
|
|
|
- LEFT JOIN sc_community scc on scc.`code` = substring(pba.accountnumber,1,3) and scc.customer_id = 47
|
|
|
- LEFT JOIN sc_user scu on scu.id = ppr.create_by
|
|
|
- LEFT JOIN pay_pay_transactiondetails ppt on ppt.payseriesno = ppr.payseriesno and ppt.transtype = 4
|
|
|
- <where>
|
|
|
- ppr.canceledrecord_id is null and ppr.iscanceled =0
|
|
|
- <if test="customerId != null"> and ppr.customer_id = #{customerId}</if>
|
|
|
- <if test="siteId != null"> and ppr.site_id = #{siteId}</if>
|
|
|
- <if test="community != null and community != ''"> and scc.code = #{community,jdbcType=VARCHAR} </if>
|
|
|
- <if test="createBy != null"> and ppr.create_by = #{createBy} </if>
|
|
|
- <if test="beginTime != null"> and ppr.create_date >= #{beginTime,jdbcType=TIMESTAMP}</if>
|
|
|
- <if test="endTime != null"> and ppr.create_date <= #{endTime,jdbcType=TIMESTAMP}</if>
|
|
|
-
|
|
|
- </where>
|
|
|
- GROUP BY pba.`name`,pba.accountnumber,pba.address,scc.`name`
|
|
|
- ) tb
|
|
|
- <where>
|
|
|
- <if test="dataType != null and subtotal != null">
|
|
|
- <if test="dataType == 0"> subtotal = #{subtotal}</if>
|
|
|
- <if test="dataType == 1"> subtotal < #{subtotal}</if>
|
|
|
- <if test="dataType == 2"> subtotal > #{subtotal}</if>
|
|
|
-
|
|
|
- </if>
|
|
|
- </where>
|
|
|
+ order by transtime desc
|
|
|
|
|
|
</select>
|
|
|
|
|
|
+
|
|
|
<select id="getPayArrearagedetailsReportList" resultType="com.bz.smart_city.dto.pay.PayArrearagedetailsReportDto">
|
|
|
|
|
|
SELECT
|
|
@@ -179,55 +141,5 @@
|
|
|
|
|
|
</select>
|
|
|
|
|
|
- <select id="getPayArrearagedetailsReportCount" resultType="com.bz.smart_city.dto.pay.PayArrearagedetailsReportDto">
|
|
|
-
|
|
|
- SELECT
|
|
|
- '合计' as accountName,
|
|
|
- sum(payamount) as payamount,
|
|
|
- sum(payamountFee) as payamountFee,
|
|
|
- sum(taxExemptFee) as taxExemptFee,
|
|
|
- sum(polluteFee) as polluteFee,
|
|
|
- sum(penltyFee) as penltyFee,
|
|
|
- sum(outLevelFee) as outLevelFee,
|
|
|
- sum(subtotal) as subtotal,
|
|
|
- sum(debtFee) as debtFee
|
|
|
- FROM
|
|
|
- (
|
|
|
- SELECT
|
|
|
- pba.NAME as accountName,
|
|
|
- pba.accountnumber as accountNumber,
|
|
|
- pba.address as accountAddr,
|
|
|
- pba.mobilephone as mobilePhone,
|
|
|
- sum( CASE WHEN pprb.feetype = 1 THEN pprb.receivablefee ELSE 0 END ) as payamountFee,
|
|
|
- sum( CASE WHEN pprb.feetype = 3 THEN pprb.receivablefee ELSE 0 END ) as taxExemptFee,
|
|
|
- sum( CASE WHEN pprb.feetype = 4 THEN pprb.receivablefee ELSE 0 END ) as polluteFee,
|
|
|
- sum( CASE WHEN pprb.feetype = 6 THEN pprb.receivablefee ELSE 0 END ) as penltyFee,
|
|
|
- sum( CASE WHEN pprb.feetype = 1 THEN pprb.payamount ELSE 0 END ) payamount,
|
|
|
- sum( CASE WHEN pprb.ladderlevel != 1 THEN pprb.receivablefee ELSE 0 END ) as outLevelFee,
|
|
|
- sum( CASE WHEN pprb.receivablefee IS NULL THEN 0 ELSE pprb.receivablefee END ) as subtotal,
|
|
|
- sum( CASE WHEN pprb.debt IS NULL THEN 0 ELSE pprb.debt END ) as debtFee
|
|
|
- FROM
|
|
|
- pay_pay_receivable pprb
|
|
|
- LEFT JOIN pay_base_account pba ON pba.id = pprb.account_id
|
|
|
- <where>
|
|
|
- <if test="customerId != null"> and pprb.customer_id = #{customerId}</if>
|
|
|
- <if test="siteId != null"> and pprb.site_id = #{siteId}</if>
|
|
|
- <if test="officeId != null"> and pprb.office_id = #{officeId}</if>
|
|
|
- <if test="community != null and community != ''"> and substring(pba.accountnumber,1,3) = #{community,jdbcType=VARCHAR}</if>
|
|
|
- <if test="accountNumber != null and accountNumber != ''"> and pba.accountnumber like concat('%',#{accountNumber},'%')</if>
|
|
|
-
|
|
|
- </where>
|
|
|
-
|
|
|
- GROUP BY
|
|
|
- pba.NAME,
|
|
|
- pba.NAME,
|
|
|
- pba.accountnumber,
|
|
|
- pba.address,
|
|
|
- pba.mobilephone
|
|
|
- HAVING
|
|
|
- sum( CASE WHEN pprb.debt IS NULL THEN 0 ELSE pprb.debt END )> 0
|
|
|
- ) tb
|
|
|
-
|
|
|
- </select>
|
|
|
|
|
|
</mapper>
|