|
|
@@ -257,6 +257,9 @@ public class DeviceInfoService {
|
|
|
if (ObjectUtils.isEmpty(deviceInfo)) {
|
|
|
return ResultContent.buildFail(String.format(ResultMessage.DATA_NOT_EXIST, param.getId()));
|
|
|
}
|
|
|
+ if (deviceInfo.getState() == DeviceState.Cancel) {
|
|
|
+ return ResultContent.buildFail("设备已注销");
|
|
|
+ }
|
|
|
deviceInfo.setState(param.getState());
|
|
|
updateDeviceOnLineStateByState(deviceInfo);
|
|
|
deviceInfoDao.save(deviceInfo);
|
|
|
@@ -331,6 +334,9 @@ public class DeviceInfoService {
|
|
|
if (deviceInfo.getState() != DeviceState.Cancel) {
|
|
|
return ResultContent.buildFail("设备未注销,不能删除");
|
|
|
}
|
|
|
+ if (deviceInfo.getIsDelete() != null && deviceInfo.getIsDelete()) {
|
|
|
+ return ResultContent.buildFail("设备已删除");
|
|
|
+ }
|
|
|
deviceInfo.setIsDelete(Boolean.TRUE);
|
|
|
deviceInfoDao.save(deviceInfo);
|
|
|
|
|
|
@@ -359,6 +365,12 @@ public class DeviceInfoService {
|
|
|
if (ObjectUtils.isEmpty(deviceInfo)) {
|
|
|
return ResultContent.buildFail(String.format("设备ID不存在:%s", deviceId));
|
|
|
}
|
|
|
+ if (deviceInfo.getState() == DeviceState.Cancel) {
|
|
|
+ return ResultContent.buildFail("设备已注销");
|
|
|
+ }
|
|
|
+ if (deviceInfo.getIsDelete() != null && deviceInfo.getIsDelete()) {
|
|
|
+ return ResultContent.buildFail("设备已删除");
|
|
|
+ }
|
|
|
deviceInfo.setState(DeviceState.Cancel);
|
|
|
updateDeviceOnLineStateByState(deviceInfo);
|
|
|
deviceInfoDao.save(deviceInfo);
|