diff --git a/mallinkAdmin/src/main/resources/db/migration/V201908021153__L_ALTER_CONTENT.sql b/mallinkAdmin/src/main/resources/db/migration/V201908021153__L_ALTER_CONTENT.sql new file mode 100644 index 000000000..887c759c5 --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V201908021153__L_ALTER_CONTENT.sql @@ -0,0 +1,2 @@ +alter table wx_rent_contract modify `late_pay_day` INT(10) DEFAULT 0; +alter table wx_property_contract modify `late_pay_day` INT(10) DEFAULT 0; \ No newline at end of file diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java index fb016c149..679366023 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -1000,6 +1000,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { return shopInfoStr; } + public Map buildRent(int receivePeriod, long[] priceArrs, List yearList, int dayType, WxRentContract wxRentContract, Long userId, int billcount, Integer isPreview, String shopInfoStr,boolean saveDb) { SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); Map resultMap = new HashedMap(); @@ -1050,8 +1051,12 @@ public class WxRentContractServiceImpl implements WxRentContractService { if(sd.format(billTimeVo.getStartDate()).equals(sd.format(billTimeVo.getEndDate()))){ needpayFront = getNeedPayMoney(wxRentContract,priceArrs[index-1],billTimeVo.getStartDate(),endDate,i,billTimeVoList.size(),saveDb); }else{ - needpayFront = getNeedPayMoney(wxRentContract,priceArrs[index-1],billTimeVo.getStartDate(),endDate,i,billTimeVoList.size(),saveDb); - needpayAfter = getNeedPayMoney(wxRentContract,priceArrs[index],endDate,billTimeVo.getEndDate(),i,billTimeVoList.size(),saveDb); + if(billTimeVo.getStartDate().before(endDate)){ + needpayFront = getNeedPayMoney(wxRentContract, priceArrs[index - 1], billTimeVo.getStartDate(), endDate, i, billTimeVoList.size(), saveDb); + needpayAfter = getNeedPayMoney(wxRentContract, priceArrs[index], endDate, billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb); + }else{ + needpayFront = getNeedPayMoney(wxRentContract, priceArrs[index], billTimeVo.getStartDate(), billTimeVo.getEndDate(), i, billTimeVoList.size(), saveDb); + } } needpay = needpayFront+needpayAfter; flag = true; diff --git a/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml b/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml index ca7195c3d..c474f6b22 100644 --- a/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml @@ -139,9 +139,9 @@ update wx_bill_property b set b.status=#{notPaid},b.expired_day= - DATEDIFF(now(), date_add(b.receive_date,interval(select late_pay_day from wx_rent_contract where id = b.`property_contract_id`) day)) + DATEDIFF(now(), date_add(b.receive_date,interval(select late_pay_day from wx_property_contract where id = b.`property_contract_id`) day)) where b.tenant_id=#{tenantId} and b.status!=#{paid} and b.status!=6 and - DATEDIFF(now(), date_add(b.receive_date,interval(select late_pay_day from wx_rent_contract where id = b.`property_contract_id`) day)) >0 + DATEDIFF(now(), date_add(b.receive_date,interval(select late_pay_day from wx_property_contract where id = b.`property_contract_id`) day)) >0 @@ -233,10 +233,18 @@ - update wx_bill_property b set b.late_pay_price = b.late_pay_price + - round( - b.owe * (select late_pay_ratio from wx_property_contract where id = b.`property_contract_id`) /10000 - ,2) + update wx_bill_property b set b.late_pay_price = + if(b.late_pay_price is null, + round( + b.owe * (select late_pay_ratio from wx_property_contract where id = b.`property_contract_id`) + * DATEDIFF(now(), date_add(b.receive_date,interval(select late_pay_day from wx_property_contract where id = b.`property_contract_id`) day)) /100 + ,2) + , + b.late_pay_price + + round( + b.owe * (select late_pay_ratio from wx_property_contract where id = b.`property_contract_id`) /100 + ,2) + ) where b.status!=3 and b.status!=6 and (select late_pay_ratio from wx_property_contract where id = b.`property_contract_id`) > 0 and DATEDIFF(now(), date_add(b.receive_date,interval(select late_pay_day from wx_property_contract where id = b.`property_contract_id`) day)) >0; diff --git a/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml b/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml index f3fc95312..07329ef2b 100644 --- a/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml @@ -235,10 +235,18 @@ - update wx_bill_rent b set b.late_pay_price = b.late_pay_price + - round( - b.owe * (select late_pay_ratio from wx_rent_contract where id = b.`rent_contract_id`) /10000 - ,2) + update wx_bill_rent b set b.late_pay_price = + if(b.late_pay_price is null, + round( + b.owe * (select late_pay_ratio from wx_rent_contract where id = b.`rent_contract_id`) + * DATEDIFF(now(), date_add(b.receive_date,interval(select late_pay_day from wx_rent_contract where id = b.`rent_contract_id`) day)) /100 + ,2) + , + b.late_pay_price + + round( + b.owe * (select late_pay_ratio from wx_rent_contract where id = b.`rent_contract_id`) /100 + ,2) + ) where b.status!=3 and b.status!=6 and (select late_pay_ratio from wx_rent_contract where id = b.`rent_contract_id`) > 0 and DATEDIFF(now(), date_add(b.receive_date,interval(select late_pay_day from wx_rent_contract where id = b.`rent_contract_id`) day)) >0;