|
@@ -2,30 +2,20 @@ package org.jeecg.modules.rooms.service;
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.bean.copier.CopyOptions;
|
|
import cn.hutool.core.bean.copier.CopyOptions;
|
|
|
-import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
-import cn.hutool.core.date.DateTime;
|
|
|
|
|
-import cn.hutool.core.lang.tree.Tree;
|
|
|
|
|
-import cn.hutool.core.lang.tree.TreeNode;
|
|
|
|
|
-import cn.hutool.core.lang.tree.TreeUtil;
|
|
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.IService;
|
|
import com.baomidou.mybatisplus.extension.service.IService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
|
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.apache.ibatis.annotations.Param;
|
|
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.exception.JeecgBootException;
|
|
import org.jeecg.common.exception.JeecgBootException;
|
|
|
import org.jeecg.modules.business.entity.BusBookingRooms;
|
|
import org.jeecg.modules.business.entity.BusBookingRooms;
|
|
|
import org.jeecg.modules.business.entity.BusHotel;
|
|
import org.jeecg.modules.business.entity.BusHotel;
|
|
|
-import org.jeecg.modules.business.entity.BusRoomPayType;
|
|
|
|
|
-import org.jeecg.modules.business.enums.BookingOrdersType;
|
|
|
|
|
import org.jeecg.modules.business.enums.CheckInTypeEnum;
|
|
import org.jeecg.modules.business.enums.CheckInTypeEnum;
|
|
|
import org.jeecg.modules.business.service.IBusBookingRoomsService;
|
|
import org.jeecg.modules.business.service.IBusBookingRoomsService;
|
|
|
import org.jeecg.modules.business.service.impl.BusHotelServiceImpl;
|
|
import org.jeecg.modules.business.service.impl.BusHotelServiceImpl;
|
|
@@ -40,10 +30,10 @@ import org.springframework.stereotype.Service;
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
import javax.transaction.Transactional;
|
|
import javax.transaction.Transactional;
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
-import java.time.LocalDate;
|
|
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
+import java.util.concurrent.atomic.AtomicInteger;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -85,20 +75,11 @@ public class CesRoomsServiceImpl extends ServiceImpl<CesRoomsMapper, CesRooms> i
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
public Result list(CesRoomSearchDto dto) {
|
|
public Result list(CesRoomSearchDto dto) {
|
|
|
-
|
|
|
|
|
- QueryWrapper<CesRooms> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
- if (!StringUtils.isBlank(dto.getBuildId())) {
|
|
|
|
|
- queryWrapper.eq(CesRooms.BUILD_ID, dto.getBuildId());
|
|
|
|
|
- }
|
|
|
|
|
- if (!StringUtils.isBlank(dto.getFloorId())) {
|
|
|
|
|
- queryWrapper.eq(CesRooms.FLOOR_ID, dto.getFloorId());
|
|
|
|
|
- }
|
|
|
|
|
- if (!StringUtils.isBlank(dto.getHotelId())) {
|
|
|
|
|
-// List<String> hotelIds = Arrays.stream(dto.getHotelId().split(",")).collect(Collectors.toList());
|
|
|
|
|
- queryWrapper.eq(CesRooms.HOTEL_ID, dto.getHotelId());
|
|
|
|
|
- }
|
|
|
|
|
- queryWrapper.eq(CesRooms.INVALID, false);
|
|
|
|
|
- queryWrapper.orderByDesc(CesRooms.SORT, CesRooms.CREATEAT);
|
|
|
|
|
|
|
+ QueryWrapper<CesRooms> queryWrapper = new QueryWrapper<CesRooms>()
|
|
|
|
|
+ .eq(!StringUtils.isBlank(dto.getBuildId()),CesRooms.BUILD_ID, dto.getBuildId())
|
|
|
|
|
+ .eq(!StringUtils.isBlank(dto.getFloorId()),CesRooms.FLOOR_ID, dto.getFloorId())
|
|
|
|
|
+ .eq(!StringUtils.isBlank(dto.getHotelId()),CesRooms.HOTEL_ID, dto.getHotelId())
|
|
|
|
|
+ .eq(CesRooms.INVALID, false).orderByDesc(CesRooms.SORT, CesRooms.CREATEAT);
|
|
|
IPage<CesRooms> dataPage = roomsMapper.selectPage(new Page<>(dto.getPageNo().intValue(), dto.getPageSize().intValue()), queryWrapper);
|
|
IPage<CesRooms> dataPage = roomsMapper.selectPage(new Page<>(dto.getPageNo().intValue(), dto.getPageSize().intValue()), queryWrapper);
|
|
|
List<CesRooms> records = dataPage.getRecords();
|
|
List<CesRooms> records = dataPage.getRecords();
|
|
|
Map<String, Object> map = new HashedMap();
|
|
Map<String, Object> map = new HashedMap();
|
|
@@ -139,6 +120,44 @@ public class CesRoomsServiceImpl extends ServiceImpl<CesRoomsMapper, CesRooms> i
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * 修改房间密码
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param dto
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public Boolean batchEditPassword(CesRoomSearchDto dto, String type, String firstValue, String endValue) {
|
|
|
|
|
+ QueryWrapper<CesRooms> queryWrapper = new QueryWrapper<CesRooms>()
|
|
|
|
|
+ .eq(!StringUtils.isBlank(dto.getBuildId()),CesRooms.BUILD_ID, dto.getBuildId())
|
|
|
|
|
+ .eq(!StringUtils.isBlank(dto.getFloorId()),CesRooms.FLOOR_ID, dto.getFloorId())
|
|
|
|
|
+ .eq(!StringUtils.isBlank(dto.getHotelId()),CesRooms.HOTEL_ID, dto.getHotelId())
|
|
|
|
|
+ .eq(CesRooms.INVALID, false);
|
|
|
|
|
+ List<CesRooms> cesRooms = roomsMapper.selectList(queryWrapper);
|
|
|
|
|
+ if ("0".equals(type) || "1".equals(type)) {
|
|
|
|
|
+ cesRooms.forEach(e -> {
|
|
|
|
|
+ e.setPassWord(firstValue + e.getPrefix() + e.getName() + endValue);
|
|
|
|
|
+ });
|
|
|
|
|
+ } else if ("2".equals(type)){
|
|
|
|
|
+ cesRooms.forEach(e -> {
|
|
|
|
|
+ e.setPassWord(firstValue + e.getName() + endValue);
|
|
|
|
|
+ });
|
|
|
|
|
+ } else if("3".equals(type)){
|
|
|
|
|
+ AtomicInteger num = new AtomicInteger();
|
|
|
|
|
+ try {
|
|
|
|
|
+ num.set(Integer.parseInt(type));
|
|
|
|
|
+ } catch (NumberFormatException e){
|
|
|
|
|
+ throw new JeecgBootException("参数错误");
|
|
|
|
|
+ }
|
|
|
|
|
+ cesRooms.forEach(e -> {
|
|
|
|
|
+ num.getAndIncrement();
|
|
|
|
|
+ e.setPassWord(Integer.toString(num.get()));
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ return updateBatchById(cesRooms);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
* 创建房间
|
|
* 创建房间
|
|
|
*
|
|
*
|
|
|
* @param roomsDto
|
|
* @param roomsDto
|
|
@@ -427,10 +446,11 @@ public class CesRoomsServiceImpl extends ServiceImpl<CesRoomsMapper, CesRooms> i
|
|
|
for (CesRooms cesRoom : CesRoomList){
|
|
for (CesRooms cesRoom : CesRoomList){
|
|
|
if (cesRoom.getRoomStatus() < 3){
|
|
if (cesRoom.getRoomStatus() < 3){
|
|
|
cesRoom.setLastRoomStatus(cesRoom.getRoomStatus());
|
|
cesRoom.setLastRoomStatus(cesRoom.getRoomStatus());
|
|
|
- cesRoom.setRoomStatus(7);
|
|
|
|
|
|
|
+ cesRoom.setRoomStatus(RoomStatusEnum.RESERVE.getKey());
|
|
|
newCesRooms.add(cesRoom);
|
|
newCesRooms.add(cesRoom);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
return updateBatchById(newCesRooms);
|
|
return updateBatchById(newCesRooms);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
}
|
|
}
|