|
|
@@ -8,6 +8,7 @@ import org.jeecg.modules.business.dto.BookingBatchRoomsDto;
|
|
|
import org.jeecg.modules.business.dto.BookingOrderSaveDto;
|
|
|
import org.jeecg.modules.business.entity.*;
|
|
|
import org.jeecg.modules.business.enums.BookingOrdersType;
|
|
|
+import org.jeecg.modules.business.enums.BookingStatusTypeEnum;
|
|
|
import org.jeecg.modules.business.enums.CheckInTypeEnum;
|
|
|
import org.jeecg.modules.business.enums.CustomerTypeEnum;
|
|
|
import org.jeecg.modules.business.mapper.BusRoomBookingOrdersMapper;
|
|
|
@@ -167,10 +168,14 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
if(item.getLayoutDayPrices().stream().anyMatch(o->o.getPrice()==null || o.getDayTime() == null || o.getRoomLayoutId() == null))
|
|
|
throw new JeecgBootException("参数错误,请传入价格、日期、房型");
|
|
|
item.getLayoutDayPrices().forEach(g->{
|
|
|
- g.setBookingOrderId(item.getOrderInfo().getId());
|
|
|
- g.setBookingType(BookingOrdersType.NORMAL.getKey());
|
|
|
+ long roomCount = item.getRoomIds().stream().filter(e->e.getLayoutId().equals(g.getRoomLayoutId())).count();
|
|
|
+ if(roomCount > 0) {
|
|
|
+ g.setBookingOrderId(item.getOrderInfo().getId());
|
|
|
+ g.setBookingType(BookingOrdersType.NORMAL.getKey());
|
|
|
+ }
|
|
|
});
|
|
|
- dayPriceService.saveBatch(item.getLayoutDayPrices());
|
|
|
+ List<String> lList = item.getRoomIds().stream().map(w->w.getLayoutId()).collect(Collectors.toList());
|
|
|
+ dayPriceService.saveBatch(item.getLayoutDayPrices().stream().filter(l->lList.contains(l.getRoomLayoutId())).collect(Collectors.toList()));
|
|
|
// 处理预定每天的房型价格 End
|
|
|
|
|
|
return item.getOrderInfo().getBookingOrdersNo();
|
|
|
@@ -233,11 +238,15 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
if(c.getLayoutDayPrices().stream().anyMatch(o->o.getPrice()==null || o.getDayTime() == null || o.getRoomLayoutId() == null))
|
|
|
throw new JeecgBootException("参数错误,批次中请传入价格、日期、房型");
|
|
|
c.getLayoutDayPrices().forEach(g->{
|
|
|
- g.setBookingOrderId(item.getOrderInfo().getId());
|
|
|
- g.setBookingType(BookingOrdersType.TEAM.getKey());
|
|
|
- g.setBatchId(batchItem.getId());
|
|
|
+ long roomCount = c.getRoomIds().stream().filter(e->e.getLayoutId().equals(g.getRoomLayoutId())).count();
|
|
|
+ if(roomCount > 0 ) {
|
|
|
+ g.setBookingOrderId(item.getOrderInfo().getId());
|
|
|
+ g.setBookingType(BookingOrdersType.TEAM.getKey());
|
|
|
+ g.setBatchId(batchItem.getId());
|
|
|
+ }
|
|
|
});
|
|
|
- dayPriceService.saveBatch(c.getLayoutDayPrices());
|
|
|
+ List<String> lList = c.getRoomIds().stream().map(a->a.getLayoutId()).collect(Collectors.toList());
|
|
|
+ dayPriceService.saveBatch(c.getLayoutDayPrices().stream().filter(x->lList.contains(x.getRoomLayoutId())).collect(Collectors.toList()));
|
|
|
//批次中处理每天房型价格 End
|
|
|
});
|
|
|
return item.getOrderInfo().getBookingOrdersNo();
|
|
|
@@ -418,7 +427,8 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
g.setBookingOrderId(item.getOrderInfo().getId());
|
|
|
g.setBookingType(BookingOrdersType.NORMAL.getKey());
|
|
|
});
|
|
|
- dayPriceService.saveBatch(item.getLayoutDayPrices());
|
|
|
+ List<String> layoutIds = item.getRoomIds().stream().map(v->v.getRoomLayoutId()).collect(Collectors.toList());
|
|
|
+ dayPriceService.saveBatch(item.getLayoutDayPrices().stream().filter(v->layoutIds.contains(v.getRoomLayoutId())).collect(Collectors.toList()));
|
|
|
// 处理预定每天的房型价格 End
|
|
|
return true;
|
|
|
// 团队预定
|
|
|
@@ -484,11 +494,12 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
if(c.getLayoutDayPrices().stream().anyMatch(o->o.getPrice()==null || o.getDayTime() == null || o.getRoomLayoutId() == null))
|
|
|
throw new JeecgBootException("参数错误,批次中请传入价格、日期、房型");
|
|
|
c.getLayoutDayPrices().forEach(g->{
|
|
|
- g.setBookingOrderId(item.getOrderInfo().getId());
|
|
|
- g.setBookingType(BookingOrdersType.TEAM.getKey());
|
|
|
- g.setBatchId(batchItem.getId());
|
|
|
+ g.setBookingOrderId(item.getOrderInfo().getId());
|
|
|
+ g.setBookingType(BookingOrdersType.TEAM.getKey());
|
|
|
+ g.setBatchId(batchItem.getId());
|
|
|
});
|
|
|
- dayPriceService.saveBatch(c.getLayoutDayPrices());
|
|
|
+ List<String> layoutIds = c.getRoomIds().stream().map(v->v.getRoomLayoutId()).collect(Collectors.toList());
|
|
|
+ dayPriceService.saveBatch(c.getLayoutDayPrices().stream().filter(p->layoutIds.contains(p.getRoomLayoutId())).collect(Collectors.toList()));
|
|
|
//批次中处理每天房型价格 End
|
|
|
});
|
|
|
return true;
|
|
|
@@ -497,6 +508,31 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public Boolean removeOrder(String id) {
|
|
|
+ BusRoomBookingOrders order = getById(id);
|
|
|
+ if(order == null) throw
|
|
|
+ new JeecgBootException("订单不存在");
|
|
|
+ removeById(id);
|
|
|
+ bookingBatchService.remove(Wrappers.<BusBookingBatch>query().eq("booking_orders_id",order.getId()));
|
|
|
+ bookingRoomsService.remove(Wrappers.<BusBookingRooms>query().eq("booking_orders_id",order.getId()));
|
|
|
+ dayPriceService.remove(Wrappers.<BusBookingLayoutDayPrice>query().eq("booking_order_id",order.getId()));
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Boolean setOrderStatus(BusRoomBookingOrders entity) {
|
|
|
+ if(entity.getId() == null || entity.getBookingStatus() == null) throw new JeecgBootException("参数错误");
|
|
|
+ if(BookingStatusTypeEnum.val(entity.getBookingStatus()) == null) throw new JeecgBootException("状态错误");
|
|
|
+ BusRoomBookingOrders updateModel = new BusRoomBookingOrders();
|
|
|
+ updateModel.setId(entity.getId());
|
|
|
+ updateModel.setBookingStatus(entity.getBookingStatus());
|
|
|
+ updateById(updateModel);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
private BusBookingBatch copyBatchToBase(BookingBatchRoomsDto data) {
|
|
|
BusBookingBatch batch = new BookingBatchRoomsDto();
|
|
|
batch.setBatchNo(data.getBatchNo());
|