qh 2 lat temu
rodzic
commit
dea54dd3f8

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

@@ -625,8 +625,9 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
         // 【添加客人信息 end】
 
 
-        BookingBatchRoomsDto c = new BookingBatchRoomsDto();
+        BusBookingBatch c = item.getOrderInfo();
 
+//        setBatchOrderInfo(item.getOrderInfo(),c);
         if(c.getArrivalTime() == null || c.getDueOutTime() == null)
             throw new JeecgBootException("预抵时间和预离时间不能为空");
         if(c.getArrivalTime().getTime() < new Date().getTime())
@@ -638,18 +639,18 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
             if(c.getDayCount() == null || c.getDayCount() <= 0)
                 throw new JeecgBootException("入住天数不能小于0");
         }
-        if(c.getRoomIds() == null || c.getRoomIds().size() == 0)
+        if(item.getRoomIds() == null || item.getRoomIds().size() == 0)
             throw new JeecgBootException("请选择批次房间");
         SimpleDateFormat sdfPc = new SimpleDateFormat("yyyyMMddHHmmssSSS");
         c.setBatchNo("YDPC"+sdfPc.format(System.currentTimeMillis()));
         c.setBookingOrdersId(item.getOrderInfo().getId());
-//        setBatchOrderInfo(item.getOrderInfo(),c);
+
+//        BusBookingBatch batchItem = copyBatchToBase(c);
 //        BusBookingBatch batchItem = copyBatchToBase(c);
-        BusBookingBatch batchItem = copyBatchToBase(c);
-        bookingBatchService.save(batchItem);
+        bookingBatchService.save(c);
         List<BusBookingRooms> batchBookingRooms = new ArrayList<>();
-        long mainCount = c.getRoomIds().stream().filter(t->t.getIsMain()!=null&&t.getIsMain()).count();
-        c.getRoomIds().forEach(s-> {
+        long mainCount = item.getRoomIds().stream().filter(t->t.getIsMain()!=null&&t.getIsMain()).count();
+        item.getRoomIds().forEach(s-> {
             BusBookingRooms bookingRoomItem = new BusBookingRooms();
             bookingRoomItem.setRoomId(s.getRoomId());
             bookingRoomItem.setRoomLayoutId(s.getLayoutId());
@@ -664,7 +665,7 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
                 bookingRoomItem.setIsMain(s.getIsMain());
             }
             bookingRoomItem.setBookingType(2);
-            bookingRoomItem.setBookingBatchId(batchItem.getId());
+            bookingRoomItem.setBookingBatchId(c.getId());
             bookingRoomItem.setBookingOrdersId(item.getOrderInfo().getId());
             batchBookingRooms.add(bookingRoomItem);
         });
@@ -675,23 +676,23 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
         // 以上处理批次关联的房间
 
         //批次中处理每天房型价格 Start
-        if(c.getLayoutDayPrices() == null || c.getLayoutDayPrices().size() == 0)
+        if(item.getLayoutDayPrices() == null || item.getLayoutDayPrices().size() == 0)
             throw new JeecgBootException("参数错误,批次中对应房型当天价格必传");
-        if(c.getLayoutDayPrices().stream().anyMatch(o->o.getPrice()==null || o.getDayTime() == null || o.getRoomLayoutId() == null))
+        if(item.getLayoutDayPrices().stream().anyMatch(o->o.getPrice()==null || o.getDayTime() == null || o.getRoomLayoutId() == null))
             throw new JeecgBootException("参数错误,批次中请传入价格、日期、房型");
-        c.getLayoutDayPrices().forEach(g->{
-            long roomCount = c.getRoomIds().stream().filter(e->e.getLayoutId().equals(g.getRoomLayoutId())).count();
+        item.getLayoutDayPrices().forEach(g->{
+            long roomCount = item.getRoomIds().stream().filter(e->e.getLayoutId().equals(g.getRoomLayoutId())).count();
             if(roomCount > 0 ) {
                 g.setBookingOrderId(item.getOrderInfo().getId());
                 g.setBookingType(BookingOrdersType.TEAM.getKey());
-                g.setBatchId(batchItem.getId());
+                g.setBatchId(c.getId());
             }
         });
-        List<String> lList = c.getRoomIds().stream().map(a->a.getLayoutId()).collect(Collectors.toList());
-        dayPriceService.saveBatch(c.getLayoutDayPrices().stream().filter(x->lList.contains(x.getRoomLayoutId())).collect(Collectors.toList()));
+        List<String> lList = item.getRoomIds().stream().map(a->a.getLayoutId()).collect(Collectors.toList());
+        dayPriceService.saveBatch(item.getLayoutDayPrices().stream().filter(x->lList.contains(x.getRoomLayoutId())).collect(Collectors.toList()));
         //批次中处理每天房型价格 End
 
-        return batchItem.getBatchNo();
+        return c.getBatchNo();
     }