Commit ab662090 by 吕明尚

房间开门增加限制,脏房不许开门

parent 08e1d8ce
package share.system.service.impl; package share.system.service.impl;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DatePattern;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
...@@ -110,6 +109,15 @@ public class OpenInterfaceServiceImpl implements OpenInterfaceService { ...@@ -110,6 +109,15 @@ public class OpenInterfaceServiceImpl implements OpenInterfaceService {
).collect(Collectors.toList()).isEmpty()) { ).collect(Collectors.toList()).isEmpty()) {
throw new BaseException("房间取电设备不存在!"); throw new BaseException("房间取电设备不存在!");
} }
//当前房间是否有保洁任务
LambdaQueryWrapper<SCleanRecords> recordsQueryWrapper = new LambdaQueryWrapper<>();
recordsQueryWrapper.eq(SCleanRecords::getRoomId, sOrder.getRoomId());
recordsQueryWrapper.ne(SCleanRecords::getStatus, CleaningStatusEnum.CLEANED.getCode());
SCleanRecords sCleanRecords = cleanRecordsService.getOne(recordsQueryWrapper);
if (ObjectUtil.isNotEmpty(sCleanRecords)) {
// 如果保洁状态未不是保洁中
throw new BaseException("当前房间待保洁,请联系客服!");
}
if (sOrder.getStatus().equals(OrderStatusEnum.UNUSED.getCode())) { if (sOrder.getStatus().equals(OrderStatusEnum.UNUSED.getCode())) {
if (RoomStatusEnum.HOLD.getValue().compareTo(sRoomVo.getStatus()) == 0 if (RoomStatusEnum.HOLD.getValue().compareTo(sRoomVo.getStatus()) == 0
|| !checkOrderOpenDoor(sOrder)) { || !checkOrderOpenDoor(sOrder)) {
...@@ -123,18 +131,7 @@ public class OpenInterfaceServiceImpl implements OpenInterfaceService { ...@@ -123,18 +131,7 @@ public class OpenInterfaceServiceImpl implements OpenInterfaceService {
// if (sRoomVo.getIsDirtyRoom() > 0) { // if (sRoomVo.getIsDirtyRoom() > 0) {
// throw new BaseException("当前房间未保洁,请等待!"); // 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, -60));
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());
//计算预约开始和结束时间时长 //计算预约开始和结束时间时长
......
package share.system.service.impl; package share.system.service.impl;
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;
...@@ -1581,6 +1580,15 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1581,6 +1580,15 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
).collect(Collectors.toList()).isEmpty()) { ).collect(Collectors.toList()).isEmpty()) {
throw new BaseException("房间取电设备不存在!"); throw new BaseException("房间取电设备不存在!");
} }
//当前房间是否有保洁任务
LambdaQueryWrapper<SCleanRecords> recordsQueryWrapper = new LambdaQueryWrapper<>();
recordsQueryWrapper.eq(SCleanRecords::getRoomId, sOrder.getRoomId());
recordsQueryWrapper.ne(SCleanRecords::getStatus, CleaningStatusEnum.CLEANED.getCode());
SCleanRecords sCleanRecords = cleanRecordsService.getOne(recordsQueryWrapper);
if (ObjectUtil.isNotEmpty(sCleanRecords)) {
// 如果保洁状态未不是保洁中
throw new BaseException("当前房间待保洁,请联系客服!");
}
if (sOrder.getStatus().equals(OrderStatusEnum.UNUSED.getCode())) { if (sOrder.getStatus().equals(OrderStatusEnum.UNUSED.getCode())) {
if (RoomStatusEnum.HOLD.getValue().compareTo(sRoomVo.getStatus()) == 0 if (RoomStatusEnum.HOLD.getValue().compareTo(sRoomVo.getStatus()) == 0
|| !checkOrderOpenDoor(sOrder)) { || !checkOrderOpenDoor(sOrder)) {
...@@ -1594,19 +1602,6 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1594,19 +1602,6 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
// if (sRoomVo.getIsDirtyRoom() > 0) { // if (sRoomVo.getIsDirtyRoom() > 0) {
// throw new BaseException("当前房间未保洁,请等待!"); // 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, -60));
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