|
@@ -136,7 +136,7 @@ namespace WingDeviceService.Service
|
|
|
//验证
|
|
|
if (string.IsNullOrWhiteSpace(request.DeviceCode))
|
|
|
{
|
|
|
- throw new RpcException((int)CustomerRpcCode.DeviceCodeEmpty, "DeviceCode empty error", "DeviceCode empty error");
|
|
|
+ ThrowCustomerException(CustomerRpcCode.DeviceCodeEmpty, "DeviceCode empty error");
|
|
|
}
|
|
|
var deviceDb = await _deviceInfoDBServiceProxy.FindDeviceInfoByCodeAsync(request.DeviceCode);
|
|
|
if (deviceDb == null || deviceDb.DeviceCode != request.DeviceCode)
|
|
@@ -189,7 +189,7 @@ namespace WingDeviceService.Service
|
|
|
//验证
|
|
|
if (string.IsNullOrWhiteSpace(request.ShortCode))
|
|
|
{
|
|
|
- throw new RpcException((int)CustomerRpcCode.ShortCodeEmpty, "ShortCode empty error", "ShortCode empty error");
|
|
|
+ ThrowCustomerException(CustomerRpcCode.ShortCodeEmpty, "ShortCode empty error");
|
|
|
}
|
|
|
var deviceDb = await _deviceInfoDBServiceProxy.FindDeviceInfoByShortCodeAsync(request.ShortCode);
|
|
|
if (deviceDb == null || deviceDb.ShortCode != request.ShortCode)
|
|
@@ -265,12 +265,12 @@ namespace WingDeviceService.Service
|
|
|
//验证
|
|
|
if (string.IsNullOrWhiteSpace(request.DeviceCode) || string.IsNullOrWhiteSpace(request.OrganizationCode))
|
|
|
{
|
|
|
- throw new RpcException((int)CustomerRpcCode.DeviceCodeOrOrganizationCodeEmpty, "DeviceCode Or OrganizationCode empty error", "DeviceCode Or OrganizationCode empty error");
|
|
|
+ ThrowCustomerException(CustomerRpcCode.DeviceCodeOrOrganizationCodeEmpty, "DeviceCode Or OrganizationCode empty error");
|
|
|
}
|
|
|
var deviceDb = await _deviceInfoDBServiceProxy.FindDeviceInfoByCodeAsync(request.DeviceCode);
|
|
|
if (deviceDb == null || deviceDb.OrganizationCode != request.OrganizationCode || deviceDb.DepartmentCode != request.DepartmentCode)
|
|
|
{
|
|
|
- throw new RpcException((int)CustomerRpcCode.DeviceNotExist, "DeviceInfo not exist error", "DeviceInfo not exist error");
|
|
|
+ ThrowCustomerException(CustomerRpcCode.DeviceNotExist, "DeviceInfo not exist error");
|
|
|
}
|
|
|
//根据设备code和机构code查询相关数据,查到则删除关联
|
|
|
if (!string.IsNullOrEmpty(deviceDb.DepartmentCode))
|
|
@@ -377,7 +377,7 @@ namespace WingDeviceService.Service
|
|
|
var deviceDb = await _deviceInfoDBServiceProxy.FindDeviceInfoByShortCodeAsync(request.ShortCode);
|
|
|
if (deviceDb == null)
|
|
|
{
|
|
|
- throw new RpcException((int)CustomerRpcCode.DeviceNotExist, "Not find device", "Not find device");
|
|
|
+ ThrowCustomerException(CustomerRpcCode.DeviceNotExist, "Not find device");
|
|
|
}
|
|
|
if (userInfoDO.BindDevices != null && userInfoDO.BindDevices.Contains(deviceDb.DeviceCode))
|
|
|
{
|
|
@@ -444,11 +444,11 @@ namespace WingDeviceService.Service
|
|
|
var deviceDb = await _deviceInfoDBServiceProxy.FindDeviceInfoByCodeAsync(request.DeviceCode);
|
|
|
if (deviceDb == null)
|
|
|
{
|
|
|
- throw new RpcException((int)CustomerRpcCode.DeviceNotExist, "Not find device", "Not find device");
|
|
|
+ ThrowCustomerException(CustomerRpcCode.DeviceNotExist, "Not find device");
|
|
|
}
|
|
|
if (string.IsNullOrWhiteSpace(request.Name))
|
|
|
{
|
|
|
- throw new RpcException((int)CustomerRpcCode.DeviceNameEmpty, "Device name cannot be empty", "Device name cannot be empty");
|
|
|
+ ThrowCustomerException(CustomerRpcCode.DeviceNameEmpty, "Device name cannot be empty");
|
|
|
}
|
|
|
deviceDb.Name = request.Name;
|
|
|
if (!string.IsNullOrWhiteSpace(request.HeadPicUrl))
|