From 43c8ec3c8271f0d292cca2bae07d50d6588d5607 Mon Sep 17 00:00:00 2001
From: tanglong <842690096@qq.com>
Date: Wed, 8 Apr 2026 16:09:51 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Dto/DeviceSync/DeviceSyncLastGradeDto.cs | 32 +
.../Dto/DeviceSync/DeviceSyncRecordAppDto.cs | 2 +-
.../DeviceSync/DeviceSyncTrainDetailsDto.cs | 4 +-
.../Dto/DeviceSync/DeviceSyncTrainPushDto.cs | 2 +-
.../DeviceSyncYiDongZhanPostDtos.cs | 15 +
YD_YiLu.Commons/Dto/ResponseMsg.cs | 3 -
YD_YiLu.Commons/Dto/WebResponseContent.cs | 6 +-
YD_YiLu.Commons/Enum/CourseType.cs | 94 ++-
YD_YiLu.Commons/Enum/DataSource.cs | 2 +-
YD_YiLu.Commons/Enum/DeviceType.cs | 2 +-
YD_YiLu.Commons/Enum/ResponseType.cs | 2 +-
YD_YiLu.Commons/Enum/SportsTestItemType.cs | 2 +-
YD_YiLu.Commons/Utils/Util.cs | 34 ++
YD_YiLu/Context/SmartSportsContext.cs | 1 +
YD_YiLu/Controllers/DeviceSyncController.cs | 15 +-
YD_YiLu/Services/Impl/DeviceSyncService.cs | 570 ++++++++++++++----
YD_YiLu/Services/Impl/LargeScreenService.cs | 7 +-
YD_YiLu/Services/Impl/XinWeiService.cs | 6 +-
.../Services/Interface/IDeviceSyncService.cs | 5 +
.../SmartSportsEntitys/N_SportsTestValue.cs | 2 +-
20 files changed, 627 insertions(+), 179 deletions(-)
create mode 100644 YD_YiLu.Commons/Dto/DeviceSync/DeviceSyncLastGradeDto.cs
create mode 100644 YD_YiLu.Commons/Dto/DeviceSync/DeviceSyncYiDongZhanPostDtos.cs
diff --git a/YD_YiLu.Commons/Dto/DeviceSync/DeviceSyncLastGradeDto.cs b/YD_YiLu.Commons/Dto/DeviceSync/DeviceSyncLastGradeDto.cs
new file mode 100644
index 0000000..cb7da5a
--- /dev/null
+++ b/YD_YiLu.Commons/Dto/DeviceSync/DeviceSyncLastGradeDto.cs
@@ -0,0 +1,32 @@
+using System.Collections.Generic;
+
+namespace YD_YiLu.Commons.Dto.DeviceSync
+{
+ ///
+ /// 人员上次成绩(批量按人员序列号)
+ ///
+ public class DeviceSyncLastGradeRequestDto
+ {
+ public string DeviceSerial { get; set; }
+ public int DeviceType { get; set; }
+ public List UserSerials { get; set; }
+ }
+
+ public class DeviceSyncLastGradeItemDto
+ {
+ public string UserSerial { get; set; }
+ public int UserId { get; set; }
+ public long TrainId { get; set; }
+ public string Nickname { get; set; }
+ public int OrganizationId { get; set; }
+ public string OrganizationName { get; set; }
+ public int Gender { get; set; }
+ public string FacePictureUrl { get; set; }
+ public string Score { get; set; }
+ public int UnStandardCounts { get; set; }
+ public string StartTime { get; set; }
+ public string EndTime { get; set; }
+ public int CourseId { get; set; }
+ public string CourseName { get; set; }
+ }
+}
diff --git a/YD_YiLu.Commons/Dto/DeviceSync/DeviceSyncRecordAppDto.cs b/YD_YiLu.Commons/Dto/DeviceSync/DeviceSyncRecordAppDto.cs
index 01a1228..a52eab3 100644
--- a/YD_YiLu.Commons/Dto/DeviceSync/DeviceSyncRecordAppDto.cs
+++ b/YD_YiLu.Commons/Dto/DeviceSync/DeviceSyncRecordAppDto.cs
@@ -23,7 +23,7 @@ namespace YD_YiLu.Commons.Dto.DeviceSync
public class DeviceSyncRecordAppItemDto
{
- public int TrainId { get; set; }
+ public long TrainId { get; set; }
public string Nickname { get; set; }
public int OrganizationId { get; set; }
public string OrganizationName { get; set; }
diff --git a/YD_YiLu.Commons/Dto/DeviceSync/DeviceSyncTrainDetailsDto.cs b/YD_YiLu.Commons/Dto/DeviceSync/DeviceSyncTrainDetailsDto.cs
index 4d81800..b16dd05 100644
--- a/YD_YiLu.Commons/Dto/DeviceSync/DeviceSyncTrainDetailsDto.cs
+++ b/YD_YiLu.Commons/Dto/DeviceSync/DeviceSyncTrainDetailsDto.cs
@@ -7,7 +7,7 @@ namespace YD_YiLu.Commons.Dto.DeviceSync
///
public class DeviceSyncTrainDetailsDto
{
- public int TrainId { get; set; }
+ public long TrainId { get; set; }
public string UserSerial { get; set; }
public int UserType { get; set; }
public string Nickname { get; set; }
@@ -33,7 +33,7 @@ namespace YD_YiLu.Commons.Dto.DeviceSync
public class CountListItem
{
- public int TrainId { get; set; }
+ public long TrainId { get; set; }
public string Score { get; set; }
public string Time { get; set; }
}
diff --git a/YD_YiLu.Commons/Dto/DeviceSync/DeviceSyncTrainPushDto.cs b/YD_YiLu.Commons/Dto/DeviceSync/DeviceSyncTrainPushDto.cs
index da23ab9..992e5eb 100644
--- a/YD_YiLu.Commons/Dto/DeviceSync/DeviceSyncTrainPushDto.cs
+++ b/YD_YiLu.Commons/Dto/DeviceSync/DeviceSyncTrainPushDto.cs
@@ -29,7 +29,7 @@ namespace YD_YiLu.Commons.Dto.DeviceSync
///
public class DeviceSyncTrainPushResponseItem
{
- public int TrainId { get; set; }
+ public long TrainId { get; set; }
public string UserSerial { get; set; }
}
}
diff --git a/YD_YiLu.Commons/Dto/DeviceSync/DeviceSyncYiDongZhanPostDtos.cs b/YD_YiLu.Commons/Dto/DeviceSync/DeviceSyncYiDongZhanPostDtos.cs
new file mode 100644
index 0000000..4686bfc
--- /dev/null
+++ b/YD_YiLu.Commons/Dto/DeviceSync/DeviceSyncYiDongZhanPostDtos.cs
@@ -0,0 +1,15 @@
+namespace YD_YiLu.Commons.Dto.DeviceSync
+{
+ /// 壹动站:人员详情 POST 请求体(与 GET /device/sync/user/detail 等价)
+ public class DeviceSyncUserDetailPostDto
+ {
+ public string DeviceSerial { get; set; }
+ public int UserId { get; set; }
+ }
+
+ /// 壹动站:训练详情 POST 请求体(与 GET /device/sync/train/details 等价)
+ public class DeviceSyncTrainDetailPostDto
+ {
+ public int TrainId { get; set; }
+ }
+}
diff --git a/YD_YiLu.Commons/Dto/ResponseMsg.cs b/YD_YiLu.Commons/Dto/ResponseMsg.cs
index f0aab84..77faa94 100644
--- a/YD_YiLu.Commons/Dto/ResponseMsg.cs
+++ b/YD_YiLu.Commons/Dto/ResponseMsg.cs
@@ -1,7 +1,4 @@
-
-using YD_YiLu.Commons.Enum;
-
namespace YD_YiLu.Commons.Dto
{
public static class ResponseMsg
diff --git a/YD_YiLu.Commons/Dto/WebResponseContent.cs b/YD_YiLu.Commons/Dto/WebResponseContent.cs
index a660afa..1cea425 100644
--- a/YD_YiLu.Commons/Dto/WebResponseContent.cs
+++ b/YD_YiLu.Commons/Dto/WebResponseContent.cs
@@ -1,8 +1,4 @@
-
-
-using YD_YiLu.Commons.Enum;
-
-namespace YD_YiLu.Commons.Dto
+namespace YD_YiLu.Commons.Dto
{
public class WebResponseContent
{
diff --git a/YD_YiLu.Commons/Enum/CourseType.cs b/YD_YiLu.Commons/Enum/CourseType.cs
index ddba9a4..207815f 100644
--- a/YD_YiLu.Commons/Enum/CourseType.cs
+++ b/YD_YiLu.Commons/Enum/CourseType.cs
@@ -1,40 +1,84 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace YD_YiLu.Commons.Enum
+namespace YD_YiLu.Commons
{
///
/// 课目类型枚举
///
public enum CourseType
{
- PullUp = 3, // 引体向上
- StandingLongJump = 7, // 立定跳远
- JumpRope = 8, // 跳绳
- JumpingJack = 9, // 开合跳
- HighKnee = 10, // 高抬腿
- Squat = 11, // 深蹲
- SitAndReach = 23, // 坐位体前屈
- SingleLegJump = 24, // 单脚跳
- DynamicHipBridge = 25, // 动态臀桥
- LateralJump = 26, // 左右跳
- WhackAMole = 27, // 打地鼠
- SevenUpEightDown = 28, // 七上八下
- KillMosquito = 29, // 消灭蚊子
- RockPaperScissors = 30, // 石头剪刀布
- FaceChange = 31, // 变脸
- NailHammer = 32, // 打钉子
- BMI = 1001, // 体重系数
- VitalCapacity = 1002, // 肺活量
+ [Description("引体向上")]
+ PullUp = 3,
- // 新增跑步类科目
- Run50m = 12, // 50米跑
- Run100m = 13, // 100米跑
- Run800m = 14, // 800米跑
- Run1000m = 15, // 1000米跑
- Run50mX8 = 20 // 50米x8
+ [Description("立定跳远")]
+ StandingLongJump = 7,
+
+ [Description("跳绳")]
+ JumpRope = 8,
+
+ [Description("开合跳")]
+ JumpingJack = 9,
+
+ [Description("高抬腿")]
+ HighKnee = 10,
+
+ [Description("深蹲")]
+ Squat = 11,
+
+ [Description("坐位体前屈")]
+ SitAndReach = 23,
+
+ [Description("单脚跳")]
+ SingleLegJump = 24,
+
+ [Description("动态臀桥")]
+ DynamicHipBridge = 25,
+
+ [Description("左右跳")]
+ LateralJump = 26,
+
+ [Description("打地鼠")]
+ WhackAMole = 27,
+
+ [Description("七上八下")]
+ SevenUpEightDown = 28,
+
+ [Description("消灭蚊子")]
+ KillMosquito = 29,
+
+ [Description("石头剪刀布")]
+ RockPaperScissors = 30,
+
+ [Description("变脸")]
+ FaceChange = 31,
+
+ [Description("打钉子")]
+ NailHammer = 32,
+
+ [Description("体重系数")]
+ BMI = 1001,
+
+ [Description("肺活量")]
+ VitalCapacity = 1002,
+
+ [Description("50米跑")]
+ Run50m = 12,
+
+ [Description("100米跑")]
+ Run100m = 13,
+
+ [Description("800米跑")]
+ Run800m = 14,
+
+ [Description("1000米跑")]
+ Run1000m = 15,
+
+ [Description("50米x8")]
+ Run50mX8 = 20
}
}
diff --git a/YD_YiLu.Commons/Enum/DataSource.cs b/YD_YiLu.Commons/Enum/DataSource.cs
index 584ae4d..51f91af 100644
--- a/YD_YiLu.Commons/Enum/DataSource.cs
+++ b/YD_YiLu.Commons/Enum/DataSource.cs
@@ -5,7 +5,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace VOL.Entity.Enum
+namespace VOL.Commons
{
///
/// 数据来源
diff --git a/YD_YiLu.Commons/Enum/DeviceType.cs b/YD_YiLu.Commons/Enum/DeviceType.cs
index eb19aee..16a7700 100644
--- a/YD_YiLu.Commons/Enum/DeviceType.cs
+++ b/YD_YiLu.Commons/Enum/DeviceType.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace YD_YiLu.Commons.Enum
+namespace YD_YiLu.Commons
{
///
/// 设备类型枚举
diff --git a/YD_YiLu.Commons/Enum/ResponseType.cs b/YD_YiLu.Commons/Enum/ResponseType.cs
index 9065e10..1b56310 100644
--- a/YD_YiLu.Commons/Enum/ResponseType.cs
+++ b/YD_YiLu.Commons/Enum/ResponseType.cs
@@ -1,6 +1,6 @@
-namespace YD_YiLu.Commons.Enum
+namespace YD_YiLu.Commons
{
public enum ResponseType
{
diff --git a/YD_YiLu.Commons/Enum/SportsTestItemType.cs b/YD_YiLu.Commons/Enum/SportsTestItemType.cs
index e52484e..60fa54a 100644
--- a/YD_YiLu.Commons/Enum/SportsTestItemType.cs
+++ b/YD_YiLu.Commons/Enum/SportsTestItemType.cs
@@ -6,7 +6,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace YD_YiLu.Commons.Enum
+namespace YD_YiLu.Commons
{
///
/// 体测项目
diff --git a/YD_YiLu.Commons/Utils/Util.cs b/YD_YiLu.Commons/Utils/Util.cs
index c692f7d..09142b5 100644
--- a/YD_YiLu.Commons/Utils/Util.cs
+++ b/YD_YiLu.Commons/Utils/Util.cs
@@ -91,6 +91,15 @@ namespace YD_YiLu.Commons.Utils
return (dateTime.ToUniversalTime().Ticks - longTime) / samllTime;
}
+ public static DateTime ParseDateTime(this string time)
+ {
+ if (DateTime.TryParse(time, out var dt))
+ return dt;
+
+ // 👉 如果解析失败,给默认值 or 抛异常(看你业务)
+ return DateTime.Now;
+ }
+
///
/// 时间戳转换成日期
///
@@ -144,5 +153,30 @@ namespace YD_YiLu.Commons.Utils
_ => "低分"
};
}
+
+ public static string GetEnumDescription(object value) where TEnum : struct, IConvertible
+ {
+ if (value == null) return string.Empty;
+
+ try
+ {
+ // 尝试转换为枚举值
+ if (!Enum.TryParse(typeof(TEnum), value.ToString(), out object enumValue))
+ {
+ return value.ToString(); // 转换失败直接返回原值
+ }
+
+ string name = enumValue.ToString();
+ FieldInfo field = typeof(TEnum).GetField(name);
+ if (field == null) return name;
+
+ var attr = field.GetCustomAttribute();
+ return attr?.Description ?? name;
+ }
+ catch
+ {
+ return value.ToString();
+ }
+ }
}
}
diff --git a/YD_YiLu/Context/SmartSportsContext.cs b/YD_YiLu/Context/SmartSportsContext.cs
index cea9ce2..f03947a 100644
--- a/YD_YiLu/Context/SmartSportsContext.cs
+++ b/YD_YiLu/Context/SmartSportsContext.cs
@@ -27,6 +27,7 @@ namespace YD_YiLu.Api.Context
public DbSet XW_ProjectMode { get; set; }
public DbSet XW_TestingProject { get; set; }
public DbSet YL_Device { get; set; }
+ public DbSet YL_Train { get; set; }
public DbSet XW_SportsTestData { get; set; }
public DbSet XW_TrainStudents { get; set; }
public DbSet XW_TrainSetting { get; set; }
diff --git a/YD_YiLu/Controllers/DeviceSyncController.cs b/YD_YiLu/Controllers/DeviceSyncController.cs
index f17ae2d..b6fc3d6 100644
--- a/YD_YiLu/Controllers/DeviceSyncController.cs
+++ b/YD_YiLu/Controllers/DeviceSyncController.cs
@@ -9,7 +9,7 @@ namespace YD_YiLu.Api.Controllers
/// 壹动站/壹体屏/活力课间屏 设备同步 HTTP 接口(小站登录与心跳见 WebSocket:/ws/camera/device)
///
[AllowAnonymous]
- public class DeviceSyncController : ControllerBase
+ public class DeviceSyncController : ControllerBase
{
private readonly IDeviceSyncService _deviceSyncService;
@@ -71,6 +71,19 @@ namespace YD_YiLu.Api.Controllers
return await _deviceSyncService.OrganizationAsync(dto);
}
+
+ ///
+ /// 人员上次成绩(按人员序列号批量)
+ ///
+ [HttpPost]
+ [Route("/device/sync/grade/last_grade")]
+ public async Task
Task> GradeOrderAsync(DeviceSyncGradeOrderRequestDto dto);
+ ///
+ /// 人员上次成绩(按人员序列号批量查询)
+ ///
+ Task> LastGradeAsync(DeviceSyncLastGradeRequestDto dto);
+
///
/// 查询运动记录
///
diff --git a/YD_YiLu/SmartSportsEntitys/N_SportsTestValue.cs b/YD_YiLu/SmartSportsEntitys/N_SportsTestValue.cs
index b7b8712..f040a4e 100644
--- a/YD_YiLu/SmartSportsEntitys/N_SportsTestValue.cs
+++ b/YD_YiLu/SmartSportsEntitys/N_SportsTestValue.cs
@@ -3,7 +3,7 @@ using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
-using VOL.Entity.Enum;
+using VOL.Commons;
using YD_YiLu.Commons.Dto.Open;
namespace YD_YiLu.Api.SmartSportsEntitys