This commit is contained in:
tanglong 2026-07-17 16:24:06 +08:00
parent a8926683df
commit 3559a3ae7f
2 changed files with 15 additions and 5 deletions

View File

@ -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; }

View File

@ -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;