|
@@ -16,6 +16,7 @@ import org.jeecg.modules.business.service.IBusCustomerService;
|
|
|
import org.jeecg.modules.business.service.IBusRoomBookingOrdersService;
|
|
import org.jeecg.modules.business.service.IBusRoomBookingOrdersService;
|
|
|
import org.jeecg.modules.business.vo.BookingBatchRoomsVo;
|
|
import org.jeecg.modules.business.vo.BookingBatchRoomsVo;
|
|
|
import org.jeecg.modules.business.vo.BookingOrderEditVo;
|
|
import org.jeecg.modules.business.vo.BookingOrderEditVo;
|
|
|
|
|
+import org.jeecg.modules.business.vo.ExtendBusBookingRoomsVo;
|
|
|
import org.jeecg.modules.rooms.service.CesRoomsServiceImpl;
|
|
import org.jeecg.modules.rooms.service.CesRoomsServiceImpl;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -134,14 +135,30 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
String bookingId = item.getOrderInfo().getId();
|
|
String bookingId = item.getOrderInfo().getId();
|
|
|
// todo 判定是否有安排冲突的房间
|
|
// todo 判定是否有安排冲突的房间
|
|
|
List<BusBookingRooms> bookingRooms = new ArrayList<>();
|
|
List<BusBookingRooms> bookingRooms = new ArrayList<>();
|
|
|
|
|
+ long mainCount = item.getRoomIds().stream().filter(t->t.getIsMain()!=null&&t.getIsMain()).count();
|
|
|
|
|
+
|
|
|
item.getRoomIds().forEach(c->{
|
|
item.getRoomIds().forEach(c->{
|
|
|
|
|
+
|
|
|
BusBookingRooms bookingRoomsItem = new BusBookingRooms();
|
|
BusBookingRooms bookingRoomsItem = new BusBookingRooms();
|
|
|
bookingRoomsItem.setBookingOrdersId(bookingId);
|
|
bookingRoomsItem.setBookingOrdersId(bookingId);
|
|
|
|
|
+ if(c.getRoomId() != null && !c.getRoomId().isEmpty()){
|
|
|
|
|
+ bookingRoomsItem.setRoomStatus(1);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ bookingRoomsItem.setRoomStatus(2);
|
|
|
|
|
+ }
|
|
|
|
|
+ if(mainCount != 1) {
|
|
|
|
|
+ bookingRoomsItem.setIsMain(false);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ bookingRoomsItem.setIsMain(c.getIsMain());
|
|
|
|
|
+ }
|
|
|
bookingRoomsItem.setRoomId(c.getRoomId());
|
|
bookingRoomsItem.setRoomId(c.getRoomId());
|
|
|
bookingRoomsItem.setRoomLayoutId(c.getLayoutId());
|
|
bookingRoomsItem.setRoomLayoutId(c.getLayoutId());
|
|
|
bookingRoomsItem.setBookingType(1);
|
|
bookingRoomsItem.setBookingType(1);
|
|
|
bookingRooms.add(bookingRoomsItem);
|
|
bookingRooms.add(bookingRoomsItem);
|
|
|
});
|
|
});
|
|
|
|
|
+ if(mainCount != 1) {
|
|
|
|
|
+ bookingRooms.get(0).setIsMain(true);
|
|
|
|
|
+ }
|
|
|
bookingRoomsService.saveBatch(bookingRooms);
|
|
bookingRoomsService.saveBatch(bookingRooms);
|
|
|
|
|
|
|
|
// 处理预定每天的房型价格 Start
|
|
// 处理预定每天的房型价格 Start
|
|
@@ -156,9 +173,6 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
dayPriceService.saveBatch(item.getLayoutDayPrices());
|
|
dayPriceService.saveBatch(item.getLayoutDayPrices());
|
|
|
// 处理预定每天的房型价格 End
|
|
// 处理预定每天的房型价格 End
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
return item.getOrderInfo().getBookingOrdersNo();
|
|
return item.getOrderInfo().getBookingOrdersNo();
|
|
|
// 团队预定
|
|
// 团队预定
|
|
|
} else if(item.getOrderInfo().getBookingOrdersType().equals(BookingOrdersType.TEAM.getKey())) {
|
|
} else if(item.getOrderInfo().getBookingOrdersType().equals(BookingOrdersType.TEAM.getKey())) {
|
|
@@ -187,15 +201,29 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
BusBookingBatch batchItem = copyBatchToBase(c);
|
|
BusBookingBatch batchItem = copyBatchToBase(c);
|
|
|
bookingBatchService.save(batchItem);
|
|
bookingBatchService.save(batchItem);
|
|
|
List<BusBookingRooms> batchBookingRooms = new ArrayList<>();
|
|
List<BusBookingRooms> batchBookingRooms = new ArrayList<>();
|
|
|
|
|
+ long mainCount = c.getRoomIds().stream().filter(t->t.getIsMain()!=null&&t.getIsMain()).count();
|
|
|
c.getRoomIds().forEach(s-> {
|
|
c.getRoomIds().forEach(s-> {
|
|
|
BusBookingRooms bookingRoomItem = new BusBookingRooms();
|
|
BusBookingRooms bookingRoomItem = new BusBookingRooms();
|
|
|
bookingRoomItem.setRoomId(s.getRoomId());
|
|
bookingRoomItem.setRoomId(s.getRoomId());
|
|
|
bookingRoomItem.setRoomLayoutId(s.getLayoutId());
|
|
bookingRoomItem.setRoomLayoutId(s.getLayoutId());
|
|
|
|
|
+ if(s.getRoomId() != null && !s.getRoomId().isEmpty()){
|
|
|
|
|
+ bookingRoomItem.setRoomStatus(1);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ bookingRoomItem.setRoomStatus(2);
|
|
|
|
|
+ }
|
|
|
|
|
+ if(mainCount != 1) {
|
|
|
|
|
+ bookingRoomItem.setIsMain(false);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ bookingRoomItem.setIsMain(s.getIsMain());
|
|
|
|
|
+ }
|
|
|
bookingRoomItem.setBookingType(2);
|
|
bookingRoomItem.setBookingType(2);
|
|
|
bookingRoomItem.setBookingBatchId(batchItem.getId());
|
|
bookingRoomItem.setBookingBatchId(batchItem.getId());
|
|
|
bookingRoomItem.setBookingOrdersId(item.getOrderInfo().getId());
|
|
bookingRoomItem.setBookingOrdersId(item.getOrderInfo().getId());
|
|
|
batchBookingRooms.add(bookingRoomItem);
|
|
batchBookingRooms.add(bookingRoomItem);
|
|
|
});
|
|
});
|
|
|
|
|
+ if(mainCount != 1) {
|
|
|
|
|
+ batchBookingRooms.get(0).setIsMain(true);
|
|
|
|
|
+ }
|
|
|
bookingRoomsService.saveBatch(batchBookingRooms);
|
|
bookingRoomsService.saveBatch(batchBookingRooms);
|
|
|
// 以上处理批次关联的房间
|
|
// 以上处理批次关联的房间
|
|
|
|
|
|
|
@@ -235,9 +263,13 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
orderId = orderInfo.getId();
|
|
orderId = orderInfo.getId();
|
|
|
BookingOrderEditVo result = new BookingOrderEditVo();
|
|
BookingOrderEditVo result = new BookingOrderEditVo();
|
|
|
if(orderInfo.getBookingOrdersType().equals(BookingOrdersType.NORMAL.getKey())) {
|
|
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()));
|
|
|
|
|
|
|
+ List<ExtendBusBookingRoomsVo> bookingRooms = bookingRoomsService.bookingRooms(orderId,BookingOrdersType.NORMAL.getKey());
|
|
|
|
|
+ List<BusBookingLayoutDayPrice> layoutDayPrices = dayPriceService.list(Wrappers.<BusBookingLayoutDayPrice>query()
|
|
|
|
|
+ .eq("booking_order_id",orderId));
|
|
|
|
|
+ bookingRooms.forEach(s->{
|
|
|
|
|
+ List<BusBookingLayoutDayPrice> findLayoutPrice = layoutDayPrices.stream().filter(a->a.getRoomLayoutId().equals(s.getRoomLayoutId())).collect(Collectors.toList());
|
|
|
|
|
+ s.setLayoutDayPrices(findLayoutPrice);
|
|
|
|
|
+ });
|
|
|
result.setRoomIds(bookingRooms);
|
|
result.setRoomIds(bookingRooms);
|
|
|
} else if(orderInfo.getBookingOrdersType().equals(BookingOrdersType.TEAM.getKey())) {
|
|
} else if(orderInfo.getBookingOrdersType().equals(BookingOrdersType.TEAM.getKey())) {
|
|
|
List<BusBookingBatch> batches = bookingBatchService.list(Wrappers.<BusBookingBatch>query().eq("booking_orders_id",orderId));
|
|
List<BusBookingBatch> batches = bookingBatchService.list(Wrappers.<BusBookingBatch>query().eq("booking_orders_id",orderId));
|
|
@@ -246,15 +278,18 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
batchesVo.add(copyBaseToBatch(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<ExtendBusBookingRoomsVo> batchRooms = bookingRoomsService.bookingRooms(orderId,BookingOrdersType.TEAM.getKey());
|
|
|
List<BusBookingLayoutDayPrice> layoutDayPrices = dayPriceService.list(Wrappers.<BusBookingLayoutDayPrice>query()
|
|
List<BusBookingLayoutDayPrice> layoutDayPrices = dayPriceService.list(Wrappers.<BusBookingLayoutDayPrice>query()
|
|
|
.eq("booking_order_id",orderId)
|
|
.eq("booking_order_id",orderId)
|
|
|
.eq("booking_type",BookingOrdersType.TEAM.getKey()));
|
|
.eq("booking_type",BookingOrdersType.TEAM.getKey()));
|
|
|
batchesVo.forEach(s->{
|
|
batchesVo.forEach(s->{
|
|
|
- List<BusBookingRooms> findRooms = batchRooms.stream().filter(a->a.getBookingBatchId().equals(s.getId())).collect(Collectors.toList());
|
|
|
|
|
|
|
+ List<ExtendBusBookingRoomsVo> 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());
|
|
List<BusBookingLayoutDayPrice> findDayPrice = layoutDayPrices.stream().filter(a->a.getBatchId().equals(s.getId())).collect(Collectors.toList());
|
|
|
- s.setLayoutDayPrices(findDayPrice);
|
|
|
|
|
|
|
+ findRooms.forEach(f->{
|
|
|
|
|
+ List<BusBookingLayoutDayPrice> batchPriceOfLayout = findDayPrice.stream().filter(i->i.getRoomLayoutId().equals(f.getRoomLayoutId())).collect(Collectors.toList());
|
|
|
|
|
+ f.setLayoutDayPrices(batchPriceOfLayout);
|
|
|
|
|
+ });
|
|
|
|
|
+// s.setLayoutDayPrices(findDayPrice);
|
|
|
s.setRoomIds(findRooms);
|
|
s.setRoomIds(findRooms);
|
|
|
});
|
|
});
|
|
|
result.setBatchRooms(batchesVo);
|
|
result.setBatchRooms(batchesVo);
|
|
@@ -348,7 +383,30 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
bookingRoomsService.remove(Wrappers.<BusBookingRooms>query().eq("booking_orders_id", item.getOrderInfo().getId()));
|
|
bookingRoomsService.remove(Wrappers.<BusBookingRooms>query().eq("booking_orders_id", item.getOrderInfo().getId()));
|
|
|
bookingBatchService.remove(Wrappers.<BusBookingBatch>query().eq("booking_orders_id",item.getOrderInfo().getId()));
|
|
bookingBatchService.remove(Wrappers.<BusBookingBatch>query().eq("booking_orders_id",item.getOrderInfo().getId()));
|
|
|
dayPriceService.remove(Wrappers.<BusBookingLayoutDayPrice>query().eq("booking_order_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();
|
|
|
|
|
+ item.getRoomIds().forEach(c->{
|
|
|
|
|
+ BusBookingRooms bookingRoomsItem = new BusBookingRooms();
|
|
|
|
|
+ bookingRoomsItem.setBookingOrdersId(bookingId);
|
|
|
|
|
+ if(c.getRoomId() != null && !c.getRoomId().isEmpty()){
|
|
|
|
|
+ bookingRoomsItem.setRoomStatus(1);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ bookingRoomsItem.setRoomStatus(2);
|
|
|
|
|
+ }
|
|
|
|
|
+ if(mainCount != 1) {
|
|
|
|
|
+ bookingRoomsItem.setIsMain(false);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ bookingRoomsItem.setIsMain(c.getIsMain());
|
|
|
|
|
+ }
|
|
|
|
|
+ bookingRoomsItem.setRoomId(c.getRoomId());
|
|
|
|
|
+ bookingRoomsItem.setRoomLayoutId(c.getRoomLayoutId());
|
|
|
|
|
+ bookingRoomsItem.setBookingType(1);
|
|
|
|
|
+ bookingRooms.add(bookingRoomsItem);
|
|
|
|
|
+ });
|
|
|
|
|
+ if(mainCount != 1) {
|
|
|
|
|
+ bookingRooms.get(0).setIsMain(true);
|
|
|
|
|
+ }
|
|
|
|
|
+ bookingRoomsService.saveBatch(bookingRooms);
|
|
|
// 处理预定每天的房型价格 Start
|
|
// 处理预定每天的房型价格 Start
|
|
|
if(item.getLayoutDayPrices() == null || item.getLayoutDayPrices().size() == 0)
|
|
if(item.getLayoutDayPrices() == null || item.getLayoutDayPrices().size() == 0)
|
|
|
throw new JeecgBootException("参数错误,对应房型当天价格必传");
|
|
throw new JeecgBootException("参数错误,对应房型当天价格必传");
|
|
@@ -393,15 +451,29 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
BusBookingBatch batchItem = c;
|
|
BusBookingBatch batchItem = c;
|
|
|
bookingBatchService.save(batchItem);
|
|
bookingBatchService.save(batchItem);
|
|
|
List<BusBookingRooms> batchBookingRooms = new ArrayList<>();
|
|
List<BusBookingRooms> batchBookingRooms = new ArrayList<>();
|
|
|
|
|
+ long mainCount = c.getRoomIds().stream().filter(t->t.getIsMain()!=null&&t.getIsMain()).count();
|
|
|
c.getRoomIds().forEach(s-> {
|
|
c.getRoomIds().forEach(s-> {
|
|
|
BusBookingRooms bookingRoomItem = new BusBookingRooms();
|
|
BusBookingRooms bookingRoomItem = new BusBookingRooms();
|
|
|
bookingRoomItem.setRoomId(s.getRoomId());
|
|
bookingRoomItem.setRoomId(s.getRoomId());
|
|
|
|
|
+ if(s.getRoomId() != null && !s.getRoomId().isEmpty()){
|
|
|
|
|
+ bookingRoomItem.setRoomStatus(1); // 未排房
|
|
|
|
|
+ } else {
|
|
|
|
|
+ bookingRoomItem.setRoomStatus(2); // 已排房
|
|
|
|
|
+ }
|
|
|
|
|
+ if(mainCount != 1) {
|
|
|
|
|
+ bookingRoomItem.setIsMain(false);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ bookingRoomItem.setIsMain(s.getIsMain());
|
|
|
|
|
+ }
|
|
|
bookingRoomItem.setRoomLayoutId(s.getRoomLayoutId());
|
|
bookingRoomItem.setRoomLayoutId(s.getRoomLayoutId());
|
|
|
bookingRoomItem.setBookingType(2);
|
|
bookingRoomItem.setBookingType(2);
|
|
|
bookingRoomItem.setBookingBatchId(batchItem.getId());
|
|
bookingRoomItem.setBookingBatchId(batchItem.getId());
|
|
|
bookingRoomItem.setBookingOrdersId(item.getOrderInfo().getId());
|
|
bookingRoomItem.setBookingOrdersId(item.getOrderInfo().getId());
|
|
|
batchBookingRooms.add(bookingRoomItem);
|
|
batchBookingRooms.add(bookingRoomItem);
|
|
|
});
|
|
});
|
|
|
|
|
+ if(mainCount != 1) {
|
|
|
|
|
+ batchBookingRooms.get(0).setIsMain(true);
|
|
|
|
|
+ }
|
|
|
bookingRoomsService.saveBatch(batchBookingRooms);
|
|
bookingRoomsService.saveBatch(batchBookingRooms);
|
|
|
// 以上处理批次关联的房间
|
|
// 以上处理批次关联的房间
|
|
|
|
|
|