Explorar el Código

商城房务模块

gqx hace 2 años
padre
commit
f4a48ffbf2

+ 24 - 0
jeecg-mall-api/src/main/java/org/jeecg/modules/bus/controller/HotelController.java

@@ -32,6 +32,7 @@ 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.business.vo.KeLiItemVo;
 import org.jeecg.modules.order.entity.CesOrderComment;
 import org.jeecg.modules.order.service.impl.CesOrderCommentServiceImpl;
 import org.jeecg.modules.rooms.DTO.CanUseRequestParamDto;
@@ -76,6 +77,7 @@ public class HotelController extends WebConfig {
     @Resource
     private IBusMemberCardService busMemberCardService;
 
+
     /**
      * 酒店列表查询
      *
@@ -207,4 +209,26 @@ public class HotelController extends WebConfig {
         }
         return Result.OK("预定成功", busRoomBookingOrdersService.bookingOrderSave(busRoomBookingOrders, isTeam));
     }
+
+
+    /**
+     * 预定/入住订单列表
+     * @param type 1 入住订单查询->livingStatus | 2 bookingStatus
+     * @param livingStatus -1 正常入住,1 已结账退房,2 先走未结,3 联房退房
+     * @param bookingStatus 1 预定中 2 在住 3 已取消
+     * @return
+     */
+    @ApiOperation(value="酒店预定订单-客历", notes="酒店预定订单-客历")
+    @RequestMapping(value = "/kedan-orders",method = RequestMethod.GET)
+    public Result<IPage<KeLiItemVo>> keli(Page<KeLiItemVo> page,String keyw, Integer livingStatus, String hotelId, Integer type, Integer bookingStatus) {
+        if (type == null) throw new JeecgBootException("参数错误");
+        if (type == 1 && livingStatus == null) throw new JeecgBootException("参数错误");
+        if (type == 2 && bookingStatus == null) throw new JeecgBootException("参数错误");
+        String userId = ThirdSessionHolder.getUserId();
+        if (type == 1)
+            return Result.OK(busRoomBookingOrdersService.getLivingOrderKL(livingStatus, keyw, hotelId, userId, page));
+        if (type == 2)
+            return Result.OK(busRoomBookingOrdersService.getBookingOrderKL(bookingStatus, keyw, hotelId, userId, page));
+        return null;
+    }
 }

+ 113 - 0
jeecg-mall-api/src/main/java/org/jeecg/modules/bus/controller/OrderMessageController.java

@@ -0,0 +1,113 @@
+package org.jeecg.modules.bus.controller;
+
+import cn.hutool.core.date.DateTime;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+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.system.base.controller.JeecgController;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.TenantContextHolder;
+import org.jeecg.config.ApiVersion;
+import org.jeecg.config.ApiVersionConstant;
+import org.jeecg.config.WebConfig;
+import org.jeecg.modules.business.entity.BusBookingRooms;
+import org.jeecg.modules.business.entity.BusHotel;
+import org.jeecg.modules.business.entity.BusRoomsLivingOrder;
+import org.jeecg.modules.business.service.IBusBookingRoomsService;
+import org.jeecg.modules.business.service.IBusHotelService;
+import org.jeecg.modules.business.service.IBusRoomBookingOrdersService;
+import org.jeecg.modules.business.service.IBusRoomsLivingOrderService;
+import org.jeecg.modules.order.entity.CesOrderMessage;
+import org.jeecg.modules.order.service.ICesOrderMessageService;
+import org.jeecg.modules.rooms.entity.CesRooms;
+import org.jeecg.modules.rooms.service.CesRoomsServiceImpl;
+import org.jeecg.modules.wxuser.entity.MallUserInfo;
+import org.jeecg.modules.wxuser.service.IUserInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * @Description: ces_order_message
+ * @Author: jeecg-boot
+ * @Date:   2023-03-24
+ * @Version: V1.0
+ */
+@Api(tags="留言/投诉添加")
+@RestController
+@RequestMapping("/mall-api/hotel-order-message")
+@Slf4j
+public class OrderMessageController extends WebConfig {
+	@Resource
+	private ICesOrderMessageService cesOrderMessageService;
+	 @Resource
+	 private IBusHotelService busHotelService;
+	@Resource
+	private IUserInfoService userInfoService;
+	@Resource
+	private IBusRoomsLivingOrderService busRoomsLivingOrderService;
+	@Resource
+	private IBusRoomBookingOrdersService busRoomBookingOrdersService;
+	@Resource
+	private IBusBookingRoomsService busBookingRoomsService;
+	@Resource
+	private CesRoomsServiceImpl cesRoomsService;
+
+
+	/**
+	 *   留言/投诉添加
+	 *
+	 * @param cesOrderMessage
+	 * @return
+	 */
+	@AutoLog(value = "留言/投诉添加")
+	@ApiOperation(value="留言/投诉添加", notes="留言/投诉添加")
+	@ApiLogin
+	@ApiVersion(group = ApiVersionConstant.FAP_MALLAPI101)
+	@PostMapping(value = "/add")
+	public Result<String> add(@RequestBody CesOrderMessage cesOrderMessage) {
+		String tenantId = TenantContextHolder.getTenantId();
+		String userId = ThirdSessionHolder.getUserId();
+		cesOrderMessage.setTenantId(tenantId);
+		cesOrderMessage.setUserId(userId);
+		cesOrderMessage.setCreateDate(DateTime.now());
+		MallUserInfo mallUserInfo = userInfoService.getById(userId);
+		if (mallUserInfo != null) {
+			cesOrderMessage.setUserMobile(mallUserInfo.getMobile());
+			cesOrderMessage.setUserName(mallUserInfo.getNickName());
+		}
+		LambdaQueryWrapper<BusRoomsLivingOrder> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+		lambdaQueryWrapper.eq(BusRoomsLivingOrder::getThirdLoginUserId, userId).last("limit 1");
+		BusRoomsLivingOrder busRoomsLivingOrder = busRoomsLivingOrderService.getOne(lambdaQueryWrapper);
+		if (busRoomsLivingOrder != null && StringUtils.isNotBlank(busRoomsLivingOrder.getBookingOrderId())) {
+			LambdaQueryWrapper<BusBookingRooms> lambdaQueryWrapper1 = new LambdaQueryWrapper<>();
+			lambdaQueryWrapper1.eq(BusBookingRooms::getBookingOrdersId, busRoomsLivingOrder.getBookingOrderId()).last("limit 1");
+			BusBookingRooms bookingRooms = busBookingRoomsService.getOne(lambdaQueryWrapper1);
+			if (bookingRooms != null) {
+				CesRooms cesRooms = cesRoomsService.getById(bookingRooms.getRoomId());
+				if (cesRooms != null) {
+					cesOrderMessage.setRoomNo(cesRooms.getName());
+				}
+			}
+		}
+		cesOrderMessageService.save(cesOrderMessage);
+		return Result.OK("添加成功!");
+	}
+
+
+}

+ 113 - 2
jeecg-mall-api/src/main/java/org/jeecg/modules/bus/controller/OrderRepairController.java

@@ -1,11 +1,14 @@
 package org.jeecg.modules.bus.controller;
 
+import cn.hutool.core.date.DateTime;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.lowagie.text.LargeElement;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.jeecg.annotation.ApiLogin;
 import org.jeecg.com.util.ThirdSessionHolder;
 import org.jeecg.common.api.vo.Result;
@@ -15,14 +18,23 @@ import org.jeecg.common.util.TenantContextHolder;
 import org.jeecg.config.ApiVersion;
 import org.jeecg.config.ApiVersionConstant;
 import org.jeecg.config.WebConfig;
-import org.jeecg.modules.business.entity.BusHotel;
-import org.jeecg.modules.business.service.IBusHotelService;
+import org.jeecg.modules.bus.vo.BusServiceRepairCategoryVo;
+import org.jeecg.modules.business.entity.*;
+import org.jeecg.modules.business.service.*;
 import org.jeecg.modules.order.entity.CesOrderRepair;
 import org.jeecg.modules.order.service.ICesOrderRepairService;
+import org.jeecg.modules.rooms.entity.CesRooms;
+import org.jeecg.modules.rooms.service.CesRoomsServiceImpl;
+import org.jeecg.modules.wxuser.entity.MallUserInfo;
+import org.jeecg.modules.wxuser.service.IUserInfoService;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+import java.util.UUID;
 
 /**
 * @Description: ces_order_repair
@@ -39,6 +51,20 @@ public class OrderRepairController extends WebConfig {
    private ICesOrderRepairService cesOrderRepairService;
     @Resource
     private IBusHotelService busHotelService;
+    @Resource
+    private IUserInfoService userInfoService;
+    @Resource
+    private IBusRoomsLivingOrderService busRoomsLivingOrderService;
+    @Resource
+    private IBusRoomBookingOrdersService busRoomBookingOrdersService;
+    @Resource
+    private IBusBookingRoomsService busBookingRoomsService;
+    @Resource
+    private CesRoomsServiceImpl cesRoomsService;
+    @Resource
+    private IBusServiceRepairService busServiceRepairService;
+    @Resource
+    private IBusServiceRepairCategoryService busServiceRepairCategoryService;
    /**
     * 服务维修单分页列表查询
     *
@@ -85,7 +111,92 @@ public class OrderRepairController extends WebConfig {
    @ApiVersion(group = ApiVersionConstant.FAP_MALLAPI101)
    @PostMapping(value = "/add")
    public Result<String> add(@RequestBody CesOrderRepair cesOrderRepair) {
+       String tenantId = TenantContextHolder.getTenantId();
+       String userId = ThirdSessionHolder.getUserId();
+       cesOrderRepair.setTenantId(tenantId);
+       cesOrderRepair.setUserId(userId);
+       cesOrderRepair.setType(2);
+       cesOrderRepair.setCreateDate(DateTime.now());
+       cesOrderRepair.setOrderId(randomNumber("WX"));
+       MallUserInfo mallUserInfo = userInfoService.getById(userId);
+       if (mallUserInfo != null) {
+           cesOrderRepair.setUserMobile(mallUserInfo.getMobile());
+           cesOrderRepair.setUserName(mallUserInfo.getNickName());
+       }
+       LambdaQueryWrapper<BusRoomsLivingOrder> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+       lambdaQueryWrapper.eq(BusRoomsLivingOrder::getThirdLoginUserId, userId).last("limit 1");
+       BusRoomsLivingOrder busRoomsLivingOrder = busRoomsLivingOrderService.getOne(lambdaQueryWrapper);
+       if (busRoomsLivingOrder != null && StringUtils.isNotBlank(busRoomsLivingOrder.getBookingOrderId())) {
+           LambdaQueryWrapper<BusBookingRooms> lambdaQueryWrapper1 = new LambdaQueryWrapper<>();
+           lambdaQueryWrapper1.eq(BusBookingRooms::getBookingOrdersId, busRoomsLivingOrder.getBookingOrderId()).last("limit 1");
+           BusBookingRooms bookingRooms = busBookingRoomsService.getOne(lambdaQueryWrapper1);
+           if (bookingRooms != null) {
+               CesRooms cesRooms = cesRoomsService.getById(bookingRooms.getRoomId());
+               if (cesRooms != null) {
+                   cesOrderRepair.setRoomNo(cesRooms.getName());
+               }
+           }
+       }
        cesOrderRepairService.save(cesOrderRepair);
        return Result.OK("添加成功!");
    }
+
+    /**
+     * 生成16位数字+prefix
+     * @param prefix
+     * @return
+     */
+    private String randomNumber(String prefix) {
+        int first = new Random(10).nextInt(8) + 1;
+        int hashCode = UUID.randomUUID().toString().hashCode();
+        if (hashCode < 0) {
+            hashCode = -hashCode;
+        }
+        return prefix + first + String.format("%015d", hashCode);
+    }
+
+    /**
+     * 维修项目列表
+     * @param hotleId
+     * @return
+     */
+    @ApiLogin
+    @ApiVersion(group = ApiVersionConstant.FAP_MALLAPI101)
+    @ApiOperation(value="维修项目列表", notes="维修项目列表")
+    @GetMapping(value = "/repair-project-list")
+    public Result<List<BusServiceRepair>> getRepairProjectList( @RequestParam(name="hotleId") String hotleId) {
+        LambdaQueryWrapper<BusServiceRepair> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(BusServiceRepair::getHotelId, hotleId);
+        queryWrapper.eq(BusServiceRepair::getType, 2);
+        List<BusServiceRepair> list = busServiceRepairService.list(queryWrapper);
+        return Result.OK(list);
+    }
+
+    /**
+     * 服务项目列表
+     * @param hotleId
+     * @return
+     */
+    @ApiLogin
+    @ApiVersion(group = ApiVersionConstant.FAP_MALLAPI101)
+    @ApiOperation(value="服务项目列表", notes="服务项目列表")
+    @GetMapping(value = "/service-project-list")
+    public Result<List<BusServiceRepairCategoryVo>> getServiceProjectList(@RequestParam(name="hotleId") String hotleId) {
+        LambdaQueryWrapper<BusServiceRepairCategory> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(BusServiceRepairCategory::getHotelId, hotleId);
+        List<BusServiceRepairCategoryVo> voList = new ArrayList<>();
+        List<BusServiceRepairCategory> list = busServiceRepairCategoryService.list(queryWrapper);
+        list.forEach(t -> {
+            BusServiceRepairCategoryVo vo = new BusServiceRepairCategoryVo();
+            vo.setName(t.getName());
+            LambdaQueryWrapper<BusServiceRepair> lambdaQueryWrapper2 = new LambdaQueryWrapper<>();
+            lambdaQueryWrapper2.eq(BusServiceRepair::getHotelId, hotleId);
+            lambdaQueryWrapper2.eq(BusServiceRepair::getType, 1);
+            lambdaQueryWrapper2.eq(BusServiceRepair::getCategoryId, t.getId());
+            List<BusServiceRepair> busServiceRepairs = busServiceRepairService.list(lambdaQueryWrapper2);
+            vo.setList(busServiceRepairs);
+            voList.add(vo);
+        });
+        return Result.OK(voList);
+    }
 }

+ 11 - 0
jeecg-mall-api/src/main/java/org/jeecg/modules/bus/vo/BusServiceRepairCategoryVo.java

@@ -0,0 +1,11 @@
+package org.jeecg.modules.bus.vo;
+
+import lombok.Data;
+import org.jeecg.modules.business.entity.BusServiceRepair;
+import org.jeecg.modules.business.entity.BusServiceRepairCategory;
+
+import java.util.List;
+@Data
+public class BusServiceRepairCategoryVo extends BusServiceRepairCategory {
+    private List<BusServiceRepair> list;
+}