|
|
@@ -328,7 +328,7 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
teamService.save(team);
|
|
|
} else {
|
|
|
if(isLiving && item.getRoomIds().size() > 1) {
|
|
|
- addBusTeams(bookingId, hotelId);
|
|
|
+ addBusTeams(hotelId, bookingId);
|
|
|
}
|
|
|
}
|
|
|
//</editor-fold>
|
|
|
@@ -497,7 +497,7 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
});
|
|
|
result.setLivingRoomIds(livingRooms);
|
|
|
//</editor-fold>
|
|
|
- BusTeam team = teamService.getOne(Wrappers.<BusTeam>query().eq("booking_order_id",orderId));
|
|
|
+ BusTeam team = teamService.getOne(Wrappers.<BusTeam>query().eq("booking_order_id",orderId).eq("is_delete",0));
|
|
|
if(team != null) {
|
|
|
result.setTeamTag(team.getSortIndex());
|
|
|
}
|
|
|
@@ -1528,6 +1528,7 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
newBookingOrder.setHotelId(livingOrder.getHotelId());
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
|
|
|
newBookingOrder.setBookingOrdersNo("YD"+sdf.format(System.currentTimeMillis()));
|
|
|
+ newBookingOrder.setBookingOrdersType(1);
|
|
|
save(newBookingOrder);
|
|
|
livingOrder.setBookingOrderId(newBookingOrder.getId());
|
|
|
roomsLivingOrderService.updateById(livingOrder);
|
|
|
@@ -1541,28 +1542,29 @@ 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()) {
|
|
|
+// 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("living_order_id",livingOrderId));
|
|
|
+ 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());
|
|
|
@@ -1575,6 +1577,28 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public Boolean cancelLeaveNotSettle(String bookingOrderId, String livingOrderId) {
|
|
|
+ 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("数据异常");
|
|
|
+ CesRooms room = roomsService.getOne(Wrappers.<CesRooms>query().eq("id",bookingRooms.getRoomId()));
|
|
|
+ if(room == null) throw new JeecgBootException("未找到订单信息");
|
|
|
+ if (!RoomStatusEnum.EMPTY_DIRTY.getKey().equals(room.getRoomStatus()) && !RoomStatusEnum.EMPTY_CLEAR.getKey().equals(room.getRoomStatus())){
|
|
|
+ throw new JeecgBootException("房间不能重新入住");
|
|
|
+ }
|
|
|
+ room.setLivingOrderId(livingOrderId);
|
|
|
+ room.setRoomStatus(RoomStatusEnum.LIVE_DIRTY.getKey());
|
|
|
+ room.setLastRoomStatus(RoomStatusEnum.EMPTY_DIRTY.getKey());
|
|
|
+ livingOrder.setSettleType(SettleTypeEnum.UN_LEAVE.getKey());
|
|
|
+ roomsLivingOrderService.updateById(livingOrder);
|
|
|
+ roomsService.updateById(room);
|
|
|
+ } else throw new JeecgBootException("参数错误");
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public IPage<RoomLivingQueryVo> getLivingPageData(Integer status,String keyw, Page<RoomLivingQueryVo> page,String hotelId) {
|
|
|
IPage<RoomLivingQueryVo> RoomLivings = baseMapper.getPage(page, status, keyw, hotelId);
|
|
|
RoomLivings.getRecords().stream().forEach(e ->{
|
|
|
@@ -2022,6 +2046,45 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
});
|
|
|
return true;
|
|
|
}
|
|
|
+
|
|
|
+ public Boolean batchUpdateOrderPrice(List<UpdateOrderPriceDto> infos){
|
|
|
+ List<BusLivingLayoutDayPrice> dayPriceList = new ArrayList<>();
|
|
|
+ ArrayList<BusOrderFee> orderFeeList = new ArrayList<>();
|
|
|
+ infos.forEach(info -> {
|
|
|
+ if(info.getLivingOrderId() == null || info.getLivingOrderId().isEmpty()) throw new JeecgBootException("参数错误");
|
|
|
+ if(info.getDayPrices() == null || info.getDayPrices().isEmpty()) throw new JeecgBootException("参数错误");
|
|
|
+ info.getDayPrices().forEach(s-> {
|
|
|
+ long stamp1 = 0;
|
|
|
+ long stamp2 = 0;
|
|
|
+ try{
|
|
|
+ stamp1 = DateUtils.parseDate(DateUtils.formatDate(s.getDayTime()) ,"yyyy-MM-dd").getTime();
|
|
|
+ stamp2 = DateUtils.parseDate(DateUtils.formatDate(new Date()) ,"yyyy-MM-dd").getTime();
|
|
|
+ } catch(Exception error) {
|
|
|
+ error.printStackTrace();
|
|
|
+ }
|
|
|
+ if(stamp1 == 0 || stamp2 == 0 || stamp1 < stamp2) return;
|
|
|
+ dayPriceList.add(s);
|
|
|
+ if(DateUtils.formatDate(new Date()).equals(DateUtils.formatDate(s.getDayTime()))){
|
|
|
+ // 修改当日房价 产生的当日房费账单也要改
|
|
|
+ BusOrderFee fee = feeService.getOne(Wrappers.<BusOrderFee>query()
|
|
|
+ .eq("DATE_FORMAT(day_time,'%Y-%m-%d')",DateUtils.formatDate(new Date())).eq("living_order_id",s.getLivingOrderId()));
|
|
|
+ if(fee != null) {
|
|
|
+ fee.setMoney(s.getPrice());
|
|
|
+ orderFeeList.add(fee);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ boolean updateFee = true;
|
|
|
+ boolean updateDayPrice = true;
|
|
|
+ if (!orderFeeList.isEmpty()){
|
|
|
+ updateFee = feeService.updateBatchById(orderFeeList);
|
|
|
+ }
|
|
|
+ if (!dayPriceList.isEmpty()){
|
|
|
+ updateDayPrice = livingLayoutDayPriceService.updateBatchById(dayPriceList);
|
|
|
+ }
|
|
|
+ return updateDayPrice && updateFee;
|
|
|
+ }
|
|
|
//bookingRooms.getBookingOrdersId()是关联房间号的关联id
|
|
|
private Boolean mergeSingle(BusRoomsLivingOrder mainLivingOrder, String mergeLivingOrderId ) {
|
|
|
//通过订单id找到订单
|
|
|
@@ -2330,6 +2393,25 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
if(FeeSubjectType.val(s.getSubjectType()) == null) {
|
|
|
throw new JeecgBootException("收款项目不存在,请核对后操作");
|
|
|
}
|
|
|
+ BusRoomPayType payType = payTypeService.getById(s.getPayType());
|
|
|
+ if (payType == null){
|
|
|
+ throw new JeecgBootException("支付方式不存在");
|
|
|
+ }
|
|
|
+ if("会员卡".equals(payType.getName())){
|
|
|
+ BusMemberBalanceLog memberBalanceLog = new BusMemberBalanceLog();
|
|
|
+ if (user.getRelTenantIds() != null && !user.getRelTenantIds().equals("")) {
|
|
|
+ memberBalanceLog.setTenantId(user.getRelTenantIds());
|
|
|
+ } else {
|
|
|
+ throw new JeecgBootException("当前登录人租户信息错误");
|
|
|
+ }
|
|
|
+ memberBalanceLog.setWithhold(s.getMoney());
|
|
|
+ memberBalanceLog.setMoney(BigDecimal.valueOf(0));
|
|
|
+ memberBalanceLog.setMemberId(livingData.getOrderInfo().getVipCustomerId());
|
|
|
+ memberBalanceLog.setHotelId(livingData.getOrderInfo().getHotelId());
|
|
|
+ memberBalanceLog.setType(2);
|
|
|
+ memberBalanceLog.setOrderFeeId(s.getId());
|
|
|
+ memberBalanceLogService.saveBalance(memberBalanceLog);
|
|
|
+ }
|
|
|
});
|
|
|
if(findRoomFees.size() > 0) feeService.saveBatch(findRoomFees);
|
|
|
// 处理协议单位记账
|