Browse Source

[定时任务][修改][得到滞纳金后计算滞纳金]

release_toaliyun_real
gongbiao 6 years ago
parent
commit
5794d8444c
8 changed files with 132 additions and 42 deletions
  1. +5
    -0
      mallinkSchedule/src/main/java/com/iformall/schedule/LatePayBillActionSchedule.java
  2. +41
    -0
      mallinkService/src/main/java/com/iformall/enums/EnumContract.java
  3. +2
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxBillPropertyMapper.java
  4. +2
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxBillRentMapper.java
  5. +0
    -6
      mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java
  6. +74
    -36
      mallinkService/src/main/resources/mapper/WxBillAllMapper.xml
  7. +4
    -0
      mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml
  8. +4
    -0
      mallinkService/src/main/resources/mapper/WxBillRentMapper.xml

+ 5
- 0
mallinkSchedule/src/main/java/com/iformall/schedule/LatePayBillActionSchedule.java View File

@@ -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());


+ 41
- 0
mallinkService/src/main/java/com/iformall/enums/EnumContract.java View File

@@ -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;
}
}

+ 2
- 0
mallinkService/src/main/java/com/iformall/mapper/WxBillPropertyMapper.java View File

@@ -55,4 +55,6 @@ public interface WxBillPropertyMapper extends CommonMapper<WxBillProperty, Long>

void updateServiceCharge(WxPayAccountBill tenantId);

void updateOwe();

}

+ 2
- 0
mallinkService/src/main/java/com/iformall/mapper/WxBillRentMapper.java View File

@@ -56,4 +56,6 @@ public interface WxBillRentMapper extends CommonMapper<WxBillRent, Long> {

void updateServiceCharge(WxPayAccountBill record);

void updateOwe();

}

+ 0
- 6
mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java View File

@@ -1714,7 +1714,6 @@ public class WxBillAllServiceImpl implements WxBillAllService {

@Override
public Map<String, Object> getOweBillAsPage(WxBillAll record, Integer pageNum, Integer pageSize) {
//WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(record.getTenantId());
PageInfo<Map<String, Object>> pageInfo = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxBillAllMapper.getOweBillAsPage(record));
List<Map<String, Object>> list = pageInfo.getList();
for (Map<String, Object> 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<String, Object> result = new HashMap<>();


+ 74
- 36
mallinkService/src/main/resources/mapper/WxBillAllMapper.xml View File

@@ -647,20 +647,30 @@

<choose>
<when test="1==filterHasPay">
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
</when>
<otherwise>
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
</otherwise>
</choose>

@@ -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
<include refid="getOweBillAsPageConditions"/>
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
<include refid="getOweBillAsPageConditions"/>
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}
<include refid="getOweBillAsPageConditions"/>
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}
<include refid="getOweBillAsPageConditions"/>
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}
<include refid="getOweBillAsPageConditions"/>
) 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)
<include refid="getOweBillAsPageConditions"/>
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}
<include refid="getOweBillAsPageConditions"/>
) 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)-


+ 4
- 0
mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml View File

@@ -272,6 +272,10 @@
<update id="updateServiceCharge" parameterType="com.iformall.domain.po.WxPayAccountBill">
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>
<update id="updateOwe">
update wx_bill_property set owe = receive_pay + service_charge_pay + late_pay_price - pay where status in (1,2,4)
</update>

</mapper>


+ 4
- 0
mallinkService/src/main/resources/mapper/WxBillRentMapper.xml View File

@@ -278,6 +278,10 @@
<update id="updateServiceCharge" parameterType="com.iformall.domain.po.WxPayAccountBill">
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>
<update id="updateOwe">
update wx_bill_rent set owe = receive_pay + service_charge_pay + late_pay_price - pay where status in (1,2,4)
</update>

</mapper>


Loading…
Cancel
Save