Method, device, electronic equipment and computer readable medium for generating report data
By retrieving a list of atomic data from the database and performing data completion and total calculation, the problem of low-quality code and difficulty in reusing it in report development is solved, thereby improving code quality and development efficiency.
Patent Information
- Application Number
- CN202211174973.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-26
- Publication Date
- 2026-03-20
- Estimated Expiration
- 2042-09-26
AI Technical Summary
In existing technologies, low-quality code and code that is difficult to reuse are common problems in report development, leading to difficulties in testing, maintenance, and repetitive work.
By retrieving the atomic data list from the database, extracting the row and column element sets, performing data completion and total calculation, and finally converting the atomic data list into a report data list.
It enhanced code standards, improved code quality and reusability, reduced system complexity, and increased development efficiency and system response speed for report data processing.
Smart Images

Figure CN115617886B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of big data intelligent analysis, and in particular to a report data generation method and device, electronic equipment and computer readable medium. BACKGROUND
[0002] With the continuous development of the system, the demand for data reports is increasing, and each report needs different dimensional data reports to monitor the status of the business. Generally, the development process of the report is that each developer processes data in a customized manner according to specific business needs. Due to the differences in the abilities and understandings of the developers, low-quality code inevitably appears in the actual operation process. Not only is it difficult to locate problems in the testing process, but also it is difficult to maintain the code in the subsequent code transfer and maintenance. Moreover, the code is difficult to reuse, and there is a lot of repetitive work. SUMMARY
[0003] Therefore, the embodiments of the present application provide a report data generation method and device, electronic equipment and computer readable medium to solve the technical problems of low-quality code and code reuse difficulty.
[0004] To achieve the above object, according to an aspect of the embodiments of the present application, a report data generation method is provided, comprising:
[0005] obtaining an atomic data list from a database according to a query condition, and extracting a row element set and a column element set from the query condition;
[0006] performing data completion on the atomic data list according to the row element set and the column element set;
[0007] calculating a summary result of the completed atomic data list, and merging the summary result into the atomic data list;
[0008] converting the atomic data list into a report data list.
[0009] Optionally, performing data completion on the atomic data list according to the row element set and the column element set comprises:
[0010] grouping the atomic data list based on the row element set to obtain row groups;
[0011] for each row group, judging whether the atomic data corresponding to each column element in the row group is missing; if so, generating atomic data based on a data completion rule, and completing the atomic data into the atomic data list of the row group.
[0012] Optionally, data completion is performed on the atomic data list based on the row feature set and the column feature set, including:
[0013] The atomic data list is grouped based on the set of column elements to obtain column groups;
[0014] For each column group, determine whether the atomic data corresponding to each row element in the column group is missing; if so, generate atomic data based on the data completion rules and complete the atomic data into the atomic data list of the column group.
[0015] Optionally, calculating the total result of the completed atomic data list and merging the total result into the atomic data list includes:
[0016] For each row group, the atomic data in the completed row group are added together to obtain the total result of the row group, and the total result is added to the atomic data list of the row group.
[0017] Optionally, calculating the total result of the completed atomic data list and merging the total result into the atomic data list includes:
[0018] For each column group, the atomic data in the completed column group are added together to obtain the total result of the column group, and the total result is added to the atomic data list of the column group.
[0019] Optionally, converting the atomic data list into a report data list includes:
[0020] The atomic data in the atomic data list are sorted, and the sorted atomic data list is converted into a report data list.
[0021] Optionally, sorting the atomic data in the atomic data list includes:
[0022] Sort the rows into groups;
[0023] For each row group, the atomic data in the atomic data list of the row group are sorted according to the column elements.
[0024] Optionally, sorting the atomic data in the atomic data list includes:
[0025] Sort the groups by column;
[0026] For each column group, the atomic data in the atomic data list of the column group are sorted according to the row elements.
[0027] In addition, according to another aspect of the embodiments of the present application, a device for generating report data is provided, comprising:
[0028] a query module configured to obtain a list of atomic data from a database according to a query condition, and extract a set of row elements and a set of column elements from the query condition;
[0029] a completion module configured to complete data of the list of atomic data according to the set of row elements and the set of column elements;
[0030] a calculation module configured to calculate a calculation result of the list of atomic data after data completion, and merge the calculation result into the list of atomic data;
[0031] a conversion module configured to convert the list of atomic data into a list of report data.
[0032] Optionally, the completion module is further configured to:
[0033] group the list of atomic data according to the set of row elements to obtain row groups;
[0034] for each row group, determine whether atomic data corresponding to each column element in the row group is missing; if so, generate atomic data based on a data completion rule, and complete the atomic data into the list of atomic data of the row group.
[0035] Optionally, the completion module is further configured to:
[0036] group the list of atomic data according to the set of column elements to obtain column groups;
[0037] for each column group, determine whether atomic data corresponding to each row element in the column group is missing; if so, generate atomic data based on a data completion rule, and complete the atomic data into the list of atomic data of the column group.
[0038] Optionally, the calculation module is further configured to:
[0039] for each row group, add each atomic data in the row group after data completion to obtain a calculation result of the row group, and add the calculation result into the list of atomic data of the row group.
[0040] Optionally, the calculation module is further configured to:
[0041] for each column group, add each atomic data in the column group after data completion to obtain a calculation result of the column group, and add the calculation result into the list of atomic data of the column group.
[0042] Optionally, the conversion module is further configured to:
[0043] sort the atomic data in the atomic data list, and convert the sorted atomic data list into a report data list.
[0044] Optionally, the conversion module is further configured to:
[0045] sort each row group;
[0046] for each row group, sort the atomic data in the atomic data list of the row group according to column elements.
[0047] Optionally, the conversion module is further configured to:
[0048] sort each column group;
[0049] for each column group, sort the atomic data in the atomic data list of the column group according to row elements.
[0050] According to another aspect of the embodiments of the present application, an electronic device is also provided, comprising:
[0051] one or more processors;
[0052] a storage device configured to store one or more programs,
[0053] when the one or more programs are executed by the one or more processors, the one or more processors implement the method of any of the above embodiments.
[0054] According to another aspect of the embodiments of the present application, a computer readable medium is also provided, which stores a computer program, and the program is executed by a processor to implement the method of any of the above embodiments.
[0055] According to another aspect of the embodiments of the present application, a computer program product is also provided, which comprises a computer program, and the computer program is executed by a processor to implement the method of any of the above embodiments.
[0056] An embodiment of the above application has the following advantages or beneficial effects: because the technical means of obtaining an atomic data list from a database according to a query condition, extracting a row element set and a column element set from the query condition, then performing data completion on the atomic data list and calculating an aggregated result, and finally converting the atomic data list into a report data list are adopted, the technical problem of low-quality code and difficulty in code reuse in the prior art is overcome. The embodiment of the application can enhance code specification, improve code quality, improve code reuse rate, reduce system complexity, thereby improving the development efficiency of report data processing, and improving system response speed and robustness.
[0057] Further effects of the above non-conventional optional mode will be described below in conjunction with the specific embodiments. BRIEF DESCRIPTION OF DRAWINGS
[0058] In order to more clearly illustrate the technical solutions of the embodiments of the application or the prior art, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the application, and other drawings can be obtained by those skilled in the art without creative effort. Among them:
[0059] Figure 1 is a schematic diagram of the main process of the method for generating report data according to the embodiment of the application;
[0060] Figure 2 is a schematic diagram of the main process of data completion according to the embodiment of the application;
[0061] Figure 3 is a schematic diagram of the main process of calculating an aggregated result according to the embodiment of the application;
[0062] Figure 4 is a schematic diagram of the main process of format conversion of the report data list according to the embodiment of the application;
[0063] Figure 5 is a schematic diagram of the main modules of the device for generating report data according to the embodiment of the application;
[0064] Figure 6 is an exemplary system architecture diagram to which the embodiment of the application can be applied;
[0065] Figure 7 is a structural schematic diagram of a computer system of a terminal device or a server suitable for implementing the embodiment of the application. DETAILED DESCRIPTION
[0066] Exemplary embodiments of the present application are described herein with reference to the accompanying drawings, which are meant to be exemplary in nature, and include various details intended to facilitate understanding of the application. Accordingly, it should be understood that various changes and modifications to the embodiments described herein can be made by those having ordinary skill in the art without departing from the spirit and scope of the application. Likewise, it is to be understood that the features implied by the description above are included as generic features in the claims. Therefore, specific embodiments are not to be understood as being recessive to all possible combinations compatible with the state of the art.
[0067] The acquisition, storage, use, processing and the like of data in the technical solution of the present application comply with relevant provisions of national laws and regulations.
[0068] Figure 1 is a schematic diagram of the main flow of the method for generating report data according to an embodiment of the present application. As shown in Figure 1 the method for generating report data can include:
[0069] Step 101: acquiring a list of atomic data from a database according to a query condition, and extracting a set of row elements and a set of column elements from the query condition.
[0070] First, all atomic data meeting the given query condition is queried from the database according to the query condition, and the result returned by the database is a list of atomic data. The atomic data in the list can be ordered or unordered.
[0071] In an embodiment of the present application, the definition of atomic data is as follows:
[0072] Generally, a complete two-dimensional report is composed of the following three elements: row elements, column elements and table data.
[0073] {Report Example 1} Type C1 Type C2 Type C3 Type R1 Data 1 Data 2 Data 1 Type R2 Data 4 Data 5 Data 6 Type R3 Data 7 Data 8 Data 9
[0074] For example, in the above table, the row elements = {type R1 type R2 type R3}, the column elements = {type C1 type C2 type C3}, and the table data = {data1 data2…}, which is essentially a matrix with a title.
[0075] For the convenience of subsequent description, a restrictive assumption is proposed here: the row elements or column elements of the report are a set of fixed elements (since the row and column can be interchanged by matrix transposition, any description of the row or column can be based on transposition to obtain another form. For the convenience of processing, the subsequent description is based on the premise that the column elements are a set of fixed elements).
[0076] For example: column elements = {type C1 type C2 type C3}, row elements = {month-end date}, as shown in the following table:
[0077] {Report Example 2} Type C1 Type C2 Type C3 202112 Data 1 Data 2 Data 3 202201 Data 4 Data 5 Data 6 202202 Data 7 Data 8 Data 9 ……
[0078] From here we can see that the minimum data granularity of the report is: the form of "data1, data2" in the table data = {data1 data2…}, where one data corresponds to an element in the matrix, which is similar to a cell in an Excel table.
[0079] Therefore, from the intuitive understanding, the meaning of the report can be defined: the report is an ordered arrangement and organization of n cells under the constraints of table elements and column elements, according to the specified rules, where n >= 0, when n = 0, it represents that the report does not query any data.
[0080] Next, taking column elements = {type C1 type C2 type C3} and row elements = {month-end date} as an example, the data stored in the database is shown in the following table, where one row of data represents an atomic data or a cell.
[0081] End of month date Type Data 202112 Type C1 Data 1 202112 Type C2 Data 2 202112 Type C3 Data 3 202201 Type C1 Data 4 202201 Type C2 Data 5 202201 Type C3 Data 6 202202 Type C1 Data 7 202202 Type C2 Data 8 202202 Type C3 Data 9
[0082] In step 101, not only the atomic data list is obtained from the database, but also the row element set and the column element set are extracted from the query condition.
[0083] According to the row elements and column elements of the report, the row elements and column elements are defined, and the report elements include fields, types, and sorting, such as the following report:
[0084] {Report Example 2} Type C1 Type C2 Type C3 202112 Data 1 Data 2 Data 3 202201 Data 4 Data 5 Data 6 202202 Data 7 Data 8 Data 9 ……
[0085] It should be noted that the row elements and column elements can be defined as needed, such as the field of the row element is statDt, the type is String, and the sorting uses the default statDt, the field of the column element is dataTp, the type is String, and the sorting uses dataSn.
[0086] According to the query condition, the complete row element set and column element set are extracted, as shown below:
[0087] Row element set Column element set 202112 Type C1 202201 Type C2 202202 Type C3 ……
[0088] Step 102, according to the row element set and the column element set, the atomic data list is data completed.
[0089] According to step 101, the query result is a list of atomic data. If the situation of partial atomic data missing is considered, the real report data is actually a sparse matrix, so data completion of the sparse matrix is needed.
[0090] Optionally, step 102 can comprise grouping the atomic data list based on the set of row elements to obtain row groups; for each row group, judging whether the atomic data corresponding to each column element in the row group is missing; if yes, generating atomic data based on a data completion rule, and completing the atomic data into the atomic data list of the row group. In some embodiments of the present application, all atomic data in the atomic data list can be grouped based on the set of row elements, each group representing a row element, and each row group containing all atomic data corresponding to the row element, and then judging whether the atomic data corresponding to each column element in the row group is missing, and if missing, generating atomic data based on a preset data completion rule (such as completion to zero or empty), and completing the atomic data into the row group.
[0091] Optionally, step 102 can comprise grouping the atomic data list based on the set of column elements to obtain column groups; for each column group, judging whether the atomic data corresponding to each row element in the column group is missing; if yes, generating atomic data based on a data completion rule, and completing the atomic data into the atomic data list of the column group. In some embodiments of the present application, all atomic data in the atomic data list can also be grouped based on the set of column elements, each group representing a column element, and each column group containing all atomic data corresponding to the column element, and then judging whether the atomic data corresponding to each row element in the column group is missing, and if missing, generating atomic data based on a preset data completion rule (such as completion to zero or empty), and completing the atomic data into the column group.
[0092] Sparse report data: column elements = {type C1 type C2 type C3}, row elements = {end-of-month date}, as shown in the following table:
[0093] {Report Example 2-1} Type C1 Type C2 Type C3 202112 Missing data 1 Data 2 Missing data 3 202201 Data 4 Missing data 5 Missing data 6 202202 Data 7 Data 8 Missing data 9 ……
[0094] Completed report data: column elements = {type C1 type C2 type C3}, row elements = {end-of-month date}, as shown in the following table:
[0095] {Report Example 2-2} Type C1 Type C2 Type C3 202112 Supplementary data 1 Data 2 Supplementary data 3 202201 Data 4 Supplementary data 5 Supplementary data 6 202202 Data 7 Data 8 Supplementary data 9 ……
[0096] Step 103, calculating the total result of the completed atomic data list, and merging the total result into the atomic data list.
[0097] Generally, there is a total result in a report, so a step of calculating the total result is needed.
[0098] Optionally, step 103 can include: for each row group, adding each atomic data in the completed row group to obtain a total result of the row group, and adding the total result to the atomic data list of the row group. In some embodiments of the present application, each atomic data can be accumulated according to row groups to obtain a total result of each row group, and then the total result is added to the atomic data list of the corresponding row group.
[0099] Optionally, step 103 can include: for each column group, adding each atomic data in the completed column group to obtain a total result of the column group, and adding the total result to the atomic data list of the column group. In some embodiments of the present application, each atomic data can also be accumulated according to column groups to obtain a total result of each column group, and then the total result is added to the atomic data list of the corresponding column group.
[0100] The total report data: column elements = {type C1 type C2 type C3}, row elements = {month-end date}, as shown in the following table:
[0101] {Report Example 2-3} Type C1 Type C2 Type C3 202112 Supplementary data 1 Data 2 Supplementary data 3 202201 Data 4 Supplementary data 5 Supplementary data 6 202202 Data 7 Data 8 Supplementary data 9 …… Total Sum (Type C1) Sum (Type C2) Sum (Type C3)
[0102] Step 104, converting the atomic data list into a report data list.
[0103] Through the foregoing steps, a relatively complete atomic data list can be obtained, but this atomic data list is still only a list, although the data thereof can constitute a complete matrix and also contains total data, atomic data still needs to be reasonably transformed to finally obtain the report data required by us.
[0104] Optionally, step 104 can include: sorting the atomic data in the atomic data list, and converting the sorted atomic data list into a report data list. The atomic data can be sorted according to rows or columns, and then the sorted atomic data list is converted into a report data list.
[0105] Specifically, the sorting can be performed according to groups first, and then the atomic data in each group is sorted, each group generates a report data through conversion, and the report data is merged into the final report data list.
[0106] Optionally, the atomic data in the atomic data list is sorted, including: sorting each row group; and for each row group, sorting the atomic data in the atomic data list of the row group according to column elements. In some embodiments of the present application, each row group can be sorted first, and each row group represents a row element, and then all the atomic data in each row group can be sorted according to column elements.
[0107] Optionally, the atomic data in the atomic data list is sorted, including: sorting each column group; and for each column group, sorting the atomic data in the atomic data list of the column group according to row elements. In some embodiments of the present application, each column group can be sorted first, and each column group represents a column element, and then all the atomic data in each column group can be sorted according to row elements.
[0108] The final atomic data list is as follows:
[0109] End of month date Type Data 202112 Type C1 Supplementary data 1 202112 Type C2 Data 2 202112 Type C3 Supplementary data 3 202201 Type C1 Data 4 202201 Type C2 Supplementary data 5 202201 Type C3 Supplementary data 6 202202 Type C1 Data 7 202202 Type C2 Data 8 202202 Type C3 Supplementary data 9 209912 Type C1 Sum (Type C1) 209912 Type C2 Sum (Type C2) 209912 Type C3 Sum (Type C3)
[0110] The converted report data list: column elements = {type C1 type C2 type C3}, row elements = {month-end date}, as shown in the following table:
[0111] {Report Example 3} Type C1 Type C2 Type C3 202112 Supplementary data 1 Data 2 Supplementary data 3 202201 Data 4 Supplementary data 5 Supplementary data 6 202202 Data 7 Data 8 Supplementary data 9 209912 Sum (Type C1) Sum (Type C2) Sum (Type C3)
[0112] According to the various embodiments described above, it can be seen that the embodiments of the present application solve the technical problems of low-quality code and difficult code reuse in the prior art by obtaining an atomic data list from a database according to a query condition, extracting a row element set and a column element set from the query condition, performing data completion on the atomic data list and calculating a summary result, and finally converting the atomic data list into a report data list. The embodiments of the present application can enhance code specification, improve code quality, improve code reuse rate, and reduce system complexity, thereby improving the development efficiency of report data processing, and improving system response speed and robustness.
[0113] Figure 2 is a schematic diagram of the main process of data completion according to an embodiment of the present application. Taking a column group as an example, as shown in Figure 2 , step 102 can include:
[0114] Step 201, grouping the atomic data list based on the column element set to obtain a plurality of column groups.
[0115] It should be noted that each group represents a column element, and each column group contains all atomic data corresponding to the column element.
[0116] Step 202, judging whether the atomic data corresponding to each row element in the column group is missing; if yes, executing step 203; if no, executing step 204.
[0117] Step 203, generating the atomic data based on the data completion rule, and completing the atomic data into the atomic data list of the column group.
[0118] Step 204, judging whether the column group is processed; if yes, ending; if no, executing step 202.
[0119] The embodiment of the present application traverses each column group one by one, completes the missing data in each column group, judges whether the data in the group is complete based on the complete row element set or column element set, if the data is missing, then adds a new atomic data, initializes the atomic data using the current row element and column element, and completes into the atomic data list, thereby obtaining the complete atomic data list.
[0120] In addition, the specific implementation of the method for generating report data in the reference embodiment of the present application has been described in detail in the above method for generating report data, and thus the repeated content is not described herein.
[0121] Figure 3 is a schematic diagram of the main flow of calculating the total result according to the embodiment of the present application.
[0122] Taking the column group as an example, as shown in Figure 3 , step 103 can include:
[0123] Step 301, grouping the atomic data list based on the column element set, thereby obtaining a plurality of column groups.
[0124] It should be noted that each group represents a column element, and each column group contains all atomic data corresponding to the column element.
[0125] Step 302, for a column group, adding each atomic data in the column group after completion, thereby obtaining the total result of the column group.
[0126] Step 303, adding the total result into the atomic data list of the column group.
[0127] Step 304, judging whether the column group is processed; if yes, ending; if no, executing step 302.
[0128] The embodiment of the present application traverses each column group one by one, performs grouping calculation based on the complete column element set, generates a total atomic data for each group, and merges the generated atomic data into the atomic data list.
[0129] In addition, the specific implementation details of the method for generating report data in another reference embodiment of the present invention have been described in detail in the above-described method for generating report data, so the details will not be repeated here.
[0130] After obtaining the transformed report data list through steps 101-104, data needs to be extracted and converted according to different result formats. Typically, a DTO can be used to define the transformed report data list, and the final output data is given in VO format. The conversion from DTO to VO requires format conversion.
[0131] like Figure 4 As shown, the specific steps are as follows:
[0132] 1) Export and Conversion: Adapt data formats for file exports;
[0133] 2) Query Conversion: Adapt data formats for transaction queries.
[0134] VO (View Object): The view object in the domain model, used in the presentation layer to encapsulate all the data of a specified page or component.
[0135] DTO (Data Transfer Object): In the domain model, a data transfer object refers to the object used for data transfer between the presentation layer, service layer, and business logic layer.
[0136] Presentation layer: In the layered architecture of an application system, it usually refers to the layer that users can see, providing users with interaction tools and interaction logic.
[0137] Service layer: The system layer in an application system. It is generally an object-oriented interface that encapsulates business logic and exposes the interface to the outside world.
[0138] Figure 5 This is a schematic diagram of the main modules of an apparatus for generating report data according to an embodiment of the present invention. Figure 5 As shown, the apparatus 500 for generating report data includes a query module 501, a completion module 502, a totaling module 503, and a conversion module 504. The query module 501 is used to obtain an atomic data list from the database according to query conditions, and to extract a set of row elements and a set of column elements from the query conditions. The completion module 502 is used to complete the atomic data list according to the set of row elements and the set of column elements. The totaling module 503 is used to calculate the total result of the completed atomic data list and merge the total result into the atomic data list. The conversion module 504 is used to convert the atomic data list into a report data list.
[0139] Optionally, the complementing module 502 is further configured to:
[0140] grouping the atomic data list based on the set of row elements, to obtain row groupings;
[0141] for each row grouping, judging whether the atomic data corresponding to each column element in the row grouping is missing; if so, generating the atomic data based on the data complementing rule, and complementing the atomic data to the atomic data list of the row grouping.
[0142] Optionally, the complementing module 502 is further configured to:
[0143] grouping the atomic data list based on the set of column elements, to obtain column groupings;
[0144] for each column grouping, judging whether the atomic data corresponding to each row element in the column grouping is missing; if so, generating the atomic data based on the data complementing rule, and complementing the atomic data to the atomic data list of the column grouping.
[0145] Optionally, the aggregating module 503 is further configured to:
[0146] for each row grouping, adding each atomic data in the complemented row grouping to obtain an aggregation result of the row grouping, and adding the aggregation result to the atomic data list of the row grouping.
[0147] Optionally, the aggregating module 503 is further configured to:
[0148] for each column grouping, adding each atomic data in the complemented column grouping to obtain an aggregation result of the column grouping, and adding the aggregation result to the atomic data list of the column grouping.
[0149] Optionally, the converting module 504 is further configured to:
[0150] sorting the atomic data in the atomic data list, and converting the sorted atomic data list into a report data list.
[0151] Optionally, the converting module 504 is further configured to:
[0152] sorting each row grouping;
[0153] for each row grouping, sorting the atomic data in the atomic data list of the row grouping according to column elements.
[0154] Optionally, the converting module 504 is further configured to:
[0155] sorting each column grouping;
[0156] For each of the column groups, sorting the atomic data in the atomic data list of the column group by row element.
[0157] It should be noted that the specific implementation of the device for generating report data is described in detail in the above method for generating report data, and thus the repeated content will not be described here.
[0158] Figure 6 An exemplary system architecture 600 to which embodiments of the application can apply is shown.
[0159] As shown in Figure 6 The system architecture 600 can include terminal devices 601, 602, 603, a network 604, and a server 605. The network 604 serves as a medium to provide a communication link between the terminal devices 601, 602, 603 and the server 605. The network 604 can include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.
[0160] A user can use the terminal devices 601, 602, 603 to interact with the server 605 through the network 604 to receive or send messages, etc. Various communication client applications can be installed on the terminal devices 601, 602, 603, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).
[0161] The terminal devices 601, 602, 603 can be various electronic devices with display screens and support for web browsing, including but not limited to smartphones, tablet computers, laptop computers, and desktop computers, etc.
[0162] The server 605 can be a server that provides various services, such as a background management server that provides support for shopping websites browsed by users using the terminal devices 601, 602, 603 (only as an example). The background management server can analyze and process received item information query requests and other data, and feed back the processing results (such as target push information, item information - only as examples) to the terminal devices.
[0163] It should be noted that the method for generating report data provided by the embodiments of the application is generally executed by the server 605, and accordingly, the device for generating report data is generally provided in the server 605. The method for generating report data provided by the embodiments of the application can also be executed by the terminal devices 601, 602, 603, and accordingly, the device for generating report data can be provided in the terminal devices 601, 602, 603.
[0164] It should be appreciated that Figure 6 the number of terminal devices, networks and servers in
[0165] Reference will now be made to Figure 7 which shows a schematic configuration of a computer system 700 that is suitable for use in implementing the terminal device of an embodiment of the present application. Figure 7 The terminal device shown is merely an example and should not impose any limitation on the functions and the range of use of the embodiments of the present application.
[0166] As shown in Figure 7 the computer system 700 includes a central processing unit (CPU) 701 which can perform various appropriate actions and processes in accordance with a program stored in a read only memory (ROM) 702 or a program loaded into a random access memory (RAM) 703 from a storage section 708. In the RAM 703, various programs and data required for the operation of the system 700 are also stored. The CPU 701, the ROM 702 and the RAM 703 are connected to each other through a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0167] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a display such as a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs a communication process via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as required. A removable recording medium 711 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. is attached to the drive 710 as required, so that a computer program read therefrom is installed into the storage section 708 as required.
[0168] In particular, the processes described above with reference to the flow charts can be implemented as a computer software program in accordance with the embodiments disclosed herein. For example, the embodiments disclosed herein include a computer program comprising a computer program carried on a computer readable medium, the computer program comprising program code for performing the methods illustrated in the flow charts. In such embodiments, the computer program can be downloaded and installed from a network via the communication section 709 and / or installed from the removable recording medium 711. When the computer program is executed by the central processing unit (CPU) 701, the above-described functions defined in the system of the present application are performed.
[0169] It should be noted that the computer-readable medium shown in the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or instrument, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to, an electrical connection with one or more conductive wires, 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 above. In the present application, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device or instrument. In the present application, the computer-readable signal medium can include a data signal propagating in a baseband or as a carrier wave part of a carrier wave, in which computer-readable program code is carried. Such a propagating data signal can take various forms, including but not limited to electromagnetic signals, optical signals or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, which can send, propagate or transmit a program for use by or in conjunction with an instruction execution system, device or instrument. The program code contained on the computer-readable medium can be transmitted by any suitable medium, including but not limited to wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0170] The flowcharts and block diagrams in the drawings illustrate the possible implementation architectures, functions and operations of the systems, methods and computer programs according to various embodiments of the present application. In this regard, each block in the flowchart or block diagram can represent a module, a program segment or a part of code containing one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur in different order than that shown in the drawings. For example, two blocks that are shown in succession can actually be executed substantially in parallel, and they can also be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, and the combination of blocks in the block diagram or flowchart, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0171] The modules described in the embodiments of the present application can be implemented in the form of software or hardware. The modules described can also be arranged in a processor, for example, a processor can be described as comprising a query module, a completion module, a calculation module and a conversion module, wherein the names of the modules do not constitute a limitation on the modules themselves in some cases.
[0172] As another aspect, the present application also provides a computer readable medium, which can be included in the device described in the above embodiments, or can exist independently without being assembled into the device. The computer readable medium carries one or more programs, when the one or more programs are executed by the device, the device implements the following method: obtaining an atomic data list from a database according to a query condition, and extracting a row element set and a column element set from the query condition; performing data completion on the atomic data list according to the row element set and the column element set; calculating an aggregated result of the completed atomic data list, and merging the aggregated result into the atomic data list; and converting the atomic data list into a report data list.
[0173] As another aspect, the embodiments of the present application also provide a computer program product comprising a computer program, which is executed by a processor to implement the method described in any of the above embodiments.
[0174] According to the technical scheme of the embodiments of the present application, because the atomic data list is obtained from the database according to the query condition, the row element set and the column element set are extracted from the query condition, then the atomic data list is completed and the aggregated result is calculated, and finally the atomic data list is converted into the report data list, the technical problems of low-quality code and difficult code reuse in the prior art are overcome. The embodiments of the present application can enhance code specification, improve code quality, improve code reuse rate, and reduce system complexity, thereby improving the development efficiency of report data processing, and improving system response speed and robustness.
[0175] The above specific embodiments do not constitute a limitation on the protection scope of the present application. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can be made depending on design requirements and other factors. Any modification, equivalent replacement and improvement made within the spirit and principle of the present application should be included in the protection scope of the present application.
Claims
1. A method for generating report data, characterized in that, include: Based on the query conditions, retrieve a list of atomic data from the database, and extract the travel element set and column element set from the query conditions; The atomic data in the atomic data list can be ordered or unordered; The atomic data list is completed based on the row element set and the column element set; Calculate the total result of the completed atomic data list, and merge the total result into the atomic data list; Convert the atomic data list into a report data list; Data completion is performed on the atomic data list based on the row feature set and the column feature set, including: The atomic data list is grouped based on the row element set to obtain row groups; For each row group, determine whether the atomic data corresponding to each column element in the row group is missing; if so, generate atomic data based on the data completion rules and complete the atomic data into the atomic data list of the row group. or, The atomic data list is grouped based on the set of column elements to obtain column groups; For each column group, determine whether the atomic data corresponding to each row element in the column group is missing; if so, generate atomic data based on the data completion rules and complete the atomic data into the atomic data list of the column group.
2. The method according to claim 1, characterized in that, Calculate the total result of the completed atomic data list, and merge the total result into the atomic data list, including: For each row group, the atomic data in the completed row group are added together to obtain the total result of the row group, and the total result is added to the atomic data list of the row group.
3. The method according to claim 1, characterized in that, Calculate the total result of the completed atomic data list, and merge the total result into the atomic data list, including: For each column group, the atomic data in the completed column group are added together to obtain the total result of the column group, and the total result is added to the atomic data list of the column group.
4. The method according to claim 1, characterized in that, Converting the atomic data list into a report data list includes: The atomic data in the atomic data list are sorted, and the sorted atomic data list is converted into a report data list.
5. The method according to claim 4, characterized in that, Sort the atomic data in the atomic data list, including: Sort the rows into groups; For each row group, the atomic data in the atomic data list of the row group are sorted according to the column elements.
6. The method according to claim 4, characterized in that, Sort the atomic data in the atomic data list, including: Sort the groups by column; For each column group, the atomic data in the atomic data list of the column group are sorted according to the row elements.
7. An apparatus for generating report data, characterized in that, include: The query module is used to retrieve a list of atomic data from the database based on query conditions, and to extract a set of travel elements and a set of column elements from the query conditions. The atomic data in the atomic data list can be ordered or unordered; The completion module is used to complete the atomic data list based on the row element set and the column element set; The totaling module is used to calculate the total result of the completed atomic data list and merge the total result into the atomic data list; The conversion module is used to convert the atomic data list into a report data list; The completion module is also used for: The atomic data list is grouped based on the row element set to obtain row groups; For each row group, determine whether the atomic data corresponding to each column element in the row group is missing; if so, generate atomic data based on the data completion rules and complete the atomic data into the atomic data list of the row group. or, The atomic data list is grouped based on the set of column elements to obtain column groups; For each column group, determine whether the atomic data corresponding to each row element in the column group is missing; if so, generate atomic data based on the data completion rules and complete the atomic data into the atomic data list of the column group.
8. The apparatus according to claim 7, characterized in that, The aggregation module is also used for: For each row group, the atomic data in the completed row group are added together to obtain the total result of the row group, and the total result is added to the atomic data list of the row group.
9. The apparatus according to claim 7, characterized in that, The aggregation module is also used for: For each column group, the atomic data in the completed column group are added together to obtain the total result of the column group, and the total result is added to the atomic data list of the column group.
10. The apparatus according to claim 7, characterized in that, The conversion module is also used for: The atomic data in the atomic data list are sorted, and the sorted atomic data list is converted into a report data list.
11. The apparatus according to claim 10, characterized in that, The conversion module is also used for: Sort the rows into groups; For each row group, the atomic data in the atomic data list of the row group are sorted according to the column elements.
12. The apparatus according to claim 10, characterized in that, The conversion module is also used for: Sort the groups by column; For each column group, the atomic data in the atomic data list of the column group are sorted according to the row elements.
13. An electronic device, characterized in that, include: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-6.
14. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-6.
15. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1-6.
Citation Information
Patent Citations
Time series data complement method, device and electronic device
CN109460398A
Graphical user interface for refocusing the scope of a series of queries
US20200371678A1