|
@@ -269,7 +269,7 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
}
|
|
|
|
|
|
// 记录操作日志
|
|
|
- logService.saveLog(Long.valueOf(devId),OprLogType.UNBLIND_DEVICE.getCode(), logContent);
|
|
|
+ logService.saveLog(Long.valueOf(devId), OprLogType.UNBLIND_DEVICE.getCode(), logContent);
|
|
|
return updateFlag;
|
|
|
}
|
|
|
|
|
@@ -298,7 +298,7 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
devInfo.setActiveTime(LocalDateTime.now());
|
|
|
devInfoService.updateById(devInfo);
|
|
|
|
|
|
- logService.saveLog(devInfo.getDevId(),OprLogType.BIND_DEVICE.getCode(), String.format("用户 %d 绑定设备 %s", request.getUserId(), request.getClientId()));
|
|
|
+ logService.saveLog(devInfo.getDevId(), OprLogType.BIND_DEVICE.getCode(), String.format("用户 %d 绑定设备 %s", request.getUserId(), request.getClientId()));
|
|
|
|
|
|
//5.返回绑定结果和设备主键id
|
|
|
DeviceDTO result = new DeviceDTO();
|
|
@@ -326,9 +326,6 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Boolean handleEvent(Long eventListId) {
|
|
@@ -387,7 +384,7 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
throw new BizException(ErrorEnum.DEVICE_IS_NOT_EXIST.getErrorCode(), ErrorEnum.DEVICE_IS_NOT_EXIST.getErrorMessage());
|
|
|
}
|
|
|
|
|
|
- logService.saveLog(devInfo.getDevId(),OprLogType.UPDATE_DEVICE.getCode(), devInfo);
|
|
|
+ logService.saveLog(devInfo.getDevId(), OprLogType.UPDATE_DEVICE.getCode(), devInfo);
|
|
|
|
|
|
//2.更新数据
|
|
|
devInfo.setTenantId(params.getTenantId());
|
|
@@ -468,7 +465,7 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
throw new BizException(ErrorEnum.DEVICE_UPDATE_FAIL.getErrorCode(), ErrorEnum.DEVICE_UPDATE_FAIL.getErrorMessage());
|
|
|
}
|
|
|
|
|
|
- logService.saveLog(devInfo.getDevId(),OprLogType.UPDATE_DEVICE.getCode(), params);
|
|
|
+ logService.saveLog(devInfo.getDevId(), OprLogType.UPDATE_DEVICE.getCode(), params);
|
|
|
|
|
|
//5.通过MQTT把信息参数发送到设备
|
|
|
mqttSend.sendDeviceParamsToMqtt(devInfo.getClientId(), params);
|
|
@@ -489,15 +486,6 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
}
|
|
|
|
|
|
|
|
|
- // 辅助方法:如果值为null则设置默认值
|
|
|
- private <T> void setIfNull(java.util.function.Supplier<T> getter,
|
|
|
- java.util.function.Supplier<T> defaultValueSupplier,
|
|
|
- java.util.function.Consumer<T> setter) {
|
|
|
- if (getter.get() == null) {
|
|
|
- setter.accept(defaultValueSupplier.get());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
public Boolean updateDeviceLocation(DeviceLocationParams params) {
|
|
|
|
|
@@ -548,7 +536,7 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- @Transactional
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public Boolean statusLight(StatusLightParams params) {
|
|
|
//1.校验设备是否存在
|
|
|
DevInfo devInfo = devInfoService.getById(params.getDevId());
|
|
@@ -611,6 +599,7 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public Boolean saveRoom(RoomParam param) {
|
|
|
|
|
|
//查询设备信息
|
|
@@ -645,7 +634,7 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
}
|
|
|
|
|
|
// 记录操作日志
|
|
|
- logService.saveLog(param.getDevId(),OprLogType.UPDATE_ROOM.getCode(), param);
|
|
|
+ logService.saveLog(param.getDevId(), OprLogType.UPDATE_ROOM.getCode(), param);
|
|
|
|
|
|
return true;
|
|
|
}
|
|
@@ -801,7 +790,7 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
devShareService.removeById(devShare);
|
|
|
|
|
|
//3.取消分享记录到日志
|
|
|
- logService.saveLog(devShare.getDevId(),OprLogType.CANCEL_SHARE.getCode(), shareId);
|
|
|
+ logService.saveLog(devShare.getDevId(), OprLogType.CANCEL_SHARE.getCode(), shareId);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -820,7 +809,7 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
devShareService.updateById(devShare);
|
|
|
|
|
|
//3.记录操作日志
|
|
|
- logService.saveLog(devShare.getDevId(),OprLogType.UPDATE_DEVICE_SHARE_PERMISSION.getCode(), param);
|
|
|
+ logService.saveLog(devShare.getDevId(), OprLogType.UPDATE_DEVICE_SHARE_PERMISSION.getCode(), param);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -1137,7 +1126,7 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
devInfo.getDevId(), // 转移的设备id
|
|
|
userInfo.getUserId() // 转移后的用户id
|
|
|
);
|
|
|
- logService.saveLog(param.getDevId(),OprLogType.DEVICE_TRANSFER.getCode(), logContent);
|
|
|
+ logService.saveLog(param.getDevId(), OprLogType.DEVICE_TRANSFER.getCode(), logContent);
|
|
|
return true;
|
|
|
}
|
|
|
|