浏览代码

离场时间

guoshuai 1 月之前
父节点
当前提交
24d6fe29af
共有 1 个文件被更改,包括 9 次插入0 次删除
  1. 9 0
      src/main/java/com/qmrb/system/service/impl/CarParkChargingRulesServiceImpl.java

+ 9 - 0
src/main/java/com/qmrb/system/service/impl/CarParkChargingRulesServiceImpl.java

@@ -159,6 +159,15 @@ public class CarParkChargingRulesServiceImpl extends ServiceImpl<CarParkCharging
 		ParkingFeeCalculator.ParkingRecord parkingRecord = new ParkingFeeCalculator.ParkingRecord();
 		parkingRecord.entryTime = inDateTime;
 		parkingRecord.exitTime = LocalDateTime.now();
+		if(barnRecord.getOutTime()!=null){
+			// 将 Date 转换为 Instant
+			Instant outInstant = barnRecord.getInTime().toInstant();
+
+			// 将 Instant 转换为 LocalDateTime(假设使用系统默认时区)
+			LocalDateTime outDateTime = outInstant.atZone(ZoneId.systemDefault()).toLocalDateTime();
+			parkingRecord.exitTime = outDateTime;
+		}
+		
 		parkingRecord.paidAmount = barnRecord.getReceivedAmount()!= null ? barnRecord.getReceivedAmount().doubleValue() : 0;;//已支付金额
 		
 		if(CollectionUtil.isNotEmpty(orderList)){