Commit 59a63bb4 authored by libin's avatar libin

租车日历价格

parent a889bf19
......@@ -196,7 +196,26 @@ public class VehicleModelCalendarPriceBiz extends BaseBiz<VehicleModelCalendarPr
* @return
*/
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());
}
/**
......
......@@ -73,8 +73,8 @@ public class VehicleModelCalendarPriceController {
@RequestParam(value = "vehicleModelId") Integer vehicleModelId,
AppUserDTO appUserDTO) {
Date startDateDay = DateUtil.beginOfDay(DateUtil.date(startDate));
Date endDateDay = DateUtil.beginOfDay(DateUtil.date(endDate));
Date startDateDay = new Date(startDate);
Date endDateDay = new Date(endDate);
return ObjectRestResponse.succ(vehicleModelCalendarPriceBiz.findVehicleModelCalendarPriceByDateAndVehilceIdAndUserId(startDateDay, endDateDay, vehicleModelId, appUserDTO.getUserid()));
}
......
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