Commit 1dbdec0b by 吕明尚

测试环境开门取消设备

parent a2665a0f
......@@ -7,7 +7,6 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
......
......@@ -1622,23 +1622,23 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
if (Objects.isNull(sRoomVo)) {
throw new BaseException("房间不存在!");
}
LambdaQueryWrapper<Device> deviceLambdaQueryWrapper = new LambdaQueryWrapper<>();
deviceLambdaQueryWrapper.eq(Device::getRoomId, sOrder.getRoomId());
deviceLambdaQueryWrapper.in(Device::getDevType, DeviceType.DEVICE_CCEE.getCode(), DeviceType.DEVICE_0001.getCode());
List<Device> deviceList = deviceService.list(deviceLambdaQueryWrapper);
if (CollectionUtils.isEmpty(deviceList)) {
throw new BaseException("房间设备缺失!");
}
if (deviceList.stream().filter(device ->
device.getDevType().equals(DeviceType.DEVICE_CCEE.getCode())
).collect(Collectors.toList()).isEmpty()) {
throw new BaseException("房间门锁设备不存在!");
}
if (deviceList.stream().filter(item ->
item.getDevType().equals(DeviceType.DEVICE_0001.getCode())
).collect(Collectors.toList()).isEmpty()) {
throw new BaseException("房间取电设备不存在!");
}
// LambdaQueryWrapper<Device> deviceLambdaQueryWrapper = new LambdaQueryWrapper<>();
// deviceLambdaQueryWrapper.eq(Device::getRoomId, sOrder.getRoomId());
// deviceLambdaQueryWrapper.in(Device::getDevType, DeviceType.DEVICE_CCEE.getCode(), DeviceType.DEVICE_0001.getCode());
// List<Device> deviceList = deviceService.list(deviceLambdaQueryWrapper);
// if (CollectionUtils.isEmpty(deviceList)) {
// throw new BaseException("房间设备缺失!");
// }
// if (deviceList.stream().filter(device ->
// device.getDevType().equals(DeviceType.DEVICE_CCEE.getCode())
// ).collect(Collectors.toList()).isEmpty()) {
// throw new BaseException("房间门锁设备不存在!");
// }
// if (deviceList.stream().filter(item ->
// item.getDevType().equals(DeviceType.DEVICE_0001.getCode())
// ).collect(Collectors.toList()).isEmpty()) {
// throw new BaseException("房间取电设备不存在!");
// }
//当前房间是否有保洁任务
LambdaQueryWrapper<SCleanRecords> recordsQueryWrapper = new LambdaQueryWrapper<>();
recordsQueryWrapper.eq(SCleanRecords::getRoomId, sOrder.getRoomId());
......@@ -1688,24 +1688,25 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
roomService.updateById(sRoom);
redisUtil.delete(ReceiptRdeisEnum.ORDER_NO.getValue() + sOrder.getOrderNo());
//开门、取电
deviceOpService.openDoor(sRoomVo.getId(), sOrder.getConsumerPhone(),DeviceOpSourceEnum.DEVICE_SOURCE_20.getCode());
//语音
deviceOpService.asyncActionExecute(sOrder.getRoomId(), sOrder.getConsumerPhone(), VoiceEnum.OPEN.getCode(),
cn.hutool.core.date.DateUtil.format(new Date(), DatePattern.NORM_DATETIME_PATTERN),
cn.hutool.core.date.DateUtil.format(cn.hutool.core.date.DateUtil.offsetMinute(new Date(), 1),
DatePattern.NORM_DATETIME_PATTERN), "1", 30L, DeviceOpSourceEnum.DEVICE_SOURCE_20.getCode());
} else {
deviceOpService.openDoor(sRoomVo.getId(), sOrder.getConsumerPhone(),DeviceOpSourceEnum.DEVICE_SOURCE_20.getCode());
if (ObjectUtil.isEmpty(sOrder.getArrivalTime())) {
// deviceOpService.openDoor(sRoomVo.getId(), sOrder.getConsumerPhone(),DeviceOpSourceEnum.DEVICE_SOURCE_20.getCode());
//语音
deviceOpService.asyncActionExecute(sOrder.getRoomId(), sOrder.getConsumerPhone(), VoiceEnum.OPEN.getCode(),
cn.hutool.core.date.DateUtil.format(new Date(), DatePattern.NORM_DATETIME_PATTERN),
cn.hutool.core.date.DateUtil.format(cn.hutool.core.date.DateUtil.offsetMinute(new Date(), 1),
DatePattern.NORM_DATETIME_PATTERN), "1", 30L, DeviceOpSourceEnum.DEVICE_SOURCE_20.getCode());
sOrder.setArrivalTime(new Date());
baseMapper.updateById(sOrder);
}
}
// deviceOpService.asyncActionExecute(sOrder.getRoomId(), sOrder.getConsumerPhone(), VoiceEnum.OPEN.getCode(),
// cn.hutool.core.date.DateUtil.format(new Date(), DatePattern.NORM_DATETIME_PATTERN),
// cn.hutool.core.date.DateUtil.format(cn.hutool.core.date.DateUtil.offsetMinute(new Date(), 1),
// DatePattern.NORM_DATETIME_PATTERN), "1", 30L, DeviceOpSourceEnum.DEVICE_SOURCE_20.getCode());
}
// else {
// deviceOpService.openDoor(sRoomVo.getId(), sOrder.getConsumerPhone(),DeviceOpSourceEnum.DEVICE_SOURCE_20.getCode());
// if (ObjectUtil.isEmpty(sOrder.getArrivalTime())) {
// //语音
// deviceOpService.asyncActionExecute(sOrder.getRoomId(), sOrder.getConsumerPhone(), VoiceEnum.OPEN.getCode(),
// cn.hutool.core.date.DateUtil.format(new Date(), DatePattern.NORM_DATETIME_PATTERN),
// cn.hutool.core.date.DateUtil.format(cn.hutool.core.date.DateUtil.offsetMinute(new Date(), 1),
// DatePattern.NORM_DATETIME_PATTERN), "1", 30L, DeviceOpSourceEnum.DEVICE_SOURCE_20.getCode());
// sOrder.setArrivalTime(new Date());
// baseMapper.updateById(sOrder);
// }
// }
return "开锁成功";
}
......
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