|
|
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import lombok.SneakyThrows;
|
|
|
import org.jeecg.common.exception.JeecgBootException;
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
|
import org.jeecg.common.util.DateUtils;
|
|
|
@@ -16,6 +17,7 @@ import org.jeecg.modules.business.entity.*;
|
|
|
import org.jeecg.modules.business.enums.*;
|
|
|
import org.jeecg.modules.business.mapper.BusRoomBookingOrdersMapper;
|
|
|
import org.jeecg.modules.business.service.*;
|
|
|
+import org.jeecg.modules.business.util.MxTools;
|
|
|
import org.jeecg.modules.business.vo.*;
|
|
|
import org.jeecg.modules.rooms.Enum.RoomStatusEnum;
|
|
|
import org.jeecg.modules.rooms.Vo.BookingRealtimeVo;
|
|
|
@@ -33,6 +35,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.*;
|
|
|
@@ -1288,6 +1291,71 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ @SneakyThrows
|
|
|
+ @Override
|
|
|
+ public ForwardFangTaiVo forwardFangTai(String start, String end, String hotelId,Boolean isContainLeave) {
|
|
|
+ List<ForwardFangTaiQueryVo> vos = baseMapper.forwardFangTaiQuery(hotelId,start,end);
|
|
|
+ isContainLeave = isContainLeave == null?false:isContainLeave;
|
|
|
+ List<String> dayStrs = MxTools.findEveryDay(start,end);
|
|
|
+ ForwardFangTaiVo result = new ForwardFangTaiVo();
|
|
|
+ List<ForwardFangTaiDateVo> dateList = new ArrayList<>();
|
|
|
+ List<LayoutRoomCountVo> roomCountVos = baseMapper.getLayoutRoomCount(hotelId);
|
|
|
+ List<String> voLivingIds = vos.stream().map(s->s.getLivingId()).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<BusRoomsLivingOrder> allOrders =voLivingIds.size() > 0? roomsLivingOrderService.list(Wrappers.<BusRoomsLivingOrder>query()
|
|
|
+ .in("id",voLivingIds)):new ArrayList<>();
|
|
|
+
|
|
|
+ Boolean finalIsContainLeave = isContainLeave;
|
|
|
+ roomCountVos.forEach(t-> {
|
|
|
+ dayStrs.forEach(s-> {
|
|
|
+ ForwardFangTaiDateVo tableCell = new ForwardFangTaiDateVo();
|
|
|
+ tableCell.setDate(s);
|
|
|
+ tableCell.setLayoutId(t.getLayoutId());
|
|
|
+ List<BusRoomsLivingOrder> leaveOrders = new ArrayList<>();
|
|
|
+ List<BusRoomsLivingOrder> livingOrders = new ArrayList<>();
|
|
|
+ final int[] dayLeave = {0};
|
|
|
+ final int[] dayLiving = {0};
|
|
|
+ vos.forEach(c->{
|
|
|
+ Optional<BusRoomsLivingOrder> opFindOrder = allOrders.stream().filter(f->f.getId().equals(c.getLivingId())).findFirst();
|
|
|
+ if(opFindOrder == null) return;
|
|
|
+ BusRoomsLivingOrder findOrder = opFindOrder.get();
|
|
|
+ try {
|
|
|
+ long enter = DateUtils.parseDate(c.getEnterDate(),"yyyy-MM-dd").getTime();
|
|
|
+ long leave = DateUtils.parseDate(c.getLeaveDate(),"yyyy-MM-dd").getTime();
|
|
|
+
|
|
|
+ long curr = DateUtils.parseDate(s,"yyyy-MM-dd").getTime();
|
|
|
+
|
|
|
+ if(c.getLayoutId().equals(t.getLayoutId())
|
|
|
+ && c.getLeaveDate().equals(s)) {
|
|
|
+ dayLeave[0] += 1;
|
|
|
+ leaveOrders.add(findOrder);
|
|
|
+
|
|
|
+ }
|
|
|
+ boolean isContainLeaveCondition = enter <= curr && ( finalIsContainLeave.booleanValue()?
|
|
|
+ leave>=curr:leave>curr);// 是否包含今日预离
|
|
|
+ if(c.getLayoutId().equals(t.getLayoutId())
|
|
|
+ && isContainLeaveCondition ) {
|
|
|
+ dayLiving[0] += 1;
|
|
|
+ livingOrders.add(findOrder);
|
|
|
+ }
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ tableCell.setLeaveCount(dayLeave[0]);// 当天该房型预离数量
|
|
|
+ tableCell.setLeaveOrders(leaveOrders);// 当天预离订单
|
|
|
+ tableCell.setLivingCount(dayLiving[0]);// 当天在住数量
|
|
|
+ tableCell.setLivingOrders(livingOrders);// 当天该房型在住订单
|
|
|
+ dateList.add(tableCell);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ result.setDateList(dateList);
|
|
|
+ result.setLayoutRooms(roomCountVos);
|
|
|
+
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
private Boolean mergeSingle(String livingOrderId, String mergeLivingOrderId ) {
|
|
|
BusRoomsLivingOrder mergeLivingOrder = roomsLivingOrderService.getById(mergeLivingOrderId);
|
|
|
if(mergeLivingOrder == null) throw new JeecgBootException("合并的订单不存在");
|