|
@@ -132,6 +132,9 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
@Resource
|
|
@Resource
|
|
|
private IBusOrderFeeGoodsService orderFeeGoodsService;
|
|
private IBusOrderFeeGoodsService orderFeeGoodsService;
|
|
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private IBusCancelService cancelService;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public String bookingOrderSave(BookingOrderSaveDto item, Boolean isTeam,Boolean isLiving,String hotelId) {
|
|
public String bookingOrderSave(BookingOrderSaveDto item, Boolean isTeam,Boolean isLiving,String hotelId) {
|
|
@@ -289,8 +292,21 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
//<editor-fold msg="团队标志">
|
|
//<editor-fold msg="团队标志">
|
|
|
if(isTeam) {
|
|
if(isTeam) {
|
|
|
BusTeam team = new BusTeam();
|
|
BusTeam team = new BusTeam();
|
|
|
|
|
+ List<BusTeam> existTeams = teamService.list(Wrappers.<BusTeam>query().eq("is_delete", 0).eq("hotel_id", hotelId));
|
|
|
|
|
+ Integer sortIndex = 0;
|
|
|
|
|
+ List<Integer> indexs = existTeams.stream().map(s->s.getSortIndex()).collect(Collectors.toList());
|
|
|
|
|
+ while(true){
|
|
|
|
|
+ Integer finalSortIndex = sortIndex;
|
|
|
|
|
+ if(indexs.stream().filter(s->s.equals(finalSortIndex)).count() == 0) {
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ sortIndex++;
|
|
|
|
|
+ }
|
|
|
team.setBookingOrderId(bookingId);
|
|
team.setBookingOrderId(bookingId);
|
|
|
team.setIsDelete(0);
|
|
team.setIsDelete(0);
|
|
|
|
|
+ team.setHotelId(hotelId);
|
|
|
|
|
+ team.setSortIndex(sortIndex);
|
|
|
|
|
+
|
|
|
teamService.save(team);
|
|
teamService.save(team);
|
|
|
}
|
|
}
|
|
|
//</editor-fold>
|
|
//</editor-fold>
|
|
@@ -1333,6 +1349,11 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
});
|
|
});
|
|
|
roomsService.updateBatchById(baseRooms);
|
|
roomsService.updateBatchById(baseRooms);
|
|
|
}
|
|
}
|
|
|
|
|
+ BusTeam team = teamService.getOne(Wrappers.<BusTeam>query().eq("booking_order_id",bookingOrderId));
|
|
|
|
|
+ if(team != null) {
|
|
|
|
|
+ team.setIsDelete(1);
|
|
|
|
|
+ teamService.updateById(team);
|
|
|
|
|
+ }
|
|
|
return true;
|
|
return true;
|
|
|
// todo 对账
|
|
// todo 对账
|
|
|
} else throw new JeecgBootException("未找到任何入住订单");
|
|
} else throw new JeecgBootException("未找到任何入住订单");
|
|
@@ -2564,4 +2585,29 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
feeService.updateById(fee);
|
|
feeService.updateById(fee);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
+ public Boolean reverseLiving(String livingOrderId, String hotelId) {
|
|
|
|
|
+ BusCancel cancel = cancelService.getOne(Wrappers.<BusCancel>query().eq("hotel_id",hotelId));
|
|
|
|
|
+ BusRoomsLivingOrder livingOrder = roomsLivingOrderService.getById(livingOrderId);
|
|
|
|
|
+ if(cancel != null) {
|
|
|
|
|
+ Calendar c1 = Calendar.getInstance();
|
|
|
|
|
+ c1.setTime(livingOrder.getArrivalTime());
|
|
|
|
|
+ Calendar c2 = Calendar.getInstance();
|
|
|
|
|
+ c2.setTime(new Date());
|
|
|
|
|
+
|
|
|
|
|
+ Integer diff = DateUtils.dateDiff('m',c1,c2);
|
|
|
|
|
+ if(cancel.getStatus().equals(0)) throw new JeecgBootException("不允许撤销入住");
|
|
|
|
|
+ if(Math.abs(diff)>cancel.getMinute()) throw new JeecgBootException("超过可撤销入住时间");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ BusBookingRooms bkroom = bookingRoomsService.getById(livingOrder.getBookingRoomId());
|
|
|
|
|
+ CesRooms room = roomsService.getById(bkroom.getRoomId());
|
|
|
|
|
+ room.setRoomStatus(RoomStatusEnum.EMPTY_DIRTY.getKey());
|
|
|
|
|
+ roomsService.updateById(room);
|
|
|
|
|
+ feeService.remove(Wrappers.<BusOrderFee>query().eq("living_order_id", livingOrderId));
|
|
|
|
|
+ roomsLivingOrderService.removeById(livingOrderId);
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|