qh 2 år sedan
förälder
incheckning
095c80ea5d

+ 12 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/BusRoomBookingOrdersController.java

@@ -336,5 +336,17 @@ public class BusRoomBookingOrdersController extends JeecgController<BusRoomBooki
 		 return Result.OK(isOk);
 	 }
 
+	 /**
+	  * 先走不结
+	  * @param livingOrderId
+	  * @return
+	  */
+	 @ApiOperation(value="酒店预定订单-先走不结", notes="酒店预定订单-先走不结")
+	 @RequestMapping(value = "/leave-not-settle",method = RequestMethod.POST)
+	 public Result<Boolean> leaveNotSettle(String bookingOrderId,String livingOrderId){
+		 Boolean isOk = service.leaveNotSettle(bookingOrderId,livingOrderId);
+		 return Result.OK(isOk);
+	 }
+
 
  }

+ 1 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/IBusRoomBookingOrdersService.java

@@ -55,5 +55,6 @@ public interface IBusRoomBookingOrdersService extends IService<BusRoomBookingOrd
     Boolean livingSettleBillCheckOut(List<BusOrderFee> settleFees, String livingOrderId);
     Boolean partialSettle(PartialSettleVo param);
     Boolean splitLiving(String livingOrderId);
+    Boolean leaveNotSettle(String bookingOrderId, String livingOrderId);
 
 }

+ 30 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/impl/BusRoomBookingOrdersServiceImpl.java

@@ -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;