using Newtonsoft.Json; namespace YD_Event.Application.CitizenSports.Dtos; /// /// 市民运动会报名同步请求。 /// public class CitizenSportsSyncInput { /// /// 跃动系统赛事 ID。 /// [Required] public long EventId { get; set; } /// /// 市民运动会平台中的赛事名称,必须与一网通办申报名称一致。 /// [Required] public string PlatformEventName { get; set; } = string.Empty; /// /// 系列赛场次名称,没有时不传。 /// public string? SeriesName { get; set; } } /// /// 市民运动会报名执行同步请求。 /// public class CitizenSportsExecuteInput : CitizenSportsSyncInput { /// /// 必须明确确认后才允许向外部平台写入。 /// public bool ConfirmUpload { get; set; } } /// /// 同步预览结果,包含实际待上传的运动员明细。 /// public class CitizenSportsPreviewOutput { public long EventId { get; set; } public string EventName { get; set; } = string.Empty; public string PlatformEventName { get; set; } = string.Empty; public int RegistrationCount { get; set; } public int UploadRecordCount { get; set; } public int TypeCount { get; set; } public bool CanUpload => Errors.Count == 0 && UploadRecordCount > 0; public List Types { get; set; } = []; public List Players { get; set; } = []; public List Errors { get; set; } = []; } public class CitizenSportsTypePreview { public string TypeName { get; set; } = string.Empty; public int PlayerCount { get; set; } } /// /// 实际发送给市民运动会平台的运动员数据。 /// public class CitizenSportsPlayerPreview { public string TypeName { get; set; } = string.Empty; public string PlayerId { get; set; } = string.Empty; public string CardNumber { get; set; } = string.Empty; public string CardType { get; set; } = string.Empty; public string PlayerName { get; set; } = string.Empty; public string? PlayerSex { get; set; } public string? PlayerPhone { get; set; } public string? PlayerBirth { get; set; } public string? GroupName { get; set; } } public class CitizenSportsValidationError { public long RegistrationPersonId { get; set; } public string Message { get; set; } = string.Empty; } public class CitizenSportsConnectionTestOutput { public bool Success { get; set; } public string Message { get; set; } = string.Empty; public long? PlatformTime { get; set; } } public class CitizenSportsExecuteOutput { public string PlatformEventCode { get; set; } = string.Empty; public int RequestedCount { get; set; } public int SuccessCount { get; set; } public int FailureCount { get; set; } public int UnattemptedCount { get; set; } public bool Aborted { get; set; } public List Batches { get; set; } = []; } public class CitizenSportsBatchResult { public string TypeName { get; set; } = string.Empty; public int RequestedCount { get; set; } public int SuccessCount { get; set; } public int FailureCount { get; set; } public bool Success { get; set; } public string Message { get; set; } = string.Empty; } internal sealed class CitizenSportsGetCodeRequest { [JsonProperty("mname")] public string EventName { get; set; } = string.Empty; [JsonProperty("sname", NullValueHandling = NullValueHandling.Ignore)] public string? SeriesName { get; set; } } internal sealed class CitizenSportsUploadRequest { [JsonProperty("mcode")] public string EventCode { get; set; } = string.Empty; [JsonProperty("typename")] public string TypeName { get; set; } = string.Empty; [JsonProperty("players")] public List Players { get; set; } = []; } internal sealed class CitizenSportsPlayer { [JsonProperty("playerId")] public string PlayerId { get; set; } = string.Empty; [JsonProperty("CardNumber")] public string CardNumber { get; set; } = string.Empty; [JsonProperty("CardType")] public string CardType { get; set; } = string.Empty; [JsonProperty("playerName")] public string PlayerName { get; set; } = string.Empty; [JsonProperty("playerSex", NullValueHandling = NullValueHandling.Ignore)] public string? PlayerSex { get; set; } [JsonProperty("playerPhone", NullValueHandling = NullValueHandling.Ignore)] public string? PlayerPhone { get; set; } [JsonProperty("playerBirth", NullValueHandling = NullValueHandling.Ignore)] public string? PlayerBirth { get; set; } [JsonProperty("groupName", NullValueHandling = NullValueHandling.Ignore)] public string? GroupName { get; set; } [JsonProperty("deleteStatus")] public int DeleteStatus { get; set; } = 1; } internal sealed class CitizenSportsPlatformResponse { [JsonProperty("code")] public string? Code { get; set; } [JsonProperty("status")] public string? Status { get; set; } [JsonProperty("message")] public string? Message { get; set; } [JsonProperty("msg")] public string? Msg { get; set; } [JsonProperty("data")] public T? Data { get; set; } [JsonProperty("sys_time")] public long? SystemTime { get; set; } [JsonIgnore] public bool IsSuccess => Code == "200" && string.Equals(Status, "success", StringComparison.OrdinalIgnoreCase); [JsonIgnore] public string EffectiveMessage => Message ?? Msg ?? "平台未返回说明"; } internal sealed class CitizenSportsTestData { [JsonProperty("Test")] public string? Test { get; set; } } internal sealed class CitizenSportsEventCodeData { [JsonProperty("mcode")] public string? EventCode { get; set; } [JsonProperty("mname")] public string? EventName { get; set; } } internal sealed class CitizenSportsUploadData { [JsonProperty("num")] public int SuccessCount { get; set; } [JsonProperty("errnum")] public int FailureCount { get; set; } }