|
@@ -110,14 +110,14 @@ namespace WingDeviceService.Service
|
|
var deviceDb = await _deviceInfoDBServiceProxy.FindDeviceInfoByCodeAsync(deviceCode);
|
|
var deviceDb = await _deviceInfoDBServiceProxy.FindDeviceInfoByCodeAsync(deviceCode);
|
|
if (deviceDb == null)
|
|
if (deviceDb == null)
|
|
{
|
|
{
|
|
- throw new NoExistDeviceException();
|
|
|
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.NoExistDevice, "Device does not exist");
|
|
}
|
|
}
|
|
foreach (var userCode in userCodes)
|
|
foreach (var userCode in userCodes)
|
|
{
|
|
{
|
|
var existUser = await _userServiceProxy.FindUserByCodeAsync(userCode);
|
|
var existUser = await _userServiceProxy.FindUserByCodeAsync(userCode);
|
|
if (existUser == null)
|
|
if (existUser == null)
|
|
{
|
|
{
|
|
- throw new NoExistUserException();
|
|
|
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.UserNotExistError, "User does not exist");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -144,7 +144,7 @@ namespace WingDeviceService.Service
|
|
var deviceDb = await _deviceInfoDBServiceProxy.FindDeviceInfoByCodeAsync(request.DeviceCode);
|
|
var deviceDb = await _deviceInfoDBServiceProxy.FindDeviceInfoByCodeAsync(request.DeviceCode);
|
|
if (deviceDb == null || deviceDb.DeviceCode != request.DeviceCode)
|
|
if (deviceDb == null || deviceDb.DeviceCode != request.DeviceCode)
|
|
{
|
|
{
|
|
- throw new NoExistDeviceException();
|
|
|
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.NoExistDevice, "Device does not exist");
|
|
}
|
|
}
|
|
//根据机构编号查询机构名称
|
|
//根据机构编号查询机构名称
|
|
var organizationName = "";
|
|
var organizationName = "";
|
|
@@ -198,7 +198,7 @@ namespace WingDeviceService.Service
|
|
var deviceDb = await _deviceInfoDBServiceProxy.FindDeviceInfoByShortCodeAsync(request.ShortCode);
|
|
var deviceDb = await _deviceInfoDBServiceProxy.FindDeviceInfoByShortCodeAsync(request.ShortCode);
|
|
if (deviceDb == null || deviceDb.ShortCode != request.ShortCode)
|
|
if (deviceDb == null || deviceDb.ShortCode != request.ShortCode)
|
|
{
|
|
{
|
|
- throw new NoExistDeviceException();
|
|
|
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.NoExistDevice, "Device does not exist");
|
|
}
|
|
}
|
|
return await MapToExtendDTO(deviceDb);
|
|
return await MapToExtendDTO(deviceDb);
|
|
}
|
|
}
|
|
@@ -227,7 +227,7 @@ namespace WingDeviceService.Service
|
|
var deviceDb = await _deviceInfoDBServiceProxy.FindDeviceInfoByCodeAsync(deviceCode);
|
|
var deviceDb = await _deviceInfoDBServiceProxy.FindDeviceInfoByCodeAsync(deviceCode);
|
|
if (deviceDb == null)
|
|
if (deviceDb == null)
|
|
{
|
|
{
|
|
- throw new NoExistDeviceException();
|
|
|
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.NoExistDevice, "Device does not exist");
|
|
}
|
|
}
|
|
var updateUsers = new List<TableDataItem<UserPasswordDTO>>();
|
|
var updateUsers = new List<TableDataItem<UserPasswordDTO>>();
|
|
foreach (var userCode in userCodes)
|
|
foreach (var userCode in userCodes)
|
|
@@ -323,12 +323,12 @@ namespace WingDeviceService.Service
|
|
var userInfoDO = await _userServiceProxy.FindUserByCodeAsync(userCode);
|
|
var userInfoDO = await _userServiceProxy.FindUserByCodeAsync(userCode);
|
|
if (userInfoDO == null)
|
|
if (userInfoDO == null)
|
|
{
|
|
{
|
|
- throw new NoExistUserException();
|
|
|
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.UserNotExistError, "User does not exist");
|
|
}
|
|
}
|
|
//查询用户的医院是否存在
|
|
//查询用户的医院是否存在
|
|
if (string.IsNullOrWhiteSpace(userInfoDO.OrganizationCode))
|
|
if (string.IsNullOrWhiteSpace(userInfoDO.OrganizationCode))
|
|
{
|
|
{
|
|
- throw new NoExistOrgException();
|
|
|
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.OrganizationNotExist, "Org does not exist");
|
|
}
|
|
}
|
|
var deviceInfoDOList = new List<DeviceInfoDTO>();
|
|
var deviceInfoDOList = new List<DeviceInfoDTO>();
|
|
if (!userInfoDO.IsDirector)
|
|
if (!userInfoDO.IsDirector)
|
|
@@ -390,7 +390,7 @@ namespace WingDeviceService.Service
|
|
var userInfoDO = await _userServiceProxy.FindUserByCodeAsync(userCode);
|
|
var userInfoDO = await _userServiceProxy.FindUserByCodeAsync(userCode);
|
|
if (userInfoDO == null)
|
|
if (userInfoDO == null)
|
|
{
|
|
{
|
|
- throw new NoExistUserException();
|
|
|
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.UserNotExistError, "User does not exist");
|
|
}
|
|
}
|
|
var deviceDb = await _deviceInfoDBServiceProxy.FindDeviceInfoByShortCodeAsync(request.ShortCode);
|
|
var deviceDb = await _deviceInfoDBServiceProxy.FindDeviceInfoByShortCodeAsync(request.ShortCode);
|
|
if (deviceDb == null)
|
|
if (deviceDb == null)
|
|
@@ -399,8 +399,7 @@ namespace WingDeviceService.Service
|
|
}
|
|
}
|
|
if (userInfoDO.BindDevices != null && userInfoDO.BindDevices.Contains(deviceDb.DeviceCode))
|
|
if (userInfoDO.BindDevices != null && userInfoDO.BindDevices.Contains(deviceDb.DeviceCode))
|
|
{
|
|
{
|
|
-
|
|
|
|
- throw new HasAddDeviceException();
|
|
|
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.HasAddedDevice,"The device has been Added");
|
|
}
|
|
}
|
|
try
|
|
try
|
|
{
|
|
{
|
|
@@ -617,13 +616,13 @@ namespace WingDeviceService.Service
|
|
var userInfoDO = await _userServiceProxy.FindUserByCodeAsync(userCode);
|
|
var userInfoDO = await _userServiceProxy.FindUserByCodeAsync(userCode);
|
|
if (userInfoDO == null)
|
|
if (userInfoDO == null)
|
|
{
|
|
{
|
|
- throw new NoExistUserException();
|
|
|
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.UserNotExistError, "User does not exist");
|
|
}
|
|
}
|
|
var result = new List<SelectItemDTO>();
|
|
var result = new List<SelectItemDTO>();
|
|
//查询用户的医院是否存在
|
|
//查询用户的医院是否存在
|
|
if (string.IsNullOrEmpty(userInfoDO.OrganizationCode))
|
|
if (string.IsNullOrEmpty(userInfoDO.OrganizationCode))
|
|
{
|
|
{
|
|
- throw new NoExistOrgException();
|
|
|
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.OrganizationNotExist, "Org does not exist");
|
|
}
|
|
}
|
|
//查询用户绑定的设备
|
|
//查询用户绑定的设备
|
|
if (userInfoDO.BindDevices == null || userInfoDO.BindDevices.Count <= 0)
|
|
if (userInfoDO.BindDevices == null || userInfoDO.BindDevices.Count <= 0)
|
|
@@ -653,7 +652,7 @@ namespace WingDeviceService.Service
|
|
var deviceInfo = await _deviceInfoDBServiceProxy.FindDeviceInfoByCodeAsync(deviceCode);
|
|
var deviceInfo = await _deviceInfoDBServiceProxy.FindDeviceInfoByCodeAsync(deviceCode);
|
|
if (deviceInfo == null || string.IsNullOrWhiteSpace(deviceInfo.DeviceCode))
|
|
if (deviceInfo == null || string.IsNullOrWhiteSpace(deviceInfo.DeviceCode))
|
|
{
|
|
{
|
|
- throw new NoExistDeviceException();
|
|
|
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.NoExistDevice, "Device does not exist");
|
|
}
|
|
}
|
|
var org = new OrganizationDTO();
|
|
var org = new OrganizationDTO();
|
|
if (!string.IsNullOrWhiteSpace(deviceInfo.OrganizationCode))
|
|
if (!string.IsNullOrWhiteSpace(deviceInfo.OrganizationCode))
|
|
@@ -684,32 +683,32 @@ namespace WingDeviceService.Service
|
|
var userCode = await ValidateTokenAsync(request.Token);
|
|
var userCode = await ValidateTokenAsync(request.Token);
|
|
if (string.IsNullOrEmpty(shortCode))
|
|
if (string.IsNullOrEmpty(shortCode))
|
|
{
|
|
{
|
|
- throw new CustomerRpcCodeException(CustomerRpcCode.UniqueCodeIsEmpty);
|
|
|
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.UniqueCodeIsEmpty,"UniqueCode is empty");
|
|
}
|
|
}
|
|
var device = await _deviceInfoDBServiceProxy.FindDeviceInfoByShortCodeAsync(shortCode);
|
|
var device = await _deviceInfoDBServiceProxy.FindDeviceInfoByShortCodeAsync(shortCode);
|
|
if (device == null)
|
|
if (device == null)
|
|
{
|
|
{
|
|
- throw new NoExistDeviceException();
|
|
|
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.NoExistDevice, "Device does not exist");
|
|
}
|
|
}
|
|
var oldOrg = await _organizationDBService.GetOrganizationDetailAsync(new GetOrganizationDBRequest { OrganizationCode = device.OrganizationCode });
|
|
var oldOrg = await _organizationDBService.GetOrganizationDetailAsync(new GetOrganizationDBRequest { OrganizationCode = device.OrganizationCode });
|
|
if (oldOrg == null || string.IsNullOrWhiteSpace(oldOrg.OrganizationCode))
|
|
if (oldOrg == null || string.IsNullOrWhiteSpace(oldOrg.OrganizationCode))
|
|
{
|
|
{
|
|
- throw new CustomerRpcCodeException(CustomerRpcCode.OrganizationNotExist);
|
|
|
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.OrganizationNotExist,"Org does not exist");
|
|
}
|
|
}
|
|
//用户
|
|
//用户
|
|
var userDTO = await _userServiceProxy.FindUserByCodeAsync(userCode);
|
|
var userDTO = await _userServiceProxy.FindUserByCodeAsync(userCode);
|
|
if (userDTO == null)
|
|
if (userDTO == null)
|
|
{
|
|
{
|
|
- throw new CustomerRpcCodeException(CustomerRpcCode.UserNotExistError);
|
|
|
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.UserNotExistError, "User does not exist");
|
|
}
|
|
}
|
|
if (!userDTO.IsDirector)
|
|
if (!userDTO.IsDirector)
|
|
{
|
|
{
|
|
- throw new CustomerRpcCodeException(CustomerRpcCode.NotOrgAdmin);
|
|
|
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.NotOrgAdmin,"not org admin");
|
|
}
|
|
}
|
|
var org = await _organizationDBService.GetOrganizationDetailAsync(new GetOrganizationDBRequest { OrganizationCode = userDTO.OrganizationCode });
|
|
var org = await _organizationDBService.GetOrganizationDetailAsync(new GetOrganizationDBRequest { OrganizationCode = userDTO.OrganizationCode });
|
|
if (org == null || string.IsNullOrWhiteSpace(org.OrganizationCode))
|
|
if (org == null || string.IsNullOrWhiteSpace(org.OrganizationCode))
|
|
{
|
|
{
|
|
- throw new CustomerRpcCodeException(CustomerRpcCode.OrganizationNotExist);
|
|
|
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.OrganizationNotExist,"Org does not exist");
|
|
}
|
|
}
|
|
#endregion
|
|
#endregion
|
|
try
|
|
try
|
|
@@ -843,7 +842,7 @@ namespace WingDeviceService.Service
|
|
var deviceDb = await _deviceInfoDBServiceProxy.FindDeviceInfoByCodeAsync(request.DeviceCode);
|
|
var deviceDb = await _deviceInfoDBServiceProxy.FindDeviceInfoByCodeAsync(request.DeviceCode);
|
|
if (deviceDb == null)
|
|
if (deviceDb == null)
|
|
{
|
|
{
|
|
- throw new NoExistDeviceException();
|
|
|
|
|
|
+ throw new CustomerRpcCodeException(CustomerRpcCode.NoExistDevice, "Device does not exist");
|
|
}
|
|
}
|
|
var userListResult = await _userServiceProxy.GetUsersByDeviceAsync(request.DeviceCode);
|
|
var userListResult = await _userServiceProxy.GetUsersByDeviceAsync(request.DeviceCode);
|
|
if (userListResult != null && userListResult.Count > 0)
|
|
if (userListResult != null && userListResult.Count > 0)
|