|
|
@@ -20,9 +20,11 @@ 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.CesAllDayPriceRule;
|
|
|
import org.jeecg.modules.rooms.entity.CesRoomBuildingFloor;
|
|
|
import org.jeecg.modules.rooms.entity.CesRoomLayout;
|
|
|
import org.jeecg.modules.rooms.entity.CesRooms;
|
|
|
+import org.jeecg.modules.rooms.service.CesAllDayPriceRuleServiceImpl;
|
|
|
import org.jeecg.modules.rooms.service.CesRoomBuildingFloorServiceImpl;
|
|
|
import org.jeecg.modules.rooms.service.CesRoomLayoutServiceImpl;
|
|
|
import org.jeecg.modules.rooms.service.CesRoomsServiceImpl;
|
|
|
@@ -97,6 +99,9 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
@Resource
|
|
|
private CesRoomBuildingFloorServiceImpl buildingFloorService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private CesAllDayPriceRuleServiceImpl allDayPriceRuleService;
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public String bookingOrderSave(BookingOrderSaveDto item, Boolean isTeam) {
|
|
|
@@ -1633,6 +1638,83 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
roomsLivingOrderService.updateBatchById(needMergeLivingOrders);
|
|
|
return true;
|
|
|
}
|
|
|
+ @Override
|
|
|
+ public void syncDayOrderFee() {
|
|
|
+ // 扫描每个订单,生成夜审房费,如果当日没有退房,并且没有生成当日房费,
|
|
|
+ // 则生成新的每日房费,生成的房费以门市价为准,
|
|
|
+ // 如果超过全天放计费的重算全天放时间,需要更改该订单的预离时间,自动续为全天房 //
|
|
|
+ // 未结账的房间集合
|
|
|
+ List<BusRoomsLivingOrder> unSettledLivings = roomsLivingOrderService.list(Wrappers.<BusRoomsLivingOrder>query()
|
|
|
+ .eq("settle_type", SettleTypeEnum.UN_LEAVE.getKey()));
|
|
|
+ List<CesAllDayPriceRule> allDayPriceRules = allDayPriceRuleService.list();
|
|
|
+ unSettledLivings.forEach(s->{
|
|
|
+ Optional<CesAllDayPriceRule> opAllPrice = allDayPriceRules.stream().filter(a->a.getHotelId().equals(s.getHotelId())).findFirst();
|
|
|
+ CesAllDayPriceRule allPrice;
|
|
|
+ if(!opAllPrice.isPresent()) {
|
|
|
+ allPrice = new CesAllDayPriceRule();
|
|
|
+ allPrice.setEndTime("16:00");
|
|
|
+ } else {
|
|
|
+ allPrice = opAllPrice.get();
|
|
|
+ }
|
|
|
+ syncDayOrderFeeItem(s,allPrice);
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @SneakyThrows
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void syncDayOrderFeeItem(BusRoomsLivingOrder order, CesAllDayPriceRule allDayRule) {
|
|
|
+ List<String> dayStrs = MxTools.findEveryDay(DateUtils.formatTime(order.getArrivalTime()),
|
|
|
+ DateUtils.formatTime(new Date()));
|
|
|
+ BusBookingRooms bookingRoom = bookingRoomsService.getById(order.getBookingRoomId());
|
|
|
+ CesRooms room = roomsService.getById(bookingRoom.getRoomId());
|
|
|
+ CesRoomLayout layout = layoutService.getById(room.getLayoutId());
|
|
|
+ if(bookingRoom == null || room == null || layout == null) return;
|
|
|
+ List<BusLivingLayoutDayPrice> dayPrices = livingLayoutDayPriceService.list(Wrappers.<BusLivingLayoutDayPrice>query()
|
|
|
+ .eq("living_order_id",order.getId()).eq("booking_room_id",order.getBookingRoomId()));
|
|
|
+ List<BusOrderFee> dayFees = feeService.list(Wrappers.<BusOrderFee>query()
|
|
|
+ .eq("living_order_id",order.getId()).eq("room_id",room.getId()).eq("subject_type",FeeSubjectType.MEI_RI_FANG_FEI.getKey()));
|
|
|
+
|
|
|
+ // 如果预离时间小于当天 全天房退房时间,默认16:00,则根据全天规则续房为全天房
|
|
|
+ if(order.getDueOutTime().getTime() < DateUtils.parseDatetime(DateUtils.formatDate(new Date())+" " + allDayRule.getEndTime()).getTime()) {
|
|
|
+ Date orderLeave = order.getDueOutTime();
|
|
|
+// orderLeave.
|
|
|
+ }
|
|
|
+ dayStrs.forEach(s->{
|
|
|
+ Optional<BusLivingLayoutDayPrice> opPrice = dayPrices.stream().filter(a-> DateUtils.formatDate(a.getDayTime()).equals(s)).findFirst();
|
|
|
+ if(!opPrice.isPresent()){
|
|
|
+ BusLivingLayoutDayPrice nPrice = new BusLivingLayoutDayPrice();
|
|
|
+ nPrice.setBookingRoomId(order.getBookingRoomId());
|
|
|
+ nPrice.setDayTime(DateUtils.parseDatetime(s));
|
|
|
+ nPrice.setRoomId(bookingRoom.getRoomId());
|
|
|
+ nPrice.setRoomLayoutId(room.getLayoutId());
|
|
|
+ nPrice.setPrice(layout.getMarketPrice());
|
|
|
+ nPrice.setLivingOrderId(order.getId());
|
|
|
+ livingLayoutDayPriceService.save(nPrice);
|
|
|
+ }
|
|
|
+ Optional<BusOrderFee> opFee = dayFees.stream().filter(a->DateUtils.formatDate(a.getDayTime()).equals(s)).findFirst();
|
|
|
+ if(!opFee.isPresent()) {
|
|
|
+ BusOrderFee nFee = new BusOrderFee();
|
|
|
+ nFee.setMoney(layout.getMarketPrice());
|
|
|
+ nFee.setCustorerOrderRemark("每日房费");
|
|
|
+ nFee.setAllowCouponscash(false);
|
|
|
+ nFee.setSubjectType(FeeSubjectType.MEI_RI_FANG_FEI.getKey());
|
|
|
+ nFee.setHotelId(order.getHotelId());
|
|
|
+ nFee.setCreateTime(new Date());
|
|
|
+ nFee.setDayTime(DateUtils.parseDatetime(s));
|
|
|
+ nFee.setRoomId(room.getId());
|
|
|
+ nFee.setFeeType(1);
|
|
|
+ nFee.setPreferentialStatus(1);
|
|
|
+ nFee.setLivingOrderId(order.getId());
|
|
|
+ if(DateUtils.parseDatetime(s).getTime() < new Date().getTime()) {
|
|
|
+ nFee.setCustorerOrderRemark("夜审房费");
|
|
|
+ nFee.setSubjectType(FeeSubjectType.YE_SHEN_FANG_FEI.getKey());
|
|
|
+ }
|
|
|
+ feeService.save(nFee);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
|
|
|
String getBookingRoomHotelId(BusBookingRooms bookingRoom) {
|