From 5794d8444c943ee35efba6b181c77debc63374ee Mon Sep 17 00:00:00 2001 From: gongbiao Date: Wed, 23 Oct 2019 15:57:22 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9][=E5=BE=97=E5=88=B0=E6=BB=9E=E7=BA=B3?= =?UTF-8?q?=E9=87=91=E5=90=8E=E8=AE=A1=E7=AE=97=E6=BB=9E=E7=BA=B3=E9=87=91?= =?UTF-8?q?]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../schedule/LatePayBillActionSchedule.java | 5 + .../java/com/iformall/enums/EnumContract.java | 41 +++++++ .../iformall/mapper/WxBillPropertyMapper.java | 2 + .../com/iformall/mapper/WxBillRentMapper.java | 2 + .../service/impl/WxBillAllServiceImpl.java | 6 - .../main/resources/mapper/WxBillAllMapper.xml | 110 ++++++++++++------ .../resources/mapper/WxBillPropertyMapper.xml | 4 + .../resources/mapper/WxBillRentMapper.xml | 4 + 8 files changed, 132 insertions(+), 42 deletions(-) create mode 100644 mallinkService/src/main/java/com/iformall/enums/EnumContract.java diff --git a/mallinkSchedule/src/main/java/com/iformall/schedule/LatePayBillActionSchedule.java b/mallinkSchedule/src/main/java/com/iformall/schedule/LatePayBillActionSchedule.java index 98d1772fc..67a7381ad 100644 --- a/mallinkSchedule/src/main/java/com/iformall/schedule/LatePayBillActionSchedule.java +++ b/mallinkSchedule/src/main/java/com/iformall/schedule/LatePayBillActionSchedule.java @@ -30,6 +30,11 @@ public class LatePayBillActionSchedule { wxBillRentMapper.autoAddLatePayPrice(); wxBillPropertyMapper.autoAddLatePayPrice(); + + //修改欠缴 + wxBillRentMapper.updateOwe(); + wxBillPropertyMapper.updateOwe(); + logger.info("账单滞纳金更新结束"); }catch (Exception e){ logger.error("LatePayBillActionSchedule error! message:{}",e.getMessage()); diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumContract.java b/mallinkService/src/main/java/com/iformall/enums/EnumContract.java new file mode 100644 index 000000000..7941501c6 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/enums/EnumContract.java @@ -0,0 +1,41 @@ +package com.iformall.enums; + + +/** + * @author gongbiao + */ + +public enum EnumContract { + + SHOP_RENT(1, "店铺租赁合同"), + SHOP_PROPERTY(3, "店铺物业合同"), + SHOP_PROPERTY_RENT(5, "店铺租赁物业合同"), + POINT_RENT(2, "多经租赁合同"), + POIN_PROPERTY(4, "多经物业合同"), + SHOP_RENT_PROPERTY(6, "多经租赁物业合同"),; + + public static EnumContract getEnum(Integer code) { + for (EnumContract value : values()) { + if (value.getCode().equals(code)) { + return value; + } + } + return null; + } + + private Integer code; + private String message; + + EnumContract(Integer code, String message) { + this.code = code; + this.message = message; + } + + public Integer getCode() { + return code; + } + + public String getMessage() { + return message; + } +} diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxBillPropertyMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxBillPropertyMapper.java index 8903d8eb8..30f0de014 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxBillPropertyMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxBillPropertyMapper.java @@ -55,4 +55,6 @@ public interface WxBillPropertyMapper extends CommonMapper void updateServiceCharge(WxPayAccountBill tenantId); + void updateOwe(); + } diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxBillRentMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxBillRentMapper.java index fa04f450d..e9f6f2a20 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxBillRentMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxBillRentMapper.java @@ -56,4 +56,6 @@ public interface WxBillRentMapper extends CommonMapper { void updateServiceCharge(WxPayAccountBill record); + void updateOwe(); + } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java index 8ccea7262..bb1a5e6d2 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java @@ -1714,7 +1714,6 @@ public class WxBillAllServiceImpl implements WxBillAllService { @Override public Map getOweBillAsPage(WxBillAll record, Integer pageNum, Integer pageSize) { - //WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(record.getTenantId()); PageInfo> pageInfo = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxBillAllMapper.getOweBillAsPage(record)); List> list = pageInfo.getList(); for (Map map : list) { @@ -1723,11 +1722,6 @@ public class WxBillAllServiceImpl implements WxBillAllService { map.put("depositOwe", subZeroAndDot(map.get("depositOwe").toString())); map.put("otherOwe", subZeroAndDot(map.get("otherOwe").toString())); map.put("totalOwe", subZeroAndDot(map.get("totalOwe").toString())); - - //加上手续费 - //todo:把手续费率传进sql,在sql中算,汇总到max,直接出结果 - //map.put("totalReceivePay", subZeroAndDot(map.get("totalOwe").toString())); - } pageInfo.setList(list); Map result = new HashMap<>(); diff --git a/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml b/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml index d6af0ac00..9219bc60d 100644 --- a/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml @@ -647,20 +647,30 @@ - round((bill.rentReceivePay-bill.rentPay)/100,2) rentReceivePay, - round((bill.propertyReceivePay-bill.propertyPay)/100,2) propertyReceivePay, - round((bill.depositReceivePay-bill.depositPay)/100,2) depositReceivePay, - round((bill.otherReceivePay-bill.otherPay)/100,2) otherReceivePay, - round((bill.rentReceivePay+bill.propertyReceivePay+bill.depositReceivePay+bill.otherReceivePay - +bill.rentLatePay+bill.propertyLatePay+bill.depositLatePay+bill.otherLatePay + round((bill.rentReceivePay+bill.rentLatePay+bill.rentServiceChargePay-bill.rentPay)/100,2) + rentReceivePay, + round((bill.propertyReceivePay+bill.propertyLatePay+bill.propertyServiceChargePay-bill.propertyPay)/100,2) + propertyReceivePay, + round((bill.depositReceivePay+bill.depositLatePay+bill.depositServiceChargePay-bill.depositPay)/100,2) + depositReceivePay, + round((bill.otherReceivePay+bill.otherLatePay+bill.otherServiceChargePay-bill.otherPay)/100,2) + otherReceivePay, + round((bill.rentReceivePay+bill.rentLatePay+bill.rentServiceChargePay+bill.propertyReceivePay+bill.depositReceivePay+bill.otherReceivePay + +bill.rentLatePay+bill.propertyLatePay+bill.depositLatePay+bill.otherLatePay+bill.rentSeviceChargePay+bill.propertySeviceChargePay + +bill.depositSeviceChargePay+bill.otherSeviceChargePay -bill.rentPay-bill.propertyPay-bill.depositPay-bill.otherPay)/100,2) totalReceivePay - round(bill.rentReceivePay/100,2) rentReceivePay, - round(bill.propertyReceivePay/100,2) propertyReceivePay, - round(bill.depositReceivePay/100,2) depositReceivePay, - round(bill.otherReceivePay/100,2) otherReceivePay, - round((bill.rentReceivePay+bill.propertyReceivePay+bill.depositReceivePay+bill.otherReceivePay+bill.rentLatePay+bill.propertyLatePay+bill.depositLatePay+bill.otherLatePay )/100,2) totalReceivePay + round((bill.rentReceivePay+bill.rentLatePay+bill.rentServiceChargePay)/100,2) rentReceivePay, + round((bill.propertyReceivePay+bill.propertyLatePay+bill.propertyServiceChargePay)/100,2) + propertyReceivePay, + round((bill.depositReceivePay+bill.depositLatePay+bill.depositServiceChargePay)/100,2) + depositReceivePay, + round((bill.otherReceivePay+bill.otherLatePay+bill.otherServiceChargePay)/100,2) otherReceivePay, + round((bill.rentReceivePay+bill.propertyReceivePay+bill.depositReceivePay + +bill.otherReceivePay+bill.rentLatePay+bill.propertyLatePay+bill.depositLatePay + +bill.otherLatePay+bill.rentSeviceChargePay+bill.propertySeviceChargePay+bill.depositSeviceChargePay+bill.otherSeviceChargePay)/100,2) + totalReceivePay @@ -685,35 +695,46 @@ max(case oweList.bill_type when '租金' then oweList.latePayPrice else 0 end) rentLatePay, max(case oweList.bill_type when '物业费' then oweList.latePayPrice else 0 end) propertyLatePay, max(case oweList.bill_type when '欠缴押金' then oweList.latePayPrice else 0 end) depositLatePay, - max(case oweList.bill_type when '其他费用' then oweList.latePayPrice else 0 end) otherLatePay - + max(case oweList.bill_type when '其他费用' then oweList.latePayPrice else 0 end) otherLatePay, + + max(case oweList.bill_type when '租金' then oweList.serviceChargePay else 0 end) rentServiceChargePay, + max(case oweList.bill_type when '物业费' then oweList.serviceChargePay else 0 end) propertyServiceChargePay, + max(case oweList.bill_type when '欠缴押金' then oweList.serviceChargePay else 0 end) depositServiceChargePay, + max(case oweList.bill_type when '其他费用' then oweList.serviceChargePay else 0 end) otherServiceChargePay + from( - select bill.tenant_id,bill.merchant_id,bill.bill_type,sum(owe) owe,bill.receive_date,bill.expired_day,sum(bill.receive_pay) receive_pay,sum(bill.pay) pay,sum(bill.late_pay_price) latePayPrice from ( + select bill.tenant_id,bill.merchant_id,bill.bill_type,sum(owe) + owe,bill.receive_date,bill.expired_day,sum(bill.receive_pay) receive_pay,sum(bill.pay) + pay,sum(bill.late_pay_price) latePayPrice,sum(bill.service_charge_pay) serviceChargePay from ( select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金' - bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' - endtime,rent_shop_type,late_pay_price from wx_bill_rent where tenant_id = #{tenantId} and is_preview = 0 + bill_type,need_pay,receive_pay,pay,(receive_pay+) owe,DATE_FORMAT(receive_date,'%Y-%m-%d') + receive_date,pay_date,expired_day,status,'' starttime,'' + endtime,rent_shop_type,late_pay_price,service_charge_pay from wx_bill_rent where tenant_id = #{tenantId} and + is_preview = 0 union all select id,merchant_id,shop_id,tenant_id,'物业费' name,3 bill_type_value,'物业费' bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' - endtime,rent_shop_type,late_pay_price from wx_bill_property where tenant_id = #{tenantId} and is_preview = 0 + endtime,rent_shop_type,late_pay_price,service_charge_pay from wx_bill_property where tenant_id = #{tenantId} and + is_preview = 0 union all select res.id,res.merchant_id,res.shop_id,res.tenant_id,res.name,res.bill_type_value,res.bill_type,res.need_pay, res.receive_pay,res.pay,res.owe owe,res.receive_date,res.pay_date,res.expired_day,res.status,res.starttime,res.endtime,res.rent_shop_type,0 late_pay_price from( select id,merchant_id,shop_id,tenant_id,'欠缴押金' name,2 bill_type_value,'欠缴押金' bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' - endtime,rent_shop_type from wx_bill_rent_deposit where tenant_id = #{tenantId} + endtime,rent_shop_type,service_charge_pay from wx_bill_rent_deposit where tenant_id = #{tenantId} union all select id,merchant_id,shop_id,tenant_id,'欠缴押金' name,4 bill_type_value,'欠缴押金' bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' - endtime,rent_shop_type from wx_bill_property_deposit where tenant_id = #{tenantId} + endtime,rent_shop_type,service_charge_pay from wx_bill_property_deposit where tenant_id = #{tenantId} union all select id,merchant_id,shop_id,tenant_id,'欠缴押金' name,8 bill_type_value,'欠缴押金' bill_type,0 as - need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type + need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date, + pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type,service_charge_pay from wx_bill_other_deposit where tenant_id = #{tenantId} ) res @@ -721,12 +742,14 @@ select res.id,res.merchant_id,res.shop_id,res.tenant_id,res.name,res.bill_type_value,res.bill_type,res.need_pay, res.receive_pay,res.pay,res.owe owe,res.receive_date,res.pay_date,res.expired_day,res.status,res.starttime,res.endtime,res.rent_shop_type,0 late_pay_price from( select id,merchant_id,shop_id,tenant_id,'其他费用' name,5 bill_type_value,'其他费用' bill_type,0 as - need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type + need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date, + expired_day,status,'' starttime,'' endtime,rent_shop_type,service_charge_pay from wx_bill_daily where tenant_id = #{tenantId} and type in(1,2,3) union all select id,merchant_id,shop_id,tenant_id,'其他费用' name,7 bill_type_value,'其他费用' bill_type,0 as - need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type + need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date, + expired_day,status,'' starttime,'' endtime,rent_shop_type,service_charge_pay from wx_bill_other where tenant_id = #{tenantId} ) res @@ -752,19 +775,33 @@ xb.title business,rc.rental_start_date rentalStartDate,rc.rental_end_date rentalEndDate,rc.rent_shop_type, ifnull(round( (select sum(bill.receive_pay)+sum(bill.late_pay_price)+bill.receivePay from ( - select merchant_id,receive_pay,if(service_charge_pay>0,service_charge_pay,receive_pay/10000*(select service_charge_rate from wx_pay_account_bill where tenant_id=456)) receivePay,late_pay_price from wx_bill_rent where is_preview = 0 and status not in(3,6) + select merchant_id,receive_pay,if(service_charge_pay>0,service_charge_pay,receive_pay/10000*(select + service_charge_rate from wx_pay_account_bill where tenant_id=#{tenantId})) receivePay,late_pay_price from + wx_bill_rent where is_preview = 0 and status not in(3,6) union all - select merchant_id,receive_pay,if(service_charge_pay>0,service_charge_pay,receive_pay/10000*(select service_charge_rate from wx_pay_account_bill where tenant_id=456)) receivePay,0 late_pay_price from wx_bill_rent_deposit where status not in(3,6) + select merchant_id,receive_pay,if(service_charge_pay>0,service_charge_pay,receive_pay/10000*(select + service_charge_rate from wx_pay_account_bill where tenant_id=#{tenantId})) receivePay,0 late_pay_price from + wx_bill_rent_deposit where status not in(3,6) union all - select merchant_id,receive_pay,if(service_charge_pay>0,service_charge_pay,receive_pay/10000*(select service_charge_rate from wx_pay_account_bill where tenant_id=456)) receivePay,late_pay_price from wx_bill_property where is_preview = 0 and status not in(3,6) + select merchant_id,receive_pay,if(service_charge_pay>0,service_charge_pay,receive_pay/10000*(select + service_charge_rate from wx_pay_account_bill where tenant_id=#{tenantId})) receivePay,late_pay_price from + wx_bill_property where is_preview = 0 and status not in(3,6) union all - select merchant_id,receive_pay,if(service_charge_pay>0,service_charge_pay,receive_pay/10000*(select service_charge_rate from wx_pay_account_bill where tenant_id=456)) receivePay,0 late_pay_price from wx_bill_property_deposit where status not in(3,6) + select merchant_id,receive_pay,if(service_charge_pay>0,service_charge_pay,receive_pay/10000*(select + service_charge_rate from wx_pay_account_bill where tenant_id=#{tenantId})) receivePay,0 late_pay_price from + wx_bill_property_deposit where status not in(3,6) union all - select merchant_id,receive_pay,if(service_charge_pay>0,service_charge_pay,receive_pay/10000*(select service_charge_rate from wx_pay_account_bill where tenant_id=456)) receivePay,0 late_pay_price from wx_bill_daily where type in(1,2,3) and status not in(3,6) + select merchant_id,receive_pay,if(service_charge_pay>0,service_charge_pay,receive_pay/10000*(select + service_charge_rate from wx_pay_account_bill where tenant_id=#{tenantId})) receivePay,0 late_pay_price from + wx_bill_daily where type in(1,2,3) and status not in(3,6) union all - select merchant_id,receive_pay,if(service_charge_pay>0,service_charge_pay,receive_pay/10000*(select service_charge_rate from wx_pay_account_bill where tenant_id=456)) receivePay,0 late_pay_price from wx_bill_other where status not in(3,6) + select merchant_id,receive_pay,if(service_charge_pay>0,service_charge_pay,receive_pay/10000*(select + service_charge_rate from wx_pay_account_bill where tenant_id=#{tenantId})) receivePay,0 late_pay_price from + wx_bill_other where status not in(3,6) union all - select merchant_id,receive_pay,if(service_charge_pay>0,service_charge_pay,receive_pay/10000*(select service_charge_rate from wx_pay_account_bill where tenant_id=456)) receivePay,0 late_pay_price from wx_bill_other_deposit where status not in(3,6) + select merchant_id,receive_pay,if(service_charge_pay>0,service_charge_pay,receive_pay/10000*(select + service_charge_rate from wx_pay_account_bill where tenant_id=#{tenantId})) receivePay,0 late_pay_price from + wx_bill_other_deposit where status not in(3,6) ) bill where bill.merchant_id = m.id )/100,2),0) receivePay, @@ -790,31 +827,32 @@ (ifnull(round( (select sum(bill.receive_pay)+sum(bill.late_pay_price)+bill.receivePay from ( select merchant_id,receive_pay,if(service_charge_pay>0,service_charge_pay,receive_pay/10000*(select - service_charge_rate from wx_pay_account_bill where tenant_id=456)) receivePay,late_pay_price from wx_bill_rent + service_charge_rate from wx_pay_account_bill where tenant_id=#{tenantId})) receivePay,late_pay_price from + wx_bill_rent where is_preview = 0 and status not in(3,6) union all select merchant_id,receive_pay,if(service_charge_pay>0,service_charge_pay,receive_pay/10000*(select - service_charge_rate from wx_pay_account_bill where tenant_id=456)) receivePay,0 late_pay_price from + service_charge_rate from wx_pay_account_bill where tenant_id=#{tenantId})) receivePay,0 late_pay_price from wx_bill_rent_deposit where status not in(3,6) union all select merchant_id,receive_pay,if(service_charge_pay>0,service_charge_pay,receive_pay/10000*(select - service_charge_rate from wx_pay_account_bill where tenant_id=456)) receivePay,late_pay_price from + service_charge_rate from wx_pay_account_bill where tenant_id=#{tenantId})) receivePay,late_pay_price from wx_bill_property where is_preview = 0 and status not in(3,6) union all select merchant_id,receive_pay,if(service_charge_pay>0,service_charge_pay,receive_pay/10000*(select - service_charge_rate from wx_pay_account_bill where tenant_id=456)) receivePay,0 late_pay_price from + service_charge_rate from wx_pay_account_bill where tenant_id=#{tenantId})) receivePay,0 late_pay_price from wx_bill_property_deposit where status not in(3,6) union all select merchant_id,receive_pay,if(service_charge_pay>0,service_charge_pay,receive_pay/10000*(select - service_charge_rate from wx_pay_account_bill where tenant_id=456)) receivePay,0 late_pay_price from + service_charge_rate from wx_pay_account_bill where tenant_id=#{tenantId})) receivePay,0 late_pay_price from wx_bill_daily where type in(1,2,3) and status not in(3,6) union all select merchant_id,receive_pay,if(service_charge_pay>0,service_charge_pay,receive_pay/10000*(select - service_charge_rate from wx_pay_account_bill where tenant_id=456)) receivePay,0 late_pay_price from + service_charge_rate from wx_pay_account_bill where tenant_id=#{tenantId})) receivePay,0 late_pay_price from wx_bill_other where status not in(3,6) union all select merchant_id,receive_pay,if(service_charge_pay>0,service_charge_pay,receive_pay/10000*(select - service_charge_rate from wx_pay_account_bill where tenant_id=456)) receivePay,0 late_pay_price from + service_charge_rate from wx_pay_account_bill where tenant_id=#{tenantId})) receivePay,0 late_pay_price from wx_bill_other_deposit where status not in(3,6) ) bill where bill.merchant_id = m.id )/100,2),0)- diff --git a/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml b/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml index 628069cbf..c40f341be 100644 --- a/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml @@ -272,6 +272,10 @@ update wx_bill_property set service_charge_pay=round(receive_pay*#{serviceChargeRate}/100) where tenant_id=#{tenantId} and service_charge_pay=0 and status in(1,2,4) + + + update wx_bill_property set owe = receive_pay + service_charge_pay + late_pay_price - pay where status in (1,2,4) + diff --git a/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml b/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml index e1647aaf2..48c2ea3db 100644 --- a/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml @@ -278,6 +278,10 @@ update wx_bill_rent set service_charge_pay=round(receive_pay*#{serviceChargeRate}/100) where tenant_id=#{tenantId} and service_charge_pay=0 and status in(1,2,4) + + + update wx_bill_rent set owe = receive_pay + service_charge_pay + late_pay_price - pay where status in (1,2,4) +