|
@@ -31,7 +31,6 @@ import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.stereotype.Component;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
@@ -162,7 +161,7 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
boolean flag = devInfoService.update(null,
|
|
|
Wrappers.<DevInfo>lambdaUpdate()
|
|
|
.set(DevInfo::getUserId, null)
|
|
|
- .eq(DevInfo::getDevId, deviceId));
|
|
|
+ .eq(DevInfo::getClientId, deviceId));
|
|
|
//更新设备分享表
|
|
|
boolean flagV2 = devShareService.update(null,
|
|
|
Wrappers.<DevShare>lambdaUpdate()
|
|
@@ -189,7 +188,7 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
// 1. 检查设备是否存在
|
|
|
DevInfo devInfo = devInfoService.getOne(
|
|
|
Wrappers.<DevInfo>lambdaQuery()
|
|
|
- .eq(DevInfo::getDevId, request.getDevId())
|
|
|
+ .eq(DevInfo::getClientId, request.getDevId())
|
|
|
);
|
|
|
if (Objects.isNull(devInfo)) {
|
|
|
throw new BizException(ErrorEnum.DEVICE_IS_NOT_EXIST.getErrorCode(), ErrorEnum.DEVICE_IS_NOT_EXIST.getErrorMessage());
|
|
@@ -199,7 +198,7 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
}
|
|
|
|
|
|
// 3. 更新设备信息
|
|
|
- return devInfoService.updateDevice(devInfo.getDevInfoId(), request);
|
|
|
+ return devInfoService.updateDevice(devInfo.getDevId(), request);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -207,7 +206,7 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
public DeviceDTO queryDeviceById(String deviceId) {
|
|
|
DevInfo devInfo = devInfoService.getOne(
|
|
|
Wrappers.<DevInfo>lambdaQuery()
|
|
|
- .eq(DevInfo::getDevId, deviceId));
|
|
|
+ .eq(DevInfo::getClientId, deviceId));
|
|
|
if (Objects.isNull(devInfo)) {
|
|
|
throw new BizException(ErrorEnum.DEVICE_IS_NOT_EXIST.getErrorCode(), ErrorEnum.DEVICE_IS_NOT_EXIST.getErrorMessage());
|
|
|
}
|
|
@@ -284,7 +283,7 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
Boolean flag = devInfoService.updateDevice(request.getDevId(), request);
|
|
|
DevInfo devInfo = devInfoService.getOne(
|
|
|
Wrappers.<DevInfo>lambdaQuery()
|
|
|
- .eq(DevInfo::getDevId, request.getDevId()));
|
|
|
+ .eq(DevInfo::getClientId, request.getDevId()));
|
|
|
|
|
|
//检查parts.length >= 2确保数组有足够元素,提供默认值"2.0"
|
|
|
String result = Optional.ofNullable(devInfo.getSoftware())
|
|
@@ -314,7 +313,7 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
|
|
|
DevInfo devInfo = devInfoService.getOne(
|
|
|
Wrappers.<DevInfo>lambdaQuery()
|
|
|
- .eq(DevInfo::getDevId, params.getDeviceId()));
|
|
|
+ .eq(DevInfo::getClientId, params.getDeviceId()));
|
|
|
if (Objects.isNull(devInfo)) {
|
|
|
throw new BizException(ErrorEnum.DEVICE_IS_NOT_EXIST.getErrorCode(), ErrorEnum.DEVICE_IS_NOT_EXIST.getErrorMessage());
|
|
|
}
|
|
@@ -369,7 +368,7 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
// 查询设备信息
|
|
|
DevInfo devInfo = devInfoService.getOne(
|
|
|
Wrappers.<DevInfo>lambdaQuery()
|
|
|
- .eq(DevInfo::getDevId, devId));
|
|
|
+ .eq(DevInfo::getClientId, devId));
|
|
|
|
|
|
if (devInfo == null) {
|
|
|
log.warn("设备不存在: {}", devId);
|
|
@@ -399,7 +398,7 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
// 检查设备是否已存在
|
|
|
DevInfo existingDevice = devInfoService.getOne(
|
|
|
Wrappers.<DevInfo>lambdaQuery()
|
|
|
- .eq(DevInfo::getDevId, device.getDevId()));
|
|
|
+ .eq(DevInfo::getClientId, device.getDevId()));
|
|
|
|
|
|
DevInfo devInfo;
|
|
|
if (existingDevice != null) {
|
|
@@ -430,7 +429,7 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
*/
|
|
|
private DevInfo createDeviceInfo(Device device) {
|
|
|
DevInfo devInfo = new DevInfo();
|
|
|
- devInfo.setDevId(device.getDevId());
|
|
|
+ devInfo.setClientId(device.getDevId());
|
|
|
devInfo.setOnline(device.getOnline());
|
|
|
devInfo.setDevType(device.getDevType());
|
|
|
devInfo.setSoftware(device.getSoftware());
|
|
@@ -516,7 +515,7 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
boolean updateResult = devInfoService.update(
|
|
|
Wrappers.<DevInfo>lambdaUpdate()
|
|
|
.set(DevInfo::getOnline, online)
|
|
|
- .eq(DevInfo::getDevId, devId));
|
|
|
+ .eq(DevInfo::getClientId, devId));
|
|
|
|
|
|
if (!updateResult) {
|
|
|
log.warn("更新设备在线状态失败: 设备不存在或更新失败, ID={}", devId);
|
|
@@ -526,7 +525,7 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
// 获取更新后的设备信息
|
|
|
DevInfo devInfo = devInfoService.getOne(
|
|
|
Wrappers.<DevInfo>lambdaQuery()
|
|
|
- .eq(DevInfo::getDevId, devId));
|
|
|
+ .eq(DevInfo::getClientId, devId));
|
|
|
|
|
|
if (devInfo != null) {
|
|
|
// 转换为领域对象
|
|
@@ -643,7 +642,7 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
// 查询设备是否存在
|
|
|
DevInfo devInfo = devInfoService.getOne(
|
|
|
Wrappers.<DevInfo>lambdaQuery()
|
|
|
- .eq(DevInfo::getDevId, deviceId));
|
|
|
+ .eq(DevInfo::getClientId, deviceId));
|
|
|
return devInfo != null;
|
|
|
} catch (Exception e) {
|
|
|
// 记录错误日志
|
|
@@ -658,7 +657,7 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
// 查询设备是否已被绑定
|
|
|
DevInfo devInfo = devInfoService.getOne(
|
|
|
Wrappers.<DevInfo>lambdaQuery()
|
|
|
- .eq(DevInfo::getDevId, deviceId));
|
|
|
+ .eq(DevInfo::getClientId, deviceId));
|
|
|
return devInfo != null && devInfo.getUserId() != null;
|
|
|
} catch (Exception e) {
|
|
|
// 记录错误日志
|
|
@@ -686,7 +685,7 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
// 检查设备是否存在
|
|
|
DevInfo devInfo = devInfoService.getOne(
|
|
|
Wrappers.<DevInfo>lambdaQuery()
|
|
|
- .eq(DevInfo::getDevId, deviceId));
|
|
|
+ .eq(DevInfo::getClientId, deviceId));
|
|
|
if (devInfo == null) {
|
|
|
return false;
|
|
|
}
|
|
@@ -700,7 +699,7 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
boolean updateResult = devInfoService.update(
|
|
|
Wrappers.<DevInfo>lambdaUpdate()
|
|
|
.set(DevInfo::getUserId, userId)
|
|
|
- .eq(DevInfo::getDevId, deviceId));
|
|
|
+ .eq(DevInfo::getClientId, deviceId));
|
|
|
|
|
|
return updateResult;
|
|
|
} catch (Exception e) {
|
|
@@ -884,7 +883,7 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
// 查询设备记录
|
|
|
DevInfo devInfo = devInfoService.getOne(
|
|
|
Wrappers.<DevInfo>lambdaQuery()
|
|
|
- .eq(DevInfo::getDevId, deviceId)
|
|
|
+ .eq(DevInfo::getClientId, deviceId)
|
|
|
);
|
|
|
|
|
|
if (devInfo == null) {
|
|
@@ -934,7 +933,7 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
|
|
|
// 创建设备信息
|
|
|
DevInfo devInfo = new DevInfo();
|
|
|
- devInfo.setDevId(deviceId);
|
|
|
+ devInfo.setClientId(deviceId);
|
|
|
|
|
|
// 设置设备类型
|
|
|
if (deviceInfo.containsKey("devType")) {
|
|
@@ -995,7 +994,7 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
// 更新设备信息
|
|
|
DevInfo devInfo = devInfoService.getOne(
|
|
|
Wrappers.<DevInfo>lambdaQuery()
|
|
|
- .eq(DevInfo::getDevId, device.getDevId())
|
|
|
+ .eq(DevInfo::getClientId, device.getDevId())
|
|
|
);
|
|
|
|
|
|
if (devInfo != null) {
|
|
@@ -1045,7 +1044,7 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
}
|
|
|
|
|
|
Device device = Device.builder()
|
|
|
- .devId(devInfo.getDevId())
|
|
|
+ .devId(devInfo.getClientId())
|
|
|
.online(devInfo.getOnline())
|
|
|
.devType(devInfo.getDevType())
|
|
|
.software(devInfo.getSoftware())
|
|
@@ -1071,7 +1070,7 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
// 查询设备记录
|
|
|
DevInfo devInfo = devInfoService.getOne(
|
|
|
Wrappers.<DevInfo>lambdaQuery()
|
|
|
- .eq(DevInfo::getDevId, deviceId)
|
|
|
+ .eq(DevInfo::getClientId, deviceId)
|
|
|
);
|
|
|
|
|
|
if (devInfo == null) {
|
|
@@ -1460,7 +1459,7 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
// 删除设备信息
|
|
|
boolean result = devInfoService.remove(
|
|
|
Wrappers.<DevInfo>lambdaQuery()
|
|
|
- .eq(DevInfo::getDevId, deviceId)
|
|
|
+ .eq(DevInfo::getClientId, deviceId)
|
|
|
);
|
|
|
|
|
|
// 删除设备相关的区域信息
|