|
|
@@ -12,6 +12,7 @@ import org.jeecg.modules.business.enums.BookingOrdersType;
|
|
|
import org.jeecg.modules.business.enums.CheckInTypeEnum;
|
|
|
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.rooms.service.CesRoomsServiceImpl;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -20,6 +21,7 @@ import org.springframework.stereotype.Service;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.ArrayList;
|
|
|
@@ -43,6 +45,10 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
|
|
|
@Autowired
|
|
|
private BusBookingBatchServiceImpl bookingBatchService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IBusBookingLayoutDayPriceService dayPriceService;
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public String bookingOrderSave(BookingOrderSaveDto item) {
|
|
|
@@ -103,11 +109,26 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
item.getRoomIds().forEach(c->{
|
|
|
BusBookingRooms bookingRoomsItem = new BusBookingRooms();
|
|
|
bookingRoomsItem.setBookingOrdersId(bookingId);
|
|
|
- bookingRoomsItem.setRoomId(c);
|
|
|
+ bookingRoomsItem.setRoomId(c.getRoomId());
|
|
|
+ bookingRoomsItem.setRoomLayoutId(c.getLayoutId());
|
|
|
bookingRoomsItem.setBookingType(1);
|
|
|
bookingRooms.add(bookingRoomsItem);
|
|
|
});
|
|
|
bookingRoomsService.saveBatch(bookingRooms);
|
|
|
+
|
|
|
+ // 处理预定每天的房型价格 Start
|
|
|
+ if(item.getLayoutDayPrices() == null || item.getLayoutDayPrices().size() == 0)
|
|
|
+ throw new JeecgBootException("参数错误,对应房型当天价格必传");
|
|
|
+ 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());
|
|
|
+ });
|
|
|
+ dayPriceService.saveBatch(item.getLayoutDayPrices());
|
|
|
+ // 处理预定每天的房型价格 End
|
|
|
+
|
|
|
+
|
|
|
return item.getOrderInfo().getBookingOrdersNo();
|
|
|
// 团队预定
|
|
|
} else if(item.getOrderInfo().getBookingOrdersType().equals(BookingOrdersType.TEAM.getKey())) {
|
|
|
@@ -137,13 +158,28 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
List<BusBookingRooms> batchBookingRooms = new ArrayList<>();
|
|
|
c.getRoomIds().forEach(s-> {
|
|
|
BusBookingRooms bookingRoomItem = new BusBookingRooms();
|
|
|
- bookingRoomItem.setRoomId(s);
|
|
|
+ bookingRoomItem.setRoomId(s.getRoomId());
|
|
|
+ bookingRoomItem.setRoomLayoutId(s.getLayoutId());
|
|
|
bookingRoomItem.setBookingType(2);
|
|
|
bookingRoomItem.setBookingBatchId(batchItem.getId());
|
|
|
bookingRoomItem.setBookingOrdersId(item.getOrderInfo().getId());
|
|
|
batchBookingRooms.add(bookingRoomItem);
|
|
|
});
|
|
|
bookingRoomsService.saveBatch(batchBookingRooms);
|
|
|
+ // 以上处理批次关联的房间
|
|
|
+
|
|
|
+ //批次中处理每天房型价格 Start
|
|
|
+ if(c.getLayoutDayPrices() == null || c.getLayoutDayPrices().size() == 0)
|
|
|
+ throw new JeecgBootException("参数错误,批次中对应房型当天价格必传");
|
|
|
+ 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());
|
|
|
+ });
|
|
|
+ dayPriceService.saveBatch(c.getLayoutDayPrices());
|
|
|
+ //批次中处理每天房型价格 End
|
|
|
});
|
|
|
return item.getOrderInfo().getBookingOrdersNo();
|
|
|
} else { // not exist type
|