Report management method and device, electronic equipment, medium and product
By creating dedicated accounts and personalized report template libraries for tenants, combined with secure data access channels and access control, the problems of automated management and data security in multi-tenant reporting systems are solved, achieving efficient and secure report generation and management.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING TOPSEC NETWORK SECURITY TECH
- Filing Date
- 2025-12-29
- Publication Date
- 2026-04-21
AI Technical Summary
In existing multi-tenant reporting systems, report generation and management rely on manual operations, which is inefficient, makes it difficult to automate the entire process, fails to meet personalized needs, and makes it difficult to guarantee data security and compliance auditing.
By creating dedicated accounts for tenants, building a personalized report template library, establishing a secure data access channel, implementing scheduled reporting tasks, automatically extracting data to populate templates and generate reports, and distributing and auditing reports, combined with data isolation and access control mechanisms, data security and compliance are ensured.
It has achieved automated management of the entire report lifecycle, improved work efficiency, met personalized needs, ensured data security and compliance auditing, reduced human error, and prevented data leakage and unauthorized access.
Smart Images

Figure CN121902199A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data management technology, specifically to a report management method, apparatus, electronic device, readable storage medium, and computer program product. Background Technology
[0002] In the digital age, business systems based on multi-tenant architecture are widely used, and different tenants have personalized requirements for report format, content, and generation cycle. Currently, report generation and management in such systems mainly rely on manual operations. For example, administrators need to manually populate data into a fixed template and trigger the generation task. This approach is not only inefficient and error-prone, but also makes it difficult to achieve fully automated control of the entire process from template customization and data population to report distribution and auditing. Furthermore, it cannot effectively meet the stringent requirements for data security, version traceability, and compliance auditing in a multi-tenant environment. Summary of the Invention
[0003] In view of the above problems, this application provides a report management method, apparatus, electronic device, readable storage medium and computer program product, which can solve the problems of lack of automated management of the entire report lifecycle in multi-tenant environments and difficulties in data security and auditing.
[0004] Firstly, this application provides a report management method, including: Create a tenant account based on the received registration request; A personalized report template library associated with the tenant account is built based on the configuration operations entered by the administrator and the preset template components. Establish a secure data access channel based on the production database connection information configured by the administrator; Based on the task configuration information entered by the administrator and the personalized report template library, create a scheduled report task corresponding to the tenant account; When the scheduled reporting task is triggered, raw production data is obtained from the production database through the data access channel; Generate a target report file based on the original production data and the target report template specified by the scheduled report task; The target report file is distributed according to the preset distribution rules, and report version records and audit logs are created.
[0005] In the above technical solution, this method can achieve the scheduled automated execution of reporting tasks by creating exclusive accounts for tenants and building an associated personalized report template library, combined with the establishment of a secure data access channel. At the same time, after the task is triggered, production data is automatically extracted, specified templates are filled to generate reports, and distribution, version recording and audit log creation are completed. This can not only efficiently meet the personalized reporting needs of different tenants, but also reduce human error through full-process automated management. At the same time, with the help of data access security mechanisms and complete version and audit records, data security and compliance audit requirements in multi-tenant scenarios are effectively guaranteed.
[0006] In some implementations, after creating a tenant account based on the received registration request, the method further includes: Generate the account identifier for the tenant account based on the registration request; Assign an independent logical storage partition to the tenant account based on the account identifier; Based on the security requirement level of the tenant account, a corresponding secure isolation database is established for the tenant account in the distributed database cluster; Create a separate file storage directory for the tenant account; An access token is generated based on the account identifier and the data operation permission mask corresponding to the tenant account.
[0007] In the above technical solution, the method can achieve physical and logical dual isolation of data between multiple tenants by generating unique identifiers for tenant accounts, allocating independent logical storage partitions and file storage directories, and establishing a secure isolation database. At the same time, by generating access tokens based on account identifiers and data operation permission masks, the method can accurately control the scope of tenant data access, build a solid data security defense line in a multi-tenant environment from the underlying storage and permission levels, and effectively avoid the risks of data leakage and unauthorized access between different tenants.
[0008] In some implementations, the step of constructing a personalized report template library associated with the tenant account based on the configuration operations input by the administrator and preset template components includes: Receive operation commands triggered by the administrator selecting a basic template and dragging components in the visual interface; An initial report template containing dynamic data placeholders, formatting settings, and conditional judgment logic is constructed based on the operation instructions. Based on the template attribute instructions input by the administrator, the attributes of the data table component in the initial report template are set to obtain a preliminary configuration template; Based on the chart configuration instructions input by the administrator, the data source, chart attributes, and preview effect settings of the line chart component in the initial configuration template are configured to obtain a personalized report template. All configured personalized report templates are stored in the secure, isolated database of the tenant account to form a personalized report template library.
[0009] In the above technical solution, the method can simplify the construction process of personalized report templates by relying on the drag-and-drop operation and component configuration of the visual interface, allowing administrators to quickly complete the template design that includes dynamic data placeholders and conditional judgment logic without complex coding; at the same time, by configuring the fine attributes and data sources of components such as tables and line charts, it can accurately match the tenant's report format and content requirements, and store the configured template in the tenant's exclusive secure isolation database, thereby ensuring the tenant's exclusive rights and security of the template.
[0010] In some implementations, establishing a secure data access channel based on the production database connection information configured by the administrator includes: Obtain the connection configuration information for the production database required by the tenant account; Based on the connection configuration information, establish a communication connection with the production database; When the communication connection test is valid, and after passing the query test and permission verification, a secure data access channel is established between the database and the production database based on the connection configuration information.
[0011] In the above technical solution, the method can obtain the connection configuration information of the tenant's production database and establish a communication connection. Combined with a multi-verification mechanism of connection testing, query testing and permission verification, it can ensure the stability and legitimacy of the data access channel. At the same time, the constructed secure data access channel can realize compliant data interaction between the tenant and the production database, effectively avoiding the risk of unauthorized data access.
[0012] In some implementations, creating a scheduled reporting task corresponding to the tenant account based on the task configuration information input by the administrator and the personalized report template library includes: The specified target report template is determined from the personalized report template library based on the task configuration information entered by the administrator; An initial report task is created, and the initial report task is customized according to the task configuration information and the target report template to obtain a scheduled report task.
[0013] In the above technical solution, the method can accurately match the target template in the personalized report template library based on the administrator's task configuration information, and generate scheduled report tasks through targeted personalized configuration of the initial report task, thereby ensuring that the report task is accurately matched with the tenant's needs, and providing clear task guidance for the automatic triggering, data filling and generation of subsequent reports.
[0014] In some implementations, obtaining raw production data from the production database through the data access channel includes: Determine the target report template specified for the scheduled reporting task; Based on the data requirements defined in the target report template, connect to the production database through the secure data access channel; Based on the pre-written structured query statement and the data requirements, raw production data is obtained from the production database.
[0015] In the above technical solution, the method can connect to the production database through a secure data access channel based on the data requirements defined in the target report template, and accurately obtain the original production data by combining structured query statements. This ensures a high degree of matching between the data and the report requirements, while relying on the secure channel to ensure the compliance and security of the data transmission process.
[0016] In some implementations, generating a target report file based on the original production data and the target report template specified by the scheduled reporting task includes: The raw production data is preprocessed to obtain preprocessed data; A structured data object is generated based on the preprocessed data; Load the target report template specified by the scheduled report task; A target report file is generated based on the structured data object and the target report template.
[0017] In the above technical solution, the method can achieve efficient adaptation of data and target report template by preprocessing and structuring the raw production data, thereby accurately generating target report files that meet the personalized needs of tenants, and thus ensuring the accuracy of report data and the standardization of format.
[0018] In some implementations, the creation of report version records and audit logs includes: Collect task execution data and key operational events for this scheduled report task; A report version record is created based on the task execution data, and an audit log is generated based on the key operation events; Store the report version record and the audit log.
[0019] In the above technical solution, the method can generate corresponding report version records and audit logs by collecting the execution data and key operation events of the scheduled reporting tasks and complete the storage, thereby realizing traceable management of the entire life cycle of the report. This allows tenants to easily view the differences between different versions of the report while meeting the strict requirements of compliance auditing in multi-tenant scenarios and effectively avoiding risks such as data tampering and improper operation.
[0020] Secondly, this application provides a report management device, comprising: The account creation unit is used to create tenant accounts based on the received registration requests; The template building unit is used to build a personalized report template library associated with the tenant account based on the configuration operations input by the administrator and preset template components; The channel establishment unit is used to establish a secure data access channel based on the production database connection information configured by the administrator. The task creation unit is used to create a scheduled report task corresponding to the tenant account based on the task configuration information input by the administrator and the personalized report template library. The acquisition unit is used to acquire raw production data from the production database through the data access channel when the timed reporting task is triggered. The report generation unit is used to generate a target report file based on the original production data and the target report template specified by the scheduled report task; A distribution unit is used to distribute the target report file according to preset distribution rules; The audit unit is used to create report version records and audit logs.
[0021] In the above technical solution, the device can create exclusive accounts for tenants and build an associated personalized report template library. Combined with the establishment of a secure data access channel, it can realize the scheduled automated execution of reporting tasks. At the same time, after the task is triggered, it automatically extracts production data, fills the specified template to generate a report, and completes distribution, version recording and audit log creation. It can not only efficiently meet the personalized reporting needs of different tenants, but also reduce human operation errors through full-process automated management. At the same time, with the help of data access security mechanisms and complete version and audit records, it can effectively ensure data security and compliance audit requirements in multi-tenant scenarios.
[0022] Thirdly, this application provides an electronic device including a memory and a processor, the memory storing a computer program, and the processor running the computer program to cause the electronic device to perform the report management method described in any one of the first aspects.
[0023] Fourthly, this application provides a readable storage medium storing a computer program, which, when executed by a processor, performs the report management method described in any one of the first aspects.
[0024] Fifthly, this application provides a computer program product comprising a computer program that, when executed by a processor, performs the report management method described in any one of the first aspects.
[0025] The beneficial effects of this application are: it can achieve automated management of the entire lifecycle of reports, from template customization and data filling to generation and distribution, through task scheduling and automated processes, thereby greatly reducing manual intervention, improving work efficiency and reducing errors; It can also provide tenants with highly flexible report template customization functions based on FreeMarker's template management mechanism, thereby quickly responding to the diverse needs of different tenants and improving tenant satisfaction; Furthermore, through reasonable data isolation and access control mechanisms, it can ensure the consistency and security of data among tenants in a multi-tenant environment, thereby effectively preventing data leakage and accidental operations. It also features comprehensive report version management capabilities, making it easy for tenants to track report change history; meanwhile, detailed audit logs provide strong support for enterprise compliance and regulatory requirements. Attached Figure Description
[0026] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0027] Figure 1 This is a flowchart illustrating the report management method in some embodiments of this application; Figure 2 This is a system architecture diagram of the report management system in some embodiments of this application; Figure 3 This is a schematic diagram of the structure of the report management device in some embodiments of this application; Figure 4 This is a schematic diagram of the structure of an electronic device in some embodiments of this application. Detailed Implementation
[0028] The embodiments of the technical solution of this application will now be described in detail with reference to the accompanying drawings. These embodiments are only used to more clearly illustrate the technical solution of this application and are therefore merely examples, and should not be used to limit the scope of protection of this application.
[0029] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the application; the terms “comprising” and “having”, and any variations thereof, in the specification, claims, and foregoing description of the drawings are intended to cover non-exclusive inclusion.
[0030] In the description of the embodiments of this application, technical terms such as "first" and "second" are used only to distinguish different objects and should not be construed as indicating or implying relative importance or implicitly specifying the number, specific order, or primary and secondary relationship of the indicated technical features. In the description of the embodiments of this application, "multiple" means two or more (including two), similarly, "multiple sets" refers to two or more sets (including two sets), and "multiple pieces" refers to two or more pieces (including two pieces) unless otherwise explicitly defined.
[0031] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0032] In the description of the embodiments in this application, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this document generally indicates that the preceding and following related objects have an "or" relationship.
[0033] In the digital age, business systems based on multi-tenant architecture are widely used, and different tenants have personalized requirements for report format, content, and generation cycle. Currently, the generation and management of reports in such systems mainly rely on manual operations; for example, administrators need to manually fill data into a fixed template and trigger the generation task.
[0034] However, this approach is not only inefficient and error-prone, but also makes it difficult to achieve fully automated control of the entire process from template customization and data population to report distribution and auditing. Furthermore, it cannot effectively meet the stringent requirements for data security, version traceability, and compliance auditing in a multi-tenant environment.
[0035] To address the aforementioned technical issues, this application provides a report management method. This method automates the entire lifecycle management of multi-tenant reports based on FreeMarker, thereby resolving problems such as the lack of automated processes, insufficient flexibility in template customization, difficulty in ensuring data consistency and security, and challenges in report version management and auditing in multi-tenant report management.
[0036] like Figure 1 As shown, some embodiments of this application provide a report management method, which includes: S101. Create a tenant account based on the received registration request; S102. Based on the configuration operations entered by the administrator and the preset template components, construct a personalized report template library associated with the tenant account; S103. Establish a secure data access channel based on the production database connection information configured by the administrator; S104. Based on the task configuration information and personalized report template library entered by the administrator, create a scheduled report task corresponding to the tenant account; S105. When the scheduled reporting task is triggered, the raw production data is obtained from the production database through the data access channel; S106. Generate a target report file based on the original production data and the target report template specified in the scheduled reporting task; S107. Distribute the target report file according to the preset distribution rules, and create report version records and audit logs.
[0037] In some embodiments, in a multi-tenant architecture business system, a tenant refers to a group of users who share the same set of system software but have independent business data, configuration and functional permissions; simply put, they are independent users of the system.
[0038] In some embodiments, a tenant account refers to a dedicated account created based on a received registration request, used to identify different tenants and support tenants in performing related operations such as configuring report templates, creating report tasks, and viewing reports.
[0039] In some embodiments, a personalized report template library refers to a collection of various templates that meet the personalized reporting needs of a tenant, built based on configuration operations entered by the administrator and preset template components, and associated with a tenant account.
[0040] In some embodiments, a secure data access channel refers to a transmission link established based on production database connection information configured by the administrator, used to enable secure and compliant data interaction between the tenant and the production database when a scheduled reporting task is triggered.
[0041] In some embodiments, a scheduled reporting task refers to a task created based on the task configuration information entered by the administrator and a personalized report template library, corresponding to a tenant account, and capable of automatically triggering and executing processes such as report generation and distribution according to preset rules.
[0042] In some embodiments, raw production data refers to basic business data that is directly obtained from the production database through a secure data access channel when a scheduled reporting task is triggered, without any processing.
[0043] In some embodiments, the target report file refers to the final report carrier that meets the tenant's needs, generated after data processing and template filling based on the target report template specified by the original production data and the scheduled reporting task.
[0044] In some embodiments, the preset distribution rules refer to the pre-defined rules used to regulate the distribution targets, distribution methods, and distribution timing of target report files.
[0045] In some embodiments, a report version record refers to a record file created based on the execution data of a scheduled reporting task, used to record report version information generated at different times, facilitating version tracing and difference comparison.
[0046] In some embodiments, audit logs refer to log files generated based on key operational events during the execution of scheduled reporting tasks, used to meet compliance audit requirements in multi-tenant scenarios and mitigate operational risks.
[0047] In some embodiments, the tenant administrator can set the report generation time period (such as daily, weekly, monthly, etc.) or trigger conditions (such as when a specific event occurs), and the method will automatically trigger the report generation task according to the predetermined scheduling strategy.
[0048] In some embodiments, when a task is triggered, the method can obtain the corresponding report template and tenant data, and generate a report file after data population. The report file can support multiple formats, such as PDF, Excel, and Word, to meet the needs of different tenants.
[0049] For example, this method supports three triggering methods: cron expressions (such as 008**? which means to execute at 8 o'clock every day), event triggering (listening to the Kafka topic order_paid), and API calls.
[0050] In some embodiments, task execution employs containerized deployment, which can automatically allocate computing resources based on the complexity of the tenant report (0.5 CPU cores / 1GB memory for simple text reports, and 2 CPU cores / 4GB memory for complex PDF reports with charts).
[0051] In some embodiments, the method can perform task dependency management, such as the "monthly report" task depending on the completion of the "daily report completion" prerequisite task before the task can be executed.
[0052] In some embodiments, the dimensions for determining report complexity include: (1) Number of original data records: The more data records to be processed (e.g., 10 order data records and 100,000 records), the more time-consuming the data extraction, transformation and filling steps into the template will take, and the more memory will be occupied; (2) Template logic complexity: Look at the nesting depth of FreeMarker instructions in the report template (e.g., the number of #if nested within #list), and the number of calculated expressions. For example, a template with 10 levels of nesting and 50 calculated expressions will significantly increase the CPU's computational burden; (3) Output format complexity: The rendering difficulty of different formats is different, and the order is PDF > Excel > Word > plain text; in addition, the number of dynamic charts and the total number of pages in the report will also affect the complexity. For example, a 100-page PDF report with 20 charts takes more than 10 times longer to render than a plain text report. (4) Data processing complexity: The difficulty of data processing operations, such as complex operations such as multi-table joins and machine learning prediction calculations, will significantly increase CPU and memory consumption; (5) Historical average generation time: Referencing the time taken for this tenant to generate similar reports in the past can serve as an auxiliary basis for judging the complexity of this report.
[0053] In some embodiments, the generated report can be automatically distributed to designated recipients based on the tenant's configuration. This distribution supports multi-channel distribution strategies and can dynamically adjust content according to recipient roles. Distribution methods include email, file-sharing platforms, message queues, etc. The system records the report's distribution history, including distribution time, recipients, report version, and other information, for auditing and tracking purposes.
[0054] For example, a company's quarterly report may include: (1) The PDF version sent to the CEO contains complete data and trend analysis; (2) The Excel version sent to the department manager only contains data from their own department; (3) The version of the email sent to the customer hides sensitive fields such as cost.
[0055] In the above embodiments, this method can achieve scheduled automated execution of reporting tasks by creating exclusive accounts for tenants and building an associated personalized report template library, combined with the establishment of a secure data access channel. At the same time, after the task is triggered, production data is automatically extracted, specified templates are filled to generate reports, and distribution, version recording, and audit log creation are completed. This method can not only efficiently meet the personalized reporting needs of different tenants, but also reduce human error through full-process automated management. Furthermore, with the help of data access security mechanisms and complete version and audit records, it can effectively ensure data security and compliance audit requirements in multi-tenant scenarios.
[0056] In some embodiments, after distributing the target report file according to preset distribution rules and creating report version records and audit logs, the method further includes: Store the target report file in the target tenant's file storage directory and create a file index for the target report file; Monitor and record the delivery status of the target report file, and retry or handle exceptions for failed delivery attempts.
[0057] In some embodiments, after creating a tenant account based on a received registration request, the method further includes: Generate an account identifier for the tenant account based on the registration request; Assign independent logical storage partitions to tenant accounts based on account identifiers; Based on the security requirements of the tenant account, establish a corresponding secure isolation database for the tenant account in the distributed database cluster; Create a separate file storage directory for each tenant account; An access token is generated based on the account identifier and the data operation permission mask corresponding to the tenant account.
[0058] In some embodiments, the method can ensure data isolation between different tenants through reasonable database design and access control mechanisms. Each tenant's data is stored in an independent database table or partition, and only authorized tenants can access and manipulate their own data.
[0059] In some embodiments, security isolation includes at least physical isolation (independent database instance, suitable for tenants with high security requirements), logical isolation (shared database instance + independent schema, such as tenant A using schema_tenant_a), or field isolation (shared table + tenant_id field, suitable for small and medium-sized tenants).
[0060] Specifically, this method can allocate independent database instances for tenants with high security requirements; create independent schemas named after account identifiers in shared database instances for standard tenants; and create data partitions in shared tables for small tenants with account identifiers as the key field.
[0061] In some embodiments, the method may employ a JWT token mechanism for access control. The token embeds the tenant ID and a data operation permission mask. For example, a tenant administrator token may contain the TENANT_A|DATA_READ_WRITE permission (administrator-level data permissions for tenant A), while a regular user token may only contain the TENANT_A|DATA_READ permission (read-only permission identifier for regular users of tenant A).
[0062] In the above embodiments, the method can achieve physical and logical dual isolation of data among multiple tenants by generating unique identifiers for tenant accounts, allocating independent logical storage partitions and file storage directories, and establishing a secure isolation database. At the same time, by generating access tokens based on account identifiers and data operation permission masks, the method can accurately control the scope of tenant data access, build a solid data security defense line in a multi-tenant environment from the underlying storage and permission levels, and effectively avoid the risks of data leakage and unauthorized access among different tenants.
[0063] In some embodiments, a personalized report template library associated with a tenant account is constructed based on configuration operations entered by the administrator and preset template components, including: Receive operation commands triggered by the administrator selecting a basic template and dragging components in the visual interface; Construct an initial report template containing dynamic data placeholders, formatting settings, and conditional judgment logic based on the operation instructions; Based on the template attribute instructions entered by the administrator, the attributes of the data table component in the initial report template are set to obtain the preliminary configuration template; Based on the chart configuration instructions entered by the administrator, the data source, chart attributes, and preview effect settings of the line chart component in the initial configuration template are configured to obtain a personalized report template. All configured personalized report templates are stored in a secure, isolated database for the tenant account, forming a personalized report template library.
[0064] In some embodiments, this method can provide each tenant with an independent report template customization function. Tenant administrators can customize report templates according to their own business needs through a visual interface or by directly editing FreeMarker template files.
[0065] In some embodiments, various dynamic elements can be defined in the template, such as data placeholders, formatting settings, and conditional judgments, to meet the requirements of different report content and formats.
[0066] In some embodiments, the method may also provide dual editing modes (visual mode and source code mode). The visual mode supports dragging and dropping components (text boxes, tables, charts) to generate template structures; the source code mode allows direct editing of FTL files.
[0067] In some embodiments, a system applying this method can have more than 30 commonly used component libraries built in, such as a "balance sheet component" for financial statements (which automatically calculates indicators such as the debt-to-equity ratio) and an "order trend chart component" for e-commerce (which supports switching between line charts and bar charts).
[0068] For example, when an e-commerce tenant creates a quarterly sales report template, the user can drag and drop the "Regional Sales Heatmap" component and configure the data source field mapping through the properties panel (${region} associates the region field, ${salesAmount} associates the sales amount).
[0069] In some embodiments, this method can store customized report templates in the data layer and associate them with tenant information. Simultaneously, the method can also record the template's modification history and version information, allowing tenants to easily switch to different versions of the template when they need to update it. In some embodiments, after obtaining the personalized report template, the method can generate an initial version number and version record for the target report template. Simultaneously, the target report template, initial version number, and version record are stored in a separate logical storage partition corresponding to the tenant account.
[0070] In the above embodiments, the method can simplify the construction process of personalized report templates by relying on the drag-and-drop operation and component configuration of the visual interface, allowing administrators to quickly complete the template design that includes dynamic data placeholders and condition judgment logic without complex coding; at the same time, by configuring the fine attributes and data sources of components such as tables and line charts, it can accurately match the tenant's report format and content requirements, and store the configured template in the tenant's exclusive secure isolation database, thereby ensuring the tenant's exclusive rights and security of the template.
[0071] In some embodiments, a secure data access channel is established based on the production database connection information configured by the administrator, including: Obtain the connection configuration information for the production database required by the tenant account; Establish a communication connection with the production database based on the connection configuration information; Once the communication connection test is successful, and after passing the query test and permission verification, a secure data access channel is established between the database and the production database based on the connection configuration information.
[0072] In some embodiments, the connection configuration information includes at least the server address of the production database, the port of the production database, the database name of the production database, the authentication username of the tenant account, and the password of the tenant account.
[0073] In the above embodiments, the method can obtain the connection configuration information of the tenant's production database and establish a communication connection. Combined with a multi-verification mechanism of connection testing, query testing and permission verification, it can ensure the stability and legitimacy of the data access channel. At the same time, the constructed secure data access channel can realize compliant data interaction between the tenant and the production database, effectively avoiding the risk of unauthorized data access.
[0074] In some embodiments, based on the task configuration information entered by the administrator and the personalized report template library, a scheduled report task corresponding to the tenant account is created, including: The specified target report template is determined from the personalized report template library based on the task configuration information entered by the administrator; Create an initial report task, and personalize the initial report task according to the task configuration information and target report template to obtain a scheduled report task.
[0075] In some embodiments, the task configuration information includes at least the task identifier, report template, report version, and task execution frequency.
[0076] In some embodiments, after creating a scheduled reporting task, the method may determine the target reporting template selected by the scheduled reporting task; analyze the template complexity and historical data volume of the target reporting template; then, determine the computing resources of the scheduled reporting task based on the template complexity and historical data volume; and finally, adjust the resource quota of the scheduled reporting task based on the computing resources.
[0077] In the above embodiments, the method can accurately match the target template in the personalized report template library based on the administrator's task configuration information, and generate scheduled report tasks by targeted personalized configuration of the initial report task, thereby ensuring that the report task is accurately matched with the tenant's needs and providing clear task guidance for the automatic triggering, data filling and generation of subsequent reports.
[0078] In some embodiments, obtaining raw production data from a production database via a data access channel includes: Determine the target report template for the scheduled reporting task; Based on the data requirements defined in the target report template, connect to the production database via a secure data access channel; Based on pre-written structured query statements and data requirements, raw production data is retrieved from the production database.
[0079] In some embodiments, the method can extract relevant data from the tenant data source according to the requirements of the report template, and perform necessary data transformation and preprocessing to meet the format and content requirements of the generated report.
[0080] For example, this method can convert data formats in a database into the data structures required by FreeMarker templates. Specifically, a visual, configurable data processing pipeline can be built using a visual ETL tool. The daily report generation process for a tenant could be as follows: (1) Extract the order_id, create_time, and amount fields from the MySQL order table; (2) Filter the data created_time yesterday by the transformation node; (3) Add the user_level field to the associated user table; (4) Aggregate and calculate the total amount for each user level; (5) Convert the results into the List structure required by FreeMarker.
[0081] In some embodiments, the system applying this method can have more than 20 built-in conversion functions, such as date formatting DATE_FORMAT(create_time,'yyyy-MM-dd') and data masking MASK(phone,3,4) (processing 13800138000 into 138****8000), etc.
[0082] In the above embodiments, the method can connect to the production database through a secure data access channel based on the data requirements defined in the target report template, and accurately obtain the original production data by combining structured query statements. This ensures a high degree of matching between the data and the report requirements, while relying on the secure channel to ensure the compliance and security of the data transmission process.
[0083] In some embodiments, a target report file is generated based on the original production data and the target report template specified by the scheduled reporting task, including: The raw production data is preprocessed to obtain preprocessed data; Generate structured data objects from preprocessed data; Load the target report template specified by the scheduled report task; Generate the target report file based on the structured data object and the target report template.
[0084] In some embodiments, the raw production data is preprocessed to obtain preprocessed data, including: The test data in the original production data is filtered to obtain the first processed data; The fields from different data sources in the first processed data are aligned and matched to obtain the second processed data; Sensitive fields in the second-processed data are partially masked to obtain preprocessed data.
[0085] In some embodiments, this method can utilize FreeMarker's template engine to dynamically populate the processed data into the corresponding report template, generating complete report content.
[0086] In some embodiments, during the filling process, the method can perform operations such as formatting, calculating, and filtering on the data according to the instructions and logic in the template to ensure the accuracy and completeness of the report content.
[0087] In some embodiments, this method can optimize the FreeMarker template parsing process and add a data validation step through an intelligent fill engine. For example, when filling ${order.totalAmount}, the system automatically checks the data type matching (to prevent strings from being assigned to numeric fields) and performs business rule validation (such as the amount cannot be negative). For large data volume scenarios (such as 100,000 order records), a paginated fill + memory caching strategy is adopted to control the memory usage of a single fill to within 512MB.
[0088] In some embodiments, the method can also integrate POI (Excel), iText (PDF), and Docx4j (Word) toolkits to achieve multi-format output with a single fill.
[0089] For example, the same sales data can be generated simultaneously: (1) Excel version (including editable formulas); (2) PDF version (encrypted watermark + electronic signature); (3) Word version (with reserved area for handwritten annotations). For large data reports (such as an Excel file with 100,000 rows of data), streaming writing is used to avoid memory overflow, and the generation time is reduced by 60% compared with the traditional method.
[0090] In the above embodiments, the method can achieve efficient adaptation of data and target report templates by preprocessing and structuring the raw production data, thereby accurately generating target report files that meet the personalized needs of tenants, and thus ensuring the accuracy and standardization of report data.
[0091] In some embodiments, a report version record and audit log are created, including: Collect task execution data and key operational events for this scheduled report task; Create report version records based on task execution data, and generate audit logs based on key operational events; Store report version history and audit logs.
[0092] In some embodiments, the method can perform version management on each generated report.
[0093] For example, this method can create a new report version each time a report is generated, and record information such as the version number, generation time, and corresponding report template version. This allows tenants to view historical report versions at any time and perform comparisons and analyses.
[0094] In some embodiments, the method can employ a Git-like version control mechanism, storing only the differences (Delta format) between the current version and the previous version each time a new version is generated. In this case, the method automatically records version snapshots (including the modifier, modification time, and change description), and supports version rollback (e.g., reverting from V3 to V2) and difference comparison (highlighting modified content).
[0095] For example, after a tenant changes the template title color, this method only saves...<h1style="color:red"> With the original<h1style="color:black"> The difference is not in the complete template file.
[0096] In some embodiments, the method records all key operations and events throughout the report's lifecycle, such as template modification, data extraction, report generation, and distribution, generating detailed audit logs.
[0097] In some embodiments, audit logs are available for querying and analysis by system administrators and tenant administrators to meet compliance and regulatory requirements.
[0098] In the above embodiments, the method can collect the execution data and key operation events of the scheduled reporting tasks, generate corresponding report version records and audit logs and complete the storage, thereby realizing traceable management of the entire life cycle of the report. This allows tenants to easily view the differences between different versions of the report while meeting the strict requirements of compliance auditing in multi-tenant scenarios and effectively avoiding risks such as data tampering and improper operation.
[0099] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below. In some embodiments, Figure 2The system architecture diagram of the report management system is shown. This report management system adopts a layered architecture, specifically including a data layer, a business logic layer, and a presentation layer.
[0100] Specifically, the data layer is responsible for storing tenant information, report templates, report data, and related configuration information; The business logic layer implements core business functions, such as report template management, data processing and population, report generation and distribution control, etc. The presentation layer provides a user interface, making it easy for tenant administrators and system administrators to operate and manage the system.
[0101] In some embodiments, the data layer adopts a distributed database cluster architecture and performs logical partitioning by tenant ID.
[0102] For example, all data of tenant A (template ID=A001, report data ID=AD001) is stored on physical node 1, while the data of tenant B (template ID=B001, report data ID=BD001) is stored on physical node 2. Simultaneously, a Redis caching layer is introduced to cache frequently accessed template metadata (such as template structures used in the last 7 days) and tenant configuration information, reducing template loading response time from 500ms to less than 50ms.
[0103] In some embodiments, the business logic layer adopts a microservice architecture to decompose core functional modules, including a template engine service (integrating FreeMarker version 2.3.32), a data integration service (supporting JDBC / ODBC / RESTful interfaces), a task scheduling service (based on the Quartz framework), and a permission management service (implementing the RBAC model).
[0104] Each service communicates asynchronously through a Kafka message queue. For example, after the data integration service completes data extraction, it sends a "DATA_READY" message to trigger the template filling process.
[0105] In some embodiments, the presentation layer adopts a front-end and back-end separation architecture. The front-end is built with a visual interface based on Vue3 + ElementPlus, and the back-end provides a RESTful API through Spring Boot. Specifically, for template editing scenarios, a dedicated code editor (integrating AceEditor) is developed, supporting FreeMarker syntax highlighting, auto-completion (e.g., automatically suggesting name / age / department when typing ${user.}) and real-time preview functionality.
[0106] For example, this report management method includes: S201, System initialization configuration.
[0107] Specifically, upon the system's initial runtime, a system administrator account is created. Simultaneously, basic system parameters are configured, including the default report format and data storage path. Additionally, the database structure is initialized, creating database tables to store tenant information, report templates, report data, and audit logs.
[0108] S202, Tenant Registration and Basic Configuration.
[0109] Specifically, the system administrator can create a tenant account for a new tenant (a certain unit, tenant ID=RESTAURANT_CHAIN) and assign corresponding resources and permissions; Tenant administrators log into the system to complete tenant-specific configurations, including uploading the company logo and setting default parameters for report generation; then they determine the tenant's needs and create a monthly notification report template.
[0110] S203, Basic Template Selection and Shared Template Configuration.
[0111] Specifically, tenant administrators can log in to the system, select a multi-dimensional data report basic template from the template library, and enter the visual editing interface; Drag and drop the title component to set the report title to "${tenantName}${reportMonth} Monthly Analysis Report". Here, tenantName is automatically associated with the tenant's basic information, and reportMonth is a dynamic parameter.
[0112] For general templates such as multi-dimensional data reports, tenant administrators can choose to share them with other tenants or set them as inheritable templates; other tenants can customize them based on the shared template, and when the parent template is updated, the child template can choose whether to update synchronously.
[0113] S204. Data source configuration and verification.
[0114] Specifically, tenant administrators can configure the data sources required for reports in the system, including database connection information, file paths, etc. The system supports multiple types of databases, including relational databases (MySQL, Oracle, etc.) and file systems (CSV, Excel files, etc.). After configuration, the system automatically verifies the availability of the data source.
[0115] S205, SQL query and conditional formatting configuration for data table components.
[0116] Specifically, this method involves adding a data table component to the template, configuring SQL query rules, and setting the table header to "Notification Title | Alarm Count | Year-on-Year Growth | Month-on-Month Growth"; then, binding the table data to the expression ${storeRevenueList}; and using FreeMarker directives to implement conditional formatting, as follows: <#list storeRevenueList as store> ${store.name} <td ${store.revenue <100000 ? 'style="color:red"' : ''}> ${store.revenue} <td ${store.yoy<0 ? 'style="color:red"' : 'style="color:green"'}> ${store.yoy}% ${store.mom}% < / #list> .
[0117] S206, Chart Component Configuration.
[0118] Specifically, this method involves inserting a ChartJS chart component into the template, configuring the chart type as a line chart, binding the X-axis to ${storeRevenueList.name}, and the Y-axis to ${storeRevenueList.revenue}, and setting a warning line through the properties panel to display a red warning line when revenue is less than 800,000.
[0119] S207, Template Version Generation and Management.
[0120] Specifically, tenant administrators can save the configured template so that the system can automatically generate version V1.0 and assign version number ID=R001; at the same time, the system will display a preview on the template details page and record the template creation time and creator.
[0121] When the template is modified in the future, the system can automatically create a new version and retain the historical version. Tenant administrators can view the content of different versions in the version management interface and select a specific version to generate a report.
[0122] S208, Setting up report generation task scheduling rules and data population.
[0123] Specifically, tenant administrators can set up report generation task scheduling rules in the system; and configure a data population task (Task 1): automatically extract data from the tenant's MySQL database at 8:00 AM every day and execute an SQL query, as shown in the following code: SELECT s.store_name as name, SUM(o.order_amount) as revenue, (SUM(o.order_amount)-SUM(last_year.order_amount)) / SUM(last_year.order_amount)*100 as yoy, (SUM(o.order_amount)-SUM(last_month.order_amount)) / SUM(last_month.order_amount)*100 as mom FROM store s JOIN orders o ON s.id=o.store_id JOIN orders last_year ON o.store_id=last_year.store_id AND o.order_date=DATE_ADD(last_year.order_date, INTERVAL 1 YEAR) JOIN orders last_month ON o.store_id=last_month.store_id AND o.order_date=DATE_ADD(last_month.order_date, INTERVAL 1 MONTH) WHERE o.order_date BETWEEN '2023-09-01' AND '2023-09-30' GROUP BY s.id; Then, the query results are converted into a List object, with yoy and mom retained to two decimal places; and the engine loading template R001 is populated with data: ${tenantName} is replaced with "XX Notice", ${reportMonth} is replaced with "September 2023", and ${storeRevenueList} is iterated to generate table content; Finally, an intermediate preview file is generated and validated by the rule engine: data integrity (ensuring all placeholders have data), logic (the absolute value of the year-on-year growth rate does not exceed 20%), and format (percentage fields retain 2 decimal places).
[0124] S209, Multi-format report generation and intelligent distribution.
[0125] Specifically, this method can be configured to generate and distribute report tasks (task 2): the scheduling rule is to generate the previous month's report at 9:00 on the 1st of each month, and the trigger condition is the completion of data filling task 1; The system automatically executes at 9:00 AM on the 1st of each month, generating reports in multiple formats: Excel (including calculation formulas and supporting data filtering), PDF (with an "Internal Confidential" watermark to prevent printing), and JSON (for tenant BI systems to perform secondary analysis). Then, send the PDF version to the CEO's email address via SMTP, with the subject line containing "[Important] XX Notification September Report"; send the Excel version to the manager, containing only the corresponding notification data, via the WeChat Work API; and upload the JSON version to the tenant's dedicated S3 storage bucket, setting a 7-day validity period. Finally, after the distribution is completed, the system generates a distribution report: Success (CEO email delivered, status code 250; 15 managers have read it), Failure (2 managers did not receive it due to account abnormalities and have been added to the retry queue).
[0126] S210, Report Version Management and Audit Log Query.
[0127] Specifically, tenant administrators can view historical versions of reports in the system. The system displays the version number, generation time, corresponding template version, and content summary of each version, and supports version comparison and switching. System administrators and tenant administrators can query audit logs, which include records of template creation and modification, data extraction, report generation and distribution, etc. System administrators can use them for system performance analysis and resource scheduling optimization, while tenant administrators can use them to verify the compliance of the report process.
[0128] Figure 3 A schematic diagram of a report management device is shown. It should be understood that this device is related to... Figure 1 The method executed in the middle corresponds to the steps involved in the aforementioned method. The specific functions and effects of the device can be found in the description above. To avoid repetition, detailed descriptions are omitted here.
[0129] The report management device includes: Account creation unit 310 is used to create tenant accounts based on the received registration request; Template building unit 320 is used to build a personalized report template library associated with tenant accounts based on the configuration operations entered by the administrator and preset template components; Channel establishment unit 330 is used to establish a secure data access channel based on the production database connection information configured by the administrator; Task creation unit 340 is used to create scheduled report tasks corresponding to tenant accounts based on the task configuration information entered by the administrator and the personalized report template library; The acquisition unit 350 is used to acquire raw production data from the production database through the data access channel when the timed reporting task is triggered; The report generation unit 360 is used to generate target report files based on the original production data and the target report template specified by the scheduled reporting task; Distribution unit 370 is used to distribute target report files according to preset distribution rules; Audit Unit 380 is used to create report version records and audit logs.
[0130] In some embodiments, the report management device further includes: The identifier generation unit 390 is used to generate an account identifier for the tenant account based on the registration request after creating the tenant account based on the received registration request. Allocation unit 400 is used to allocate independent logical storage partitions to tenant accounts based on account identifiers; Database creation unit 410 is used to create a corresponding secure isolation database for a tenant account in a distributed database cluster according to the security requirement level of the tenant account. Directory creation unit 420 is used to create independent file storage directories for tenant accounts; The token generation unit 430 is used to generate an access token based on the account identifier and the data operation permission mask corresponding to the tenant account.
[0131] In some embodiments, the template building unit 320 includes: The receiving subunit 321 is used to receive operation instructions triggered by the administrator selecting a basic template and dragging components in the visual interface; Sub-unit 322 is used to construct an initial report template containing dynamic data placeholders, formatting settings, and condition judgment logic based on operation instructions. Set sub-unit 323 to set the attributes of the data table component in the initial report template according to the template attribute instructions entered by the administrator, so as to obtain the preliminary configuration template; Sub-unit 323 is also used to set the data source, chart attributes, and preview effect of the line chart component in the initial configuration template according to the chart configuration instructions entered by the administrator, so as to obtain a personalized report template with complete configuration; The first storage subunit 324 is used to store all configured personalized report templates in the secure isolation database of the tenant account, forming a personalized report template library.
[0132] In some embodiments, the channel establishment unit 330 includes: The first acquisition subunit 331 is used to acquire the connection configuration information of the production database required by the tenant account; Subunit 332 is established to establish a communication connection with the production database based on the connection configuration information; Subunit 332 is also used to establish a secure data access channel with the production database based on the connection configuration information after the communication connection test is valid and after passing the query test and permission verification.
[0133] In some embodiments, the task creation unit 340 includes: The first determining subunit 341 is used to determine the specified target report template from the personalized report template library based on the task configuration information entered by the administrator; Create sub-unit 342 to create an initial report task, and personalize the initial report task according to the task configuration information and target report template to obtain a scheduled report task.
[0134] In some embodiments, the acquisition unit 350 includes: The second determining subunit 351 is used to determine the target report template specified by the timed reporting task; Connection subunit 352 is used to connect to the production database through a secure data access channel according to the data requirements defined in the target report template; The second acquisition subunit 353 is used to acquire raw production data from the production database based on pre-written structured query statements and data requirements.
[0135] In some embodiments, the report generation unit 360 includes: The preprocessing subunit 361 is used to preprocess the raw production data to obtain preprocessed data; Generating subunit 362 is used to generate structured data objects based on preprocessed data; Loading subunit 363 is used to load the target report template specified by the scheduled report task; The generation subunit 362 is also used to generate a target report file based on the structured data object and the target report template.
[0136] In some embodiments, the audit unit 380 includes: Subunit 381 is used to collect task execution data and key operation events for this scheduled reporting task. Audit subunit 382 is used to create report version records based on task execution data and generate audit logs based on key operation events; The second storage subunit 383 is used to store report version records and audit logs.
[0137] like Figure 4 As shown, this application provides an electronic device 500, which includes a processor 501 and a memory 502. The processor 501 and the memory 502 are interconnected and communicate with each other through a communication bus 503 and / or other forms of connection mechanism (not shown). The memory 502 stores a computer program that can be executed by the processor 501. When the computing device is running, the processor 501 executes the computer program to perform the method in any of the aforementioned optional implementations.
[0138] This application provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the method in any of the aforementioned optional implementations.
[0139] The computer-readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Red-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0140] This application provides a computer program product, which includes a computer program that, when run by a processor, executes the method in any of the aforementioned optional implementations.
[0141] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and not to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. These modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application, and they should all be covered within the scope of the claims and specification of this application. In particular, as long as there is no conflict, the various technical features mentioned in the embodiments can be combined in any way. This application is not limited to the specific embodiments disclosed herein, but includes all technical solutions falling within the scope of the claims.
Claims
1. A report management method, characterized in that, include: Create a tenant account based on the received registration request; A personalized report template library associated with the tenant account is built based on the configuration operations entered by the administrator and the preset template components. Establish a secure data access channel based on the production database connection information configured by the administrator; Based on the task configuration information entered by the administrator and the personalized report template library, create a scheduled report task corresponding to the tenant account; When the scheduled reporting task is triggered, raw production data is obtained from the production database through the data access channel; Generate a target report file based on the original production data and the target report template specified by the scheduled report task; The target report file is distributed according to the preset distribution rules, and report version records and audit logs are created.
2. The report management method according to claim 1, characterized in that, After creating a tenant account based on the received registration request, the method further includes: Generate the account identifier for the tenant account based on the registration request; Assign an independent logical storage partition to the tenant account based on the account identifier; Based on the security requirement level of the tenant account, a corresponding secure isolation database is established for the tenant account in the distributed database cluster; Create a separate file storage directory for the tenant account; An access token is generated based on the account identifier and the data operation permission mask corresponding to the tenant account.
3. The report management method according to claim 1, characterized in that, The process of constructing a personalized report template library associated with the tenant account based on the configuration operations input by the administrator and preset template components includes: Receive operation commands triggered by the administrator selecting a basic template and dragging components in the visual interface; An initial report template containing dynamic data placeholders, formatting settings, and conditional judgment logic is constructed based on the operation instructions. Based on the template attribute instructions input by the administrator, the attributes of the data table component in the initial report template are set to obtain a preliminary configuration template; Based on the chart configuration instructions input by the administrator, the data source, chart attributes, and preview effect settings of the line chart component in the initial configuration template are configured to obtain a personalized report template. All configured personalized report templates are stored in the secure, isolated database of the tenant account to form a personalized report template library.
4. The report management method according to claim 1, characterized in that, The step of establishing a secure data access channel based on the production database connection information configured by the administrator includes: Obtain the connection configuration information for the production database required by the tenant account; Based on the connection configuration information, establish a communication connection with the production database; When the communication connection test is valid, and after passing the query test and permission verification, a secure data access channel is established between the database and the production database based on the connection configuration information.
5. The report management method according to claim 1, characterized in that, The step of creating a scheduled report task corresponding to the tenant account based on the task configuration information input by the administrator and the personalized report template library includes: The specified target report template is determined from the personalized report template library based on the task configuration information entered by the administrator; An initial report task is created, and the initial report task is customized according to the task configuration information and the target report template to obtain a scheduled report task.
6. The report management method according to claim 1, characterized in that, The step of obtaining raw production data from the production database through the data access channel includes: Determine the target report template specified for the scheduled reporting task; Based on the data requirements defined in the target report template, connect to the production database through the secure data access channel; Based on the pre-written structured query statement and the data requirements, raw production data is obtained from the production database.
7. The report management method according to claim 1, characterized in that, The step of generating a target report file based on the original production data and the target report template specified by the scheduled report task includes: The raw production data is preprocessed to obtain preprocessed data; A structured data object is generated based on the preprocessed data; Load the target report template specified by the scheduled report task; A target report file is generated based on the structured data object and the target report template.
8. The report management method according to claim 1, characterized in that, The creation of report version records and audit logs includes: Collect task execution data and key operational events for this scheduled report task; A report version record is created based on the task execution data, and an audit log is generated based on the key operation events; Store the report version record and the audit log.
9. A report management device, characterized in that, The report management device includes: The account creation unit is used to create tenant accounts based on the received registration requests; The template building unit is used to build a personalized report template library associated with the tenant account based on the configuration operations input by the administrator and preset template components; The channel establishment unit is used to establish a secure data access channel based on the production database connection information configured by the administrator. The task creation unit is used to create a scheduled report task corresponding to the tenant account based on the task configuration information input by the administrator and the personalized report template library. The acquisition unit is used to acquire raw production data from the production database through the data access channel when the timed reporting task is triggered. The report generation unit is used to generate a target report file based on the original production data and the target report template specified by the scheduled report task; A distribution unit is used to distribute the target report file according to preset distribution rules; The audit unit is used to create report version records and audit logs.
10. An electronic device, characterized in that, The electronic device includes a memory and a processor, the memory storing a computer program and the processor running the computer program to cause the electronic device to perform the report management method according to any one of claims 1 to 8.
11. A readable storage medium, characterized in that, The readable storage medium stores a computer program, which, when executed by a processor, performs the report management method according to any one of claims 1 to 8.
12. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, performs the report management method according to any one of claims 1 to 8.