Bladeren bron

预约转入住,fix

覃浩 2 jaren geleden
bovenliggende
commit
ef09e760a9

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

@@ -262,7 +262,7 @@ public class BusRoomBookingOrdersController extends JeecgController<BusRoomBooki
 	 @ApiOperation(value="酒店预定订单-预约房间入住", notes="酒店预定订单-预约房间入住")
 	 @RequestMapping(value = "booking-to-live",method = RequestMethod.POST)
 	 public  Result<String> bookingRoomToLive(String bookingRoomId, @RequestBody List<BusLivingCustomer> customers,String hotelId) {
-		 return  Result.OK("入住成功",service.bookingToLive(bookingRoomId, customers,hotelId));
+		 return  Result.OK("入住成功",service.bookingToLive(bookingRoomId, customers,hotelId,true));
 	 }
 
 	 /**

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

@@ -41,7 +41,7 @@ public interface IBusRoomBookingOrdersService extends IService<BusRoomBookingOrd
     String batchOrderSave(BatchOrderSavaDto item);
 
     Boolean setBatchOrderStatus(BusBookingBatch batchOrder);
-    String bookingToLive(String bookingRoomId, List<BusLivingCustomer> customers, String hotelId);
+    String bookingToLive(String bookingRoomId, List<BusLivingCustomer> customers, String hotelId,Boolean bookingLiving);
 
     String customerLiving(BookingOrderSaveDto livingData, Boolean isTeam, String hotelId);
 

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

@@ -870,7 +870,7 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public String bookingToLive(String bookingRoomId, List<BusLivingCustomer> customers, String hotelId) {
+    public String bookingToLive(String bookingRoomId, List<BusLivingCustomer> customers, String hotelId, Boolean bookingLiving) {
         BusBookingRooms bkRoom = bookingRoomsService.getById(bookingRoomId);
         if(bkRoom == null) throw  new JeecgBootException("关联房间不存在");
         BusRoomBookingOrders bookingOrders = getById(bkRoom.getBookingOrdersId());
@@ -938,31 +938,33 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
         //</editor-fold>
 
         //<editor-fold desc="todo:账单相关">
-//        BigDecimal money = new BigDecimal(0);
-//        BusLivingLayoutDayPrice  price = livingLayoutDayPriceService.getOne(Wrappers.<BusLivingLayoutDayPrice>query()
-//        .eq("living_order_id", livingOrder.getId()).eq("day_time",DateUtils.formatDate(new Date())+" 00:00:00"));
-//        if(price != null) {
-//            money = price.getPrice();
-//        } else {
-//            CesRoomLayout layout = layoutService.getById(room.getLayoutId());
-//            if(layout == null) throw new JeecgBootException("房价不存在");
-//            money = layout.getMarketPrice();
-//        }
-//
-//        BusOrderFee dayOrderFee = new BusOrderFee();
-//        dayOrderFee.setDayTime(new Date());
-//        dayOrderFee.setCreateTime(new Date());
-//        dayOrderFee.setMoney(money);
-//        dayOrderFee.setFeeType(1);
-//        dayOrderFee.setSubjectType(FeeSubjectType.MEI_RI_FANG_FEI.getKey());
-//        CesRooms orderRoom = room;
-//        dayOrderFee.setRoomId(orderRoom.getId());
-//        String roomName = orderRoom.getPrefix() != null?orderRoom.getPrefix():"";
-//        roomName += roomName + orderRoom.getName();
-//        dayOrderFee.setRemark("【"+roomName + "】 "+ DateUtils.formatDate(dayOrderFee.getDayTime()) + " 当日房费");
-//        dayOrderFee.setLivingOrderId(livingOrder.getId());
-//        dayOrderFee.setHotelId(hotelId);
-//        feeService.save(dayOrderFee);
+        if(bookingLiving != null && bookingLiving) {
+            BigDecimal money = new BigDecimal(0);
+            BusLivingLayoutDayPrice  price = livingLayoutDayPriceService.getOne(Wrappers.<BusLivingLayoutDayPrice>query()
+                    .eq("living_order_id", livingOrder.getId()).eq("day_time",DateUtils.formatDate(new Date())+" 00:00:00"));
+            if(price != null) {
+                money = price.getPrice();
+            } else {
+                CesRoomLayout layout = layoutService.getById(room.getLayoutId());
+                if(layout == null) throw new JeecgBootException("房价不存在");
+                money = layout.getMarketPrice();
+            }
+
+            BusOrderFee dayOrderFee = new BusOrderFee();
+            dayOrderFee.setDayTime(new Date());
+            dayOrderFee.setCreateTime(new Date());
+            dayOrderFee.setMoney(money);
+            dayOrderFee.setFeeType(1);
+            dayOrderFee.setSubjectType(FeeSubjectType.MEI_RI_FANG_FEI.getKey());
+            CesRooms orderRoom = room;
+            dayOrderFee.setRoomId(orderRoom.getId());
+            String roomName = orderRoom.getPrefix() != null?orderRoom.getPrefix():"";
+            roomName += roomName + orderRoom.getName();
+            dayOrderFee.setRemark("【"+roomName + "】 "+ DateUtils.formatDate(dayOrderFee.getDayTime()) + " 当日房费");
+            dayOrderFee.setLivingOrderId(livingOrder.getId());
+            dayOrderFee.setHotelId(hotelId);
+            feeService.save(dayOrderFee);
+        }
         //</editor-fold>
         return livingOrder.getId();
     }
@@ -1446,7 +1448,7 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
         livingCustomer.setId(null);
         livingCustomer.setLivingOrderId(null);
         customers.add(livingCustomer);
-        String livingOrderId = bookingToLive(bookingRooms.getId(), customers,hotelId);
+        String livingOrderId = bookingToLive(bookingRooms.getId(), customers,hotelId,null);
 
         return true;
     }
@@ -1969,7 +1971,7 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
 
             List<BusLivingCustomer> customers = livingData.getRoomIds().stream().filter(s->s.getRoomId().equals(bkRoom.getRoomId())).findFirst().get().getLivingCustomers();
             if(customers == null || customers.size() == 0) throw new JeecgBootException("请添加客户信息");
-            String livingOrderId = bookingToLive(bkRoom.getId(), customers,hotelId);
+            String livingOrderId = bookingToLive(bkRoom.getId(), customers,hotelId,null);
             // 费用关联到主房
             if(livingData.getOrderFees()!=null && livingData.getOrderFees().size() > 0 ) {
                 List<BusOrderFee> findRoomFees = livingData.getOrderFees().stream().filter(t->t.getRoomId().equals(bkRoom.getRoomId())).collect(Collectors.toList());