|
|
@@ -1038,22 +1038,11 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
if (daily != null) { |
|
|
if (daily != null) { |
|
|
if (!daily.getStatus().equals(EnumBillRentStatus.PAID.getCode())) { |
|
|
if (!daily.getStatus().equals(EnumBillRentStatus.PAID.getCode())) { |
|
|
long allPay = new BigDecimal(daily.getPay()).add(new BigDecimal(pay)).longValueExact(); |
|
|
long allPay = new BigDecimal(daily.getPay()).add(new BigDecimal(pay)).longValueExact(); |
|
|
daily.setExpiredDay(0L); |
|
|
|
|
|
if (allPay >= receivePay) { |
|
|
|
|
|
daily.setStatus(EnumBillRentStatus.PAID.getCode()); |
|
|
|
|
|
} else { |
|
|
|
|
|
Date payDate = bill.getPayDate(); |
|
|
|
|
|
Date receiveDate = bill.getReceiveDate(); |
|
|
|
|
|
if (payDate.after(receiveDate)) { |
|
|
|
|
|
int expiredDay = DateUtils.daysBetween(receiveDate, payDate); |
|
|
|
|
|
daily.setExpiredDay((long) expiredDay); |
|
|
|
|
|
daily.setStatus(EnumBillRentStatus.NOT_PAID.getCode()); |
|
|
|
|
|
} else { |
|
|
|
|
|
daily.setStatus(EnumBillRentStatus.WAIT_PAY.getCode()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
WxBillRent expiredDayAndStatus = getExpiredDayAndStatus(bill.getReceiveDate(), bill.getPayDate(), receivePay, allPay, false); |
|
|
|
|
|
daily.setExpiredDay(expiredDayAndStatus.getExpiredDay()); |
|
|
|
|
|
daily.setStatus(expiredDayAndStatus.getStatus()); |
|
|
daily.setReceivePay(receivePay); |
|
|
daily.setReceivePay(receivePay); |
|
|
daily.setPay(daily.getPay() + pay); |
|
|
|
|
|
|
|
|
daily.setPay(allPay); |
|
|
daily.setOwe(0L); |
|
|
daily.setOwe(0L); |
|
|
long owe = daily.getReceivePay() - daily.getPay(); |
|
|
long owe = daily.getReceivePay() - daily.getPay(); |
|
|
if (owe > 0) { |
|
|
if (owe > 0) { |
|
|
@@ -1086,24 +1075,13 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
Date date = new Date(); |
|
|
Date date = new Date(); |
|
|
daily.setCreatetime(date); |
|
|
daily.setCreatetime(date); |
|
|
daily.setUpdatetime(date); |
|
|
daily.setUpdatetime(date); |
|
|
daily.setExpiredDay(0L); |
|
|
|
|
|
daily.setOwe(receivePay - pay); |
|
|
daily.setOwe(receivePay - pay); |
|
|
daily.setIsDel(EnumDelStatus.NOT_DEL.getCode()); |
|
|
daily.setIsDel(EnumDelStatus.NOT_DEL.getCode()); |
|
|
daily.setStarttime(bill.getStarttime()); |
|
|
daily.setStarttime(bill.getStarttime()); |
|
|
daily.setEndtime(bill.getEndtime()); |
|
|
daily.setEndtime(bill.getEndtime()); |
|
|
if (receivePay <= pay) { |
|
|
|
|
|
daily.setStatus(EnumBillRentStatus.PAID.getCode()); |
|
|
|
|
|
} else { |
|
|
|
|
|
Date payDate = daily.getPayDate(); |
|
|
|
|
|
Date receiveDate = daily.getReceiveDate(); |
|
|
|
|
|
int expiredDay = DateUtils.daysBetween(receiveDate, payDate); |
|
|
|
|
|
if (expiredDay > 0) { |
|
|
|
|
|
daily.setStatus(EnumBillRentStatus.NOT_PAID.getCode()); |
|
|
|
|
|
daily.setExpiredDay((long) expiredDay); |
|
|
|
|
|
} else { |
|
|
|
|
|
daily.setStatus(EnumBillRentStatus.WAIT_PAY.getCode()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
WxBillRent expiredDayAndStatus = getExpiredDayAndStatus(bill.getReceiveDate(), bill.getPayDate(), receivePay, pay, false); |
|
|
|
|
|
daily.setExpiredDay(expiredDayAndStatus.getExpiredDay()); |
|
|
|
|
|
daily.setStatus(expiredDayAndStatus.getStatus()); |
|
|
wxBillDailyMapper.insertSelective(daily); |
|
|
wxBillDailyMapper.insertSelective(daily); |
|
|
addActionImport(daily.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); |
|
|
addActionImport(daily.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); |
|
|
} |
|
|
} |
|
|
@@ -1119,24 +1097,13 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
if (other != null) { |
|
|
if (other != null) { |
|
|
if (!other.getStatus().equals(EnumBillRentStatus.PAID.getCode())) { |
|
|
if (!other.getStatus().equals(EnumBillRentStatus.PAID.getCode())) { |
|
|
long allPay = new BigDecimal(other.getPay()).add(new BigDecimal(pay)).longValueExact(); |
|
|
long allPay = new BigDecimal(other.getPay()).add(new BigDecimal(pay)).longValueExact(); |
|
|
other.setExpiredDay(0L); |
|
|
|
|
|
if (allPay >= receivePay) { |
|
|
|
|
|
other.setStatus(EnumBillRentStatus.PAID.getCode()); |
|
|
|
|
|
} else { |
|
|
|
|
|
Date payDate = bill.getPayDate(); |
|
|
|
|
|
Date receiveDate = bill.getReceiveDate(); |
|
|
|
|
|
if (payDate.after(receiveDate)) { |
|
|
|
|
|
int expiredDay = DateUtils.daysBetween(receiveDate, payDate); |
|
|
|
|
|
other.setExpiredDay((long) expiredDay); |
|
|
|
|
|
other.setStatus(EnumBillRentStatus.NOT_PAID.getCode()); |
|
|
|
|
|
} else { |
|
|
|
|
|
other.setStatus(EnumBillRentStatus.WAIT_PAY.getCode()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
WxBillRent expiredDayAndStatus = getExpiredDayAndStatus(bill.getReceiveDate(), bill.getPayDate(), receivePay, allPay, false); |
|
|
|
|
|
other.setExpiredDay(expiredDayAndStatus.getExpiredDay()); |
|
|
|
|
|
other.setStatus(expiredDayAndStatus.getStatus()); |
|
|
other.setReceivePay(receivePay); |
|
|
other.setReceivePay(receivePay); |
|
|
other.setName(bill.getBillAttr()); |
|
|
other.setName(bill.getBillAttr()); |
|
|
other.setComments(bill.getBillAttr()); |
|
|
other.setComments(bill.getBillAttr()); |
|
|
other.setPay(other.getPay() + pay); |
|
|
|
|
|
|
|
|
other.setPay(allPay); |
|
|
other.setOwe(0L); |
|
|
other.setOwe(0L); |
|
|
long owe = other.getReceivePay() - other.getPay(); |
|
|
long owe = other.getReceivePay() - other.getPay(); |
|
|
if (owe > 0) { |
|
|
if (owe > 0) { |
|
|
@@ -1170,24 +1137,13 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
Date date = new Date(); |
|
|
Date date = new Date(); |
|
|
other.setCreatetime(date); |
|
|
other.setCreatetime(date); |
|
|
other.setUpdatetime(date); |
|
|
other.setUpdatetime(date); |
|
|
other.setExpiredDay(0L); |
|
|
|
|
|
other.setOwe(receivePay - pay); |
|
|
other.setOwe(receivePay - pay); |
|
|
other.setIsDel(EnumDelStatus.NOT_DEL.getCode()); |
|
|
other.setIsDel(EnumDelStatus.NOT_DEL.getCode()); |
|
|
other.setStarttime(bill.getStarttime()); |
|
|
other.setStarttime(bill.getStarttime()); |
|
|
other.setEndtime(bill.getEndtime()); |
|
|
other.setEndtime(bill.getEndtime()); |
|
|
if (receivePay <= pay) { |
|
|
|
|
|
other.setStatus(EnumBillRentStatus.PAID.getCode()); |
|
|
|
|
|
} else { |
|
|
|
|
|
Date payDate = other.getPayDate(); |
|
|
|
|
|
Date receiveDate = other.getReceiveDate(); |
|
|
|
|
|
int expiredDay = DateUtils.daysBetween(receiveDate, payDate); |
|
|
|
|
|
if (expiredDay > 0) { |
|
|
|
|
|
other.setStatus(EnumBillRentStatus.NOT_PAID.getCode()); |
|
|
|
|
|
other.setExpiredDay((long) expiredDay); |
|
|
|
|
|
} else { |
|
|
|
|
|
other.setStatus(EnumBillRentStatus.WAIT_PAY.getCode()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
WxBillRent expiredDayAndStatus = getExpiredDayAndStatus(bill.getReceiveDate(), bill.getPayDate(), receivePay, pay, false); |
|
|
|
|
|
other.setExpiredDay(expiredDayAndStatus.getExpiredDay()); |
|
|
|
|
|
other.setStatus(expiredDayAndStatus.getStatus()); |
|
|
wxBillOtherMapper.insertSelective(other); |
|
|
wxBillOtherMapper.insertSelective(other); |
|
|
addActionImport(other.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); |
|
|
addActionImport(other.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); |
|
|
} |
|
|
} |
|
|
@@ -1207,18 +1163,10 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
if (allPay >= receivePay) { |
|
|
if (allPay >= receivePay) { |
|
|
otherDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); |
|
|
otherDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); |
|
|
} else { |
|
|
} else { |
|
|
Date payDate = bill.getPayDate(); |
|
|
|
|
|
Date receiveDate = bill.getReceiveDate(); |
|
|
|
|
|
if (payDate.after(receiveDate)) { |
|
|
|
|
|
int expiredDay = DateUtils.daysBetween(receiveDate, payDate); |
|
|
|
|
|
otherDeposit.setExpiredDay((long) expiredDay); |
|
|
|
|
|
otherDeposit.setStatus(EnumBillRentStatus.NOT_PAID.getCode()); |
|
|
|
|
|
} else { |
|
|
|
|
|
otherDeposit.setStatus(EnumBillRentStatus.WAIT_PAY.getCode()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
otherDeposit.setStatus(EnumBillRentStatus.WAIT_PAY.getCode()); |
|
|
} |
|
|
} |
|
|
otherDeposit.setReceivePay(receivePay); |
|
|
otherDeposit.setReceivePay(receivePay); |
|
|
otherDeposit.setPay(otherDeposit.getPay() + pay); |
|
|
|
|
|
|
|
|
otherDeposit.setPay(allPay); |
|
|
otherDeposit.setOwe(0L); |
|
|
otherDeposit.setOwe(0L); |
|
|
long owe = otherDeposit.getReceivePay() - otherDeposit.getPay(); |
|
|
long owe = otherDeposit.getReceivePay() - otherDeposit.getPay(); |
|
|
if (owe > 0) { |
|
|
if (owe > 0) { |
|
|
@@ -1261,13 +1209,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
if (receivePay <= pay) { |
|
|
if (receivePay <= pay) { |
|
|
otherDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); |
|
|
otherDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); |
|
|
} else { |
|
|
} else { |
|
|
Date payDate = otherDeposit.getPayDate(); |
|
|
|
|
|
Date receiveDate = otherDeposit.getReceiveDate(); |
|
|
|
|
|
int expiredDay = DateUtils.daysBetween(receiveDate, payDate); |
|
|
|
|
|
otherDeposit.setStatus(EnumBillRentStatus.WAIT_PAY.getCode()); |
|
|
otherDeposit.setStatus(EnumBillRentStatus.WAIT_PAY.getCode()); |
|
|
if (expiredDay > 0) { |
|
|
|
|
|
otherDeposit.setExpiredDay((long) expiredDay); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
wxBillOtherDepositMapper.insertSelective(otherDeposit); |
|
|
wxBillOtherDepositMapper.insertSelective(otherDeposit); |
|
|
addActionImport(otherDeposit.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); |
|
|
addActionImport(otherDeposit.getId(), bill.getPayWay(), bill.getPayDate(), user, bill.getPayStr()); |
|
|
@@ -1281,6 +1223,40 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
stringRedisTemplate.expire(importKey, 10, TimeUnit.SECONDS); |
|
|
stringRedisTemplate.expire(importKey, 10, TimeUnit.SECONDS); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public WxBillRent getExpiredDayAndStatus(Date startDate, Date endDate, Long owe, Long pay, boolean flag) { |
|
|
|
|
|
WxBillRent rent = new WxBillRent(); |
|
|
|
|
|
rent.setExpiredDay(0L); |
|
|
|
|
|
if (owe <= pay) { |
|
|
|
|
|
rent.setStatus(EnumBillRentStatus.PAID.getCode()); |
|
|
|
|
|
int expiredDay = DateUtils.daysBetween(startDate, endDate); |
|
|
|
|
|
int timePeriod = 0; |
|
|
|
|
|
if (expiredDay > timePeriod) { |
|
|
|
|
|
rent.setExpiredDay((long) expiredDay); |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
Date now = new Date(); |
|
|
|
|
|
int day = DateUtils.daysBetween(startDate, now); |
|
|
|
|
|
int timePeriod = 0; |
|
|
|
|
|
if (day < timePeriod) { |
|
|
|
|
|
rent.setStatus(EnumBillRentStatus.NOT_PAID.getCode()); |
|
|
|
|
|
long expiredDay = Long.valueOf(Math.abs(day)); |
|
|
|
|
|
rent.setExpiredDay(expiredDay); |
|
|
|
|
|
} else { |
|
|
|
|
|
if (flag) { |
|
|
|
|
|
timePeriod = 30; |
|
|
|
|
|
if (day > timePeriod) { |
|
|
|
|
|
rent.setStatus(EnumBillRentStatus.NOT_EXPIRED.getCode()); |
|
|
|
|
|
} else { |
|
|
|
|
|
rent.setStatus(EnumBillRentStatus.WAIT_PAY.getCode()); |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
rent.setStatus(EnumBillRentStatus.WAIT_PAY.getCode()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return rent; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void importBill(String tenantId, String importKey, WxBillExcelTemplate bill, MallUserInfo user) { |
|
|
public void importBill(String tenantId, String importKey, WxBillExcelTemplate bill, MallUserInfo user) { |
|
|
//租金 |
|
|
//租金 |
|
|
@@ -1300,20 +1276,9 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
WxBillRent rent = wxBillRentMapper.selectBillOne(rentQuery); |
|
|
WxBillRent rent = wxBillRentMapper.selectBillOne(rentQuery); |
|
|
if (rent != null && !rent.getStatus().equals(EnumBillRentStatus.PAID.getCode())) { |
|
|
if (rent != null && !rent.getStatus().equals(EnumBillRentStatus.PAID.getCode())) { |
|
|
long pay = new BigDecimal(bill.getPayStr()).multiply(new BigDecimal(100)).longValueExact(); |
|
|
long pay = new BigDecimal(bill.getPayStr()).multiply(new BigDecimal(100)).longValueExact(); |
|
|
rent.setExpiredDay(0L); |
|
|
|
|
|
if (rent.getOwe() <= pay) { |
|
|
|
|
|
rent.setStatus(EnumBillRentStatus.PAID.getCode()); |
|
|
|
|
|
} else { |
|
|
|
|
|
Date payDate = bill.getPayDate(); |
|
|
|
|
|
Date receiveDate = bill.getReceiveDate(); |
|
|
|
|
|
if (payDate.after(receiveDate)) { |
|
|
|
|
|
int expiredDay = DateUtils.daysBetween(receiveDate, payDate); |
|
|
|
|
|
rent.setExpiredDay((long) expiredDay); |
|
|
|
|
|
rent.setStatus(EnumBillRentStatus.NOT_PAID.getCode()); |
|
|
|
|
|
} else { |
|
|
|
|
|
rent.setStatus(EnumBillRentStatus.WAIT_PAY.getCode()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
WxBillRent expiredDayAndStatus = getExpiredDayAndStatus(bill.getReceiveDate(), bill.getPayDate(), rent.getOwe(), pay, true); |
|
|
|
|
|
rent.setExpiredDay(expiredDayAndStatus.getExpiredDay()); |
|
|
|
|
|
rent.setStatus(expiredDayAndStatus.getStatus()); |
|
|
rent.setPay(rent.getPay() + pay); |
|
|
rent.setPay(rent.getPay() + pay); |
|
|
rent.setOwe(rent.getOwe() - pay); |
|
|
rent.setOwe(rent.getOwe() - pay); |
|
|
rent.setPayDate(bill.getPayDate()); |
|
|
rent.setPayDate(bill.getPayDate()); |
|
|
@@ -1336,20 +1301,9 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
WxBillProperty property = wxBillPropertyMapper.selectBillOne(propertyQuery); |
|
|
WxBillProperty property = wxBillPropertyMapper.selectBillOne(propertyQuery); |
|
|
if (property != null && !property.getStatus().equals(EnumBillRentStatus.PAID.getCode())) { |
|
|
if (property != null && !property.getStatus().equals(EnumBillRentStatus.PAID.getCode())) { |
|
|
long pay = new BigDecimal(bill.getPayStr()).multiply(new BigDecimal(100)).longValueExact(); |
|
|
long pay = new BigDecimal(bill.getPayStr()).multiply(new BigDecimal(100)).longValueExact(); |
|
|
property.setExpiredDay(0L); |
|
|
|
|
|
if (property.getOwe() <= pay) { |
|
|
|
|
|
property.setStatus(EnumBillRentStatus.PAID.getCode()); |
|
|
|
|
|
} else { |
|
|
|
|
|
Date payDate = bill.getPayDate(); |
|
|
|
|
|
Date receiveDate = bill.getReceiveDate(); |
|
|
|
|
|
if (payDate.after(receiveDate)) { |
|
|
|
|
|
int expiredDay = DateUtils.daysBetween(receiveDate, payDate); |
|
|
|
|
|
property.setExpiredDay((long) expiredDay); |
|
|
|
|
|
property.setStatus(EnumBillRentStatus.NOT_PAID.getCode()); |
|
|
|
|
|
} else { |
|
|
|
|
|
property.setStatus(EnumBillRentStatus.WAIT_PAY.getCode()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
WxBillRent expiredDayAndStatus = getExpiredDayAndStatus(bill.getReceiveDate(), bill.getPayDate(), property.getOwe(), pay, true); |
|
|
|
|
|
property.setExpiredDay(expiredDayAndStatus.getExpiredDay()); |
|
|
|
|
|
property.setStatus(expiredDayAndStatus.getStatus()); |
|
|
property.setPay(property.getPay() + pay); |
|
|
property.setPay(property.getPay() + pay); |
|
|
property.setOwe(property.getOwe() - pay); |
|
|
property.setOwe(property.getOwe() - pay); |
|
|
property.setPayDate(bill.getPayDate()); |
|
|
property.setPayDate(bill.getPayDate()); |
|
|
@@ -1426,7 +1380,9 @@ public class WxBillAllServiceImpl implements WxBillAllService { |
|
|
for (Map<String, Object> bill:mapList) { |
|
|
for (Map<String, Object> bill:mapList) { |
|
|
Long merchantId = (Long)bill.get("merchantId"); |
|
|
Long merchantId = (Long)bill.get("merchantId"); |
|
|
List<Map<String, Object>> currList = result.get(merchantId); |
|
|
List<Map<String, Object>> currList = result.get(merchantId); |
|
|
if(currList == null) currList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
if (currList == null) { |
|
|
|
|
|
currList = new ArrayList<>(); |
|
|
|
|
|
} |
|
|
currList.add(bill); |
|
|
currList.add(bill); |
|
|
result.put(merchantId,currList); |
|
|
result.put(merchantId,currList); |
|
|
} |
|
|
} |
|
|
|