|
|
@@ -1,16 +1,16 @@
|
|
|
package org.jeecg.modules.bus.controller;
|
|
|
-import annotation.ApiLogin;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
-import config.WebConfig;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.jeecg.annotation.ApiLogin;
|
|
|
+import org.jeecg.com.util.ThirdSessionHolder;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
|
|
import org.jeecg.common.constant.CommonConstant;
|
|
|
@@ -23,12 +23,23 @@ import org.jeecg.common.util.TenantContextHolder;
|
|
|
import org.jeecg.common.util.TokenUtils;
|
|
|
import org.jeecg.config.ApiVersion;
|
|
|
import org.jeecg.config.ApiVersionConstant;
|
|
|
+import org.jeecg.config.WebConfig;
|
|
|
+import org.jeecg.modules.business.dto.BookingOrderSaveDto;
|
|
|
import org.jeecg.modules.business.entity.BusHotel;
|
|
|
+import org.jeecg.modules.business.entity.BusMarketCouponsCashUsed;
|
|
|
+import org.jeecg.modules.business.entity.BusMemberCard;
|
|
|
import org.jeecg.modules.business.service.IBusHotelService;
|
|
|
+import org.jeecg.modules.business.service.IBusMemberCardService;
|
|
|
+import org.jeecg.modules.business.service.IBusRoomBookingOrdersService;
|
|
|
import org.jeecg.modules.business.util.MapUtil;
|
|
|
+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.CesRoomLayout;
|
|
|
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.system.entity.SysTenant;
|
|
|
import org.jeecg.modules.system.service.ISysTenantService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -51,11 +62,19 @@ import java.util.Map;
|
|
|
@AllArgsConstructor
|
|
|
@RequestMapping("/mall-api/hotel")
|
|
|
@Slf4j
|
|
|
-public class HotelController extends WebConfig {
|
|
|
- @Resource
|
|
|
- private IBusHotelService busHotelService;
|
|
|
- @Resource
|
|
|
- private CesRoomLayoutServiceImpl cesRoomLayoutService;
|
|
|
+public class HotelController extends WebConfig {
|
|
|
+ @Resource
|
|
|
+ private IBusHotelService busHotelService;
|
|
|
+ @Resource
|
|
|
+ private CesRoomLayoutServiceImpl cesRoomLayoutService;
|
|
|
+ @Resource
|
|
|
+ private CesRoomsServiceImpl cesRoomsService;
|
|
|
+ @Resource
|
|
|
+ private CesOrderCommentServiceImpl cesOrderCommentService;
|
|
|
+ @Resource
|
|
|
+ private IBusRoomBookingOrdersService busRoomBookingOrdersService;
|
|
|
+ @Resource
|
|
|
+ private IBusMemberCardService busMemberCardService;
|
|
|
|
|
|
/**
|
|
|
* 酒店列表查询
|
|
|
@@ -64,7 +83,7 @@ public class HotelController extends WebConfig {
|
|
|
* @param req
|
|
|
* @return
|
|
|
*/
|
|
|
- @ApiOperation(value="酒店列表查询", notes="酒店列表查询")
|
|
|
+ @ApiOperation(value = "酒店列表查询", notes = "酒店列表查询")
|
|
|
@GetMapping(value = "/queryList")
|
|
|
@ApiLogin
|
|
|
@ApiVersion(group = ApiVersionConstant.FAP_MALLAPI101)
|
|
|
@@ -81,39 +100,109 @@ public class HotelController extends WebConfig {
|
|
|
return Result.OK(list);
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value="可入住酒店列表", notes="可入住酒店列表")
|
|
|
+ /**
|
|
|
+ * 可入住酒店列表
|
|
|
+ *
|
|
|
+ * @param pageNo
|
|
|
+ * @param pageSize
|
|
|
+ * @param sort 0推荐排序 1 距离优先 2低价优先 3评分优先 4评论数优先
|
|
|
+ * @param keyWord 搜索关键字
|
|
|
+ * @param req
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "可入住酒店列表", notes = "可入住酒店列表")
|
|
|
@GetMapping(value = "/can-use-hotel-list")
|
|
|
@ApiLogin
|
|
|
@ApiVersion(group = ApiVersionConstant.FAP_MALLAPI101)
|
|
|
- public Result<List<BusHotel>> getCanUseHotelList(BusHotel busHotel, HttpServletRequest req) {
|
|
|
- LambdaQueryWrapper<BusHotel> queryWrapper = QueryGenerator.initQueryWrapper(busHotel, req.getParameterMap()).lambda();
|
|
|
- if (StringUtils.isNotBlank(busHotel.getKeyWord())) {
|
|
|
- queryWrapper.and(t -> {
|
|
|
- t.like(BusHotel::getAddress, busHotel.getKeyWord());
|
|
|
- t.or().like(BusHotel::getName, busHotel.getKeyWord());
|
|
|
- t.or().like(BusHotel::getIntroduction, busHotel.getKeyWord());
|
|
|
- });
|
|
|
- }
|
|
|
+ public Result<IPage<BusHotel>> getCanUseHotelList(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
|
+ @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
|
|
+ @RequestParam(name = "sort", defaultValue = "0") Integer sort,
|
|
|
+ @RequestParam(name = "keyWord", defaultValue = "") String keyWord,
|
|
|
+ HttpServletRequest req) {
|
|
|
+ Page<BusHotel> page = new Page<BusHotel>(pageNo, pageSize);
|
|
|
String tenantId = TenantContextHolder.getTenantId();
|
|
|
- if (StringUtils.isNotBlank(tenantId)) {
|
|
|
- queryWrapper.eq(BusHotel::getTenantId, tenantId);
|
|
|
- }
|
|
|
- queryWrapper.eq(BusHotel::getStatus, 1);
|
|
|
- queryWrapper.eq(BusHotel::getCheckStatus, 1);
|
|
|
- queryWrapper.eq(BusHotel::getDelFlag, 0);
|
|
|
- List<BusHotel> list = busHotelService.list(queryWrapper);
|
|
|
- list.forEach(t -> {
|
|
|
- LambdaQueryWrapper<CesRoomLayout> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
- lambdaQueryWrapper.eq(CesRoomLayout::getHotelId, t.getId());
|
|
|
- lambdaQueryWrapper.orderByAsc(CesRoomLayout::getMarketPrice).last("limit 1");
|
|
|
- CesRoomLayout cesRoomLayout = cesRoomLayoutService.getOne(lambdaQueryWrapper);
|
|
|
- if (cesRoomLayout != null) {
|
|
|
- t.setMinPrice(cesRoomLayout.getMarketPrice());
|
|
|
- }
|
|
|
- if (ObjectUtils.isNotEmpty(busHotel.getLat()) && ObjectUtils.isNotEmpty(busHotel.getLng())) {
|
|
|
+ IPage<BusHotel> pageList = busHotelService.pageList(page, tenantId, keyWord, sort);
|
|
|
+ return Result.OK(pageList);
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
- });
|
|
|
- return Result.OK(list);
|
|
|
+ /**
|
|
|
+ * 通过id查询酒店详情
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "通过id查询酒店详情", notes = "通过id查询酒店详情")
|
|
|
+ @GetMapping(value = "/queryById")
|
|
|
+ @ApiVersion(group = ApiVersionConstant.FAP_MALLAPI101)
|
|
|
+ public Result<BusHotel> queryById(@RequestParam(name = "id", required = true) String id) {
|
|
|
+ BusHotel busHotel = busHotelService.getById(id);
|
|
|
+ return Result.OK(busHotel);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据酒店查询房型对应可用房间
|
|
|
+ *
|
|
|
+ * @param param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "根据酒店查询房型对应可用房间", notes = "根据酒店查询房型对应可用房间")
|
|
|
+ @GetMapping(value = "/can-user-rooms")
|
|
|
+ @ApiVersion(group = ApiVersionConstant.FAP_MALLAPI101)
|
|
|
+ public Result<List<CanUseResultVo>> getCanUseRooms(CanUseRequestParamDto param) {
|
|
|
+ if (param.getHotelId() == null || param.getHotelId().isEmpty())
|
|
|
+ throw new JeecgBootException("参数错误");
|
|
|
+ if (param.getEndOf() == null || param.getStartOf() == null)
|
|
|
+ throw new JeecgBootException("请传入时间范围");
|
|
|
+ return Result.ok(cesRoomsService.getCanUseRooms(param));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据酒店查询评价列表
|
|
|
+ * @param cesOrderComment
|
|
|
+ * @param pageNo
|
|
|
+ * @param pageSize
|
|
|
+ * @param req
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value="根据酒店查询评价列表", notes="根据酒店查询评价列表")
|
|
|
+ @GetMapping(value = "/comment-list")
|
|
|
+ @ApiVersion(group = ApiVersionConstant.FAP_MALLAPI101)
|
|
|
+ public Result<IPage<CesOrderComment>> getCommentPageList(CesOrderComment cesOrderComment,
|
|
|
+ @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
|
|
+ @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
|
|
+ HttpServletRequest req) {
|
|
|
+ LambdaQueryWrapper<CesOrderComment> queryWrapper = QueryGenerator.initQueryWrapper(cesOrderComment, req.getParameterMap()).lambda();
|
|
|
+ Page<CesOrderComment> page = new Page<CesOrderComment>(pageNo, pageSize);
|
|
|
+ IPage<CesOrderComment> pageList = cesOrderCommentService.page(page, queryWrapper);
|
|
|
+ return Result.OK(pageList);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 酒店预定订单添加
|
|
|
+ * @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();
|
|
|
+ LambdaQueryWrapper<BusMemberCard> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ lambdaQueryWrapper.eq(BusMemberCard::getUserId, userId);
|
|
|
+ lambdaQueryWrapper.eq(BusMemberCard::getHotelId, busRoomBookingOrders.getHotelId());
|
|
|
+ Long count = busMemberCardService.count(lambdaQueryWrapper);
|
|
|
+ if (count > 0) {
|
|
|
+ busRoomBookingOrders.getOrderInfo().setCustomerType(2);
|
|
|
+ } else {
|
|
|
+ busRoomBookingOrders.getOrderInfo().setCustomerType(1);
|
|
|
+ }
|
|
|
+ return Result.OK("预定成功", busRoomBookingOrdersService.bookingOrderSave(busRoomBookingOrders, isTeam));
|
|
|
}
|
|
|
}
|