Quellcode durchsuchen

设备类型多语言

fly vor 2 Jahren
Ursprung
Commit
f012fc5ffd
2 geänderte Dateien mit 9 neuen und 13 gelöschten Zeilen
  1. 5 1
      Service/ConnectService.cs
  2. 4 12
      Service/DeviceService.cs

+ 5 - 1
Service/ConnectService.cs

@@ -65,7 +65,11 @@ namespace WingDeviceService.Service
                 {
                     ThrowCustomerException(CustomerRpcCode.SystemVersionEmpty, "SystemLanguage empty error");
                 }
-
+                var deviceTypeList = await _deviceInfoDBServiceProxy.FindDictionaryItemsAsync(new FindDictionaryItemsDBRequest { DictionaryType = (int)DictionaryTypeEnum.DeviceType });
+                if (!deviceTypeList.Select(x => x.DictionaryCode).Contains(request.DeviceType))
+                {
+                    ThrowCustomerException(CustomerRpcCode.DeviceTypeError, "DeviceType error");
+                }
                 #endregion
 
                 var deviceDto = await _deviceInfoDBServiceProxy.FindDeviceInfoBySerialNumberAsync(request.DeviceUniqueCode);

+ 4 - 12
Service/DeviceService.cs

@@ -176,7 +176,7 @@ namespace WingDeviceService.Service
                 OrganizationCode = deviceDb.OrganizationCode,
                 DepartmentCode = deviceDb.DepartmentCode,
                 ShortCode = deviceDb.ShortCode,
-                DeviceTypeName = deviceTypeModel.Value
+                LanguageConfigs = deviceTypeModel.LanguageConfigs
             };
             return result;
         }
@@ -558,11 +558,7 @@ namespace WingDeviceService.Service
                 var deviceTypeList = await _deviceInfoDBServiceProxy.FindDictionaryItemsAsync(new FindDictionaryItemsDBRequest { DictionaryType = (int)DictionaryTypeEnum.DeviceType });
                 foreach (var c in deviceInfoDOList)
                 {
-                    var deviceTypeName = deviceTypeList.FirstOrDefault(t => t.DictionaryCode == c.DeviceType)?.Value;
-                    if (string.IsNullOrWhiteSpace(deviceTypeName))
-                    {
-                        deviceTypeName = c.DeviceType;
-                    }
+                    var deviceTypeModel = deviceTypeList.FirstOrDefault(t => t.DictionaryCode == c.DeviceType);
                     result.Add(new DeviceExtendInfoDTO
                     {
                         DepartmentName = organizations.PageData.FirstOrDefault(o => o.OrganizationCode == c.DepartmentCode)?.OrganizationName,
@@ -580,7 +576,7 @@ namespace WingDeviceService.Service
                         OrganizationCode = c.OrganizationCode,
                         DepartmentCode = c.DepartmentCode,
                         ShortCode = c.ShortCode,
-                        DeviceTypeName = deviceTypeName
+                        LanguageConfigs = deviceTypeModel?.LanguageConfigs
                     });
                 }
             }
@@ -803,11 +799,7 @@ namespace WingDeviceService.Service
                     var device = dto.MappingTo<DeviceExtendInfoDTO>();
                     device.IsOnline = deviceTokens.FirstOrDefault(x => x.ClientId == dto.DeviceCode)?.IsOnline ?? false;
                     device.DepartmentName = organizations.FirstOrDefault(x => x.OrganizationCode == dto.DepartmentCode)?.OrganizationName;
-                    device.DeviceTypeName = deviceTypeList.FirstOrDefault(t => t.DictionaryCode == device.DeviceType)?.Value;
-                    if (string.IsNullOrWhiteSpace(device.DeviceTypeName))
-                    {
-                        device.DeviceTypeName = device.DeviceType;
-                    }
+                    device.LanguageConfigs = deviceTypeList.FirstOrDefault(t => t.DictionaryCode == device.DeviceType)?.LanguageConfigs;
                     var organization = organizations.FirstOrDefault(x => x.OrganizationCode == dto.OrganizationCode);
                     if (organization != null)
                     {