|
|
@@ -1142,6 +1142,36 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public Boolean leaveNotSettle(String bookingOrderId, String livingOrderId){
|
|
|
+ if(bookingOrderId != null && !bookingOrderId.isEmpty()) {
|
|
|
+ List<BusRoomsLivingOrder> bookingLivings = roomsLivingOrderService.list(Wrappers.<BusRoomsLivingOrder>query()
|
|
|
+ .eq("booking_order_id",bookingOrderId));
|
|
|
+ List<String> livingOrderIds = bookingLivings.stream().map(s->s.getId()).collect(Collectors.toList());
|
|
|
+ if(livingOrderIds.size() == 0) throw new JeecgBootException("没有入住信息");
|
|
|
+ List<CesRooms> rooms = roomsService.list(Wrappers.<CesRooms>query()
|
|
|
+ .in("living_order_id",livingOrderIds));
|
|
|
+ rooms.forEach(s->{
|
|
|
+ s.setLivingOrderId(null);
|
|
|
+ s.setRoomStatus(RoomStatusEnum.EMPTY_DIRTY.getKey());
|
|
|
+ });
|
|
|
+ roomsService.updateBatchById(rooms);
|
|
|
+ } else if(livingOrderId != null && !livingOrderId.isEmpty()) {
|
|
|
+ BusRoomsLivingOrder livingOrder = roomsLivingOrderService.getById(livingOrderId);
|
|
|
+ if(livingOrder == null) throw new JeecgBootException("订单未找到");
|
|
|
+ BusBookingRooms bookingRooms = bookingRoomsService.getById(livingOrder.getBookingRoomId());
|
|
|
+ if(bookingRooms == null) throw new JeecgBootException("数据异常");
|
|
|
+ if(bookingRooms.getIsMain().equals(true)) throw new JeecgBootException("主房不能单独先走不结");
|
|
|
+ CesRooms room = roomsService.getOne(Wrappers.<CesRooms>query().eq("living_order_id",livingOrderId));
|
|
|
+ if(room == null) throw new JeecgBootException("未找到订单信息");
|
|
|
+ room.setLivingOrderId(null);
|
|
|
+ room.setRoomStatus(RoomStatusEnum.EMPTY_DIRTY.getKey());
|
|
|
+ roomsService.updateById(room);
|
|
|
+ } else throw new JeecgBootException("参数错误");
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
private void settleFee(BusBookingRooms mainRoom, BusRoomsLivingOrder mainRoomOrder, List<BusOrderFee> feeItems, List<BusOrderFee> settleFees) {
|
|
|
if(settleFees.size() == 0) throw new JeecgBootException("参数错误");
|
|
|
BusOrderFee preferFeeItem = null;
|