|
|
@@ -4,6 +4,7 @@ import cn.dev33.satoken.stp.StpUtil;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.kym.common.utils.CommUtil;
|
|
|
import com.kym.entity.WashDevice;
|
|
|
+import com.kym.entity.WashOrder;
|
|
|
import com.kym.entity.common.PageBean;
|
|
|
import com.kym.entity.queryParams.DeviceQueryParams;
|
|
|
import com.kym.entity.vo.WashDeviceVo;
|
|
|
@@ -75,11 +76,21 @@ public class WashDeviceServiceImpl extends MyBaseServiceImpl<WashDeviceMapper, W
|
|
|
@Override
|
|
|
public WashDeviceVo getDevice(String shortId) {
|
|
|
var productKeyAndDeviceName = KymCache.INSTANCE.getProductKeyAndDeviceNameByWashShortId(shortId);
|
|
|
+ // 校验操作人权限
|
|
|
+ var order = washOrderService.lambdaQuery()
|
|
|
+ .eq(WashOrder::getProductKey, productKeyAndDeviceName[0])
|
|
|
+ .eq(WashOrder::getDeviceName, productKeyAndDeviceName[1])
|
|
|
+ .eq(WashOrder::getOrderStatus, WashOrder.ORDER_STATUS_开机)
|
|
|
+ .eq(WashOrder::getPayStatus, WashOrder.PAY_STATUS_未支付)
|
|
|
+ .one();
|
|
|
+
|
|
|
+ CommUtil.asserts(order != null && order.getUserId() != StpUtil.getLoginIdAsLong(), "设备正在使用中!");
|
|
|
+
|
|
|
var washDevice = lambdaQuery()
|
|
|
.eq(WashDevice::getProductKey, productKeyAndDeviceName[0])
|
|
|
.eq(WashDevice::getDeviceName, productKeyAndDeviceName[1])
|
|
|
.one();
|
|
|
- //TODO 根据订单查询占用中的设备
|
|
|
+
|
|
|
var vo = new WashDeviceVo().setCurrentUserId(StpUtil.getLoginIdAsLong());
|
|
|
BeanUtils.copyProperties(washDevice, vo.setShortId(shortId));
|
|
|
return vo;
|