mock_data_service.dart 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. import 'package:flutter/material.dart';
  2. import '../models/document.dart';
  3. import '../models/element.dart';
  4. import '../models/annotation.dart';
  5. import '../models/graph.dart';
  6. /// 模拟数据服务
  7. class MockDataService {
  8. // 模拟文档数据
  9. static List<Document> getMockDocuments() {
  10. return [
  11. Document(
  12. id: '1',
  13. name: '智能票据处理系统-项目计划书.pdf',
  14. type: DocumentType.pdf,
  15. status: DocumentStatus.completed,
  16. createdAt: DateTime.now().subtract(const Duration(days: 1)),
  17. updatedAt: DateTime.now().subtract(const Duration(hours: 2)),
  18. fileSize: 2048000,
  19. parsedText: _getMockParsedText(),
  20. ),
  21. Document(
  22. id: '2',
  23. name: '投资分析报告.docx',
  24. type: DocumentType.word,
  25. status: DocumentStatus.processing,
  26. createdAt: DateTime.now().subtract(const Duration(hours: 5)),
  27. fileSize: 1536000,
  28. ),
  29. Document(
  30. id: '3',
  31. name: '合同扫描件.jpg',
  32. type: DocumentType.image,
  33. status: DocumentStatus.parsing,
  34. createdAt: DateTime.now().subtract(const Duration(hours: 1)),
  35. fileSize: 1024000,
  36. ),
  37. ];
  38. }
  39. // 模拟解析后的文本
  40. static String _getMockParsedText() {
  41. return '''一、项目概述
  42. 本项目由腾讯科技有限公司(以下简称"腾讯")投资建设,旨在打造一套面向大型企业财务共享中心的"智能票据处理系统"。系统通过OCR识别、版面理解、要素抽取与人机协同核验,提升发票、合同、报销单据等票据类文档的处理效率与准确率。
  43. 二、投资与资金安排
  44. 项目总投资金额为人民币3,700万元,其中已支付1,000万元用于样机研制、数据治理与前期试点。剩余资金将依据阶段性里程碑进行分批拨付,涵盖核心算法优化、系统平台化改造、以及与客户生态的对接集成。
  45. 三、技术与产品路线
  46. 系统采用多模态文档理解技术,将版面结构、语义上下文与业务词典结合,实现对复杂票据的鲁棒解析。产品形态包含:上传解析端、人工牵引标注端、规则与关系构建端,以及结果交付端。
  47. 四、收益预期
  48. 预计上线后,票据处理效率提升60%以上,人工核验工作量下降40%,并显著降低AI"幻觉"导致的错判风险,从而提升财务数据的可靠性与可审计性。''';
  49. }
  50. // 模拟要素数据
  51. static List<DocumentElement> getMockElements() {
  52. return [
  53. DocumentElement(
  54. id: 'e1',
  55. type: ElementType.company,
  56. label: '公司',
  57. value: '腾讯科技有限公司',
  58. documentId: '1',
  59. ),
  60. DocumentElement(
  61. id: 'e2',
  62. type: ElementType.amount,
  63. label: '总投资',
  64. value: '3700万',
  65. documentId: '1',
  66. ),
  67. DocumentElement(
  68. id: 'e3',
  69. type: ElementType.amount,
  70. label: '已支付',
  71. value: '1000万',
  72. documentId: '1',
  73. ),
  74. DocumentElement(
  75. id: 'e4',
  76. type: ElementType.amount,
  77. label: '剩余投资',
  78. value: '2700万',
  79. documentId: '1',
  80. ),
  81. ];
  82. }
  83. // 模拟批注数据
  84. static List<Annotation> getMockAnnotations() {
  85. return [
  86. Annotation(
  87. id: 'a1',
  88. text: '腾讯科技有限公司',
  89. start: const Offset(0, 0),
  90. end: const Offset(100, 20),
  91. type: AnnotationType.highlight,
  92. documentId: '1',
  93. createdAt: DateTime.now(),
  94. ),
  95. Annotation(
  96. id: 'a2',
  97. text: '3700万元',
  98. start: const Offset(0, 50),
  99. end: const Offset(80, 70),
  100. type: AnnotationType.highlight,
  101. documentId: '1',
  102. createdAt: DateTime.now(),
  103. ),
  104. ];
  105. }
  106. // 模拟关系网络数据
  107. static List<GraphNode> getMockGraphNodes() {
  108. return [
  109. GraphNode(
  110. id: 'n1',
  111. label: '总投资: 3700万',
  112. type: NodeType.element,
  113. position: const Offset(100, 100),
  114. ),
  115. GraphNode(
  116. id: 'n2',
  117. label: '已支付: 1000万',
  118. type: NodeType.element,
  119. position: const Offset(100, 200),
  120. ),
  121. GraphNode(
  122. id: 'n3',
  123. label: '减去',
  124. type: NodeType.operator,
  125. position: const Offset(300, 150),
  126. ),
  127. GraphNode(
  128. id: 'n4',
  129. label: '剩余投资: 2700万',
  130. type: NodeType.result,
  131. position: const Offset(500, 150),
  132. ),
  133. ];
  134. }
  135. static List<GraphEdge> getMockGraphEdges() {
  136. return [
  137. GraphEdge(id: 'e1', source: 'n1', target: 'n3', type: EdgeType.calculate),
  138. GraphEdge(id: 'e2', source: 'n2', target: 'n3', type: EdgeType.calculate),
  139. GraphEdge(id: 'e3', source: 'n3', target: 'n4', type: EdgeType.calculate),
  140. ];
  141. }
  142. // 模拟Prompt
  143. static String getMockPrompt() {
  144. return '''原文参考:"项目由腾讯投资,总投资金额为3700万元。根据进度,目前已支付1000万元。"
  145. 要求:请根据上述原文,计算项目剩余投资金额。''';
  146. }
  147. // 模拟AI回复
  148. static String getMockAIResponse() {
  149. return '''根据您提供的信息,项目剩余投资金额为:
  150. 3700万 - 1000万 = 2700万元
  151. 计算过程:
  152. - 总投资金额:3700万元
  153. - 已支付金额:1000万元
  154. - 剩余投资金额 = 总投资金额 - 已支付金额 = 3700 - 1000 = 2700万元''';
  155. }
  156. }