|
@@ -100,17 +100,17 @@ namespace WingDeviceService.Service
|
|
|
//检查设备编码不为空
|
|
|
if (string.IsNullOrWhiteSpace(request.DeviceCode))
|
|
|
{
|
|
|
- throw new RpcException(1004, "Required parameter:DeviceCode cannot be empty", "Required parameter:DeviceCode cannot be empty");
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.DeviceCodeIsEmpty, "Required parameter:DeviceCode cannot be empty");
|
|
|
}
|
|
|
if (userCodes == null || userCodes.Count <= 0)
|
|
|
{
|
|
|
- throw new RpcException(1004, "Required parameter:UserCodes cannot be empty", "Required parameter:UserCodes cannot be empty");
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.UserCodeEmptyError, "Required parameter:UserCodes cannot be empty");
|
|
|
}
|
|
|
//查询设备对象
|
|
|
var deviceDb = await _deviceInfoDBServiceProxy.FindDeviceInfoByCodeAsync(deviceCode);
|
|
|
if (deviceDb == null)
|
|
|
{
|
|
|
- throw new CustomerRpcCodeException(CustomerRpcCode.NoExistDevice, "Device does not exist");
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.NoExistDevice, "Device does not exist");
|
|
|
}
|
|
|
foreach (var userCode in userCodes)
|
|
|
{
|
|
@@ -144,7 +144,7 @@ namespace WingDeviceService.Service
|
|
|
var deviceDb = await _deviceInfoDBServiceProxy.FindDeviceInfoByCodeAsync(request.DeviceCode);
|
|
|
if (deviceDb == null || deviceDb.DeviceCode != request.DeviceCode)
|
|
|
{
|
|
|
- throw new CustomerRpcCodeException(CustomerRpcCode.NoExistDevice, "Device does not exist");
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.NoExistDevice, "Device does not exist");
|
|
|
}
|
|
|
//根据机构编号查询机构名称
|
|
|
var organizationName = "";
|
|
@@ -198,7 +198,7 @@ namespace WingDeviceService.Service
|
|
|
var deviceDb = await _deviceInfoDBServiceProxy.FindDeviceInfoByShortCodeAsync(request.ShortCode);
|
|
|
if (deviceDb == null || deviceDb.ShortCode != request.ShortCode)
|
|
|
{
|
|
|
- throw new CustomerRpcCodeException(CustomerRpcCode.NoExistDevice, "Device does not exist");
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.NoExistDevice, "Device does not exist");
|
|
|
}
|
|
|
return await MapToExtendDTO(deviceDb);
|
|
|
}
|
|
@@ -216,12 +216,12 @@ namespace WingDeviceService.Service
|
|
|
//检查设备编码不为空
|
|
|
if (string.IsNullOrWhiteSpace(request.DeviceCode))
|
|
|
{
|
|
|
- throw new RpcException(1004, "Required parameter:DeviceCode cannot be empty", "Required parameter:DeviceCode cannot be empty");
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.DeviceCodeIsEmpty, "Required parameter:DeviceCode cannot be empty");
|
|
|
}
|
|
|
//用户编码集合检查
|
|
|
if (userCodes == null || userCodes.Count <= 0)
|
|
|
{
|
|
|
- throw new RpcException(1004, "Required parameter:UserCodes cannot be empty", "Required parameter:UserCodes cannot be empty");
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.UserCodeEmptyError, "Required parameter:UserCodes cannot be empty");
|
|
|
}
|
|
|
//查询设备对象
|
|
|
var deviceDb = await _deviceInfoDBServiceProxy.FindDeviceInfoByCodeAsync(deviceCode);
|
|
@@ -316,7 +316,7 @@ namespace WingDeviceService.Service
|
|
|
var userInfoDO = await _userServiceProxy.FindUserByCodeAsync(userCode);
|
|
|
if (userInfoDO == null)
|
|
|
{
|
|
|
- throw new CustomerRpcCodeException(CustomerRpcCode.UserNotExistError, "User does not exist");
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.UserNotExistError, "User does not exist");
|
|
|
}
|
|
|
//查询用户的医院是否存在
|
|
|
if (string.IsNullOrWhiteSpace(userInfoDO.OrganizationCode))
|
|
@@ -383,7 +383,7 @@ namespace WingDeviceService.Service
|
|
|
var userInfoDO = await _userServiceProxy.FindUserByCodeAsync(userCode);
|
|
|
if (userInfoDO == null)
|
|
|
{
|
|
|
- throw new CustomerRpcCodeException(CustomerRpcCode.UserNotExistError, "User does not exist");
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.UserNotExistError, "User does not exist");
|
|
|
}
|
|
|
var deviceDb = await _deviceInfoDBServiceProxy.FindDeviceInfoByShortCodeAsync(request.ShortCode);
|
|
|
if (deviceDb == null)
|
|
@@ -392,7 +392,7 @@ namespace WingDeviceService.Service
|
|
|
}
|
|
|
if (userInfoDO.BindDevices != null && userInfoDO.BindDevices.Contains(deviceDb.DeviceCode))
|
|
|
{
|
|
|
- throw new CustomerRpcCodeException(CustomerRpcCode.HasAddedDevice,"The device has been Added");
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.HasAddedDevice, "The device has been Added");
|
|
|
}
|
|
|
try
|
|
|
{
|
|
@@ -609,13 +609,13 @@ namespace WingDeviceService.Service
|
|
|
var userInfoDO = await _userServiceProxy.FindUserByCodeAsync(userCode);
|
|
|
if (userInfoDO == null)
|
|
|
{
|
|
|
- throw new CustomerRpcCodeException(CustomerRpcCode.UserNotExistError, "User does not exist");
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.UserNotExistError, "User does not exist");
|
|
|
}
|
|
|
var result = new List<SelectItemDTO>();
|
|
|
//查询用户的医院是否存在
|
|
|
if (string.IsNullOrEmpty(userInfoDO.OrganizationCode))
|
|
|
{
|
|
|
- throw new CustomerRpcCodeException(CustomerRpcCode.OrganizationNotExist, "Org does not exist");
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.OrganizationNotExist, "Org does not exist");
|
|
|
}
|
|
|
//查询用户绑定的设备
|
|
|
if (userInfoDO.BindDevices == null || userInfoDO.BindDevices.Count <= 0)
|
|
@@ -676,7 +676,7 @@ namespace WingDeviceService.Service
|
|
|
var userCode = await ValidateTokenAsync(request.Token);
|
|
|
if (string.IsNullOrEmpty(shortCode))
|
|
|
{
|
|
|
- throw new CustomerRpcCodeException(CustomerRpcCode.UniqueCodeIsEmpty,"UniqueCode is empty");
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.UniqueCodeIsEmpty, "UniqueCode is empty");
|
|
|
}
|
|
|
var device = await _deviceInfoDBServiceProxy.FindDeviceInfoByShortCodeAsync(shortCode);
|
|
|
if (device == null)
|
|
@@ -686,7 +686,7 @@ namespace WingDeviceService.Service
|
|
|
var oldOrg = await _organizationDBService.GetOrganizationDetailAsync(new GetOrganizationDBRequest { OrganizationCode = device.OrganizationCode });
|
|
|
if (oldOrg == null || string.IsNullOrWhiteSpace(oldOrg.OrganizationCode))
|
|
|
{
|
|
|
- throw new CustomerRpcCodeException(CustomerRpcCode.OrganizationNotExist,"Org does not exist");
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.OrganizationNotExist, "Org does not exist");
|
|
|
}
|
|
|
//用户
|
|
|
var userDTO = await _userServiceProxy.FindUserByCodeAsync(userCode);
|
|
@@ -696,12 +696,12 @@ namespace WingDeviceService.Service
|
|
|
}
|
|
|
if (!userDTO.IsDirector)
|
|
|
{
|
|
|
- throw new CustomerRpcCodeException(CustomerRpcCode.NotOrgAdmin,"not org admin");
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.NotOrgAdmin, "not org admin");
|
|
|
}
|
|
|
var org = await _organizationDBService.GetOrganizationDetailAsync(new GetOrganizationDBRequest { OrganizationCode = userDTO.OrganizationCode });
|
|
|
if (org == null || string.IsNullOrWhiteSpace(org.OrganizationCode))
|
|
|
{
|
|
|
- throw new CustomerRpcCodeException(CustomerRpcCode.OrganizationNotExist,"Org does not exist");
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.OrganizationNotExist, "Org does not exist");
|
|
|
}
|
|
|
#endregion
|
|
|
try
|
|
@@ -829,13 +829,13 @@ namespace WingDeviceService.Service
|
|
|
//检查设备编码不为空
|
|
|
if (string.IsNullOrWhiteSpace(request.DeviceCode))
|
|
|
{
|
|
|
- throw new RpcException(1004, "Required parameter:DeviceCode cannot be empty", "Required parameter:DeviceCode cannot be empty");
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.DeviceCodeIsEmpty, "Required parameter:DeviceCode cannot be empty");
|
|
|
}
|
|
|
//查询设备对象
|
|
|
var deviceDb = await _deviceInfoDBServiceProxy.FindDeviceInfoByCodeAsync(request.DeviceCode);
|
|
|
if (deviceDb == null)
|
|
|
{
|
|
|
- throw new CustomerRpcCodeException(CustomerRpcCode.NoExistDevice, "Device does not exist");
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.NoExistDevice, "Device does not exist");
|
|
|
}
|
|
|
var userListResult = await _userServiceProxy.GetUsersByDeviceAsync(request.DeviceCode);
|
|
|
if (userListResult != null && userListResult.Count > 0)
|
|
@@ -856,7 +856,7 @@ namespace WingDeviceService.Service
|
|
|
//检查设备编码不为空
|
|
|
if (string.IsNullOrWhiteSpace(request.DeviceCode))
|
|
|
{
|
|
|
- throw new RpcException(1004, "Required parameter:DeviceCode cannot be empty", "Required parameter:DeviceCode cannot be empty");
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.DeviceCodeIsEmpty, "Required parameter:DeviceCode cannot be empty");
|
|
|
}
|
|
|
return await _diagnosisModuleService.GetDeviceDiagnosisModulesAsync(new GetDeviceDiagnosisModulesDBRequest { DeviceCode = request.DeviceCode });
|
|
|
}
|
|
@@ -873,11 +873,11 @@ namespace WingDeviceService.Service
|
|
|
//检查设备编码不为空
|
|
|
if (string.IsNullOrWhiteSpace(request.DeviceCode))
|
|
|
{
|
|
|
- throw new RpcException(1004, "Required parameter:DeviceCode cannot be empty", "Required parameter:DeviceCode cannot be empty");
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.DeviceCodeIsEmpty, "Required parameter:DeviceCode cannot be empty");
|
|
|
}
|
|
|
if (string.IsNullOrWhiteSpace(request.DiagnosisModule))
|
|
|
{
|
|
|
- throw new RpcException(1004, "Required parameter:DiagnosisModule cannot be empty", "Required parameter:DiagnosisModule cannot be empty");
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.DeviceAIDiagnosisModule, "Required parameter:DeviceCode cannot be empty");
|
|
|
}
|
|
|
var result = await _diagnosisModuleService.UpdateDeviceDiagnosisModuleStateAsync(new UpdateDeviceDiagnosisModuleStateDBRequest
|
|
|
{
|