|
|
@@ -16,6 +16,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import lombok.SneakyThrows;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
+import org.aspectj.weaver.ast.Var;
|
|
|
import org.jeecg.common.api.dto.message.MessageDTO;
|
|
|
import org.jeecg.common.constant.CommonConstant;
|
|
|
import org.jeecg.common.exception.JeecgBootException;
|
|
|
@@ -1142,7 +1143,7 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
dayOrderFee.setRoomId(orderRoom.getId());
|
|
|
String roomName = orderRoom.getPrefix() != null?orderRoom.getPrefix():"";
|
|
|
roomName += roomName + orderRoom.getName();
|
|
|
- dayOrderFee.setRemark("【"+roomName + "】 "+ DateUtils.formatDate(dayOrderFee.getDayTime()) + " 当日房费");
|
|
|
+ dayOrderFee.setRemark("【"+roomName + "】 "+ DateUtils.formatDateTime() + " 当日房费");
|
|
|
dayOrderFee.setLivingOrderId(livingOrder.getId());
|
|
|
dayOrderFee.setHotelId(hotelId);
|
|
|
feeService.save(dayOrderFee);
|
|
|
@@ -2180,37 +2181,38 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Boolean leaveNotSettle(String bookingOrderId, String livingOrderId){
|
|
|
-// if(bookingOrderId != null && !bookingOrderId.isEmpty()) {
|
|
|
-// List<BusRoomsLivingOrder> bookingLivings = roomsLivingOrderService.list(Wrappers.<BusRoomsLivingOrder>query()
|
|
|
-// .eq("booking_order_id",bookingOrderId));
|
|
|
-// List<String> livingOrderIds = bookingLivings.stream().map(s->s.getId()).collect(Collectors.toList());
|
|
|
-// if(livingOrderIds.size() == 0) throw new JeecgBootException("没有入住信息");
|
|
|
-// List<CesRooms> rooms = roomsService.list(Wrappers.<CesRooms>query()
|
|
|
-// .in("living_order_id",livingOrderIds));
|
|
|
-// rooms.forEach(s->{
|
|
|
-// s.setLivingOrderId("");
|
|
|
-// s.setRoomStatus(RoomStatusEnum.EMPTY_DIRTY.getKey());
|
|
|
-// s.setLastRoomStatus(RoomStatusEnum.EMPTY_DIRTY.getKey());
|
|
|
-// });
|
|
|
-// bookingLivings.forEach(s->s.setSettleType(SettleTypeEnum.UN_SETTLE_LEAVE.getKey()));
|
|
|
-// roomsLivingOrderService.updateBatchById(bookingLivings);
|
|
|
-// roomsService.updateBatchById(rooms);
|
|
|
-// } else
|
|
|
- if(livingOrderId != null && !livingOrderId.isEmpty()) {
|
|
|
- BusRoomsLivingOrder livingOrder = roomsLivingOrderService.getById(livingOrderId);
|
|
|
- if(livingOrder == null) throw new JeecgBootException("订单未找到");
|
|
|
- BusBookingRooms bookingRooms = bookingRoomsService.getById(livingOrder.getBookingRoomId());
|
|
|
- if(bookingRooms == null) throw new JeecgBootException("数据异常");
|
|
|
- if(bookingRooms.getIsMain().equals(true)) throw new JeecgBootException("主房不能单独先走不结");
|
|
|
- CesRooms room = roomsService.getOne(Wrappers.<CesRooms>query().eq("id",bookingRooms.getRoomId()));
|
|
|
- if(room == null) throw new JeecgBootException("未找到订单信息");
|
|
|
- room.setLivingOrderId("");
|
|
|
- room.setRoomStatus(RoomStatusEnum.EMPTY_DIRTY.getKey());
|
|
|
- room.setLastRoomStatus(RoomStatusEnum.EMPTY_DIRTY.getKey());
|
|
|
- livingOrder.setSettleType(SettleTypeEnum.UN_SETTLE_LEAVE.getKey());
|
|
|
- roomsLivingOrderService.updateById(livingOrder);
|
|
|
- roomsService.updateById(room);
|
|
|
- } else throw new JeecgBootException("参数错误");
|
|
|
+ if (StrUtil.isEmpty(bookingOrderId) || StrUtil.isEmpty(livingOrderId)){
|
|
|
+ throw new JeecgBootException("参数异常");
|
|
|
+ }
|
|
|
+ // 找出关联的所有居住单
|
|
|
+ List<BusRoomsLivingOrder> livingOrderList = roomsLivingOrderService.list(Wrappers.<BusRoomsLivingOrder>lambdaQuery()
|
|
|
+ .eq(BusRoomsLivingOrder::getBookingOrderId, bookingOrderId));
|
|
|
+ long unLeaveCount = livingOrderList.stream().filter(e -> SettleTypeEnum.UN_LEAVE.getKey().equals(e.getSettleType())).count();
|
|
|
+ // 需要先走不结的居住订单
|
|
|
+ Optional<BusRoomsLivingOrder> orderOptional = livingOrderList.stream().filter(e -> e.getId().equals(livingOrderId)).findFirst();
|
|
|
+ if (!orderOptional.isPresent()){
|
|
|
+ throw new JeecgBootException("订单未找到");
|
|
|
+ }
|
|
|
+ BusBookingRooms bookingRooms = bookingRoomsService.getById(orderOptional.get().getBookingRoomId());
|
|
|
+ if(bookingRooms == null) throw new JeecgBootException("数据异常");
|
|
|
+ // 是主房,且有正常入住的附属房
|
|
|
+ if(bookingRooms.getIsMain() && livingOrderList.size() > 1 && StrUtil.isEmpty(orderOptional.get().getContractTeamId())){
|
|
|
+ if (unLeaveCount > 1){
|
|
|
+ throw new JeecgBootException("为主房不能单独先走不结");
|
|
|
+ }
|
|
|
+ BusMarketAgreementUnit marketAgreementUnit = marketAgreementUnitService.getById(orderOptional.get().getContractTeamId());
|
|
|
+ if (marketAgreementUnit == null){
|
|
|
+ throw new JeecgBootException("为主房且顾客不是协议单位不能先走不结");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ CesRooms room = roomsService.getOne(Wrappers.<CesRooms>query().eq("id",bookingRooms.getRoomId()));
|
|
|
+ if(room == null) throw new JeecgBootException("未找到订单信息");
|
|
|
+ room.setLivingOrderId("");
|
|
|
+ room.setRoomStatus(RoomStatusEnum.EMPTY_DIRTY.getKey());
|
|
|
+ room.setLastRoomStatus(RoomStatusEnum.EMPTY_DIRTY.getKey());
|
|
|
+ orderOptional.get().setSettleType(SettleTypeEnum.UN_SETTLE_LEAVE.getKey());
|
|
|
+ roomsLivingOrderService.updateById(orderOptional.get());
|
|
|
+ roomsService.updateById(room);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
@@ -2266,8 +2268,8 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
return roomLivings;
|
|
|
}
|
|
|
@Override
|
|
|
- public IPage<KeLiItemVo> getLivingOrderKL(Integer status,String keyw,String hotelId,String thirdUserId, Page<KeLiItemVo> page) {
|
|
|
- IPage<KeLiItemVo> pRes = baseMapper.getKeLiLiving(page,thirdUserId,hotelId,keyw,status);
|
|
|
+ public IPage<KeLiItemVo> getLivingOrderKL(Integer status,String keyw,String hotelId,String thirdUserId, Page<KeLiItemVo> page, Date startTime,Date endTime) {
|
|
|
+ IPage<KeLiItemVo> pRes = baseMapper.getKeLiLiving(page,thirdUserId,hotelId,keyw,status,startTime,endTime);
|
|
|
List<String> livingIds = pRes.getRecords().stream().map(s->s.getId()).collect(Collectors.toList());
|
|
|
List<BusLivingLayoutDayPrice> prices = livingIds.size() >0? livingLayoutDayPriceService.list(Wrappers.<BusLivingLayoutDayPrice>query()
|
|
|
.in("living_order_id",livingIds).orderByAsc("day_time")) : new ArrayList<>();
|
|
|
@@ -2278,8 +2280,8 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
return pRes;
|
|
|
}
|
|
|
@Override
|
|
|
- public IPage<KeLiItemVo> getBookingOrderKL(Integer status,String keyw,String hotelId,String thirdUserId, Page<KeLiItemVo> page) {
|
|
|
- IPage<KeLiItemVo> pRes = baseMapper.getKeBooking(page,thirdUserId,hotelId,keyw,status);
|
|
|
+ public IPage<KeLiItemVo> getBookingOrderKL(Integer status,String keyw,String hotelId,String thirdUserId, Page<KeLiItemVo> page, Date startTime,Date endTime) {
|
|
|
+ IPage<KeLiItemVo> pRes = baseMapper.getKeBooking(page,thirdUserId,hotelId,keyw,status,startTime,endTime);
|
|
|
List<String> livingIds = pRes.getRecords().stream().map(s->s.getId()).collect(Collectors.toList());
|
|
|
List<BusBookingLayoutDayPrice> prices = livingIds.size() >0? dayPriceService.list(Wrappers.<BusBookingLayoutDayPrice>query()
|
|
|
.in("booking_order_id",livingIds).orderByAsc("day_time")) : new ArrayList<>();
|