Commit d514f71c authored by 周健威's avatar 周健威

Merge branch 'master-vehicle-price' into dev-tiande

parents 72e800ae 1a63c879
......@@ -127,6 +127,12 @@ public class AddRentVehicleDTO extends AddOrderCommonDTO{
@ApiModelProperty(value = "车辆id")
private String vehicleId;
@ApiModelProperty(value = "商品类型 1--房车;2--机车;3--游艇")
private Integer goodsType = 1;
@ApiModelProperty(value = "小时数")
private Integer hourNum;
public void setStartTime(Long startTime) {
this.startTime = startTime;
this.bookStartDate = YMR_SLASH_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(startTime), ZoneOffset.ofHours(8)));
......
......@@ -105,6 +105,7 @@ public class OrderRentVehicleBiz extends BaseBiz<OrderRentVehicleDetailMapper, O
public RentVehicleBO initRentVehicleBO(AddRentVehicleDTO vo) {
//计算天数
vo.setDayNum(orderCalculateBiz.getIncludeDays(vo.getStartTime(), vo.getEndTime()));
vo.setHourNum(orderCalculateBiz.getIncludeHours(vo.getStartTime(), vo.getEndTime()));
if(null == vo.getEndCompanyId() || vo.getEndCompanyId().equals(0)) {
if(StrUtil.isBlank(vo.getEndAddr())) {
......
......@@ -384,6 +384,40 @@ public class OrderCalculateBiz {
return bookDays;
}
/**
* 计算包含多少小时
* @param startLong
* @param endLong
* @return
*/
public Integer getIncludeHours(Long startLong, Long endLong) {
Map<String, Dictionary> dictionaryMap = thirdFeign.dictionaryGetAll4Map().getData();
Long hourLong = (60L * 60L * 1000L);
//Long dayLong = hourLong * 24;
Long bufferLong = 0L;
//计算:使用天数 当前时间 - 开始时间的0时0分0秒
Long bookTimeLag = endLong - startLong;
//默认 已使用了1小时
if(bookTimeLag <= 0) {
return 1;
}
log.info("bookTimeLag {}", new BigDecimal(bookTimeLag + ""));
log.info("divide {}", new BigDecimal(hourLong+ ""));
Integer hourDays = new BigDecimal(bookTimeLag + "").divide(new BigDecimal(hourLong+ ""), 0, RoundingMode.DOWN).intValue();
Long excess = bookTimeLag%hourLong;
if(excess > bufferLong) {
hourDays += 1;
}
if(0 == hourDays) {
hourDays = 1;
}
return hourDays;
}
public OrderRefundPriceVO getPriceCalculate (String no, OrderPageVO orderPageVO) {
//根据no 查订单
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment