|
|
@@ -3,6 +3,8 @@ import cn.hutool.core.date.DateTime;
|
|
|
import com.alibaba.druid.support.json.JSONUtils;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import io.swagger.annotations.Api;
|
|
|
@@ -31,6 +33,7 @@ import org.jeecg.config.WebConfig;
|
|
|
import org.jeecg.modules.business.dto.BookingLayoutRoomsDto;
|
|
|
import org.jeecg.modules.business.dto.BookingOrderSaveDto;
|
|
|
import org.jeecg.modules.business.entity.*;
|
|
|
+import org.jeecg.modules.business.enums.CheckInTypeEnum;
|
|
|
import org.jeecg.modules.business.service.*;
|
|
|
import org.jeecg.modules.business.util.MapUtil;
|
|
|
import org.jeecg.modules.business.vo.KeLiItemVo;
|
|
|
@@ -40,13 +43,11 @@ import org.jeecg.modules.order.entity.CesOrderComment;
|
|
|
import org.jeecg.modules.order.service.impl.CesOrderCommentServiceImpl;
|
|
|
import org.jeecg.modules.rooms.DTO.CanUseRequestParamDto;
|
|
|
import org.jeecg.modules.rooms.Vo.CanUseResultVo;
|
|
|
+import org.jeecg.modules.rooms.entity.CesHourRoomRule;
|
|
|
import org.jeecg.modules.rooms.entity.CesRoomLayout;
|
|
|
import org.jeecg.modules.rooms.entity.CesRoomLayoutPrice;
|
|
|
import org.jeecg.modules.rooms.entity.CesRooms;
|
|
|
-import org.jeecg.modules.rooms.service.CesRoomLayoutPriceServiceImpl;
|
|
|
-import org.jeecg.modules.rooms.service.CesRoomLayoutServiceImpl;
|
|
|
-import org.jeecg.modules.rooms.service.CesRoomsServiceImpl;
|
|
|
-import org.jeecg.modules.rooms.service.ICesRoomLayoutPriceDateService;
|
|
|
+import org.jeecg.modules.rooms.service.*;
|
|
|
import org.jeecg.modules.system.entity.SysTenant;
|
|
|
import org.jeecg.modules.system.service.ISysTenantService;
|
|
|
import org.jeecg.modules.wxuser.entity.MallUserInfo;
|
|
|
@@ -106,6 +107,8 @@ public class HotelController extends WebConfig {
|
|
|
private IUserInfoService userInfoService;
|
|
|
@Resource
|
|
|
private IBusDictItemService busDictItemService;
|
|
|
+ @Resource
|
|
|
+ private CesHourRoomRuleServiceImpl cesHourRoomRuleService;
|
|
|
/**
|
|
|
* 酒店列表查询
|
|
|
*
|
|
|
@@ -200,6 +203,15 @@ public class HotelController extends WebConfig {
|
|
|
throw new JeecgBootException("参数错误");
|
|
|
if (param.getEndOf() == null || param.getStartOf() == null)
|
|
|
throw new JeecgBootException("请传入时间范围");
|
|
|
+ if (param.getBookingType().equals(CheckInTypeEnum.HOUR_TIME.getKey())) {
|
|
|
+ LambdaQueryWrapper<CesHourRoomRule> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ lambdaQueryWrapper.eq(CesHourRoomRule::getHotelId, param.getHotelId());
|
|
|
+ lambdaQueryWrapper.orderByAsc(CesHourRoomRule::getAfterOpenRoom).last("limit 1");
|
|
|
+ CesHourRoomRule cesHourRoomRule = cesHourRoomRuleService.getOne(lambdaQueryWrapper);
|
|
|
+ if (cesHourRoomRule != null) {
|
|
|
+ param.setHourRoomRuleId(cesHourRoomRule.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
return Result.ok(cesRoomsService.getCanUseRooms(param));
|
|
|
}
|
|
|
|
|
|
@@ -227,35 +239,35 @@ public class HotelController extends WebConfig {
|
|
|
}
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * 酒店预定订单添加
|
|
|
- *
|
|
|
- * @param busRoomBookingOrders
|
|
|
- * @return
|
|
|
- */
|
|
|
- @AutoLog(value = "酒店预定订单-添加")
|
|
|
- @ApiOperation(value = "酒店预定订单-添加", notes = "酒店预定订单-添加")
|
|
|
- @PostMapping(value = "/hotel-room-booking")
|
|
|
- @ApiLogin
|
|
|
- @ApiVersion(group = ApiVersionConstant.FAP_MALLAPI101)
|
|
|
- public Result<String> hotelRoomBookingAdd(@RequestBody BookingOrderSaveDto busRoomBookingOrders) {
|
|
|
- Boolean isTeam = busRoomBookingOrders.getOrderInfo().getBookingOrdersType().equals(2);
|
|
|
- busRoomBookingOrders.getOrderInfo().setBookingOrdersType(1);
|
|
|
- String tenantId = TenantContextHolder.getTenantId();
|
|
|
- String userId = ThirdSessionHolder.getUserId();
|
|
|
- busRoomBookingOrders.getOrderInfo().setThirdLoginUserId(userId);
|
|
|
- LambdaQueryWrapper<BusMemberCard> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
- lambdaQueryWrapper.eq(BusMemberCard::getUserId, userId);
|
|
|
- lambdaQueryWrapper.eq(BusMemberCard::getHotelId, busRoomBookingOrders.getHotelId()).last("limit 1");
|
|
|
- BusMemberCard busMemberCard = busMemberCardService.getOne(lambdaQueryWrapper);
|
|
|
- if (busMemberCard != null) {
|
|
|
- busRoomBookingOrders.getOrderInfo().setCustomerType(2);
|
|
|
- busRoomBookingOrders.getOrderInfo().setVipCustomerId(busMemberCard.getId());
|
|
|
- } else {
|
|
|
- busRoomBookingOrders.getOrderInfo().setCustomerType(1);
|
|
|
- }
|
|
|
- return Result.OK("预定成功", busRoomBookingOrdersService.bookingOrderSave(busRoomBookingOrders, isTeam));
|
|
|
- }
|
|
|
+// /**
|
|
|
+// * 酒店预定订单添加
|
|
|
+// *
|
|
|
+// * @param busRoomBookingOrders
|
|
|
+// * @return
|
|
|
+// */
|
|
|
+// @AutoLog(value = "酒店预定订单-添加")
|
|
|
+// @ApiOperation(value = "酒店预定订单-添加", notes = "酒店预定订单-添加")
|
|
|
+// @PostMapping(value = "/hotel-room-booking")
|
|
|
+// @ApiLogin
|
|
|
+// @ApiVersion(group = ApiVersionConstant.FAP_MALLAPI101)
|
|
|
+// public Result<String> hotelRoomBookingAdd(@RequestBody BookingOrderSaveDto busRoomBookingOrders) {
|
|
|
+// Boolean isTeam = busRoomBookingOrders.getOrderInfo().getBookingOrdersType().equals(2);
|
|
|
+// busRoomBookingOrders.getOrderInfo().setBookingOrdersType(1);
|
|
|
+// String tenantId = TenantContextHolder.getTenantId();
|
|
|
+// String userId = ThirdSessionHolder.getUserId();
|
|
|
+// busRoomBookingOrders.getOrderInfo().setThirdLoginUserId(userId);
|
|
|
+// LambdaQueryWrapper<BusMemberCard> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+// lambdaQueryWrapper.eq(BusMemberCard::getUserId, userId);
|
|
|
+// lambdaQueryWrapper.eq(BusMemberCard::getHotelId, busRoomBookingOrders.getHotelId()).last("limit 1");
|
|
|
+// BusMemberCard busMemberCard = busMemberCardService.getOne(lambdaQueryWrapper);
|
|
|
+// if (busMemberCard != null) {
|
|
|
+// busRoomBookingOrders.getOrderInfo().setCustomerType(2);
|
|
|
+// busRoomBookingOrders.getOrderInfo().setVipCustomerId(busMemberCard.getId());
|
|
|
+// } else {
|
|
|
+// busRoomBookingOrders.getOrderInfo().setCustomerType(1);
|
|
|
+// }
|
|
|
+// return Result.OK("预定成功", busRoomBookingOrdersService.bookingOrderSave(busRoomBookingOrders, isTeam));
|
|
|
+// }
|
|
|
|
|
|
/**
|
|
|
* 生成16位数字+prefix
|
|
|
@@ -294,6 +306,7 @@ public class HotelController extends WebConfig {
|
|
|
if (ObjectUtils.isEmpty(coupons)) {
|
|
|
return Result.error("优惠券活动不存在");
|
|
|
}
|
|
|
+ mallHotelOrder.setCouponMoney(coupons.getCost());
|
|
|
busMarketCouponsCashUsed.setStatus(2);
|
|
|
busMarketCouponsCashUsed.setUsedTime(DateTime.now());
|
|
|
busMarketCouponsCashUsedService.updateById(busMarketCouponsCashUsed);
|
|
|
@@ -306,6 +319,27 @@ public class HotelController extends WebConfig {
|
|
|
mallHotelOrder.setCode(randomNumber(prefix));
|
|
|
mallHotelOrder.setPayType(1);
|
|
|
mallHotelOrder.setStatus(5);
|
|
|
+
|
|
|
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ SimpleDateFormat formatter2 = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
|
|
+ Date four = null;
|
|
|
+ try {
|
|
|
+ four = formatter2.parse(formatter.format(mallHotelOrder.getStartDate()) + " "+mallHotelOrder.getArriveTime());
|
|
|
+ mallHotelOrder.setStartDate(four);
|
|
|
+ } catch (ParseException e) {
|
|
|
+
|
|
|
+ }
|
|
|
+ CesHourRoomRule cesHourRoomRule=null;
|
|
|
+ Calendar calendar = new GregorianCalendar();
|
|
|
+ if(mallHotelOrder.getBookingType().equals(2)) {
|
|
|
+ CesRoomLayoutPrice cesRoomLayoutPrice = cesRoomLayoutPriceService.getById(mallHotelOrder.getRoomLayoutPriceId());
|
|
|
+ cesHourRoomRule = cesHourRoomRuleService.getById(cesRoomLayoutPrice.getSellerId());
|
|
|
+ calendar.setTime(mallHotelOrder.getStartDate());
|
|
|
+ calendar.add(Calendar.MINUTE, cesHourRoomRule.getAfterOpenRoom());
|
|
|
+ mallHotelOrder.setEndDate(calendar.getTime());
|
|
|
+ }
|
|
|
+ log.info("getStartDate---------------"+mallHotelOrder.getStartDate());
|
|
|
+ log.info("getEndDate---------------"+mallHotelOrder.getEndDate());
|
|
|
mallHotelOrderService.save(mallHotelOrder);
|
|
|
|
|
|
//增加临时坑位预定单
|
|
|
@@ -317,7 +351,10 @@ public class HotelController extends WebConfig {
|
|
|
List<BusBookingLayoutDayPrice> layoutDayPrices = new ArrayList<>();
|
|
|
long getTime = mallHotelOrder.getEndDate().getTime() - mallHotelOrder.getStartDate().getTime();
|
|
|
long day = getTime / (1000 * 60 * 60 * 24);
|
|
|
- Calendar calendar = new GregorianCalendar();
|
|
|
+ if(day==0) {
|
|
|
+ day = 1;
|
|
|
+ }
|
|
|
+ log.info("day---------------"+day);
|
|
|
BigDecimal sCouponMoney = couponMoney;
|
|
|
for (Integer i = 0; i < day; i++) {
|
|
|
calendar.setTime(mallHotelOrder.getStartDate());
|
|
|
@@ -338,15 +375,7 @@ public class HotelController extends WebConfig {
|
|
|
busRoomBookingOrders.setLayoutDayPrices(layoutDayPrices);
|
|
|
|
|
|
BusRoomBookingOrders bookingOrders = new BusRoomBookingOrders();
|
|
|
- SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- SimpleDateFormat formatter2 = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
|
|
- Date four = null;
|
|
|
- try {
|
|
|
- four = formatter2.parse(formatter.format(mallHotelOrder.getStartDate()) + " 16:50");
|
|
|
- } catch (ParseException e) {
|
|
|
-
|
|
|
- }
|
|
|
- bookingOrders.setArrivalTime(four);
|
|
|
+ bookingOrders.setArrivalTime(mallHotelOrder.getStartDate());
|
|
|
LambdaQueryWrapper<BusDictItem> lambdaQueryWrapper2 = new LambdaQueryWrapper<>();
|
|
|
lambdaQueryWrapper2.eq(BusDictItem::getHotelId, mallHotelOrder.getHotelId());
|
|
|
lambdaQueryWrapper2.eq(BusDictItem::getDictId, "1639544187093995521");
|
|
|
@@ -376,6 +405,9 @@ public class HotelController extends WebConfig {
|
|
|
bookingOrders.setOuterOrdersNo(mallHotelOrder.getCode());
|
|
|
bookingOrders.setBookingStatus(3);
|
|
|
bookingOrders.setBookingType(mallHotelOrder.getBookingType());
|
|
|
+ if(mallHotelOrder.getBookingType().equals(2)) {
|
|
|
+ bookingOrders.setHourRoomId(cesHourRoomRule.getId());
|
|
|
+ }
|
|
|
busRoomBookingOrders.setOrderInfo(bookingOrders);
|
|
|
|
|
|
List<BookingLayoutRoomsDto> roomIds = new ArrayList<>();
|
|
|
@@ -474,4 +506,86 @@ public class HotelController extends WebConfig {
|
|
|
List<CesRoomLayoutPrice> list = cesRoomLayoutPriceService.list(lambdaQueryWrapper);
|
|
|
return Result.ok(list);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 酒店预定订单列表
|
|
|
+ * @param mallHotelOrder
|
|
|
+ * @param pageNo
|
|
|
+ * @param pageSize
|
|
|
+ * @param req
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "酒店预定订单列表", notes = "酒店预定订单列表")
|
|
|
+ @GetMapping(value = "/hotel_order-list")
|
|
|
+ @ApiVersion(group = ApiVersionConstant.FAP_MALLAPI101)
|
|
|
+ @ApiLogin
|
|
|
+ public Result<IPage<MallHotelOrder>> getHotelOrderPageList(MallHotelOrder mallHotelOrder,
|
|
|
+ @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
|
+ @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
|
|
+ HttpServletRequest req) {
|
|
|
+ String tenantId = TenantContextHolder.getTenantId();
|
|
|
+ LambdaQueryWrapper<MallHotelOrder> queryWrapper = QueryGenerator.initQueryWrapper(mallHotelOrder, req.getParameterMap()).lambda();
|
|
|
+ queryWrapper.eq(MallHotelOrder::getTenantId, tenantId);
|
|
|
+ Page<MallHotelOrder> page = new Page<MallHotelOrder>(pageNo, pageSize);
|
|
|
+ IPage<MallHotelOrder> pageList = mallHotelOrderService.page(page, queryWrapper);
|
|
|
+ pageList.getRecords().forEach(t -> {
|
|
|
+ if (t.getStatus().equals(1)) {
|
|
|
+ t.setStatusName("未付款");
|
|
|
+ } else if (t.getStatus().equals(2)) {
|
|
|
+ t.setStatusName("已付款");
|
|
|
+ } else if (t.getStatus().equals(3)) {
|
|
|
+ t.setStatusName("已取消");
|
|
|
+ } else if (t.getStatus().equals(4)) {
|
|
|
+ t.setStatusName("已完成");
|
|
|
+ } else if (t.getStatus().equals(5)) {
|
|
|
+ t.setStatusName("待入住");
|
|
|
+ } else if (t.getStatus().equals(6)) {
|
|
|
+ t.setStatusName("已入住");
|
|
|
+ } else if (t.getStatus().equals(7)) {
|
|
|
+ t.setStatusName("退款中");
|
|
|
+ }
|
|
|
+ BusHotel hotel = busHotelService.getById(t.getHotelId());
|
|
|
+ if (hotel != null) {
|
|
|
+ t.setHotelName(hotel.getName());
|
|
|
+ }
|
|
|
+ CesRoomLayout layout = cesRoomLayoutService.getById(t.getLayoutId());
|
|
|
+ if (layout != null) {
|
|
|
+ t.setLayoutName(layout.getName());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return Result.OK(pageList);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="酒店订单确认入住", notes="酒店订单确认入住")
|
|
|
+ @PostMapping(value = "/confirm-move")
|
|
|
+ @ApiVersion(group = ApiVersionConstant.FAP_MALLAPI101)
|
|
|
+ @ApiLogin
|
|
|
+ public Result<String> confirmMove(@RequestBody MallHotelOrder mallHotelOrder) {
|
|
|
+ MallHotelOrder order = mallHotelOrderService.getById(mallHotelOrder.getId());
|
|
|
+ if (!order.getStatus().equals(5)) {
|
|
|
+ return Result.error("订单不是待入住状态");
|
|
|
+ }
|
|
|
+ order.setStatus(6);
|
|
|
+ mallHotelOrderService.updateById(order);
|
|
|
+
|
|
|
+ LambdaUpdateWrapper<BusRoomBookingOrders> updateWrapper = new UpdateWrapper().lambda();
|
|
|
+ updateWrapper.set(BusRoomBookingOrders::getBookingStatus,1);
|
|
|
+ updateWrapper.eq(BusRoomBookingOrders::getOuterOrdersNo, order.getCode());
|
|
|
+ busRoomBookingOrdersService.update(updateWrapper);
|
|
|
+ return Result.OK("确认入住成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="酒店订单取消", notes="酒店订单取消")
|
|
|
+ @PostMapping(value = "/confirm-cancel")
|
|
|
+ @ApiVersion(group = ApiVersionConstant.FAP_MALLAPI101)
|
|
|
+ @ApiLogin
|
|
|
+ public Result<String> confirmCancel(@RequestBody MallHotelOrder mallHotelOrder) {
|
|
|
+ MallHotelOrder order = mallHotelOrderService.getById(mallHotelOrder.getId());
|
|
|
+ if (order.getStatus().equals(4)||order.getStatus().equals(6)) {
|
|
|
+ return Result.error("订单已完成/已入住状态");
|
|
|
+ }
|
|
|
+ order.setStatus(3);
|
|
|
+ mallHotelOrderService.updateById(order);
|
|
|
+ return Result.OK("取消成功!");
|
|
|
+ }
|
|
|
}
|