|
|
@@ -208,7 +208,6 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService |
|
|
List<WxPropertyContract> list = wxPropertyContractMapper.findList(wxPropertyContract); |
|
|
List<WxPropertyContract> list = wxPropertyContractMapper.findList(wxPropertyContract); |
|
|
if (list.size() > 0) { |
|
|
if (list.size() > 0) { |
|
|
wxPropertyContract = list.get(0); |
|
|
wxPropertyContract = list.get(0); |
|
|
Integer receivePeriod = wxPropertyContract.getReceivePeriod(); |
|
|
|
|
|
final IdWorker idWorker = IdWorker.get(); |
|
|
final IdWorker idWorker = IdWorker.get(); |
|
|
WxBillPropertyDeposit wxBillDeposit = new WxBillPropertyDeposit(); |
|
|
WxBillPropertyDeposit wxBillDeposit = new WxBillPropertyDeposit(); |
|
|
wxBillDeposit.setId(idWorker.nextId()); |
|
|
wxBillDeposit.setId(idWorker.nextId()); |
|
|
@@ -221,7 +220,6 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService |
|
|
Date date = new Date(); |
|
|
Date date = new Date(); |
|
|
Calendar instance = Calendar.getInstance(); |
|
|
Calendar instance = Calendar.getInstance(); |
|
|
instance.setTime(wxPropertyContract.getRentalStartDate()); |
|
|
instance.setTime(wxPropertyContract.getRentalStartDate()); |
|
|
instance.add(Calendar.MONTH, receivePeriod.intValue()); |
|
|
|
|
|
instance.add(Calendar.DAY_OF_MONTH, -1); |
|
|
instance.add(Calendar.DAY_OF_MONTH, -1); |
|
|
Date time = instance.getTime(); |
|
|
Date time = instance.getTime(); |
|
|
wxBillDeposit.setReceiveDate(time); |
|
|
wxBillDeposit.setReceiveDate(time); |
|
|
@@ -240,11 +238,9 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService |
|
|
long day = (time.getTime() - date.getTime()) / (24 * 60 * 60 * 1000); |
|
|
long day = (time.getTime() - date.getTime()) / (24 * 60 * 60 * 1000); |
|
|
wxBillDeposit.setStatus(EnumBillRentStatus.NOT_PAID.getCode()); |
|
|
wxBillDeposit.setStatus(EnumBillRentStatus.NOT_PAID.getCode()); |
|
|
wxBillDeposit.setExpiredDay(day); |
|
|
wxBillDeposit.setExpiredDay(day); |
|
|
wxBillDeposit.setReceiveDate(time); |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
wxBillDeposit.setStatus(EnumBillRentStatus.WAIT_PAY.getCode()); |
|
|
wxBillDeposit.setStatus(EnumBillRentStatus.WAIT_PAY.getCode()); |
|
|
wxBillDeposit.setExpiredDay(0L); |
|
|
wxBillDeposit.setExpiredDay(0L); |
|
|
wxBillDeposit.setReceiveDate(time); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
wxBillDeposit.setTenantId(wxMerchant.getTenantId()); |
|
|
wxBillDeposit.setTenantId(wxMerchant.getTenantId()); |
|
|
@@ -282,11 +278,11 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService |
|
|
int index = paycount - 1; |
|
|
int index = paycount - 1; |
|
|
final IdWorker idWorker = IdWorker.get(); |
|
|
final IdWorker idWorker = IdWorker.get(); |
|
|
for (int i = 0; i < paycount; i++) { |
|
|
for (int i = 0; i < paycount; i++) { |
|
|
WxBillProperty wxBillRent = new WxBillProperty(); |
|
|
|
|
|
wxBillRent.setId(idWorker.nextId()); |
|
|
|
|
|
wxBillRent.setPropertyContractId(wxPropertyContract.getId()); |
|
|
|
|
|
wxBillRent.setReceivePay(0); |
|
|
|
|
|
wxBillRent.setPay(0); |
|
|
|
|
|
|
|
|
WxBillProperty wxBillProperty = new WxBillProperty(); |
|
|
|
|
|
wxBillProperty.setId(idWorker.nextId()); |
|
|
|
|
|
wxBillProperty.setPropertyContractId(wxPropertyContract.getId()); |
|
|
|
|
|
wxBillProperty.setReceivePay(0); |
|
|
|
|
|
wxBillProperty.setPay(0); |
|
|
|
|
|
|
|
|
Date date = new Date(); |
|
|
Date date = new Date(); |
|
|
Calendar instance = Calendar.getInstance(); |
|
|
Calendar instance = Calendar.getInstance(); |
|
|
@@ -294,67 +290,64 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService |
|
|
instance.add(Calendar.MONTH, receivePeriod * i); |
|
|
instance.add(Calendar.MONTH, receivePeriod * i); |
|
|
instance.add(Calendar.DAY_OF_MONTH, -1); |
|
|
instance.add(Calendar.DAY_OF_MONTH, -1); |
|
|
Date time = instance.getTime(); |
|
|
Date time = instance.getTime(); |
|
|
wxBillRent.setReceiveDate(time); |
|
|
|
|
|
|
|
|
wxBillProperty.setReceiveDate(time); |
|
|
|
|
|
|
|
|
//账单开始时间 |
|
|
//账单开始时间 |
|
|
instance.clear(); |
|
|
instance.clear(); |
|
|
instance.setTime(wxBillRent.getReceiveDate()); |
|
|
|
|
|
|
|
|
instance.setTime(wxBillProperty.getReceiveDate()); |
|
|
instance.add(Calendar.DAY_OF_MONTH, 1); |
|
|
instance.add(Calendar.DAY_OF_MONTH, 1); |
|
|
wxBillRent.setStarttime(instance.getTime()); |
|
|
|
|
|
|
|
|
wxBillProperty.setStarttime(instance.getTime()); |
|
|
//账单结束时间 |
|
|
//账单结束时间 |
|
|
instance.clear(); |
|
|
instance.clear(); |
|
|
instance.setTime(wxBillRent.getReceiveDate()); |
|
|
|
|
|
instance.add(Calendar.DAY_OF_MONTH, 1); |
|
|
|
|
|
|
|
|
instance.setTime(wxBillProperty.getStarttime()); |
|
|
instance.add(Calendar.MONTH, receivePeriod); |
|
|
instance.add(Calendar.MONTH, receivePeriod); |
|
|
wxBillRent.setEndtime(instance.getTime()); |
|
|
|
|
|
|
|
|
instance.add(Calendar.DAY_OF_MONTH, -1); |
|
|
|
|
|
wxBillProperty.setEndtime(instance.getTime()); |
|
|
int needpay = wxPropertyContract.getPrice() * receivePeriod; |
|
|
int needpay = wxPropertyContract.getPrice() * receivePeriod; |
|
|
if (extracount > 0 && i == index) { |
|
|
if (extracount > 0 && i == index) { |
|
|
//账单开始时间 |
|
|
//账单开始时间 |
|
|
instance.clear(); |
|
|
instance.clear(); |
|
|
instance.setTime(wxBillRent.getReceiveDate()); |
|
|
|
|
|
|
|
|
instance.setTime(wxBillProperty.getReceiveDate()); |
|
|
instance.add(Calendar.DAY_OF_MONTH, 1); |
|
|
instance.add(Calendar.DAY_OF_MONTH, 1); |
|
|
wxBillRent.setStarttime(instance.getTime()); |
|
|
|
|
|
|
|
|
wxBillProperty.setStarttime(instance.getTime()); |
|
|
//账单结束时间 |
|
|
//账单结束时间 |
|
|
instance.clear(); |
|
|
instance.clear(); |
|
|
instance.setTime(wxBillRent.getReceiveDate()); |
|
|
|
|
|
instance.add(Calendar.DAY_OF_MONTH, 1); |
|
|
|
|
|
|
|
|
instance.setTime(wxBillProperty.getStarttime()); |
|
|
instance.add(Calendar.MONTH, extralease); |
|
|
instance.add(Calendar.MONTH, extralease); |
|
|
wxBillRent.setEndtime(instance.getTime()); |
|
|
|
|
|
|
|
|
instance.add(Calendar.DAY_OF_MONTH, -1); |
|
|
|
|
|
wxBillProperty.setEndtime(instance.getTime()); |
|
|
needpay = wxPropertyContract.getPrice() * extralease; |
|
|
needpay = wxPropertyContract.getPrice() * extralease; |
|
|
} |
|
|
} |
|
|
wxBillRent.setNeedPay(needpay); |
|
|
|
|
|
wxBillRent.setOwe(needpay); |
|
|
|
|
|
|
|
|
wxBillProperty.setNeedPay(needpay); |
|
|
|
|
|
wxBillProperty.setOwe(needpay); |
|
|
//截止收租日在当前时间之前 |
|
|
//截止收租日在当前时间之前 |
|
|
if (wxBillRent.getReceiveDate().before(date)) { |
|
|
|
|
|
|
|
|
if (wxBillProperty.getReceiveDate().before(date)) { |
|
|
long day = (time.getTime() - date.getTime()) / (24 * 60 * 60 * 1000); |
|
|
long day = (time.getTime() - date.getTime()) / (24 * 60 * 60 * 1000); |
|
|
wxBillRent.setStatus(EnumBillRentStatus.NOT_PAID.getCode()); |
|
|
|
|
|
wxBillRent.setExpiredDay(day); |
|
|
|
|
|
wxBillRent.setReceiveDate(time); |
|
|
|
|
|
|
|
|
wxBillProperty.setStatus(EnumBillRentStatus.NOT_PAID.getCode()); |
|
|
|
|
|
wxBillProperty.setExpiredDay(day); |
|
|
} else {//截止收租日在当前时间之后 |
|
|
} else {//截止收租日在当前时间之后 |
|
|
Calendar now = Calendar.getInstance(); |
|
|
Calendar now = Calendar.getInstance(); |
|
|
now.add(Calendar.MONTH, receivePeriod); |
|
|
now.add(Calendar.MONTH, receivePeriod); |
|
|
Date currenttime = now.getTime(); |
|
|
Date currenttime = now.getTime(); |
|
|
//当前日期加上周期后小于截止收租日就是没有到期,否则当前待缴 |
|
|
//当前日期加上周期后小于截止收租日就是没有到期,否则当前待缴 |
|
|
if (currenttime.before(wxBillRent.getReceiveDate())) { |
|
|
|
|
|
wxBillRent.setStatus(EnumBillRentStatus.NOT_EXPIRED.getCode()); |
|
|
|
|
|
wxBillRent.setExpiredDay(0L); |
|
|
|
|
|
wxBillRent.setReceiveDate(time); |
|
|
|
|
|
|
|
|
if (currenttime.before(wxBillProperty.getReceiveDate())) { |
|
|
|
|
|
wxBillProperty.setStatus(EnumBillRentStatus.NOT_EXPIRED.getCode()); |
|
|
|
|
|
wxBillProperty.setExpiredDay(0L); |
|
|
} else { |
|
|
} else { |
|
|
wxBillRent.setStatus(EnumBillRentStatus.WAIT_PAY.getCode()); |
|
|
|
|
|
wxBillRent.setExpiredDay(0L); |
|
|
|
|
|
wxBillRent.setReceiveDate(time); |
|
|
|
|
|
|
|
|
wxBillProperty.setStatus(EnumBillRentStatus.WAIT_PAY.getCode()); |
|
|
|
|
|
wxBillProperty.setExpiredDay(0L); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
wxBillRent.setTenantId(wxMerchant.getTenantId()); |
|
|
|
|
|
wxBillRent.setIsDel(0); |
|
|
|
|
|
wxBillRent.setMerchantId(wxMerchant.getId()); |
|
|
|
|
|
wxBillRent.setUserId(user.getId()); |
|
|
|
|
|
wxBillRent.setShopId(wxPropertyContract.getShopId()); |
|
|
|
|
|
wxBillRent.setCreatetime(date); |
|
|
|
|
|
wxBillRent.setUpdatetime(date); |
|
|
|
|
|
wxBillRent.setIsDel(EnumDelStatus.NOT_DEL.getCode()); |
|
|
|
|
|
|
|
|
wxBillProperty.setTenantId(wxMerchant.getTenantId()); |
|
|
|
|
|
wxBillProperty.setIsDel(0); |
|
|
|
|
|
wxBillProperty.setMerchantId(wxMerchant.getId()); |
|
|
|
|
|
wxBillProperty.setUserId(user.getId()); |
|
|
|
|
|
wxBillProperty.setShopId(wxPropertyContract.getShopId()); |
|
|
|
|
|
wxBillProperty.setCreatetime(date); |
|
|
|
|
|
wxBillProperty.setUpdatetime(date); |
|
|
|
|
|
wxBillProperty.setIsDel(EnumDelStatus.NOT_DEL.getCode()); |
|
|
try { |
|
|
try { |
|
|
wxBillPropertyMapper.insertSelective(wxBillRent); |
|
|
|
|
|
|
|
|
wxBillPropertyMapper.insertSelective(wxBillProperty); |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
logger.error("添加物业账单失败,e:" + e.getMessage()); |
|
|
logger.error("添加物业账单失败,e:" + e.getMessage()); |
|
|
throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); |
|
|
throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); |
|
|
|