| | |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.time.Duration; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | |
| | | private String carNum; |
| | | private TChargingOrder tChargingOrder; |
| | | private Long periodCount; |
| | | private String timeCount; |
| | | public String calculateDuration() { |
| | | if (startTime == null || endTime == null) { |
| | | return "00:00:00"; |
| | | } |
| | | |
| | | Duration duration = Duration.between(startTime, endTime); |
| | | long totalSeconds = duration.getSeconds(); |
| | | long hours = totalSeconds / 3600; |
| | | long minutes = (totalSeconds % 3600) / 60; |
| | | long seconds = totalSeconds % 60; |
| | | |
| | | return String.format("%02d:%02d:%02d", hours, minutes, seconds); |
| | | } |
| | | } |