Document template import processing method, system, equipment and medium

By constructing a template import processing mechanism that includes multi-environment comparison, chain loading, secure conversion, and state synchronization, the problems of version confusion, security risks, and information loss during the document template import process are solved, achieving efficient, reliable, and secure template import.

CN121936441AActive Publication Date: 2026-04-28SHANGHAI YUNCHI INFORMATION TECHNOLOGY CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHANGHAI YUNCHI INFORMATION TECHNOLOGY CO LTD
Filing Date
2026-03-31
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

Existing document template import technology lacks a multi-environment comparison mechanism, which poses security risks. The import process is insecure and source information is lost, leading to version confusion and system instability.

Method used

A template import processing mechanism integrating multi-environment comparison, chained loading, secure conversion, and state synchronization is constructed. It generates difference comparison results by acquiring template content in parallel, securely converts template syntax on the front end, and stores the import source in the state manager to ensure data integrity and security.

Benefits of technology

It improves import accuracy, enhances system security, optimizes user experience, ensures template data is legal and renders completely, and improves system reliability and stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121936441A_ABST
    Figure CN121936441A_ABST
Patent Text Reader

Abstract

The invention discloses a document template import processing method and system, electronic equipment and a storage medium, and relates to the technical field of document platforms. The method comprises the steps that paging search and condition screening are provided on a template list interface, in response to selection operation of a user on a target template, template contents in a test environment and a Git warehouse are acquired in parallel, and a difference comparison result is generated and displayed through a modal popup window; in response to an import confirmation instruction of a user, calling a back-end chained loading interface to import the template data into an editor; the specific grammar in the template is converted into an HTML annotation format at the front end; and the template information and the import source are stored in a front-end state manager, and an editor is triggered to initialize rendering. Through multi-environment comparison, security conversion and state synchronization, the technical problems of version chaos, poor security and source information loss in the existing document template importing process are solved, and the template importing accuracy, security and user experience are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of document platform technology, and in particular to a document template import and processing method, system, device and medium. Background Technology

[0002] With the development of internet technology, visual template designers are widely used in document platforms (such as billing systems), allowing users to easily import document templates (such as HTML templates) into editors for editing. However, existing template import technologies have the following main drawbacks: First, there is a lack of multi-environment comparison mechanism: the template may exist in multiple locations such as the test environment and the Git repository (pre-production environment). When users import it, they cannot intuitively understand the differences in content under different environments, which can easily lead to the import of the wrong version and cause version confusion.

[0003] Secondly, there are security risks: the template may contain malicious scripts or variable placeholders, and direct import and rendering may lead to parsing errors, lacking effective security measures.

[0004] Third, source information is lost: the source environment information of the template is not recorded after import, and the save path cannot be accurately determined when saving later, which can easily cause file overwriting errors.

[0005] The aforementioned problems are intertwined, resulting in an unreliable, insecure, and unintelligent template import process. There is an urgent need for a template import processing method that can systematically solve these problems. Summary of the Invention

[0006] The present invention aims to construct a template import processing mechanism that integrates multi-environment comparison, chain loading, secure conversion, and state synchronization. Through this mechanism, synergistic effects can be achieved, and the above-mentioned technical problems can be systematically solved.

[0007] To achieve the above objectives, the present invention adopts the following technical solution: This invention provides a method for importing and processing document templates, including: The template list interface provides paginated search and conditional filtering functions. In response to the user's selection of a target template, it retrieves template content from the test environment and Git repository in parallel to generate difference comparison results, which are displayed through a modal pop-up. The difference comparison results may include one or more of the following metadata information: template ID, template name, modification time, content difference marker, template file size, last modification time, and whether the file exists. In response to the user's confirmation import command, the backend chain loading interface is called to import the template data into the editor; On the front end, specific syntax in the template is converted into HTML comment format; The template information and import source are stored in the front-end state manager, and the editor is triggered to initialize rendering.

[0008] Preferably, the template content in the test environment and Git repository is obtained in parallel, including: if the template file does not exist in the test environment, a template upload entry is provided to support users to upload HTML format template files; And / or, parallel retrieval uses an asynchronous request mechanism. When any environment retrieval fails, a pop-up window will display the reason for the failure, allowing the user to retry or ignore the environment.

[0009] Preferably, the template upload entry includes a file type verification interface for uploading template files with the .html extension, and prompts the user that only .html format template files are supported; And / or, the template upload entry includes at least one of the following operation areas: file selector, drag-and-drop upload area, and format prompt information.

[0010] Preferably, the modal pop-up supports presenting the difference comparison results in the form of highlighted inline differences, and supports users to confirm whether each item is covered; And / or, the chain loading interface performs multi-level validation on the template data before calling it. The multi-level validation includes: syntax validation and resource reference validation. If the validation fails, the import is interrupted and an error is prompted. If there are illegal tags or scripts, they are filtered or intercepted. And / or, convert specific syntax in the template into HTML comment format, including: identifying specific syntax in the template and replacing it with HTML comment format, while preserving the original content for subsequent recovery, wherein the specific syntax includes variable placeholders and script tags; And / or, the template import source includes the test environment and the Git repository (pre-production environment), where the source information is stored together with the template data and used to determine the target path when saving later.

[0011] Preferably, an import log is automatically recorded after the import is completed. The import log includes one or more of the following information: operator, time, template source, and template version number. And / or, the method further includes: if a network interruption or interface abnormality occurs during the import process, automatically roll back to the state before import and clear the stored temporary data; And / or, the method further includes a template version tag, wherein a template version number is generated at import time based on the latest commit hash of the Git repository or the modification time of the test environment, and is stored together with the template data.

[0012] Preferably, the paginated search of the template list interface supports fuzzy search by template type, code, and name, and supports sorting by modification time in reverse order; And / or, the front-end state manager uses Redux and stores one or more of the following information: original template content, converted content, import source, and currently selected element identifier; And / or, the chained loading interface returns a list of resources associated with the template while returning the template data, and the front end preloads the list of resources to accelerate rendering.

[0013] Preferably, in any embodiment of this application, the editor is automatically initialized and the visualization effect of the template is rendered after the import is completed.

[0014] This application also provides a document template import and processing system, including: Interactive Interface (UI) module: Provides pagination search and conditional filtering functions in the template list interface. In response to the user's selection of the target template, it retrieves the template content in the test environment and Git repository in parallel to generate difference comparison results, which are displayed through modal pop-ups. Interface response module: In response to the user's confirmation import command, it calls the backend chain loading interface to import the template data into the editor; The core front-end module converts specific syntax in the template into HTML comment format, stores template information and import sources in the front-end state manager, and triggers the editor to initialize rendering.

[0015] This application also provides an electronic device for importing and processing document templates, including: At least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform: a document template import processing method as described in any one of this application.

[0016] This application also provides a computer storage medium storing computer-executable instructions, which, when executed by a processor, perform the following: the document template import processing method as described in any one of this application.

[0017] Compared with the prior art, the beneficial effects achieved by the present invention can include one or more of the following aspects: On the one hand, it improves import accuracy from the source. By acquiring and comparing templates in parallel across multiple environments, users can intuitively identify template differences in different environments, avoiding the import of incorrect versions and solving the version confusion problem at its source; Secondly, it significantly enhances system security. Through secure front-end syntax conversion, it effectively prevents malicious script execution, ensuring the security of the editing environment, while preserving the original template information and supporting subsequent editing and restoration. In three aspects, multiple methods are used in synergy to optimize the user experience. For example, persistent storage of imported source information provides an accurate path for subsequent saving; chained loading ensures data integrity; and state synchronization triggers automatic rendering, reducing user operation steps, etc. In four aspects, the import process is stable and reliable, ensuring that the template data is legal and rendered completely, thus improving system reliability. Attached Figure Description

[0018] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1 This is a flowchart illustrating a document template import and processing method according to this application; Figure 2 This is a schematic diagram of the template list interface in this application; Figure 3 This is a schematic diagram comparing the two environments in this application; Figure 4 This is a schematic diagram of the difference comparison results in this application; Figure 5 This is a schematic diagram of the template selection interface in this application; Figure 6 This is a schematic diagram of the template upload entry in this application; Figure 7 This is a schematic diagram of the structure of a document template import and processing system according to this application; Figure 8 This is a schematic diagram of an electronic device used for importing and processing document templates in this application. Detailed Implementation

[0020] The specific embodiments of the technical solution of this application will be described in detail below with reference to the accompanying drawings. The following embodiments are used to illustrate this application, but are not intended to limit the scope of this application.

[0021] In practical applications, there are a series of problems in the import and processing of document templates, mainly as follows: On the one hand, the template import process is fragmented and lacks a multi-environment collaborative comparison mechanism.

[0022] In existing technologies, templates are typically stored in multiple environments, such as development environments, testing environments, and Git version repositories (where Git repositories are typically used to track and manage project file versions). When importing templates, users often can only import from a single environment (such as a local or testing environment), making it difficult to intuitively understand the differences between the same template in different environments (such as a testing environment and a Git repository). Therefore, problems can easily arise during actual imports. For example, users may import an outdated or modified template without their knowledge; it is difficult to trace the template's change history, increasing the difficulty of debugging and troubleshooting; and in multi-team collaboration scenarios, template version confusion can easily occur, leading to online incidents.

[0023] Secondly, the import process lacks data security guarantees.

[0024] Existing template import solutions typically load template content directly into the editor for rendering without performing security checks on specific syntax elements within the template (such as script tags and variable placeholders). Therefore, actual imports can easily lead to serious security vulnerabilities. For example, malicious scripts may be injected into the template and executed during editing or previewing, causing XSS (Cross-Site Scripting) attacks; variable placeholders may be misinterpreted or corrupted, resulting in abnormal template rendering.

[0025] In three aspects, the loss of import source information affects subsequent saving and version management.

[0026] In existing technologies, after a template is imported, its source information (such as which environment it was imported from, the corresponding Git branch, etc.) is often not recorded. This makes it difficult for users to accurately determine the save path when saving the template after editing. For example, whether to overwrite the original test environment files or commit to the Git repository is missing information, which increases the complexity of the user's operation and is also prone to file overwriting errors.

[0027] Fourthly, there is a lack of an effective rollback mechanism after an import failure.

[0028] When network interruptions, interface errors, or file format errors occur during the import process, existing technologies often directly report errors and terminate the process. However, the temporarily stored data may remain, affecting subsequent operations. Therefore, the lack of a traceable import mechanism leads to a poor user experience and insufficient system stability.

[0029] In five aspects, there is a lack of intelligent processing of template-related resources.

[0030] Templates typically rely on external resources such as images, style files, and script libraries. Current technologies often only process the template file itself when importing templates, without simultaneously processing related resources. This results in resource deficiencies (such as images failing to display) when the template is rendered in the editor, negatively impacting the editing experience.

[0031] In summary, existing template import technologies have some shortcomings in areas such as multi-environment collaboration, data security, source information recording, rollback mechanisms, and resource management.

[0032] Based on this, the present invention provides a new solution for template import. The core concept is to build a single-document template import processing mechanism that integrates multi-environment comparison, chain loading, secure conversion, source recording, and status synchronization. The implementation strategy is as follows: (1) Template discovery: Provide a paginated search interface, and users can filter templates according to conditions; (2) Environment comparison: Obtain test environment and Git environment content in parallel, and display the differences in a modal pop-up window; (3) Chain loading: After user confirmation, the loading interface can be automatically called to import the template data into the editor; (4) Security processing: The front end converts the template syntax into HTML comments to ensure rendering security; (5) Status synchronization: The template information is stored in the front end state manager (such as Redux) and automatically triggers the editor initialization. Therefore, the front end is responsible for UI interaction, data conversion and status management, while the back end provides basic interfaces such as template query, content acquisition and file upload.

[0033] In practice, the template import mechanism constructed in this application systematically solves the technical problem of the inability to effectively import document templates in existing technologies through the synergistic effect of the following multiple technical means: 1. Multi-environment parallel acquisition and difference comparison mechanism The template list interface offers paginated search and conditional filtering functions. Responding to the user's selection of a target template, it retrieves template content from the test environment and Git repository in parallel, generates difference comparison results using a difference algorithm, and displays them intuitively in a modal pop-up window. This mechanism allows users to fully understand the differences between templates in different environments before importing, avoiding the import of incorrect versions and resolving version inconsistencies at the source.

[0034] 2. A chained loading interface, with multiple layers of verification as needed, is a preferred implementation method. After the user confirms the import, the backend chained loading interface is called to import the template data into the editor. In a preferred implementation, this interface can also perform multi-level validation of the template data before the call, including syntax validation and resource reference validation. If the validation fails, the import is interrupted and an error is displayed. The chained loading mechanism ensures the integrity and legality of the imported data.

[0035] 3. Safe front-end syntax conversion The front-end converts specific syntax in the template (such as variable placeholders and script tags) into HTML comment format while preserving the original content for later restoration. This conversion mechanism effectively prevents malicious script execution (such as XSS attacks), ensures the security of the editing environment, and does not damage the original template information, supporting subsequent editing and restoration.

[0036] 4. Import source information storage and status management The template information and import source (such as the test environment or Git repository) are stored in the front-end state manager (such as Redux), and the editor is triggered to initialize rendering. This mechanism enables the import source information to be persisted, providing a target path for subsequent save operations and avoiding file overwriting errors.

[0037] In practice, in addition to the above methods, a resource list preloading mechanism can also be introduced. That is, when the chain loading interface returns template data, it also returns a list of resources associated with the template. The front end preloads the resource list to accelerate rendering and ensure that the template is fully presented in the editor.

[0038] In addition to the methods mentioned above, an import log and rollback mechanism can be introduced during implementation. This involves automatically recording the import log after completion, including information such as the operator, time, template source, and template version number. If a network interruption or interface failure occurs during the import process, the system automatically rolls back to the state before the import and clears any stored temporary data. This mechanism ensures the atomicity of the import operation, improving system stability and user experience.

[0039] The aforementioned technical features are interconnected and mutually supportive, forming a collaborative technical solution. This solution establishes a template import processing mechanism that integrates multi-environment comparison, chained loading, secure conversion, source recording, and state synchronization. Starting with environment comparison, this mechanism acquires content from multiple environments in parallel, allowing users to fully understand template differences before importing. Chained loading serves as the channel, ensuring data integrity through multi-layered verification. Secure conversion provides protection against script attacks through syntax conversion. State management is at its core, supporting subsequent operations through persistent source information. Resource preloading further ensures complete template rendering. Therefore, the various stages of the solution are interconnected, forming an organic whole that achieves efficient, reliable, and secure document template import through synergistic action.

[0040] The invention will now be illustrated by examples.

[0041] Example 1 This embodiment exemplifies how, before importing a template, users can intuitively understand the differences between templates in different environments, and ensure that the import process is safe and reliable, while also recording the import source information for subsequent use.

[0042] refer to Figure 1 As illustrated, the document template import processing method provided in this embodiment includes the following steps: Step S101: Provide pagination search and conditional filtering functions in the template list interface in response to the user's selection of the target template.

[0043] refer to Figure 2 As shown in the illustration, the template list interface in this embodiment is implemented using components, which can support pagination display and fuzzy search by template type, code, name, etc.

[0044] In implementation, parallel retrieval is used to improve response speed. In some preferred examples, when a user clicks on a template row, the front end simultaneously sends asynchronous requests to two interfaces: / api / environment / test / template / {id} and / api / git / template / {id}.

[0045] Step S102: Obtain template content from the test environment and Git repository in parallel. It should be noted that in addition to templates from the test environment and Git repository, templates can also be obtained from other environments (by configuring the environment template information separately), which will not be elaborated here.

[0046] Step S103: Generate difference comparison results, wherein the difference comparison results are displayed through a modal pop-up window.

[0047] refer to Figure 3 As illustrated, after successful retrieval, the front-end calls a template comparison tool library (such as the comparison tool diff-match-patch) to compare the version content in the two environments (e.g., line-level comparison) and generate difference results. In a preferred example, the difference results may include one or more of the following data: template ID, template name, modification time, content difference markers, template file size, and metadata such as whether the file exists.

[0048] During implementation, the difference comparison results are displayed via a Modal pop-up window. The left side of the pop-up window shows the test environment content, and the right side shows the Git repository content. Difference rows are highlighted with different background colors and the modification time is indicated. (Reference) Figure 4 As shown, if the amount is the result of the difference comparison, it will be highlighted and the modification time will be marked.

[0049] Step S104: In response to the user's confirmation import command, if the user confirms the import, proceed to step S105; otherwise, return to step S101.

[0050] Step S105: Call the backend chain loading interface to import the template data into the editor.

[0051] After confirming everything is correct in the pop-up window, the user clicks the "Confirm Import" button. The frontend sends an import request to the backend, which includes information such as the template ID and the import source (test or git). Upon receiving the request, the backend performs a chained loading operation: first, it retrieves the original template data based on the import source; then, it performs syntax validation and resource reference validation in sequence; after passing the validation, it returns the template data to the frontend.

[0052] Step S106: Convert the specific syntax in the template into HTML comment format on the front end.

[0053] After receiving the template data, the front-end performs a secure transformation operation. For example, it uses regular expressions to identify the following specific syntax in the template: <script>标签及其内容、{{变量名}}形式的占位符、<iframe>等潜在风险标签。然后,将上述语法转换为HTML注释格式,例如:原内容<script>alert('xss')< / script> Convert to<!--script alert('xss') / script--> Meanwhile, a copy of the original content is retained during the conversion process and stored in the state manager for later restoration during editing.

[0054] Step S107: Store the template information and import source to the front-end state manager (such as Redux) and trigger the editor to initialize rendering.

[0055] After conversion, the following information is stored in the front-end state manager (such as Redux): original template content, converted content, import source, and the identifier of the currently selected element (initially unselected). Once stored, the editor is triggered to initialize rendering. The editor loads the converted template content and renders the HTML effect in the visualization area.

[0056] In some implementations, this application also supports template source query, template comparison, template addition, template loading, and template source environment selection.

[0057] refer to Figure 5 As shown, when importing a template, a template selection interface pops up, allowing users to search for existing templates in the test environment by template type, encoding, and template name. This facilitates comparison with the latest template content in the Git repository. Additionally, the upload function allows users to upload these templates.

[0058] It should be noted that template import has the following characteristics: (1) The query results include template ID, number, template name, and template comparison function; (2) When clicking on template comparison, the template comparison interface is displayed, which automatically compares the differences between the current template test environment and the pre-production environment templates, as well as the template modification time. (3) When clicking on template comparison, if there is no template file, you will need to upload the template file after clicking on template comparison.

[0059] Furthermore, from a technical perspective, Java can be used as the backend language and React as the frontend language, resulting in a system with high compatibility and stability. This leverages Java's powerful object-oriented capabilities, cross-platform functionality, and extensive open-source support to provide a reliable foundation for developing complex, comprehensive billing service platforms. This enables the import and design of HTML visual templates, offering high flexibility and scalability, facilitating the creation of various application platforms (such as document platforms). It significantly improves the flexibility of billing template editing, allowing even non-technical personnel to easily adjust and optimize templates, thereby significantly reducing software learning and template design costs.

[0060] Therefore, this embodiment proposes a template import processing method that integrates multi-environment comparison, chained loading, secure conversion, and state synchronization. It generates comparison results by acquiring content from multiple environments in parallel and displays them in a modal pop-up window, allowing users to intuitively understand the differences between the multiple environments before importing and avoid importing incorrect versions. The chained loading interface ensures data integrity; front-end syntax conversion guarantees security; and a state manager stores source information to provide a basis for subsequent operations. The entire import process is safe, reliable, and user-friendly.

[0061] Example 2 This embodiment addresses how to facilitate users uploading missing templates when template files are not available in the test environment, and how to handle situations where obtaining a certain environment fails to ensure the process can continue.

[0062] Based on Example 1, a template missing handling and asynchronous failure fault tolerance mechanism have been added. When the template file does not exist in the test environment, an upload entry is automatically provided; when a certain environment fails during parallel acquisition, a pop-up window displays the reason for the failure and allows the user to choose to retry or ignore it.

[0063] Scenario 1: Test environment template file does not exist During parallel retrieval, if the test environment API returns a file that does not exist, the front-end will add an "Upload Template" button to the pop-up window. After the user clicks this button, a template upload entry will appear, such as... Figure 6 As shown, the upload entry point includes: a file selector (supports clicking to select files), a drag-and-drop upload area (supports dragging and dropping files to this area for upload), and format prompts (displaying "Only HTML templates are supported"). After a user uploads an HTML file, the front-end sends the file to the upload interface in the test environment. Upon successful upload, the comparison process is retried.

[0064] Scenario 2: Failure to acquire any environment If any API in the test environment or Git repository times out or returns an error due to network issues, the frontend will capture the exception and display a failure message in a pop-up window, such as: "Test environment acquisition failed. Retry or ignore?" Two buttons, "Retry" and "Ignore this environment," will be provided. If the user selects "Retry," the frontend will re-initiate the request to the corresponding API; if the user selects "Ignore this environment," the pop-up window will only display the successfully acquired environment content, with a note in the difference comparison area stating "This environment content acquisition failed and cannot be compared at this time."

[0065] With a template missing handling mechanism, users can upload templates without leaving the current interface, improving ease of use. An asynchronous failure tolerance mechanism ensures that even if a certain environment is temporarily unavailable, users can still complete the import based on an available environment, avoiding process interruption and improving system robustness.

[0066] Example 3 This embodiment aims to ensure that the template files uploaded by users are in the correct format and to provide diverse upload methods to suit different user habits.

[0067] Based on Example 2, this embodiment adds a file type verification interface and a diversified upload operation area to ensure that the uploaded file format is correct and to provide flexible upload methods.

[0068] In practice, verification can be achieved by providing a file type validation interface.

[0069] After the user selects a file, the frontend immediately reads the file extension and compares it with the list of allowed extensions (['.html', '.htm']). If the file extension is not in the list, an error message is displayed on the interface: "File format error, please upload an HTML template file," and the upload button is disabled. Simultaneously, to prevent users from bypassing the verification by changing the extension, the frontend also reads the magic number in the file header via API to verify whether the file is a genuine HTML text file. If the verification fails, an error message is also displayed.

[0070] During implementation, the user experience can be optimized by providing diverse upload operation areas.

[0071] To accommodate the different operating habits of users, this embodiment provides three upload methods (see above). Figure 6 (Illustration) (1) File Selector: Click the “Select File” button to bring up the system file selection dialog box; (2) Drag and drop upload area: Users can directly drag and drop files from the folder to the specified area. The area border is highlighted and the file is automatically uploaded after being released. (3) Format prompts: The prompt "Only HTML format templates are supported" is displayed at the top of the interface to avoid user misoperation.

[0072] By using a file type validation interface, we can effectively prevent the upload of files with incorrect formats and reduce invalid backend requests; by providing diverse upload operation areas, we can meet the operating habits of different users and improve the user experience.

[0073] Example 4 Based on Example 1, this embodiment adds refined features such as highlighting inline differences, multi-layer verification, specific syntax recognition and conversion, and source information storage, further optimizing user experience and system security.

[0074] Referring to the above Figure 4 As shown, this can be achieved by highlighting inline differences.

[0075] In implementation, within the modal pop-up window, not only are row-level differences distinguished by background color, but intra-row differences are also highlighted with different colors. For example, a row containing " Amount: {{amount}} If the test environment uses "{{amount}}" and the Git repository uses "{{totalAmount}}", the corresponding line in the pop-up window will be highlighted in yellow, and "amount" and "totalAmount" will be distinguished in red font, making it easy for users to quickly locate the differences. Additionally, checkboxes are provided before each difference line, allowing users to confirm whether to overwrite each item. For example, users can check "Keep test environment version" or "Use Git repository version," and the system will generate the final import content based on the selection.

[0076] This embodiment also provides a multi-layer verification function, that is, the chained loading interface performs a multi-layer verification mechanism before being called.

[0077] For example, syntax validation: The HTML parsing library is used to parse the template, checking if tags are closed and if attributes are formatted correctly. If a syntax error is found (such as an unclosed tag...),... If the import fails, the import process will be interrupted and an error message will be displayed, such as: "Template syntax error: line 25". "Unclosed".

[0078] For example, resource reference validation: extract all references from the template. <img src=""...”"> , <link href=""...”"> Once resources are referenced, a HEAD request is sent to verify their accessibility. If any unavailable resources are found, an error message is displayed to the user, such as: "Three image resources were detected as inaccessible. Do you want to continue importing?".

[0079] Additionally, if illegal tags or scripts (such as...) exist... <script>、<iframe>),则进行过滤或拦截,并在转换时将其注释化,同时记录日志。

[0080] 本实例中还可以引入特定语法识别与转换机制。

[0081] 例如,采用基于正则表达式和AST解析的混合策略:对于简单占位符,使用正则识别并完成转换为;而对于复杂脚本标签,使用解析器识别并整体转换为注释,同时保留内部内容用于后续恢复。

[0082] 本实例中还可以引入来源信息存储机制。实施中,模板信息存储至Redux时,除了导入来源,还可以存储来源环境的详细信息。例如,若来源为测试环境,存储环境URL、API版本等;若来源为Git仓库,存储分支名、提交哈希、远程仓库地址等。通过这些信息可以在后续保存操作时准确地确定目标路径。

[0083] 本实施例通过高亮行内差异和逐项确认,用户可精细化控制导入内容;通过多层验证,确保模板数据合法可靠;通过特定语法转换,平衡安全性和可恢复性;通过来源信息存储,为后续操作提供完整上下文。

[0084] 实施例5本实施例在实施例1的基础上,增加了导入日志记录、自动回滚机制、模板版本标记等运维特性,能够提升系统的可审计性、稳定性和版本管理等能力。

[0085] 本实例中可以引入导入日志记录机制。在导入完成后,前端自动组装日志信息,并通过接口发送至后端存储。其中,日志内容可以包括以下一个或多个信息:操作人(从JWT令牌中解析的用户名)、时间(当前时间戳)、模板来源(test或git)、模板版本号(根据Git提交哈希生成的版本号)。另外,可以在后端将日志存入数据库,供后续审计查询。

[0086] 本实例中还可以引入自动回滚机制。在导入过程中,若发生网络中断或接口异常,前端捕获错误后执行回滚操作。例如,清除Redux中本次导入相关的临时数据;关闭模态弹窗;显示错误提示,如"导入失败,已自动回滚至导入前状态”;还原编辑器至导入前的内容(若有)等。

[0087] 本实例中还可以引入模板版本标记机制。在导入时,前端根据来源信息生成模板版本号,例如若来源为Git仓库,取最新提交哈希的前8位作为版本号,如"v1.0-a3b5c7d9”;若来源为测试环境,取模板文件的修改时间戳作为版本号,如"v202503011430”。

[0088] 实施中,版本号随模板数据一同存储,并在编辑器的标题栏显示,便于用户识别当前模板版本。

[0089] 本实施例通过导入日志记录,便于追溯操作轨迹和责任认定;通过自动回滚机制,确保系统状态一致性,提升用户体验;通过模板版本标记,支持多版本管理和快速回退。

[0090] 实施例6本实施例在实施例1的基础上,增加了分页搜索优化、Redux状态管理细化、资源预加载等特性,提升模板查找效率、编辑器性能、渲染完整性。

[0091] 本实例中还可以引入分页搜索优化功能。其中,模板列表界面的分页搜索支持查询 / 筛选 / 排序等功能。例如,模糊查询:输入"账单”,可匹配模板名称中包含"账单”的所有模板;条件筛选:提供下拉框,支持按模板类型(如"邮件模板”、"账单模板”)、编码进行筛选;排序:默认按修改时间倒序排列,最新修改的模板排在前面。

[0092] 本实例中还可以引入前端状态管理细化机制。实施中,通过Redux存储内容进行细化,存储内容可以包括:模板原始内容(用于恢复未转换前的状态)、转换后内容(用于渲染可视化界面)、导入来源(test / git)、当前选中元素标识(XPath格式,如" / html / body / div[2] / p”)、编辑历史(用于撤销 / 重做操作)等。

[0093] 本实例中还可以引入资源预加载机制。实施中,链式加载接口返回模板数据的同时,返回资源列表,从而前端收到数据后,立即预加载资源:对于CSS内容(Cascading StyleSheets,层叠样式表),解析<link rel="preload” href="...” as="style”>标签;对于图片,解析<link rel="preload” href="...” as="image”>标签;对于字体文件,解析<linkrel="preload” href="...” as="font”>标签。预加载完成后,再渲染可视化界面,确保资源立即可用。

[0094] 本实施例通过优化的分页搜索,用户可快速定位目标模板;通过Redux状态管理细化,支持复杂编辑操作;通过资源预加载,避免渲染时资源缺失,提升用户体验。

[0095] 实施例7本实施例在前述实施例1-6的基础上,增加了自动触发编辑器初始化的特性,简化用户操作流程。

[0096] 实施中,可以在步骤S107中,将模板信息存储至Redux后,立即触发编辑器一个初始化操作,例如名为"EDITOR_INIT”的Action,即Redux中的editor reducer接收到该Action后,将状态标记为"待初始化”。编辑器组件通过监听该状态变化,当检测到状态变化时,执行初始化逻辑。例如,从Redux获取转换后的模板内容;调用渲染引擎(如React的dangerouslySetInnerHTML或专门的DOM解析库)将内容渲染到可视化区域;初始化编辑器的选中状态、历史记录等。

[0097] 因此,整个过程中,用户无需点击任何"渲染”或"刷新”按钮,即可在导入完成后立即看到模板的可视化效果。

[0098] 本实施例通过自动触发编辑器初始化,简化用户操作流程,提升系统易用性和用户体验。

[0099] 实施例8在前述方法实施例基础上,本实施例提供一种单证模板导入处理系统、电子设备及计算机存储介质等示例,通过模块化设计和硬件执行。

[0100] 基于相同发明构思,在上述方法示例基础上,本申请还提供一种单证模板导入处理系统示例说明。

[0101] 参考图7示意,一种单证模板导入处理系统,包括:交互界面模块:在模板列表界面提供分页搜索和条件筛选功能,响应于用户对目标模板的选择操作,并行获取测试环境和Git仓库中的模板内容(可以通过接口调用模块进行并行获取),以生成差异对比结果,其中所述差异对比结果通过模态弹窗展示。

[0102] 接口响应模块:响应于用户的确认导入指令,调用后端链式加载接口将模板数据导入编辑器。

[0103] 前端核心模块:在前端将模板中的特定语法转换为HTML注释格式,以及将模板信息及导入来源存储至前端状态管理器,并触发编辑器初始化渲染。

[0104] 实施中,各模块之间通过定义好的接口进行通信,协同完成模板导入处理流程。核心数据流的闭环可以为:交互界面触发 → 接口模块并行获取测试 / Git内容 → 差异对比弹窗展示 → 用户确认 → 调用链式加载接口 → 后端多层校验 → 返回模板+资源列表→ 前端安全转换 → Redux存储 → 编辑器自动渲染。

[0105] 需要说明的是,单证模板导入处理系统中的单元模块功能及模块数量的设置,可以根据前述方法实施例进行相应设置,这里不再展开说明。

[0106] 基于相同发明构思,本发明还提供一种电子设备,包括:至少一个处理器;以及,与所述至少一个处理器通信连接的存储器;其中,所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行:如本申请中任一项实施例所述的单证模板导入处理方法。

[0107] 如图8所示,本申请还提供的电子设备的结构示意图,图中示出了该电子设备500的结构,这里电子设备500仅仅是一个示例,不应对本发明实施例的功能和使用范围带来限定。

[0108] 在电子设备500中,可包括:至少一个处理器510;以及,与所述至少一个处理器通信连接的存储器520;其中,所述存储器存储520有可被所述至少一个处理器510执行的指令,所述指令被所述至少一个处理器510执行,以使所述至少一个处理器510能够执行:本申请中任一项实施例所述单证模板导入处理方法。

[0109] 需要说明的是,电子设备500可以以通用计算设备的形式表现,例如其可以为服务器设备。

[0110] 实施中,电子设备500的组件可以包括但不限于:上述至少一个处理器510、上述至少一个存储器520、连接不同系统组件(包括存储器520和处理器510)的总线530,其中总线530可包括数据总线、地址总线和控制总线。

[0111] 实施中,存储器520可以包括易失性存储器,例如随机存取存储器(RAM)5201和 / 或高速缓存存储器5202,还可以进一步包括只读存储器(ROM)5203。

[0112] 存储器520还可以包括具有一组(至少一个)程序模块5204的程序工具5205,这样的程序模块5204包括但不限于:操作系统、一个或者多个应用程序、其它程序模块以及程序数据,这些示例中的每一个或某种组合中可能包括网络环境的实现。

[0113] 处理器510通过运行存储在存储器520中的计算机程序,从而执行各种功能应用以及数据处理。

[0114] 电子设备500也可以与一个或多个外部设备540(例如键盘、指向设备等)通信。这种通信可以通过输入 / 输出(I / O)接口550进行。并且,电子设备500还可以通过网络适配器560与一个或者多个网络(例如局域网(LAN),广域网(WAN)和 / 或公共网络,例如因特网)通信,网络适配器560通过总线530与电子设备500中的其它模块通信。应当明白,尽管图中未示出,可以结合电子设备500使用其它硬件和 / 或软件模块,包括但不限于:微代码、设备驱动器、冗余处理器、外部磁盘驱动阵列、RAID(磁盘阵列)系统、磁带驱动器以及数据备份存储系统等。

[0115] 基于相同发明构思,本说明书实施例提供一种计算机存储介质,所述计算机存储介质存储有计算机可执行指令,所述计算机可执行指令设置为:如本申请中任一项实施例所述的单证模板导入处理方法。

[0116] 需要说明的是,所述计算机存储介质可以包括但不限于:便携式盘、硬盘、随机存取存储器、只读存储器、可擦拭可编程只读存储器、光存储器件、磁存储器件或上述的任意合适的组合。

[0117] 在可能的实施方式中,本发明还可以提供将数据处理实现为一种程序产品的形式,其包括程序代码,当所述程序产品在终端设备上运行时,所述程序代码用于使所述终端设备执行前述任意一个实施例所述方法中的若干步骤。

[0118] 其中,可以以一种或多种程序设计语言的任意组合来编写用于执行本发明中的程序代码,所述程序代码可以完全地在用户设备上执行、部分地在用户设备上执行、作为一个独立的软件包执行、部分在用户设备上部分在远程设备上执行或完全在远程设备上执行。

[0119] 虽然以上描述了本申请的具体实施方式,但是本领域的技术人员应当理解,这仅是举例说明,本申请的保护范围是由所附权利要求书限定的。本领域的技术人员在不背离本申请的原理和实质的前提下,可以对这些实施方式做出多种变更或修改,但这些变更和修改均落入本申请的保护范围。< / script>

Claims

1. A method for importing and processing document templates, characterized in that, include: The template list interface provides paginated search and conditional filtering functions. In response to the user's selection of the target template, it retrieves the template content in the test environment and Git repository in parallel to generate difference comparison results, which are displayed through modal pop-ups. In response to the user's confirmation import command, the backend chain loading interface is called to import the template data into the editor; On the front end, specific syntax in the template is converted into HTML comment format; The template information and import source are stored in the front-end state manager, and the editor is triggered to initialize rendering.

2. The method according to claim 1, characterized in that, Parallel acquisition of template content from the test environment and Git repository, including: if the template file does not exist in the test environment, providing a template upload entry to support users to upload HTML format template files; And / or, parallel retrieval uses an asynchronous request mechanism. When any environment retrieval fails, a pop-up window will display the reason for the failure, allowing the user to retry or ignore the environment.

3. The method according to claim 2, characterized in that, The template upload entry includes a file type validation interface, which is used to upload template files with the .html extension and prompts the user that only .html format template files are supported. And / or, the template upload entry includes at least one of the following operation areas: file selector, drag-and-drop upload area, and format prompt information.

4. The method according to claim 1, characterized in that, The modal pop-up supports presenting the difference comparison results in the form of highlighted inline differences, and supports users to confirm whether each item is covered; And / or, the chain loading interface performs multi-level validation on the template data before calling it. The multi-level validation includes: syntax validation and resource reference validation. If the validation fails, the import is interrupted and an error is prompted. If there are illegal tags or scripts, they are filtered or intercepted. And / or, convert specific syntax in the template into HTML comment format, including: identifying specific syntax in the template and replacing it with HTML comment format, while preserving the original content for subsequent recovery, wherein the specific syntax includes variable placeholders and script tags; And / or, the template import source includes the test environment and Git repository, where the source information is stored together with the template data and used to determine the target path when saving later.

5. The method according to claim 1, characterized in that, The method further includes: automatically recording an import log after the import is completed, the import log including one or more of the following information: operator, time, template source, template version number; And / or, the method further includes: if a network interruption or interface abnormality occurs during the import process, automatically roll back to the state before import and clear the stored temporary data; And / or, the method further includes a template version tag, wherein a template version number is generated at import time based on the latest commit hash of the Git repository or the modification time of the test environment, and is stored together with the template data.

6. The method according to claim 1, characterized in that, The template list interface supports paginated search by template type, code, and name for fuzzy search, and also supports sorting by modification time in reverse order. And / or, the front-end state manager uses Redux and stores one or more of the following information: original template content, converted content, import source, and currently selected element identifier; And / or, the chained loading interface returns a list of resources associated with the template while returning the template data, and the front end preloads the list of resources to accelerate rendering.

7. The method according to any one of claims 1 to 6, characterized in that, After importing, the editor will automatically initialize and render the visual effects of the template.

8. A document template import and processing system, characterized in that, include: Interactive interface module: Provides paginated search and conditional filtering functions in the template list interface. In response to the user's selection of the target template, it retrieves the template content in the test environment and Git repository in parallel to generate difference comparison results, which are displayed through modal pop-ups. Interface response module: In response to the user's confirmation import command, it calls the backend chain loading interface to import the template data into the editor; The core front-end module converts specific syntax in the template into HTML comment format, stores template information and import sources in the front-end state manager, and triggers the editor to initialize rendering.

9. An electronic device for importing and processing document templates, characterized in that, include: At least one processor; And a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform: the document template import processing method as described in any one of claims 1-7.

10. A computer storage medium, characterized in that, The computer storage medium stores computer-executable instructions, which, when executed by a processor, perform the following: the document template import processing method as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Receipt template generation method and device, computer equipment and storage medium

    CN108509400A

  • Document template generation method, device and equipment, and storage medium

    CN112613290A

  • Electronic document management method, electronic equipment and storage medium

    CN118395470A

  • Claim settlement service automatic verification method and device, electronic equipment and storage medium

    CN121212995A

  • Automatic process management method and system applied to foreign trade business intellectualization

    CN121581817A