|
|
@@ -1,12 +1,20 @@
|
|
|
package org.jeecg.modules.business.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
+import cn.hutool.core.util.BooleanUtil;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
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 net.sf.saxon.expr.instruct.ForEach;
|
|
|
import org.jeecg.common.exception.JeecgBootException;
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
|
import org.jeecg.common.util.DateUtils;
|
|
|
@@ -18,6 +26,7 @@ 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.finance.vo.OrderFeeVo;
|
|
|
import org.jeecg.modules.fw.entity.FwRoomClean;
|
|
|
import org.jeecg.modules.fw.entity.FwRoomExamine;
|
|
|
import org.jeecg.modules.fw.entity.FwRoomLock;
|
|
|
@@ -44,8 +53,12 @@ import javax.annotation.Resource;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
+import java.time.Duration;
|
|
|
+import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
+import java.time.ZoneId;
|
|
|
import java.util.*;
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
@@ -109,6 +122,9 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
private CesAllDayPriceRuleServiceImpl allDayPriceRuleService;
|
|
|
|
|
|
@Resource
|
|
|
+ private CesGoodsServiceImpl cesGoodsServiceImpl;
|
|
|
+
|
|
|
+ @Resource
|
|
|
private IBusAgreementOrderFeeService agreementOrderFeeService;
|
|
|
|
|
|
@Resource
|
|
|
@@ -312,25 +328,7 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
teamService.save(team);
|
|
|
} else {
|
|
|
if(isLiving && item.getRoomIds().size() > 1) {
|
|
|
- BusTeam team = new BusTeam();
|
|
|
- List<BusTeam> existTeams = teamService.list(Wrappers.<BusTeam>query().eq("is_delete", 0).eq("hotel_id", hotelId)
|
|
|
- .eq("rel_type",2)); // 1团队房,2联房
|
|
|
- Integer sortIndex = 1;
|
|
|
- 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.setIsDelete(0);
|
|
|
- team.setHotelId(hotelId);
|
|
|
- team.setSortIndex(sortIndex);
|
|
|
- team.setRelType(2);
|
|
|
-
|
|
|
- teamService.save(team);
|
|
|
+ addBusTeams(bookingId, hotelId);
|
|
|
}
|
|
|
}
|
|
|
//</editor-fold>
|
|
|
@@ -413,6 +411,28 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public void addBusTeams(String hotelId, String bookingId){
|
|
|
+ BusTeam team = new BusTeam();
|
|
|
+ List<BusTeam> existTeams = teamService.list(Wrappers.<BusTeam>query().eq("is_delete", 0).eq("hotel_id", hotelId)
|
|
|
+ .eq("rel_type",2)); // 1团队房,2联房
|
|
|
+ Integer sortIndex = 1;
|
|
|
+ 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.setIsDelete(0);
|
|
|
+ team.setHotelId(hotelId);
|
|
|
+ team.setSortIndex(sortIndex);
|
|
|
+ team.setRelType(2);
|
|
|
+
|
|
|
+ teamService.save(team);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 通过id获取预约单详情
|
|
|
* @param orderId
|
|
|
@@ -461,6 +481,13 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
orderInfo.setSettleType(opLvOrder.get().getSettleType());
|
|
|
}
|
|
|
BusRoomsLivingOrder order = opLvOrder.get();
|
|
|
+ if (ObjectUtil.isNotEmpty(order.getArrivalTime())&& ObjectUtil.isNotEmpty(order.getDueOutTime())){
|
|
|
+ long millisDiff = order.getDueOutTime().getTime() - order.getArrivalTime().getTime();
|
|
|
+
|
|
|
+ // 将毫秒数差值转换为天数
|
|
|
+ int daysBetween = (int) TimeUnit.DAYS.convert(millisDiff, TimeUnit.MILLISECONDS) + 1;
|
|
|
+ order.setDayCount(daysBetween);
|
|
|
+ }
|
|
|
List<BusLivingCustomer> currentLivingCustomers = livingCustomers.stream().filter(s->s.getLivingOrderId().equals(order.getId())).collect(Collectors.toList());
|
|
|
List<BusLivingLayoutDayPrice> lvDayPrices = livingLayoutDayPriceService.list(Wrappers.<BusLivingLayoutDayPrice>query().eq("living_order_id",order.getId()));
|
|
|
r.setLivingOrder(order);
|
|
|
@@ -480,7 +507,6 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
batches.forEach(s->{
|
|
|
batchesVo.add(copyBaseToBatch(s));
|
|
|
});
|
|
|
-
|
|
|
List<ExtendBusBookingRoomsVo> batchRooms = bookingRoomsService.bookingRooms(orderId,BookingOrdersType.TEAM.getKey());
|
|
|
List<BusBookingLayoutDayPrice> layoutDayPrices = dayPriceService.list(Wrappers.<BusBookingLayoutDayPrice>query()
|
|
|
.eq("booking_order_id",orderId)
|
|
|
@@ -1182,13 +1208,28 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<BusOrderFee> getLivingOrderFee(String orderId) {
|
|
|
+ public List<BusOrderFeeVo> getLivingOrderFee(String orderId) {
|
|
|
List<BusRoomsLivingOrder> livingOrders = roomsLivingOrderService.list(Wrappers.<BusRoomsLivingOrder>query().eq("booking_order_id",orderId));
|
|
|
if(livingOrders.size() > 0) {
|
|
|
List<String> livingOrderIds = livingOrders.stream().map(s->s.getId()).collect(Collectors.toList());
|
|
|
- List<BusOrderFee> orderFees = feeService.list(Wrappers.<BusOrderFee>query().in("living_order_id",livingOrderIds));
|
|
|
- return orderFees;
|
|
|
- } else return new ArrayList<>();
|
|
|
+ // 所有订单商品关联对象
|
|
|
+ List<BusOrderFeeGoodsVo> busOrderFeeGoodVos = orderFeeGoodsService.queryOrderGoodDetail(livingOrderIds);
|
|
|
+ // 所有订单
|
|
|
+ List<BusOrderFee> orderFees = feeService.list(Wrappers.<BusOrderFee>query().in("living_order_id",livingOrderIds).gt("money",0).eq("preferential_status", 1));
|
|
|
+ ArrayList<BusOrderFeeVo> busOrderFeeVos = new ArrayList<>();
|
|
|
+ orderFees.stream().forEach(e ->{
|
|
|
+ BusOrderFeeVo busOrderFeeVo = BeanUtil.copyProperties(e, BusOrderFeeVo.class);
|
|
|
+ // 订单为 商品订单 时
|
|
|
+ if (FeeSubjectType.SHANG_PIN.getKey().equals(e.getSubjectType())){
|
|
|
+ List<BusOrderFeeGoodsVo> busOrderFeeGoodsVo = busOrderFeeGoodVos.stream().filter(orderFeeGoodVo -> StrUtil.equals(orderFeeGoodVo.getOrderFeeId(), e.getId())).collect(Collectors.toList());
|
|
|
+ busOrderFeeVo.setFeeGoodVos(busOrderFeeGoodsVo);
|
|
|
+ }
|
|
|
+ busOrderFeeVos.add(busOrderFeeVo);
|
|
|
+ }
|
|
|
+ );
|
|
|
+ return busOrderFeeVos;
|
|
|
+ }
|
|
|
+ return new ArrayList<>();
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -1292,11 +1333,10 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
if (order == null) throw new JeecgBootException("订单错误");
|
|
|
BusBookingRooms bkRoom = bookingRoomsService.getById(order.getBookingRoomId());
|
|
|
if (bkRoom == null) throw new JeecgBootException("订单房间不存在");
|
|
|
- if (settleFee.getPrices() == null || settleFee.getPrices().size() == 0)
|
|
|
- throw new JeecgBootException("每天价格不能为空");
|
|
|
+ if (CollUtil.isEmpty(settleFee.getPrices()) && (settleFee.getMoney() == null || settleFee.getMoney().equals(new BigDecimal(0)))){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
if (order.getArrivalTime().getTime() >= dueOutTime.getTime()) throw new JeecgBootException("预离时间不能小于预抵时间");
|
|
|
- order.setDueOutTime(dueOutTime);
|
|
|
- roomsLivingOrderService.updateById(order);
|
|
|
if (settleFee != null && settleFee.getMoney() != null && !settleFee.getMoney().equals(new BigDecimal(0))) {
|
|
|
settleFee.setLivingOrderId(livingOrderId);
|
|
|
settleFee.setFeeType(2);
|
|
|
@@ -1306,18 +1346,44 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
settleFee.setPreferentialStatus(1); // 未结账
|
|
|
feeService.save(settleFee);
|
|
|
}
|
|
|
- CesRooms room = roomsService.getById(bkRoom.getRoomId());
|
|
|
- settleFee.getPrices().forEach(s -> {
|
|
|
- s.setRoomLayoutId(room.getLayoutId());
|
|
|
- s.setRoomId(bkRoom.getRoomId());
|
|
|
- s.setLivingType(1);
|
|
|
- s.setLivingOrderId(livingOrderId);
|
|
|
- });
|
|
|
- livingLayoutDayPriceService.saveBatch(settleFee.getPrices());
|
|
|
+ if(dueOutTime.getTime() >= order.getDueOutTime().getTime()){
|
|
|
+ CesRooms room = roomsService.getById(bkRoom.getRoomId());
|
|
|
+ settleFee.getPrices().forEach(s -> {
|
|
|
+ s.setRoomLayoutId(room.getLayoutId());
|
|
|
+ s.setRoomId(bkRoom.getRoomId());
|
|
|
+ s.setLivingType(1);
|
|
|
+ s.setLivingOrderId(livingOrderId);
|
|
|
+ });
|
|
|
+ livingLayoutDayPriceService.saveBatch(settleFee.getPrices());
|
|
|
+ }
|
|
|
+ order.setDueOutTime(dueOutTime);
|
|
|
+ roomsLivingOrderService.updateById(order);
|
|
|
return true;
|
|
|
// throw new JeecgBootException("设置失败");
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 判断续租是否跟预约订单冲突
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public BookingOrderEditVo roomIdBooked(String livingOrderId, Date newDueOutTime) {
|
|
|
+ BusRoomsLivingOrder order = roomsLivingOrderService.getById(livingOrderId);
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ String arrivalTimeStr = sdf.format(order.getArrivalTime());
|
|
|
+ List<BusRoomBookingOrders> bookingOrdersByRooms = baseMapper.findBookingOrderByRoom(order.getBookingRoomId(), arrivalTimeStr);
|
|
|
+ for (BusRoomBookingOrders bookingOrder: bookingOrdersByRooms) {
|
|
|
+ if (bookingOrder.getArrivalTime().getTime() <= newDueOutTime.getTime()){
|
|
|
+ BusCustomer busCustomer = customerService.getById(bookingOrder.getContactId());
|
|
|
+ BookingOrderEditVo bookingOrderVo = new BookingOrderEditVo();
|
|
|
+ bookingOrderVo.setOrderInfo(bookingOrder);
|
|
|
+ bookingOrderVo.setContactName(busCustomer.getName());
|
|
|
+ bookingOrderVo.setPhone(busCustomer.getPhone());
|
|
|
+ return bookingOrderVo;
|
|
|
+ };
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Boolean settleBillCheckOut(List<BusOrderFee> settleFees, String bookingOrderId) {
|
|
|
@@ -1446,11 +1512,18 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public Boolean splitLiving(String livingOrderId) {
|
|
|
+ public String splitLiving(String livingOrderId) {
|
|
|
BusRoomsLivingOrder livingOrder = roomsLivingOrderService.getById(livingOrderId);
|
|
|
if(livingOrder == null) throw new JeecgBootException("订单不存在");
|
|
|
BusBookingRooms bookingRoom = bookingRoomsService.getById(livingOrder.getBookingRoomId());
|
|
|
if(bookingRoom == null) throw new JeecgBootException("订单房间不存在");
|
|
|
+ long count = roomsLivingOrderService.count(Wrappers.<BusRoomsLivingOrder>query().eq("booking_order_id", livingOrder.getBookingOrderId()));
|
|
|
+ if (count == 2){
|
|
|
+ UpdateWrapper<BusTeam> uw = new UpdateWrapper<>();
|
|
|
+ uw.eq("booking_order_id", livingOrder.getBookingOrderId());
|
|
|
+ uw.set("is_delete", 1);
|
|
|
+ teamService.update(uw);
|
|
|
+ }
|
|
|
BusRoomBookingOrders newBookingOrder = copyBookingToAcceptOrder(livingOrder);
|
|
|
newBookingOrder.setHotelId(livingOrder.getHotelId());
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
|
|
|
@@ -1459,8 +1532,10 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
livingOrder.setBookingOrderId(newBookingOrder.getId());
|
|
|
roomsLivingOrderService.updateById(livingOrder);
|
|
|
bookingRoom.setBookingOrdersId(newBookingOrder.getId());
|
|
|
+ bookingRoom.setIsMain(true);
|
|
|
bookingRoomsService.updateById(bookingRoom);
|
|
|
- return true;
|
|
|
+
|
|
|
+ return newBookingOrder.getId();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -1501,7 +1576,13 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
|
|
|
@Override
|
|
|
public IPage<RoomLivingQueryVo> getLivingPageData(Integer status,String keyw, Page<RoomLivingQueryVo> page,String hotelId) {
|
|
|
- return baseMapper.getPage(page,status,keyw,hotelId);
|
|
|
+ IPage<RoomLivingQueryVo> RoomLivings = baseMapper.getPage(page, status, keyw, hotelId);
|
|
|
+ RoomLivings.getRecords().stream().forEach(e ->{
|
|
|
+ if (ObjectUtil.isNotEmpty(e.getRelType())){
|
|
|
+ e.setGroupTag(TeamEnum.val(e.getRelType()).getTitle() + e.getSortIndex());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return RoomLivings;
|
|
|
}
|
|
|
@Override
|
|
|
public IPage<KeLiItemVo> getLivingOrderKL(Integer status,String keyw,String hotelId,String thirdUserId, Page<KeLiItemVo> page) {
|
|
|
@@ -1598,10 +1679,12 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public Boolean mergeOrder(String mergeLivingOrderId, List<String> livingOrderId) {
|
|
|
+ public Boolean mergeOrder(String hotelId, String mainLivingOrderId, List<String> livingOrderId) {
|
|
|
+ BusRoomsLivingOrder mainLivingOrder = roomsLivingOrderService.getById(mainLivingOrderId);
|
|
|
livingOrderId.forEach(s->{
|
|
|
- this.mergeSingle(mergeLivingOrderId,s);
|
|
|
+ this.mergeSingle(mainLivingOrder,s);
|
|
|
});
|
|
|
+ addBusTeams(hotelId, mainLivingOrder.getBookingOrderId());
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
@@ -1939,40 +2022,47 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
});
|
|
|
return true;
|
|
|
}
|
|
|
-
|
|
|
- private Boolean mergeSingle(String livingOrderId, String mergeLivingOrderId ) {
|
|
|
+//bookingRooms.getBookingOrdersId()是关联房间号的关联id
|
|
|
+ private Boolean mergeSingle(BusRoomsLivingOrder mainLivingOrder, String mergeLivingOrderId ) {
|
|
|
+ //通过订单id找到订单
|
|
|
BusRoomsLivingOrder mergeLivingOrder = roomsLivingOrderService.getById(mergeLivingOrderId);
|
|
|
if(mergeLivingOrder == null) throw new JeecgBootException("合并的订单不存在");
|
|
|
if(mergeLivingOrder.getSettleType().equals(SettleTypeEnum.SETTLE_LEAVE.getKey())) throw new JeecgBootException("结账退房的订单无法合并");
|
|
|
+ //通过订单关联的房间id找到房间B
|
|
|
BusBookingRooms bookingRooms = bookingRoomsService.getById(mergeLivingOrder.getBookingRoomId());
|
|
|
List<BusRoomsLivingOrder> needMergeLivingOrders = new ArrayList<>();
|
|
|
-
|
|
|
- BusRoomsLivingOrder livingOrder = roomsLivingOrderService.getById(livingOrderId);
|
|
|
+ //主订单
|
|
|
if(bookingRooms.getIsMain()){
|
|
|
+ //找出房间B所有的关联订单,包括了B房间自己
|
|
|
List<BusRoomsLivingOrder> relationOtherLivingOrders = roomsLivingOrderService.list(Wrappers.<BusRoomsLivingOrder>query()
|
|
|
.eq("booking_order_id", bookingRooms.getBookingOrdersId()));
|
|
|
+ //所有订单的房间id集合
|
|
|
List<String> bookingRoomIds = relationOtherLivingOrders.stream().map(s->s.getBookingRoomId()).collect(Collectors.toList());
|
|
|
+ //找出B房间所有的关联房间
|
|
|
List<BusBookingRooms> bookingRoomsList = bookingRoomsService.list(Wrappers.<BusBookingRooms>query().in("id",bookingRoomIds));
|
|
|
bookingRoomsList.forEach(s->{
|
|
|
s.setIsMain(false);
|
|
|
- s.setBookingOrdersId(livingOrder.getBookingOrderId());
|
|
|
+ s.setBookingOrdersId(mainLivingOrder.getBookingOrderId());
|
|
|
});
|
|
|
+ //将修改后关联标识后的房间存好
|
|
|
bookingRoomsService.updateBatchById(bookingRoomsList);
|
|
|
needMergeLivingOrders.addAll(relationOtherLivingOrders);
|
|
|
|
|
|
- BusBookingRooms mainBkRoom = bookingRoomsService.getOne(Wrappers.<BusBookingRooms>query().eq("booking_orders_id",bookingRooms.getBookingOrdersId()));
|
|
|
- if(mainBkRoom != null) {
|
|
|
- mainBkRoom.setIsMain(true);
|
|
|
- bookingRoomsService.updateById(mainBkRoom); // 设置预约的主房
|
|
|
- }
|
|
|
+// BusBookingRooms mainBkRoom = bookingRoomsService.getOne(Wrappers.<BusBookingRooms>query().eq("booking_orders_id",bookingRooms.getBookingOrdersId()));
|
|
|
+// if(mainBkRoom != null) {
|
|
|
+// mainBkRoom.setIsMain(true);
|
|
|
+// bookingRoomsService.updateById(mainBkRoom); // 设置预约的主房
|
|
|
+// }
|
|
|
} else {
|
|
|
needMergeLivingOrders.add(mergeLivingOrder);
|
|
|
}
|
|
|
+ //所有订单都改成主订单的关联标识id
|
|
|
needMergeLivingOrders.forEach(s->{
|
|
|
s.setBeforeMergeBookingOrderId(s.getBookingOrderId());
|
|
|
- s.setBookingOrderId(livingOrder.getBookingOrderId());
|
|
|
+ s.setBookingOrderId(mainLivingOrder.getBookingOrderId());
|
|
|
});
|
|
|
roomsLivingOrderService.updateBatchById(needMergeLivingOrders);
|
|
|
+
|
|
|
return true;
|
|
|
}
|
|
|
@Override
|
|
|
@@ -2123,7 +2213,7 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
// if(user == null) throw new JeecgBootException("请登录");
|
|
|
if(hotelId == null) throw new JeecgBootException("未找到酒店");
|
|
|
BusOrderFee preferFeeItem = null;
|
|
|
- if(settleFees.stream().anyMatch(s->s.getIsPreferential().equals(true))){
|
|
|
+ if(settleFees.stream().anyMatch(s-> BooleanUtil.isTrue(s.getIsPreferential()))){
|
|
|
preferFeeItem = settleFees.stream().filter(s->s.getIsPreferential().equals(true)).findFirst().get();
|
|
|
if(preferFeeItem.getMoney()==null || preferFeeItem.getMoney().compareTo(BigDecimal.valueOf(0)) <= 0) throw new JeecgBootException("优惠价不能小于或等于0");
|
|
|
if(preferFeeItem.getCouponscashId() != null && !preferFeeItem.getCouponscashId().isEmpty()) {
|
|
|
@@ -2151,7 +2241,7 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
}
|
|
|
List<BusRoomPayType> payTypes = payTypeService.list();
|
|
|
settleFees.forEach(s->{
|
|
|
- if(s.getIsPreferential().equals(true)) return;
|
|
|
+ if(BooleanUtil.isTrue(s.getIsPreferential())) return;
|
|
|
|
|
|
String payTypeId = s.getPayType();
|
|
|
if(payTypeId != null && !payTypeId.isEmpty()) {
|
|
|
@@ -2567,7 +2657,6 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
s.setLivingOrderId(livingOrderId);
|
|
|
});
|
|
|
livingLayoutDayPriceService.saveBatch(prices);
|
|
|
-
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
@@ -2635,4 +2724,33 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+// @Override
|
|
|
+// public Long count(String bookingOrderId,String hotelId) {
|
|
|
+// QueryWrapper<BusRoomsLivingOrder> qw = new QueryWrapper<>();
|
|
|
+// qw.eq("hotel_id", hotelId);
|
|
|
+// qw.eq("booking_order_id", bookingOrderId);
|
|
|
+// long count = roomsLivingOrderService.count(qw);
|
|
|
+// return count;
|
|
|
+// }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Boolean canOnlyPaySelf(String bookingOrderId, String hotelId, String roomId) {
|
|
|
+ QueryWrapper<BusRoomsLivingOrder> qw = new QueryWrapper<>();
|
|
|
+ qw.eq("hotel_id", hotelId);
|
|
|
+ qw.eq("booking_order_id", bookingOrderId);
|
|
|
+ long count = roomsLivingOrderService.count(qw);
|
|
|
+ BusBookingRooms bookingRooms = bookingRoomsService.getOne(Wrappers.<BusBookingRooms>query().eq("booking_orders_id", bookingOrderId).eq("room_id", roomId));
|
|
|
+ if (count>1 && !bookingRooms.getIsMain()){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Boolean payPortionFee(List<String> feeIds) {
|
|
|
+ boolean isUpdate = feeService.update(Wrappers.<BusOrderFee>update().set("preferential_status", 2).in("id", feeIds));
|
|
|
+ return isUpdate;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|