|
|
@@ -1,5 +1,6 @@
|
|
|
package org.jeecg.modules.business.service.impl;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import org.jeecg.common.exception.JeecgBootException;
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
|
@@ -461,12 +462,30 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
updateById(item.getOrderInfo());
|
|
|
String bookingId = item.getOrderInfo().getId();
|
|
|
// todo 判定是否有安排冲突的房间
|
|
|
- bookingRoomsService.remove(Wrappers.<BusBookingRooms>query().eq("booking_orders_id", item.getOrderInfo().getId()));
|
|
|
+
|
|
|
+
|
|
|
+ //这里不能直接删除 先查询预订单有没有入住记录,如果房间有入住,那么入住过的记录则不能删除
|
|
|
+ List<BusRoomsLivingOrder> bookingLivings = roomsLivingOrderService.list(Wrappers.<BusRoomsLivingOrder>query()
|
|
|
+ .eq("booking_order_id",item.getOrderInfo().getId()));
|
|
|
+ // 先找到已定的房间ROOMID
|
|
|
+ List<String> livingRoomIds = new ArrayList<>();
|
|
|
+ QueryWrapper bookingRoomDelWrapper = Wrappers.<BusBookingRooms>query()
|
|
|
+ .eq("booking_orders_id", item.getOrderInfo().getId());
|
|
|
+ if(bookingLivings.size() > 0) {
|
|
|
+ bookingRoomDelWrapper.notIn("id",bookingLivings.stream().map(g->g.getBookingRoomId()).collect(Collectors.toList()));
|
|
|
+ livingRoomIds = bookingRoomsService.list(Wrappers.<BusBookingRooms>query().in("id",bookingLivings.stream().map(g->g.getBookingRoomId()).collect(Collectors.toList())))
|
|
|
+ .stream().map(g->g.getRoomId()).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
+ bookingRoomsService.remove(bookingRoomDelWrapper); // 这里将不会影响入住的房间
|
|
|
bookingBatchService.remove(Wrappers.<BusBookingBatch>query().eq("booking_orders_id",item.getOrderInfo().getId()));
|
|
|
dayPriceService.remove(Wrappers.<BusBookingLayoutDayPrice>query().eq("booking_order_id",item.getOrderInfo().getId()));
|
|
|
List<BusBookingRooms> bookingRooms = new ArrayList<>();
|
|
|
long mainCount = item.getRoomIds().stream().filter(t->t.getIsMain()!=null&&t.getIsMain()).count();
|
|
|
+ List<String> finalLivingRoomIds = livingRoomIds;
|
|
|
item.getRoomIds().forEach(c->{
|
|
|
+ // 如果有房间入住了 就不添加了
|
|
|
+ if(finalLivingRoomIds.contains(c.getRoomId())) return;
|
|
|
BusBookingRooms bookingRoomsItem = new BusBookingRooms();
|
|
|
bookingRoomsItem.setBookingOrdersId(bookingId);
|
|
|
if(c.getRoomId() != null && !c.getRoomId().isEmpty()){
|