Pārlūkot izejas kodu

1.修改水量审核
2.修改收费员明细表、收费明细表,去掉预存抵扣

Xiaojh 4 gadi atpakaļ
vecāks
revīzija
9a5a137217

+ 9 - 1
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/AmountWaterUsedAmountServiceImpl.java

@@ -271,7 +271,15 @@ public class AmountWaterUsedAmountServiceImpl implements AmountWaterUsedAmountSe
                         amount = customerInfo.getFixedamount();
                     }
 
-                    //月阶梯用户 新安装户相差天数>31天或者跨账期结算则非阶梯结算
+                    BigInteger WaterPropertyId = customerInfo.getWaterPropertyId();
+                    if(WaterPropertyId != null) {
+                        //根据用水性质ID查找是否是阶梯
+                        BaseWaterPropertyDto waterPropertyDto = baseWaterPropertyMapper.get(WaterPropertyId, loginUser.getSiteId(), loginUser.getCustomerId());
+                        Integer laddertype = waterPropertyDto.getLaddertype();
+                        isEnable = laddertype;
+                    }
+
+                        //月阶梯用户 新安装户相差天数>31天或者跨账期结算则非阶梯结算
                     if(isEnable>=1){
                         List<AmountWaterUsedAmountDto> amountWaterUsedAmounts = amountWaterUsedAmountMapper.getWaterUsedAmountByMeterId(customerInfo.getWatermeterId());
                         if(amountWaterUsedAmounts!=null && amountWaterUsedAmounts.size()>0){

+ 32 - 8
smart-city-platform/src/main/resources/mapper/pay/PayReportMapper.xml

@@ -20,6 +20,7 @@
         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
+        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>
@@ -65,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>
@@ -110,6 +112,7 @@
         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
+            and ppr.payway !=5
             <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>
@@ -137,6 +140,7 @@
         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
+        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="community != null and community != ''"> and scc.code = #{community,jdbcType=VARCHAR} </if>
@@ -205,8 +209,8 @@
             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(case when e.feetype = 1 then e.price end )),0 ),3)as "sfee",
-            round(ifnull((FLOOR(sum(a.transamount)/p.totalprice_l1))*(max(case when e.feetype = 4 then e.price end )),0 ),3) as "wsfee",
+            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
@@ -215,8 +219,18 @@
         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 pay_base_priceofwaterproperty b on p.id = b.waterproperty_id
-        left join pay_base_waterprice e on b.waterprice_id = e.id and e.ladderlevel = 1
+        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>
@@ -256,16 +270,26 @@
             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(case when e.feetype = 1 then e.price end )),0 ),3)as "sfee",
-            round(ifnull((FLOOR(sum(a.receivedamount)/p.totalprice_l1))*(max(case when e.feetype = 4 then e.price end )),0 ),3) as "wsfee",
+            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 pay_base_priceofwaterproperty b on p.id = b.waterproperty_id
-        left join pay_base_waterprice e on b.waterprice_id = e.id and e.ladderlevel = 1
+        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>