|
@@ -1,7 +1,6 @@
|
|
|
package org.jeecg.modules.business.service.impl;
|
|
package org.jeecg.modules.business.service.impl;
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
-import cn.hutool.core.date.DateTime;
|
|
|
|
|
import cn.hutool.core.lang.Snowflake;
|
|
import cn.hutool.core.lang.Snowflake;
|
|
|
import cn.hutool.core.util.BooleanUtil;
|
|
import cn.hutool.core.util.BooleanUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
@@ -13,10 +12,12 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
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.impl.ServiceImpl;
|
|
|
import lombok.SneakyThrows;
|
|
import lombok.SneakyThrows;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
-import org.checkerframework.checker.units.qual.C;
|
|
|
|
|
|
|
+import org.jeecg.common.api.dto.message.MessageDTO;
|
|
|
|
|
+import org.jeecg.common.constant.CommonConstant;
|
|
|
import org.jeecg.common.exception.JeecgBootException;
|
|
import org.jeecg.common.exception.JeecgBootException;
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
|
import org.jeecg.common.util.DateUtils;
|
|
import org.jeecg.common.util.DateUtils;
|
|
@@ -48,11 +49,12 @@ import org.jeecg.modules.rooms.Vo.LivingContinueVo;
|
|
|
import org.jeecg.modules.rooms.Vo.LivingRealtimeVo;
|
|
import org.jeecg.modules.rooms.Vo.LivingRealtimeVo;
|
|
|
import org.jeecg.modules.rooms.entity.*;
|
|
import org.jeecg.modules.rooms.entity.*;
|
|
|
import org.jeecg.modules.rooms.service.*;
|
|
import org.jeecg.modules.rooms.service.*;
|
|
|
|
|
+import org.jeecg.modules.system.entity.SysUser;
|
|
|
|
|
+import org.jeecg.modules.system.service.ISysUserService;
|
|
|
|
|
+import org.jeecg.modules.system.service.impl.SysBaseApiImpl;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
-
|
|
|
|
|
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
@@ -166,6 +168,12 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
@Resource
|
|
@Resource
|
|
|
private IKcDepositoryInGoodsService depositoryInGoodsService;
|
|
private IKcDepositoryInGoodsService depositoryInGoodsService;
|
|
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private ISysUserService sysUserService;
|
|
|
|
|
+
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private IBusHotelService busHotelService;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public String bookingOrderSave(BookingOrderSaveDto item, Boolean isTeam,Boolean isLiving,String hotelId) {
|
|
public String bookingOrderSave(BookingOrderSaveDto item, Boolean isTeam,Boolean isLiving,String hotelId) {
|
|
@@ -351,7 +359,6 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
addBusTeams(hotelId, bookingId);
|
|
addBusTeams(hotelId, bookingId);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
//</editor-fold>
|
|
//</editor-fold>
|
|
|
roomsService.getReserveRoom();
|
|
roomsService.getReserveRoom();
|
|
@@ -1141,13 +1148,34 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
feeService.save(dayOrderFee);
|
|
feeService.save(dayOrderFee);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /*添加消息通知*/
|
|
|
|
|
+ BusHotel busHotel = busHotelService.getById(room.getHotelId());
|
|
|
|
|
+ LambdaQueryWrapper<SysUser> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
+ lambdaQueryWrapper.eq(SysUser::getDelFlag, 0);
|
|
|
|
|
+ lambdaQueryWrapper.eq(SysUser::getRelTenantIds, busHotel.getTenantId());
|
|
|
|
|
+ List<SysUser> sysUsers = sysUserService.list(lambdaQueryWrapper);
|
|
|
|
|
+ String userIds = "";
|
|
|
|
|
+ for (SysUser sysUser : sysUsers) {
|
|
|
|
|
+ userIds += sysUser.getUsername() + ",";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!userIds.isEmpty()) {
|
|
|
|
|
+ MessageDTO messageDTO = new MessageDTO();
|
|
|
|
|
+ messageDTO.setFromUser("");
|
|
|
|
|
+ messageDTO.setToUser(userIds);
|
|
|
|
|
+ messageDTO.setTenantId(busHotel.getTenantId());
|
|
|
|
|
+ messageDTO.setTitle(room.getPrefix() + room.getName() + "房间被入住-" + DateUtils.formatDate(new Date()));
|
|
|
|
|
+ messageDTO.setContent(room.getPrefix() + room.getName() + "房间被入住-" + DateUtils.formatDate(new Date()));
|
|
|
|
|
+ messageDTO.setCategory(CommonConstant.MSG_CATEGORY_1);
|
|
|
|
|
+ messageDTO.setMsgCategoryDetail(CommonConstant.MSG_ORDER);
|
|
|
|
|
+ sysBaseAPI.sendSysAnnouncement(messageDTO);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
CesAllDayPriceRule cesAllDayPriceRule = allDayPriceRuleService.getOne(Wrappers.<CesAllDayPriceRule>lambdaQuery().eq(CesAllDayPriceRule::getHotelId,hotelId).eq(CesAllDayPriceRule::getInvalid,false));
|
|
CesAllDayPriceRule cesAllDayPriceRule = allDayPriceRuleService.getOne(Wrappers.<CesAllDayPriceRule>lambdaQuery().eq(CesAllDayPriceRule::getHotelId,hotelId).eq(CesAllDayPriceRule::getInvalid,false));
|
|
|
if(ObjectUtils.isEmpty(cesAllDayPriceRule)) {
|
|
if(ObjectUtils.isEmpty(cesAllDayPriceRule)) {
|
|
|
throw new JeecgBootException("未找到超时收费规则");
|
|
throw new JeecgBootException("未找到超时收费规则");
|
|
|
}
|
|
}
|
|
|
Calendar calendar = getRemindTime(livingOrder, cesAllDayPriceRule, livingRoomOrderInfo.getBookingType());
|
|
Calendar calendar = getRemindTime(livingOrder, cesAllDayPriceRule, livingRoomOrderInfo.getBookingType());
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
|
|
- System.out.println(format.format(calendar.getTime()));
|
|
|
|
|
redisTemplate.opsForZSet().add("overTimerOrder", livingOrder.getId(), calendar.getTimeInMillis());
|
|
redisTemplate.opsForZSet().add("overTimerOrder", livingOrder.getId(), calendar.getTimeInMillis());
|
|
|
roomsService.getReserveRoom();
|
|
roomsService.getReserveRoom();
|
|
|
//</editor-fold>
|
|
//</editor-fold>
|
|
@@ -1173,7 +1201,8 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
}
|
|
}
|
|
|
return calendar;
|
|
return calendar;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private SysBaseApiImpl sysBaseAPI;
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public String customerLiving(BookingOrderSaveDto livingData, Boolean isTeam, String hotelId) {
|
|
public String customerLiving(BookingOrderSaveDto livingData, Boolean isTeam, String hotelId) {
|
|
@@ -1580,7 +1609,8 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
|
|
|
|
|
public Boolean syncRoomOverTimeOrder(String hotelId) {
|
|
public Boolean syncRoomOverTimeOrder(String hotelId) {
|
|
|
// 查询出当前时间内需要处理的超时订单
|
|
// 查询出当前时间内需要处理的超时订单
|
|
|
- Set<Object> set = redisTemplate.opsForZSet().rangeByScore("overTimerOrder", 0, Calendar.getInstance().getTimeInMillis());CesAllDayPriceRule cesAllDayPriceRule = allDayPriceRuleService.getOne(Wrappers.<CesAllDayPriceRule>lambdaQuery().eq(CesAllDayPriceRule::getHotelId,hotelId).eq(CesAllDayPriceRule::getInvalid,false));
|
|
|
|
|
|
|
+ Set<Object> set = redisTemplate.opsForZSet().rangeByScore("overTimerOrder", 0, Calendar.getInstance().getTimeInMillis());
|
|
|
|
|
+ CesAllDayPriceRule cesAllDayPriceRule = allDayPriceRuleService.getOne(Wrappers.<CesAllDayPriceRule>lambdaQuery().eq(CesAllDayPriceRule::getHotelId,hotelId).eq(CesAllDayPriceRule::getInvalid,false));
|
|
|
if(CollUtil.isEmpty(set)){
|
|
if(CollUtil.isEmpty(set)){
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
@@ -2308,7 +2338,7 @@ public class BusRoomBookingOrdersServiceImpl extends ServiceImpl<BusRoomBookingO
|
|
|
depositoryInGoods.setNum(feeGood.getNum());
|
|
depositoryInGoods.setNum(feeGood.getNum());
|
|
|
depositoryInGoods.setFeeId(feeGood.getOrderFeeId());
|
|
depositoryInGoods.setFeeId(feeGood.getOrderFeeId());
|
|
|
depositoryInGoods.setHotelId(feeGood.getHotelId());
|
|
depositoryInGoods.setHotelId(feeGood.getHotelId());
|
|
|
-// depositoryInGoods.setTenantId(user.getRelTenantIds());
|
|
|
|
|
|
|
+ depositoryInGoods.setTenantId(TokenUtils.getAuthUser().getRelTenantIds());
|
|
|
depositoryInGoods.setCreateTime(new Date());
|
|
depositoryInGoods.setCreateTime(new Date());
|
|
|
return depositoryInGoods;
|
|
return depositoryInGoods;
|
|
|
}
|
|
}
|