|
@@ -16,10 +16,12 @@ import org.jeecg.modules.business.mapper.BusRoomBookingOrdersMapper;
|
|
|
import org.jeecg.modules.business.service.IBusBookingLayoutDayPriceService;
|
|
import org.jeecg.modules.business.service.IBusBookingLayoutDayPriceService;
|
|
|
import org.jeecg.modules.business.service.IBusCustomerService;
|
|
import org.jeecg.modules.business.service.IBusCustomerService;
|
|
|
import org.jeecg.modules.business.service.IBusRoomBookingOrdersService;
|
|
import org.jeecg.modules.business.service.IBusRoomBookingOrdersService;
|
|
|
|
|
+import org.jeecg.modules.business.service.IBusRoomsLivingOrderService;
|
|
|
import org.jeecg.modules.business.vo.BatchOrderEditVo;
|
|
import org.jeecg.modules.business.vo.BatchOrderEditVo;
|
|
|
import org.jeecg.modules.business.vo.BookingBatchRoomsVo;
|
|
import org.jeecg.modules.business.vo.BookingBatchRoomsVo;
|
|
|
import org.jeecg.modules.business.vo.BookingOrderEditVo;
|
|
import org.jeecg.modules.business.vo.BookingOrderEditVo;
|
|
|
import org.jeecg.modules.business.vo.ExtendBusBookingRoomsVo;
|
|
import org.jeecg.modules.business.vo.ExtendBusBookingRoomsVo;
|
|
|
|
|
+import org.jeecg.modules.rooms.Enum.RoomStatusEnum;
|
|
|
import org.jeecg.modules.rooms.service.CesRoomsServiceImpl;
|
|
import org.jeecg.modules.rooms.service.CesRoomsServiceImpl;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -56,6 +58,9 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
@Resource
|
|
@Resource
|
|
|
private IBusCustomerService customerService;
|
|
private IBusCustomerService customerService;
|
|
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private IBusRoomsLivingOrderService roomsLivingOrderService;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public String bookingOrderSave(BookingOrderSaveDto item) {
|
|
public String bookingOrderSave(BookingOrderSaveDto item) {
|
|
@@ -734,6 +739,170 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
+ public Boolean bookingToLive(String bookingRoomId, List<BusLivingCustomer> customers) {
|
|
|
|
|
+ BusBookingRooms bkRoom = bookingRoomsService.getById(bookingRoomId);
|
|
|
|
|
+ if(bkRoom == null) throw new JeecgBootException("关联房间不存在");
|
|
|
|
|
+ BusRoomBookingOrders bookingOrders = getById(bkRoom.getBookingOrdersId());
|
|
|
|
|
+ if(bookingOrders == null) throw new JeecgBootException("房间预约单不存在");
|
|
|
|
|
+ LoginUser user = TokenUtils.getAuthUser();
|
|
|
|
|
+
|
|
|
|
|
+ //<editor-fold desc="订单复制 -- 散客入住">
|
|
|
|
|
+ BusRoomsLivingOrder livingOrder = null;
|
|
|
|
|
+ if(bkRoom.getBookingType().equals(BookingOrdersType.NORMAL.getKey())) {
|
|
|
|
|
+ //todo other
|
|
|
|
|
+ livingOrder = copyBookingToAcceptOrder(bookingOrders);
|
|
|
|
|
+ } else if(bkRoom.getBookingType().equals(BookingOrdersType.TEAM.getKey())) {
|
|
|
|
|
+ BusBookingBatch batch = bookingBatchService.getById(bkRoom.getBookingBatchId());
|
|
|
|
|
+ if(batch == null) throw new JeecgBootException("批次不存在");
|
|
|
|
|
+ livingOrder = copyBookingToAcceptOrder(batch, bookingOrders);
|
|
|
|
|
+ livingOrder.setBatchId(bkRoom.getBookingBatchId());
|
|
|
|
|
+ } else throw new JeecgBootException("订单类型错误");
|
|
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
|
|
|
|
|
+ livingOrder.setLivingOrderNo("D"+sdf.format(System.currentTimeMillis()));
|
|
|
|
|
+ livingOrder.setArrivalTime(new Date());// todo 这个地方的入住开始时间应该怎么算
|
|
|
|
|
+ roomsLivingOrderService.save(livingOrder);
|
|
|
|
|
+
|
|
|
|
|
+ bkRoom.setRoomStatus(RoomStatusEnum.LIVE_DIRTY.getKey());
|
|
|
|
|
+ bookingRoomsService.updateById(bkRoom);
|
|
|
|
|
+ //</editor-fold>
|
|
|
|
|
+
|
|
|
|
|
+ //<editor-fold desc="同住人相关">
|
|
|
|
|
+ if(customers != null && customers.size() > 0) {
|
|
|
|
|
+ customers.forEach(s->{
|
|
|
|
|
+ // 【添加客人信息 Start】
|
|
|
|
|
+ if(s.getCustomerName() != null && !s.getCustomerName().isEmpty() && s.getPhone() != null && !s.getPhone().isEmpty()){
|
|
|
|
|
+ BusCustomer customer = customerService.getOne(Wrappers.<BusCustomer>query().eq("name",s.getCustomerName())
|
|
|
|
|
+ .eq("phone",s.getPhone()));
|
|
|
|
|
+ if(customer == null) {
|
|
|
|
|
+ // save customer
|
|
|
|
|
+ BusCustomer newCustomer = new BusCustomer();
|
|
|
|
|
+ newCustomer.setCreateTime(new Date());
|
|
|
|
|
+ newCustomer.setCreateUser("");
|
|
|
|
|
+ newCustomer.setTenantId(user.getRelTenantIds());
|
|
|
|
|
+ newCustomer.setName(s.getCustomerName());
|
|
|
|
|
+ newCustomer.setPhone(s.getPhone());
|
|
|
|
|
+ newCustomer.setCertType(1); // 身份证
|
|
|
|
|
+ customerService.save(newCustomer);
|
|
|
|
|
+ s.setCustomerId(newCustomer.getId());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ s.setCustomerId(customer.getId());
|
|
|
|
|
+ }
|
|
|
|
|
+ } else throw new JeecgBootException("客人信息不能为空");
|
|
|
|
|
+
|
|
|
|
|
+ // 【添加客人信息 end】
|
|
|
|
|
+ });
|
|
|
|
|
+ } else throw new JeecgBootException("请添加入住人信息");
|
|
|
|
|
+ //</editor-fold>
|
|
|
|
|
+
|
|
|
|
|
+ //<editor-fold desc="todo:账单相关">
|
|
|
|
|
+ // TODO: 待做
|
|
|
|
|
+ //</editor-fold>
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
+ public Boolean customerLiving(BookingOrderSaveDto livingData) {
|
|
|
|
|
+ String bookingOrderNo = bookingOrderSave(livingData);
|
|
|
|
|
+ if(bookingOrderNo != null && !bookingOrderNo.isEmpty()){
|
|
|
|
|
+ BookingOrderEditVo bookingOrderVo = getBookingInfoById(null,bookingOrderNo);
|
|
|
|
|
+ // 散客取roomIds
|
|
|
|
|
+ if(bookingOrderVo.getOrderInfo().getBookingOrdersType().equals(BookingOrdersType.NORMAL.getKey())) {
|
|
|
|
|
+ bookingRoomToLiving(livingData, bookingOrderVo.getRoomIds(), bookingOrderVo);
|
|
|
|
|
+ } else if(bookingOrderVo.getOrderInfo().getBookingOrdersType().equals(BookingOrdersType.TEAM.getKey())) {
|
|
|
|
|
+ bookingOrderVo.getBatchRooms().forEach(b->{
|
|
|
|
|
+ bookingRoomToLiving(livingData, b.getRoomIds(), bookingOrderVo);
|
|
|
|
|
+ });
|
|
|
|
|
+ } else throw new JeecgBootException("订单类型错误");
|
|
|
|
|
+ }
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private void bookingRoomToLiving(BookingOrderSaveDto livingData, List<ExtendBusBookingRoomsVo> roomIds, BookingOrderEditVo bookingOrderVo) {
|
|
|
|
|
+ roomIds.forEach(bkRoom-> {
|
|
|
|
|
+ if(livingData.getRoomIds().stream().filter(s->s.getRoomId().equals(bkRoom.getRoomId())).count() == 0)
|
|
|
|
|
+ throw new JeecgBootException("房间信息未找到");
|
|
|
|
|
+ List<BusLivingCustomer> customers = livingData.getRoomIds().stream().filter(s->s.getRoomId().equals(bkRoom.getRoomId())).findFirst().get().getLivingCustomers();
|
|
|
|
|
+ if(customers == null || customers.size() == 0) throw new JeecgBootException("请添加客户信息");
|
|
|
|
|
+ bookingToLive(bkRoom.getId(), customers);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ private BusRoomsLivingOrder copyBookingToAcceptOrder(BusRoomBookingOrders bkOrder) {
|
|
|
|
|
+ BusRoomsLivingOrder livingOrder = new BusRoomsLivingOrder();
|
|
|
|
|
+ livingOrder.setAgencyName(bkOrder.getAgencyName());
|
|
|
|
|
+ livingOrder.setArrivalTime(bkOrder.getArrivalTime());
|
|
|
|
|
+ livingOrder.setBreakfastNum(bkOrder.getBreakfastNum());
|
|
|
|
|
+ livingOrder.setContactId(bkOrder.getContactId());
|
|
|
|
|
+ livingOrder.setCreateTime(new Date());
|
|
|
|
|
+ livingOrder.setCreateUser("");
|
|
|
|
|
+ livingOrder.setCustomerSource(bkOrder.getCustomerSource());
|
|
|
|
|
+ livingOrder.setLivingOrdersType(bkOrder.getBookingOrdersType());
|
|
|
|
|
+ livingOrder.setLivingType(bkOrder.getBookingType());
|
|
|
|
|
+ livingOrder.setOuterOrdersNo(bkOrder.getOuterOrdersNo());
|
|
|
|
|
+ livingOrder.setContractTeamId(bkOrder.getContractTeamId());
|
|
|
|
|
+ livingOrder.setContractTeamProtocolId(bkOrder.getContractTeamProtocolId());
|
|
|
|
|
+ livingOrder.setDayCount(bkOrder.getDayCount());
|
|
|
|
|
+ livingOrder.setCustomerType(bkOrder.getCustomerType());
|
|
|
|
|
+ livingOrder.setDinnerNum(bkOrder.getDinnerNum());
|
|
|
|
|
+ livingOrder.setLunchNum(bkOrder.getLunchNum());
|
|
|
|
|
+ livingOrder.setDueOutTime(bkOrder.getDueOutTime());
|
|
|
|
|
+ livingOrder.setHourRoomId(bkOrder.getHourRoomId());
|
|
|
|
|
+ livingOrder.setWarranter(bkOrder.getWarranter());
|
|
|
|
|
+ livingOrder.setWarrantType(bkOrder.getWarrantType());
|
|
|
|
|
+ livingOrder.setVipCustomerId(bkOrder.getVipCustomerId());
|
|
|
|
|
+ livingOrder.setTeamName(bkOrder.getTeamName());
|
|
|
|
|
+ livingOrder.setTeamTypeDicId(bkOrder.getTeamTypeDicId());
|
|
|
|
|
+ livingOrder.setRoomPriceSlnId(bkOrder.getRoomPriceSlnId());
|
|
|
|
|
+ livingOrder.setLeaderName(bkOrder.getLeaderName());
|
|
|
|
|
+ livingOrder.setPublicConsumeFee(bkOrder.getPublicConsumeFee());
|
|
|
|
|
+ livingOrder.setPublicMeetingFee(bkOrder.getPublicMeetingFee());
|
|
|
|
|
+ livingOrder.setPublicVipFee(bkOrder.getPublicVipFee());
|
|
|
|
|
+ livingOrder.setPublicRoomFee(bkOrder.getPublicRoomFee());
|
|
|
|
|
+ livingOrder.setTeamPeopleNumber(bkOrder.getTeamPeopleNumber());
|
|
|
|
|
+ livingOrder.setBookingOrderId(bkOrder.getId());
|
|
|
|
|
+ return livingOrder;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private BusRoomsLivingOrder copyBookingToAcceptOrder(BusBookingBatch bkOrder, BusRoomBookingOrders bookingOrder) {
|
|
|
|
|
+ BusRoomsLivingOrder livingOrder = new BusRoomsLivingOrder();
|
|
|
|
|
+ livingOrder.setAgencyName(bkOrder.getAgencyName());
|
|
|
|
|
+ livingOrder.setArrivalTime(bkOrder.getArrivalTime());
|
|
|
|
|
+ livingOrder.setBreakfastNum(bkOrder.getBreakfastNum());
|
|
|
|
|
+ livingOrder.setContactId(bkOrder.getContactId());
|
|
|
|
|
+ livingOrder.setCreateTime(new Date());
|
|
|
|
|
+ livingOrder.setCreateUser("");
|
|
|
|
|
+ livingOrder.setCustomerSource(bkOrder.getCustomerSource());
|
|
|
|
|
+ livingOrder.setLivingOrdersType(BookingOrdersType.TEAM.getKey());
|
|
|
|
|
+ livingOrder.setLivingType(bkOrder.getBookingType());
|
|
|
|
|
+ livingOrder.setOuterOrdersNo(bkOrder.getOuterOrdersNo());
|
|
|
|
|
+ livingOrder.setContractTeamId(bkOrder.getContractTeamId());
|
|
|
|
|
+ livingOrder.setContractTeamProtocolId(bkOrder.getContractTeamProtocolId());
|
|
|
|
|
+ livingOrder.setDayCount(bkOrder.getDayCount());
|
|
|
|
|
+ livingOrder.setCustomerType(bkOrder.getCustomerType());
|
|
|
|
|
+ livingOrder.setDinnerNum(bkOrder.getDinnerNum());
|
|
|
|
|
+ livingOrder.setLunchNum(bkOrder.getLunchNum());
|
|
|
|
|
+ livingOrder.setDueOutTime(bkOrder.getDueOutTime());
|
|
|
|
|
+ livingOrder.setHourRoomId(bkOrder.getHourRoomId());
|
|
|
|
|
+ livingOrder.setWarranter(bkOrder.getWarranter());
|
|
|
|
|
+ livingOrder.setWarrantType(bkOrder.getWarrantType());
|
|
|
|
|
+ livingOrder.setVipCustomerId(bkOrder.getVipCustomerId());
|
|
|
|
|
+ livingOrder.setTeamName(bookingOrder.getTeamName());
|
|
|
|
|
+ livingOrder.setTeamTypeDicId(bookingOrder.getTeamTypeDicId());
|
|
|
|
|
+ livingOrder.setRoomPriceSlnId(bkOrder.getRoomPriceSlnId());
|
|
|
|
|
+ livingOrder.setLeaderName(bookingOrder.getLeaderName());
|
|
|
|
|
+ livingOrder.setPublicConsumeFee(bookingOrder.getPublicConsumeFee());
|
|
|
|
|
+ livingOrder.setPublicMeetingFee(bookingOrder.getPublicMeetingFee());
|
|
|
|
|
+ livingOrder.setPublicVipFee(bookingOrder.getPublicVipFee());
|
|
|
|
|
+ livingOrder.setPublicRoomFee(bookingOrder.getPublicRoomFee());
|
|
|
|
|
+ livingOrder.setTeamPeopleNumber(bookingOrder.getTeamPeopleNumber());
|
|
|
|
|
+ livingOrder.setBookingOrderId(bkOrder.getId());
|
|
|
|
|
+ return livingOrder;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
private BusBookingBatch copyBatchToBase(BookingBatchRoomsDto data) {
|
|
private BusBookingBatch copyBatchToBase(BookingBatchRoomsDto data) {
|
|
|
BusBookingBatch batch = new BookingBatchRoomsDto();
|
|
BusBookingBatch batch = new BookingBatchRoomsDto();
|