Commit 7b30ce2e by YG8999

订单开门添加未保洁房间不能开门

parent 9191f29f
...@@ -5,6 +5,7 @@ import java.math.RoundingMode; ...@@ -5,6 +5,7 @@ import java.math.RoundingMode;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUnit; import cn.hutool.core.date.DateUnit;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
...@@ -1082,6 +1083,23 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1082,6 +1083,23 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
if (DateUtils.addHours(sOrder.getPreStartDate(), Constants.OPEN_DOOR_AHEAD_HOUR_MINUS).compareTo(new Date()) > 0) { if (DateUtils.addHours(sOrder.getPreStartDate(), Constants.OPEN_DOOR_AHEAD_HOUR_MINUS).compareTo(new Date()) > 0) {
throw new BaseException("预约时间未到达,可提前" + Constants.OPEN_DOOR_AHEAD_HOUR + "小时进场,请耐心等候!"); throw new BaseException("预约时间未到达,可提前" + Constants.OPEN_DOOR_AHEAD_HOUR + "小时进场,请耐心等候!");
} }
// 判断房间是否脏房中
if (sRoomVo.getIsDirtyRoom() > 0) {
throw new BaseException("当前房间未保洁,请等待!");
}
// 55分钟内是否有保洁记录
LambdaQueryWrapper<SCleanRecords> recordsQueryWrapper = new LambdaQueryWrapper<>();
recordsQueryWrapper.eq(SCleanRecords::getRoomId, sOrder.getRoomId());
recordsQueryWrapper.ge(SCleanRecords::getCreateTime, cn.hutool.core.date.DateUtil.offset(cn.hutool.core.date.DateUtil.date(), DateField.MINUTE, -55));
List<SCleanRecords> recordsList = cleanRecordsService.list(recordsQueryWrapper);
if(recordsList != null && recordsList.size() > 0) {
SCleanRecords records = recordsList.get(0);
if (CleaningStatusEnum.CLEANED.getCode().equals(records.getStatus())) {
// 如果保洁状态未不是保洁中
throw new BaseException("当前房间待保洁中,请等待!");
}
}
//更改订单状态,房间状态,开始时间,结束时间 //更改订单状态,房间状态,开始时间,结束时间
sOrder.setStatus(OrderStatusEnum.INUSE.getCode()); sOrder.setStatus(OrderStatusEnum.INUSE.getCode());
//计算预约开始和结束时间时长 //计算预约开始和结束时间时长
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment