diff --git a/YD_YiLu.Commons/Dto/DeviceSync/DeviceSyncGradeOrderDto.cs b/YD_YiLu.Commons/Dto/DeviceSync/DeviceSyncGradeOrderDto.cs index 2d5cf1b..39d05d7 100644 --- a/YD_YiLu.Commons/Dto/DeviceSync/DeviceSyncGradeOrderDto.cs +++ b/YD_YiLu.Commons/Dto/DeviceSync/DeviceSyncGradeOrderDto.cs @@ -33,6 +33,7 @@ namespace YD_YiLu.Commons.Dto.DeviceSync public int UserId { get; set; } public string Nickname { get; set; } public int OrganizationId { get; set; } + public string GradeName { get; set; } public string OrganizationName { get; set; } public int Gender { get; set; } public string Score { get; set; } @@ -65,6 +66,7 @@ namespace YD_YiLu.Commons.Dto.DeviceSync public string UserSerial { get; set; } public string Nickname { get; set; } public int OrganizationId { get; set; } + public string GradeName { get; set; } public string OrganizationName { get; set; } public int Gender { get; set; } public string Score { get; set; } diff --git a/YD_YiLu/Services/Impl/DeviceSyncService.cs b/YD_YiLu/Services/Impl/DeviceSyncService.cs index 86d15f1..72886f9 100644 --- a/YD_YiLu/Services/Impl/DeviceSyncService.cs +++ b/YD_YiLu/Services/Impl/DeviceSyncService.cs @@ -570,8 +570,11 @@ namespace YD_YiLu.Api.Services.Impl UserId = x.Key.Id, Nickname = x.Key.StudentName, OrganizationId = x.Key.ClassId ?? 0, + GradeName = classMap.TryGetValue(x.Key.ClassId ?? 0, out var gradeClassInfo) + ? gradeClassInfo.GradeName ?? "" + : "", OrganizationName = classMap.TryGetValue(x.Key.ClassId ?? 0, out var classInfo) - ? $"{classInfo.GradeName ?? ""}{classInfo.ClassName ?? ""}" + ? classInfo.ClassName ?? "" : x.Key.ClassName ?? "", Gender = x.Key.Sex, Score = Math.Round(x.Score).ToString("0"), @@ -1125,7 +1128,7 @@ namespace YD_YiLu.Api.Services.Impl new YtpGradeListItem { Time = GetYtpSummaryTime(dto.DateType), - Duration = SecondsToWholeHours(0), + Duration = SecondsToIntegerHours(0), Count = "0" } }; @@ -1138,7 +1141,7 @@ namespace YD_YiLu.Api.Services.Impl .Select(day => new YtpGradeListItem { Time = day.ToString("MM-dd"), - Duration = SecondsToWholeHours(0), + Duration = SecondsToIntegerHours(0), Count = "0" }) .ToList(); @@ -1158,7 +1161,7 @@ namespace YD_YiLu.Api.Services.Impl new YtpGradeListItem { Time = GetYtpSummaryTime(dto.DateType), - Duration = SecondsToWholeHours(totalSeconds), + Duration = SecondsToIntegerHours(totalSeconds), Count = trains.Count.ToString() } }; @@ -1176,7 +1179,7 @@ namespace YD_YiLu.Api.Services.Impl return new YtpGradeListItem { Time = day.ToString("MM-dd"), - Duration = SecondsToWholeHours(daySeconds), + Duration = SecondsToIntegerHours(daySeconds), Count = dayTrains.Count.ToString() }; }) @@ -1449,6 +1452,11 @@ namespace YD_YiLu.Api.Services.Impl return Math.Ceiling(seconds / 3600.0).ToString("0"); } + private static string SecondsToIntegerHours(int seconds) + { + return ((int)(seconds / 3600.0)).ToString(); + } + private static bool IsYtpSummaryDateType(int dateType) { return dateType >= 0 && dateType <= 9;