浏览代码

解决添加空房间之后不能查询到可用房间的问题
客历模块添加

qh 2 年之前
父节点
当前提交
55fadaff33

+ 178 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/BusCustomerController.java

@@ -0,0 +1,178 @@
+package org.jeecg.modules.business.controller;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.business.entity.BusCustomer;
+import org.jeecg.modules.business.service.IBusCustomerService;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.extern.slf4j.Slf4j;
+
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.jeecg.common.system.base.controller.JeecgController;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+import com.alibaba.fastjson.JSON;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+
+ /**
+ * @Description: bus_customer
+ * @Author: jeecg-boot
+ * @Date:   2023-03-28
+ * @Version: V1.0
+ */
+@Api(tags="客历")
+@RestController
+@RequestMapping("/bus/busCustomer")
+@Slf4j
+public class BusCustomerController extends JeecgController<BusCustomer, IBusCustomerService> {
+	@Autowired
+	private IBusCustomerService busCustomerService;
+	
+	/**
+	 * 分页列表查询
+	 *
+	 * @param busCustomer
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	//@AutoLog(value = "bus_customer-分页列表查询")
+	@ApiOperation(value="bus_customer-分页列表查询", notes="bus_customer-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<BusCustomer>> queryPageList(BusCustomer busCustomer,
+								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+								   HttpServletRequest req) {
+		QueryWrapper<BusCustomer> queryWrapper = QueryGenerator.initQueryWrapper(busCustomer, req.getParameterMap());
+		Page<BusCustomer> page = new Page<BusCustomer>(pageNo, pageSize);
+		IPage<BusCustomer> pageList = busCustomerService.page(page, queryWrapper);
+		return Result.OK(pageList);
+	}
+	
+	/**
+	 *   添加
+	 *
+	 * @param busCustomer
+	 * @return
+	 */
+	@AutoLog(value = "bus_customer-添加")
+	@ApiOperation(value="bus_customer-添加", notes="bus_customer-添加")
+	//@RequiresPermissions("org.jeecg.modules.business:bus_customer:add")
+	@PostMapping(value = "/add")
+	public Result<String> add(@RequestBody BusCustomer busCustomer) {
+		busCustomerService.save(busCustomer);
+		return Result.OK("添加成功!");
+	}
+	
+	/**
+	 *  编辑
+	 *
+	 * @param busCustomer
+	 * @return
+	 */
+	@AutoLog(value = "bus_customer-编辑")
+	@ApiOperation(value="bus_customer-编辑", notes="bus_customer-编辑")
+	//@RequiresPermissions("org.jeecg.modules.business:bus_customer:edit")
+	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
+	public Result<String> edit(@RequestBody BusCustomer busCustomer) {
+		busCustomerService.updateById(busCustomer);
+		return Result.OK("编辑成功!");
+	}
+	
+	/**
+	 *   通过id删除
+	 *
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "bus_customer-通过id删除")
+	@ApiOperation(value="bus_customer-通过id删除", notes="bus_customer-通过id删除")
+	//@RequiresPermissions("org.jeecg.modules.business:bus_customer:delete")
+	@DeleteMapping(value = "/delete")
+	public Result<String> delete(@RequestParam(name="id",required=true) String id) {
+		busCustomerService.removeById(id);
+		return Result.OK("删除成功!");
+	}
+	
+	/**
+	 *  批量删除
+	 *
+	 * @param ids
+	 * @return
+	 */
+	@AutoLog(value = "bus_customer-批量删除")
+	@ApiOperation(value="bus_customer-批量删除", notes="bus_customer-批量删除")
+	//@RequiresPermissions("org.jeecg.modules.business:bus_customer:deleteBatch")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		this.busCustomerService.removeByIds(Arrays.asList(ids.split(",")));
+		return Result.OK("批量删除成功!");
+	}
+	
+	/**
+	 * 通过id查询
+	 *
+	 * @param id
+	 * @return
+	 */
+	//@AutoLog(value = "bus_customer-通过id查询")
+	@ApiOperation(value="bus_customer-通过id查询", notes="bus_customer-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<BusCustomer> queryById(@RequestParam(name="id",required=true) String id) {
+		BusCustomer busCustomer = busCustomerService.getById(id);
+		if(busCustomer==null) {
+			return Result.error("未找到对应数据");
+		}
+		return Result.OK(busCustomer);
+	}
+
+    /**
+    * 导出excel
+    *
+    * @param request
+    * @param busCustomer
+    */
+    //@RequiresPermissions("org.jeecg.modules.business:bus_customer:exportXls")
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, BusCustomer busCustomer) {
+        return super.exportXls(request, busCustomer, BusCustomer.class, "bus_customer");
+    }
+
+    /**
+      * 通过excel导入数据
+    *
+    * @param request
+    * @param response
+    * @return
+    */
+    //@RequiresPermissions("org.jeecg.modules.business:bus_customer:importExcel")
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        return super.importExcel(request, response, BusCustomer.class);
+    }
+
+}

+ 89 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/entity/BusCustomer.java

@@ -0,0 +1,89 @@
+package org.jeecg.modules.business.entity;
+
+import java.io.Serializable;
+import java.io.UnsupportedEncodingException;
+import java.util.Date;
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import lombok.Data;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.jeecg.common.aspect.annotation.Dict;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * @Description: bus_customer
+ * @Author: jeecg-boot
+ * @Date:   2023-03-28
+ * @Version: V1.0
+ */
+@Data
+@TableName("bus_customer")
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = false)
+@ApiModel(value="bus_customer对象", description="bus_customer")
+public class BusCustomer implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+	/**key*/
+	@TableId(type = IdType.ASSIGN_ID)
+    @ApiModelProperty(value = "key")
+    private String id;
+	/**客人名称*/
+	@Excel(name = "客人名称", width = 15)
+    @ApiModelProperty(value = "客人名称")
+    private String name;
+	/**1男2女*/
+	@Excel(name = "1男2女", width = 15)
+    @ApiModelProperty(value = "1男2女")
+    private Integer gender;
+	/**1身份证。。。*/
+	@Excel(name = "1身份证。。。", width = 15)
+    @ApiModelProperty(value = "1身份证。。。")
+    private Integer certType;
+	/**证件号?*/
+	@Excel(name = "证件号?", width = 15)
+    @ApiModelProperty(value = "证件号?")
+    private String certNo;
+	/**手机号*/
+	@Excel(name = "手机号", width = 15)
+    @ApiModelProperty(value = "手机号")
+    private String phone;
+	/**关联会员id*/
+	@Excel(name = "关联会员id", width = 15)
+    @ApiModelProperty(value = "关联会员id")
+    private String relationVipId;
+	/**创建时间*/
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern="yyyy-MM-dd")
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+	/**创建人*/
+	@Excel(name = "创建人", width = 15)
+    @ApiModelProperty(value = "创建人")
+    private String createUser;
+	/**更新时间*/
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern="yyyy-MM-dd")
+    @ApiModelProperty(value = "更新时间")
+    private Date updateTime;
+	/**更新人*/
+	@Excel(name = "更新人", width = 15)
+    @ApiModelProperty(value = "更新人")
+    private String updateUser;
+	/**租户id*/
+	@Excel(name = "租户id", width = 15)
+    @ApiModelProperty(value = "租户id")
+    private String tenantId;
+	/**酒店id*/
+	@Excel(name = "酒店id", width = 15)
+    @ApiModelProperty(value = "酒店id")
+    private String hotelId;
+}

+ 17 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/BusCustomerMapper.java

@@ -0,0 +1,17 @@
+package org.jeecg.modules.business.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.business.entity.BusCustomer;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * @Description: bus_customer
+ * @Author: jeecg-boot
+ * @Date:   2023-03-28
+ * @Version: V1.0
+ */
+public interface BusCustomerMapper extends BaseMapper<BusCustomer> {
+
+}

+ 5 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/xml/BusCustomerMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.modules.business.mapper.BusCustomerMapper">
+
+</mapper>

+ 14 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/IBusCustomerService.java

@@ -0,0 +1,14 @@
+package org.jeecg.modules.business.service;
+
+import org.jeecg.modules.business.entity.BusCustomer;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @Description: bus_customer
+ * @Author: jeecg-boot
+ * @Date:   2023-03-28
+ * @Version: V1.0
+ */
+public interface IBusCustomerService extends IService<BusCustomer> {
+
+}

+ 19 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/impl/BusCustomerServiceImpl.java

@@ -0,0 +1,19 @@
+package org.jeecg.modules.business.service.impl;
+
+import org.jeecg.modules.business.entity.BusCustomer;
+import org.jeecg.modules.business.mapper.BusCustomerMapper;
+import org.jeecg.modules.business.service.IBusCustomerService;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * @Description: bus_customer
+ * @Author: jeecg-boot
+ * @Date:   2023-03-28
+ * @Version: V1.0
+ */
+@Service
+public class BusCustomerServiceImpl extends ServiceImpl<BusCustomerMapper, BusCustomer> implements IBusCustomerService {
+
+}

+ 21 - 4
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/impl/BusRoomBookingOrdersServiceImpl.java

@@ -6,15 +6,13 @@ import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.TokenUtils;
 import org.jeecg.modules.business.dto.BookingBatchRoomsDto;
 import org.jeecg.modules.business.dto.BookingOrderSaveDto;
-import org.jeecg.modules.business.entity.BusBookingBatch;
-import org.jeecg.modules.business.entity.BusBookingLayoutDayPrice;
-import org.jeecg.modules.business.entity.BusBookingRooms;
-import org.jeecg.modules.business.entity.BusRoomBookingOrders;
+import org.jeecg.modules.business.entity.*;
 import org.jeecg.modules.business.enums.BookingOrdersType;
 import org.jeecg.modules.business.enums.CheckInTypeEnum;
 import org.jeecg.modules.business.enums.CustomerTypeEnum;
 import org.jeecg.modules.business.mapper.BusRoomBookingOrdersMapper;
 import org.jeecg.modules.business.service.IBusBookingLayoutDayPriceService;
+import org.jeecg.modules.business.service.IBusCustomerService;
 import org.jeecg.modules.business.service.IBusRoomBookingOrdersService;
 import org.jeecg.modules.business.vo.BookingBatchRoomsVo;
 import org.jeecg.modules.business.vo.BookingOrderEditVo;
@@ -54,6 +52,9 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
     @Resource
     private IBusBookingLayoutDayPriceService dayPriceService;
 
+    @Resource
+    private IBusCustomerService customerService;
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public String bookingOrderSave(BookingOrderSaveDto item) {
@@ -136,6 +137,22 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
             dayPriceService.saveBatch(item.getLayoutDayPrices());
             // 处理预定每天的房型价格 End
 
+            // 添加客人信息 Start
+//            if(item.getContactName() != null && !item.getContactName().isEmpty() && item.getPhone() != null && !item.getPhone().isEmpty()){
+//                BusCustomer customer = customerService.getOne(Wrappers.<BusCustomer>query().eq("name",item.getContactName())
+//                        .eq("phone",item.getPhone()));
+//
+//                if(item.getOrderInfo().getContactId() != null && !item.getOrderInfo().getContactId().isEmpty()) {
+//                    if(customer == null) {
+//                        item.getOrderInfo().setContactId(customer.getId());
+//                    } else {
+//                        if(customer.getId().equals(item.getOrderInfo().getContactId()))
+//                    }
+//                }
+//            }
+
+            // 添加客人信息 end
+
 
             return item.getOrderInfo().getBookingOrdersNo();
             // 团队预定

+ 3 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/mapper/CesRoomsMapper.java

@@ -34,6 +34,8 @@ public interface CesRoomsMapper extends BaseMapper<CesRooms> {
             "\t\tINNER JOIN bus_room_booking_orders o ON br.booking_orders_id = o.id \n" +
             "\tWHERE\n" +
             "\t\tbr.booking_type = 1 \n" +
+            "\t\tAND br.room_id is not null \n" +
+
             "\t\tAND o.booking_status = 1 \n" +
             "\t\tAND ( ( o.arrival_time <= #{startOf} AND o.due_out_time >= #{startOf} ) -- 预抵时间在别的客人预定时间范围内\n" +
             "\t\t\tOR ( o.arrival_time <= #{endOf} AND o.due_out_time >= #{endOf} ) -- 或者预离时间在别的客户预定范围内\n" +
@@ -49,6 +51,7 @@ public interface CesRoomsMapper extends BaseMapper<CesRooms> {
             "\t\t) \n" +
             "\tWHERE\n" +
             "\t\tbr.booking_type = 2 \n" +
+            "\t\tAND br.room_id is not null \n" +
             "\t\tAND o.booking_status = 1 \n" +
             "\t)\n")
     List<CesRooms> canUseRooms(String hotelId, Date startOf, Date endOf);