A report generation method, a computer device and a storage medium
By using a report generation method and report configuration information to generate target reports for different users, the problem of poor user experience in existing technologies is solved. This enables dynamic display of report data that conforms to user permissions, reduces costs, and improves system stability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HENAN QINWEI DIGITAL TECHNOLOGY CO LTD
- Filing Date
- 2026-01-23
- Publication Date
- 2026-06-05
AI Technical Summary
In existing technologies, the way form data is displayed by the front end through API interfaces cannot meet the data display requirements of different user groups, resulting in a poor user experience.
A report generation method is provided that, in response to a target user's data query request, obtains the target user's accessible configuration information from multiple report configuration information, including data source location information and structure reference information, and generates a target report that meets the user's permissions, dynamically displaying business data.
It enables the data display needs of different user groups to be met without modifying the code or deploying online, reducing manpower and time costs, avoiding the risk of data omission, and improving the stability and user experience of the data query system.
Smart Images

Figure CN122154651A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a report generation method, computer device and storage medium. Background Technology
[0002] In related technologies, the front end can obtain form data by requesting the Application Programming Interface (API) and then display the data on the front end interface. However, this method cannot meet the data display requirements of different user groups, resulting in a poor user experience. Summary of the Invention
[0003] The purpose of this application is to provide a report generation method, computer device, and storage medium to meet the data display needs of different user groups and improve user experience.
[0004] In a first aspect, embodiments of this application provide a report generation method, the method comprising: In response to a data query request from a target user, the configuration information of the target report accessible to the target user is obtained from multiple report configuration information. The configuration information of the target report includes the data source location information and the structural reference information of the target report. Based on the structural reference information of the target report, the structured information of the target report is determined, and this structured information is used to define the table structure of the target report. Based on the data source location information and structured information of the target report, the business data of the target report is obtained, so that the business data and structured information of the target report can be used to generate the target report.
[0005] When using the technical solution of this application embodiment, the configuration information of the target report can be obtained from multiple report configuration information based on the data query request of the target user. The configuration information of the target report contains the data source location information and the structural reference information of the target report. Therefore, the structured information of the target report can be determined based on the data source location information. This structured information is used to define the table structure of the target report. Therefore, the business data of the target report can also be obtained based on the data source location information and the structured information of the target report. Since the business data of the target report is used to define the business indicators of the target report, the target report can be generated based on the business data and structured information of the target report.
[0006] Furthermore, in response to a target user's data query request, the configuration information of the target report accessible to the target user can be obtained from multiple report configuration information. Based on the target report's data source location information and structural reference information included in the target report's configuration information, the structured information and business data of the target report accessible to the target user can be obtained. This is equivalent to using the report configuration information as a bridge to query the structured information and business data of the target report that satisfy the target user's access permissions under a data query request. Therefore, based on the target report's structured information and business data, a target report that satisfies the target user's access permissions can be generated, ensuring that the report-related data queried by the target user meets their access requirements.
[0007] As can be seen, the method of this application embodiment can configure the report data of the target report for users with different access permissions by configuring the report configuration information, so as to display reports that meet the data display needs of each type of user. Therefore, the method of this application embodiment does not require code modification for different types of users, nor does it require deployment and online, and can realize the dynamic display of target business information. This can not only reduce manpower and time costs, but also avoid the risk of data omission, improve the stability and continuity of the data query system, and provide users with a user-friendly experience.
[0008] In one possible implementation, the report configuration information includes user permission information, data source location information, and structural reference information. In response to a data query request from a target user, the configuration information of the target report accessible to the target user is obtained from multiple report configuration information sets, including: In response to a target user's data query request, the target user's identity information and the report information to be retrieved are determined. Since multiple reports have different user access permissions, if one of the multiple report configuration information includes user permission information matching the target user's identity information and data source location information of the report matching the report information to be retrieved, the configuration information of the target report is determined to be one of the multiple configuration report information. Therefore, in the method of this application embodiment, the target user's identity information and the report information to be retrieved can be determined based on the target user's data query request. Then, using the report's user permission information and data source location information in the report configuration information as references, the configuration information of the target report accessible to the target user is accurately located. This ensures that the target report generated based on the target report's configuration information is a report that the target user has access to, rather than a report that the target user does not have access to.
[0009] In one possible implementation, the business data of the target report is obtained based on the data source location information and structured information of the target report, including: Based on the data source location information of the target report, obtain the target business table to which the business indicators of the target report belong. Based on the structured information of the target report and the target business table, determine the business indicators of the target business.
[0010] As can be seen, in the method of this application embodiment, the target business table where the business indicators of the target report are located can be located using the data source location information of the target report. The structured information of the target report can define the table structure of the target report. Therefore, the relevant business data that needs to be filled in the table structure of the target report can be obtained from the target business table with the structured information of the target report as a reference, so that the obtained business data as the business data of the target report meets the user permission requirements of the target report.
[0011] In one possible implementation, the target business table includes business metrics and corresponding field information; the structured information of the target report includes the field information of the target report; and based on the structured information of the target report and the target business table, the business metrics of the target business are determined, including: Based on the field information of the target report, obtain the field information corresponding to the target business indicators that match the field information of the target report from the target business table; based on the field information corresponding to the target business indicators and the target business indicators, determine the business data of the target report.
[0012] When the structured information of the target report is used to define the table structure of the target report, the structured information of the target report includes the field information of the target report. Since the field information of the target report has the access rights of the target user, by referring to the field information of the target report and matching it with the field information included in the target business table, and then combining the matching results, the business data of the target report with the access rights of the target user can be directly obtained from the target business table. Therefore, the method of this application embodiment can ensure that the displayed target report matches the user permissions of the target user without modifying the code and redeploying.
[0013] In one possible implementation, the structural reference information of the target report includes the field information of the target report and the dimension field objects of the target report. Based on the structural reference information of the target report, the structured information of the target report is determined, including: Extract the header field data and row field data of the target report from the field information of the target report; Determine the header data of the target report based on the header field data and dimension field objects of the target report; Based on the row field data of the target report, determine the report rows of the target report. The structured information of the target report includes the report header and the report rows of the target report.
[0014] When defining the table structure of a target report using its structured information, you can organize the row field data and header field data of the target report through dimension field objects, thereby obtaining the table structure of the target report that is accessible to the target user.
[0015] In one possible implementation, the method of this application embodiment may further include: Based on the header data and row data of the target report, determine the table structure of the target report; based on the business data and table structure of the target report, determine the rendering data of the target report; and display the target report based on the rendering data.
[0016] In one possible implementation, the header field data of the target report includes the header fields and their relationships, and the row field data includes the row fields and their relationships. Based on the header data and row data of the target report, the table structure of the target report is determined, which may include: Based on the header field association and row field association, determine the nesting relationship of table fields in the target report; The table structure of the target report is determined based on the header fields, row fields, table field nesting relationships, and dimension field objects of the target report.
[0017] In the method of this application embodiment, the header field data of the target report includes header field association relationships, and the row field data of the target report includes row field association relationships. Therefore, after determining the field nesting relationship of the target report based on the header field association relationship and the row field association relationship, regardless of whether the target report is a single-level report or a multi-level report, the table field nesting relationship can be used as a bridge, combined with dimension field objects, to organize the row fields included in the report row data of the target report and the header fields included in the report header data of the target report to form the table structure of the target report.
[0018] In one possible implementation, the business data of the target report includes the target business metrics and field information of those metrics. Based on the business data and table structure of the target report, the rendering data of the target report is determined, including: When both the dimension field objects and the row field data of the target report match the field information of the target business metric, the fill parameters of the target business metric are determined based on the dimension field objects and row fields of the target report; based on the fill parameters of the target business metric, the target business metric is filled into the table structure of the target report to obtain the rendered data of the target report.
[0019] When both the dimension field objects and the row field data of the target report match the field information of the target business indicator, it means that the position of the target business indicator in the row direction can be located through the row field data of the target report. Furthermore, by combining the dimension field objects of the target report with the field information corresponding to the target business indicator, the fill position of the target business indicator can be determined. Therefore, based on the fill parameters of the target business indicator, the target business indicator can be filled into the table structure of the target report to obtain the rendering data of the target report.
[0020] Secondly, embodiments of this application also provide a report generation apparatus, the method comprising: The acquisition module is used to respond to the data query request of the target user and obtain the configuration information of the target report that the target user can access from multiple report configuration information. The configuration information of the target report includes the data source location information and the structural reference information of the target report. The determination module is used to determine the structured information of the target report based on the structure reference information of the target report. The structured information of the target report is used to define the table structure of the target report. The acquisition module is also used to acquire the business data of the target report based on the data source location information and the structured information of the target report, so that the business data of the target report and the structured information of the target report can generate the target report. The business data of the target report is used to define the business indicators of the target report.
[0021] Thirdly, embodiments of this application also provide a computer storage medium storing computer instructions that, when executed on a processor, cause the processor to execute the method described in the first aspect of the embodiments of this application or any possible implementation thereof.
[0022] Fourthly, embodiments of this application also provide a computer program product, including a computer program, wherein the computer program, when executed by a processor, implements the method described in the first aspect or any possible implementation thereof.
[0023] Fifthly, embodiments of this application also provide a computer device, including: Processor; and, Memory for stored programs; The program includes instructions that, when executed by a processor, cause the processor to perform the method according to any possible implementation of the sixth or first aspect of this application.
[0024] The beneficial effects of the technical solutions described in the second to fifth aspects of the embodiments of this application can be referred to the beneficial effects of the methods described in the first aspect or any possible implementation of the first aspect of the embodiments of this application, which will not be repeated here. Attached Figure Description
[0025] Further details, features, and advantages of this application are claimed in the following description of exemplary embodiments in conjunction with the accompanying drawings, in which: Figure 1 A schematic diagram of an example data query system according to embodiments of this application in which various methods described herein may be implemented is shown; Figure 2A This illustration shows a schematic diagram of the metadata configuration interface in header table mode according to an embodiment of this application; Figure 2B This illustration shows a schematic diagram of the metadata configuration interface in row table mode according to an embodiment of this application; Figure 3 A flowchart of a report generation method according to an embodiment of this application is shown; Figure 4 A schematic block diagram of a functional module of a report generation apparatus according to an exemplary embodiment of this application is shown. Detailed Implementation
[0026] Embodiments of this application will now be described in more detail with reference to the accompanying drawings. While some embodiments of this application are shown in the drawings, it should be understood that this application can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this application. It should be understood that the drawings and embodiments of this application are for illustrative purposes only and are not intended to limit the scope of protection of this application.
[0027] It should be understood that the steps described in the method embodiments of this application may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this application is not limited in this respect.
[0028] The term "comprising" and its variations as used herein are open-ended, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the following description. It should be noted that the concepts of "first", "second", etc., mentioned in this application are used only to distinguish different devices, modules, or units, and are not intended to limit the order of functions performed by these devices, modules, or units or their interdependencies.
[0029] It should be noted that the terms "a" and "a plurality of" used in this application are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more". Before introducing the embodiments of this application, the relevant terms involved in the embodiments of this application are first explained as follows: Metadata refers to data that describes data. It is used to define, describe, or manage the structure, attributes, and uses of actual data. Metadata itself does not contain business data, but it provides the necessary context and specifications for the processing, exchange, and understanding of business data. The role of metadata is to help systems understand and process actual data, and improve data manageability and interoperability.
[0030] Multidimensional reports are reports that simultaneously statistically analyze and display data across multiple dimensions (such as time, region, product, etc.). They can support any number of dimensions and commonly take the form of multi-level headers, crosstabs, or pivot tables. Multidimensional reports help analyze business data from different perspectives and identify trends and anomalies.
[0031] The header table is the "master table / metadata table" of the reporting system. It stores the global, unique attributes of a single report that do not change with the detail rows, and is the "core of ownership" of the row table data.
[0032] The row table (also called the detail table or row item table) is a core component in the reporting system that complements the "header table". It is used to store the specific business data row by row and item by item in the report and is the "data body" of the report.
[0033] The report header is the structural description of a report, used to define the report's framework, the meaning of data fields, and display rules. It is usually located at the top of the report or at the beginning of each page, and includes single-level report headers and multi-level report headers.
[0034] A report row refers to the data-carrying part of a report, which consists of specific data records, with each row representing an independent data entity.
[0035] An Application Programming Interface (API) is a set of predefined functions designed to provide applications and developers with the ability to access a set of routines based on certain software or hardware, without needing to access the source code or understand the details of the internal workings.
[0036] Dynamic data rendering refers to the process of formatting and transforming data obtained from the backend according to the requirements of the frontend and displaying it on the page or interface. Dynamic means that the page or interface content can be updated in real time according to the data or status, and the query results are matched and rendered with the report headers.
[0037] This application provides a report generation method to meet the needs of different user groups and improve user experience.
[0038] Figure 1 A schematic diagram of an example data query system according to embodiments of this application, in which various methods described herein can be implemented, is shown. For example... Figure 1 As shown, the data query system 100 of this application embodiment includes a front-end 101, a back-end 102 and a data storage system 103.
[0039] In one alternative approach, the front-end and back-end can belong to the same computer device, which can be used as a user terminal. For example, the program that implements the method for generating the target report can be deployed on the same computer device. The data storage system can be the storage medium of the computer device or a cloud storage system that can communicate with the computer device.
[0040] In another alternative approach, the front-end and back-end may not belong to the same computer device. For example, the program that generates the target report can be divided into two parts: a front-end and a back-end. The back-end is deployed on a remote server, while the front-end is not part of the local user interface. The data storage system can be storage media installed on the remote server or a cloud storage system that can communicate with the computer device.
[0041] The data storage system 103 of this application embodiment can store various business tables and various report metadata, and a metadata configuration module 1021 is deployed on the backend 102 to configure the report metadata within the data storage system 103. The metadata configuration module 1021 is a core infrastructure of the Internet system, used to define and manage report data, rules and relationships, realize the standardization and dynamic control of report data, thereby decoupling the business rules for displaying report data from the code.
[0042] like Figure 1As shown, the front-end 101 can communicate with the back-end 102 via the middle processing layer and the metadata configuration module 1021. The middle processing layer can be a RESTful interface, which can be called by the front-end 101 to manage and query report data.
[0043] Optional, such as Figure 1 As shown, the middle processing layer may include a configuration interface and a query interface. The front end 101 sends configuration instructions for metadata to the back end through the configuration interface, so that after receiving the configuration instructions for metadata, the back end can quickly iterate the business rules for different report data through the metadata configuration module 1021 in a declarative configuration manner.
[0044] like Figure 1 As shown, a data acquisition module 1022 can also be deployed in the backend 102, and a data rendering module can be deployed in the frontend 101. The frontend 101 can send a data query request through the query interface. After receiving the data query request, the backend 102 can obtain the target report data configured by the metadata configuration module 1021 from the data storage system 103 based on the data query request, and return the target report data to the frontend 101 through the query interface. The frontend 101 can parse the target report data through the data rendering module and display the target report on the display interface of the frontend 101 based on the parsed target report data.
[0045] For a specific business table, such as Figure 1 As shown, report metadata can be configured through the metadata configuration module 1021 to achieve rapid iteration of business rules for the report data to be displayed. This eliminates the need for frequent modifications to the front-end and back-end code, as well as deployment and deployment. Report data can be quickly modified simply by adjusting the business rules of the report data through the metadata configuration module 1021.
[0046] Optional, such as Figure 1 As shown, when facing different business scenarios, the table headers or fields displayed to users often need to change. By configuring the table headers or fields of the report data through the metadata configuration module 1021, the table structure of the report data can be dynamically adjusted to achieve the purpose of quickly modifying the table headers or fields of the report data.
[0047] In one example, such as Figure 1 As shown, the content of the business tables that different types of users can view may differ. Therefore, the metadata configuration module 1021 can be used to configure report data (row metadata and header metadata) with different user access rights. In this way, although the report data seen by different users through the front end 101 comes from the same business table, the business data they see is within the corresponding user's permissions.
[0048] Optional, such as Figure 1 As shown, the report metadata data table can be divided into a metadata header table and a metadata row table, while the business tables can be stored in different tables from the report metadata. This decouples the table structure of the business tables from the business tables. When different users configure report data in the report metadata through the metadata configuration module 1021, it will not affect the business data in the business tables. Therefore, the scalability and maintainability of the data storage system 103 can be improved without modifying the code.
[0049] For example, the header and rows of the target report can be obtained based on different user roles and the report information to be retrieved (such as the target report name), and the business data of the target report can be obtained based on the header and rows of the target report.
[0050] As can be seen, this application embodiment can achieve access control and access change auditing of business tables by configuring the report data that different types of users have the right to access in the report metadata, thereby ensuring that the report metadata becomes a core asset that drives business convenience.
[0051] Optional, such as Figure 1 As shown, the target report data can include the report header data, report row data, and business data of the target report. Correspondingly, the query interface can be divided into a first query interface and a second query interface. Frontend 101 can submit a data query request to backend 102 through the first query interface. After obtaining the report header data of the target report, backend 102 can retrieve the report header data and report row data of the target report from the metadata based on the report name and user type, and return the report header data of the target report to frontend 101 through the first query interface. Backend 102 can also, after obtaining the report row data and business data of the target report, return the report row data and business data of the target report to frontend 101 through the second query interface. Alternatively, the second query interface can retrieve only the report row data of the target report. In this case, the retrieval interface can also include a third query interface, through which frontend 101 can retrieve the business data of the target report.
[0052] like Figure 1As shown, the front-end 101 is equipped with a data rendering module 102B-1, which needs to balance flexibility, performance and maintainability. Its core objective is to convert all the acquired data into Hyper Text Markup Language (HTML) format in real time and present it on the display interface (such as a page). Optionally, frontend 101 can traverse the header data of the target report of the first interface through data rendering module 102B-1. According to the hierarchy of header fields and the parent field code of the header fields, the header of the target report can be displayed on the display interface. Frontend 101 can also traverse the report row data of the second query interface through data rendering module 102B-1. According to the hierarchy of row fields and the parent field code of the row fields, the report rows of the target report can be displayed on the display interface. Frontend 101 can also traverse the business data of the target report of the third interface through data rendering module 102B-1. This business data contains the row field code of the business indicators. Through the row field code, the business indicators, the row fields of the report rows, and the header fields of the report header can be associated. There is a relationship between the report rows and the report header. Through these relationships, the fill parameters of the business indicators (i.e., the row field data and header field data corresponding to the business indicators) can be obtained. Then, based on the fill parameters, the business indicators of the target report can be displayed on the display interface.
[0053] Optionally, report metadata can be stored as a metadata header table and a metadata row table, depending on its type. The metadata header table and the metadata row table can jointly define the table structure of the data table. Therefore, in situations such as... Figure 1 The metadata configuration module 1021 shown can be divided into a metadata header table configuration process and a metadata row table configuration process when configuring report metadata. Through these two configuration processes, the table structure can be configured for report data from business tables.
[0054] As can be seen, the system framework of this application embodiment can be achieved through, as follows: Figure 1 The metadata configuration module 1021, the middle processing layer, and the front end work together to achieve the purpose of metadata configuration to drive the display of target report data. It should be understood that the data model of the metadata configuration interface can be designed before executing the metadata configuration.
[0055] Optionally, a client application can be installed on the front end, allowing users to configure report data and query reports. Report metadata can be divided into header tables and row tables, representing two different types of metadata tables. Figure 2A This illustration shows a schematic diagram of the metadata configuration interface in header table mode according to an embodiment of this application. Figure 2B This diagram illustrates the metadata configuration interface in row table mode according to an embodiment of this application. The following is a detailed explanation... Figure 2A and Figure 2B This section explains the configuration operations for the header table and row table. Specifically, it explains how to configure them. Figure 2A and Figure 2B In the middle table mode 201, the drop-down menu of the control allows you to select either header table mode or row table mode.
[0056] like Figure 2A As shown, in the header table mode of the metadata configuration interface 200, you can configure the primary key id, report code, report name, role id, business table name, and dimension field 1 through the header table. For example, when there are many dimension fields, Figure 2A This example only shows a single dimension field; in a real header table, there may be more dimension fields. If you need to configure multiple header tables, you can add a new row using the "Add" control and configure the next header table within it. For example... Figure 2B As shown, in the row table mode of the metadata configuration interface 200, you can configure the primary key id, report field code, Chinese name of report field, English name of report field, report field hierarchy, parent code of report field, report field type, report field object, and report control field in the row table. If you need to configure multiple row tables, you can also create a new table using the "Add" control and configure the next row table within it. It is evident that both the report header data and report row data of the target report can be configured in any field within the metadata configuration interface 200. Examples are provided below with reference to the attached diagram.
[0057] For the same report data, its header table mode and row table mode can be linked by the primary key ID. The header table can be configured with role ID and data source location information (such as report code). At the same time, in header table mode, dimension fields are added to the header table, and dimension field objects are added to the row table based on the dimension fields.
[0058] In row table mode, the specific content of report fields can be defined by specifying related information (such as report field code, Chinese name, and English name). Field positions and nesting relationships can be defined through report field hierarchy, parent code, and dimension field objects. Furthermore, the ability to export fields can be controlled via the report's own settings.
[0059] Optionally, in the metadata configuration interface 200, you can perform CRUD operations on the header table and row table (such as adding tables, fields, setting primary and foreign keys, etc.). It can use Vue and Spring Boot technologies to build the front-end and back-end framework of the metadata configuration interface 200.
[0060] After configuring the header and row tables, the client installed on the front-end 101 can obtain report metadata from the back-end 102 through the metadata service interface 203, and dynamically generate forms, reports, validation rules, etc., achieving low-code or no-code configuration. Simultaneously, high-frequency query optimization can be achieved through metadata caching and synchronization functions.
[0061] Optionally, after reading the report metadata returned by the intermediate processing layer, the front-end 101 can also cache the report metadata in the front-end 101 through metadata caching and synchronization. When it detects that the report metadata stored in the back-end has been updated, it can delete the report metadata in the front-end 101 and re-cache the updated report metadata in the front-end 101 during the new data query stage.
[0062] It should be noted that the report generation method of this application embodiment can be applied to a data query system. This data query system can not only seamlessly adapt to multiple devices through multiple terminals and multiple technology stacks, for example, by optimizing the system to support cross-platform access and operation, such as mobile devices, desktop applications and web applications, but also by utilizing cloud services for broader data support and computing resource support, and achieve larger-scale dynamic adjustment and configuration.
[0063] This application provides a report generation method that can generate a target report that conforms to the user's permissions based on the type of user requesting the report data.
[0064] This report generation method can be applied across industries. For example, in the financial industry, it can support dynamic configuration of bank financial statements and risk management dashboards (such as Basel III indicators), automatically adjusting fields according to regulatory requirements; in the healthcare field, it can realize functions such as clinical trial data analysis and patient electronic medical record statistics; in the retail e-commerce field, it can realize functions such as sales funnel analysis and inventory turnover monitoring; and in the smart manufacturing field, it can realize functions such as equipment failure rate analysis and production yield statistics.
[0065] Figure 3 A flowchart illustrating a report generation method according to an embodiment of this application is shown. Figure 3 As shown, the report generation method 300 of this application embodiment includes steps 301 to 303.
[0066] In step 301, in response to the data query request of the target user, the configuration information of the target report accessible to the target user is obtained from multiple report configuration information. The configuration information of the target report includes the data source location information of the target report and the structural reference information of the target report.
[0067] Optionally, the user can input the report information to be retrieved through the report query system provided by the front-end client. The client can package the target user's identity information and the report information to be retrieved into a data query request and send the data query request to the back-end.
[0068] In one example, the report information to be retrieved may include information indicating the target report, such as the name or code of the target report. When entering the report information to be retrieved in the report query interface, the target user's identity information can be entered, or it can be left blank.
[0069] For example, a login interface can be set up in the report query system. When querying reports, users can log in to the report query system through the login interface and enter the report information to be retrieved in the display interface. The identity information of the target user can be represented by the user login information.
[0070] In step 302, based on the structural reference information of the target report, the structured information of the target report is determined. This structured information is used to define the table structure of the target report. Since the configuration information of the target report is accessible to the target user, the table structure of the target report defined by the structured information is accessible to the target user.
[0071] Optionally, the configuration information of the target report can be divided into a header table and a row table according to table type, with the same primary key ID for both. The configuration information of the target report can also be divided into user permission information, data source location information, and structural reference information according to data function.
[0072] refer to Figure 2A and Figure 2B As shown, the user permission information for the target report can be a role ID, the data source location information for the target report can include the report code, and the structural reference information for the target report can at least include the field information and dimension field objects of the target report. The field information and dimension field objects of the target report can originate from a row table.
[0073] When the structured information of the target report includes the report header data and the report row data, the header field data and the row field data of the target report can be extracted from the field information of the target report; the report header data of the target report can be determined based on the header field data and the dimension field objects of the target report; and the report rows of the target report can be determined based on the row field data of the target report. The structured information of the target report includes the report header and the report rows of the target report.
[0074] When defining the table structure of a target report using its structured information, you can organize the row field data and header field data of the target report through dimension field objects, thereby obtaining the table structure of the target report that is accessible to the target user.
[0075] In step 303, based on the data source location information and the structured information of the target report, the business data of the target report is obtained, so that the business data of the target report and the structured information of the target report can generate the target report.
[0076] When the configuration information of the target report includes the user permission information, the data source location information, and the structural reference information of the target report, the target business table to which the business indicators of the target report belong can be obtained based on the data source location information of the target report. Based on the structured information of the target report and the target business table, the business indicators of the target business can be determined.
[0077] When the data source location information of the target report includes the code of the target business table where the business data of the target report is located, the target business table where the business data of the target report is located can be accessed by using the code of the target business table as the query API for business data. The business data of the target business can then be obtained from the target business table by combining the structured information of the target report.
[0078] Optionally, when the target business table includes business metrics and the corresponding field information, the structured information of the target report includes the field information of the target report. Based on the field information of the target report, the field information corresponding to the target business metrics that matches the field information of the target report can be obtained from the target business table. Then, based on the field information corresponding to the target business metrics and the target business metrics, the business data of the target report can be determined.
[0079] When the structured information of the target report is used to define the table structure of the target report, the structured information of the target report includes the field information of the target report. Since the field information of the target report has the access rights of the target user, by referring to the field information of the target report and matching it with the field information included in the target business table, and then combining the matching results, the business data of the target report with the access rights of the target user can be directly obtained from the target business table.
[0080] In one example, when the target report's field information includes both row field data and header field data, the target report's business data can be retrieved from the target business table based on the dimension field object and the row field data. In this case, the target report's business data, including the field information corresponding to the target business metrics, actually includes both the target report's header field and row field.
[0081] In the method of this application embodiment, the target business table containing the business indicators of the target report is located using the data source location information of the target report. The structured information of the target report defines its table structure. Therefore, by using the structured information of the target report as a reference, and matching it with the field information included in the target business table, and then combining the matching results, the business data of the target report with the target user's access permissions can be directly obtained from the target business table. In this way, without modifying the code or redeploying, it can be ensured that the target report displayed on the terminal matches the user permissions of the target user.
[0082] In the method of this application embodiment, the configuration information of the target report can be obtained from multiple report configuration information based on the data query request of the target user. The configuration information of the target report contains the data source location information and the structural reference information of the target report. Therefore, the structured information of the target report can be determined based on the data source location information. This structured information is used to define the table structure of the target report. Therefore, the business data of the target report can also be obtained based on the data source location information and the structured information of the target report. Since the business data of the target report is used to define the business indicators of the target report, the target report can be generated based on the business data and structured information of the target report.
[0083] Furthermore, in response to a target user's data query request, the configuration information of the target report accessible to the target user can be obtained from multiple report configuration information. Based on the target report's data source location information and structural reference information included in the target report's configuration information, the structured information and business data of the target report accessible to the target user can be obtained. This is equivalent to using the report configuration information as a bridge to query the structured information and business data of the target report that satisfy the target user's access permissions under a data query request. Therefore, based on the target report's structured information and business data, a target report that satisfies the target user's access permissions can be generated, ensuring that the report-related data queried by the target user meets their access requirements.
[0084] As can be seen, the method of this application embodiment can configure the report data of the target report for users with different access permissions by configuring the report configuration information, so as to display reports that meet the data display needs of each type of user. Therefore, the method of this application embodiment does not require code modification for different types of users, nor does it require deployment and online, and can realize the dynamic display of target business information. This can not only reduce manpower and time costs, but also avoid the risk of data omission, improve the stability and continuity of the data query system, and provide users with a user-friendly experience.
[0085] In one alternative approach, when the report configuration information includes user permission information, data source location information, and structure reference information, in response to a target user's data query request, the target user's identity information and the report information to be retrieved can be determined. Since multiple reports have different user access permissions, if one of the multiple report configuration information includes user permission information matching the target user's identity information and data source location information matching the report information to be retrieved, it indicates that the content within the report structure defined by that report configuration information has the target user's query permissions. Furthermore, the business data within the business table indicated by the report's data source location information is also the source of the report indicators in the report data that the target user needs to query. Therefore, it can be determined that the target report's configuration information is one of multiple configuration report information.
[0086] Optionally, the data query request can be parsed to obtain the target user's identity information and the report information to be retrieved, and based on the target user's identity information and the report information to be retrieved, the configuration information of the target report can be obtained from the configuration information of multiple reports.
[0087] When the permission information of a report includes the user permission information of the report, the configuration information of multiple reports can be traversed to obtain the user permission information that matches the identity information of the target user. The configuration information of the report to which the user permission information belongs can be the configuration information of the candidate report.
[0088] When the report information to be retrieved includes the report name of the target report, the report name of the target report can be the report code of the target report. The data source location information of the report can include the report code. The target business table indicated by the report code not only contains the business data of the target report that the target user has access to, but also includes the business data that the target user does not have access to.
[0089] Optionally, when the data source location information of a report may include a report code, the configuration information of multiple reports can be traversed to obtain the codes of the business tables of candidate reports that match the report code of the target report. In this case, it indicates that the report information to be retrieved matches the data source location information of the target report.
[0090] As can be seen, in the method of this application embodiment, the target user's identity information and the report information to be retrieved can be determined based on the target user's data query request. Then, the user permission information and data source location information of the report in the report configuration information are used as references to accurately locate the configuration information of the target report that the target user can access. This ensures that the target report generated based on the configuration information of the target report is a report that the target user has access to, rather than a report that the target user does not have access to.
[0091] In an alternative embodiment, the method of this application may further include: generating a target report based on the structured information and business data of the target report. The generated target report can then be displayed on the query interface of a data query system.
[0092] When generating a target report, the table structure of the target report can be determined based on the report header data and the report row data of the target report; the rendering data of the target report can be determined based on the business data and the table structure of the target report; and the target report can be displayed based on the rendering data of the target report.
[0093] When the front-end and back-end of a data query system are not on the same device, such as the front-end being a local user terminal and the back-end being a remote server, the front-end can send data query requests from the target user to the back-end. After obtaining the structured information and business data of the target report, the back-end returns the report header and rows of the target report through different query interfaces. In this way, after receiving the report header, rows, and business data of the target report, the terminal can easily generate the rendering data of the target report without the need for various intermediate data separation processes. This can improve the rendering efficiency of the target report on the report display interface.
[0094] Optionally, the front-end can receive the header data of the target report returned by the back-end through the first query interface, and the row table data and business data of the target report returned by the back-end through the second query interface. Alternatively, the front-end can receive the row table data of the target report returned by the back-end through the second query interface, and receive the business data of the target report returned by the back-end through the third query interface.
[0095] Optionally, when the header field data of the target report includes the header fields and header field relationships of the target report, and the row field data of the target report includes the row fields and row field relationships of the target report, the header field relationships can reflect the relationships between different header fields, and the row field relationships can reflect the relationships between different row fields. Therefore, the nesting relationship of the table fields of the target report can be determined based on the header field relationships and the row field relationships. Since the dimension field object can organize header fields at different levels, the table structure of the target report can be determined based on the header fields of the target report, the row fields of the target report, the nesting relationship of the table fields, and the dimension field object.
[0096] Furthermore, the nesting relationships of table fields in the target report are determined through header field relationships and row field relationships, and dimension field objects are used to associate header fields at different levels, thereby constructing a nested multi-level table structure. At this point, regardless of whether the target report is a single-level or multi-level report, the header field relationships and row field relationships can be used as a bridge to organize row field data and header field data through dimension field objects, forming the table structure of the target report. Based on the data types included in the field nesting relationship, table field nesting relationships can include row field hierarchy, row field parent field, header field hierarchy, and header field parent field. The row field hierarchy and its parent field determine the position of the row field within the target report's table frame. Similarly, the header field hierarchy and its parent field, combined with dimension field objects, determine the position of the header field within the target report's table frame.
[0097] Optionally, when the business data of the target report includes target business metrics and dimension fields of the business metrics, and both the dimension field objects and the row field data of the target report match the field information of the target business metrics, the fill parameters of the target business metrics can be determined based on the dimension field objects and the row fields of the target report; based on the fill parameters of the target business metrics, the target business metrics are then filled into the table structure of the target report to obtain the rendered data of the target report.
[0098] For a specific target business metric, its corresponding field information may include row field codes and dimension field objects of the target report. Therefore, the dimension field objects and row field data of the target report can be matched with the field information of the target business metric. If the match is successful, it means that the position coordinates defined by the dimension field objects and row field data of the target report can be the fill parameters of the target business metric. In this way, the fill parameters of the business metric are used to fill the business metric in the table structure of the target report.
[0099] It should be noted that when the front-end and back-end of the data query system are not on the same computer device, the structured information of the target report queried by the back-end can be cached. Therefore, when the front-end detects a data query operation from a target user on the report query interface, if the cached structured information of the target report is the target report that the target user can access, the structured information of the target report can be directly obtained from the front-end. Based on the structured information of the target report, the business data of the target report can be obtained from the server and then returned to the front-end. This can improve the data query speed and reduce the delay in report data display.
[0100] In one possible implementation, the method of this application embodiment may further include: in response to a configuration instruction for a report, configuring the report's permission information in the report's configuration information, configuring the target report's data source location information in the report's configuration information, and modifying the report's structure reference information. By configuring the report's permission information and data source location information, user access permissions for each report can be differentiated, resulting in different user access permissions for each report.
[0101] By modifying the structural reference information of the report, the data displayed to the user in the data query system interface can be defined. Furthermore, by limiting the data source location information of the target report, even without modifying the data within the business table containing the target data, the report data for which the target user has the necessary permissions can be obtained based on the structural reference information. Therefore, this embodiment of the application, through configuring the report's configuration information, can obtain the business data of the target report from the business table after acquiring the target report's configuration information, using the target report's data source location information and structural reference information.
[0102] Optionally, for reports A, B, and C, their data all originate from the target business table. Reports A, B, and C have different user permissions; for example, report A can be viewed only by user A, report B only by user B, and report C only by user C. The configuration information for reports A, B, and C can be configured separately. The three reports share the same data source location information, all pointing to the target business table. However, their user permissions and structural reference information differ. Regardless of the differences or similarities in the configuration information of the three reports, they will not affect the data in the target business table.
[0103] As can be seen, the method of this application embodiment can decouple the business table from the report configuration information (i.e., report metadata) by configuring the report configuration information, so that the data storage system 103 has good scalability, and the data query system can flexibly display report data according to different user types.
[0104] like Figure 1 As shown, front-end 101 can transmit configuration instructions to back-end 102 through the configuration interface, enabling back-end 102 to configure the metadata stored in data storage system 103 through the metadata configuration module to obtain report metadata. Report metadata can be defined as report configuration information. Here, based on data type, it can be divided into report headers containing header field data and report rows containing row field data; based on the type of table where the metadata resides, it can be divided into header tables and row tables.
[0105] When the report configuration information includes a header table and a row table, row field data, header field data, and dimension field objects can be stored in the row table, while the attributes of the dimension fields, the report's user access permissions, and the report's data source location information can be stored in the header table.
[0106] Optionally, for the header table, the data it stores can be stored in the form of metadata. This metadata can include, according to type, the data source location information of the report, the permission information of the report, and the dimension fields of the report. It can also store additional information such as basic information of the report, business scenario of the report, version information, configuration status, operator (configuration personnel) and operation time (configuration time).
[0107] In one example, the data source location information for a report may include a report code, which can serve as a query API for business data. This report code allows access to the business table containing the report's business data. Report permission information may include the user roles supported by the report. Basic report information may include the report name and the name of the business table containing the report data. Dimension fields may be one or more. Table 1 shows an example of the metadata header table `report_metadata_header`, which can be used to design the metadata management interface.
[0108] Table 1. English-Chinese translation of metadata header table
[0109] Optionally, for row tables, the data they store can be stored in the form of metadata. This metadata can include field definitions (also known as report row definitions), dimension field objects, the header table address corresponding to the metadata, control fields, and rule fields, depending on the type. For example, field definitions can include basic information such as field code, field type (header field, row field), field name (e.g., Chinese name, English name), field hierarchy, field order, and parent code. Control fields can include whether the field is exportable, sortable, or queryable. Rule fields can include the value range of queryable fields, such as gender including male and female. Table 2 shows the metadata list `report_metadata_header`, and the metadata management interface can be designed based on the report metadata row table shown in Table 2.
[0110] Table 2. Metadata Row Table: English-Chinese Translation Table
[0111] When parsing a data query request to obtain the target user's identity information and the report code to be retrieved, the metadata in the data storage system 103 can be filtered to find the role ID that matches the target user's identity information and the report code that matches the report code to be retrieved. Then, the metadata header table containing the matched role ID and report code is used as the metadata header table of the target report. The header table ID (primary key ID) is used to find the list of report metadata containing the header table ID from the metadata and use it as the metadata row table of the target report.
[0112] The metadata header table and the metadata row table of the target report in this application embodiment can constitute the structural reference information of the target report. Row field data, header field data and dimension field objects can be obtained from the report metadata row table according to the dimension fields. Then, the header field data and dimension field objects are combined into report header data, and the row field data is defined as report row data.
[0113] Optionally, the target business table may include business metrics and the fields corresponding to those business metrics. For example, the target business information may include data ID, row field information (such as row field code and row field name), dimension field objects (such as header field name), and business metrics. The metadata row table also contains row field data (such as row field code and row field name) and header field data (such as header field name). Therefore, report business data can be obtained from the target business information based on the metadata row table.
[0114] To facilitate understanding of the report generation method in this application embodiment, the following explanation uses the query of a regional annual quarterly sales volume statistics table and a company segment report profit and loss details table as examples.
[0115] I. The query results for the regional annual and quarterly sales volume statistics table are shown in Table 3.
[0116] Table 3 Regional Sales Volume Statistics by Year and Quarter
[0117] To retrieve the sales volume statistics table for the example region by year and quarter in Table 3, and the business table - Server_Sale_Detail shown in Table 4, the metadata header table and metadata row table of the sales volume statistics table can be configured through the metadata configuration module. The configuration results are shown in Tables 5 and 6.
[0118] Table 4 Business Table - Server_Sale_Detail
[0119] Table 5 Metadata Header Table
[0120] Table 6 Metadata Row Table
[0121] When configuring the metadata header table, you can define the role information as "administrator" and add the report code "Server_Sale_Report" and the business table name "Server_Sale_Detail" to it. When parsing a data query request and obtaining the target user's role as "administrator" and the code of the report to be retrieved as "Server_Sale_Report", the metadata header table shown in Table 5 can be accessed. This allows access to the business table "Server_Sale_Detail" shown in Table 4 via the report code "Server_Sale_Report" in Table 5, and the full amount of business data within the business table "Server_Sale_Detail" can be obtained. The metadata header table shown in Table 5 also contains a header table ID, and the metadata row table also contains a header table ID. Therefore, you can traverse all metadata row tables through the metadata header table shown in Table 5 to filter out the metadata row table shown in Table 6.
[0122] The dimension fields stored in the metadata header table shown in Table 5 include year and quarter. Therefore, based on this, dimension field objects can be configured in the metadata row table shown in Table 6, defining the dimension field objects as the report header data of the regional annual quarterly sales quantity statistics table, and setting the row field data as the report row data of the regional annual quarterly sales quantity statistics table. Simultaneously, based on the header field data and row field data, the business data of the regional annual quarterly sales quantity statistics table is obtained from the business table Server_Sale_Detail shown in Table 4.
[0123] The report can be displayed using the Vue framework. First, the report header data can be traversed through a first query interface, and the report rows and headers can be traversed through a second query interface. For example, the backend can return the report header data to the frontend through the first query interface, the report row data through the second query interface, and the business data through the second query interface. Then, the parent-child relationships of the header fields and row fields can be recursively derived through the report field hierarchy and parent field encoding. Finally, the report row data, header field data, and business data can be associated through dimension field objects.
[0124] For each header field, the possible header table ID, report field code, report field name, report field hierarchy, report field sorting, report row parent code, and report field type are provided, along with the dimension field object for each header field.
[0125] For report header data with the header field name "2024", its header table ID is 1, report field code (field_code) is Year_2024, report field name (field_name_cn) is 2024, report field level (field_level) is 1, report field order (field_order) is 10, report field parent code (field_parent_code) is NULL, report field type (field_type) is header field, and its corresponding dimension field object (dimension_field) is NULL. At this point, based on the report row level (field_level) and report row parent code (field_parent_code), it can be determined that "2024" is the first header field in the first-level header field hierarchy.
[0126] For a report header data with the header field name "Second Quarter", its header table ID is 1, report field code (field_code) is Second, report field name (field_name_cn) is Second Quarter, report field level (field_level) is 2, report field order (field_order) is 20, report field parent code (field_parent_code) is 2024, report field type (field_type) is header field, and dimension field object (dimension_field) is {"year": "2024", "quarter": "Second"}. At this point, by using the report field level and report field parent code, it can be determined that in the header fields, "Second Quarter" is the second header field belonging to the first-level header field "2024".
[0127] Each report row can include a report field ID, report field code, report field name, report field level, report field sort, report field parent code, and report field type, and a dimension field object can be configured for that report row. For example, for a report row with the field name "2024", it includes header ID: 1, report field code (field_code): a, report field name (field_name_cn): A, report field level (field_level): 1, report field sort (field_order): 10, report field parent code (field_parent_code): NULL, report field type (field_type): row field, and dimension field object (dimension_field): NULL. In this case, the report field level and report field parent code determine that "2024" is the first row field in the header.
[0128] Each report record may include: data ID, row field code, city name, year, quarter, and report metric. For example, for city A's sales volume of 106 in the second quarter of 2024, the report data may include: data ID: 1, row field code (item_code): a, city name (city_name): A, year (year): 2024, quarter (quarter): Second, report metric (amount): 106.
[0129] When determining the population position of a report indicator, the header field position of the indicator can be located based on the dimension field object in the report header data, while the row field position of the indicator can be determined through the report field code in the report row data.
[0130] For example, for city A's sales volume of 106 in the second quarter of 2024, which includes the year: 2024 and the quarter: Second, filtering the report header data based on this reveals that the report header data corresponding to the dimension field object (dimension_field): {"year": "2024", "quarter": "Second"} is the second header field within the second-level header fields that belong to the first-level header field "2024". This field position corresponds to the header field position of the sales volume 106. Filtering the report row data using the row field code (e.g., item code: a) in the business data shows that the row field code (field_code): a is the first row field within the first-level row fields. This row field position corresponds to the row field position of the sales volume 106.
[0131] As can be seen, the method in this embodiment configures the `field_parent_code` and `field_level` fields in the metadata row table to achieve multi-level nested table headers. For example, the annual and quarterly sales volume statistics table for a region is a multi-dimensional report, which can be displayed according to a three-level table structure of year, quarter, and region. Moreover, by configuring dimension field objects (such as `dimension_field:{"year":"2024","quarter":"Second"}`) in the metadata row table, header fields, row fields, and business data can be dynamically associated, thereby supporting data items and pivot analysis with arbitrary dimension combinations. Through the above configuration, the "Regional Annual and Quarterly Sales Volume Statistics Table" accessible to administrators can be dynamically and flexibly rendered on the front end without affecting business data, without requiring code modification.
[0132] Furthermore, the method in this application embodiment can also configure user roles and report codes in the metadata header table to determine the data source of business data in the "Regional Sales Quantity Statistics Table by Year and Quarter". Combined with the metadata row table, user roles (such as WHERE role IN ('finance') condition) are added during the process of sending Structured Query Language (SQL) through the middle processing layer API at the front end. This allows the middle processing layer API to dynamically filter and return report headers, report rows, and business data based on user roles, ensuring that the rendered "Regional Sales Quantity Statistics Table by Year and Quarter" matches the identity of the target user and preventing data leakage. In addition, control fields can be configured in the metadata row table. By using the display_flag in the control fields, the visibility of some fields can be controlled, thereby ensuring data security and preventing unauthorized access to data that is not authorized.
[0133] II. The query results for the company's segment report profit and loss statement are shown in Table 7.
[0134] Table 7. Reported Profit and Loss Statement of Overseas Companies
[0135] Table 8. Reported Profit and Loss Statement of Domestic Companies
[0136] To retrieve the profit and loss details table for overseas companies shown in Table 7 and the profit and loss details table for domestic companies shown in Table 8, the business table - Company_Report_Detail - shown in Table 9 can be configured with metadata header tables and metadata row tables through the metadata configuration module. The metadata header table is shown in Table 10, and the metadata row table is shown in Table 11.
[0137] Table 9 Business Table Company_Report_Detail
[0138] Table 10 Data Header Table
[0139] Table 11 Metadata Row Table
[0140] When configuring the metadata header table, you can define the roles of the Overseas Company Reporting Profit and Loss Details Table and the Domestic Company Reporting Profit and Loss Details Table as administrators. For the Overseas Company Reporting Profit and Loss Details Table, add the report code `Company_Report_Oversea` and the business table name `Company_Report_Detail`. For the Domestic Company Reporting Profit and Loss Details Table, add the report code `Company_Report Internet` and the business table name `Company_Report_Detail`. The report codes `Company_Report_Oversea` and `Company_ReportInternet` are different, but their corresponding data source is the business table `Company_Report_Detail` shown in Table 9. Table 9 only illustrates the Domestic Company Reporting Profit and Loss Details Table and omits the Overseas Company Reporting Profit and Loss Details Table.
[0141] When parsing the data query request and determining that the target user's role is administrator and the code of the report to be retrieved is Company_Report_Oversea, the metadata header table shown in Table 5 can be accessed. This allows access to the business table Server_Sale_Detail shown in Table 9 via the report code Company_Report_Oversea in Table 10, and the full amount of business data within the Company_Report_Detail table can be retrieved.
[0142] For both the overseas and domestic company profit and loss detail reports, the dimension field stored in the metadata header table shown in Table 10 includes `sub_type`. Therefore, this can be used as a basis to configure dimension field objects in the metadata row table shown in Table 11. The metadata header table in Table 10 also contains a header table ID, and the metadata row table in Table 11 also contains a header table ID. Therefore, by using the primary key ID=1 of the metadata header table in Table 10 to traverse all metadata row tables, we can filter out the metadata row table in Table 11 with header table ID=1. Based on this, we can retrieve the report header data and report row data of the overseas company profit and loss detail report from the metadata row table with header table ID=1. Then, based on the metadata row table with header table ID=1 in the row table, we can retrieve the business data of the overseas company profit and loss detail report from all business data in the business table `Company_Report_Detail`.
[0143] For the domestic company's profit and loss details report and the domestic company's profit and loss details report, the dimension fields stored in the metadata header table shown in Table 10 include `dept_type` and `sub_type`. Therefore, based on this, dimension field objects can be configured in the metadata row table shown in Table 11. The metadata header table shown in Table 10 also contains a header table ID, and the metadata row table shown in Table 11 also contains a header table ID. Therefore, by using the primary key ID=2 of the metadata header table shown in Table 10 to traverse all metadata row tables, the metadata row table with header table ID=2 in the metadata row table shown in Table 11 can be selected. Based on this, the business data of the domestic company's profit and loss details report can be obtained from the metadata row table with header table ID=2.
[0144] The front-end can use the Vue framework to display reports. First, the report header data can be traversed through the first query interface, and the report rows can be traversed through the second query interface. The parent-child relationship of the header field and the parent-child relationship of the row field are recursively determined by the report field hierarchy and the parent field ID of the row field (such as the parent code of the report field). The report row data, header field data and business data are associated through the dimension field object.
[0145] Optionally, the backend can return report header data to the frontend via the first query interface, report row data via the second query interface, and business data via the third query interface. For each report header, it can contain the header table ID, report field code, report field name, report field hierarchy, report field sorting, report field parent code, report field type, and dimension field object.
[0146] For the report header data in Table 7 with the header field name "Other Parts", its header table ID (header_id): 1, report field code (field_code): other_dept, report field name (field_name_cn): Other Parts, report field level (field_level): 1, report field order (field_order): 10, report field parent code (field_parent_code): NULL, report field type (field_type): Header Field, dimension field object (dimension_field): {"sub_type": "other_dept"}. At this point, based on the report field level (field_level) and report field parent code (field_parent_code), it can be determined that "Other Parts" is the first header field in the first-level header fields.
[0147] Each report row can include a report row ID, report field code, report field name, report field level, report field sorting, report field parent code, report field type, and dimension field object. For example, a report row with the field name "2024" would include: Header ID: 1, Report Field Code (field_code): operating_income, Report Field Name (field_name_cn): Operating Income, Report Field Level (field_level): 1, Report Field Sort (field_order): 10, Report Field Parent Code (field_parent_code): NULL, Report Field Type (field_type): Row Field, and Dimension Field Object (dimension_field): NULL. In this case, the report field level and report field parent code determine that "Operating Income" is the first row field in the header fields.
[0148] Optionally, for the report header data in Table 8 with the header field name "Department", its header table ID (header_id): 2, report field code (field_code): device_dept, report field name (field_name_cn): Department of Equipment, report field level (field_level): 1, report field order (field_order): 10, report field parent code (field_parent_code): NULL, report field type (field_type): Header field, dimension field object (dimension_field): NULL. In this case, based on the report field level (field_level) and report field parent code (field_parent_code), it can be determined that "Department of Equipment" is the first header field in the first-level header fields.
[0149] For the report header data in Table 8 with the header field name "Other Divisions", its header ID (header_id): 2, report field code (field_code): other_dept, report field name (field_name_cn): Other Divisions, report field level (field_level): 2, report field order (field_order): 10, report field parent code (field_parent_code): device_dept, report field type (field_type): Header Field, dimension field object (dimension_field): {"dept_type": "device_dept", "sub_type": "other_dept"}. At this point, based on the report field level (field_level) and report field parent code (field_parent_code), it can be determined that in the header fields, "Other Divisions" is the first header field in the second-level header fields that belong to the first-level header field "Device Divisions".
[0150] Each report row can include a report row ID, report field code, report field name, report field level, report field sorting, report field parent code, report field type, and dimension field object. For example, a report row with the field name "Operating Revenue" would include: Header ID: 2, Report Field Code (field_code): operating_income, Report Field Name (field_name_cn): Operating Revenue, Report Field Level (field_level): 1, Report Field Sort (field_order): 10, Report Field Parent Code (field_parent_code): NULL, Report Field Type (field_type): Row Field, and Dimension Field Object (dimension_field): NULL. In this case, the report field level and report field parent code determine that "Operating Revenue" is the first row field in the first-level row fields within the header fields.
[0151] For a report row with the field name "Product Revenue", the data includes: Header ID: 2, Report Field Code (field_code): product_income, Report Field Name (field_name_cn): Product Revenue, Report Field Level (field_level): 2, Report Field Order (field_order): 20, Report Field Parent Code (field_parent_code): operating_income, Report Field Type (field_type): Row Field, Dimension Field Object (dimension_field): NULL. At this point, by using the report field level and the report field parent code, it can be determined that in the header fields, "Product Revenue" is the first row field in the second-level row fields that belong to the first-level row field "Operating Revenue".
[0152] When determining the population position of a report indicator, the header field position of the indicator can be located based on the dimension field object in the report header data, while the row field position of the indicator can be determined through the report field code in the report row data.
[0153] Taking the business data population position in Table 8 as an example, the first business data in Table 9 indicates that the operating revenue of other divisions in the Equipment Division is 100, which includes the division type (dept_type): device_dept and the sub-division type (sub_type): other_dept. Based on this, filtering from the report header data reveals that the position of the report header data belonging to the dimension field object (dimension_field): {"dept_type": "device_dept", "sub_type": "other_dept"} is the first header field in the second-level header fields belonging to the first-level header field "Equipment Division". This field position is the header field position of the operating revenue of 100 in other divisions in the Equipment Division. Filtering the report row data through the row field code (item_code): operating_income in the business data reveals that the position of the row field data belonging to the report field code (field_code): operating_income is the first row field in the first-level row fields. This row field position is the row field position of the operating revenue of 100 in other divisions in the Equipment Division.
[0154] As can be seen, the method in this embodiment configures the `field_parent_code` and `field_level` fields in the metadata row table to achieve multi-level nested headers in the target report. For example, the profit and loss details table of the domestic company report is a multi-dimensional report, which can be displayed according to multi-level table structures such as region, department, revenue type, and revenue source. Moreover, by configuring dimension field objects (such as {"dept_type": "device_dept", "sub_type": "other_dept"}) in the metadata row table, header fields, row fields, and business data can be dynamically associated, thereby supporting data items and pivot analysis with arbitrary dimension combinations. Through the above configuration, the "profit and loss details table of the domestic company report" that can be accessed by the administrator can be dynamically and flexibly rendered on the front end without affecting the business data, without modifying the code.
[0155] Furthermore, the method in this application embodiment can also configure user roles and report codes in the metadata header table to determine the data source of business data in the "Domestic Company Report Profit and Loss Details Table". Combined with the metadata row table, user roles (such as WHERE role IN ('finance') condition) are added during the process of sending Structured Query Language (SQL) through the middle processing layer API at the front end. This allows the middle processing layer API to dynamically filter and return report header data, report row data, and report data based on user roles, ensuring that the rendered "Domestic Company Report Profit and Loss Details Table" matches the identity of the target user and preventing data leakage. In addition, control fields can be configured in the metadata row table. By using the display_flag in the control fields, the visibility of some fields can be controlled, thereby ensuring data security and preventing unauthorized access to data that is not authorized.
[0156] As can be seen from the above examples, the method of this application embodiment can adapt to multi-dimensional report queries in complex business analysis scenarios (such as financial statement drill-down), reduce development costs by 80%, and by configuring role fields in the header table to limit the user identity for querying reports, it meets data compliance requirements such as the General Data Protection Regulation (GDPR) and reduces the risk of unauthorized access. Moreover, by configuring the metadata header table and metadata row table, on the one hand, it can provide the front end with target report data that matches the user role without developing separate front-end and back-end code for each report; on the other hand, it can decouple data storage from display logic, which not only improves data scalability but also shortens the response time for field changes from "days" to "minutes," improving business agility.
[0157] By dividing the functions into modules corresponding to each function, an exemplary embodiment of this application provides a report generation apparatus. Figure 4 A schematic block diagram of a functional module of a report generation apparatus according to an exemplary embodiment of this application is shown. Figure 4 As shown, the report generation device 400 includes: The acquisition module 401 is used to respond to the data query request of the target user and obtain the configuration information of the target report that the target user can access from multiple report configuration information. The configuration information of the target report includes the data source location information of the target report and the structural reference information of the target report. The determination module 402 is used to determine the structured information of the target report based on the structure reference information of the target report. The structured information of the target report is used to define the table structure of the target report. The acquisition module 401 is also used to acquire the business data of the target report based on the data source location information of the target report and the structured information of the target report, so that the business data of the target report and the structured information of the target report generate the target report, and the business data of the target report is used to define the business indicators of the target report.
[0158] In one possible implementation, the report configuration information includes user permission information, data source location information, and structural reference information. The acquisition module 401 is used to respond to the data query request of the target user and determine the identity information of the target user and the report information to be retrieved. When one of the multiple report configuration information includes user permission information that matches the identity information of the target user and data source location information of the report that matches the report information to be retrieved, the configuration information of the target report is determined to be one of the multiple configuration report information.
[0159] In one possible implementation, the acquisition module 401 is used to acquire the target business table to which the business indicators of the target report belong based on the data source location information of the target report; and to determine the business indicators of the target business based on the structured information of the target report and the target business table.
[0160] In one possible implementation, the target business table includes business indicators and field information corresponding to the business indicators, and the structured information of the target report includes: field information of the target report; the determining module 402 is used to obtain field information corresponding to the target business indicators that match the field information of the target report from the target business table based on the field information of the target report; and determine the business data of the target report based on the field information corresponding to the target business indicators and the target business indicators.
[0161] In one possible implementation, the structural reference information of the target report includes the field information of the target report and the dimension field object of the target report. The determining module 402 is used to extract the header field data and the row field data of the target report from the field information of the target report; determine the report header data of the target report based on the header field data and the dimension field object of the target report; and determine the report rows of the target report based on the row field data of the target report. The structured information of the target report includes the report header and the report rows of the target report.
[0162] In one possible implementation, the device 400 further includes a display module for determining the table structure of the target report based on the report header data and the report row data of the target report; determining the rendering data of the target report based on the business data and the table structure of the target report; and displaying the target report based on the rendering data of the target report.
[0163] In one possible implementation, the header field data of the target report includes the header fields of the target report and the header field association relationships. The display module 403 is used to determine the table field nesting relationship of the target report based on the header field association relationships and the row field association relationships; and to determine the table structure of the target report based on the header fields of the target report, the row fields of the target report, the table field nesting relationships, and the dimension field objects.
[0164] In one possible implementation, the business data of the target report includes the target business metrics and the field information of the target business metrics. The display module 403, when both the dimension field objects and the row field data of the target report match the field information of the target business metrics, determines the fill parameters of the target business metrics based on the dimension field objects and the row fields of the target report; based on the fill parameters of the target business metrics, it fills the target business metrics into the table structure of the target report to obtain the rendered data of the target report.
[0165] This application also provides a computer device, including: at least one processor; and a memory communicatively connected to the at least one processor. The memory stores a computer program executable by the at least one processor, which, when executed by the at least one processor, causes the computer device to perform a report generation method according to an embodiment of this application.
[0166] An exemplary embodiment of this application also provides a non-transitory computer-readable storage space storing a computer program, wherein the computer program, when executed by a computer's processor, is used to cause the computer to perform a report generation method according to an embodiment of this application.
[0167] An exemplary embodiment of this application also provides a computer program product, including a computer program, wherein, when executed by a computer's processor, the computer program is used to cause the computer to perform a report generation method according to an embodiment of this application.
[0168] Although this application has been described in conjunction with specific features and embodiments, it is obvious that various modifications and combinations can be made thereto without departing from the spirit and scope of this application. Accordingly, this specification and drawings are merely exemplary illustrations of this application as defined by the appended claims, and are considered to cover any and all modifications, variations, combinations, or equivalents within the scope of this application. Clearly, those skilled in the art can make various alterations and modifications to this application without departing from the spirit and scope of this application. Thus, if such modifications and modifications of this application fall within the scope of the claims of this application and their equivalents, this application is also intended to include such modifications and modifications.
Claims
1. A report generation method, characterized in that, The method includes: In response to a data query request from a target user, configuration information of the target report accessible to the target user is obtained from multiple report configuration information. The configuration information of the target report includes the data source location information and the structural reference information of the target report. Based on the structural reference information of the target report, the structured information of the target report is determined, and the structured information of the target report is used to define the table structure of the target report; Based on the data source location information and the structured information of the target report, the business data of the target report is obtained, so that the business data of the target report and the structured information of the target report are used to generate the target report. The business data of the target report is used to define the business indicators of the target report.
2. The method according to claim 1, characterized in that, The report configuration information includes user permission information, data source location information, and structural reference information. In response to a target user's data query request, it retrieves the configuration information of the target report accessible to the target user from multiple report configuration information sources, including: In response to the data query request from the target user, determine the target user's identity information and the report information to be retrieved; When one of the multiple report configuration information includes user permission information matching the identity information of the target user and data source location information of the report matching the report information to be retrieved, the configuration information of the target report is determined to be one of the multiple report configuration information.
3. The method according to claim 1, characterized in that, The process of obtaining business data from the target report based on the data source location information and the structured information of the target report includes: Based on the data source location information of the target report, obtain the target business table to which the business indicators of the target report belong; Based on the structured information of the target report and the target business table, the business indicators of the target business are determined.
4. The method according to claim 3, characterized in that, The target business table includes business metrics and corresponding field information. The structured information of the target report includes the field information of the target report. Determining the business metrics of the target business based on the structured information of the target report and the target business table includes: Based on the field information of the target report, obtain the field information corresponding to the target business indicators that match the field information of the target report from the target business table; Based on the field information corresponding to the target business indicator and the target business indicator, the business data of the target report is determined.
5. The method according to any one of claims 1 to 4, characterized in that, The structural reference information of the target report includes the field information and dimension field objects of the target report. Determining the structured information of the target report based on the structural reference information includes: Extract the header field data and row field data of the target report from the field information of the target report; Based on the header field data of the target report and the dimension field object of the target report, determine the report header data of the target report; Based on the row field data of the target report, the report rows of the target report are determined. The structured information of the target report includes the report header and the report rows of the target report.
6. The method according to claim 5, characterized in that, The method further includes: Based on the header data and row data of the target report, the table structure of the target report is determined; Based on the business data and table structure of the target report, determine the rendering data of the target report; The target report is displayed based on the rendered data of the target report.
7. The method according to claim 6, characterized in that, The header field data of the target report includes the header fields and their relationships, and the row field data of the target report includes the row fields and their relationships. Determining the table structure of the target report based on its header data and row data includes: Based on the header field association relationship and the row field association relationship, determine the table field nesting relationship of the target report; The table structure of the target report is determined based on the header fields of the target report, the row fields of the target report, the nesting relationship of the table fields, and the dimension field objects.
8. The method according to claim 6, characterized in that, The business data of the target report includes the target business metrics of the target report and the field information of the target business metrics. Determining the rendering data of the target report based on the business data and the table structure of the target report includes: When both the dimension field object and the row field data of the target report match the field information of the target business indicator, the fill parameters of the target business indicator are determined based on the dimension field object and the row field of the target report. Based on the filling parameters of the target business indicators, the target business indicators are filled into the table structure of the target report to obtain the rendering data of the target report.
9. A computer device, characterized in that, include: processor; as well as, Memory for stored programs; The program includes instructions that, when executed by a processor, cause the processor to perform the method according to any one of claims 1 to 8.
10. A non-transitory computer-readable storage medium, characterized in that, The computer program is stored thereon, which, when executed by the processor of the computer, is used to cause the computer to perform the method according to any one of claims 1 to 8.