|
|
@@ -1,11 +1,13 @@
|
|
|
package org.jeecg.modules.business.service.impl;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import org.jeecg.common.exception.JeecgBootException;
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
|
import org.jeecg.common.util.TokenUtils;
|
|
|
import org.jeecg.modules.business.dto.BookingBatchRoomsDto;
|
|
|
import org.jeecg.modules.business.dto.BookingOrderSaveDto;
|
|
|
import org.jeecg.modules.business.entity.BusBookingBatch;
|
|
|
+import org.jeecg.modules.business.entity.BusBookingLayoutDayPrice;
|
|
|
import org.jeecg.modules.business.entity.BusBookingRooms;
|
|
|
import org.jeecg.modules.business.entity.BusRoomBookingOrders;
|
|
|
import org.jeecg.modules.business.enums.BookingOrdersType;
|
|
|
@@ -14,6 +16,8 @@ import org.jeecg.modules.business.enums.CustomerTypeEnum;
|
|
|
import org.jeecg.modules.business.mapper.BusRoomBookingOrdersMapper;
|
|
|
import org.jeecg.modules.business.service.IBusBookingLayoutDayPriceService;
|
|
|
import org.jeecg.modules.business.service.IBusRoomBookingOrdersService;
|
|
|
+import org.jeecg.modules.business.vo.BookingBatchRoomsVo;
|
|
|
+import org.jeecg.modules.business.vo.BookingOrderEditVo;
|
|
|
import org.jeecg.modules.rooms.service.CesRoomsServiceImpl;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -27,6 +31,7 @@ import java.time.LocalDateTime;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @Description: 酒店预定订单
|
|
|
@@ -186,6 +191,46 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
throw new JeecgBootException("参数错误");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过id获取预约单详情
|
|
|
+ * @param orderId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public BookingOrderEditVo getBookingInfoById(String orderId) {
|
|
|
+ BusRoomBookingOrders orderInfo = getById(orderId);
|
|
|
+ if(orderInfo == null) throw new JeecgBootException("预约单不存在");
|
|
|
+ BookingOrderEditVo result = new BookingOrderEditVo();
|
|
|
+ if(orderInfo.getBookingOrdersType().equals(BookingOrdersType.NORMAL.getKey())) {
|
|
|
+ List<BusBookingRooms> bookingRooms = bookingRoomsService.list(Wrappers.<BusBookingRooms>query()
|
|
|
+ .eq("booking_orders_id",orderId)
|
|
|
+ .eq("booking_type",BookingOrdersType.NORMAL.getKey()));
|
|
|
+ result.setRoomIds(bookingRooms);
|
|
|
+ } else if(orderInfo.getBookingOrdersType().equals(BookingOrdersType.TEAM.getKey())) {
|
|
|
+ List<BusBookingBatch> batches = bookingBatchService.list(Wrappers.<BusBookingBatch>query().eq("booking_orders_id",orderId));
|
|
|
+ List<BookingBatchRoomsVo> batchesVo = new ArrayList<>();
|
|
|
+ batches.forEach(s->{
|
|
|
+ batchesVo.add(copyBaseToBatch(s));
|
|
|
+ });
|
|
|
+
|
|
|
+ List<BusBookingRooms> batchRooms = bookingRoomsService.list(Wrappers.<BusBookingRooms>query()
|
|
|
+ .eq("booking_orders_id",orderId).eq("booking_type",BookingOrdersType.TEAM.getKey()));
|
|
|
+ List<BusBookingLayoutDayPrice> layoutDayPrices = dayPriceService.list(Wrappers.<BusBookingLayoutDayPrice>query()
|
|
|
+ .eq("booking_order_id",orderId)
|
|
|
+ .eq("booking_type",BookingOrdersType.TEAM.getKey()));
|
|
|
+ batchesVo.forEach(s->{
|
|
|
+ List<BusBookingRooms> findRooms = batchRooms.stream().filter(a->a.getBookingBatchId().equals(s.getId())).collect(Collectors.toList());
|
|
|
+ List<BusBookingLayoutDayPrice> findDayPrice = layoutDayPrices.stream().filter(a->a.getBatchId().equals(s.getId())).collect(Collectors.toList());
|
|
|
+ s.setLayoutDayPrices(findDayPrice);
|
|
|
+ s.setRoomIds(findRooms);
|
|
|
+ });
|
|
|
+ result.setBatchRooms(batchesVo);
|
|
|
+ }
|
|
|
+ result.setOrderInfo(orderInfo);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
private BusBookingBatch copyBatchToBase(BookingBatchRoomsDto data) {
|
|
|
BusBookingBatch batch = new BookingBatchRoomsDto();
|
|
|
batch.setBatchNo(data.getBatchNo());
|
|
|
@@ -195,4 +240,14 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
batch.setDayCount(data.getDayCount());
|
|
|
return batch;
|
|
|
}
|
|
|
+
|
|
|
+ private BookingBatchRoomsVo copyBaseToBatch(BusBookingBatch data) {
|
|
|
+ BookingBatchRoomsVo batch = new BookingBatchRoomsVo();
|
|
|
+ batch.setBatchNo(data.getBatchNo());
|
|
|
+ batch.setBookingOrdersId(data.getBookingOrdersId());
|
|
|
+ batch.setArrivalTime(data.getArrivalTime());
|
|
|
+ batch.setDueOutTime(data.getDueOutTime());
|
|
|
+ batch.setDayCount(data.getDayCount());
|
|
|
+ return batch;
|
|
|
+ }
|
|
|
}
|