Document management method and device supporting API integration, equipment and storage medium
By establishing a user permission mapping table and using the token bucket algorithm, time wheel algorithm, and message queue to implement API interface permission control and data synchronization, the problem of non-real-time and irregular data synchronization in the document management system is solved, improving the system's flexibility and reliability.
Patent Information
- Application Number
- CN202510882227.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-27
- Publication Date
- 2025-10-28
AI Technical Summary
Existing document management systems lack effective API interface integration, resulting in unreal-time and irregular data synchronization, making them unable to adapt to diverse business scenarios. Furthermore, they cannot control interface access based on user role permissions, impacting work efficiency and reliability.
By establishing a user permission mapping table, issuing API access tokens using the token bucket algorithm, and combining the time wheel algorithm and message queue to achieve timed and real-time data synchronization, performing format conversion and updating the document library, the standardization and consistency of data are ensured.
It has achieved flexibility and scalability in the document management system, adapting to diverse business scenarios, improving the reliability of data synchronization and system integration, and ensuring access control for different user roles and real-time data updates.
Smart Images

Figure CN120849487A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of information processing technology, and in particular to a document management method, apparatus, device, and storage medium that supports API integration. Background Technology
[0002] With the continuous development of information technology, enterprises generate a large number of electronic documents in their daily operations, highlighting the increasing importance of document management. Traditional document management systems typically operate independently, lacking effective integration with other business systems. In practice, users often need to manually import and export documents between different systems, a cumbersome and error-prone process that severely impacts work efficiency. Furthermore, importing non-standard format documents can reduce the reliability of document management. Moreover, traditional document management systems cannot meet the needs of unified cross-system management and retrieval of documents, hindering data sharing and collaboration. While some existing document management systems attempt to connect with other systems through simple data interfaces, these interfaces are limited in function and lack scalability. They cannot achieve scheduled or real-time data synchronization, nor can they control interface access based on user role permissions. This makes them unsuitable for diverse business scenarios and fails to meet the modern enterprise's requirements for efficient, flexible, and integrated document management. Summary of the Invention
[0003] To overcome the shortcomings of existing technologies, the present invention aims to provide a document management method, apparatus, device, and storage medium that supports API integration, improves the reliability of document management, enables data interaction with external systems through API interfaces, achieves timed and real-time data synchronization, improves system integration, controls interface access based on the permissions of different user roles, enhances the flexibility and scalability of the document management system, and adapts to diverse business scenarios.
[0004] The first aspect of this invention provides a document management method supporting API integration, comprising: establishing a user permission mapping table; assigning role permissions to different users according to the user permission mapping table; when the permission set of the role permissions includes API call permissions, issuing an API access token to the user using a token bucket algorithm, and calling the API interface according to the API access token; constructing a ring task scheduler using a time wheel algorithm, and using the task scheduler to trigger the API interface to pull timed synchronization data from an external system at a preset time; monitoring document events of the external system in real time based on a message queue, and triggering the API interface to pull real-time synchronization data according to the document events; converting the timed synchronization data or the real-time synchronization data into a standard format synchronization data, and updating the document library based on the standard format synchronization data.
[0005] Optionally, in a first implementation of the first aspect of the present invention, the step of establishing a user permission mapping table and assigning role permissions to different users according to the user permission mapping table includes: configuring permissions using a role-based access control algorithm to obtain permission configuration information; establishing a user permission mapping table according to the permission configuration information, wherein the user permission mapping table includes a user role mapping table, a role permission mapping table, and a permission API mapping table; and assigning role permissions to different users according to the user permission mapping table.
[0006] Optionally, in a second implementation of the first aspect of the present invention, the step of issuing an API access token to the user using a token bucket algorithm when the permission set of the role permissions includes API call permission, and calling the API interface according to the API access token, includes: generating a token bucket using the token bucket algorithm, and setting the token generation rate and the capacity of the token bucket; issuing an API access token to the user using the token bucket when the permission set of the role permissions includes API call permission; calling the API interface according to the API access token; performing functional testing on the API interface using equivalence class partitioning and boundary value analysis to obtain a first test result; performing performance testing on the API interface using benchmark testing and load testing to obtain a second test result; analyzing the metrics of the API interface based on the first test result and the second test result, the metrics including response time, error rate, and throughput; and evaluating the stability and reliability of the API interface under high pressure based on the response time, the error rate, and the throughput.
[0007] Optionally, in a third implementation of the first aspect of the present invention, the step of constructing a ring task scheduler using a time wheel algorithm and using the task scheduler to trigger the API interface to pull timed synchronization data from an external system at a preset time includes: constructing a ring task scheduler using a time wheel algorithm; setting the time interval for executing data retrieval tasks in the ring task scheduler; and triggering the API interface to pull timed synchronization data from an external system according to the time interval.
[0008] Optionally, in a fourth implementation of the first aspect of the present invention, the step of real-time monitoring of document events of the external system based on a message queue and triggering the API interface to pull real-time synchronized data according to the document events includes: setting event types that can be pulled for data; defining document events according to the event types; real-time monitoring of the document events of the external system based on a message queue; and triggering the API interface to pull real-time synchronized data when the message queue detects the document events.
[0009] Optionally, in a fifth implementation of the first aspect of the present invention, the step of converting the format of the timed synchronization data or the real-time synchronization data to obtain standard format synchronization data, and updating the document library based on the standard format synchronization data, includes: converting the format of the timed synchronization data or the real-time synchronization data to obtain standard format synchronization data; parsing the content of the standard format synchronization data using regular expressions and natural language processing techniques to obtain parsed data; preprocessing the parsed data using natural language processing techniques to obtain processed text, wherein the preprocessing includes word segmentation, part-of-speech tagging, and named entity recognition; extracting key content from the processed text, and updating the document library based on the key content.
[0010] Optionally, in the sixth implementation of the first aspect of the present invention, after converting the format of the timed synchronization data or the real-time synchronization data to obtain standard format synchronization data, and updating the document library based on the standard format synchronization data, the method further includes: capturing exception information when the API interface encounters an error; identifying the error type of the exception information, the error type including network error, parameter error, and server internal error; generating correction suggestion information according to the error type; and sending the correction suggestion information to the user terminal so that the user terminal generates and displays a correction suggestion page based on the correction suggestion information.
[0011] A second aspect of the present invention provides a document management device supporting API integration, comprising: an allocation module for establishing a user permission mapping table and allocating role permissions to different users according to the user permission mapping table; an API access token issuance module for issuing an API access token to the user using a token bucket algorithm when the permission set of the role permissions includes API access permission, and invoking the API interface according to the API access token; a pull module for constructing a ring task scheduler using a time wheel algorithm, and using the task scheduler to trigger the API interface to pull timed synchronization data from an external system at a preset time; a listener pull module for listening to document events of the external system in real time based on a message queue, and triggering the API interface to pull real-time synchronization data according to the document events; and a conversion and update module for converting the timed synchronization data or the real-time synchronization data into a standard format synchronization data, and updating the document library based on the standard format synchronization data.
[0012] Optionally, in a first implementation of the second aspect of the present invention, the allocation module includes: a configuration unit, used to configure permissions based on a role-based access control algorithm to obtain permission configuration information; an establishment unit, used to establish a user permission mapping table according to the permission configuration information, the user permission mapping table including a user role mapping table, a role permission mapping table, and a permission API mapping table; and an allocation unit, used to allocate role permissions to different users according to the user permission mapping table.
[0013] Optionally, in a second implementation of the second aspect of the present invention, the issuing and calling module includes: a generation and setting unit, used to generate a token bucket using a token bucket algorithm, and set the token generation rate and the capacity of the token bucket; an issuing unit, used to issue an API access token to the user using the token bucket when the permission set of the role permissions includes API calling permissions; a calling unit, used to call the API interface according to the API access token; a first testing unit, used to perform functional testing on the API interface using equivalence class partitioning and boundary value analysis to obtain a first test result; a second testing unit, used to perform performance testing on the API interface using benchmark testing and load testing to obtain a second test result; an analysis unit, used to analyze the indicators of the API interface based on the first test result and the second test result, the indicators including response time, error rate, and throughput; and an evaluation unit, used to evaluate the stability and reliability of the API interface under high pressure based on the response time, the error rate, and the throughput.
[0014] Optionally, in a third implementation of the second aspect of the present invention, the construction and retrieval module includes: a construction unit for constructing a ring task scheduler using a time wheel algorithm; a setting unit for setting the time interval for executing data retrieval tasks in the ring task scheduler; and a first retrieval unit for triggering the API interface to retrieve timed synchronization data from an external system according to the time interval.
[0015] Optionally, in a fourth implementation of the second aspect of the present invention, the listening and pulling module includes: a setting definition unit, used to set the event types that can be pulled for data, and define document events according to the event types; a listening unit, used to listen to the document events of the external system in real time based on a message queue; and a second pulling unit, used to trigger the API interface to pull real-time synchronized data when the message queue listens to the document event.
[0016] Optionally, in a fifth implementation of the second aspect of the present invention, the conversion and update module includes: a conversion unit, used to convert the format of the timed synchronization data or the real-time synchronization data to obtain standard format synchronization data; a parsing unit, used to parse the content of the standard format synchronization data using regular expressions and natural language processing technology to obtain parsed data; a preprocessing unit, used to preprocess the parsed data using natural language processing technology to obtain processed text, wherein the preprocessing includes word segmentation, part-of-speech tagging, and named entity recognition; and an extraction unit, used to extract key content from the processed text and update the document library based on the key content.
[0017] Optionally, in the sixth implementation of the second aspect of the present invention, it further includes: a capture module, used to capture exception information when the API interface encounters an error; an identification module, used to identify the error type of the exception information, the error type including network error, parameter error and server internal error; a generation module, used to generate correction suggestion information according to the error type; and a sending module, used to send the correction suggestion information to the user terminal, so that the user terminal generates and displays a correction suggestion page based on the correction suggestion information.
[0018] A third aspect of the present invention provides a document management device supporting API integration, the document management device supporting API integration comprising: a memory and at least one processor, the memory storing instructions; at least one processor invokes the instructions in the memory to cause the document management device supporting API integration to perform the various steps of the document management method supporting API integration described above.
[0019] A fourth aspect of the present invention provides a computer-readable storage medium storing instructions that, when executed by a processor, implement the steps of the document management method supporting API integration described in any of the preceding claims.
[0020] In the technical solution of this invention, user permission mapping table is used to assign role permissions to different users. When the permission set of a role includes API call permission, a token bucket algorithm is used to issue an API access token to the user. The API interface is called based on the API access token. This allows for control of interface access based on the permissions of different user roles, improving the flexibility and scalability of the document management system and adapting to diverse business scenarios. A time wheel algorithm is used to construct a ring task scheduler. The task scheduler triggers the API interface to pull timed synchronization data from external systems at preset times. Based on a message queue, document events of external systems are monitored in real time. Based on document events, the API interface is triggered to pull real-time synchronization data. Data interaction with external systems is achieved through the API interface, realizing timed and real-time data synchronization, improving the system integration. The timed or real-time synchronized data is converted to a standard format synchronized data. The document library is updated based on the standard format synchronized data, improving the reliability of document management. Attached Figure Description
[0021] Figure 1 This is a first flowchart of a document management method supporting API integration provided in an embodiment of the present invention;
[0022] Figure 2 This is a second flowchart of a document management method supporting API integration provided in an embodiment of the present invention;
[0023] Figure 3 A third flowchart of a document management method supporting API integration provided in an embodiment of the present invention;
[0024] Figure 4 This is a fourth flowchart of a document management method supporting API integration provided in an embodiment of the present invention;
[0025] Figure 5 A schematic diagram of a document management device supporting API integration provided in an embodiment of the present invention;
[0026] Figure 6 Another structural schematic diagram of a document management device supporting API integration provided in an embodiment of the present invention;
[0027] Figure 7 This is a schematic diagram of the structure of a document management device that supports API integration, as provided in an embodiment of the present invention. Detailed Implementation
[0028] This invention provides a document management method, apparatus, device, and storage medium that supports API integration, improving the reliability of document management. It enables data interaction with external systems through API interfaces, achieving timed and real-time data synchronization, thus improving system integration. Furthermore, it allows control of interface access based on the permissions of different user roles, enhancing the flexibility and scalability of the document management system and adapting to diverse business scenarios.
[0029] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” or “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0030] For ease of understanding, the specific process of the embodiments of the present invention is described below. Please refer to [link / reference]. Figure 1 One embodiment of the document management method supporting API integration in this invention includes:
[0031] 101. Establish a user permission mapping table, and assign role permissions to different users according to the user permission mapping table;
[0032] In this embodiment, the user permission mapping table is used to associate different users with their corresponding permission roles. Based on the user permission mapping table, the role permissions of different users are dynamically assigned. When a user registers in the system or is added by an administrator, a role needs to be assigned to each user. The role determines which operations a user can perform in the system. The user permission mapping table lists the relationship between roles and permissions. For example, the administrator role has the permission to view, edit, and delete all data, while the ordinary user role only has the permission to view.
[0033] 102. When the role's permission set includes API call permission, use the token bucket algorithm to issue API access tokens to the user and call the API interface based on the API access tokens;
[0034] In this embodiment, each time a user requests an API, the system first checks whether the user has API call permissions. For each user with API call permissions, the system initializes a token bucket. This token bucket limits the access frequency based on a set generation rate and bucket capacity. For example, if a user is allowed to make 10 API requests per second, the system adds 10 tokens to the bucket per second, and the bucket capacity is set to 100 tokens. When a user makes an API request, the system checks if there are enough tokens in the token bucket. If there are, the system consumes one token and allows the user to execute the API request. If there are no tokens, the system rejects the user's request and prompts the user to wait until a new token is generated. The system can dynamically adjust the token generation rate and bucket capacity according to traffic conditions. For example, the system can reduce the token generation rate during high traffic and increase the generation rate during low traffic to ensure the reasonable use of system resources. Once the user successfully obtains a token from the token bucket, the user can call the API interface.
[0035] 103. A ring-shaped task scheduler is constructed using the time wheel algorithm. The task scheduler triggers the API interface at preset times to pull timed synchronization data from the external system.
[0036] In this embodiment, a ring task scheduler is constructed using the time wheel algorithm. The time wheel algorithm is an efficient timed task scheduling algorithm. The time wheel is divided into several time slots of fixed size, each time slot representing a time unit (e.g., 1 second, 10 seconds, etc.). Tasks are assigned to different slots. Based on the task's execution time, the task will wait for execution in the corresponding time slot. The slots of the time wheel are connected sequentially to form a ring structure. The time wheel pointer moves clockwise on the time wheel. Each time the pointer moves, the task in the current time slot will be executed. When the time wheel is initialized, the number of time slots and the time interval corresponding to each slot need to be set. When a task needs to be executed on a timed basis, the scheduler adds the task to the time wheel and assigns it to the corresponding time slot. When the time wheel pointer passes through a slot, the system will execute all the expired tasks in that slot. The task triggers the API interface to pull timed synchronization data from the external system.
[0037] 104. Monitor document events from external systems in real time using a message queue, and trigger the API interface to pull real-time synchronized data based on the document events;
[0038] In this embodiment, a message queue is a message passing mechanism. Producers send messages to the message queue, which stores the messages to ensure their reliability. Consumers consume messages from the message queue and perform corresponding operations. External systems (such as a document management system) act as event producers. When documents change (such as creation, modification, or deletion), they encapsulate these events into messages and push them to the message queue. The message queue is used to receive and store these document events, ensuring that events generated by external systems can be processed asynchronously. Through the message queue, the dependency between external systems and synchronous systems is decoupled, ensuring that synchronous operations are not affected by the speed of changes in external systems. When a document event is sent to the message queue, the consumer is responsible for consuming the document event from the message queue. When the consumer receives a document event, it determines the subsequent processing flow based on the event content. The consumer constructs request parameters and calls the corresponding API interface to obtain synchronization data based on the message content (e.g., document ID and event type).
[0039] 105. Convert the format of timed or real-time synchronized data to obtain standard format synchronized data, and update the document library based on the standard format synchronized data;
[0040] In this embodiment, external systems may use different data formats for storage and transmission. To ensure that the data can be processed correctly in the target system, the data must be converted into the standard format required by the target system. First, the data format used by the external system is identified, which may include JSON, XML, CSV, etc. According to the needs of the document library, a standard format is designed, and specific code for data conversion is implemented to convert the source format data into the standard format. Once the data obtains standardized synchronized data through format conversion, the next step is to update the document library of the target system based on this data.
[0041] In this embodiment of the invention, user permission mapping table is used to assign role permissions to different users. When the permission set of a role includes API call permission, a token bucket algorithm is used to issue an API access token to the user. The API interface is called based on the API access token. This allows for control of interface access based on the permissions of different user roles, improving the flexibility and scalability of the document management system and adapting to diverse business scenarios. A time wheel algorithm is used to construct a ring task scheduler. The task scheduler triggers the API interface at preset times to pull timed synchronization data from external systems. Based on a message queue, document events of external systems are monitored in real time. Based on document events, the API interface is triggered to pull real-time synchronization data. Data interaction with external systems is achieved through the API interface, realizing timed and real-time data synchronization, improving the system integration. The timed or real-time synchronized data is converted to a standard format synchronized data. The document library is updated based on the standard format synchronized data, improving the reliability of document management.
[0042] Please see Figure 2 The second embodiment of the document management method supporting API integration in this invention includes:
[0043] 201. Configure permissions using a role-based access control algorithm to obtain permission configuration information;
[0044] In this embodiment, RBAC (Role-Based Access Control) is a method for managing access permissions through roles. The core idea of RBAC is to assign users to different roles and define a set of access permissions for each role. First, it is necessary to clarify which resources need to be subject to access management. Then, it is necessary to define the access levels of these resources. A mapping relationship needs to be established between roles and permissions. One or more roles are assigned to each user. Once the relationship between roles and permissions is defined and the role assignment is completed, these configurations need to be integrated into the system. Through the mapping relationship between roles and permissions, access control algorithms can be used to determine whether a user has permission to access a certain resource.
[0045] 202. Establish a user permission mapping table based on the permission configuration information. The user permission mapping table includes a user role mapping table, a role permission mapping table, and a permission API mapping table.
[0046] In this embodiment, a user permission mapping table is established based on the permission configuration information. The user permission mapping table includes a user role mapping table, a role permission mapping table, and a permission API mapping table. The user role mapping table is used to store the roles assigned to each user and record the mapping relationship between users and roles. The role permission mapping table is used to store the permissions possessed by each role and record the mapping relationship between roles and permissions. The permission API mapping table is used to store the mapping relationship between permissions and API interfaces and record the mapping relationship between permissions and actual API interfaces or operations.
[0047] 203. Assign role permissions to different users based on the user permission mapping table;
[0048] In this embodiment, each user is assigned to a specific role according to the user role mapping table. Based on the role, the permissions corresponding to that role are further looked up from the role permission mapping table, and these permissions are assigned to the corresponding users.
[0049] 204. Use the token bucket algorithm to generate a token bucket, and set the token generation rate and the capacity of the token bucket;
[0050] In this embodiment, a token bucket algorithm is used to generate a token bucket, and the token generation rate and the capacity of the token bucket are set. The token bucket capacity represents the maximum number of tokens that can be held in the bucket, and the token generation rate represents the number of tokens generated per unit time. Once the token bucket is initialized and the token generation rate and bucket capacity are set, tokens begin to be generated at a fixed rate until the bucket capacity reaches its limit.
[0051] 205. When the permission set of a role includes API call permission, use the token bucket to issue API access tokens to the user;
[0052] In this embodiment, the system queries whether the role's permission set contains API call permissions. If the role's permission set contains API call permissions, an API access token is issued to the user using the token bucket.
[0053] 206. Invoke the API interface based on the API access token;
[0054] In this embodiment, after the API access token is valid and the permission verification passes, the API interface is called according to the API requirements.
[0055] 207. The API interface was functionally tested using equivalence class partitioning and boundary value analysis, and the first test results were obtained.
[0056] In this embodiment, equivalence class partitioning is a method that divides all possible input data into several equivalence classes. First, based on the requirements of the API interface, the legal and illegal ranges of the input data are determined. Then, these data are divided into valid and invalid equivalence classes. Test cases are designed based on the above equivalence class partitioning. Boundary value analysis is a method that designs test cases based on the boundary values of the input data. The principle of boundary value analysis is to select the critical points of the input data, especially the maximum value, minimum value, values that are just within the legal range, values that are just outside the legal range, and illegal inputs. Test cases are designed based on boundary value analysis. After the test cases are designed, these test cases are used to test the API interface to obtain the first test result.
[0057] 208. Use benchmark testing and load testing to perform performance testing on the API interface and obtain the second test results;
[0058] In this embodiment, benchmarking is a method to evaluate system performance by measuring the performance of an API interface under standard load and comparing it with a preset benchmark value. Benchmarking tools, such as Apache JMeter, Postman, and Gatling, are selected, and benchmark scenarios are determined. Using the selected tools, requests to the API interface under normal load are simulated, and key performance indicators are measured and recorded. Load testing simulates a large number of concurrent user requests to test the API's performance under high load. The purpose is to identify API performance bottlenecks, evaluate the system's carrying capacity, and ensure that the system can still operate stably under loads exceeding normal limits. Load testing tools are selected, load testing scenarios are set, and a gradual increase from low to high load is simulated. The performance of the API interface is observed, and the scalability and carrying capacity of the API are evaluated based on indicators such as response time, throughput, and number of failed requests. A second test result is obtained after benchmarking and load testing.
[0059] 209. Analyze the API interface metrics based on the results of the first and second tests. The metrics include response time, error rate, and throughput.
[0060] In this embodiment, the API interface metrics are analyzed based on the first test results and the second test results. The metrics include response time, error rate, and throughput. Response time is an important metric for measuring API interface performance. It represents the time from sending a request to receiving a response. Error rate refers to the proportion of failed requests that occur during the request process. Throughput refers to the number of requests that the API can process per unit of time, measured in requests per second.
[0061] 210. Evaluate the stability and reliability of the API interface under high pressure based on response time, error rate, and throughput;
[0062] In this embodiment, the stability and reliability of the API interface under high pressure are evaluated based on response time, error rate and throughput. The performance of each indicator under high load is analyzed step by step, and its impact on system stability and reliability is determined to obtain the evaluation results.
[0063] In this embodiment of the invention, role-based access control and user permission mapping ensure clear and granular permission configuration, effectively managing the permissions and API access of different roles. The token bucket algorithm is used to control API access flow, which helps balance system load, avoid excessive resource consumption or abuse, and improve system stability. Combined with functional testing, performance testing, benchmark testing, and load testing, the correctness, performance stability, and reliability of the API interface under high load are ensured. By evaluating response time, error rate, and throughput, the stability of the API interface and its ability to adapt to high-pressure environments can be scientifically judged, and potential performance bottlenecks can be predicted in advance.
[0064] Please see Figure 3 The third embodiment of the document management method supporting API integration in this invention includes:
[0065] 301. Construct a ring-shaped task scheduler using the time wheel algorithm;
[0066] In this embodiment, a circular task scheduler is constructed using a time wheel algorithm. The core of the time wheel is a circular array, where the size of each time slot is one time step. Each time the time wheel rotates, the pointer advances one slot, indicating the progress of time.
[0067] 302. Set the time interval for executing data fetching tasks in the ring task scheduler;
[0068] In this embodiment, when a task needs to be scheduled, the time slot in which it should be placed is calculated based on the task's delay time. Whenever the time wheel pointer moves to a certain slot, the task in that slot is checked. Assuming that the task is executed once every 5 minutes, the task is placed in the 5-minute slot of the time wheel. Every time the time wheel rotates, the slot is checked. If the task's execution time has arrived, the task is executed.
[0069] 303. Trigger the API interface at time intervals to pull timed synchronization data from external systems;
[0070] In this embodiment, a ring task scheduler is used to execute data retrieval tasks at time intervals. Data retrieval tasks are placed into corresponding slots at time intervals. When the time wheel rotates to the slot, the task will be executed, triggering the API interface to retrieve timed synchronization data from the external system.
[0071] 304. Define the event types that can be used for data retrieval, and define document events according to the event types;
[0072] In this embodiment, data retrieval is triggered based on specific events. The types of events that can trigger data retrieval in the system are clearly defined, and a related document event is written for each event type.
[0073] 305. Real-time monitoring of document events from external systems based on message queues;
[0074] In this embodiment, a suitable message queue platform is selected, and according to specific business requirements, the message queue's exchange, queue, and routing key are set. An event listener is designed to listen to and subscribe to events in the message queue, and relevant messages are selectively processed according to the event type.
[0075] 306. When the message queue detects a document event, it triggers the API interface to pull real-time synchronized data.
[0076] In this embodiment, the message queue listens for document events issued by external systems and sends messages to the listening consumers when an event occurs. When the message queue detects a document event, it sends a request to the target system or database through the API interface to pull real-time synchronized data.
[0077] In this embodiment of the invention, a time wheel algorithm is used for task scheduling, which can efficiently manage scheduled tasks, avoid the resource waste and time interval errors of traditional scheduled task scheduling, and ensure that tasks are executed precisely at the predetermined time. By setting flexible time intervals and event types, it is possible to precisely control when and how data is pulled, meet the synchronization requirements of different business needs, and combine message queues for real-time monitoring to ensure that data updates from external systems can be synchronized in real time, avoid delays, and improve the system's response speed and real-time performance. The message queue decouples the logic of data pulling and processing, making the system more flexible and easy to expand. The event listening or data processing strategy can be adjusted without affecting the main process.
[0078] Please see Figure 4 The fourth embodiment of the document management method supporting API integration in this invention includes:
[0079] 401. Convert the format of timed or real-time synchronized data to obtain standard format synchronized data;
[0080] In this embodiment, the external system may use different data formats for storage and transmission. In order to ensure that the data can be processed correctly in the target system, the data must be converted into the standard format required by the target system. First, the data format used by the external system is identified, which may include JSON, XML, CSV, etc. According to the needs of the document library, a standard format is designed, and specific code for data conversion is implemented to convert the source format data into the standard format to obtain the standard format synchronized data.
[0081] 402. Use regular expressions and natural language processing techniques to parse the content of the standard format synchronization data to obtain parsed data;
[0082] In this embodiment, regular expressions and natural language processing (NLP) techniques are used to parse the content of the standard format synchronized data, extract specific pattern data from the data, and NLP techniques can perform a deeper level of text understanding on the pattern data to obtain parsed data.
[0083] 403. Use natural language processing techniques to preprocess the parsed data to obtain the processed text. Preprocessing includes word segmentation, part-of-speech tagging, and named entity recognition.
[0084] In this embodiment, natural language processing technology is used to segment the parsed data into smaller units to obtain multiple words, identify the part of speech of each word, and identify specific entities in the text, such as names, locations, organizations, etc.
[0085] 404. Extract key content from the processed text and update the document library based on the key content;
[0086] In this embodiment, key content is extracted from the processed text, that is, information useful to the target task is identified from the preprocessed text. Once the key content is extracted from the text, it needs to be updated in the document library.
[0087] 405. Capture exception information when an API interface encounters an error;
[0088] In this embodiment, when an error occurs in the API interface, the exception information is captured and recorded in the log after the exception is captured.
[0089] 406. Identify the error type of the abnormal information. Error types include network errors, parameter errors, and internal server errors.
[0090] In this embodiment, the error type of the abnormal information is identified. The error types include network errors, parameter errors, and internal server errors. Network errors refer to the inability to establish a connection or problems occurring during the connection process when communicating with an external API. Parameter errors refer to the parameters passed in the request not meeting the API requirements, which may be due to incorrect parameter format, missing required parameters, invalid parameter values, etc. Internal server errors usually refer to errors that occurred when the API server was processing the request.
[0091] 407. Generate correction suggestion information based on the error type;
[0092] In this embodiment, correction suggestions are generated based on the error type. For temporary internal server errors, which may be due to server resource issues, it is recommended to restart the API server. By analyzing the server's error logs, the root cause of the internal error can be identified. If server resources are insufficient, it may be necessary to increase the server's processing capacity, such as by increasing CPU, memory, or optimizing the database connection pool. For frequent database queries, a caching mechanism can be introduced to reduce the pressure on the database. If the error is caused by high concurrency, a load balancing mechanism can be considered to distribute the requests across multiple servers.
[0093] 408. Send the correction suggestion information to the user terminal so that the user terminal can generate and display the correction suggestion page based on the correction suggestion information;
[0094] In this embodiment, it is ensured that the received correction suggestion information is accurate and detailed. For example, the correction suggestion should include information such as the error type, the suggested repair solution, and possible follow-up operations. The correction suggestion information can be transmitted to the user terminal in various ways, such as through API response, WebSocket push, or dynamic data insertion during page rendering. The user terminal generates and displays the correction suggestion page based on the correction suggestion information.
[0095] In this embodiment of the invention, the entire process, through automated data synchronization, parsing, processing, and error capture, reduces manual intervention and improves data processing efficiency and real-time performance. Format conversion and standardization steps ensure data consistency, making subsequent analysis and processing more reliable. Utilizing natural language processing technology for word segmentation, part-of-speech tagging, and named entity recognition enables deep understanding and extraction of key information from the text, providing accurate data support for document library updates. By capturing and analyzing error information and generating corresponding correction suggestions, the system can intelligently handle various anomalies, improving system stability and reliability. By feeding back correction suggestions to the user, clear correction recommendations are provided, enhancing the user experience, helping users quickly resolve problems, and improving system interactivity and user satisfaction.
[0096] The document management method supporting API integration in the embodiments of the present invention has been described above. The document management device supporting API integration in the embodiments of the present invention is described below. Please refer to [link / reference]. Figure 5 One embodiment of the document management device supporting API integration in this invention includes:
[0097] Establish allocation module 501, which is used to establish a user permission mapping relationship table and assign role permissions to different users according to the user permission mapping relationship table;
[0098] The API access token issuance module 502 is used to issue API access tokens to users using the token bucket algorithm when the user has API access permission in the permission set of the role permissions, and then call the API interface based on the API access token.
[0099] A pull module 503 is constructed to build a ring task scheduler using a time wheel algorithm, and the task scheduler uses the API interface to pull timed synchronization data from the external system at a preset time.
[0100] The listening and pulling module 504 is used to listen for document events from external systems in real time based on a message queue, and to trigger the API interface to pull real-time synchronized data based on the document events.
[0101] The conversion and update module 505 is used to convert the format of timed or real-time synchronized data to obtain standard format synchronized data, and update the document library based on the standard format synchronized data.
[0102] In this embodiment, user permission mapping table is used to assign role permissions to different users. When the permission set of a role includes API call permission, a token bucket algorithm is used to issue an API access token to the user. The API interface is called based on the API access token. This allows for control of interface access based on the permissions of different user roles, improving the flexibility and scalability of the document management system and adapting to diverse business scenarios. A time wheel algorithm is used to construct a ring task scheduler. The task scheduler triggers the API interface at preset times to pull timed synchronization data from external systems. Based on a message queue, document events from external systems are monitored in real time. Based on document events, the API interface is triggered to pull real-time synchronization data. Data interaction with external systems is achieved through the API interface, realizing timed and real-time data synchronization, improving the system integration. The timed or real-time synchronized data is converted to a standard format synchronized data. The document library is updated based on the standard format synchronized data, improving the reliability of document management.
[0103] Please see Figure 6 Another embodiment of the document management device supporting API integration in this invention includes:
[0104] Establish allocation module 501, which is used to establish a user permission mapping relationship table and assign role permissions to different users according to the user permission mapping relationship table;
[0105] The API access token issuance module 502 is used to issue API access tokens to users using the token bucket algorithm when the user has API access permission in the permission set of the role permissions, and then call the API interface based on the API access token.
[0106] A pull module 503 is constructed to build a ring task scheduler using a time wheel algorithm, and the task scheduler uses the API interface to pull timed synchronization data from the external system at a preset time.
[0107] The listening and pulling module 504 is used to listen for document events from external systems in real time based on a message queue, and to trigger the API interface to pull real-time synchronized data based on the document events.
[0108] The conversion and update module 505 is used to convert the format of timed or real-time synchronized data to obtain standard format synchronized data, and update the document library based on the standard format synchronized data.
[0109] In this embodiment, the allocation module 501 includes: a configuration unit 5011, used to configure permissions based on a role-based access control algorithm to obtain permission configuration information; an establishment unit 5012, used to establish a user permission mapping table according to the permission configuration information, the user permission mapping table including a user role mapping table, a role permission mapping table and a permission API mapping table; and an allocation unit 5013, used to allocate the corresponding role permissions to different users according to the user permission mapping table.
[0110] In this embodiment, the API access token issuance module 502 includes: a generation and setting unit 5021, used to generate a token bucket using the token bucket algorithm and set the token generation rate and the capacity of the token bucket; an issuance unit 5022, used to issue an API access token to a user using the token bucket when the user has API access permission in the permission set of the role permissions; an API access token issuance unit 5023, used to issue an API interface according to the API access token; a first testing unit 5024, used to perform functional testing on the API interface using equivalence class partitioning and boundary value analysis to obtain a first test result; a second testing unit 5025, used to perform performance testing on the API interface using benchmark testing and load testing to obtain a second test result; an analysis unit 5026, used to analyze the API interface metrics based on the first and second test results, including response time, error rate, and throughput; and an evaluation unit 5027, used to evaluate the stability and reliability of the API interface under high pressure based on response time, error rate, and throughput.
[0111] In this embodiment, the data retrieval module 503 includes: a construction unit 5031, used to construct a ring task scheduler using a time wheel algorithm; a setting unit 5032, used to set the time interval for executing data retrieval tasks in the ring task scheduler; and a first retrieval unit 5033, used to trigger the API interface to retrieve timed synchronization data from an external system according to the time interval.
[0112] In this embodiment, the listening and pulling module 504 includes: a setting definition unit 5041, used to set the event types that can be pulled for data, and define document events according to the event types; a listening unit 5042, used to listen to document events of external systems in real time based on a message queue; and a second pulling unit 5043, used to trigger the API interface to pull real-time synchronized data when the message queue listens to a document event.
[0113] In this embodiment, the conversion and update module 505 includes: a conversion unit 5051, used to convert the format of timed synchronization data or real-time synchronization data to obtain standard format synchronization data; a parsing unit 5052, used to parse the content of the standard format synchronization data using regular expressions and natural language processing technology to obtain parsed data; a preprocessing unit 5053, used to preprocess the parsed data using natural language processing technology to obtain processed text, the preprocessing including word segmentation, part-of-speech tagging and named entity recognition; and an extraction unit 5054, used to extract key content from the processed text and update the document library based on the key content.
[0114] In this embodiment, the system further includes: a capture module 506, used to capture exception information when an error occurs in the API interface; an identification module 507, used to identify the error type of the exception information, including network error, parameter error and server internal error; a generation module 508, used to generate correction suggestion information according to the error type; and a sending module 509, used to send the correction suggestion information to the user terminal so that the user terminal can generate and display a correction suggestion page based on the correction suggestion information.
[0115] above Figure 5 and Figure 6 The document management device supporting API integration in the embodiments of the present invention will be described in detail from the perspective of modular functional entities. The document management device supporting API integration in the embodiments of the present invention will be described in detail from the perspective of hardware processing.
[0116] Figure 7This is a schematic diagram of the structure of a document management device 600 supporting API integration according to an embodiment of the present invention. The document management device 600 supporting API integration can vary significantly due to different configurations or performance. It may include one or more central processing units (CPUs) 610 (e.g., one or more processors) and a memory 620, and one or more storage media 630 (e.g., one or more mass storage devices) for storing application programs 633 or data 632. The memory 620 and storage media 630 can be temporary or persistent storage. The program stored in the storage media 630 may include one or more modules (not shown in the diagram), each module may include a series of instruction operations on the document management device 600 supporting API integration. Furthermore, the processor 610 may be configured to communicate with the storage media 630 and execute a series of instruction operations in the storage media 630 on the document management device 600 supporting API integration to implement the steps of the document management method supporting API integration provided in the above-described method embodiments.
[0117] The document management device 600 supporting API integration may also include one or more power supplies 640, one or more wired or wireless network interfaces 650, one or more input / output interfaces 660, and / or one or more operating systems 631, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc. Those skilled in the art will understand that... Figure 7 The illustrated document management device architecture that supports API integration does not constitute a limitation on document management devices that support API integration. It may include more or fewer components than illustrated, or combine certain components, or have different component arrangements.
[0118] The present invention also provides a computer-readable storage medium, which can be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium, wherein the computer-readable storage medium stores instructions that, when executed on a computer, cause the computer to perform steps of a document management method that supports API integration.
[0119] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described systems, devices, and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0120] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0121] Finally, it should be noted that the above descriptions are merely preferred embodiments of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A document management method supporting API integration, characterized in that, include: Establish a user permission mapping table, and assign role permissions to different users according to the user permission mapping table; When the set of permissions for the role includes API call permissions, the token bucket algorithm is used to issue an API access token to the user, and the API interface is called based on the API access token. A ring-shaped task scheduler is constructed using a time wheel algorithm. The task scheduler is used to trigger the API interface to pull timed synchronization data from the external system at preset times. Based on the message queue, the system listens for document events of the external system in real time and triggers the API interface to pull real-time synchronized data according to the document events. The timed synchronization data or the real-time synchronization data is converted to a standard format synchronization data, and the document library is updated based on the standard format synchronization data.
2. The document management method supporting API integration according to claim 1, characterized in that, The step of establishing a user permission mapping table and assigning role permissions to different users according to the user permission mapping table includes: The role-based access control algorithm is used to configure permissions and obtain permission configuration information. A user permission mapping table is established based on the permission configuration information. The user permission mapping table includes a user role mapping table, a role permission mapping table, and a permission API mapping table. Assign role permissions to different users based on the user permission mapping table.
3. The document management method supporting API integration according to claim 1, characterized in that, When the set of permissions for the role includes API call permissions, an API access token is issued to the user using the token bucket algorithm, and the API interface is called based on the API access token, including: A token bucket is generated using the token bucket algorithm, and the token generation rate and the capacity of the token bucket are set. When the set of permissions for the role includes API call permissions, an API access token is issued to the user using the token bucket. Invoke the API interface based on the API access token; The API interface was functionally tested using equivalence class partitioning and boundary value analysis, and the first test result was obtained. The API interface was subjected to performance testing using benchmarking and load testing methods to obtain the second test result. The metrics of the API interface are analyzed based on the first and second test results, including response time, error rate, and throughput. The stability and reliability of the API interface under high pressure are evaluated based on the response time, the error rate, and the throughput.
4. The document management method supporting API integration according to claim 1, characterized in that, The method employs a time-wheel algorithm to construct a ring-shaped task scheduler, which triggers the API interface at preset times to retrieve timed synchronization data from external systems, including: A ring-shaped task scheduler is constructed using the time wheel algorithm; Set the time interval for executing data fetching tasks in the ring task scheduler; The API interface is triggered to retrieve timed synchronization data from the external system at the specified time interval.
5. The document management method supporting API integration according to claim 1, characterized in that, The method of real-time monitoring of document events from the external system based on a message queue, and triggering the API interface to pull real-time synchronized data based on the document events, includes: Define the event types that can be retrieved, and define document events according to the event types; Real-time monitoring of document events from the external system is performed based on a message queue. When the message queue detects the document event, it triggers the API interface to pull real-time synchronized data.
6. The document management method supporting API integration according to claim 1, characterized in that, The step of converting the timed synchronization data or the real-time synchronization data to a standard format synchronization data, and updating the document library based on the standard format synchronization data, includes: The timed synchronization data or the real-time synchronization data is converted to a standard format synchronization data. The content of the standard format synchronization data is parsed using regular expressions and natural language processing techniques to obtain parsed data; The parsed data is preprocessed using natural language processing techniques to obtain processed text. The preprocessing includes word segmentation, part-of-speech tagging, and named entity recognition. Extract key content from the processed text, and update the document library based on the key content.
7. The document management method supporting API integration according to claim 1, characterized in that, After converting the timed synchronization data or the real-time synchronization data to obtain standard format synchronization data, and updating the document library based on the standard format synchronization data, the process further includes: When an error occurs in the API interface, capture the exception information; Identify the error type of the abnormal information, including network errors, parameter errors, and internal server errors; Generate correction suggestion information based on the error type; The correction suggestion information is sent to the user terminal, so that the user terminal generates and displays a correction suggestion page based on the correction suggestion information.
8. A document management device supporting API integration, characterized in that, include: An allocation module is established to create a user permission mapping table and assign role permissions to different users according to the user permission mapping table. The API access token issuance module is used to issue an API access token to the user using the token bucket algorithm when the user has API access permission in the permission set of the role permissions, and then call the API interface according to the API access token. A pull module is constructed to build a ring task scheduler using a time wheel algorithm, and the task scheduler is used to trigger the API interface to pull timed synchronization data from the external system at a preset time. The listening and fetching module is used to listen for document events of the external system in real time based on a message queue, and trigger the API interface to fetch real-time synchronized data according to the document events. The conversion and update module is used to convert the timed synchronization data or the real-time synchronization data into a standard format synchronization data, and update the document library based on the standard format synchronization data.
9. A document management device that supports API integration, characterized in that, The document management device that supports API integration includes: a memory and at least one processor, wherein the memory stores instructions; At least one of the processors invokes the instructions in the memory to cause the API-integrated document management device to perform the steps of the API-integrated document management method as claimed in any one of claims 1-7.
10. A computer-readable storage medium storing instructions thereon, characterized in that, When the instructions are executed by the processor, they implement the steps of the document management method supporting API integration as described in any one of claims 1-7.
Citation Information
Cited By
System throughput optimization control method and device, electronic equipment and storage medium
CN121442006A