qh před 2 roky
rodič
revize
52da569387

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

@@ -372,6 +372,15 @@ public class BusRoomBookingOrdersController extends JeecgController<BusRoomBooki
 	 	return Result.OK(service.setLivingOrderFee(orders,livingOrderId));
 	 }
 
+	 /**
+	  * 添加联房
+	  * @return
+	  */
+	 @ApiOperation(value="酒店预定订单-添加联房", notes="酒店预定订单-添加联房")
+	 @RequestMapping(value = "/union-order",method = RequestMethod.POST)
+	 public Result<Boolean> unionOrder(String roomId,String bookingOrderId) {
+	 	return Result.OK(service.unionOrder(roomId,bookingOrderId));
+	 }
 
 
 

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

@@ -62,5 +62,6 @@ public interface IBusRoomBookingOrdersService extends IService<BusRoomBookingOrd
 
     IPage<RoomLivingQueryVo> getLivingPageData(Integer status,String keyw, Page<RoomLivingQueryVo> page);
     Boolean setLivingOrderFee(List<BusOrderFee> fees,String livingOrderId);
+    Boolean unionOrder(String roomId, String bookingOrderId);
 
 }

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

@@ -21,7 +21,9 @@ import org.jeecg.modules.rooms.Enum.RoomStatusEnum;
 import org.jeecg.modules.rooms.Vo.BookingRealtimeVo;
 import org.jeecg.modules.rooms.Vo.FloorBuildingRoomVo;
 import org.jeecg.modules.rooms.Vo.LivingRealtimeVo;
+import org.jeecg.modules.rooms.entity.CesRoomLayout;
 import org.jeecg.modules.rooms.entity.CesRooms;
+import org.jeecg.modules.rooms.service.CesRoomLayoutServiceImpl;
 import org.jeecg.modules.rooms.service.CesRoomsServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -87,6 +89,9 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
     @Resource
     private  IBusRoomPayTypeService payTypeService;
 
+    @Resource
+    private CesRoomLayoutServiceImpl layoutService;
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public String bookingOrderSave(BookingOrderSaveDto item, Boolean isTeam) {
@@ -1186,7 +1191,7 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
                 s.setRoomStatus(RoomStatusEnum.EMPTY_DIRTY.getKey());
                 s.setLastRoomStatus(RoomStatusEnum.EMPTY_DIRTY.getKey());
             });
-            bookingLivings.forEach(s->s.setSettleType(SettleTypeEnum.SETTLE_LEAVE.getKey()));
+            bookingLivings.forEach(s->s.setSettleType(SettleTypeEnum.UN_SETTLE_LEAVE.getKey()));
             roomsLivingOrderService.updateBatchById(bookingLivings);
             roomsService.updateBatchById(rooms);
         } else if(livingOrderId != null && !livingOrderId.isEmpty()) {
@@ -1200,7 +1205,7 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
             room.setLivingOrderId("");
             room.setRoomStatus(RoomStatusEnum.EMPTY_DIRTY.getKey());
             room.setLastRoomStatus(RoomStatusEnum.EMPTY_DIRTY.getKey());
-            livingOrder.setSettleType(SettleTypeEnum.SETTLE_LEAVE.getKey());
+            livingOrder.setSettleType(SettleTypeEnum.UN_SETTLE_LEAVE.getKey());
             roomsLivingOrderService.updateById(livingOrder);
             roomsService.updateById(room);
         } else throw new JeecgBootException("参数错误");
@@ -1232,6 +1237,41 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
         return true;
     }
 
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean unionOrder(String roomId, String bookingOrderId) {
+        CesRooms room = roomsService.getById(roomId);
+        if(room == null) throw new JeecgBootException("房间不存在");
+        CesRoomLayout layout = layoutService.getById(room.getLayoutId());
+        if(layout == null) throw new JeecgBootException("房型不存在");
+        BusRoomBookingOrders bkOrder = getById(bookingOrderId);
+        if(bkOrder == null) throw new JeecgBootException("订单不存在");
+        BusBookingRooms bookingRooms = new BusBookingRooms();
+        bookingRooms.setBookingOrdersId(bookingOrderId);
+        bookingRooms.setBookingType(bkOrder.getBookingOrdersType());
+        bookingRooms.setRoomId(roomId);
+        bookingRooms.setRoomStatus(RoomStatusEnum.LIVE_CLEAR.getKey());
+        bookingRooms.setLayoutId(layout.getId());
+        bookingRooms.setRoomLayoutId(layout.getId());
+        if(room.getLivingOrderId() == null || room.getLivingOrderId().isEmpty()) throw new JeecgBootException("非正常入住的订单无法联房");
+        BusRoomsLivingOrder roomLivingOrder = roomsLivingOrderService.getById(room.getLivingOrderId());
+        if(!roomLivingOrder.getBookingOrderId().equals(bookingOrderId)) throw new JeecgBootException("订单关联错误");
+
+        BusLivingCustomer livingCustomer =  livingCustomerService.getOne(Wrappers.<BusLivingCustomer>query().eq("living_order_id",roomLivingOrder.getId()).eq("customer_id",roomLivingOrder.getContactId()));
+        if(livingCustomer == null) {
+            livingCustomer = livingCustomerService.getOne(Wrappers.<BusLivingCustomer>query().eq("living_order_id",roomLivingOrder.getId()));
+        }
+        if(livingCustomer == null) throw new JeecgBootException("获取客户信息失败");
+        bookingRoomsService.save(bookingRooms);
+        List<BusLivingCustomer> customers = new ArrayList<>();
+        livingCustomer.setId(null);
+        livingCustomer.setLivingOrderId(null);
+        customers.add(livingCustomer);
+        String livingOrderId = bookingToLive(bookingRooms.getId(), customers);
+
+        return true;
+    }
+
     String getBookingRoomHotelId(BusBookingRooms bookingRoom) {
         return roomsService.getById(bookingRoom.getRoomId()).getHotelId();
     }