Report template generation method, device, electronic device and storage medium
By obtaining report metadata and determining the type and content of cells based on them, and automatically generating report templates, the problem of low efficiency of manual generation of report templates is solved, and fast and accurate report generation and data summary are achieved.
Patent Information
- Application Number
- CN202411110940.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-14
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2044-08-14
AI Technical Summary
In the prior art, it is necessary to manually generate report templates, resulting in low efficiency in report generation and data aggregation.
By obtaining report metadata, determining the type, location and filling content of the cell in standard format, creating variables and storing them into the corresponding cache container, rendering cells according to the container type, and generating report templates.
It realizes automatic generation of report templates, improves the speed of report generation and data summary, ensures that the generated cells comply with the standard format, and improves the accuracy of the report.
Smart Images

Figure CN118627488B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of report processing, and in particular to a report template generation method, device, electronic equipment and storage medium. Background Art
[0002] Statements are the most basic financial management tools for enterprises. By conducting statistical analysis on the business data of an enterprise, we can obtain the operating status of the enterprise and provide a basis for decision-making for business management, investment, loans and trade.
[0003] Currently, for some required report files, report templates need to be manually generated. However, the amount of data that needs to be processed in the report is huge, and the efficiency of manual processing is low. Summary of the invention
[0004] The present invention provides a report template generation method, device, electronic equipment and storage medium, which can improve the report generation speed and data aggregation speed.
[0005] According to one aspect of the present invention, a report template generation method is provided, the method comprising:
[0006] Get report metadata;
[0007] Determine the type, position and filled content of at least one cell according to the report metadata; the filled content is content in a standard format;
[0008] Creating variables for each of the cells according to the corresponding filled content of each of the cells;
[0009] storing the variables of each cell into a cache container of a corresponding container type according to the type of each cell;
[0010] According to the container type of the cache container where the variable of each cell is located, each cell is rendered at the position of each cell to generate a report template.
[0011] According to another aspect of the present invention, a report template generating device is provided, the device comprising:
[0012] Report metadata acquisition module, used to acquire report metadata;
[0013] A filling content determination module, used to determine the type, position and filling content of at least one cell according to the report metadata; the filling content is content in a standard format;
[0014] A variable creation module, used for creating a variable for each cell according to the corresponding filled content of each cell;
[0015] A variable cache module, used for storing the variables of each cell into a cache container of a corresponding container type according to the type of each cell;
[0016] The report template generating module is used to render each of the cells at the position of each of the cells according to the container type of the cache container where the variable of each of the cells is located, so as to generate a report template.
[0017] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0018] at least one processor; and
[0019] a memory communicatively connected to the at least one processor; wherein,
[0020] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the report template generation method described in any embodiment of the present invention.
[0021] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the report template generation method described in any embodiment of the present invention when executed.
[0022] The technical solution of the embodiment of the present invention can automatically generate each cell by determining the type, position and fill-in content of the standard format of the cell according to the report metadata, and make the generated cells conform to the standard format. The source report data can be format converted to speed up the generation of the report template. By creating variables for each cell according to the fill-in content and storing the created variables in the corresponding cache container according to the cell type, the cell is rendered at the cell position according to the container type, the cache mode and rendering mode can be flexibly selected, and the display result of the cell can be accurately calculated at the cell position and rendered for display, so as to generate the report template, and the report template is generated using the cell granularity to improve the accuracy of the report.
[0023] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0025] Figure 1 is a flow chart of a report template generation method provided according to the first embodiment of the present invention;
[0026] Figure 2 is a flow chart of a report template generation method provided according to Embodiment 2 of the present invention;
[0027] Figure 3 is a structural schematic diagram of a report template generating device provided according to Embodiment 3 of the present invention;
[0028] Figure 4 It is a structural schematic diagram of an electronic device for implementing the report template generating method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0029] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0030] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0031] Embodiment 1
[0032] Figure 1A flowchart of a report template generation method provided in Embodiment 1 of the present invention. The embodiment of the present invention is applicable to the case where a corresponding report template is generated according to report metadata. The method can be executed by a report template generation device, which can be implemented in the form of hardware and / or software. The report template generation device can be configured in an electronic device that carries a report template generation function, such as a vehicle-mounted terminal.
[0033] See also Figure 1 The report template generation method shown includes:
[0034] S101. Obtain report metadata.
[0035] The report metadata is used to determine the data structure of the report. When aggregating multiple report data, it is usually necessary to summarize the reports according to the same standard template, and the report metadata is used to describe the data structure of the standard template. Exemplarily, to summarize the reports of multiple agencies in an organization, the report data provided by each agency needs to be summarized according to the same standard template. Exemplarily, the report metadata can be obtained from an Excel spreadsheet file or a description file. The user can use the copy clipboard to enable the electronic device that implements the report template generation method provided in the embodiment of the present invention to monitor the copied metadata, perform format conversion, reproduce the format required to assemble the report according to the Excel data, and generate a report template.
[0036] In a specific example, the report metadata may specify the content and formula of each cell in a table, and the content of the parameters involved in the formula.
[0037] In addition, users can also configure report metadata. Users enter the report type, name, and keywords, and the system searches the search engine library to match the reports that meet the conditions in the current report library. The matching path is: first the report result library and then the report template library. First, match in the report result library. If the corresponding report is found, it is necessary to extract the report according to the organizational level corresponding to the query result, and obtain the report template according to the query result. The report template can be customized based on the report template, which is equivalent to automatically generating the corresponding report template with the report metadata. If no match is found, match in the report template library and obtain the report template according to the query result. The report template can also be customized based on the report template, which is equivalent to automatically generating the corresponding report template with the report metadata. If no match is found, the report template needs to be directly constructed.
[0038] S102: Determine the type, position and filled content of at least one cell according to the report metadata; the filled content is content in a standard format.
[0039] A cell may refer to a cell in a report template. The type of a cell may include at least one of the following: a formula, a dynamic data source, and a constant, etc. The position of a cell may include a row order and a column order, etc., and the position of a cell may also include a page number. Fill-in content may refer to content adapted to a standard format. Fill-in content may be used to determine the content displayed in a cell. Content in a standard format may refer to content that is recognizable by a system that implements the report template generation method provided by an embodiment of the present invention, as well as content that can be supported for processing. Usually, the content that needs to be filled in a cell is directly obtained data, rather than data that needs to be indirectly determined. Clear data can be directly determined as the fill-in content of the cell, and indirectly determined data needs to be converted into data determined by a processing method that the system can support. Specifically, if the type of the cell is a formula, the calculation method of the formula needs to be converted into a calculation method that the system can support, such as converting the calculation method into a function supported by the system; for example, if the type of the cell is referenced data, the reference method and the referenced object need to be converted into a method and object that the system can support.
[0040] In an optional embodiment, for a cell whose type is a formula, the method for determining the fill-in content of the cell may be: determining the fill-in content based on the report metadata, including: obtaining at least one report formula in the report metadata; querying whether there is a corresponding standard function for each of the report formulas, and obtaining a function query result for each of the report formulas; when the function query result of the report formula includes at least one target function, using the same content to input into the report formula and each of the target functions respectively, to obtain a corresponding calculation result; comparing the calculation result of the report formula with the calculation result of each of the target functions, obtaining a target function consistent with the calculation result of the report formula, and determining it as a replacement function corresponding to the report formula; when the function query result is empty or there is no target function consistent with the calculation result of the report formula, generating a replacement function corresponding to the report formula; determining the replacement function corresponding to the report formula as the fill-in content corresponding to the cell filled with the report formula.
[0041] A report formula may refer to an expression for calculating a parameter, and the report formula includes at least one parameter. Each parameter may be a preset constant or data provided externally. A standard function may refer to a pre-built function, and is also a function that can be supported by a corresponding system that implements the report template generation method provided by an embodiment of the present invention. The report formula cannot be used directly in the corresponding system, and the report formula may be converted into a corresponding function, so that the corresponding system implements the calculation function corresponding to the report formula by calling the corresponding function. Among the multiple pre-created standard functions, it is detected whether there is a standard function corresponding to the report formula, and a function query result of the report formula is obtained. The function query result includes null or at least one standard function corresponding to the report formula. The standard function corresponding to the report formula may refer to a standard function that is consistent with the function of the report formula. Specifically, the parameters included in the report formula can be compared with the parameters of each standard function in the function library, and the standard function with the same function can be determined as the target function corresponding to the report formula. A report formula may not have a target function, and the corresponding function query result is null, or a report formula may correspond to at least one target function, and the corresponding function query result includes at least one target function. Exemplarily, a standard function that is consistent with the function of a report formula may refer to at least one of the number of parameters included, parameter names of the parameters, and parameter types of the parameters being the same.
[0042] When at least one objective function is obtained, the objective function needs to be verified. The verification is specifically performed by detecting whether the functions of each objective function are consistent with those of the report formula. The corresponding calculation result may refer to the same content being input into the report formula to obtain the calculation result of the report formula, and the same content being input into the objective function to obtain the calculation result of the objective function. Specifically, the same content is input into each objective function and the report formula, each objective function is calculated to obtain a calculation result, and the report formula is calculated to obtain a calculation result. The calculation results of the objective function are compared with the calculation results of the report formula respectively, and the objective function with the same calculation results is determined as the replacement function corresponding to the report formula. If there are multiple replacement functions, another set of the same content is used again to input each replacement function and the report formula, and the replacement functions with inconsistent calculation results are eliminated until only one replacement function remains.
[0043] If the calculation results of all target functions are inconsistent with the report formula, or the function query result is empty, indicating that there is no replacement function corresponding to the report formula in the standard function, then the replacement function corresponding to the report formula is selected. Specifically, the generation method can be: input the report formula into a pre-trained large language model to obtain the replacement function output by the large language model. Exemplarily, the composition of the report formula can be analyzed to generate the prompt word prompt, which is input into the large language model to generate the implementation code of the report formula. According to the implementation code, a standard function is created and used as the replacement function corresponding to the report formula. In a specific example, prompt can be the excel sum (formula name) formula js code.
[0044] If the generated replacement function still does not correspond to the report formula, a prompt message is generated to request manual processing. A replacement function corresponding to the report formula is determined as the fill-in content corresponding to the cell filled in by the report formula.
[0045] The standard functions in the function library can be matched according to the Excel formula extracted from the report metadata. By matching the parameter type of the Excel formula with the parameter type of the function library, the corresponding standard function can be obtained to form a function list, and the parameters of each target function in the list can be probed and replayed. If the return value of the target function based on the same input is consistent with the output result of the Excel report formula, it is determined that the report formula and the target function can be replaced, and the target function is determined as the replacement function. For formulas that do not have corresponding replacement functions, prompts are generated based on the analysis of the composition of the Excel formula, and input into the large language model to obtain the implementation code of the Excel formula, and the code is inferred and probed line by line to automatically generate a replacement function. Through the replacement of the report formula, the calculation parameters of the original report formula can be extracted for cells of the formula type, tested, called the existing standard function, and calculated the report formula to detect whether the standard function corresponds to the report formula; if there are multiple target functions, multiple target functions are called respectively, and the target function that is consistent with the calculation result of the report formula is determined as the replacement function, and the inconsistent target function is discarded. If the replacement function does not correspond to the report formula, the cell filled with the report formula will be marked in red and the user will be prompted to complete it manually.
[0046] By obtaining the report formulas involved in the report metadata and converting them into supported standard functions, the report formulas can be converted into supported standard functions according to the data format of the report template, achieving formula conversion accuracy and preparing for subsequent rendering of the report formulas.
[0047] In an optional embodiment, for a cell whose type is a dynamic data source, a method for determining the fill-in content of the cell may be: determining the fill-in content according to the report metadata includes: obtaining at least one function parameter in the report metadata; querying, according to each function parameter, in an associated standard data source whether there is a corresponding standard data source for each function parameter, and obtaining a data source query result for each function parameter; for each function parameter, when a target data source corresponding to the function parameter exists in the data source query result, querying, according to the function parameter, a reference content of the function parameter in the target data source; and querying, according to the function parameter, in the data source query result. If it is empty, obtain the source data corresponding to the function parameter; in the source data corresponding to the function parameter, obtain each source field of the source data; create a new standard data source for the source data, and generate a corresponding query statement according to each source field; according to the query statement corresponding to each source field and the function parameter, query the reference content of the function parameter in the new standard data source, and the source field generates a corresponding query statement for querying the reference content of the function parameter in the new standard data source according to the function parameter; for each function parameter, determine the fill-in content of the cell filled with the function parameter according to the reference content of the function parameter.
[0048] Function parameters can refer to parameters that reference data in external storage space. The parameter value of a function parameter can be queried from the referenced external storage space. The parameter value of a function parameter can be a single value, or a vector, matrix, or array composed of multiple values. The specific content of the parameter value of the function parameter is not specifically limited. The external storage space can include data sources (calling interfaces or obtaining data through network port communication), databases, and data tables. Among them, data that can be queried in the data source can refer to data from interfaces, other static data files, and other middleware files. The reference content of the function parameter can refer to the data corresponding to the function parameter in the standard data source.
[0049] The associated standard data source may refer to a data source that can communicate, and the data source can query the parameter value corresponding to the function parameter according to the function parameter. Specifically, the system that implements the report template generation method provided by the embodiment of the present invention has the function of communicating with the standard data source and obtaining the service provided by the standard data source, and also records the relevant information of the data content stored in the standard data source. In addition, the system for processing the report template cannot directly obtain the parameter value of the function parameter from the storage space outside the standard data source, so it is necessary to convert the source data of the function parameter into a standard data source that can be supported and processed to ensure that the generated report template can be processed correctly. The target data source corresponding to the function parameter may refer to the content that can query the function parameter. In at least one associated standard data source, it is detected whether there is a standard data source corresponding to the function parameter, and the data source query result of the function parameter is obtained. The data source query result may include null or at least one target data source. When the data source query result is null, it indicates that the space storing the parameter value of the function parameter is not a data source, and a data source needs to be established so that the system supports obtaining the parameter value of the function parameter. When the data source query result includes multiple target data sources, it is necessary to filter out a target data source from them.
[0050] A dynamic data set container can be constructed for each standard data source. The dynamic data set container includes field data included in the standard data source. One field data includes: the field name of the field and the description content of the field. One field data can be a key-value pair. The field name of the field is the key, and the description content of the field is the value. The description content of the field can include the description content of the left header and / or the upper header of the field. The field name of the field can be the index position of the field in the standard data source. For example, the field name is A1, which is the field of the cell in the first row of the A column. In addition, a field data can also include the content of the cell and other attribute information. And the identification information of the standard data source needs to be added to the field data. The function parameter can be matched with each field data, and the standard data source to which the identification information in the field data matched by the function parameter belongs is determined as the target data source corresponding to the function parameter. Specifically, the description information or pointing information of the function parameter, or the parameter identification of the function parameter, can be obtained, and matched with the field name description content in each field data, and the standard data source corresponding to the field data with the highest similarity is determined as the target data source. When there are multiple target data sources, one target data source may be selected from the multiple target data sources as the final result according to the function of the formula in which the function parameter participates and the description information of other parameters included in the formula.
[0051] When the data source query result is empty, a data source can be created for the source of the function parameter. The source data corresponding to the function parameter can refer to a data set that stores the parameter value corresponding to the function parameter. For example, the source data can be a data table or a database. The source data includes source fields. A new standard data source can be created to correspond to the source data. A corresponding query statement is generated based on each source field. The query statement is used to query the data corresponding to the function parameter in the standard data source.
[0052] The cell filled with the function parameter may refer to a cell whose display content is determined according to the reference content of the function parameter. The filled-in content is used to determine the display content. The display content of the cell is the data corresponding to the function parameter; or the display content of the cell is the calculation result obtained by the formula calculation in which the function parameter participates. The filled-in content can be the display content or the content that determines the display content. Exemplarily, the type of the cell is a dynamic data source, and the filled-in content of the cell can be: the id of the standard data source: the field name.
[0053] In a specific example, the process of dynamic data source replacement can be: extract all function parameters according to the current report content Excel table, and generate a report dynamic data set container. The dynamic data set container includes key-value pairs, for example, key=A1 (field name), value=A1's left header content. According to the dynamic data set container, semantic reasoning is performed on the function parameters, and the function parameters are matched and associated with the existing standard data sources that have been connected. For function parameters that cannot match the associated standard data source, the parameter values of such function parameters are usually derived from interfaces, other static data files, and other middleware files, etc., which can be scanned and matched by the table structure of the database. The database is normalized, and each table in the database is dynamically matched with the function parameters, and the attribute information of the corresponding organization is associated to generate a data query SQL (Structured Query Language) statement, and a personalized data source is created based on the SQL statement as a standard data source. To create a data source, an interface of the data source can be created. By calling the interface, the field name passed into the interface can be queried through a pre-generated query statement. Specifically, a record can be inserted into the standard data source.
[0054] The attribute information associated with the current organizational structure may refer to that the generated data source has the attribute information of the organization, and the permission is set for the acquisition operation of the function parameter. When the attribute information of the organization corresponding to the standard data source is verified, the parameter value of the function parameter can be obtained from the standard data source. For another example, according to the provided permission information, the part of the content corresponding to the permission information is selected from the parameter value corresponding to the function parameter in the standard data source as the fill-in content of the corresponding cell. By setting permissions, users (organizations) can query and obtain data within the scope of the permission.
[0055] By obtaining function parameters and querying the data source corresponding to the function parameters, the function parameters are associated with the data source. When the data source does not exist, a new data source can be created based on the source data corresponding to the function parameters to support obtaining the parameter values of the function parameters from the data source. The function parameter acquisition method can be converted to a supported acquisition method to ensure that the function parameter values are read correctly.
[0056] S103: Create a variable for each cell according to the corresponding filled content of each cell.
[0057] For each cell, create a variable for the cell and assign the variable created by the cell to the filled content.
[0058] S104. Store the variables of each cell into a cache container of a corresponding container type according to the type of each cell.
[0059] There is a corresponding relationship between the cell type and the container type. The cell variable is stored in a cache container of the container type corresponding to the cell type. The cache container is used to store variables. Different cache containers take out variables in different ways for calculation and rendering to generate the display content of the cell.
[0060] S105 , rendering each of the cells at the location of each of the cells according to the container type of the cache container where the variable of each of the cells is located, to generate a report template.
[0061] According to the container type, the stored variables are taken in turn for calculation in the corresponding manner to obtain the display content of the cell, and the display content of the cell is displayed at the cell position to generate a report template. The generated report template can include multiple cells, and the content displayed in the cell is the result of the calculation of the variable corresponding to the cell. When summarizing the report, the variable corresponding to the cell can be changed, for example, the data source associated with the variable of the dynamic data source, or the reference position in the associated data source, etc.
[0062] Optionally, rendering each of the cells at the position of each of the cells includes: when the type of the target grid is a formula and a dynamic data source, obtaining data of a statistical report pointed to by at least one dynamic data source, performing calculations according to a function of the target grid to obtain statistical results of the target grid; and rendering the statistical results of the target grid at the position of the target grid.
[0063] In a specific application scenario, the dynamic data source is at least one statistical report. A target cell of type dynamic data source may refer to a cell that needs to obtain data from an external data source. A target cell of type formula may refer to a cell that calculates the result of a formula. A target cell of type formula and dynamic data source may refer to a cell in which a parameter in the formula needs to obtain data from an external data source and the formula needs to be calculated. For each parameter that calls the dynamic data source in the formula, the data at the corresponding position is queried from the statistical report pointed to by the dynamic data source as the parameter value of the parameter. The parameter values of each parameter are substituted into the formula for calculation to obtain the calculation result of the formula, which is used as the statistical result of the target cell. The statistical result of the target cell is rendered at the position of the target cell to display the summary result in the report template.
[0064] In addition, the associated dynamic data source can also perform permission verification. When using the report template, the user needs to be verified. Only when the verification passes can the data at the corresponding location be queried from the statistical report corresponding to the dynamic data source pointed to by the cell, as the display content of the cell, or participate in the calculation of the cell formula.
[0065] By configuring the dynamic data source as a statistical report, querying the parameter values corresponding to the parameters of the target cell in the statistical report, substituting the parameter values into the formula of the target cell for calculation, obtaining the statistical results of the target cell, and displaying the statistical results at the position of the target cell, multiple statistical reports can be summarized and calculated in the report template, which speeds up the summary and reduces the summary cost.
[0066] The technical solution of the embodiment of the present invention can automatically generate each cell by determining the type, position and fill-in content of the standard format of the cell according to the report metadata, and make the generated cells conform to the standard format. The source report data can be format converted to speed up the generation of the report template. By creating variables for each cell according to the fill-in content and storing the created variables in the corresponding cache container according to the cell type, the cell is rendered at the cell position according to the container type, the cache mode and rendering mode can be flexibly selected, and the display result of the cell can be accurately calculated at the cell position and rendered for display, so as to generate the report template, and the report template is generated using the cell granularity to improve the accuracy of the report.
[0067] Embodiment 2
[0068] Figure 2 A flowchart of a report template generation method provided for the second embodiment of the present invention. Based on the above embodiments, the embodiment of the present invention concretizes "storing the variables of each cell into a cache container of a corresponding container type according to the type of each cell" as follows: when the type of the cell is static data, the variables of the cell are stored in a first cache container; when the type of the cell is reference data, the first variable in the variables of the cell is stored in a first cache container, and the second variable in the variables of the cell is stored in a second cache container, and the first variable references the second variable; the reference data includes a dynamic data source or a constant; when the type of the cell is a formula, the reference variable in the variables of the cell is stored in a corresponding cache container, and the third variable in the variables of the cell is stored in a third cache container, and the reference variable includes at least one of the following: a first variable, a second variable and a third variable, and the third variable references the reference variable. It should be noted that for the parts not described in detail in the embodiment of the present invention, please refer to the description of other embodiments.
[0069] See also Figure 2 The report template generation method shown includes:
[0070] S201. Obtain report metadata.
[0071] S202: Determine the type, position and filled content of at least one cell according to the report metadata; the filled content is content in a standard format.
[0072] S203: Create a variable for each cell according to the corresponding filled content of each cell.
[0073] S204: When the type of the cell is static data, store the variable of the cell in a first cache container.
[0074] Static data may refer to data that is stable and unchanged for a long time. Usually, static data can be directly obtained without calculation and directly rendered and displayed. The first cache container is used to store static data. The type of the cell is static data, and creating a variable for the cell may be: generating a variable for the cell and assigning the variable to the static data. For example, the static data is 3, and a variable a=3 is created.
[0075] S205. Store a first variable among the variables of the cell in a first cache container, and store a second variable among the variables of the cell in a second cache container, wherein the first variable references the second variable; and the reference data includes a dynamic data source or a constant.
[0076] Reference data can refer to data that cannot be directly obtained and needs to be provided by external transmission, for example, data obtained by calling an interface. Reference data can be understood as external parameters. Reference data can be changing data, that is, a dynamic data source, or long-term stable data, that is, constants. It should be noted that the constants in reference data and static data are both long-term stable data. The difference between the two is that static data can be data set in the report metadata, and constants in reference data can be data whose acquisition method is specified in the report metadata.
[0077] The type of the cell is reference data, and creating a variable for the cell includes: creating a second variable according to the reference expression of the reference data, creating a first variable of the reference data, and the first variable references the second variable. Creating variables in this way allows the first variable to instantly obtain the changed content when the content of the second variable is changed. The reference expression is used to obtain the reference data. Exemplarily, the reference data is a dynamic data source, and the reference expression includes the identifier of the dynamic data source and the index of the reference data in the dynamic data source (such as C3). In fact, the second variable can be understood as a variable of the reference method, and the first variable can be understood as a variable of the referenced data. The first cache container is used to store data, and the second cache container is used to store the acquisition method. Accordingly, the first variable is stored in the first cache container, and the second variable is stored in the second cache container. By creating variables, the constants and dynamic data sources of external parameters are referenced in a form-like manner, and the form-like references are placed in the second cache container. By creating variables stored in the first cache container, the variables stored in the second cache container are referenced, and two-way binding is achieved.
[0078] It should be noted that the cell type is static data, and the variables of the cell are all first variables.
[0079] S206. When the cell type is a formula, store a reference variable in the variables of the cell into a corresponding cache container, and store a third variable in the variables of the cell into a third cache container, wherein the reference variable includes at least one of the following: a first variable, a second variable, and a third variable, and the third variable references the reference variable.
[0080] The type of cell is a formula, and creating a variable for the cell includes: creating a third variable according to the logical expression of the target formula corresponding to the cell, creating a third variable of the reference formula included in the target formula, creating a first variable or a second variable of the parameter included in the target formula, creating a first variable when the parameter is static data, creating a second variable when the parameter is reference data, and creating a first variable for the reference data. If the reference formula included in the target formula or the included parameters have created corresponding variables, it is only necessary to establish a variable reference relationship between the target formula and the reference formula, and / or to establish a variable reference relationship between the target formula and the parameters. Specifically, the third variable of the formula is assigned to the logical expression and at least one of the referenced first variable, second variable and third variable. Among them, the logical expression can be a function expression, including the standard function established above.
[0081] It should be noted that the content filled in the cell of formula type is the replacement function, and the third variable can be a logical expression that calls the replacement function.
[0082] S207 , rendering each of the cells at the location of each of the cells according to the container type of the cache container where the variable of each of the cells is located, and generating a report template.
[0083] After all cells are traversed, a three-layer cache container is established. All variables in the second cache container are calculated, and all variable references are calculated through the third cache container to achieve the rendering of the entire cell.
[0084] In an optional embodiment, the method of rendering each cell at the location of each cell according to the container type of the cache container where the variables of each cell are located to generate a report template includes: creating multiple working threads; running each working thread according to the scheduling period corresponding to each working thread; the scheduling period corresponding to the working thread is determined according to the number and container type of cache containers calculated by the working thread; running each working thread, obtaining the variables of the cell from the corresponding cache container, calculating the obtained cell variables, and rendering the obtained cell variables at the location of the obtained cell.
[0085] The rendering of the report template of the embodiment of the present invention is performed in the browser. When rendering, the browser usually takes data for calculation and processing once at a certain interval. When displaying the report template, the browser calculates and renders the corresponding data based on the time scheduling mechanism. Especially for reports in the financial field, there is a huge amount of data in the report that needs to be processed. If the scheduling cycle is too short, the load pressure of the browser is too large, and problems are prone to occur during operation. For data with different calculation amounts, different times are used for scheduling, which can alleviate the load pressure of the browser while taking into account the real-time nature of the report data.
[0086] The work thread is used to process the data of the report template and generate display content, which is provided to the rendering module for display. The variables in each cache container can be traversed and calculated. The calculation task can be assigned to each work thread, and the scheduling period of the work thread is determined according to the number and container type of the cache containers involved in the calculation task assigned to the work thread. Exemplarily, the scheduling period of the work thread whose container type only includes the first cache container and / or the second cache container is set to millisecond scheduling; the scheduling period of the work thread whose container type includes the third cache container is set to second scheduling. For another example, the calculation amount of the calculation task is determined according to the container type and the number of cache containers, and the scheduling period is determined according to the calculation amount. Exemplarily, each container type is set with a corresponding weight, the number of cache containers is divided into multiple number ranges, and a corresponding weight is set for each number range. The corresponding weights of the container type and the number of cache containers can be detected, and the weighted sum can be calculated to obtain the calculation amount of the calculation task, and the corresponding scheduling period of the work thread can be determined according to the corresponding relationship between the calculation amount and the scheduling period. Generally, the larger the calculation amount, the longer the scheduling period, and the smaller the calculation amount, the shorter the scheduling period.
[0087] In an optional embodiment, when the container type of the cache container in the computing task assigned to the working thread includes a first cache container or a Durr cache container, the scheduling period of the working thread is set to milliseconds; when the container type of the cache container in the computing task assigned to the working thread includes a third cache container, the scheduling period of the working thread is set to seconds.
[0088] A worker thread executes each calculation task in the order of the scheduling cycle. For each calculation task, the worker thread reads the variables from the cache container for calculation. The worker thread is also used to send the calculation result of the cell variable to the rendering module, and render and display the calculation result at the position of the cell on the browser page. Usually, a cell of type static data displays the assigned content of the first variable. A cell of type dynamic data source displays the assigned content of the first variable. A cell of type formula displays the calculation result of the formula of the third variable.
[0089] In a specific example, a task scheduler can be created. Multiple Web Workers work threads are constructed, each work thread is registered to the task scheduler for management, and the entire task scheduler establishes a time scheduling mechanism based on the cache container relationship. If the work thread only references the second cache container and the first cache container, the scheduling period of the time scheduling is set to milliseconds. When the work thread is associated with multiple cache containers, the scheduling period of the time scheduling is set to seconds.
[0090] By creating a worker thread to handle the variable calculation of each cache container and determining the scheduling period of the worker thread according to the type and number of cache containers processed by the worker thread, the real-time nature of the rendered data can be taken into account while avoiding excessive load pressure, thereby improving the real-time nature and accuracy of report rendering.
[0091] In an optional embodiment, the report template generation method also includes: during the running process of each of the working threads, for the variables of each of the cells, when the container type of the cache container where the variables of the cell are located is the first cache container, an exclusive lock is allocated to the variables of the cell, and the variables of the cell are calculated; when the calculation of the variables of the cell is completed, a shared lock is allocated to the variables of the cell; when there are multiple variables dependent on the target variable, an optimistic lock is allocated to the target variable.
[0092] Usually, during the operation of a worker thread, specifically during the process of a worker thread obtaining a cell variable for calculation, a lock can be allocated for the obtained variable, so that the concurrently executed worker thread can calculate the variable that can be obtained under the lock mechanism, or wait for the variable lock to be released and wait for the variable to be obtained for calculation. Locks need to be allocated for the calculation and update of the same resource to avoid the problem that parallel processing worker threads process the same variable at the same time, resulting in inconsistent variables and incorrect display results of the report template. An exclusive lock can mean that the locked object can only be exclusively owned by one worker thread at the same time. A shared lock can mean that the locked object can be obtained by multiple worker threads at the same time. An optimistic lock can mean that the locked object can be obtained by multiple worker threads at the same time when there is no conflict in the submitted data. When the lock is released, it can be obtained and locked by any worker thread. When the container type of the cache container where the cell variable is located is the first cache container, it indicates that the value of the variable is stable for a long time. When a worker thread calculates the variable, it is necessary to avoid other worker threads from calculating the variable at the same time. When accessing the variables in the first cache container, an exclusive lock needs to be allocated. A worker thread that calculates the variable obtains the exclusive lock and calculates the variable, while other worker threads cannot obtain the exclusive lock and thus cannot calculate the variable. At this time, only one worker thread can calculate the variable. When the variable is calculated, it indicates that the variable has been updated. At this time, it can be accessed by other worker threads. At this time, the exclusive lock can be upgraded to a shared lock. Other worker threads can apply for the shared lock of the variable and obtain access rights to the variable. If a variable is referenced by multiple variables and the lock of the variable is not an optimistic lock, the lock of the variable is modified to an optimistic lock. Specifically, when a worker thread processes a variable and the variable is not referenced by multiple other variables, an exclusive lock is allocated to the variable. When the variable calculation is completed, the lock of the variable is upgraded to a shared lock. When the variable is processed by other worker threads, it is still changed to an exclusive lock and upgraded to a shared lock after the processing is completed. When a variable is referenced by multiple other variables, an optimistic lock is allocated to the variable.
[0093] In a specific example, when all task schedulers start scheduling, a lock upgrade mechanism for exclusive locks, shared locks, and optimistic locks is established based on the dependency depth of the variables of each cache container. The dependency depth can be expressed by the number of referenced variables. When the variable in the first cache container is calculated, if the variable is not associated with other cache containers, an exclusive lock is allocated. When the worker thread completes the calculation, the lock is upgraded to a shared lock at the same time; if the values of multiple cache containers depend on the variable, an optimistic lock is established for the variable.
[0094] By assigning corresponding locks to variables in the cache container according to the type of cache container and the association depth of the variables, data consistency can be maintained during the concurrent calculation of the variables, the accuracy of variable calculation can be improved, and the data accuracy of the report template can be improved.
[0095] The technical solution of the embodiment of the present invention can classify the variables of cells by storing the variables created for different types of cells in different cache containers, provide data preparation for subsequent calculation and rendering of different types of cells, and improve the processing flexibility and pertinence of cells.
[0096] In an optional embodiment, the report template generation method may further include displaying data lineage relationships. Specifically, by establishing a cache container, when it is necessary to see the data source of a cell, the reference relationship between the variables recorded in each cache container can be obtained, and the cell can be indexed in the reference relationship to achieve data lineage relationship search.
[0097] In an optional embodiment, after the report template is generated, the report template may be stored. In fact, the stored report template is a rendered report. When the report template is saved, since the report template is unstructured data, when the report template is saved, the unstructured data is automatically converted into structured data for storage. Specifically, storing the report template may include: extracting report feature values, generating database query statements, and saving data.
[0098] Among them, extracting the report characteristic value may include: obtaining the report template identifier as the name of the report template; performing CRC (Cyclic Redundancy Check) algorithm encoding according to the binary stream of the report template, extracting the exclusive characteristic value of the report template, and determining it as the unique characteristic value of the report template; by parsing the report template, parsing it line by line, determining the header title and header field of the report template, using the number of the cell where the header field is located as the field name, and using the header field name as the field description, to generate a key-value pair of the report template. Among them, the binary stream of the report template includes the data of the report template and related attribute information. The parsing method of the report template is: obtaining the number of col (table column element), if col is 1, determining that the element is a title, when the number of cols in two connected rows is the same and greater than 1, the two rows of cols are header fields, and cells without values in the table need to be excluded.
[0099] Generating a database DDL (Data Definition Language) statement may include: automatically generating a data DDL creation statement based on the feature value extraction in the first step. For example, the statement may be: createtable table name (id int, di varchar, fields corresponding to each pinyin, createTime date).
[0100] Saving data may include: 1. Saving original data: parsing the report template row by row. When col is 1, the col cell is assumed to be a title and automatically discarded. When two consecutive rows have the same number of cols and are greater than 1, the col cells in the two rows are determined to be header fields and automatically discarded. Extract data row by row, and automatically match the cell number with the cell field according to the cell number. When a summarized cell appears, take the number of the first merged cell. For example, when cells in a column are merged into the same cell, the number of the first cell before the merge is determined as the number of the merged cell. 2. Field tuning: unify the dimensions of the contents of each cell in the report template, and the dimensions are expressed by field types. Obtain the type and length of the field value of each cell, and change the type and length of the field according to the data rules. Specifically, unify the type and length of the values in the same row, column, page, or part of the rows and columns.
[0101] Inverted index data creation: Remove the numeric columns from each row of data, concatenate them into rows of data, insert them into the search engine, create an inverted index, and point it to the report template to enable search of the report template.
[0102] The report template generated by the embodiment of the present invention can realize intelligent configuration mode and simple and easy-to-understand operation process; the statistical report can be customized to better meet the precision requirements; multiple conditions can be configured to perform statistics of different dimensions on the same detailed report; charts can be displayed to display data more clearly and facilitate recording; and data not to be displayed can be selected to display statistical report data more freely.
[0103] Embodiment 3
[0104] Figure 3 A schematic diagram of the structure of a report template generation device provided in Embodiment 3 of the present invention. The embodiment of the present invention can be applied to the case where a corresponding report template is generated according to report metadata, the device can execute a report template generation method, the device can be implemented in the form of hardware and / or software, and the device can be configured in an electronic device that carries a report template generation function.
[0105] See also Figure 3 The report template generating device shown includes:
[0106] The report metadata acquisition module 301 is used to acquire the report metadata;
[0107] A fill-in content determination module 302 is used to determine the type, position and fill-in content of at least one cell according to the report metadata; the fill-in content is content in a standard format;
[0108] A variable creation module 303, used to create a variable for each cell according to the corresponding filled content of each cell;
[0109] A variable cache module 304, used for storing the variables of each cell into a cache container of a corresponding container type according to the type of each cell;
[0110] The report template generating module 305 is used to render each cell at the position of each cell according to the container type of the cache container where the variable of each cell is located, and generate a report template.
[0111] The technical solution of the embodiment of the present invention can automatically generate each cell by determining the type, position and fill-in content of the standard format of the cell according to the report metadata, and make the generated cells conform to the standard format. The source report data can be format converted to speed up the generation of the report template. By creating variables for each cell according to the fill-in content and storing the created variables in the corresponding cache container according to the cell type, the cell is rendered at the cell position according to the container type, the cache mode and rendering mode can be flexibly selected, and the display result of the cell can be accurately calculated at the cell position and rendered for display, so as to generate the report template, and the report template is generated using the cell granularity to improve the accuracy of the report.
[0112] Furthermore, the fill-in content determination module includes: a report formula acquisition unit, which acquires at least one report formula in the report metadata; a function query unit, which is used to query whether there is a corresponding standard function for each of the report formulas, and obtain the function query results of each of the report formulas; a unit testing unit, which is used to, when the function query result of the report formula includes at least one target function, use the same content to input the same content into the report formula and each of the target functions, and obtain the corresponding calculation result; a replacement function verification unit, which is used to compare the calculation result of the report formula with the calculation result of each of the target functions, obtain the target function consistent with the calculation result of the report formula, and determine it as the replacement function corresponding to the report formula; a replacement function generation unit, which is used to generate a replacement function corresponding to the report formula when the function query result is empty or there is no target function consistent with the calculation result of the report formula; a content determination unit, which is used to determine the replacement function corresponding to the report formula as the fill-in content corresponding to the cell filled in by the report formula.
[0113] Furthermore, the fill-in content determination module includes: a function parameter acquisition unit, which is used to acquire at least one function parameter in the report metadata; a data source query unit, which is used to query whether there is a corresponding standard data source for each function parameter in the associated standard data source according to each function parameter, and obtain the data source query result of each function parameter; a target data source determination unit, which is used to query the reference content of the function parameter in the target data source according to the function parameter when there is a target data source corresponding to the function parameter in the data source query result; a source data acquisition unit, which is used to acquire the source data corresponding to the function parameter when the data source query result is empty; and a source data source query unit. A field acquisition unit is used to acquire each source field of the source data in the source data corresponding to the function parameter; a data source creation unit is used to create a new standard data source for the source data and generate corresponding query statements according to each source field; a content query unit is used to query the reference content of the function parameter in the new standard data source according to the query statements corresponding to each source field and the function parameter, and the source field generates a corresponding query statement for querying the reference content of the function parameter in the new standard data source according to the function parameter; a content determination unit is used to determine the fill-in content of the cell filled with the function parameter according to the reference content of the function parameter for each function parameter.
[0114] Furthermore, the cache container includes a first cache container, a second cache container and a third cache container; the variable cache module includes: a first cache unit, used to store the variables of the cell in the first cache container when the type of the cell is static data; a second cache unit, used to store the first variable in the variables of the cell in the first cache container when the type of the cell is reference data, and store the second variable in the variables of the cell in the second cache container, and the first variable references the second variable; the reference data includes a dynamic data source or a constant; a third cache unit, used to store the referenced variables in the variables of the cell in the corresponding cache container when the type of the cell is a formula, and store the third variable in the variables of the cell in the third cache container, and the referenced variables include at least one of the following: the first variable, the second variable and the third variable, and the third variable references the referenced variable.
[0115] Furthermore, the report template generation module includes: a thread creation unit, used to create multiple working threads; a thread scheduling unit, used to run each working thread according to a scheduling period corresponding to each working thread; the scheduling period corresponding to the working thread is determined according to the number and container type of cache containers calculated by the working thread; a thread running unit, used to run each working thread, obtain cell variables from the corresponding cache container, calculate the obtained cell variables, and render the obtained cell variables at the position of the obtained cell.
[0116] Furthermore, the report template generation device also includes: an exclusive lock allocation module, which is used to allocate exclusive locks to the variables of each cell during the running process of each of the working threads, and calculate the variables of the cell when the container type of the cache container where the variables of the cell are located is the first cache container; a shared lock allocation module, which is used to allocate shared locks to the variables of the cell when the calculation of the variables of the cell is completed; and an optimistic lock allocation module, which is used to allocate an optimistic lock to the target variable when there are multiple variables dependent on the target variable.
[0117] Furthermore, the report template generation module includes: a target grid calculation unit, which is used to obtain data of a statistical report pointed to by at least one dynamic data source when the type of the target grid is a formula and a dynamic data source, and perform calculations according to the function of the target grid to obtain statistical results of the target grid; and a statistical result rendering unit, which is used to render the statistical results of the target grid at the position of the target grid.
[0118] The report template generating device provided in the embodiment of the present invention can execute the report template generating method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0119] In the technical solutions of the embodiments of the present invention, the acquisition, storage and application of the data involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0120] Embodiment 4
[0121] Figure 4 A schematic diagram of the structure of an electronic device 400 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0122] like Figure 4 As shown, the electronic device 400 includes at least one processor 401, and a memory connected to the at least one processor 401 in communication, such as a read-only memory (ROM) 402, a random access memory (RAM) 403, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 401 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 402 or the computer program loaded from the storage unit 408 to the random access memory (RAM) 403. In the RAM 403, various programs and data required for the operation of the electronic device 400 can also be stored. The processor 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0123] Multiple components in the electronic device 400 are connected to the I / O interface 405, including: an input unit 406, such as a keyboard, a mouse, etc.; an output unit 407, such as various types of displays, speakers, etc.; a storage unit 408, such as a disk, an optical disk, etc.; and a communication unit 409, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 409 allows the electronic device 400 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0124] The processor 401 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 401 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 401 executes the various methods and processes described above, such as a report template generation method.
[0125] In some embodiments, the report template generation method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 408. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 400 via the ROM 402 and / or the communication unit 409. When the computer program is loaded into the RAM 403 and executed by the processor 401, one or more steps of the report template generation method described above may be performed. Alternatively, in other embodiments, the processor 401 may be configured to execute the report template generation method in any other appropriate manner (e.g., by means of firmware).
[0126] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0127] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0128] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, device, or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0129] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0130] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0131] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS (Virtual Private Server) services.
[0132] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0133] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A report template generation method, characterized in that: The method comprises: Get report metadata; Determine the type, position and filled content of at least one cell according to the report metadata; the filled content is content in a standard format; Creating variables for each of the cells according to the corresponding filled content of each of the cells; storing the variables of each cell into a cache container of a corresponding container type according to the type of each cell; Rendering each of the cells at the location of each of the cells according to the container type of the cache container where the variable of each of the cells is located, to generate a report template; Determining the filling content according to the report metadata includes: In the report metadata, obtaining at least one report formula; Query whether each of the report formulas has a corresponding standard function, and obtain function query results for each of the report formulas; When the function query result of the report formula includes at least one objective function, the same content is input into the report formula and each objective function to obtain a corresponding calculation result; Compare the calculation result of the report formula with the calculation results of each of the objective functions, obtain an objective function that is consistent with the calculation result of the report formula, and determine it as a replacement function corresponding to the report formula; When the function query result is empty or there is no target function that is consistent with the calculation result of the report formula, a prompt word is generated according to the report formula, and is input into the large language model for processing, and the implementation code of the report formula is output; According to the implementation code of the report formula, a standard function is created and determined as a replacement function of the report formula; The replacement function corresponding to the report formula is determined as the filling content corresponding to the cell filled with the report formula.
2. The report template generation method according to claim 1, characterized in that: Determining the filling content according to the report metadata includes: Obtaining at least one function parameter in the report metadata; According to each of the function parameters, querying in the associated standard data sources whether each of the function parameters has a corresponding standard data source, and obtaining a data source query result for each of the function parameters; For each of the function parameters, when the data source query result contains a target data source corresponding to the function parameter, querying the target data source for reference content of the function parameter according to the function parameter; When the data source query result is empty, obtaining the source data corresponding to the function parameter; In the source data corresponding to the function parameter, obtaining each source field of the source data; Creating a new standard data source for the source data, and generating corresponding query statements according to the source fields; According to the query statements corresponding to the source fields and the function parameters, the reference content of the function parameters is queried in the new standard data source, and the source fields generate corresponding query statements for querying the reference content of the function parameters in the new standard data source according to the function parameters; For each of the function parameters, the filling content of the cell filled with the function parameter is determined according to the reference content of the function parameter.
3. The report template generation method according to claim 1, characterized in that: The cache container includes a first cache container, a second cache container and a third cache container; The step of storing the variables of each cell into a cache container of a corresponding container type according to the type of each cell includes: When the type of the cell is static data, storing the variable of the cell in a first cache container; When the type of the cell is reference data, a first variable in the variables of the cell is stored in a first cache container, and a second variable in the variables of the cell is stored in a second cache container, the first variable references the second variable; the reference data includes a dynamic data source or a constant; When the cell type is a formula, a reference variable in the variables of the cell is stored in a corresponding cache container, and a third variable in the variables of the cell is stored in a third cache container, wherein the reference variable includes at least one of the following: a first variable, a second variable, and a third variable, and the third variable references the reference variable.
4. The report template generation method according to claim 3, characterized in that: The step of rendering each cell at the position of each cell according to the container type of the cache container where the variable of each cell is located to generate a report template includes: Create multiple worker threads; Run each of the working threads according to the scheduling period corresponding to each of the working threads; the scheduling period corresponding to the working thread is determined according to the number and container type of cache containers calculated by the working thread; Each of the working threads is run to obtain a variable of a cell from a corresponding cache container, calculate the variable of the obtained cell, and render the variable of the obtained cell at the position of the obtained cell.
5. The report template generation method according to claim 4, characterized in that: Also includes: During the running process of each of the working threads, for the variables of each of the cells, when the container type of the cache container where the variables of the cells are located is the first cache container, an exclusive lock is allocated to the variables of the cells, and the variables of the cells are calculated; When the variable calculation of the cell is completed, assigning a shared lock to the variable of the cell; When there are multiple variables that depend on the target variable, an optimistic lock is assigned to the target variable.
6. The report template generation method according to claim 1, characterized in that: Rendering each of the cells at the position of each of the cells includes: When the type of the target cell is a formula and a dynamic data source, data of a statistical report pointed to by at least one dynamic data source is obtained, and calculation is performed according to the function of the target cell to obtain a statistical result of the target cell; At the position of the target grid, the statistical result of the target grid is rendered.
7. A report template generating device, characterized in that: The device comprises: Report metadata acquisition module, used to acquire report metadata; A filling content determination module, used to determine the type, position and filling content of at least one cell according to the report metadata; the filling content is content in a standard format; A variable creation module, used for creating a variable for each cell according to the corresponding filled content of each cell; A variable cache module, used for storing the variables of each cell into a cache container of a corresponding container type according to the type of each cell; A report template generation module, used for rendering each cell at the position of each cell according to the container type of the cache container where the variable of each cell is located, and generating a report template; The filling content determination module includes: A report formula acquisition unit, which acquires at least one report formula from the report metadata; A function query unit, used to query whether each report formula has a corresponding standard function, and obtain a function query result of each report formula; A unit testing unit, used for, when the function query result of the report formula includes at least one objective function, inputting the same content into the report formula and each of the objective functions to obtain corresponding calculation results; A replacement function verification unit, used to compare the calculation result of the report formula with the calculation results of each of the objective functions, obtain an objective function that is consistent with the calculation result of the report formula, and determine it as a replacement function corresponding to the report formula; A replacement function generating unit is used to generate prompt words according to the report formula when the function query result is empty or there is no target function that is consistent with the calculation result of the report formula, and input the prompt words into the large language model for processing, and output the implementation code of the report formula; create a standard function according to the implementation code of the report formula, and determine it as the replacement function of the report formula; The content determination unit is used to determine the replacement function corresponding to the report formula as the filling content corresponding to the cell filled with the report formula.
8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the report template generation method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the report template generation method according to any one of claims 1 to 6 when executed.
Citation Information
Patent Citations
Template report generation method based on multistage container unloading
CN111796803A