计算时租预计还车时间

This commit is contained in:
2025-09-30 11:33:02 +08:00
parent d627e9ed42
commit 151898fdac

View File

@ -62,8 +62,10 @@ public class OrderUtil {
public static Integer getOrderOverdueHours(LocalDateTime endRentTime) {
if(endRentTime!=null){
LocalDateTime now = LocalDateTime.now();
log.info("计算时租逾期小时数,预计还车时间:{}, 当前时间 : {}", endRentTime, now);
if(now.isAfter(endRentTime)){
return (int) ChronoUnit.HOURS.between(endRentTime, now);
int hours = (int) ChronoUnit.HOURS.between(endRentTime, now);
return hours == 0 ? 1 : hours;
}
}
return 0;