Commit 075be5f7 authored by libin's avatar libin

Merge branch 'holiday-price' into dev

parents 5defc385 59a63bb4
...@@ -196,7 +196,26 @@ public class VehicleModelCalendarPriceBiz extends BaseBiz<VehicleModelCalendarPr ...@@ -196,7 +196,26 @@ public class VehicleModelCalendarPriceBiz extends BaseBiz<VehicleModelCalendarPr
* @return * @return
*/ */
public List<VehicleModelCalendarPriceDTO> findVehicleModelCalendarPriceByDateAndVehilceIdAndUserId(Date startDate, Date endDate, Integer vehicleModelId, Integer userId) { public List<VehicleModelCalendarPriceDTO> findVehicleModelCalendarPriceByDateAndVehilceIdAndUserId(Date startDate, Date endDate, Integer vehicleModelId, Integer userId) {
return findVehicleModelCalendarPrice(startDate, endDate, vehicleModelId, userId); LocalDate startLocalDate = DateUtils.dateToLocalDate(startDate);
LocalDate endLocalDate = DateUtils.dateToLocalDate(endDate);
Integer days = getIncludeDays(startDate.getTime(), endDate.getTime());
boolean isSelect = false;
List<VehicleModelCalendarPriceDTO> vehicleModelCalendarPrice = findVehicleModelCalendarPrice(startDate,endDate, vehicleModelId, userId);
for (int i = 0, y = 0; i < vehicleModelCalendarPrice.size(); i++) {
VehicleModelCalendarPriceDTO vehicleModelCalendarPriceDTO = vehicleModelCalendarPrice.get(i);
LocalDate current_date = DateUtils.dateToLocalDate(vehicleModelCalendarPriceDTO.getDate());
if (y == 0) {
isSelect = (current_date.isAfter(startLocalDate) && current_date.isBefore(endLocalDate)) || current_date.isEqual(startLocalDate) || current_date.isEqual(endLocalDate);
}
if (isSelect) {
if (y < days) {
vehicleModelCalendarPriceDTO.setIsSelect(isSelect ? true : false);
y++;
}
}
}
return vehicleModelCalendarPrice.stream().filter(x->Objects.nonNull(x.getIsSelect())).collect(Collectors.toList());
} }
/** /**
......
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