|
|
@@ -16,7 +16,6 @@ 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;
|
|
|
@@ -175,6 +174,7 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
@Resource
|
|
|
private IBusHotelService busHotelService;
|
|
|
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public String bookingOrderSave(BookingOrderSaveDto item, Boolean isTeam,Boolean isLiving,String hotelId) {
|
|
|
@@ -253,7 +253,9 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
}
|
|
|
} else if(item.getLivingRoomDayPrices() != null && item.getLivingRoomDayPrices().size() > 0){
|
|
|
|
|
|
- } else throw new JeecgBootException("客人信息不能为空");
|
|
|
+ } else if (item.getOrderInfo().getBookingType() == 5) {
|
|
|
+
|
|
|
+ }else throw new JeecgBootException("客人信息不能为空");
|
|
|
|
|
|
// 【添加客人信息 end】
|
|
|
// 散客预定
|
|
|
@@ -309,27 +311,30 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
}
|
|
|
bookingRoomsService.saveBatch(bookingRooms);
|
|
|
|
|
|
- // 处理预定每天的房型价格 Start
|
|
|
- if(item.getLivingRoomDayPrices() != null && item.getLivingRoomDayPrices().size() > 0) {
|
|
|
- if(item.getLivingRoomDayPrices().stream().anyMatch(o->o.getPrice()==null || o.getDayTime() == null || o.getRoomId() == null))
|
|
|
- throw new JeecgBootException("参数错误,请传入价格、日期、房型");
|
|
|
- // 入住之后在save
|
|
|
- } else {
|
|
|
- if(item.getLayoutDayPrices() == null || item.getLayoutDayPrices().size() == 0)
|
|
|
- throw new JeecgBootException("参数错误,对应房型当天价格必传");
|
|
|
- if(item.getLayoutDayPrices().stream().anyMatch(o->o.getPrice()==null || o.getDayTime() == null || o.getRoomLayoutId() == null))
|
|
|
- throw new JeecgBootException("参数错误,请传入价格、日期、房型");
|
|
|
- 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.NORMAL.getKey());
|
|
|
- }
|
|
|
- });
|
|
|
- List<String> lList = item.getRoomIds().stream().map(w->w.getLayoutId()).collect(Collectors.toList());
|
|
|
- dayPriceService.saveBatch(item.getLayoutDayPrices().stream().filter(l->lList.contains(l.getRoomLayoutId())).collect(Collectors.toList()));
|
|
|
+ if (item.getOrderInfo().getBookingType() != 5){
|
|
|
+ // 处理预定每天的房型价格 Start
|
|
|
+ if(item.getLivingRoomDayPrices() != null && item.getLivingRoomDayPrices().size() > 0) {
|
|
|
+ if(item.getLivingRoomDayPrices().stream().anyMatch(o->o.getPrice()==null || o.getDayTime() == null || o.getRoomId() == null))
|
|
|
+ throw new JeecgBootException("参数错误,请传入价格、日期、房型");
|
|
|
+ // 入住之后在save
|
|
|
+ } else {
|
|
|
+ if(item.getLayoutDayPrices() == null || item.getLayoutDayPrices().size() == 0)
|
|
|
+ throw new JeecgBootException("参数错误,对应房型当天价格必传");
|
|
|
+ if(item.getLayoutDayPrices().stream().anyMatch(o->o.getPrice()==null || o.getDayTime() == null || o.getRoomLayoutId() == null))
|
|
|
+ throw new JeecgBootException("参数错误,请传入价格、日期、房型");
|
|
|
+ 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.NORMAL.getKey());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ List<String> lList = item.getRoomIds().stream().map(w->w.getLayoutId()).collect(Collectors.toList());
|
|
|
+ dayPriceService.saveBatch(item.getLayoutDayPrices().stream().filter(l->lList.contains(l.getRoomLayoutId())).collect(Collectors.toList()));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
// 处理预定每天的房型价格 End
|
|
|
|
|
|
// 预约时不添加联房和团队标识,入住时才添加
|
|
|
@@ -1023,7 +1028,8 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public String bookingToLive(String bookingRoomId, List<BusLivingCustomer> customers, String hotelId, Boolean bookingLiving, BusRoomBookingOrders livingRoomOrderInfo) {
|
|
|
+ public String bookingToLive(String bookingRoomId, List<BusLivingCustomer> customers, String hotelId, Boolean bookingLiving,
|
|
|
+ BusRoomBookingOrders livingRoomOrderInfo, CesHouseLongRentScheme longRentScheme) {
|
|
|
BusBookingRooms bkRoom = bookingRoomsService.getById(bookingRoomId);
|
|
|
if(bkRoom == null) throw new JeecgBootException("关联房间不存在");
|
|
|
BusRoomBookingOrders bookingOrders = getById(bkRoom.getBookingOrdersId());
|
|
|
@@ -1121,33 +1127,11 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
//</editor-fold>
|
|
|
|
|
|
//<editor-fold desc="todo:账单相关">
|
|
|
- if(bookingLiving != null && bookingLiving) {
|
|
|
- BigDecimal money = new BigDecimal(0);
|
|
|
- BusLivingLayoutDayPrice price = livingLayoutDayPriceService.getOne(Wrappers.<BusLivingLayoutDayPrice>query()
|
|
|
- .eq("living_order_id", livingOrder.getId()).eq("day_time",DateUtils.formatDate(new Date())+" 00:00:00"));
|
|
|
- if(price != null) {
|
|
|
- money = price.getPrice();
|
|
|
- } else {
|
|
|
- CesRoomLayout layout = layoutService.getById(room.getLayoutId());
|
|
|
- if(layout == null) throw new JeecgBootException("房价不存在");
|
|
|
- money = layout.getMarketPrice();
|
|
|
- }
|
|
|
+// if(bookingLiving != null && bookingLiving) {
|
|
|
|
|
|
- BusOrderFee dayOrderFee = new BusOrderFee();
|
|
|
- dayOrderFee.setDayTime(new Date());
|
|
|
- dayOrderFee.setCreateTime(new Date());
|
|
|
- dayOrderFee.setMoney(money);
|
|
|
- dayOrderFee.setFeeType(1);
|
|
|
- dayOrderFee.setSubjectType(FeeSubjectType.MEI_RI_FANG_FEI.getKey());
|
|
|
- CesRooms orderRoom = room;
|
|
|
- dayOrderFee.setRoomId(orderRoom.getId());
|
|
|
- String roomName = orderRoom.getPrefix() != null?orderRoom.getPrefix():"";
|
|
|
- roomName += roomName + orderRoom.getName();
|
|
|
- dayOrderFee.setRemark("【"+roomName + "】 "+ DateUtils.formatDateTime() + " 当日房费");
|
|
|
- dayOrderFee.setLivingOrderId(livingOrder.getId());
|
|
|
- dayOrderFee.setHotelId(hotelId);
|
|
|
- feeService.save(dayOrderFee);
|
|
|
- }
|
|
|
+ feeService.addBillFee(livingOrder, room,longRentScheme);
|
|
|
+
|
|
|
+// }
|
|
|
|
|
|
/*添加消息通知*/
|
|
|
BusHotel busHotel = busHotelService.getById(room.getHotelId());
|
|
|
@@ -1175,9 +1159,13 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
if(ObjectUtils.isEmpty(cesAllDayPriceRule)) {
|
|
|
throw new JeecgBootException("未找到超时收费规则");
|
|
|
}
|
|
|
- Calendar calendar = getRemindTime(livingOrder, cesAllDayPriceRule, livingRoomOrderInfo.getBookingType());
|
|
|
- SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
|
|
- redisTemplate.opsForZSet().add("overTimerOrder", livingOrder.getId(), calendar.getTimeInMillis());
|
|
|
+ if (livingOrder.getLivingType() != 5){
|
|
|
+ Calendar calendar = getRemindTime(livingOrder, cesAllDayPriceRule, livingRoomOrderInfo.getBookingType());
|
|
|
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
|
|
+ redisTemplate.opsForZSet().add("overTimerOrder", livingOrder.getId(), calendar.getTimeInMillis());
|
|
|
+ } else {
|
|
|
+
|
|
|
+ }
|
|
|
roomsService.getReserveRoom();
|
|
|
//</editor-fold>
|
|
|
return livingOrder.getId();
|
|
|
@@ -1365,7 +1353,7 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
|
|
|
private Map<String, BigDecimal> getRoomOrderFees(String livingOrderId) {
|
|
|
List<BusOrderFee> fees = feeService.list(Wrappers.<BusOrderFee>query()
|
|
|
- .eq("living_order_id",livingOrderId).eq("preferential_status",1));
|
|
|
+ .eq("living_order_id",livingOrderId));
|
|
|
List<BusOrderFee> xiaofeiList = fees.stream().filter(s->s.getFeeType().equals(1)).collect(Collectors.toList());
|
|
|
List<BusOrderFee> shoukuanList = fees.stream().filter(s->s.getFeeType().equals(2)).collect(Collectors.toList());
|
|
|
List<BusOrderFee> depositList = shoukuanList.stream().filter(s->ObjectUtil.equals(s.getSubjectType(),"1")).collect(Collectors.toList());
|
|
|
@@ -1836,7 +1824,7 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
nextCalendar.setTime(livingOrder.getDueOutTime());
|
|
|
nextCalendar.set(Calendar.YEAR, nowCalendar.get(Calendar.YEAR));
|
|
|
nextCalendar.set(Calendar.MONTH, nowCalendar.get(Calendar.MONTH));
|
|
|
- nextCalendar.set(Calendar.DAY_OF_MONTH, nowCalendar.get(Calendar.YEAR));
|
|
|
+ nextCalendar.set(Calendar.DAY_OF_MONTH, nowCalendar.get(Calendar.DAY_OF_MONTH));
|
|
|
nextCalendar.add(Calendar.DAY_OF_YEAR,1);
|
|
|
// 修改预离时间
|
|
|
if(nextCalendar.getTime().compareTo(livingOrder.getDueOutTime()) > 0){
|
|
|
@@ -2377,7 +2365,7 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
livingCustomer.setId(null);
|
|
|
livingCustomer.setLivingOrderId(null);
|
|
|
customers.add(livingCustomer);
|
|
|
- String livingOrderId = bookingToLive(bookingRooms.getId(), customers,hotelId,null,null);
|
|
|
+ String livingOrderId = bookingToLive(bookingRooms.getId(), customers,hotelId,null,null, null);
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
@@ -3177,8 +3165,9 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
BookingLayoutRoomsDto bkRoomItem = livingData.getRoomIds().stream().filter(s->s.getRoomId().equals(bkRoom.getRoomId())).findFirst().get();
|
|
|
List<BusLivingCustomer> customers = bkRoomItem.getLivingCustomers();
|
|
|
if(customers == null || customers.isEmpty()) throw new JeecgBootException("请添加客户信息");
|
|
|
+
|
|
|
// 保存入住单,修改房间状态
|
|
|
- String livingOrderId = bookingToLive(bkRoom.getId(), customers,hotelId,null, bkRoomItem.getRoomOrderInfo());
|
|
|
+ String livingOrderId = bookingToLive(bkRoom.getId(), customers,hotelId,null, bkRoomItem.getRoomOrderInfo(),bkRoomItem.getLongRentScheme());
|
|
|
// 将预约时交的押金,放到主房
|
|
|
if (bkRoom.getIsMain()){
|
|
|
LambdaUpdateWrapper<BusOrderFee> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
@@ -3189,6 +3178,7 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
updateWrapper.isNull(BusOrderFee::getLivingOrderId);
|
|
|
feeService.update(updateWrapper);
|
|
|
}
|
|
|
+
|
|
|
// 费用关联到主房
|
|
|
if(livingData.getOrderFees()!=null && !livingData.getOrderFees().isEmpty()) {
|
|
|
List<BusOrderFee> findRoomFees = livingData.getOrderFees().stream().filter(t->t.getRoomId().equals(bkRoom.getRoomId())).collect(Collectors.toList());
|
|
|
@@ -3252,21 +3242,22 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
// });
|
|
|
feeService.collectionBatch(findRoomFees, hotelId);
|
|
|
}
|
|
|
+
|
|
|
// 另外每个房间还要在入住时生成每日房费账单
|
|
|
- BusOrderFee roomFee = new BusOrderFee();
|
|
|
- roomFee.setRoomId(bkRoom.getRoomId());
|
|
|
- roomFee.setLivingOrderId(livingOrderId);
|
|
|
- roomFee.setFeeType(1); // 消费
|
|
|
- List<BusLivingLayoutDayPrice> roomDayPrice = livingData.getLivingRoomDayPrices().stream()
|
|
|
- .filter(i->i.getRoomId().equals(bkRoom.getRoomId())).collect(Collectors.toList());
|
|
|
- BigDecimal dayRoomFee = currentDayFee(roomDayPrice,null);
|
|
|
- if(dayRoomFee == null) throw new JeecgBootException("未找到当日房价");
|
|
|
- roomFee.setMoney(dayRoomFee); // 取当日房费的优惠价 其他时间要查询房价方案、每日房价,房型门市价按照规则去取
|
|
|
- roomFee.setCreateTime(new Date());
|
|
|
- roomFee.setDayTime(new Date());
|
|
|
- roomFee.setHotelId(hotelId);
|
|
|
- roomFee.setSubjectType(FeeSubjectType.MEI_RI_FANG_FEI.getKey());
|
|
|
- feeService.save(roomFee);
|
|
|
+// BusOrderFee roomFee = new BusOrderFee();
|
|
|
+// roomFee.setRoomId(bkRoom.getRoomId());
|
|
|
+// roomFee.setLivingOrderId(livingOrderId);
|
|
|
+// roomFee.setFeeType(1); // 消费
|
|
|
+// List<BusLivingLayoutDayPrice> roomDayPrice = livingData.getLivingRoomDayPrices().stream()
|
|
|
+// .filter(i->i.getRoomId().equals(bkRoom.getRoomId())).collect(Collectors.toList());
|
|
|
+// BigDecimal dayRoomFee = currentDayFee(roomDayPrice,null);
|
|
|
+// if(dayRoomFee == null) throw new JeecgBootException("未找到当日房价");
|
|
|
+// roomFee.setMoney(dayRoomFee); // 取当日房费的优惠价 其他时间要查询房价方案、每日房价,房型门市价按照规则去取
|
|
|
+// roomFee.setCreateTime(new Date());
|
|
|
+// roomFee.setDayTime(new Date());
|
|
|
+// roomFee.setHotelId(hotelId);
|
|
|
+// roomFee.setSubjectType(FeeSubjectType.MEI_RI_FANG_FEI.getKey());
|
|
|
+// feeService.save(roomFee);
|
|
|
results.put(bkRoom.getRoomId(),livingOrderId);
|
|
|
});
|
|
|
return results;
|