|
|
@@ -2,6 +2,7 @@ package com.kym.service.impl;
|
|
|
|
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
+import com.kym.common.exception.BusinessException;
|
|
|
import com.kym.common.utils.CommUtil;
|
|
|
import com.kym.entity.WashDevice;
|
|
|
import com.kym.entity.WashOrder;
|
|
|
@@ -50,6 +51,7 @@ public class WashDeviceServiceImpl extends MyBaseServiceImpl<WashDeviceMapper, W
|
|
|
var list = lambdaQuery()
|
|
|
.eq(CommUtil.isNotEmptyAndNull(params.getId()), WashDevice::getId, params.getId())
|
|
|
.eq(CommUtil.isNotEmptyAndNull(params.getStationId()), WashDevice::getStationId, params.getStationId())
|
|
|
+ .orderByAsc(WashDevice::getState)
|
|
|
.orderByAsc(WashDevice::getDeviceName)
|
|
|
.list();
|
|
|
var voList = new ArrayList<WashDeviceVo>();
|
|
|
@@ -84,16 +86,19 @@ public class WashDeviceServiceImpl extends MyBaseServiceImpl<WashDeviceMapper, W
|
|
|
.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();
|
|
|
+ if (order == null || order.getUserId() == StpUtil.getLoginIdAsLong()) {
|
|
|
+ var washDevice = lambdaQuery()
|
|
|
+ .eq(WashDevice::getProductKey, productKeyAndDeviceName[0])
|
|
|
+ .eq(WashDevice::getDeviceName, productKeyAndDeviceName[1])
|
|
|
+ .one();
|
|
|
+
|
|
|
+ var vo = new WashDeviceVo().setCurrentUserId(StpUtil.getLoginIdAsLong());
|
|
|
+ BeanUtils.copyProperties(washDevice, vo.setShortId(shortId));
|
|
|
+ return vo;
|
|
|
+ } else {
|
|
|
+ throw new BusinessException("设备他人使用中!");
|
|
|
+ }
|
|
|
|
|
|
- var vo = new WashDeviceVo().setCurrentUserId(StpUtil.getLoginIdAsLong());
|
|
|
- BeanUtils.copyProperties(washDevice, vo.setShortId(shortId));
|
|
|
- return vo;
|
|
|
}
|
|
|
|
|
|
|