|
@@ -139,7 +139,7 @@ namespace WingDeviceService.Service
|
|
|
await ValidateTokenAsync(request.Token);
|
|
|
if (string.IsNullOrWhiteSpace(request.DeviceCode))
|
|
|
{
|
|
|
- throw new RpcException(1001, "DeviceCode empty error", "DeviceCode empty error");
|
|
|
+ throw new RpcException((int)CustomerRpcCode.DeviceCodeEmpty, "DeviceCode empty error", "DeviceCode empty error");
|
|
|
}
|
|
|
var deviceDb = await _deviceInfoDBServiceProxy.FindDeviceInfoByCodeAsync(request.DeviceCode);
|
|
|
if (deviceDb == null || deviceDb.DeviceCode != request.DeviceCode)
|
|
@@ -193,7 +193,7 @@ namespace WingDeviceService.Service
|
|
|
await ValidateTokenAsync(request.Token);
|
|
|
if (string.IsNullOrWhiteSpace(request.ShortCode))
|
|
|
{
|
|
|
- throw new RpcException(1001, "ShortCode empty error", "ShortCode empty error");
|
|
|
+ throw new RpcException((int)CustomerRpcCode.ShortCodeEmpty, "ShortCode empty error", "ShortCode empty error");
|
|
|
}
|
|
|
var deviceDb = await _deviceInfoDBServiceProxy.FindDeviceInfoByShortCodeAsync(request.ShortCode);
|
|
|
if (deviceDb == null || deviceDb.ShortCode != request.ShortCode)
|
|
@@ -271,20 +271,13 @@ namespace WingDeviceService.Service
|
|
|
await ValidateTokenAsync(request.Token);
|
|
|
if (string.IsNullOrWhiteSpace(request.DeviceCode) || string.IsNullOrWhiteSpace(request.OrganizationCode))
|
|
|
{
|
|
|
- throw new RpcException(1001, "DeviceCode Or OrganizationCode empty error", "DeviceCode Or OrganizationCode empty error");
|
|
|
+ throw new RpcException((int)CustomerRpcCode.DeviceCodeOrOrganizationCodeEmpty, "DeviceCode Or OrganizationCode empty error", "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(1001, "DeviceInfo not exist error", "DeviceInfo not exist error");
|
|
|
+ throw new RpcException((int)CustomerRpcCode.DeviceNotExist, "DeviceInfo not exist error", "DeviceInfo not exist error");
|
|
|
}
|
|
|
- // //根据机构code和设备code去用户表查询关联数据,如果有则返回异常,否则就解除绑定关系;
|
|
|
- // var isExistUserRelevancy = false;
|
|
|
- // //todo 到时候调用mike的关联用户接口
|
|
|
- // if (isExistUserRelevancy)
|
|
|
- // {
|
|
|
- // throw new RpcException(1001, "This Device Exist Share User error", "This Device Exist Share User error");
|
|
|
- // }
|
|
|
//根据设备code和机构code查询相关数据,查到则删除关联
|
|
|
if (!string.IsNullOrEmpty(deviceDb.DepartmentCode))
|
|
|
{
|
|
@@ -395,7 +388,7 @@ namespace WingDeviceService.Service
|
|
|
var deviceDb = await _deviceInfoDBServiceProxy.FindDeviceInfoByShortCodeAsync(request.ShortCode);
|
|
|
if (deviceDb == null)
|
|
|
{
|
|
|
- throw new RpcException(1001, "Not find device", "Not find device");
|
|
|
+ throw new RpcException((int)CustomerRpcCode.DeviceNotExist, "Not find device", "Not find device");
|
|
|
}
|
|
|
if (userInfoDO.BindDevices != null && userInfoDO.BindDevices.Contains(deviceDb.DeviceCode))
|
|
|
{
|
|
@@ -463,11 +456,11 @@ namespace WingDeviceService.Service
|
|
|
var deviceDb = await _deviceInfoDBServiceProxy.FindDeviceInfoByCodeAsync(request.DeviceCode);
|
|
|
if (deviceDb == null)
|
|
|
{
|
|
|
- throw new RpcException(1001, "Not find device", "Not find device");
|
|
|
+ throw new RpcException((int)CustomerRpcCode.DeviceNotExist, "Not find device", "Not find device");
|
|
|
}
|
|
|
if (string.IsNullOrWhiteSpace(request.Name))
|
|
|
{
|
|
|
- throw new RpcException(1001, "Device name cannot be empty", "Device name cannot be empty");
|
|
|
+ throw new RpcException((int)CustomerRpcCode.DeviceNameEmpty, "Device name cannot be empty", "Device name cannot be empty");
|
|
|
}
|
|
|
deviceDb.Name = request.Name;
|
|
|
if (!string.IsNullOrWhiteSpace(request.HeadPicUrl))
|