| @@ -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; | |||||
| @@ -1000,6 +1000,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| return shopInfoStr; | return shopInfoStr; | ||||
| } | } | ||||
| public Map<String, Object> buildRent(int receivePeriod, long[] priceArrs, List<Date> yearList, int dayType, WxRentContract wxRentContract, Long userId, int billcount, Integer isPreview, String shopInfoStr,boolean saveDb) { | public Map<String, Object> buildRent(int receivePeriod, long[] priceArrs, List<Date> yearList, int dayType, WxRentContract wxRentContract, Long userId, int billcount, Integer isPreview, String shopInfoStr,boolean saveDb) { | ||||
| SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); | SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); | ||||
| Map<String,Object> resultMap = new HashedMap(); | Map<String,Object> resultMap = new HashedMap(); | ||||
| @@ -1050,8 +1051,12 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| if(sd.format(billTimeVo.getStartDate()).equals(sd.format(billTimeVo.getEndDate()))){ | if(sd.format(billTimeVo.getStartDate()).equals(sd.format(billTimeVo.getEndDate()))){ | ||||
| needpayFront = getNeedPayMoney(wxRentContract,priceArrs[index-1],billTimeVo.getStartDate(),endDate,i,billTimeVoList.size(),saveDb); | needpayFront = getNeedPayMoney(wxRentContract,priceArrs[index-1],billTimeVo.getStartDate(),endDate,i,billTimeVoList.size(),saveDb); | ||||
| }else{ | }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; | needpay = needpayFront+needpayAfter; | ||||
| flag = true; | flag = true; | ||||
| @@ -139,9 +139,9 @@ | |||||
| <update id="updateNotPaidStatus" parameterType="hashmap"> | <update id="updateNotPaidStatus" parameterType="hashmap"> | ||||
| update wx_bill_property b set b.status=#{notPaid},b.expired_day= | 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 | 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 | |||||
| </update> | </update> | ||||
| <update id="updateWaitPayStatus" parameterType="hashmap"> | <update id="updateWaitPayStatus" parameterType="hashmap"> | ||||
| @@ -233,10 +233,18 @@ | |||||
| </select> | </select> | ||||
| <update id="autoAddLatePayPrice"> | <update id="autoAddLatePayPrice"> | ||||
| 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 | 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 (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; | 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; | ||||
| @@ -235,10 +235,18 @@ | |||||
| </select> | </select> | ||||
| <update id="autoAddLatePayPrice"> | <update id="autoAddLatePayPrice"> | ||||
| 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 | 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 (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; | 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; | ||||