Forráskód Böngészése

可使用房间 fixbug

qh 2 éve
szülő
commit
5999eda820

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

@@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.extern.slf4j.Slf4j;
 
+import org.jeecg.modules.business.vo.BookingOrderEditVo;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
 import org.jeecgframework.poi.excel.def.NormalExcelConstants;
 import org.jeecgframework.poi.excel.entity.ExportParams;
@@ -103,6 +104,20 @@ public class BusRoomBookingOrdersController extends JeecgController<BusRoomBooki
 		busRoomBookingOrdersService.updateById(busRoomBookingOrders);
 		return Result.OK("编辑成功!");
 	}
+
+	 /**
+	  *   酒店预定订单-通过id获取订单详情
+	  *
+	  * @param
+	  * @return
+	  */
+	 @AutoLog(value = "酒店预定订单-通过id获取订单详情")
+	 @ApiOperation(value="酒店预定订单-通过id获取订单详情", notes="酒店预定订单-通过id获取订单详情")
+	 //@RequiresPermissions("business:bus_room_booking_orders:getBookingOrderInfo")
+	 @GetMapping(value = "/getBookingOrderInfo")
+	private Result<BookingOrderEditVo> getBookingOrderInfo(String bookingOrderId) {
+	 	return Result.ok(service.getBookingInfoById(bookingOrderId));
+	}
 	
 	/**
 	 *   通过id删除

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

@@ -3,6 +3,7 @@ package org.jeecg.modules.business.service;
 import org.jeecg.modules.business.dto.BookingOrderSaveDto;
 import org.jeecg.modules.business.entity.BusRoomBookingOrders;
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.business.vo.BookingOrderEditVo;
 
 /**
  * @Description: 酒店预定订单
@@ -13,4 +14,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
 public interface IBusRoomBookingOrdersService extends IService<BusRoomBookingOrders> {
 
     String bookingOrderSave(BookingOrderSaveDto item);
+
+    BookingOrderEditVo getBookingInfoById(String orderId);
 }

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

@@ -1,11 +1,13 @@
 package org.jeecg.modules.business.service.impl;
 
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import org.jeecg.common.exception.JeecgBootException;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.TokenUtils;
 import org.jeecg.modules.business.dto.BookingBatchRoomsDto;
 import org.jeecg.modules.business.dto.BookingOrderSaveDto;
 import org.jeecg.modules.business.entity.BusBookingBatch;
+import org.jeecg.modules.business.entity.BusBookingLayoutDayPrice;
 import org.jeecg.modules.business.entity.BusBookingRooms;
 import org.jeecg.modules.business.entity.BusRoomBookingOrders;
 import org.jeecg.modules.business.enums.BookingOrdersType;
@@ -14,6 +16,8 @@ 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.business.vo.BookingBatchRoomsVo;
+import org.jeecg.modules.business.vo.BookingOrderEditVo;
 import org.jeecg.modules.rooms.service.CesRoomsServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -27,6 +31,7 @@ import java.time.LocalDateTime;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * @Description: 酒店预定订单
@@ -186,6 +191,46 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
             throw new JeecgBootException("参数错误");
         }
     }
+
+    /**
+     * 通过id获取预约单详情
+     * @param orderId
+     * @return
+     */
+    @Override
+    public BookingOrderEditVo getBookingInfoById(String orderId) {
+        BusRoomBookingOrders orderInfo = getById(orderId);
+        if(orderInfo == null) throw new JeecgBootException("预约单不存在");
+        BookingOrderEditVo result = new BookingOrderEditVo();
+        if(orderInfo.getBookingOrdersType().equals(BookingOrdersType.NORMAL.getKey())) {
+            List<BusBookingRooms> bookingRooms = bookingRoomsService.list(Wrappers.<BusBookingRooms>query()
+            .eq("booking_orders_id",orderId)
+            .eq("booking_type",BookingOrdersType.NORMAL.getKey()));
+            result.setRoomIds(bookingRooms);
+        } else if(orderInfo.getBookingOrdersType().equals(BookingOrdersType.TEAM.getKey())) {
+            List<BusBookingBatch> batches = bookingBatchService.list(Wrappers.<BusBookingBatch>query().eq("booking_orders_id",orderId));
+            List<BookingBatchRoomsVo> batchesVo = new ArrayList<>();
+            batches.forEach(s->{
+                batchesVo.add(copyBaseToBatch(s));
+            });
+
+            List<BusBookingRooms> batchRooms = bookingRoomsService.list(Wrappers.<BusBookingRooms>query()
+            .eq("booking_orders_id",orderId).eq("booking_type",BookingOrdersType.TEAM.getKey()));
+            List<BusBookingLayoutDayPrice> layoutDayPrices = dayPriceService.list(Wrappers.<BusBookingLayoutDayPrice>query()
+            .eq("booking_order_id",orderId)
+            .eq("booking_type",BookingOrdersType.TEAM.getKey()));
+            batchesVo.forEach(s->{
+                List<BusBookingRooms> findRooms = batchRooms.stream().filter(a->a.getBookingBatchId().equals(s.getId())).collect(Collectors.toList());
+                List<BusBookingLayoutDayPrice> findDayPrice = layoutDayPrices.stream().filter(a->a.getBatchId().equals(s.getId())).collect(Collectors.toList());
+                s.setLayoutDayPrices(findDayPrice);
+                s.setRoomIds(findRooms);
+            });
+            result.setBatchRooms(batchesVo);
+        }
+        result.setOrderInfo(orderInfo);
+        return result;
+    }
+
     private BusBookingBatch copyBatchToBase(BookingBatchRoomsDto data) {
         BusBookingBatch batch = new BookingBatchRoomsDto();
         batch.setBatchNo(data.getBatchNo());
@@ -195,4 +240,14 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
         batch.setDayCount(data.getDayCount());
         return batch;
     }
+
+    private BookingBatchRoomsVo copyBaseToBatch(BusBookingBatch data) {
+        BookingBatchRoomsVo batch = new BookingBatchRoomsVo();
+        batch.setBatchNo(data.getBatchNo());
+        batch.setBookingOrdersId(data.getBookingOrdersId());
+        batch.setArrivalTime(data.getArrivalTime());
+        batch.setDueOutTime(data.getDueOutTime());
+        batch.setDayCount(data.getDayCount());
+        return batch;
+    }
 }

+ 20 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/vo/BookingBatchRoomsVo.java

@@ -0,0 +1,20 @@
+package org.jeecg.modules.business.vo;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.jeecg.modules.business.dto.BookingLayoutRoomsDto;
+import org.jeecg.modules.business.entity.BusBookingBatch;
+import org.jeecg.modules.business.entity.BusBookingLayoutDayPrice;
+import org.jeecg.modules.business.entity.BusBookingRooms;
+
+import java.util.List;
+
+@Data
+public class BookingBatchRoomsVo  extends BusBookingBatch {
+    @TableField(exist = false)
+    private List<BusBookingRooms> roomIds;
+    @ApiModelProperty(value = "房型每天价格 ,1 散客预定 每天房价传入这个必传")
+    @TableField(exist = false)
+    private List<BusBookingLayoutDayPrice> layoutDayPrices;
+}

+ 29 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/vo/BookingOrderEditVo.java

@@ -0,0 +1,29 @@
+package org.jeecg.modules.business.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.jeecg.modules.business.dto.BookingBatchRoomsDto;
+import org.jeecg.modules.business.dto.BookingLayoutRoomsDto;
+import org.jeecg.modules.business.entity.BusBookingLayoutDayPrice;
+import org.jeecg.modules.business.entity.BusBookingRooms;
+import org.jeecg.modules.business.entity.BusRoomBookingOrders;
+
+import java.util.List;
+
+@Data
+public class BookingOrderEditVo {
+    private BusRoomBookingOrders orderInfo;
+    /**
+     *散客预定 走这个
+     **/
+    @ApiModelProperty(value = "散客预定 走这个,关联的房间id")
+    private List<BusBookingRooms> roomIds;
+    @ApiModelProperty(value = "房型每天价格 ,1 散客预定 每天房价传入这个必传")
+    private List<BusBookingLayoutDayPrice> layoutDayPrices;
+    @ApiModelProperty(value = "如果是团队预定,关联房间ID和房型每天价格 走这个参数")
+    private List<BookingBatchRoomsVo> batchRooms;
+    // 联系人名称
+    private String contactName;
+    // 联系人电话
+    private String phone;
+}

+ 1 - 1
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/service/CesRoomsServiceImpl.java

@@ -295,7 +295,7 @@ public class CesRoomsServiceImpl extends ServiceImpl<CesRoomsMapper, CesRooms> i
                s.setFavPrice(null);
            floors.forEach(c->{
                CanUseBuildingRoomsVo floorRoomsVo  = new CanUseBuildingRoomsVo();
-               List<CesRooms> floorRooms = allRooms.stream().filter(e->e.getFloorId().equals(c.getId())).collect(Collectors.toList());
+               List<CesRooms> floorRooms = allRooms.stream().filter(e->e.getFloorId().equals(c.getId()) && e.getLayoutId().equals(s.getId())).collect(Collectors.toList());
                Optional<CesRoomBuildingFloor> opBuilding = allBuildingFloors.stream().filter(q->q.getId().equals(c.getParentId())).findFirst();
                if(!opBuilding.isPresent()) return;
                floorRoomsVo.setFloorRooms(floorRooms);