Electronic official document processing method and system based on multiple tenants and storage medium
By setting up a unique tenant for each user and setting up a Schema-level isolation zone in the electronic document service system and database, the problem of waste of existing electronic document software resources is solved, and efficient resource utilization and performance improvement is achieved.
Patent Information
- Application Number
- CN202411659154.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-20
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2044-11-20
AI Technical Summary
The service deployment of existing electronic document software cannot efficiently use system resources, resulting in waste of resources.
The multi-tenant-based electronic document processing method is adopted. By setting up a unique tenant for each user and setting up a Schema-level isolation area in the electronic document service system and database, the logical isolation of data of different tenants is realized, and the electronic document service system and database resources are shared.
It effectively saves resource overhead, improves system resource utilization, and improves performance and system stability.
Smart Images

Figure CN119645958A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a multi-tenant-based electronic document processing method, system and storage medium. Background Art
[0002] Previously, electronic document software was deployed and managed by independent service deployment, independent data storage, independent upgrade and operation for each unit. Although this method has a high level of data isolation, it also brings unnecessary hardware and software resource overhead and causes unnecessary resource waste. Therefore, how to use electronic document software based on high resource utilization has become an urgent problem that needs to be solved. Summary of the invention
[0003] The present invention provides a multi-tenant-based electronic document processing method, system and storage medium to solve the problem that the existing service deployment using document software cannot efficiently use system resources, resulting in resource waste.
[0004] In a first aspect, the present invention provides a multi-tenant-based electronic document processing method, comprising:
[0005] A unique tenant is set up for each user, and multiple tenants share a set of electronic document service systems and a set of database services;
[0006] The data of each tenant is isolated from each other in the electronic document service system and the database service, that is, a unique Schema-level isolation zone is set for each tenant in the electronic document service system and the database to achieve logical isolation of data of different tenants in the electronic document service system and the database;
[0007] Establish an association between the user's data operation and the tenant corresponding to the user, so that the data operation is completed only in the Schema-level isolation area corresponding to the tenant, and when performing database operations, operate the user data in the corresponding Schema-level isolation area according to the user's user information, and dynamically store the operation data in the Schema-level isolation area.
[0008] Optionally, the dynamically storing the operation data in the Schema-level isolation area includes: storing the structured data generated by the user in a schema-based manner in the Schema-level isolation area corresponding to the tenant to which the user belongs, and dynamically generating a persistent directory based on the user's user information to store unstructured data in the persistent directory of the tenant corresponding to the user.
[0009] Optionally, the method further comprises: storing public data as shared data in a public Schema area in the electronic document service system and the database, wherein the public data comprises menus, dictionaries and configuration information.
[0010] Optionally, the user's log and situation data are independently stored in a time-partitioned area in the Schema-level isolation area corresponding to the user.
[0011] Optionally, the method further includes: setting a top-level system administrator, wherein the top-level system administrator has the authority to create a new tenant and create a Schema-level isolation area corresponding to the new tenant.
[0012] Optionally, establishing an association between a user's data operation and a tenant corresponding to the user includes: retrieving tenant information of a tenant corresponding to a user who issues a data operation request based on a data operation request issued by the user through a preset tenant filter, and storing the tenant information in the data operation information of the user context through a preset thread decorator, so that in subsequent processing, the user's operation information is directly connected to the Schema-level isolation area corresponding to the user.
[0013] Optionally, the method further includes: dynamically storing the data generated by the operation data in the Schema-level isolation area corresponding to the user according to the user information of the user corresponding to the current data operation through a preset tenant filter, a preset electronic document thread decorator and a preset persistence layer interceptor.
[0014] Optionally, dynamically storing the data generated by the operation data in the Schema-level isolation area corresponding to the user according to the user information of the user corresponding to the current data operation through a preset tenant filter, a preset electronic document thread decorator, and a preset persistence layer interceptor includes:
[0015] Retrieving tenant information of a tenant corresponding to a user who issues a data operation request based on a data operation request issued by the user through a preset tenant filter;
[0016] The tenant information is stored in the data operation information of the user context by presetting the thread decorator, so that in subsequent processing, the user's operation information is directly connected to the Schema-level isolation area corresponding to the user;
[0017] The SQL statement is processed through the preset persistence layer interceptor, and the data generated by the operation data is dynamically stored in the Schema-level isolation area corresponding to the user.
[0018] In a second aspect, the present invention provides a multi-tenant-based electronic document processing system for implementing any of the above methods, the system comprising: an electronic document service system and a database service;
[0019] A setting unit is used to set a tenant uniquely corresponding to each user, set multiple tenants to share a set of electronic document service systems and a set of database services, and set the data of each tenant to be isolated from each other in the electronic document service system and the database service, that is, by setting a unique Schema-level isolation area for each tenant in the electronic document service system and the database, so as to achieve logical isolation of data of different tenants in the electronic document service system and the database;
[0020] The processing unit is used to establish an association between a user's data operation and a tenant corresponding to the user, so that the data operation is completed only in the Schema-level isolation area corresponding to the tenant, and when performing database operations, the user data in the corresponding Schema-level isolation area is operated according to the user's user information, and the operation data is dynamically stored in the Schema-level isolation area.
[0021] In a third aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, and when the program is executed by a processor, the program implements any of the above-mentioned multi-tenant-based electronic document processing methods.
[0022] The beneficial effects of the present invention are as follows:
[0023] The present invention adopts a service sharing and data logic isolation mode. All tenants in this user mode share a set of services and a database, but each tenant has its own Schema for storing data related to its own tenant, thereby greatly saving resource overhead. That is, the method of the present invention not only saves more database server resources, but also does not occupy a large amount of server system resources due to too many database instances when the software initializes the database connection pool resources, thereby significantly improving performance and system stability.
[0024] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0026] Figure 1 is a schematic diagram of a data storage structure provided by an embodiment of the present invention;
[0027] Figure 2 This is a schematic diagram of a process for creating a new tenant provided by an embodiment of the present invention;
[0028] Figure 3 is a flow chart of a user access control method provided by an embodiment of the present invention;
[0029] Figure 4 is a flow chart of a user access control method provided by an embodiment of the present invention; DETAILED DESCRIPTION
[0030] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0031] Aiming at the problem that the existing service deployment using official document software cannot efficiently use system resources, resulting in resource waste, an embodiment of the present invention provides an electronic official document processing method based on multi-tenancy, including:
[0032] Step 101: A tenant uniquely corresponding to each user is set, and multiple tenants are set to share a set of electronic document service systems and a set of database services;
[0033] Among them, the electronic document processing system in the embodiment of the present invention can correspond to an organization, a group or a company. Taking the organization as an example, the organization may have multiple different departments, and the method described in the embodiment of the present invention is to treat the department as a user and set a unique corresponding tenant for the user in the electronic document processing system. Through the setting, all tenants share an electronic document processing system, but the information between each tenant is isolated from each other, thereby improving the utilization rate of system resources while effectively ensuring the privacy of each tenant's information.
[0034] Step 102: Data of each tenant is isolated from each other in the electronic document service system and the database service, that is, a unique Schema-level isolation zone is set for each tenant in the electronic document service system and the database, so as to achieve logical isolation of data of different tenants in the electronic document service system and the database;
[0035] In order to ensure the security of data of all users, the embodiment of the present invention is configured so that the data of each tenant is isolated from each other in the electronic document service system and the database service, that is, a Schema-level isolation area is set for each tenant.
[0036] Step 103: Establish an association between the user's data operation and the tenant corresponding to the user, so that the data operation is completed only in the Schema-level isolation area corresponding to the tenant, and when performing database operations, operate the user data in the corresponding Schema-level isolation area according to the user's user information, and dynamically store the operation data in the Schema-level isolation area.
[0037] After setting up the Schema-level isolation area, establish users and tenants, that is, establish an association between the user and its corresponding Schema-level isolation area, so that the user can only operate the data in the corresponding isolation area, and the processed data is also stored in the isolation area.
[0038] Specifically, an embodiment of the present invention stores the structured data generated by the user in a schema-level isolation area corresponding to the tenant to which the user belongs, and dynamically generates a persistent directory based on the user's user information to store unstructured data in the persistent directory of the tenant corresponding to the user.
[0039] In order to further save resource usage, the embodiment of the present invention is also provided with a public Schema area, by storing public data as shared data in the public Schema area of the electronic document service system and the database, that is, the embodiment of the present invention stores public data such as menus, dictionaries and configuration information in the public Schema area.
[0040] By setting up a public Schema area, public data can be stored publicly, thus avoiding repeated storage of data in different Schema-level isolation areas, which can further save the consumption of system resources.
[0041] In addition, in order to facilitate searching, the present invention also independently stores the user's log and situation data in the time-partitioned area in the Schema-level isolation area corresponding to the user.
[0042] Through this standardized data storage method, on the one hand, effective data storage can be achieved, and on the other hand, it can also facilitate the subsequent retrieval and use of data at any time. Therefore, this can also greatly save the consumption of system resources.
[0043] The present invention can greatly save system resource consumption by setting up a public Schema area, effectively storing user logs and situation data, and dynamically generating a persistent directory based on user information to store unstructured data in the persistent directory of the tenant corresponding to the user, thereby greatly improving the processing efficiency of electronic documents and further greatly improving the user experience.
[0044] See also Figure 1 The method described in the embodiment of the present invention is based on the concept of service sharing and data logic isolation mode. By adopting Schema-level isolation in the database design of the electronic document processing software, in addition to public data, an independent Schema is created for tenant data, and structured data is stored in the database by unit in different modes; for unstructured data, it is isolated and stored by unit and directory in the storage resource. Based on performance and resource considerations, public data (such as menus, dictionaries, configuration information, etc.) is stored independently as shared data, and logs, status and other data are stored independently by year partitions.
[0045] Through the above, the embodiment of the present invention is that multiple units share a set of electronic official document services and share hardware and software resources. This can not only ensure that there is no excessive waste of resource expenditure on electronic official document software, but also that the operation and maintenance manpower and costs only need to maintain one set of electronic official document software. At the same time, each unit uses a unified version of electronic official documents, and can obtain the latest functions and problem fixes at the same time. And the embodiment of the present invention can ensure that the data of each unit are independent of each other and do not affect each other through settings. In the case of sharing a set of electronic official document processing software, the independent storage of the data of each unit can still be guaranteed, and it is more conducive to the unit data not affecting the data of other units when migrating in and out.
[0046] In specific implementation, the method described in the embodiment of the present invention further sets a top-level system administrator, and the top-level system administrator has the authority to create a new tenant and create a Schema-level isolation area corresponding to the new tenant.
[0047] The top system administrator is responsible for creating new tenants, revoking tenants, and adjusting various tenant permissions. For example, because Tenant A corresponds to the comprehensive management department, this tenant can view the permissions of a certain isolation area or a certain target of other tenants. Tenant B is the highest leader of the unit and has the permission to view a certain isolation area of a certain department, and so on.
[0048] In addition, when creating a new tenant, the top-level system administrator also has the authority to allocate an isolation area for the new tenant. That is, after the top-level system administrator creates a new tenant, he or she must also allocate an isolation area to the new tenant and enable the new user to use the newly created tenant normally through settings.
[0049] Specifically, see Figure 2 In the embodiment of the present invention, in the tenant design, a top-level system administrator is set to create a new tenant, and at the same time, the administrator can select an organization managed under the tenant to create an isolation scope for the tenant, and each organization exists under only one tenant;
[0050] The electronic document processing software adds entity annotations to distinguish the tenant strategy of the entity class and whether it is a multi-tenant database table. In the process of creating a new tenant, a tenant corresponding mode is created, and a set of business tables unique to the mode is created in this mode.
[0051] At the same time, a file directory for distinguishing tenant identifiers is created under the persistent directory of unstructured data of the electronic document software for independent storage of unstructured data.
[0052] Furthermore, the embodiment of the present invention establishes an association between a user's data operation and a tenant corresponding to the user, by retrieving tenant information of the tenant corresponding to the user who issues the data operation request based on the data operation request issued by the user through a preset tenant filter, and stores the tenant information in the data operation information of the user context through a preset thread decorator, so that in subsequent processing, the user's operation information is directly connected to the Schema-level isolation area corresponding to the user.
[0053] Furthermore, in the embodiment of the present invention, the method further includes:
[0054] By presetting tenant filters, presetting electronic document thread decorators and presetting persistence layer interceptors, the data generated by the operation data is dynamically stored in the Schema-level isolation area corresponding to the user according to the user information of the user corresponding to the current data operation.
[0055] For specific implementation, see Figure 3 The embodiment of the present invention is based on a service sharing and data logic isolation model. Since the same database stores the business data of multiple tenants, it is necessary to ensure that each user can only access the business data of the tenant to which he belongs after logging in.
[0056] After the user logs in to the system using the single sign-on (SSO) authentication mechanism, the electronic document software adds a tenant filter to store and retrieve the corresponding tenant information based on the user when performing data operations. Before the user requests data operations, the thread stores the tenant information in the tenant context by using a thread decorator when processing the request, ensuring that when processing concurrent requests, the user can also use specific tenants and data sources in subsequent processing.
[0057] In specific implementation, the preset tenant filter, the preset electronic document thread decorator and the preset persistence layer interceptor in the embodiment of the present invention dynamically store the data generated by the operation data in the Schema-level isolation area corresponding to the user according to the user information of the user corresponding to the current data operation, including:
[0058] Retrieving tenant information of a tenant corresponding to a user who issues a data operation request based on a data operation request issued by the user through a preset tenant filter;
[0059] The tenant information is stored in the data operation information of the user context by presetting the thread decorator, so that in subsequent processing, the user's operation information is directly connected to the Schema-level isolation area corresponding to the user;
[0060] The SQL statement is processed through the preset persistence layer interceptor, and the data generated by the operation data is dynamically stored in the Schema-level isolation area corresponding to the user.
[0061] Specifically, the embodiment of the present invention is based on a service sharing and data logic isolation model. Because each unit has an independent database model, when performing database operations, it is necessary to dynamically execute the SQL statement of the corresponding schema according to the tenant information. Therefore, the mybatis-plus persistence layer framework needs to be modified and rewritten.
[0062] For specific implementation, see Figure 4 The method described in the embodiment of the present invention is to obtain the current schema from the thread context when performing data operations, and create a class to hold the information of the current schema; by rewriting the sql interceptor of mybatis-plus, when processing sql statements, according to the custom annotations of the entity class, determine which tables are fixed modes and which tables are tenant modes, and dynamically replace the table names with the tenant information in the fixed mode and the context, so as to achieve the electronic document processing software supporting multi-schema operations.
[0063] That is to say, the method described in the embodiment of the present invention modifies the background code of the electronic document processing software, adds tenant filters and thread decorators, and rewrites the SQL interceptor of the persistence layer, thereby ensuring that complex logical SQL statements and multi-mode SQL processing statements can still accurately and reliably query the corresponding data based on the user's tenant information.
[0064] By comparison, it can be seen that compared with an independent database, the method described in the present invention saves huge amounts of resource overhead and application pressure, not only saving more database server resources, but also when the software initializes database connection pool resources, it will not occupy a large amount of server system resources due to too many database instances, thereby significantly improving performance and system stability.
[0065] Accordingly, an embodiment of the present invention further provides a multi-tenant-based electronic document processing system for implementing any of the above methods, the system comprising: an electronic document service system and a database service;
[0066] A setting unit is used to set a tenant uniquely corresponding to each user, set multiple tenants to share a set of electronic document service systems and a set of database services, and set the data of each tenant to be isolated from each other in the electronic document service system and the database service, that is, by setting a unique Schema-level isolation area for each tenant in the electronic document service system and the database, so as to achieve logical isolation of data of different tenants in the electronic document service system and the database;
[0067] Specifically, the setting unit of the embodiment of the present invention is used for the confidentiality officer to set the unit to be sent when sending the electronic document, and to set the tenant information of the selected unit. The selected unit may be a unit under the same tenant, or a cross-tenant unit under different tenants. According to the set unit information, it is necessary to set the tenant information of the corresponding unit, and set the context information of the electronic document processing software;
[0068] The processing unit is used to establish an association between a user's data operation and a tenant corresponding to the user, so that the data operation is completed only in the Schema-level isolation area corresponding to the tenant, and when performing database operations, the user data in the corresponding Schema-level isolation area is operated according to the user's user information, and the operation data is dynamically stored in the Schema-level isolation area.
[0069] That is, in the embodiment of the present invention, the processing unit processes the distribution of electronic documents to different units and tenant associations, classifies the distribution units according to the tenant information, and sets the tenant information for the system context when distributing to different units, to ensure that when distributing to the current tenant unit, it will not be distributed to other units. After processing the distribution information of the current tenant, continue to process other tenant information.
[0070] In other words, the embodiment of the present invention can realize service sharing and data isolation, that is, multiple units share a set of electronic document services, but the data are logically isolated. This method can solve the current problems of high electronic document software resource overhead, high operation and maintenance costs, and difficulty in version control.
[0071] In addition, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, any of the above-mentioned multi-tenant-based electronic document processing methods is implemented. The relevant contents of the storage medium and system embodiments of the present invention can be understood by referring to the relevant contents of the method embodiments of the present invention, and will not be discussed in detail here.
[0072] Although the preferred embodiments of the present invention have been disclosed for illustrative purposes, those skilled in the art will appreciate that various modifications, additions and substitutions are possible, and thus, the scope of the present invention should not be limited to the above embodiments.
Claims
1. A multi-tenant-based electronic document processing method, characterized in that: include: A unique tenant is set up for each user, and multiple tenants share a set of electronic document service systems and a set of database services; The data of each tenant is isolated from each other in the electronic document service system and the database service, that is, a unique Schema-level isolation zone is set for each tenant in the electronic document service system and the database to achieve logical isolation of data of different tenants in the electronic document service system and the database; Establish an association between the user's data operation and the tenant corresponding to the user, so that the data operation is completed only in the Schema-level isolation area corresponding to the tenant, and when performing database operations, operate the user data in the corresponding Schema-level isolation area according to the user's user information, and dynamically store the operation data in the Schema-level isolation area.
2. The method according to claim 1, characterized in that The dynamically storing the operation data in the Schema-level isolation area includes: The structured data generated by the user is stored in the Schema-level isolation area corresponding to the tenant where the user is located, and a persistent directory is dynamically generated based on the user's user information to store the unstructured data in the persistent directory of the tenant corresponding to the user.
3. The method according to claim 2, characterized in that The method further comprises: The public data is stored as shared data in the public Schema area of the electronic document service system and the database, wherein the public data includes menus, dictionaries and configuration information.
4. The method according to claim 2, characterized in that: The user's logs and situation data are stored independently in the time-partitioned area in the Schema-level isolation area corresponding to the user.
5. The method according to claim 1, characterized in that The method further comprises: A top-level system administrator is set, and the top-level system administrator has the authority to create a new tenant and create a Schema-level isolation area corresponding to the new tenant.
6. The method according to any one of claims 1 to 5, characterized in that: The operation of establishing the user's data is associated with the tenant corresponding to the user, including: The tenant information of the tenant corresponding to the user who issues the data operation request is retrieved based on the data operation request issued by the user through a preset tenant filter, and the tenant information is stored in the data operation information of the user context through a preset thread decorator, so that in subsequent processing, the user's operation information is directly connected to the Schema-level isolation area corresponding to the user.
7. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: By presetting tenant filters, presetting electronic document thread decorators and presetting persistence layer interceptors, the data generated by the operation data is dynamically stored in the Schema-level isolation area corresponding to the user according to the user information of the user corresponding to the current data operation.
8. The method according to claim 7, characterized in that The method of dynamically storing the data generated by the operation data in the Schema-level isolation area corresponding to the user according to the user information of the user corresponding to the current data operation through the preset tenant filter, the preset electronic document thread decorator and the preset persistence layer interceptor includes: Retrieving tenant information of a tenant corresponding to a user who issues a data operation request based on a data operation request issued by the user through a preset tenant filter; The tenant information is stored in the data operation information of the user context by presetting the thread decorator, so that in subsequent processing, the user's operation information is directly connected to the Schema-level isolation area corresponding to the user; The SQL statement is processed through the preset persistence layer interceptor, and the data generated by the operation data is dynamically stored in the Schema-level isolation area corresponding to the user.
9. A multi-tenant-based electronic document processing system for implementing the method described in any one of claims 1 to 8, characterized in that: The system includes: an electronic document service system and a database service system; A setting unit is used to set a tenant uniquely corresponding to each user, set multiple tenants to share a set of electronic document service systems and a set of database services, and set the data of each tenant to be isolated from each other in the electronic document service system and the database service, that is, by setting a unique Schema-level isolation area for each tenant in the electronic document service system and the database, so as to achieve logical isolation of data of different tenants in the electronic document service system and the database; The processing unit is used to establish an association between a user's data operation and a tenant corresponding to the user, so that the data operation is completed only in the Schema-level isolation area corresponding to the tenant, and when performing database operations, the user data in the corresponding Schema-level isolation area is operated according to the user's user information, and the operation data is dynamically stored in the Schema-level isolation area.
10. A computer-readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the multi-tenant-based electronic document processing method according to any one of claims 1 to 8.
Citation Information
Patent Citations
SaaS application based global configuration multi-tenant dynamic data source system
CN106503163A
Multi-tenant database management and control method and system and storage medium
CN113535723A
Data routing method and device based on multiple tenants
CN118646705A
Multi-tenancy in database namespace
US20110276584A1
Methods for enhancing a legacy single tenant application system to a multi-tenant application system with minimal changes
US20180314746A1