WordDocumentModels.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. using System.Text.Json.Serialization;
  2. namespace OASystem.API.OAMethodLib.FileProcessing
  3. {
  4. public class WordDocumentModels
  5. {
  6. }
  7. /// <summary>
  8. /// Word文档信息模型
  9. /// </summary>
  10. public class WordDocumentInfo
  11. {
  12. [JsonPropertyName("title")]
  13. public string Title { get; set; } = string.Empty;
  14. [JsonPropertyName("content")]
  15. public string Content { get; set; } = string.Empty;
  16. [JsonPropertyName("metadata")]
  17. public DocumentMetadata Metadata { get; set; } = new DocumentMetadata();
  18. [JsonPropertyName("tables")]
  19. public List<DocumentTable> Tables { get; set; } = new List<DocumentTable>();
  20. [JsonPropertyName("formFields")]
  21. public List<FormField> FormFields { get; set; } = new List<FormField>();
  22. [JsonPropertyName("sections")]
  23. public List<DocumentSection> Sections { get; set; } = new List<DocumentSection>();
  24. [JsonPropertyName("imagesCount")]
  25. public int ImagesCount { get; set; }
  26. [JsonPropertyName("processingTimeMs")]
  27. public long ProcessingTimeMs { get; set; }
  28. }
  29. /// <summary>
  30. /// 文档元数据
  31. /// </summary>
  32. public class DocumentMetadata
  33. {
  34. [JsonPropertyName("author")]
  35. public string Author { get; set; } = string.Empty;
  36. [JsonPropertyName("company")]
  37. public string Company { get; set; } = string.Empty;
  38. [JsonPropertyName("createdTime")]
  39. public DateTime? CreatedTime { get; set; }
  40. [JsonPropertyName("lastSavedTime")]
  41. public DateTime? LastSavedTime { get; set; }
  42. [JsonPropertyName("pageCount")]
  43. public int PageCount { get; set; }
  44. [JsonPropertyName("wordCount")]
  45. public int WordCount { get; set; }
  46. [JsonPropertyName("characterCount")]
  47. public int CharacterCount { get; set; }
  48. [JsonPropertyName("subject")]
  49. public string Subject { get; set; } = string.Empty;
  50. [JsonPropertyName("keywords")]
  51. public string Keywords { get; set; } = string.Empty;
  52. }
  53. /// <summary>
  54. /// 文档表格
  55. /// </summary>
  56. public class DocumentTable
  57. {
  58. [JsonPropertyName("tableName")]
  59. public string TableName { get; set; } = string.Empty;
  60. [JsonPropertyName("rows")]
  61. public List<List<string>> Rows { get; set; } = new List<List<string>>();
  62. [JsonPropertyName("headers")]
  63. public List<string> Headers { get; set; } = new List<string>();
  64. }
  65. /// <summary>
  66. /// 表单字段
  67. /// </summary>
  68. public class FormField
  69. {
  70. [JsonPropertyName("name")]
  71. public string Name { get; set; } = string.Empty;
  72. [JsonPropertyName("type")]
  73. public string Type { get; set; } = string.Empty;
  74. [JsonPropertyName("value")]
  75. public string Value { get; set; } = string.Empty;
  76. [JsonPropertyName("isChecked")]
  77. public bool IsChecked { get; set; }
  78. }
  79. /// <summary>
  80. /// 文档章节
  81. /// </summary>
  82. public class DocumentSection
  83. {
  84. [JsonPropertyName("sectionNumber")]
  85. public int SectionNumber { get; set; }
  86. [JsonPropertyName("content")]
  87. public string Content { get; set; } = string.Empty;
  88. [JsonPropertyName("paragraphsCount")]
  89. public int ParagraphsCount { get; set; }
  90. [JsonPropertyName("tablesCount")]
  91. public int TablesCount { get; set; }
  92. }
  93. /// <summary>
  94. /// 处理结果
  95. /// </summary>
  96. public class ProcessingResult
  97. {
  98. [JsonPropertyName("success")]
  99. public bool Success { get; set; }
  100. [JsonPropertyName("data")]
  101. public WordDocumentInfo? Data { get; set; }
  102. [JsonPropertyName("errorMessage")]
  103. public string? ErrorMessage { get; set; }
  104. [JsonPropertyName("fileSize")]
  105. public long FileSize { get; set; }
  106. [JsonPropertyName("fileType")]
  107. public string FileType { get; set; } = string.Empty;
  108. }
  109. }